FFmpeg
Data Structures | Macros | Functions | Variables
apedec.c File Reference
#include <inttypes.h>
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/opt.h"
#include "lossless_audiodsp.h"
#include "avcodec.h"
#include "bswapdsp.h"
#include "bytestream.h"
#include "internal.h"
#include "get_bits.h"
#include "unary.h"

Go to the source code of this file.

Data Structures

struct  APEFilter
 Filters applied to the decoded data. More...
 
struct  APERice
 
struct  APERangecoder
 
struct  APEPredictor
 Filter histories. More...
 
struct  APEPredictor64
 
struct  APEContext
 Decoder context. More...
 

Macros

#define MAX_CHANNELS   2
 
#define MAX_BYTESPERSAMPLE   3
 
#define APE_FRAMECODE_MONO_SILENCE   1
 
#define APE_FRAMECODE_STEREO_SILENCE   3
 
#define APE_FRAMECODE_PSEUDO_STEREO   4
 
#define HISTORY_SIZE   512
 
#define PREDICTOR_ORDER   8
 
#define PREDICTOR_SIZE   50
 Total size of all predictor histories. More...
 
#define YDELAYA   (18 + PREDICTOR_ORDER*4)
 
#define YDELAYB   (18 + PREDICTOR_ORDER*3)
 
#define XDELAYA   (18 + PREDICTOR_ORDER*2)
 
#define XDELAYB   (18 + PREDICTOR_ORDER)
 
#define YADAPTCOEFFSA   18
 
#define XADAPTCOEFFSA   14
 
#define YADAPTCOEFFSB   10
 
#define XADAPTCOEFFSB   5
 
#define APE_FILTER_LEVELS   3
 
#define OFFSET(x)   offsetof(APEContext, x)
 
#define PAR   (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
 

Enumerations

enum  APECompressionLevel {
  COMPRESSION_LEVEL_FAST = 1000, COMPRESSION_LEVEL_NORMAL = 2000, COMPRESSION_LEVEL_HIGH = 3000, COMPRESSION_LEVEL_EXTRA_HIGH = 4000,
  COMPRESSION_LEVEL_INSANE = 5000
}
 Possible compression levels. More...
 

Functions

static void ape_apply_filters (APEContext *ctx, int32_t *decoded0, int32_t *decoded1, int count)
 
static void entropy_decode_mono_0000 (APEContext *ctx, int blockstodecode)
 
static void entropy_decode_stereo_0000 (APEContext *ctx, int blockstodecode)
 
static void entropy_decode_mono_3860 (APEContext *ctx, int blockstodecode)
 
static void entropy_decode_stereo_3860 (APEContext *ctx, int blockstodecode)
 
static void entropy_decode_mono_3900 (APEContext *ctx, int blockstodecode)
 
static void entropy_decode_stereo_3900 (APEContext *ctx, int blockstodecode)
 
static void entropy_decode_stereo_3930 (APEContext *ctx, int blockstodecode)
 
static void entropy_decode_mono_3990 (APEContext *ctx, int blockstodecode)
 
static void entropy_decode_stereo_3990 (APEContext *ctx, int blockstodecode)
 
static void predictor_decode_mono_3800 (APEContext *ctx, int count)
 
static void predictor_decode_stereo_3800 (APEContext *ctx, int count)
 
static void predictor_decode_mono_3930 (APEContext *ctx, int count)
 
static void predictor_decode_stereo_3930 (APEContext *ctx, int count)
 
static void predictor_decode_mono_3950 (APEContext *ctx, int count)
 
static void predictor_decode_stereo_3950 (APEContext *ctx, int count)
 
static av_cold int ape_decode_close (AVCodecContext *avctx)
 
static av_cold int ape_decode_init (AVCodecContext *avctx)
 
static void update_rice (APERice *rice, unsigned int x)
 
static int get_rice_ook (GetBitContext *gb, int k)
 
static int ape_decode_value_3860 (APEContext *ctx, GetBitContext *gb, APERice *rice)
 
static int ape_decode_value_3900 (APEContext *ctx, APERice *rice)
 
static int ape_decode_value_3990 (APEContext *ctx, APERice *rice)
 
static int get_k (int ksum)
 
