libavcodec/h263.c File Reference

h263/mpeg4 codec. More...

#include <limits.h>
#include "dsputil.h"
#include "avcodec.h"
#include "mpegvideo.h"
#include "h263data.h"
#include "mpeg4data.h"
#include "mathops.h"

Go to the source code of this file.

Defines

#define INTRA_MCBPC_VLC_BITS   6
#define INTER_MCBPC_VLC_BITS   7
#define CBPY_VLC_BITS   6
#define MV_VLC_BITS   9
#define DC_VLC_BITS   9
#define SPRITE_TRAJ_VLC_BITS   6
#define MB_TYPE_B_VLC_BITS   4
#define TEX_VLC_BITS   9
#define H263_MBTYPE_B_VLC_BITS   6
#define CBPC_B_VLC_BITS   3
#define IS_3IV1   0
#define tab_size   ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0]))
#define tab_bias   (tab_size/2)

Functions

static void h263_encode_block (MpegEncContext *s, DCTELEM *block, int n)
static void h263p_encode_umotion (MpegEncContext *s, int val)
static void mpeg4_encode_block (MpegEncContext *s, DCTELEM *block, int n, int dc, uint8_t *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb)
static int mpeg4_get_block_length (MpegEncContext *s, DCTELEM *block, int n, int intra_dc, uint8_t *scan_table)
static int h263_decode_motion (MpegEncContext *s, int pred, int fcode)
static int h263p_decode_umotion (MpegEncContext *s, int pred)
static int h263_decode_block (MpegEncContext *s, DCTELEM *block, int n, int coded)
static int mpeg4_decode_dc (MpegEncContext *s, int n, int *dir_ptr)
 decodes the dc value.
static int mpeg4_decode_block (MpegEncContext *s, DCTELEM *block, int n, int coded, int intra, int rvlc)
 decodes a block.
static int h263_pred_dc (MpegEncContext *s, int n, int16_t **dc_val_ptr)
static void mpeg4_encode_visual_object_header (MpegEncContext *s)
static void mpeg4_encode_vol_header (MpegEncContext *s, int vo_number, int vol_number)
static void mpeg4_decode_sprite_trajectory (MpegEncContext *s, GetBitContext *gb)
static int ff_mpeg4_pred_dc (MpegEncContext *s, int n, int level, int *dir_ptr, int encoding)
 predicts the dc.
int h263_get_picture_format (int width, int height)
static void show_pict_info (MpegEncContext *s)
void ff_mpeg4_init_direct_mv (MpegEncContext *s)
static void ff_mpeg4_set_one_direct_mv (MpegEncContext *s, int mx, int my, int i)
int ff_mpeg4_set_direct_mv (MpegEncContext *s, int mx, int my)
void ff_h263_update_motion_val (MpegEncContext *s)
void ff_h263_loop_filter (MpegEncContext *s)
static void h263_pred_acdc (MpegEncContext *s, DCTELEM *block, int n)
int16_t * h263_pred_motion (MpegEncContext *s, int block, int dir, int *px, int *py)
void mpeg4_pred_ac (MpegEncContext *s, DCTELEM *block, int n, int dir)
 predicts the ac.
void h263_decode_init_vlc (MpegEncContext *s)
int ff_h263_get_gob_height (MpegEncContext *s)
 Get the GOB height based on picture height.
int ff_h263_decode_mba (MpegEncContext *s)
void ff_h263_encode_mba (MpegEncContext *s)
static int h263_decode_gob_header (MpegEncContext *s)
 decodes the group of blocks header or slice header.
static void memsetw (short *tab, int val, int n)
int ff_mpeg4_get_video_packet_prefix_length (MpegEncContext *s)
static int mpeg4_is_resync (MpegEncContext *s)
 check if the next stuff is a resync marker or the end.
static int mpeg4_decode_video_packet_header (MpegEncContext *s)
 decodes the next video packet.
void ff_mpeg4_clean_buffers (MpegEncContext *s)
const uint8_t * ff_h263_find_resync_marker (const uint8_t *restrict p, const uint8_t *restrict end)
 finds the next resync_marker
