42 #define MAX_CHANNELS 2
43 #define MAX_BYTESPERSAMPLE 3
45 #define APE_FRAMECODE_MONO_SILENCE 1
46 #define APE_FRAMECODE_STEREO_SILENCE 3
47 #define APE_FRAMECODE_PSEUDO_STEREO 4
49 #define HISTORY_SIZE 512
50 #define PREDICTOR_ORDER 8
52 #define PREDICTOR_SIZE 50
54 #define YDELAYA (18 + PREDICTOR_ORDER*4)
55 #define YDELAYB (18 + PREDICTOR_ORDER*3)
56 #define XDELAYA (18 + PREDICTOR_ORDER*2)
57 #define XDELAYB (18 + PREDICTOR_ORDER)
59 #define YADAPTCOEFFSA 18
60 #define XADAPTCOEFFSA 14
61 #define YADAPTCOEFFSB 10
62 #define XADAPTCOEFFSB 5
77 #define APE_FILTER_LEVELS 3
228 s->decoded_size =
s->data_size = 0;
260 "%d bits per coded sample",
s->bps);
270 s->compression_level,
s->flags);
272 !
s->compression_level ||
275 s->compression_level);
278 s->fset =
s->compression_level / 1000 - 1;
286 if (
s->fileversion < 3860) {
289 }
else if (
s->fileversion < 3900) {
292 }
else if (
s->fileversion < 3930) {
295 }
else if (
s->fileversion < 3990) {
303 if (
s->fileversion < 3930) {
306 }
else if (
s->fileversion < 3950) {
327 #define TOP_VALUE ((unsigned int)1 << (CODE_BITS-1))
328 #define SHIFT_BITS (CODE_BITS - 9)
329 #define EXTRA_BITS ((CODE_BITS-2) % 8 + 1)
330 #define BOTTOM_VALUE (TOP_VALUE >> 8)
335 ctx->rc.buffer = bytestream_get_byte(&
ctx->ptr);
344 ctx->rc.buffer <<= 8;
345 if(
ctx->ptr <
ctx->data_end) {
346 ctx->rc.buffer += *
ctx->ptr;
351 ctx->rc.low = (
ctx->rc.low << 8) | ((
ctx->rc.buffer >> 1) & 0xFF);
365 ctx->rc.help =
ctx->rc.range / tot_f;
366 return ctx->rc.low /
ctx->rc.help;
378 return ctx->rc.low /
ctx->rc.help;
390 ctx->rc.low -=
ctx->rc.help * lt_f;
391 ctx->rc.range =
ctx->rc.help * sy_f;
403 #define MODEL_ELEMENTS 64
409 0, 14824, 28224, 39348, 47855, 53994, 58171, 60926,
410 62682, 63786, 64463, 64878, 65126, 65276, 65365, 65419,
411 65450, 65469, 65480, 65487, 65491, 65493,
418 14824, 13400, 11124, 8507, 6139, 4177, 2755, 1756,
419 1104, 677, 415, 248, 150, 89, 54, 31,
427 0, 19578, 36160, 48417, 56323, 60899, 63265, 64435,
428 64971, 65232, 65351, 65416, 65447, 65466, 65476, 65482,
429 65485, 65488, 65490, 65491, 65492, 65493,
436 19578, 16582, 12257, 7906, 4576, 2366, 1170, 536,
437 261, 119, 65, 31, 19, 10, 6, 3,
448 const uint16_t counts[],
449 const uint16_t counts_diff[])
456 symbol= cf - 65535 + 63;
463 for (symbol = 0; counts[symbol + 1] <= cf; symbol++);
473 int lim = rice->
k ? (1 << (rice->
k + 4)) : 0;
474 rice->
ksum += ((x + 1) / 2) - ((rice->
ksum + 16) >> 5);
476 if (rice->
ksum < lim)
478 else if (rice->
ksum >= (1 << (rice->
k + 5)) && rice->
k < 24)
497 unsigned int x, overflow;
501 if (
ctx->fileversion > 3880) {
502 while (overflow >= 16) {
517 rice->
ksum += x - (rice->
ksum + 8 >> 4);
518 if (rice->
ksum < (rice->
k ? 1 << (rice->
k + 4) : 0))
520 else if (rice->
ksum >= (1 << (rice->
k + 5)) && rice->
k < 24)
524 return ((x >> 1) ^ ((x & 1) - 1)) + 1;
529 unsigned int x, overflow;
538 tmpk = (rice->
k < 1) ? 0 : rice->
k - 1;
546 }
else if (tmpk <= 31) {
553 x += overflow << tmpk;
558 return ((x >> 1) ^ ((x & 1) - 1)) + 1;
563 unsigned int x, overflow, pivot;
575 if (pivot < 0x10000) {
579 int base_hi = pivot, base_lo;
582 while (base_hi & ~0xFFFF) {
591 base = (base_hi << bbits) + base_lo;
594 x =
base + overflow * pivot;
599 return ((x >> 1) ^ ((x & 1) - 1)) + 1;
611 unsigned ksummax, ksummin;
614 for (
i = 0;
i <
FFMIN(blockstodecode, 5);
i++) {
619 if (blockstodecode <= 5)
625 for (;
i <
FFMIN(blockstodecode, 64);
i++) {
633 if (blockstodecode <= 64)
637 ksummax = 1 << rice->
k + 7;
638 ksummin = rice->
k ? (1 << rice->
k + 6) : 0;
639 for (;
i < blockstodecode;
i++) {
646 while (rice->
ksum < ksummin) {
648 ksummin = rice->
k ? ksummin >> 1 : 0;
651 while (rice->
ksum >= ksummax) {
656 ksummin = ksummin ? ksummin << 1 : 128;
661 for (
i = 0;
i < blockstodecode;
i++)
683 while (blockstodecode--)
691 int blocks = blockstodecode;
693 while (blockstodecode--)
703 while (blockstodecode--)
711 int blocks = blockstodecode;
713 while (blockstodecode--)
728 while (blockstodecode--) {
738 while (blockstodecode--)
747 while (blockstodecode--) {
756 if (
ctx->fileversion >= 3900) {
757 if (
ctx->data_end -
ctx->ptr < 6)
759 ctx->CRC = bytestream_get_be32(&
ctx->ptr);
766 ctx->CRC_state = UINT32_MAX;
767 if ((
ctx->fileversion > 3820) && (
ctx->CRC & 0x80000000)) {
768 ctx->CRC &= ~0x80000000;
770 if (
ctx->data_end -
ctx->ptr < 6)
772 ctx->frameflags = bytestream_get_be32(&
ctx->ptr);
777 ctx->riceX.ksum = (1 <<
ctx->riceX.k) * 16;
779 ctx->riceY.ksum = (1 <<
ctx->riceY.k) * 16;
781 if (
ctx->fileversion >= 3900) {
823 if (
ctx->fileversion < 3930) {
843 if (
ctx->fileversion < 3930) {
865 return (x < 0) - (x > 0);
881 predictionA = p->
buf[delayA] * 2U - p->
buf[delayA - 1];
884 if ((
decoded ^ predictionA) > 0)
896 const int delayA,
const int delayB,
897 const int start,
const int shift)
899 int32_t predictionA, predictionB, sign;
912 d1 = (p->
buf[delayA] - (unsigned)p->
buf[delayA - 1]) * 2;
913 d0 = p->
buf[delayA] + ((p->
buf[delayA - 2] - (unsigned)p->
buf[delayA - 1]) * 8);
914 d3 = p->
buf[delayB] * 2U - p->
buf[delayB - 1];
943 int32_t coeffs[256], delay[256];
948 memset(coeffs, 0, order *
sizeof(*coeffs));
949 for (
i = 0;
i < order;
i++)
951 for (
i = order;
i < length;
i++) {
954 for (j = 0; j < order; j++) {
955 dotprod += delay[j] * (unsigned)coeffs[j];
956 coeffs[j] += ((delay[j] >> 31) | 1) * sign;
959 for (j = 0; j < order - 1; j++)
960 delay[j] = delay[j + 1];
970 uint32_t coeffs[8] = { 0 };
972 for (
i = 0;
i < length;
i++) {
975 for (j = 7; j >= 0; j--) {
976 dotprod += delay[j] * coeffs[j];
977 coeffs[j] += ((delay[j] >> 31) | 1) * sign;
979 for (j = 7; j > 0; j--)
980 delay[j] = delay[j - 1];
982 buffer[
i] -= (unsigned)(dotprod >> 9);
991 int start = 4,
shift = 10;
998 int order = 128,
shift2 = 11;
1000 if (
ctx->fileversion >= 3830) {
1013 int X = *decoded0,
Y = *decoded1;
1045 int start = 4,
shift = 10;
1051 int order = 128,
shift2 = 11;
1053 if (
ctx->fileversion >= 3830) {
1091 uint32_t d0, d1, d2, d3;
1094 d0 = p->
buf[delayA ];
1095 d1 = p->
buf[delayA ] - (unsigned)p->
buf[delayA - 1];
1096 d2 = p->
buf[delayA - 1] - (
unsigned)p->
buf[delayA - 2];
1097 d3 = p->
buf[delayA - 2] - (unsigned)p->
buf[delayA - 3];
1126 int Y = *decoded1,
X = *decoded0;
1168 const int delayA,
const int delayB,
1169 const int adaptA,
const int adaptB,
1172 int64_t predictionA, predictionB;
1177 p->
buf[delayA - 1] = p->
buf[delayA] - (uint64_t)p->
buf[delayA - 1];
1188 p->
buf[delayB - 1] = p->
buf[delayB] - (uint64_t)p->
buf[delayB - 1];
1199 predictionA = (
int32_t)predictionA;
1200 predictionB = (
int32_t)predictionB;
1233 ctx->compression_level);
1237 ctx->compression_level);
1256 int32_t predictionA, currentA,
A, sign;
1260 currentA = p->
lastA[0];
1273 currentA =
A + (uint64_t)(predictionA >> 10);
1294 *(decoded0++) = p->
filterA[0];
1297 p->
lastA[0] = currentA;
1303 f->historybuffer = buf + order;
1304 f->delay =
f->historybuffer + order * 2;
1305 f->adaptcoeffs =
f->historybuffer + order;
1307 memset(
f->historybuffer, 0, (order * 2) *
sizeof(*
f->historybuffer));
1308 memset(
f->coeffs, 0, order *
sizeof(*
f->coeffs));
1319 int32_t *
data,
int count,
int order,
int fracbits)
1326 res =
ctx->adsp.scalarproduct_and_madd_int16(
f->coeffs,
1328 f->adaptcoeffs - order,
1330 res = (
int64_t)(res + (1LL << (fracbits - 1))) >> fracbits;
1331 res += (unsigned)*
data;
1339 f->adaptcoeffs[0] = (res == 0) ? 0 : ((res >> 28) & 8) - 4;
1340 f->adaptcoeffs[-4] >>= 1;
1341 f->adaptcoeffs[-8] >>= 1;
1349 (8 << ((absres >
f->avg * 3LL) + (absres > (
f->avg +
f->avg / 3))));
1359 *
f->adaptcoeffs = 0;
1361 f->avg += (
int)(absres - (
unsigned)
f->avg) / 16;
1363 f->adaptcoeffs[-1] >>= 1;
1364 f->adaptcoeffs[-2] >>= 1;
1365 f->adaptcoeffs[-8] >>= 1;
1372 memmove(
f->historybuffer,
f->delay - (order * 2),
1373 (order * 2) *
sizeof(*
f->historybuffer));
1374 f->delay =
f->historybuffer + order * 2;
1375 f->adaptcoeffs =
f->historybuffer + order;
1382 int count,
int order,
int fracbits)
1427 ctx->entropy_decode_mono(
ctx, count);
1432 ctx->predictor_decode_mono(
ctx, count);
1435 if (
ctx->channels == 2) {
1436 memcpy(
ctx->decoded[1],
ctx->decoded[0], count *
sizeof(*
ctx->decoded[1]));
1442 unsigned left, right;
1452 ctx->entropy_decode_stereo(
ctx, count);
1457 ctx->predictor_decode_stereo(
ctx, count);
1461 left = *decoded1 - (unsigned)(*decoded0 / 2);
1462 right = left + *decoded0;
1464 *(decoded0++) = left;
1465 *(decoded1++) = right;
1470 int *got_frame_ptr,
AVPacket *avpkt)
1480 uint64_t decoded_buffer_size;
1487 uint32_t nblocks,
offset;
1494 if (avpkt->
size < 8) {
1498 buf_size = avpkt->
size & ~3;
1499 if (buf_size != avpkt->
size) {
1501 "extra bytes at the end will be skipped.\n");
1503 if (
s->fileversion < 3950)
1508 s->bdsp.bswap_buf((uint32_t *)
s->data, (
const uint32_t *) buf,
1510 memset(
s->data + (buf_size & ~3), 0, buf_size & 3);
1512 s->data_end =
s->data + buf_size;
1514 nblocks = bytestream_get_be32(&
s->ptr);
1515 offset = bytestream_get_be32(&
s->ptr);
1516 if (
s->fileversion >= 3900) {
1523 if (
s->data_end -
s->ptr <
offset) {
1531 if (
s->fileversion > 3800)
1537 if (!nblocks || nblocks > INT_MAX / 2 /
sizeof(*
s->decoded_buffer) - 8) {
1548 s->samples = nblocks;
1556 blockstodecode =
FFMIN(
s->blocks_per_loop,
s->samples);
1559 if (
s->fileversion < 3930)
1560 blockstodecode =
s->samples;
1563 decoded_buffer_size = 2LL *
FFALIGN(blockstodecode, 8) *
sizeof(*
s->decoded_buffer);
1574 if (!
s->decoded_buffer)
1576 memset(
s->decoded_buffer, 0, decoded_buffer_size);
1577 s->decoded[0] =
s->decoded_buffer;
1578 s->decoded[1] =
s->decoded_buffer +
FFALIGN(blockstodecode, 8);
1596 for (ch = 0; ch <
s->channels; ch++) {
1598 for (
i = 0;
i < blockstodecode;
i++)
1599 *sample8++ = (
s->decoded[ch][
i] + 0x80U) & 0xff;
1603 for (ch = 0; ch <
s->channels; ch++) {
1605 for (
i = 0;
i < blockstodecode;
i++)
1606 *sample16++ =
s->decoded[ch][
i];
1610 for (ch = 0; ch <
s->channels; ch++) {
1612 for (
i = 0;
i < blockstodecode;
i++)
1613 *sample24++ =
s->decoded[ch][
i] * 256U;
1618 s->samples -= blockstodecode;
1621 s->fileversion >= 3900) {
1622 uint32_t crc =
s->CRC_state;
1624 int stride =
s->bps == 24 ? 4 : (
s->bps>>3);
1626 int bytes =
s->bps >> 3;
1628 for (
i = 0;
i < blockstodecode;
i++) {
1629 for (ch = 0; ch <
s->channels; ch++) {
1633 for(
int j = 0; j<
stride; j++)
1634 smp[j] = smp_native[
stride-j-1];
1642 if (!
s->samples && (~crc >> 1) ^
s->CRC) {
1644 "frames may have been affected as well.\n");
1654 return !
s->samples ? avpkt->
size : 0;
1663 #define OFFSET(x) offsetof(APEContext, x)
1664 #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
1667 {
"all",
"no maximum. decode all samples for each packet at once", 0,
AV_OPT_TYPE_CONST, { .i64 = INT_MAX }, INT_MIN, INT_MAX,
PAR,
"max_samples" },
static void flush(AVCodecContext *avctx)
static enum AVSampleFormat sample_fmts[]
static void entropy_decode_stereo_3860(APEContext *ctx, int blockstodecode)
static void entropy_decode_stereo_3930(APEContext *ctx, int blockstodecode)
static const uint8_t ape_filter_fracbits[5][APE_FILTER_LEVELS]
Filter fraction bits depending on compression level.
static void range_dec_normalize(APEContext *ctx)
Perform normalization.
static av_cold int ape_decode_close(AVCodecContext *avctx)
static void entropy_decode_mono_3860(APEContext *ctx, int blockstodecode)
static int APESIGN(int32_t x)
Get inverse sign of integer (-1 for positive, 1 for negative and 0 for zero)
static const int32_t initial_coeffs_fast_3320[1]
static void entropy_decode_mono_3900(APEContext *ctx, int blockstodecode)
static av_always_inline int filter_fast_3320(APEPredictor *p, const int decoded, const int filter, const int delayA)
static int ape_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
static int ape_decode_value_3900(APEContext *ctx, APERice *rice)
static const AVOption options[]
static void do_apply_filter(APEContext *ctx, int version, APEFilter *f, int32_t *data, int count, int order, int fracbits)
static const uint16_t ape_filter_orders[5][APE_FILTER_LEVELS]
Filter orders depending on compression level.
static void range_decode_update(APEContext *ctx, int sy_f, int lt_f)
Update decoding state.
static void predictor_decode_stereo_3950(APEContext *ctx, int count)
static void do_init_filter(APEFilter *f, int16_t *buf, int order)
static int get_k(int ksum)
#define APE_FRAMECODE_STEREO_SILENCE
static int range_decode_culfreq(APEContext *ctx, int tot_f)
Calculate cumulative frequency for next symbol.
static void update_rice(APERice *rice, unsigned int x)
APECompressionLevel
Possible compression levels.
@ COMPRESSION_LEVEL_EXTRA_HIGH
@ COMPRESSION_LEVEL_INSANE
@ COMPRESSION_LEVEL_NORMAL
static int ape_decode_value_3990(APEContext *ctx, APERice *rice)
static av_always_inline int filter_3800(APEPredictor *p, const unsigned decoded, const int filter, const int delayA, const int delayB, const int start, const int shift)
static const int32_t initial_coeffs_b_3800[2]
static void ape_apply_filters(APEContext *ctx, int32_t *decoded0, int32_t *decoded1, int count)
static void ape_unpack_mono(APEContext *ctx, int count)
static void long_filter_high_3800(int32_t *buffer, int order, int shift, int length)
static void predictor_decode_mono_3930(APEContext *ctx, int count)
static int init_entropy_decoder(APEContext *ctx)
#define PREDICTOR_SIZE
Total size of all predictor histories.
static const int64_t initial_coeffs_3930_64bit[4]
static int range_decode_culshift(APEContext *ctx, int shift)
Decode value with given size in bits.
static const int32_t initial_coeffs_a_3800[3]
static void init_filter(APEContext *ctx, APEFilter *f, int16_t *buf, int order)
static void entropy_decode_stereo_0000(APEContext *ctx, int blockstodecode)
static void long_filter_ehigh_3830(int32_t *buffer, int length)
static av_cold int ape_decode_init(AVCodecContext *avctx)
static int ape_decode_value_3860(APEContext *ctx, GetBitContext *gb, APERice *rice)
static const int32_t initial_coeffs_3930[4]
static void entropy_decode_mono_0000(APEContext *ctx, int blockstodecode)
static void entropy_decode_stereo_3900(APEContext *ctx, int blockstodecode)
static void predictor_decode_stereo_3800(APEContext *ctx, int count)
static int range_get_symbol(APEContext *ctx, const uint16_t counts[], const uint16_t counts_diff[])
Decode symbol.
#define APE_FILTER_LEVELS
static void entropy_decode_mono_3990(APEContext *ctx, int blockstodecode)
static void entropy_decode_stereo_3990(APEContext *ctx, int blockstodecode)
static void predictor_decode_stereo_3930(APEContext *ctx, int count)
static av_always_inline int predictor_update_3930(APEPredictor *p, const int decoded, const int filter, const int delayA)
static int get_rice_ook(GetBitContext *gb, int k)
static av_always_inline int predictor_update_filter(APEPredictor64 *p, const int decoded, const int filter, const int delayA, const int delayB, const int adaptA, const int adaptB, int compression_level)
static const AVClass ape_decoder_class
static void predictor_decode_mono_3800(APEContext *ctx, int count)
static void decode_array_0000(APEContext *ctx, GetBitContext *gb, int32_t *out, APERice *rice, int blockstodecode)
static void ape_flush(AVCodecContext *avctx)
static const uint16_t counts_3970[22]
Fixed probabilities for symbols in Monkey Audio version 3.97.
static void ape_unpack_stereo(APEContext *ctx, int count)
static void range_start_decoding(APEContext *ctx)
Start the decoder.
static const uint16_t counts_diff_3970[21]
Probability ranges for symbols in Monkey Audio version 3.97.
static const uint16_t counts_diff_3980[21]
Probability ranges for symbols in Monkey Audio version 3.98.
static const uint16_t counts_3980[22]
Fixed probabilities for symbols in Monkey Audio version 3.98.
static void init_predictor_decoder(APEContext *ctx)
static void apply_filter(APEContext *ctx, APEFilter *f, int32_t *data0, int32_t *data1, int count, int order, int fracbits)
static int range_decode_bits(APEContext *ctx, int n)
Decode n bits (n <= 16) without modelling.
static int init_frame_decoder(APEContext *ctx)
static void predictor_decode_mono_3950(APEContext *ctx, int count)
#define APE_FRAMECODE_PSEUDO_STEREO
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.
#define AV_EF_CRCCHECK
Verify checksums embedded in the bitstream (could be of either encoded or decoded data,...
#define AV_EF_EXPLODE
abort decoding on minor error detection
static av_cold int init(AVCodecContext *avctx)
static av_always_inline void filter(int16_t *output, ptrdiff_t out_stride, const int16_t *low, ptrdiff_t low_stride, const int16_t *high, ptrdiff_t high_stride, int len, int clip)
audio channel layout utility functions
#define FFABSU(a)
Unsigned Absolute value.
Public header for CRC hash function implementation.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
bitstream reader API header.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int get_bits_left(GetBitContext *gb)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_STEREO
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_SUBFRAMES
Codec can output multiple frames per AVPacket Normally demuxers return one frame at a time,...
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
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_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#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.
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
#define LIBAVUTIL_VERSION_INT
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
static const int shift2[6]
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
av_cold void ff_llauddsp_init(LLAudDSPContext *c)
typedef void(RENAME(mix_any_func_type))
static int shift(int a, int b)
void(* entropy_decode_stereo)(struct APEContext *ctx, int blockstodecode)
int32_t * decoded[MAX_CHANNELS]
decoded data for each channel
int16_t * filterbuf[APE_FILTER_LEVELS]
filter memory
int samples
samples left to decode in current frame
const uint8_t * ptr
current position in frame data
void(* predictor_decode_mono)(struct APEContext *ctx, int count)
int flags
global decoder flags
int data_size
frame data allocated size
APEPredictor64 predictor64
64bit predictor used for final reconstruction
void(* predictor_decode_stereo)(struct APEContext *ctx, int count)
APERice riceY
rice code parameters for the first channel
uint8_t * data_end
frame data end
int fileversion
codec version, very important in decoding process
APEFilter filters[APE_FILTER_LEVELS][2]
filters used for reconstruction
uint32_t CRC_state
accumulated CRC
APEPredictor predictor
predictor used for final reconstruction
uint32_t CRC
signalled frame CRC
APERangecoder rc
rangecoder used to decode actual values
APERice riceX
rice code parameters for the second channel
int compression_level
compression levels
int blocks_per_loop
maximum number of samples to decode for each call
void(* entropy_decode_mono)(struct APEContext *ctx, int blockstodecode)
uint8_t * data
current frame data
int fset
which filter set to use (calculated from compression level)
int frameflags
frame flags
Filters applied to the decoded data.
int16_t * historybuffer
filter memory
int16_t * delay
filtered values
int16_t * coeffs
actual coefficients used in filtering
int16_t * adaptcoeffs
adaptive filter coefficients used for correcting of actual filter coefficients
uint64_t coeffsB[2][5]
adaption coefficients
uint64_t coeffsA[2][4]
adaption coefficients
int64_t historybuffer[HISTORY_SIZE+PREDICTOR_SIZE]
int32_t historybuffer[HISTORY_SIZE+PREDICTOR_SIZE]
uint32_t coeffsA[2][4]
adaption coefficients
uint32_t coeffsB[2][5]
adaption coefficients
uint32_t low
low end of interval
unsigned int buffer
buffer for input/output
uint32_t range
length of interval
uint32_t help
bytes_to_follow resp. intermediate value
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
main external API structure.
enum AVSampleFormat sample_fmt
audio sample format
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int channels
number of audio channels
uint64_t channel_layout
Audio channel layout.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
const char * name
Name of the codec implementation.
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
This structure stores compressed data.
#define avpriv_request_sample(...)
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
static const uint8_t offset[127][2]