79 int need32 =
s->stream_info.bps > 16;
83 if (need32 || want32) {
88 s->sample_shift = 32 -
s->stream_info.bps;
94 s->sample_shift = 16 -
s->stream_info.bps;
122 s->stream_info.channels);
123 s->got_streaminfo = 1;
145 s->stream_info.max_blocksize,
151 if (!
s->decoded_buffer)
156 s->stream_info.channels,
157 s->stream_info.max_blocksize,
159 if (ret >= 0 &&
s->stream_info.bps == 32 &&
s->stream_info.channels == 2) {
161 s->stream_info.max_blocksize,
166 av_fast_malloc(&
s->decoded_buffer_33bps, &
s->decoded_buffer_size_33bps, buf_size);
167 if (!
s->decoded_buffer_33bps)
171 s->decoded_buffer_33bps,
173 s->stream_info.max_blocksize,
177 return ret < 0 ? ret : 0;
189 int metadata_type, metadata_size, ret;
208 s->stream_info.channels);
209 s->got_streaminfo = 1;
222 int metadata_last, metadata_size;
223 const uint8_t *buf_end = buf + buf_size;
227 if (buf_end - buf < 4)
231 if (buf_end - buf < metadata_size) {
235 buf += metadata_size;
236 }
while (!metadata_last);
238 return buf_size - (buf_end - buf);
244 int i,
tmp, partition, method_type, rice_order;
245 int rice_bits, rice_esc;
251 samples =
s->blocksize >> rice_order;
252 rice_bits = 4 + method_type;
253 rice_esc = (1 << rice_bits) - 1;
255 decoded += pred_order;
258 if (method_type > 1) {
264 if (samples << rice_order !=
s->blocksize) {
266 rice_order,
s->blocksize);
270 if (pred_order > samples) {
272 pred_order, samples);
276 for (partition = 0; partition < (1 << rice_order); partition++) {
278 if (
tmp == rice_esc) {
280 for (;
i < samples;
i++)
283 int real_limit = (
tmp > 1) ? (INT_MAX >> (
tmp - 1)) + 2 : INT_MAX;
284 for (;
i < samples;
i++) {
286 if (v == 0x80000000){
303 int pred_order,
int bps)
305 const int blocksize =
s->blocksize;
311 for (
i = 0;
i < pred_order;
i++) {
319 a = decoded[pred_order-1];
321 b =
a - decoded[pred_order-2];
323 c =
b - decoded[pred_order-2] + decoded[pred_order-3];
325 d =
c - decoded[pred_order-2] + 2U*decoded[pred_order-3] - decoded[pred_order-4];
327 switch (pred_order) {
331 for (
i = pred_order;
i < blocksize;
i++)
332 decoded[
i] =
a += decoded[
i];
335 for (
i = pred_order;
i < blocksize;
i++)
336 decoded[
i] =
a +=
b += decoded[
i];
339 for (
i = pred_order;
i < blocksize;
i++)
340 decoded[
i] =
a +=
b +=
c += decoded[
i];
343 for (
i = pred_order;
i < blocksize;
i++)
344 decoded[
i] =
a +=
b +=
c += d += decoded[
i];
354#define DECODER_SUBFRAME_FIXED_WIDE(residual) { \
355 const int blocksize = s->blocksize; \
358 if ((ret = decode_residuals(s, residual, pred_order)) < 0) \
361 switch (pred_order) { \
363 for (int i = pred_order; i < blocksize; i++) \
364 decoded[i] = residual[i]; \
367 for (int i = pred_order; i < blocksize; i++) \
368 decoded[i] = (uint64_t)residual[i] + (uint64_t)decoded[i-1];\
371 for (int i = pred_order; i < blocksize; i++) \
372 decoded[i] = (uint64_t)residual[i] + 2*(uint64_t)decoded[i-1] - (uint64_t)decoded[i-2]; \
375 for (int i = pred_order; i < blocksize; i++) \
376 decoded[i] = (uint64_t)residual[i] + 3*(uint64_t)decoded[i-1] - 3*(uint64_t)decoded[i-2] + (uint64_t)decoded[i-3]; \
379 for (int i = pred_order; i < blocksize; i++) \
380 decoded[i] = (uint64_t)residual[i] + 4*(uint64_t)decoded[i-1] - 6*(uint64_t)decoded[i-2] + 4*(uint64_t)decoded[i-3] - (uint64_t)decoded[i-4]; \
383 av_log(s->avctx, AV_LOG_ERROR, "illegal pred order %d\n", pred_order); \
384 return AVERROR_INVALIDDATA; \
390 int pred_order,
int bps)
393 for (
int i = 0;
i < pred_order;
i++) {
401 int32_t *residual,
int pred_order)
404 for (
int i = 0;
i < pred_order;
i++) { \
407 DECODER_SUBFRAME_FIXED_WIDE(residual);
411 int order,
int qlevel,
int len,
int bps)
414 int ebps = 1 << (
bps-1);
417 for (
i = order;
i <
len;
i++)
418 sigma |= decoded[
i] + ebps;
423 for (
i =
len - 1;
i >= order;
i--) {
425 for (j = 0; j < order; j++)
427 decoded[
i] -= p >> qlevel;
429 for (
i = order;
i <
len;
i++, decoded++) {
431 for (j = 0; j < order; j++)
432 p += coeffs[j] * (uint32_t)decoded[j];
433 decoded[j] += p >> qlevel;
441 int coeff_prec, qlevel;
445 for (
i = 0;
i < pred_order;
i++) {
450 if (coeff_prec == 16) {
461 for (
i = 0;
i < pred_order;
i++) {
462 coeffs[pred_order -
i - 1] =
get_sbits(&
s->gb, coeff_prec);
468 if ( (
s->buggy_lpc &&
s->stream_info.bps <= 16)
469 || ( !
s->buggy_lpc &&
bps <= 16
470 &&
bps + coeff_prec +
av_log2(pred_order) <= 32)) {
471 s->dsp.lpc16(decoded, coeffs, pred_order, qlevel,
s->blocksize);
473 s->dsp.lpc32(decoded, coeffs, pred_order, qlevel,
s->blocksize);
474 if (
s->stream_info.bps <= 16)
482 int32_t *residual,
int pred_order)
485 int coeff_prec, qlevel;
489 for (
i = 0;
i < pred_order;
i++) {
494 if (coeff_prec == 16) {
505 for (
i = 0;
i < pred_order;
i++) {
506 coeffs[pred_order -
i - 1] =
get_sbits(&
s->gb, coeff_prec);
512 s->dsp.lpc33(decoded, residual, coeffs, pred_order, qlevel,
s->blocksize);
520 int type, wasted = 0;
521 int bps =
s->stream_info.bps;
544 "Invalid number of wasted bits > available bits (%d) - left=%d\n",
556 for (
i = 0;
i <
s->blocksize;
i++)
560 for (
i = 0;
i <
s->blocksize;
i++)
561 s->decoded_33bps[
i] =
tmp;
563 }
else if (
type == 1) {
565 for (
i = 0;
i <
s->blocksize;
i++)
568 for (
i = 0;
i <
s->blocksize;
i++)
571 }
else if ((
type >= 8) && (
type <= 12)) {
572 int order =
type & ~0x8;
574 if (
bps + order <= 32) {
585 }
else if (
type >= 32) {
599 if (wasted+
bps == 33) {
600 s->dsp.wasted33(
s->decoded_33bps, decoded, wasted,
s->blocksize);
601 }
else if (wasted < 32) {
602 s->dsp.wasted32(decoded, wasted,
s->blocksize);
620 if (
s->stream_info.channels
621 && fi.
channels !=
s->stream_info.channels
622 &&
s->got_streaminfo) {
633 if (!
s->stream_info.bps && !fi.
bps) {
638 fi.
bps =
s->stream_info.bps;
639 }
else if (
s->stream_info.bps && fi.
bps !=
s->stream_info.bps) {
645 if (!
s->stream_info.bps) {
646 s->stream_info.bps =
s->avctx->bits_per_raw_sample = fi.
bps;
650 if (!
s->stream_info.max_blocksize)
652 if (fi.
blocksize >
s->stream_info.max_blocksize) {
654 s->stream_info.max_blocksize);
659 if (!
s->stream_info.samplerate && !fi.
samplerate) {
661 " or frame header\n");
666 s->stream_info.samplerate =
s->avctx->sample_rate = fi.
samplerate;
668 if (!
s->got_streaminfo) {
672 s->got_streaminfo = 1;
676 s->stream_info.channels);
681 for (
i = 0;
i <
s->stream_info.channels;
i++) {
699 decoded[1][
i] = decoded[0][
i] - (uint64_t)decoded_33bps[
i];
702 decoded[0][
i] = decoded[1][
i] + (uint64_t)decoded_33bps[
i];
704 for (
i = 0;
i <
len;
i++) {
705 uint64_t
a = decoded[0][
i];
708 decoded[0][
i] = (
a +
b);
715 int *got_frame_ptr,
AVPacket *avpkt)
717 const uint8_t *buf = avpkt->
data;
718 int buf_size = avpkt->
size;
725 if (buf_size > 5 && !memcmp(buf,
"\177FLAC", 5)) {
761 0, buf, bytes_read)) {
768 frame->nb_samples =
s->blocksize;
772 if (
s->stream_info.bps == 32 &&
s->ch_mode > 0) {
774 s->dsp.decorrelate[0](
frame->data,
s->decoded,
s->stream_info.channels,
775 s->blocksize,
s->sample_shift);
777 s->dsp.decorrelate[
s->ch_mode](
frame->data,
s->decoded,
778 s->stream_info.channels,
779 s->blocksize,
s->sample_shift);
782 if (bytes_read > buf_size) {
786 if (bytes_read < buf_size) {
788 buf_size - bytes_read, buf_size);
812 .class_name =
"FLAC decoder",
const FFCodec ff_flac_decoder
static av_cold void close(AVCodecParserContext *s)
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi > >8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1<< 16)) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi > >24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi > >56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(UINT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out->ch+ch,(const uint8_t **) in->ch+ch, off *(out-> planar
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
static int BS_FUNC left(const BSCTX *bc)
Return the number of the bits left in a buffer.
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define CODEC_SAMPLEFMTS(...)
Public header for CRC hash function implementation.
#define AV_EF_CRCCHECK
Verify checksums embedded in the bitstream (could be of either encoded or decoded data,...
#define AV_EF_COMPLIANT
consider all spec non compliances as errors
#define AV_EF_EXPLODE
abort decoding on minor error detection
int(* init)(AVBSFContext *ctx)
channel
Use these values when setting the channel map with ebur128_set_channel().
int ff_flac_decode_frame_header(void *logctx, GetBitContext *gb, FLACFrameInfo *fi, int log_level_offset)
Validate and decode a frame header.
int ff_flac_is_extradata_valid(AVCodecContext *avctx, uint8_t **streaminfo_start)
Validate the FLAC extradata.
void ff_flac_set_channel_layout(AVCodecContext *avctx, int channels)
int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer)
Parse the Streaminfo metadata block.
FLAC (Free Lossless Audio Codec) common stuff.
#define FLAC_MIN_FRAME_SIZE
#define FLAC_MAX_BLOCKSIZE
@ FLAC_METADATA_TYPE_VORBIS_COMMENT
@ FLAC_METADATA_TYPE_STREAMINFO
static av_always_inline void flac_parse_block_header(const uint8_t *block_header, int *last, int *type, int *size)
Parse the metadata block parameters from the header.
#define FLAC_MAX_CHANNELS
#define FLAC_STREAMINFO_SIZE
FLAC (Free Lossless Audio Codec) decoder/parser common functions.
bitstream reader API header.
static int get_sbits_long(GetBitContext *s, int n)
Read 0-32 bits as a signed integer.
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
static int get_sbits(GetBitContext *s, int n)
static int get_bits_left(GetBitContext *gb)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static const uint8_t * align_get_bits(GetBitContext *s)
static int get_bits_count(const GetBitContext *s)
static int64_t get_sbits64(GetBitContext *s, int n)
Read 0-64 bits as a signed integer.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int esc_len)
read signed golomb rice code (flac).
#define AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Get the required buffer size for the given audio parameters.
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
@ AV_SAMPLE_FMT_S32
signed 32 bits
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
@ AV_SAMPLE_FMT_S16
signed 16 bits
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Fill plane data pointers and linesize for samples with sample format sample_fmt.
#define LIBAVUTIL_VERSION_INT
#define DECODER_SUBFRAME_FIXED_WIDE(residual)
static int decode_subframe_lpc(FLACContext *s, int32_t *decoded, int pred_order, int bps)
static int decode_frame(FLACContext *s)
static int flac_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
static const AVClass flac_decoder_class
static av_cold int flac_decode_init(AVCodecContext *avctx)
static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
static int allocate_buffers(FLACContext *s)
static void decorrelate_33bps(int ch_mode, int32_t **decoded, int64_t *decoded_33bps, int len)
static av_cold int flac_decode_close(AVCodecContext *avctx)
static void dump_headers(AVCodecContext *avctx, FLACStreaminfo *s)
static int decode_subframe_fixed_wide(FLACContext *s, int32_t *decoded, int pred_order, int bps)
static int decode_subframe_lpc_33bps(FLACContext *s, int64_t *decoded, int32_t *residual, int pred_order)
static void lpc_analyze_remodulate(SUINT32 *decoded, const int coeffs[32], int order, int qlevel, int len, int bps)
static int decode_subframe_fixed(FLACContext *s, int32_t *decoded, int pred_order, int bps)
static int decode_subframe_fixed_33bps(FLACContext *s, int64_t *decoded, int32_t *residual, int pred_order)
static void flac_set_bps(FLACContext *s)
static int get_metadata_size(const uint8_t *buf, int buf_size)
Determine the size of an inline header.
static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size)
Parse the STREAMINFO from an inline header.
static int decode_subframe(FLACContext *s, int channel)
av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels)
Multithreading API for decoders.
#define MKBETAG(a, b, c, d)
Memory handling functions.
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
Describe the class of an AVClass context structure.
main external API structure.
enum AVSampleFormat sample_fmt
audio sample format
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int blocksize
number of samples in the current frame
unsigned int decoded_buffer_size_33bps
AVCodecContext * avctx
parent AVCodecContext
unsigned int decoded_buffer_size
GetBitContext gb
GetBitContext initialized to start at the current frame.
int32_t * decoded[FLAC_MAX_CHANNELS]
decoded samples
FLACStreaminfo stream_info
uint8_t * decoded_buffer_33bps
int ch_mode
channel decorrelation type in the current frame
int buggy_lpc
use workaround for old lavc encoded files
int64_t * decoded_33bps
decoded samples for a 33 bps subframe
int got_streaminfo
indicates if the STREAMINFO has been read
int sample_shift
shift required to make output samples 16-bit or 32-bit
int blocksize
block size of the frame
int channels
number of channels
int samplerate
sample rate
int ch_mode
channel decorrelation mode
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.