static void decode_array_0000 (APEContext *ctx, GetBitContext *gb, int32_t *out, APERice *rice, int blockstodecode)
 
static int init_entropy_decoder (APEContext *ctx)
 
static void init_predictor_decoder (APEContext *ctx)
 
static int APESIGN (int32_t x)
 Get inverse sign of integer (-1 for positive, 1 for negative and 0 for zero) More...
 
static av_always_inline int filter_fast_3320 (APEPredictor *p, const int decoded, const int filter, const int delayA)
 
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 void long_filter_high_3800 (int32_t *buffer, int order, int shift, int length)
 
static void long_filter_ehigh_3830 (int32_t *buffer, int length)
 
static av_always_inline int predictor_update_3930 (APEPredictor *p, const int decoded, const int filter, const int delayA)
 
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)
 
static void do_init_filter (APEFilter *f, int16_t *buf, int order)
 
static void init_filter (APEContext *ctx, APEFilter *f, int16_t *buf, int order)
 
static void do_apply_filter (APEContext *ctx, int version, APEFilter *f, int32_t *data, int count, int order, int fracbits)
 
static void apply_filter (APEContext *ctx, APEFilter *f, int32_t *data0, int32_t *data1, int count, int order, int fracbits)
 
static int init_frame_decoder (APEContext *ctx)
 
static void ape_unpack_mono (APEContext *ctx, int count)
 
static void ape_unpack_stereo (APEContext *ctx, int count)
 
static int ape_decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
 
static void ape_flush (AVCodecContext *avctx)
 

Variables

static const uint16_t ape_filter_orders [5][APE_FILTER_LEVELS]
 Filter orders depending on compression level. More...
 
static const uint8_t ape_filter_fracbits [5][APE_FILTER_LEVELS]
 Filter fraction bits depending on compression level. More...
 
static const int32_t initial_coeffs_fast_3320 [1]
 
static const int32_t initial_coeffs_a_3800 [3]
 
static const int32_t initial_coeffs_b_3800 [2]
 
static const int32_t initial_coeffs_3930 [4]
 
static const int64_t initial_coeffs_3930_64bit [4]
 
static const AVOption options []
 
static const AVClass ape_decoder_class
 
AVCodec ff_ape_decoder
 

APE range decoding functions

#define CODE_BITS   32
 
#define TOP_VALUE   ((unsigned int)1 << (CODE_BITS-1))
 
#define SHIFT_BITS   (CODE_BITS - 9)
 
#define EXTRA_BITS   ((CODE_BITS-2) % 8 + 1)
 
#define BOTTOM_VALUE   (TOP_VALUE >> 8)
 
#define MODEL_ELEMENTS   64
 
static const uint16_t counts_3970 [22]
 Fixed probabilities for symbols in Monkey Audio version 3.97. More...
 
static const uint16_t counts_diff_3970 [21]
 Probability ranges for symbols in Monkey Audio version 3.97. More...
 
static const uint16_t counts_3980 [22]
 Fixed probabilities for symbols in Monkey Audio version 3.98. More...
 
static const uint16_t counts_diff_3980 [21]
 Probability ranges for symbols in Monkey Audio version 3.98. More...
 
static void range_start_decoding (APEContext *ctx)
 Start the decoder. More...
 
static void range_dec_normalize (APEContext *ctx)
 Perform normalization. More...
 
static int range_decode_culfreq (APEContext *ctx, int tot_f)
 Calculate cumulative frequency for next symbol. More...
 
static int range_decode_culshift (APEContext *ctx, int shift)
 Decode value with given size in bits. More...
 
static void range_decode_update (APEContext *ctx, int sy_f, int lt_f)
 Update decoding state. More...
 
static int range_decode_bits (APEContext *ctx, int n)
 Decode n bits (n <= 16) without modelling. More...
 
static int range_get_symbol (APEContext *ctx, const uint16_t counts[], const uint16_t counts_diff[])
 Decode symbol. More...
 

Detailed Description

Monkey's Audio lossless audio decoder

Definition in file apedec.c.

Macro Definition Documentation

◆ MAX_CHANNELS

#define MAX_CHANNELS   2

Definition at line 42 of file apedec.c.

◆ MAX_BYTESPERSAMPLE

#define MAX_BYTESPERSAMPLE   3

Definition at line 43 of file apedec.c.