int ff_h263_resync (MpegEncContext *s)
 decodes the group of blocks / video packet header.
static int get_amv (MpegEncContext *s, int n)
 gets the average motion vector for a GMC MB.
static int mpeg4_decode_partition_a (MpegEncContext *s)
 decodes first partition.
static int mpeg4_decode_partition_b (MpegEncContext *s, int mb_count)
 decode second partition.
int ff_mpeg4_decode_partitions (MpegEncContext *s)
 decodes the first & second partition
static int mpeg4_decode_partitioned_mb (MpegEncContext *s, DCTELEM block[6][64])
 decode partition C of one MB.
static void preview_obmc (MpegEncContext *s)
 read the next MVs for OBMC.
static void h263_decode_dquant (MpegEncContext *s)
int ff_h263_decode_mb (MpegEncContext *s, DCTELEM block[6][64])
int ff_mpeg4_decode_mb (MpegEncContext *s, DCTELEM block[6][64])
int h263_decode_picture_header (MpegEncContext *s)
static int mpeg4_decode_gop_header (MpegEncContext *s, GetBitContext *gb)
static int decode_vol_header (MpegEncContext *s, GetBitContext *gb)
static int decode_user_data (MpegEncContext *s, GetBitContext *gb)
 decodes the user data stuff in the header.
static int decode_vop_header (MpegEncContext *s, GetBitContext *gb)
int ff_mpeg4_decode_picture_header (MpegEncContext *s, GetBitContext *gb)
 decode mpeg4 headers
int intel_h263_decode_picture_header (MpegEncContext *s)
int flv_h263_decode_picture_header (MpegEncContext *s)

Variables

static uint8_t static_rl_table_store [5][2][2 *MAX_RUN+MAX_LEVEL+3]
static VLC intra_MCBPC_vlc
static VLC inter_MCBPC_vlc
static VLC cbpy_vlc
static VLC mv_vlc
static VLC dc_lum
static VLC dc_chrom
static VLC sprite_trajectory
static VLC mb_type_b_vlc
static VLC h263_mbtype_b_vlc
static VLC cbpc_b_vlc


Detailed Description

h263/mpeg4 codec.

Definition in file h263.c.


Define Documentation

#define CBPC_B_VLC_BITS   3

Definition at line 56 of file h263.c.

Referenced by ff_h263_decode_mb(), and h263_decode_init_vlc().

#define CBPY_VLC_BITS   6

#define DC_VLC_BITS   9

#define H263_MBTYPE_B_VLC_BITS   6

Definition at line 55 of file h263.c.

Referenced by ff_h263_decode_mb(), and h263_decode_init_vlc().

#define INTER_MCBPC_VLC_BITS   7

#define INTRA_MCBPC_VLC_BITS   6

#define IS_3IV1   0

Definition at line 118 of file h263.c.

Referenced by decode_vop_header(), ff_mpeg4_pred_dc(), mpeg4_decode_block(), and mpeg4_decode_dc().

#define MB_TYPE_B_VLC_BITS   4

Definition at line 53 of file h263.c.

Referenced by ff_mpeg4_decode_mb(), and h263_decode_init_vlc().

#define MV_VLC_BITS   9

#define SPRITE_TRAJ_VLC_BITS   6

Definition at line 52 of file h263.c.

Referenced by h263_decode_init_vlc(), and mpeg4_decode_sprite_trajectory().

#define tab_bias   (tab_size/2)

Definition at line 590 of file h263.c.

Referenced by ff_mpeg4_init_direct_mv(), and ff_mpeg4_set_one_direct_mv().

#define tab_size   ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0]))

Definition at line 589 of file h263.c.

Referenced by ff_mpeg4_init_direct_mv(), and ff_mpeg4_set_one_direct_mv().

#define TEX_VLC_BITS   9

Definition at line 54 of file h263.c.


Function Documentation

static int decode_user_data ( MpegEncContext s,
GetBitContext gb 
) [static]

decodes the user data stuff in the header.

Also initializes divx/xvid/lavc_version/build.

Definition at line 5806 of file h263.c.

Referenced by ff_mpeg4_decode_picture_header().

