28 #define UNCHECKED_BITSTREAM_READER 1
92 }
else if (
code == rl->
n+1) {
109 s->y_dc_scale_table =
116 s->last_dc[0] = 1 << (7 +
s->intra_dc_precision);
117 s->last_dc[1] =
s->last_dc[0];
118 s->last_dc[2] =
s->last_dc[0];
119 memset(
s->last_mv, 0,
sizeof(
s->last_mv));
192 for (
i = 0;
i < buf_size;
i++) {
198 if ((buf[
i] & 3) == 3)
235 #define MAX_INDEX (64 - 1)
238 const uint16_t *quant_matrix,
239 uint8_t *
const scantable,
int last_dc[3],
242 int dc,
diff,
i = 0, component;
252 dc = last_dc[component];
254 last_dc[component] =
dc;
256 block[0] =
dc * quant_matrix[0];
277 level = (
level * qscale * quant_matrix[j]) >> 4;
293 }
else if (
level == 0) {
305 level = (
level * qscale * quant_matrix[j]) >> 4;
309 level = (
level * qscale * quant_matrix[j]) >> 4;
Macro definitions for various function/variable attributes.
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)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> dc
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
#define SLICE_MAX_START_CODE
#define flags(name, subs,...)
#define GET_CACHE(name, gb)
#define CLOSE_READER(name, gb)
#define SHOW_UBITS(name, gb, num)
#define SHOW_SBITS(name, gb, num)
#define OPEN_READER(name, gb)
#define SKIP_BITS(name, gb, num)
#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)
#define UPDATE_CACHE(name, gb)
#define LAST_SKIP_BITS(name, gb, num)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
const uint8_t * avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
common internal API header
static int ff_thread_once(char *control, void(*routine)(void))
static av_cold void mpeg12_init_vlcs(void)
static const uint8_t table_mb_btype[11][2]
static const uint8_t table_mb_ptype[7][2]
av_cold void ff_mpeg12_init_vlcs(void)
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)
void ff_mpeg1_clean_buffers(MpegEncContext *s)
av_cold void ff_init_2d_vlc_rl(RLTable *rl, unsigned static_size, int flags)
av_cold void ff_mpeg12_common_init(MpegEncContext *s)
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.
#define INIT_2D_VLC_RL(rl, static_size, flags)
static int decode_dc(GetBitContext *gb, int component)
const uint16_t ff_mpeg12_vlc_dc_chroma_code[12]
const uint8_t ff_mpeg12_mbPatTable[64][2]
const uint8_t ff_mpeg12_mbAddrIncrTable[36][2]
const uint16_t ff_mpeg12_vlc_dc_lum_code[12]
const uint8_t ff_mpeg12_mbMotionVectorTable[17][2]
const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12]
const unsigned char ff_mpeg12_vlc_dc_lum_bits[12]
#define MB_BTYPE_VLC_BITS
#define MB_PTYPE_VLC_BITS
#define PICTURE_START_CODE
#define SLICE_MIN_START_CODE
const uint8_t *const ff_mpeg2_dc_scale_table[4]
void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove, int fuzzy)
Fetch timestamps for a specific byte within the current access unit.
static const uint16_t table[]
#define FF_ARRAY_ELEMS(a)
uint32_t state
contains the last few bytes in MSB order
int n
number of entries of table_vlc minus 1
const uint16_t(* table_vlc)[2]
RL_VLC_ELEM * rl_vlc[32]
decoding only
const int8_t * table_level
VLC_TYPE(* table)[2]
code, bits
static av_always_inline int diff(const uint32_t a, const uint32_t b)
#define init_vlc(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
#define INIT_VLC_USE_NEW_STATIC