◆ APE_FRAMECODE_MONO_SILENCE

#define APE_FRAMECODE_MONO_SILENCE   1

Definition at line 45 of file apedec.c.

◆ APE_FRAMECODE_STEREO_SILENCE

#define APE_FRAMECODE_STEREO_SILENCE   3

Definition at line 46 of file apedec.c.

◆ APE_FRAMECODE_PSEUDO_STEREO

#define APE_FRAMECODE_PSEUDO_STEREO   4

Definition at line 47 of file apedec.c.

◆ HISTORY_SIZE

#define HISTORY_SIZE   512

Definition at line 49 of file apedec.c.

◆ PREDICTOR_ORDER

#define PREDICTOR_ORDER   8

Definition at line 50 of file apedec.c.

◆ PREDICTOR_SIZE

#define PREDICTOR_SIZE   50

Total size of all predictor histories.

Definition at line 52 of file apedec.c.

◆ YDELAYA

#define YDELAYA   (18 + PREDICTOR_ORDER*4)

Definition at line 54 of file apedec.c.

◆ YDELAYB

#define YDELAYB   (18 + PREDICTOR_ORDER*3)

Definition at line 55 of file apedec.c.

◆ XDELAYA

#define XDELAYA   (18 + PREDICTOR_ORDER*2)

Definition at line 56 of file apedec.c.

◆ XDELAYB

#define XDELAYB   (18 + PREDICTOR_ORDER)

Definition at line 57 of file apedec.c.

◆ YADAPTCOEFFSA

#define YADAPTCOEFFSA   18

Definition at line 59 of file apedec.c.

◆ XADAPTCOEFFSA

#define XADAPTCOEFFSA   14

Definition at line 60 of file apedec.c.

◆ YADAPTCOEFFSB

#define YADAPTCOEFFSB   10

Definition at line 61 of file apedec.c.

◆ XADAPTCOEFFSB

#define XADAPTCOEFFSB   5

Definition at line 62 of file apedec.c.

◆ APE_FILTER_LEVELS

#define APE_FILTER_LEVELS   3

Definition at line 77 of file apedec.c.

◆ CODE_BITS

#define CODE_BITS   32

Definition at line 326 of file apedec.c.

◆ TOP_VALUE

#define TOP_VALUE   ((unsigned int)1 << (CODE_BITS-1))

Definition at line 327 of file apedec.c.

◆ SHIFT_BITS

#define SHIFT_BITS   (CODE_BITS - 9)

Definition at line 328 of file apedec.c.

◆ EXTRA_BITS

#define EXTRA_BITS   ((CODE_BITS-2) % 8 + 1)

Definition at line 329 of file apedec.c.

◆ BOTTOM_VALUE

#define BOTTOM_VALUE   (TOP_VALUE >> 8)

Definition at line 330 of file apedec.c.

◆ MODEL_ELEMENTS

#define MODEL_ELEMENTS   64

Definition at line 403 of file apedec.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(APEContext, x)

Definition at line 1643 of file apedec.c.

◆ PAR

Definition at line 1644 of file apedec.c.

Enumeration Type Documentation

◆ APECompressionLevel

Possible compression levels.

Enumerator
COMPRESSION_LEVEL_FAST 
COMPRESSION_LEVEL_NORMAL 
COMPRESSION_LEVEL_HIGH 
COMPRESSION_LEVEL_EXTRA_HIGH 
COMPRESSION_LEVEL_INSANE 

Definition at line 68 of file apedec.c.

Function Documentation

◆ ape_apply_filters()

static void ape_apply_filters ( APEContext ctx,
int32_t decoded0,
int32_t decoded1,
int  count 
)
static

◆ entropy_decode_mono_0000()

static void entropy_decode_mono_0000 ( APEContext ctx,
int  blockstodecode 
)
static

Definition at line 665 of file apedec.c.

Referenced by ape_decode_init().

◆ entropy_decode_stereo_0000()

static void entropy_decode_stereo_0000 ( APEContext ctx,
int  blockstodecode 
)
static

Definition at line 671 of file apedec.c.

Referenced by ape_decode_init().

◆ entropy_decode_mono_3860()

static void entropy_decode_mono_3860 ( APEContext ctx,
int  blockstodecode 
)
static

