39 #define V2_INTRA_CBPC_VLC_BITS 3
40 #define V2_MB_TYPE_VLC_BITS 7
42 #define V2_MV_VLC_BITS 9
43 #define TEX_VLC_BITS 9
45 #define DEFAULT_INTER_INDEX 3
79 ff_dlog(s,
"MV code %d at %d %d pred: %d\n", code, s->
mb_x,s->
mb_y, pred);
89 val = (val - 1) << shift;
131 if(code<0 || code>7){
185 for (i = 0; i < 6; i++) {
234 int val = ((code >> (5 - i)) & 1);
240 cbp |= val << (5 - i);
260 ((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0),
276 for (i = 0; i < 6; i++) {
291 static volatile int done = 0;
386 if (CONFIG_WMV2_DECODER)
404 if(start_code!=0x00000100){
422 if(!had_i)
return -1;
558 if(left>=length && left<length+8)
567 else if(left<length+8)
613 }
else if (level != 0) {
644 int n,
int coded,
const uint8_t *scan_table)
684 if (dc_pred_dir == 0)
694 qadd = (s->
qscale - 1) | 1;
763 if(sign) level= -
level;
766 #if 0 // waste of time / this will detect very few errors
768 const int abs_level=
FFABS(level);
769 const int run1= run - rl->
max_run[last][abs_level] - run_diff;
771 if(abs_level <= rl->max_level[last][run]){
773 return DECODING_AC_LOST;
775 if(abs_level <= rl->max_level[last][run]*2){
777 return DECODING_AC_LOST;
779 if(run1>=0 && abs_level <= rl->max_level[last][run1]){
781 return DECODING_AC_LOST;
787 if (level>0) level= level * qmul + qadd;
788 else level= level * qmul - qadd;
789 #if 0 // waste of time too :(
790 if(level>2048 || level<-2048){
792 return DECODING_AC_LOST;
800 else if((i>62 && i<192) || i>192+63)
807 i+= run + rl->
max_run[run>>7][level/qmul] + run_diff;
813 else if((i>62 && i<192) || i>192+63)
822 level = level + rl->
max_level[run>>7][(run-1)&63] * qmul;
828 else if((i>62 && i<192) || i>192+63)
839 else if((i>62 && i<192) || i>192+63)
847 if (((i + 192 == 64 && level / qmul == -1) ||
859 block[scan_table[i]] =
level;
863 block[scan_table[i]] =
level;
881 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
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
void(* clear_blocks)(int16_t *blocks)
static VLC v2_dc_chroma_vlc
#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)
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
uint8_t ff_static_rl_table_store[NB_RL_TABLES][2][2 *MAX_RUN+MAX_LEVEL+3]
const uint8_t ff_mvtab[33][2]
int no_rounding
apply no rounding to motion compensation (MPEG4, msmpeg4, ...) for b-frames rounding mode is always 0...
static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64])
Picture current_picture
copy of the current picture structure.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
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 MPEG1
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)
Libavcodec external API header.
#define V2_INTRA_CBPC_VLC_BITS
#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)
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.
#define CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
const uint8_t * table_mvx
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
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, ...
int bit_rate
wanted bit rate
static const uint8_t start_code[]
RLTable ff_rl_table[NB_RL_TABLES]
static VLC v2_mb_type_vlc
#define FF_DEBUG_PICT_INFO
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
struct AVCodecContext * avctx
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
#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 ...
#define AV_EF_BITSTREAM
detect bitstream specification deviations
AVCodec ff_msmpeg4v3_decoder
int ff_h263_decode_end(AVCodecContext *avctx)
const uint32_t(*const [WMV2_INTER_CBP_TABLE_COUNT] ff_wmv2_inter_table)[2]
int16_t(* block)[64]
points to one of the following blocks
static int decode012(GetBitContext *gb)
VLC_TYPE(* table)[2]
code, bits
int ff_msmpeg4_decode_motion(MpegEncContext *s, int *mx_ptr, int *my_ptr)
#define AV_EF_COMPLIANT
consider all spec non compliances as errors
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 tha cache usage
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.
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]