38 #define V2_INTRA_CBPC_VLC_BITS 3
39 #define V2_MB_TYPE_VLC_BITS 7
41 #define V2_MV_VLC_BITS 9
42 #define TEX_VLC_BITS 9
44 #define DEFAULT_INTER_INDEX 3
78 ff_dlog(s,
"MV code %d at %d %d pred: %d\n", code, s->
mb_x,s->
mb_y, pred);
88 val = (val - 1) << shift;
130 if(code<0 || code>7){
184 for (i = 0; i < 6; i++) {
233 int val = ((code >> (5 - i)) & 1);
239 cbp |= val << (5 - i);
259 ((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0),
275 for (i = 0; i < 6; i++) {
290 static volatile int done = 0;
385 if (CONFIG_WMV2_DECODER)
403 if(start_code!=0x00000100){
421 if(!had_i)
return -1;
557 if(left>=length && left<length+8)
566 else if(left<length+8)
612 }
else if (level != 0) {
642 int n,
int coded,
const uint8_t *scan_table)
682 if (dc_pred_dir == 0)
692 qadd = (s->
qscale - 1) | 1;
761 if(sign) level= -
level;
765 if (level>0) level= level * qmul + qadd;
766 else level= level * qmul - qadd;
773 i+= run + rl->
max_run[run>>7][level/qmul] + run_diff;
782 level = level + rl->
max_level[run>>7][(run-1)&63] * qmul;
795 if (((i + 192 == 64 && level / qmul == -1) ||
807 block[scan_table[i]] =
level;
811 block[scan_table[i]] =
level;
829 int *mx_ptr,
int *my_ptr)
#define DEFAULT_INTER_INDEX
const char const char void * val
ScanTable intra_v_scantable
static int shift(int a, int b)
static int msmpeg4v2_decode_motion(MpegEncContext *s, int pred, int f_code)
VLC ff_mb_non_intra_vlc[4]
uint32_t ff_v2_dc_lum_table[512][2]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
const uint32_t ff_table0_dc_lum[120][2]
static av_cold int init(AVCodecContext *avctx)
VLC ff_h263_intra_MCBPC_vlc
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
uint32_t ff_v2_dc_chroma_table[512][2]
#define SKIP_COUNTER(name, gb, num)
int msmpeg4_version
0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 4=wmv1/7 5=wmv2/8
#define AV_EF_COMPLIANT
consider all spec non compliances as errors
void(* clear_blocks)(int16_t *blocks)
static VLC v2_dc_chroma_vlc
#define AV_EF_BITSTREAM
detect bitstream specification deviations
#define MB_NON_INTRA_VLC_BITS
av_cold void ff_msmpeg4_common_init(MpegEncContext *s)
int16_t * ff_h263_pred_motion(MpegEncContext *s, int block, int dir, int *px, int *py)
int8_t * max_run[2]
encoding & decoding
const uint8_t ff_v2_intra_cbpc[4][2]
int ff_msmpeg4_decode_block(MpegEncContext *s, int16_t *block, int n, int coded, const uint8_t *scan_table)
uint8_t ff_static_rl_table_store[NB_RL_TABLES][2][2 *MAX_RUN+MAX_LEVEL+3]
#define FF_DEBUG_PICT_INFO
int no_rounding
apply no rounding to motion compensation (MPEG-4, msmpeg4, ...) for B-frames rounding mode is always ...
static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64])
Picture current_picture
copy of the current picture structure.
static int get_bits_count(const GetBitContext *s)
int8_t * max_level[2]
encoding & decoding
const uint32_t ff_table0_dc_chroma[120][2]
int mb_height
number of MBs horizontally & vertically
static int msmpeg4v1_pred_dc(MpegEncContext *s, int n, int32_t **dc_val_ptr)
static int get_bits_left(GetBitContext *gb)
#define UPDATE_CACHE(name, gb)
const uint16_t ff_msmp4_mb_i_table[64][2]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int last_dc[3]
last DC values for MPEG-1
static int msmpeg4v34_decode_mb(MpegEncContext *s, int16_t block[6][64])
int rl_chroma_table_index
int ff_msmpeg4_decode_picture_header(MpegEncContext *s)
int mb_skipped
MUST BE SET only during DECODING.
void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n, int dir)
Predict the ac.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define INTER_MCBPC_VLC_BITS
const char * name
Name of the codec implementation.
int(* decode_mb)(struct MpegEncContext *s, int16_t block[6][64])
#define CLOSE_READER(name, gb)
#define INIT_VLC_RL(rl, static_size)
#define V2_INTRA_CBPC_VLC_BITS
#define GET_RL_VLC(level, run, name, gb, table, bits,max_depth, need_update)
#define SKIP_BITS(name, gb, num)
int ff_h263_decode_init(AVCodecContext *avctx)
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
VLC ff_h263_inter_MCBPC_vlc
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
const uint8_t ff_v2_mb_type[8][2]
int ff_msmpeg4_pred_dc(MpegEncContext *s, int n, int16_t **dc_val_ptr, int *dir_ptr)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
const uint8_t * table_mvx
static const uint8_t start_code[]
int width
picture width / height.
const uint8_t * table_mv_bits
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
static int msmpeg4_decode_dc(MpegEncContext *s, int n, int *dir_ptr)
#define LAST_SKIP_BITS(name, gb, num)
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
int block_last_index[12]
last non zero coefficient in block
const uint32_t ff_table1_dc_chroma[120][2]
RL_VLC_ELEM * rl_vlc[32]
decoding only
#define SHOW_UBITS(name, gb, num)
int ff_msmpeg4_decode_ext_header(MpegEncContext *s, int buf_size)
static const float pred[4]
static const int8_t mv[256][2]
AVCodec ff_msmpeg4v1_decoder
#define MV_TYPE_16X16
1 vector for the whole mb
Libavcodec external API header.
const uint32_t(*const [WMV2_INTER_CBP_TABLE_COUNT] ff_wmv2_inter_table)[2]
AVCodec ff_msmpeg4v2_decoder
main external API structure.
static VLC v2_intra_cbpc_vlc
ScanTable intra_scantable
int height
picture size. must be a multiple of 16
#define OPEN_READER(name, gb)
const uint16_t * table_mv_code
av_cold int ff_rl_init(RLTable *rl, uint8_t static_store[2][2 *MAX_RUN+MAX_LEVEL+3])
const uint32_t ff_table1_dc_lum[120][2]
static unsigned int get_bits1(GetBitContext *s)
#define V2_MB_TYPE_VLC_BITS
ScanTable intra_h_scantable
static void skip_bits(GetBitContext *s, int n)
#define GET_CACHE(name, gb)
#define MB_INTRA_VLC_BITS
int slice_height
in macroblocks
#define SKIP_CACHE(name, gb, num)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
static enum AVPixelFormat pix_fmts[]
RLTable ff_rl_table[NB_RL_TABLES]
static VLC v2_mb_type_vlc
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
struct AVCodecContext * avctx
#define SHOW_SBITS(name, gb, num)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
AVCodec ff_msmpeg4v3_decoder
int ff_h263_decode_end(AVCodecContext *avctx)
int16_t(* block)[64]
points to one of the following blocks
static int decode012(GetBitContext *gb)
VLC_TYPE(* table)[2]
code, bits
int64_t bit_rate
wanted bit rate
int ff_msmpeg4_decode_motion(MpegEncContext *s, int *mx_ptr, int *my_ptr)
int chroma_qscale
chroma QP
#define INTER_INTRA_VLC_BITS
uint32_t * mb_type
types and macros are defined in mpegutils.h
const uint8_t * table_mvy
ScanTable inter_scantable
if inter == intra then intra should be used to reduce the cache usage
static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt)
int ff_msmpeg4_coded_block_pred(MpegEncContext *s, int n, uint8_t **coded_block_ptr)
int h263_aic_dir
AIC direction: 0 = left, 1 = top.
int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
AVPixelFormat
Pixel format.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
const uint8_t ff_table_inter_intra[4][2]
VLC ff_msmp4_dc_luma_vlc[2]
#define INTRA_MCBPC_VLC_BITS
av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
VLC ff_msmp4_dc_chroma_vlc[2]
const uint8_t ff_mvtab[33][2]