28 #define UNCHECKED_BITSTREAM_READER 1 79 int code = vlc.
table[i][0];
93 }
else if (code == rl->
n+1) {
195 for (i = 0; i < buf_size; i++) {
201 if ((buf[i] & 3) == 3)
238 #define MAX_INDEX (64 - 1) 241 const uint16_t *quant_matrix,
242 uint8_t *
const scantable,
int last_dc[3],
245 int dc,
diff, i = 0, component;
249 component = index <= 3 ? 0 : index - 4 + 1;
255 dc = last_dc[component];
257 last_dc[component] =
dc;
259 block[0] = dc * quant_matrix[0];
280 level = (level * qscale * quant_matrix[j]) >> 4;
281 level = (level - 1) | 1;
296 }
else if (level == 0) {
308 level = (level * qscale * quant_matrix[j]) >> 4;
309 level = (level - 1) | 1;
312 level = (level * qscale * quant_matrix[j]) >> 4;
313 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 init_vlc(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)
#define SLICE_MIN_START_CODE
Macro definitions for various function/variable attributes.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define INIT_2D_VLC_RL(rl, static_size, flags)
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
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 SKIP_BITS(name, gb, num)
av_cold void ff_init_2d_vlc_rl(RLTable *rl, unsigned static_size, int flags)
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 GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)
#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)
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)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;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);return NULL;} return ac;} 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;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->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);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> dc
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
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.