Definition at line 679 of file apedec.c.

Referenced by ape_decode_init().

◆ entropy_decode_stereo_3860()

static void entropy_decode_stereo_3860 ( APEContext ctx,
int  blockstodecode 
)
static

Definition at line 687 of file apedec.c.

Referenced by ape_decode_init().

◆ entropy_decode_mono_3900()

static void entropy_decode_mono_3900 ( APEContext ctx,
int  blockstodecode 
)
static

Definition at line 699 of file apedec.c.

Referenced by ape_decode_init().

◆ entropy_decode_stereo_3900()

static void entropy_decode_stereo_3900 ( APEContext ctx,
int  blockstodecode 
)
static

Definition at line 707 of file apedec.c.

Referenced by ape_decode_init().

◆ entropy_decode_stereo_3930()

static void entropy_decode_stereo_3930 ( APEContext ctx,
int  blockstodecode 
)
static

Definition at line 723 of file apedec.c.

Referenced by ape_decode_init().

◆ entropy_decode_mono_3990()

static void entropy_decode_mono_3990 ( APEContext ctx,
int  blockstodecode 
)
static

Definition at line 734 of file apedec.c.

Referenced by ape_decode_init().

◆ entropy_decode_stereo_3990()

static void entropy_decode_stereo_3990 ( APEContext ctx,
int  blockstodecode 
)
static

Definition at line 742 of file apedec.c.

Referenced by ape_decode_init().

◆ predictor_decode_mono_3800()

static void predictor_decode_mono_3800 ( APEContext ctx,
int  count 
)
static

Definition at line 1041 of file apedec.c.

Referenced by ape_decode_init().

◆ predictor_decode_stereo_3800()

static void predictor_decode_stereo_3800 ( APEContext ctx,
int  count 
)
static

Definition at line 986 of file apedec.c.

Referenced by ape_decode_init().

◆ predictor_decode_mono_3930()

static void predictor_decode_mono_3930 ( APEContext ctx,
int  count 
)
static

Definition at line 1144 of file apedec.c.

Referenced by ape_decode_init().

◆ predictor_decode_stereo_3930()

static void predictor_decode_stereo_3930 ( APEContext ctx,
int  count 
)
static

Definition at line 1116 of file apedec.c.

Referenced by ape_decode_init().

◆ predictor_decode_mono_3950()

static void predictor_decode_mono_3950 ( APEContext ctx,
int  count 
)
static

Definition at line 1243 of file apedec.c.

Referenced by ape_decode_init().

◆ predictor_decode_stereo_3950()

static void predictor_decode_stereo_3950 ( APEContext ctx,
int  count 
)
static

Definition at line 1214 of file apedec.c.

Referenced by ape_decode_init().

◆ ape_decode_close()

static av_cold int ape_decode_close ( AVCodecContext avctx)
static

Definition at line 218 of file apedec.c.

◆ ape_decode_init()

static av_cold int ape_decode_init ( AVCodecContext avctx)
static

Definition at line 233 of file apedec.c.

◆ range_start_decoding()

static void range_start_decoding ( APEContext ctx)
inlinestatic

Start the decoder.

Definition at line 333 of file apedec.c.

Referenced by entropy_decode_stereo_3900(), and init_entropy_decoder().

◆ range_dec_normalize()

static void range_dec_normalize ( APEContext ctx)
inlinestatic

Perform normalization.

Definition at line 341 of file apedec.c.

Referenced by entropy_decode_stereo_3900(), range_decode_culfreq(), and range_decode_culshift().

◆ range_decode_culfreq()

static int range_decode_culfreq ( APEContext ctx,
int  tot_f 
)
inlinestatic

Calculate cumulative frequency for next symbol.

Does NO update!

Parameters
ctxdecoder context
tot_fis the total frequency or (code_value)1<<shift
Returns
the cumulative frequency

Definition at line 362 of file apedec.c.

Referenced by ape_decode_value_3990().

◆ range_decode_culshift()

static int range_decode_culshift ( APEContext ctx,
int  shift 
)
inlinestatic

Decode value with given size in bits.

Parameters
ctxdecoder context
shiftnumber of bits to decode

Definition at line 374 of file apedec.c.

Referenced by range_decode_bits(), and range_get_symbol().

◆ range_decode_update()

