36 #define V2_INTRA_CBPC_VLC_BITS 3
37 #define V2_MB_TYPE_VLC_BITS 7
39 #define V2_MV_VLC_BITS 9
40 #define TEX_VLC_BITS 9
42 #define DEFAULT_INTER_INDEX 3
73 int code, val, sign, shift;
76 av_dlog(s,
"MV code %d at %d %d pred: %d\n", code, s->
mb_x,s->
mb_y, pred);
86 val = (val - 1) << shift;
126 if(code<0 || code>7){
178 for (i = 0; i < 6; i++) {
227 int val = ((code >> (5 - i)) & 1);
233 cbp |= val << (5 - i);
253 ((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0),
269 for (i = 0; i < 6; i++) {
395 if(start_code!=0x00000100){
413 if(!had_i)
return -1;
549 if(left>=length && left<length+8)
558 else if(left<length+8)
600 }
else if (level != 0) {
631 int n,
int coded,
const uint8_t *scan_table)
672 if (dc_pred_dir == 0)
682 qadd = (s->
qscale - 1) | 1;
751 if(sign) level= -
level;
754 #if 0 // waste of time / this will detect very few errors
756 const int abs_level=
FFABS(level);
757 const int run1= run - rl->
max_run[last][abs_level] - run_diff;
759 if(abs_level <= rl->max_level[last][run]){
761 return DECODING_AC_LOST;
763 if(abs_level <= rl->max_level[last][run]*2){
765 return DECODING_AC_LOST;
767 if(run1>=0 && abs_level <= rl->max_level[last][run1]){
769 return DECODING_AC_LOST;
775 if (level>0) level= level * qmul + qadd;
776 else level= level * qmul - qadd;
777 #if 0 // waste of time too :(
778 if(level>2048 || level<-2048){
780 return DECODING_AC_LOST;
788 else if((i>62 && i<192) || i>192+63)
795 i+= run + rl->
max_run[run>>7][level/qmul] + run_diff;
801 else if((i>62 && i<192) || i>192+63)
810 level = level + rl->
max_level[run>>7][(run-1)&63] * qmul;
816 else if((i>62 && i<192) || i>192+63)
827 else if((i>62 && i<192) || i>192+63)
844 block[scan_table[i]] =
level;
848 block[scan_table[i]] =
level;
866 int *mx_ptr,
int *my_ptr)
#define DEFAULT_INTER_INDEX
ScanTable intra_v_scantable
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]
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
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
#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)
#define CONFIG_WMV2_DECODER
int8_t * max_run[2]
encoding & decoding
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
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]
#define FF_DEBUG_PICT_INFO
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
void av_log(void *avcl, int level, const char *fmt,...)
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)
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)
#define CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
const uint8_t * table_mvx
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.
AVCodec ff_msmpeg4v2_decoder
main external API structure.
static VLC v2_intra_cbpc_vlc
static void close(AVCodecParserContext *s)
ScanTable intra_scantable
int height
picture size. must be a multiple of 16
#define OPEN_READER(name, gb)
const uint16_t * table_mv_code
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
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)
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
AVCodec ff_msmpeg4v3_decoder
static av_cold int init(AVCodecParserContext *s)
int ff_h263_decode_end(AVCodecContext *avctx)
const uint32_t(*const [WMV2_INTER_CBP_TABLE_COUNT] ff_wmv2_inter_table)[2]
av_cold void ff_init_rl(RLTable *rl, uint8_t static_store[2][2 *MAX_RUN+MAX_LEVEL+3])
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)
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.
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]