static int decode_vol_header ( MpegEncContext s,
GetBitContext gb 
) [static]

Definition at line 5492 of file h263.c.

Referenced by ff_mpeg4_decode_picture_header().

static int decode_vop_header ( MpegEncContext s,
GetBitContext gb 
) [static]

Definition at line 5861 of file h263.c.

Referenced by ff_mpeg4_decode_picture_header().

int ff_h263_decode_mb ( MpegEncContext s,
DCTELEM  block[6][64] 
)

Definition at line 3908 of file h263.c.

Referenced by ff_h263_decode_init(), and rv10_decode_packet().

int ff_h263_decode_mba ( MpegEncContext s  ) 

void ff_h263_encode_mba ( MpegEncContext s  ) 

Definition at line 2978 of file h263.c.

const uint8_t* ff_h263_find_resync_marker ( const uint8_t *restrict  p,
const uint8_t *restrict  end 
)

finds the next resync_marker

Parameters:
p pointer to buffer to scan
end pointer to the end of the buffer
Returns:
pointer to the next resync_marker, or end if none was found

Definition at line 3301 of file h263.c.

Referenced by decode_slice().

int ff_h263_get_gob_height ( MpegEncContext s  ) 

Get the GOB height based on picture height.

Definition at line 2955 of file h263.c.

Referenced by encode_thread(), and ff_h263_decode_frame().

void ff_h263_loop_filter ( MpegEncContext s  ) 

Definition at line 1464 of file h263.c.

Referenced by decode_slice(), encode_thread(), and rv10_decode_packet().

int ff_h263_resync ( MpegEncContext s  ) 

decodes the group of blocks / video packet header.

Returns:
bit position of the resync_marker, or <0 if none was found

Definition at line 3320 of file h263.c.

Referenced by ff_h263_decode_frame().

void ff_h263_update_motion_val ( MpegEncContext s  ) 

Definition at line 686 of file h263.c.

Referenced by decode_slice(), encode_thread(), and rv10_decode_packet().

void ff_mpeg4_clean_buffers ( MpegEncContext s  ) 

Definition at line 3264 of file h263.c.

Referenced by encode_thread(), and ff_h263_decode_frame().

int ff_mpeg4_decode_mb ( MpegEncContext s,
DCTELEM  block[6][64] 
)

Definition at line 4174 of file h263.c.

Referenced by decode_vop_header(), and ff_h263_decode_init().

int ff_mpeg4_decode_partitions ( MpegEncContext s  ) 

decodes the first & second partition

Returns:
<0 if error (and sets error type in the error_status_table)

Definition at line 3664 of file h263.c.

Referenced by decode_slice().

int ff_mpeg4_decode_picture_header ( MpegEncContext s,
GetBitContext gb 
)

decode mpeg4 headers

Returns:
<0 if no VOP found (or a damaged one) FRAME_SKIPPED if a not coded VOP is found 0 if a VOP is found

Definition at line 6080 of file h263.c.

Referenced by av_mpeg4_decode_header(), and ff_h263_decode_frame().

int ff_mpeg4_get_video_packet_prefix_length ( MpegEncContext s  ) 

Definition at line 3094 of file h263.c.

Referenced by mpeg4_decode_video_packet_header(), and mpeg4_is_resync().

void ff_mpeg4_init_direct_mv ( MpegEncContext s  ) 

Definition at line 592 of file h263.c.

Referenced by decode_vop_header(), and rv20_decode_picture_header().

static int ff_mpeg4_pred_dc ( MpegEncContext s,
int  n,
int  level,
int *  dir_ptr,
int  encoding 
) [inline, static]

predicts the dc.

encoding quantized level -> quantized diff decoding quantized diff -> quantized level

Parameters:
n block index (0-3 are luma, 4-5 are chroma)
dir_ptr pointer to an integer where the prediction direction will be stored

Definition at line 2522 of file h263.c.

Referenced by mpeg4_decode_block(), and mpeg4_decode_dc().

int ff_mpeg4_set_direct_mv ( MpegEncContext s,
int  mx,
int  my 
)

Returns:
the mb_type

Definition at line 635 of file h263.c.