static void range_decode_update ( APEContext ctx,
int  sy_f,
int  lt_f 
)
inlinestatic

Update decoding state.

Parameters
ctxdecoder context
sy_fthe interval length (frequency of the symbol)
lt_fthe lower end (frequency sum of < symbols)

Definition at line 388 of file apedec.c.

Referenced by ape_decode_value_3990(), range_decode_bits(), and range_get_symbol().

◆ range_decode_bits()

static int range_decode_bits ( APEContext ctx,
int  n 
)
inlinestatic

Decode n bits (n <= 16) without modelling.

Definition at line 395 of file apedec.c.

Referenced by ape_decode_value_3900(), and ape_decode_value_3990().

◆ range_get_symbol()

static int range_get_symbol ( APEContext ctx,
const uint16_t  counts[],
const uint16_t  counts_diff[] 
)
inlinestatic

Decode symbol.

Parameters
ctxdecoder context
countsprobability range start position
counts_diffprobability range widths

Definition at line 447 of file apedec.c.

Referenced by ape_decode_value_3900(), and ape_decode_value_3990().

◆ update_rice()

static void update_rice ( APERice rice,
unsigned int  x 
)
inlinestatic

Definition at line 471 of file apedec.c.

Referenced by ape_decode_value_3900(), and ape_decode_value_3990().

◆ get_rice_ook()

static int get_rice_ook ( GetBitContext gb,
int  k 
)
inlinestatic

Definition at line 482 of file apedec.c.

Referenced by decode_array_0000().

◆ ape_decode_value_3860()

static int ape_decode_value_3860 ( APEContext ctx,
GetBitContext gb,
APERice rice 
)
inlinestatic

Definition at line 494 of file apedec.c.

Referenced by entropy_decode_mono_3860(), and entropy_decode_stereo_3860().

◆ ape_decode_value_3900()

static int ape_decode_value_3900 ( APEContext ctx,
APERice rice 
)
inlinestatic

◆ ape_decode_value_3990()

static int ape_decode_value_3990 ( APEContext ctx,
APERice rice 
)
inlinestatic

Definition at line 561 of file apedec.c.

Referenced by entropy_decode_mono_3990(), and entropy_decode_stereo_3990().

◆ get_k()

static int get_k ( int  ksum)
static

Definition at line 602 of file apedec.c.

Referenced by decode_array_0000().

◆ decode_array_0000()

static void decode_array_0000 ( APEContext ctx,
GetBitContext gb,
int32_t out,
APERice rice,
int  blockstodecode 
)
static

Definition at line 607 of file apedec.c.

Referenced by entropy_decode_mono_0000(), and entropy_decode_stereo_0000().

◆ init_entropy_decoder()

static int init_entropy_decoder ( APEContext ctx)
static

Definition at line 753 of file apedec.c.

Referenced by init_frame_decoder().

◆ init_predictor_decoder()

static void init_predictor_decoder ( APEContext ctx)
static

Definition at line 811 of file apedec.c.

Referenced by init_frame_decoder().

◆ APESIGN()

static int APESIGN ( int32_t  x)
inlinestatic

Get inverse sign of integer (-1 for positive, 1 for negative and 0 for zero)

Definition at line 864 of file apedec.c.

Referenced by do_apply_filter(), filter_3800(), long_filter_ehigh_3830(), long_filter_high_3800(), predictor_decode_mono_3950(), predictor_update_3930(), and predictor_update_filter().

◆ filter_fast_3320()

static av_always_inline int filter_fast_3320 ( APEPredictor p,
const int  decoded,
const int  filter,
const int  delayA 
)
static

Definition at line 868 of file apedec.c.

Referenced by predictor_decode_mono_3800(), and predictor_decode_stereo_3800().

◆ filter_3800()

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

Definition at line 894 of file apedec.c.

Referenced by predictor_decode_mono_3800(), and predictor_decode_stereo_3800().

◆ long_filter_high_3800()

static void long_filter_high_3800 ( int32_t buffer,
int  order,
int  shift,
int  length 
)
static

Definition at line 939 of file apedec.c.

Referenced by predictor_decode_mono_3800(), and predictor_decode_stereo_3800().

◆ long_filter_ehigh_3830()

static void long_filter_ehigh_3830 ( int32_t buffer,
int  length 
)
static

