28 #define UNCHECKED_BITSTREAM_READER 1
70 #define INIT_2D_VLC_RL(rl, static_size)\
72 static RL_VLC_ELEM rl_vlc_table[static_size];\
73 rl.rl_vlc[0] = rl_vlc_table;\
74 init_2d_vlc_rl(&rl, static_size);\
86 int code = vlc.
table[i][0];
100 }
else if (code == rl->
n+1) {
202 for (i = 0; i < buf_size; i++) {
208 if ((buf[i] & 3) == 3)
245 #define MAX_INDEX (64 - 1)
248 const uint16_t *quant_matrix,
249 uint8_t *
const scantable,
int last_dc[3],
252 int dc,
diff, i = 0, component;
256 component = index <= 3 ? 0 : index - 4 + 1;
262 dc = last_dc[component];
264 last_dc[component] =
dc;
266 block[0] = dc * quant_matrix[0];
287 level = (level * qscale * quant_matrix[j]) >> 4;
288 level = (level - 1) | 1;
303 }
else if (level == 0) {
315 level = (level * qscale * quant_matrix[j]) >> 4;
316 level = (level - 1) | 1;
319 level = (level * qscale * quant_matrix[j]) >> 4;
320 level = (level - 1) | 1;
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define SLICE_MAX_START_CODE
const uint8_t * y_dc_scale_table
qscale -> y_dc_scale table
int last_mv[2][2][2]
last MV, used for MV prediction in MPEG-1 & B-frame MPEG-4
av_cold void ff_mpeg12_init_vlcs(void)
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
const unsigned char ff_mpeg12_vlc_dc_lum_bits[12]
void ff_mpeg1_clean_buffers(MpegEncContext *s)
const uint16_t ff_mpeg12_vlc_dc_lum_code[12]
const int8_t * table_level
#define SLICE_MIN_START_CODE
Macro definitions for various function/variable attributes.
#define INIT_2D_VLC_RL(rl, static_size)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static av_cold int end(AVCodecContext *avctx)
Multithreading support functions.
static const uint8_t table_mb_ptype[7][2]
const uint8_t * avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
#define UPDATE_CACHE(name, gb)
int last_dc[3]
last DC values for MPEG-1
#define init_vlc(vlc, nb_bits, nb_codes,bits, bits_wrap, bits_size,codes, codes_wrap, codes_size,flags)
static const struct endianess table[]
const uint16_t ff_mpeg12_vlc_dc_chroma_code[12]
simple assert() macros that are a bit more flexible than ISO C assert().
#define CLOSE_READER(name, gb)
static int decode_dc(GetBitContext *gb, int component)
#define GET_RL_VLC(level, run, name, gb, table, bits,max_depth, need_update)
#define SKIP_BITS(name, gb, num)
static const uint8_t table_mb_btype[11][2]
const uint8_t *const ff_mpeg2_dc_scale_table[4]
int n
number of entries of table_vlc minus 1
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
const uint16_t(* table_vlc)[2]
const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12]
#define MB_BTYPE_VLC_BITS
#define LAST_SKIP_BITS(name, gb, num)
RL_VLC_ELEM * rl_vlc[32]
decoding only
#define SHOW_UBITS(name, gb, num)
#define FF_ARRAY_ELEMS(a)
static av_cold void init_2d_vlc_rl(RLTable *rl, unsigned static_size)
Libavcodec external API header.
#define MB_PTYPE_VLC_BITS
#define OPEN_READER(name, gb)
av_cold int ff_rl_init(RLTable *rl, uint8_t static_store[2][2 *MAX_RUN+MAX_LEVEL+3])
uint32_t state
contains the last few bytes in MSB order
#define GET_CACHE(name, gb)
int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s)
Find the end of the current frame in the bitstream.
av_cold void ff_mpeg12_common_init(MpegEncContext *s)
const uint8_t * c_dc_scale_table
qscale -> c_dc_scale table
#define SHOW_SBITS(name, gb, num)
int ff_mpeg1_decode_block_intra(GetBitContext *gb, const uint16_t *quant_matrix, uint8_t *const scantable, int last_dc[3], int16_t *block, int index, int qscale)
common internal api header.
uint8_t ff_mpeg12_static_rl_table_store[2][2][2 *MAX_RUN+MAX_LEVEL+3]
#define INIT_VLC_USE_NEW_STATIC
const uint8_t ff_mpeg12_mbPatTable[64][2]
static av_always_inline int diff(const uint32_t a, const uint32_t b)
const uint8_t ff_mpeg12_mbAddrIncrTable[36][2]
VLC_TYPE(* table)[2]
code, bits
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> dc
const uint8_t ff_mpeg12_mbMotionVectorTable[17][2]
#define PICTURE_START_CODE
void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove, int fuzzy)
Fetch timestamps for a specific byte within the current access unit.