Referenced by encode_thread(), ff_h263_decode_mb(), and ff_mpeg4_decode_mb().

static void ff_mpeg4_set_one_direct_mv ( MpegEncContext s,
int  mx,
int  my,
int  i 
) [inline, static]

Definition at line 600 of file h263.c.

Referenced by ff_mpeg4_set_direct_mv().

int flv_h263_decode_picture_header ( MpegEncContext s  ) 

Definition at line 6265 of file h263.c.

Referenced by ff_h263_decode_frame().

static int get_amv ( MpegEncContext s,
int  n 
) [inline, static]

gets the average motion vector for a GMC MB.

Parameters:
n either 0 for the x component or 1 for y
Returns:
the average MV for a GMC MB

Definition at line 3367 of file h263.c.

Referenced by ff_mpeg4_decode_mb(), and mpeg4_decode_partition_a().

static int h263_decode_block ( MpegEncContext s,
DCTELEM block,
int  n,
int  coded 
) [static]

Definition at line 4567 of file h263.c.

Referenced by ff_h263_decode_mb().

static void h263_decode_dquant ( MpegEncContext s  )  [static]

Definition at line 3895 of file h263.c.

Referenced by ff_h263_decode_mb().

static int h263_decode_gob_header ( MpegEncContext s  )  [static]

decodes the group of blocks header or slice header.

Returns:
<0 if an error occurred

Definition at line 2993 of file h263.c.

Referenced by ff_h263_resync().

void h263_decode_init_vlc ( MpegEncContext s  ) 

Definition at line 2902 of file h263.c.

Referenced by ff_h263_decode_init(), and rv10_decode_init().

static int h263_decode_motion ( MpegEncContext s,
int  pred,
int  fcode 
) [static]

int h263_decode_picture_header ( MpegEncContext s  ) 

Definition at line 5001 of file h263.c.

Referenced by ff_h263_decode_frame().

static void h263_encode_block ( MpegEncContext s,
DCTELEM block,
int  n 
) [static]

int h263_get_picture_format ( int  width,
int  height 
)

Definition at line 121 of file h263.c.

Referenced by MPV_encode_init().

static void h263_pred_acdc ( MpegEncContext s,
DCTELEM block,
int  n 
) [static]

Definition at line 1598 of file h263.c.

Referenced by h263_decode_block().

static int h263_pred_dc ( MpegEncContext s,
int  n,
int16_t **  dc_val_ptr 
) [static]

int16_t* h263_pred_motion ( MpegEncContext s,
int  block,
int  dir,
int *  px,
int *  py 
)

static int h263p_decode_umotion ( MpegEncContext s,
int  pred 
) [static]

Definition at line 4542 of file h263.c.

Referenced by ff_h263_decode_mb(), and preview_obmc().

static void h263p_encode_umotion ( MpegEncContext s,
int  val 
) [static]

int intel_h263_decode_picture_header ( MpegEncContext s  ) 

Definition at line 6167 of file h263.c.

Referenced by ff_h263_decode_frame().

static void memsetw ( short *  tab,
int  val,
int  n 
) [inline, static]

Definition at line 3044 of file h263.c.

Referenced by ff_mpeg4_clean_buffers().

static int mpeg4_decode_block ( MpegEncContext s,
DCTELEM block,
int  n,
int  coded,
int  intra,
int  rvlc 
) [inline, static]

decodes a block.

Returns:
<0 if an error occurred

Definition at line 4748 of file h263.c.

Referenced by ff_mpeg4_decode_mb(), and mpeg4_decode_partitioned_mb().

static int mpeg4_decode_dc ( MpegEncContext s,
int  n,
int *  dir_ptr 
) [inline, static]

decodes the dc value.

Parameters:
n block index (0-3 are luma, 4-5 are chroma)
dir_ptr the prediction direction will be stored here
Returns:
the quantized dc

Definition at line 4703 of file h263.c.

Referenced by mpeg4_decode_block(), mpeg4_decode_partition_a(), and mpeg4_decode_partition_b().

static int mpeg4_decode_gop_header ( MpegEncContext s,
GetBitContext gb 
) [static]

Definition at line 5476 of file h263.c.