Definition at line 965 of file apedec.c.

Referenced by predictor_decode_mono_3800(), and predictor_decode_stereo_3800().

◆ predictor_update_3930()

static av_always_inline int predictor_update_3930 ( APEPredictor p,
const int  decoded,
const int  filter,
const int  delayA 
)
static

Definition at line 1086 of file apedec.c.

Referenced by predictor_decode_mono_3930(), and predictor_decode_stereo_3930().

◆ predictor_update_filter()

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 
)
static

Definition at line 1166 of file apedec.c.

Referenced by predictor_decode_stereo_3950().

◆ do_init_filter()

static void do_init_filter ( APEFilter f,
int16_t *  buf,
int  order 
)
static

Definition at line 1291 of file apedec.c.

Referenced by init_filter().

◆ init_filter()

static void init_filter ( APEContext ctx,
APEFilter f,
int16_t *  buf,
int  order 
)
static

Definition at line 1303 of file apedec.c.

Referenced by init_frame_decoder().

◆ do_apply_filter()

static void do_apply_filter ( APEContext ctx,
int  version,
APEFilter f,
int32_t data,
int  count,
int  order,
int  fracbits 
)
static

Definition at line 1309 of file apedec.c.

Referenced by apply_filter().

◆ apply_filter()

static void apply_filter ( APEContext ctx,
APEFilter f,
int32_t data0,
int32_t data1,
int  count,
int  order,
int  fracbits 
)
static

Definition at line 1371 of file apedec.c.

Referenced by ape_apply_filters().

◆ init_frame_decoder()

static int init_frame_decoder ( APEContext ctx)
static

Definition at line 1394 of file apedec.c.

Referenced by ape_decode_frame().

◆ ape_unpack_mono()

static void ape_unpack_mono ( APEContext ctx,
int  count 
)
static

Definition at line 1410 of file apedec.c.

Referenced by ape_decode_frame().

◆ ape_unpack_stereo()

static void ape_unpack_stereo ( APEContext ctx,
int  count 
)
static

Definition at line 1431 of file apedec.c.

Referenced by ape_decode_frame().

◆ ape_decode_frame()