Referenced by ff_mpeg4_decode_picture_header().

static int mpeg4_decode_partition_a ( MpegEncContext s  )  [static]

decodes first partition.

Returns:
number of MBs decoded or <0 if an error occurred

Definition at line 3412 of file h263.c.

Referenced by ff_mpeg4_decode_partitions().

static int mpeg4_decode_partition_b ( MpegEncContext s,
int  mb_count 
) [static]

decode second partition.

Returns:
<0 if an error occurred

Definition at line 3577 of file h263.c.

Referenced by ff_mpeg4_decode_partitions().

static int mpeg4_decode_partitioned_mb ( MpegEncContext s,
DCTELEM  block[6][64] 
) [static]

decode partition C of one MB.

Returns:
<0 if an error occurred

Definition at line 3717 of file h263.c.

Referenced by decode_vop_header().

static void mpeg4_decode_sprite_trajectory ( MpegEncContext s,
GetBitContext gb 
) [static]

Definition at line 5267 of file h263.c.

Referenced by decode_vop_header(), and mpeg4_decode_video_packet_header().

static int mpeg4_decode_video_packet_header ( MpegEncContext s  )  [static]

decodes the next video packet.

Returns:
<0 if something went wrong

Definition at line 3175 of file h263.c.

Referenced by ff_h263_resync().

static void mpeg4_encode_block ( MpegEncContext s,
DCTELEM block,
int  n,
int  dc,
uint8_t *  scan_table,
PutBitContext dc_pb,
PutBitContext ac_pb 
) [inline, static]

static void mpeg4_encode_visual_object_header ( MpegEncContext s  )  [static]

static void mpeg4_encode_vol_header ( MpegEncContext s,
int  vo_number,
int  vol_number 
) [static]

static int mpeg4_get_block_length ( MpegEncContext s,
DCTELEM block,
int  n,
int  intra_dc,
uint8_t *  scan_table 
) [static]

static int mpeg4_is_resync ( MpegEncContext s  )  [inline, static]

check if the next stuff is a resync marker or the end.

Returns:
0 if not

Definition at line 3128 of file h263.c.

Referenced by ff_mpeg4_decode_mb(), and mpeg4_decode_partitioned_mb().

void mpeg4_pred_ac ( MpegEncContext s,
DCTELEM block,
int  n,
int  dir 
)

predicts the ac.

Parameters:
n block index (0-3 are luma, 4-5 are chroma)
dir the ac prediction direction

Definition at line 2599 of file h263.c.

Referenced by ff_msmpeg4_decode_block(), and mpeg4_decode_block().

static void preview_obmc ( MpegEncContext s  )  [static]

read the next MVs for OBMC.

yes this is a ugly hack, feel free to send a patch :)

Definition at line 3803 of file h263.c.

Referenced by ff_h263_decode_mb().

static void show_pict_info ( MpegEncContext s  )  [static]

Definition at line 140 of file h263.c.

Referenced by h263_decode_picture_header(), and intel_h263_decode_picture_header().


Variable Documentation

VLC cbpc_b_vlc [static]

Definition at line 2897 of file h263.c.

VLC cbpy_vlc [static]

Definition at line 2891 of file h263.c.

VLC dc_chrom [static]

Definition at line 2893 of file h263.c.

VLC dc_lum [static]

Definition at line 2893 of file h263.c.

Definition at line 2896 of file h263.c.

VLC inter_MCBPC_vlc [static]

Definition at line 2890 of file h263.c.

VLC intra_MCBPC_vlc [static]

Definition at line 2889 of file h263.c.

VLC mb_type_b_vlc [static]

Definition at line 2895 of file h263.c.

VLC mv_vlc [static]

Definition at line 2892 of file h263.c.

Definition at line 2894 of file h263.c.

uint8_t static_rl_table_store[5][2][2 *MAX_RUN+MAX_LEVEL+3] [static]

Definition at line 113 of file h263.c.

Referenced by ff_msmpeg4_decode_init(), and h263_decode_init_vlc().


Generated on Fri Oct 26 02:35:43 2012 for FFmpeg by  doxygen 1.5.8