static int ape_decode_frame ( AVCodecContext avctx,
void *  data,
int got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 1460 of file apedec.c.

◆ ape_flush()

static void ape_flush ( AVCodecContext avctx)
static

Definition at line 1637 of file apedec.c.

Variable Documentation

◆ ape_filter_orders

const uint16_t ape_filter_orders[5][APE_FILTER_LEVELS]
static
Initial value:
= {
{ 0, 0, 0 },
{ 16, 0, 0 },
{ 64, 0, 0 },
{ 32, 256, 0 },
{ 16, 256, 1280 }
}

Filter orders depending on compression level.

Definition at line 80 of file apedec.c.

Referenced by ape_apply_filters(), ape_decode_init(), and init_frame_decoder().

◆ ape_filter_fracbits

const uint8_t ape_filter_fracbits[5][APE_FILTER_LEVELS]
static
Initial value:
= {
{ 0, 0, 0 },
{ 11, 0, 0 },
{ 11, 0, 0 },
{ 10, 13, 0 },
{ 11, 13, 15 }
}

Filter fraction bits depending on compression level.

Definition at line 89 of file apedec.c.

Referenced by ape_apply_filters().

◆ counts_3970

const uint16_t counts_3970[22]
static
Initial value:
= {
0, 14824, 28224, 39348, 47855, 53994, 58171, 60926,
62682, 63786, 64463, 64878, 65126, 65276, 65365, 65419,
65450, 65469, 65480, 65487, 65491, 65493,
}

Fixed probabilities for symbols in Monkey Audio version 3.97.

Definition at line 408 of file apedec.c.

Referenced by ape_decode_value_3900().

◆ counts_diff_3970

const uint16_t counts_diff_3970[21]
static
Initial value:
= {
14824, 13400, 11124, 8507, 6139, 4177, 2755, 1756,
1104, 677, 415, 248, 150, 89, 54, 31,
19, 11, 7, 4, 2,
}

Probability ranges for symbols in Monkey Audio version 3.97.

Definition at line 417 of file apedec.c.

Referenced by ape_decode_value_3900().

◆ counts_3980

const uint16_t counts_3980[22]
static
Initial value:
= {
0, 19578, 36160, 48417, 56323, 60899, 63265, 64435,
64971, 65232, 65351, 65416, 65447, 65466, 65476, 65482,
65485, 65488, 65490, 65491, 65492, 65493,
}

Fixed probabilities for symbols in Monkey Audio version 3.98.

Definition at line 426 of file apedec.c.

Referenced by ape_decode_value_3990().

◆ counts_diff_3980

const uint16_t counts_diff_3980[21]
static
Initial value:
= {
19578, 16582, 12257, 7906, 4576, 2366, 1170, 536,
261, 119, 65, 31, 19, 10, 6, 3,
3, 2, 1, 1, 1,
}

Probability ranges for symbols in Monkey Audio version 3.98.

Definition at line 435 of file apedec.c.

Referenced by ape_decode_value_3990().

◆ initial_coeffs_fast_3320

const int32_t initial_coeffs_fast_3320[1]
static
Initial value:
= {
375,
}

Definition at line 791 of file apedec.c.

Referenced by init_predictor_decoder().

◆ initial_coeffs_a_3800

const int32_t initial_coeffs_a_3800[3]
static
Initial value:
= {
64, 115, 64,
}

Definition at line 795 of file apedec.c.

Referenced by init_predictor_decoder().

◆ initial_coeffs_b_3800

const int32_t initial_coeffs_b_3800[2]
static
Initial value:
= {
740, 0
}

Definition at line 799 of file apedec.c.

Referenced by init_predictor_decoder().

◆ initial_coeffs_3930

const int32_t initial_coeffs_3930[4]
static
Initial value:
= {
360, 317, -109, 98
}

Definition at line 803 of file apedec.c.

Referenced by init_predictor_decoder().

◆ initial_coeffs_3930_64bit

const int64_t initial_coeffs_3930_64bit[4]
static
Initial value:
= {
360, 317, -109, 98
}

Definition at line 807 of file apedec.c.

Referenced by init_predictor_decoder().

◆ options

const AVOption options[]
static
Initial value:
= {
{ "max_samples", "maximum number of samples decoded per call", OFFSET(blocks_per_loop), AV_OPT_TYPE_INT, { .i64 = 4608 }, 1, INT_MAX, PAR, "max_samples" },
{ "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" },
{ NULL},
}

Definition at line 1645 of file apedec.c.

◆ ape_decoder_class

const AVClass ape_decoder_class
static
Initial value:
= {
.class_name = "APE decoder",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 1651 of file apedec.c.

◆ ff_ape_decoder

AVCodec ff_ape_decoder
Initial value:
= {
.name = "ape",
.long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"),
.priv_data_size = sizeof(APEContext),
.close = ape_decode_close,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.priv_class = &ape_decoder_class,
}

Definition at line 1658 of file apedec.c.

init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
AV_CODEC_ID_APE
@ AV_CODEC_ID_APE
Definition: codec_id.h:456
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:925
ape_decoder_class
static const AVClass ape_decoder_class
Definition: apedec.c:1651
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:68
ape_flush
static void ape_flush(AVCodecContext *avctx)
Definition: apedec.c:1637
ape_decode_init
static av_cold int ape_decode_init(AVCodecContext *avctx)
Definition: apedec.c:233
options
static const AVOption options[]
Definition: apedec.c:1645
decode
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
OFFSET
#define OFFSET(x)
Definition: apedec.c:1643
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
flush
static void flush(AVCodecContext *avctx)
Definition: aacdec_template.c:592
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
APEContext
Decoder context.
Definition: apedec.c:152
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
AV_SAMPLE_FMT_U8P
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition: samplefmt.h:66
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
PAR
#define PAR
Definition: apedec.c:1644
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:67
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:49
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
ape_decode_close
static av_cold int ape_decode_close(AVCodecContext *avctx)
Definition: apedec.c:218
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_CODEC_CAP_DELAY
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: codec.h:77
AV_CODEC_CAP_SUBFRAMES
#define AV_CODEC_CAP_SUBFRAMES
Codec can output multiple frames per AVPacket Normally demuxers return one frame at a time,...
Definition: codec.h:95
ape_decode_frame
static int ape_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: apedec.c:1460
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234