FFmpeg
Functions | Variables
aptx.c File Reference
#include "aptx.h"
#include "mathops.h"

Go to the source code of this file.

Functions

static av_always_inline void aptx_update_codeword_history (Channel *channel)
 
void ff_aptx_generate_dither (Channel *channel)
 
static void aptx_invert_quantization (InvertQuantize *invert_quantize, int32_t quantized_sample, int32_t dither, ConstTables *tables)
 
static int32_taptx_reconstructed_differences_update (Prediction *prediction, int32_t reconstructed_difference, int order)
 
static void aptx_prediction_filtering (Prediction *prediction, int32_t reconstructed_difference, int order)
 
static void aptx_process_subband (InvertQuantize *invert_quantize, Prediction *prediction, int32_t quantized_sample, int32_t dither, ConstTables *tables)
 
void ff_aptx_invert_quantize_and_prediction (Channel *channel, int hd)
 
av_cold int ff_aptx_init (AVCodecContext *avctx)
 

Variables

static const int32_t quantize_intervals_LF [65]
 
static const int32_t invert_quantize_dither_factors_LF [65]
 
static const int32_t quantize_dither_factors_LF [65]
 
static const int16_t quantize_factor_select_offset_LF [65]
 
static const int32_t quantize_intervals_MLF [9]
 
static const int32_t invert_quantize_dither_factors_MLF [9]
 
static const int32_t quantize_dither_factors_MLF [9]
 
static const int16_t quantize_factor_select_offset_MLF [9]
 
static const int32_t quantize_intervals_MHF [3]
 
static const int32_t invert_quantize_dither_factors_MHF [3]
 
static const int32_t quantize_dither_factors_MHF [3]
 
static const int16_t quantize_factor_select_offset_MHF [3]
 
static const int32_t quantize_intervals_HF [5]
 
static const int32_t invert_quantize_dither_factors_HF [5]
 
static const int32_t quantize_dither_factors_HF [5]
 
static const int16_t quantize_factor_select_offset_HF [5]
 
static const int32_t hd_quantize_intervals_LF [257]
 
static const int32_t hd_invert_quantize_dither_factors_LF [257]
 
static const int32_t hd_quantize_dither_factors_LF [256]
 
static const int16_t hd_quantize_factor_select_offset_LF [257]
 
static const int32_t hd_quantize_intervals_MLF [33]
 
static const int32_t hd_invert_quantize_dither_factors_MLF [33]
 
static const int32_t hd_quantize_dither_factors_MLF [32]
 
static const int16_t hd_quantize_factor_select_offset_MLF [33]
 
static const int32_t hd_quantize_intervals_MHF [9]
 
static const int32_t hd_invert_quantize_dither_factors_MHF [9]
 
static const int32_t hd_quantize_dither_factors_MHF [8]
 
static const int16_t hd_quantize_factor_select_offset_MHF [9]
 
static const int32_t hd_quantize_intervals_HF [17]
 
static const int32_t hd_invert_quantize_dither_factors_HF [17]
 
static const int32_t hd_quantize_dither_factors_HF [16]
 
static const int16_t hd_quantize_factor_select_offset_HF [17]
 
ConstTables ff_aptx_quant_tables [2][NB_SUBBANDS]
 
static const int16_t quantization_factors [32]
 

Function Documentation

◆ aptx_update_codeword_history()

static av_always_inline void aptx_update_codeword_history ( Channel channel)
static

Definition at line 377 of file aptx.c.

Referenced by ff_aptx_generate_dither().

◆ ff_aptx_generate_dither()

void ff_aptx_generate_dither ( Channel channel)

Definition at line 385 of file aptx.c.

Referenced by aptx_decode_samples(), and aptx_encode_channel().

◆ aptx_invert_quantization()

static void aptx_invert_quantization ( InvertQuantize invert_quantize,
int32_t  quantized_sample,
int32_t  dither,
ConstTables tables 
)
static

Definition at line 400 of file aptx.c.

Referenced by aptx_process_subband().

◆ aptx_reconstructed_differences_update()

static int32_t* aptx_reconstructed_differences_update ( Prediction prediction,
int32_t  reconstructed_difference,
int  order 
)
static

Definition at line 425 of file aptx.c.

Referenced by aptx_prediction_filtering().

◆ aptx_prediction_filtering()

static void aptx_prediction_filtering ( Prediction prediction,
int32_t  reconstructed_difference,
int  order 
)
static

Definition at line 438 of file aptx.c.

Referenced by aptx_process_subband().

◆ aptx_process_subband()

static void aptx_process_subband ( InvertQuantize invert_quantize,
Prediction prediction,
int32_t  quantized_sample,
int32_t  dither,
ConstTables tables 
)
static

Definition at line 464 of file aptx.c.

Referenced by ff_aptx_invert_quantize_and_prediction().

◆ ff_aptx_invert_quantize_and_prediction()

void ff_aptx_invert_quantize_and_prediction ( Channel channel,
int  hd 
)

Definition at line 497 of file aptx.c.

Referenced by aptx_decode_samples(), and aptx_encode_samples().

◆ ff_aptx_init()

av_cold int ff_aptx_init ( AVCodecContext avctx)

Definition at line 508 of file aptx.c.

Referenced by aptx_encode_init().

Variable Documentation

◆ quantize_intervals_LF

const int32_t quantize_intervals_LF[65]
static
Initial value:
= {
-9948, 9948, 29860, 49808, 69822, 89926, 110144, 130502,
151026, 171738, 192666, 213832, 235264, 256982, 279014, 301384,
324118, 347244, 370790, 394782, 419250, 444226, 469742, 495832,
522536, 549890, 577936, 606720, 636290, 666700, 698006, 730270,
763562, 797958, 833538, 870398, 908640, 948376, 989740, 1032874,
1077948, 1125150, 1174700, 1226850, 1281900, 1340196, 1402156, 1468282,
1539182, 1615610, 1698514, 1789098, 1888944, 2000168, 2125700, 2269750,
2438670, 2642660, 2899462, 3243240, 3746078, 4535138, 5664098, 7102424,
8897462,
}

Definition at line 27 of file aptx.c.

◆ invert_quantize_dither_factors_LF

const int32_t invert_quantize_dither_factors_LF[65]
static
Initial value:
= {
9948, 9948, 9962, 9988, 10026, 10078, 10142, 10218,
10306, 10408, 10520, 10646, 10784, 10934, 11098, 11274,
11462, 11664, 11880, 12112, 12358, 12618, 12898, 13194,
13510, 13844, 14202, 14582, 14988, 15422, 15884, 16380,
16912, 17484, 18098, 18762, 19480, 20258, 21106, 22030,
23044, 24158, 25390, 26760, 28290, 30008, 31954, 34172,
36728, 39700, 43202, 47382, 52462, 58762, 66770, 77280,
91642, 112348, 144452, 199326, 303512, 485546, 643414, 794914,
1000124,
}

Definition at line 38 of file aptx.c.

◆ quantize_dither_factors_LF

const int32_t quantize_dither_factors_LF[65]
static
Initial value:
= {
0, 4, 7, 10, 13, 16, 19, 22,
26, 28, 32, 35, 38, 41, 44, 47,
51, 54, 58, 62, 65, 70, 74, 79,
84, 90, 95, 102, 109, 116, 124, 133,
143, 154, 166, 180, 195, 212, 231, 254,
279, 308, 343, 383, 430, 487, 555, 639,
743, 876, 1045, 1270, 1575, 2002, 2628, 3591,
5177, 8026, 13719, 26047, 45509, 39467, 37875, 51303,
0,
}

Definition at line 49 of file aptx.c.

◆ quantize_factor_select_offset_LF

const int16_t quantize_factor_select_offset_LF[65]
static
Initial value:
= {
0, -21, -19, -17, -15, -12, -10, -8,
-6, -4, -1, 1, 3, 6, 8, 10,
13, 15, 18, 20, 23, 26, 29, 31,
34, 37, 40, 43, 47, 50, 53, 57,
60, 64, 68, 72, 76, 80, 85, 89,
94, 99, 105, 110, 116, 123, 129, 136,
144, 152, 161, 171, 182, 194, 207, 223,
241, 263, 291, 328, 382, 467, 522, 522,
522,
}

Definition at line 60 of file aptx.c.

◆ quantize_intervals_MLF

const int32_t quantize_intervals_MLF[9]
static
Initial value:
= {
-89806, 89806, 278502, 494338, 759442, 1113112, 1652322, 2720256, 5190186,
}

Definition at line 73 of file aptx.c.

◆ invert_quantize_dither_factors_MLF

const int32_t invert_quantize_dither_factors_MLF[9]
static
Initial value:
= {
89806, 89806, 98890, 116946, 148158, 205512, 333698, 734236, 1735696,
}

Definition at line 76 of file aptx.c.

◆ quantize_dither_factors_MLF

const int32_t quantize_dither_factors_MLF[9]
static
Initial value:
= {
0, 2271, 4514, 7803, 14339, 32047, 100135, 250365, 0,
}

Definition at line 79 of file aptx.c.

◆ quantize_factor_select_offset_MLF

const int16_t quantize_factor_select_offset_MLF[9]
static
Initial value:
= {
0, -14, 6, 29, 58, 96, 154, 270, 521,
}

Definition at line 82 of file aptx.c.

◆ quantize_intervals_MHF

const int32_t quantize_intervals_MHF[3]
static
Initial value:
= {
-194080, 194080, 890562,
}

Definition at line 87 of file aptx.c.

◆ invert_quantize_dither_factors_MHF

const int32_t invert_quantize_dither_factors_MHF[3]
static
Initial value:
= {
194080, 194080, 502402,
}

Definition at line 90 of file aptx.c.

◆ quantize_dither_factors_MHF

const int32_t quantize_dither_factors_MHF[3]
static
Initial value:
= {
0, 77081, 0,
}

Definition at line 93 of file aptx.c.

◆ quantize_factor_select_offset_MHF

const int16_t quantize_factor_select_offset_MHF[3]
static
Initial value:
= {
0, -33, 136,
}

Definition at line 96 of file aptx.c.

◆ quantize_intervals_HF

const int32_t quantize_intervals_HF[5]
static
Initial value:
= {
-163006, 163006, 542708, 1120554, 2669238,
}

Definition at line 101 of file aptx.c.

◆ invert_quantize_dither_factors_HF

const int32_t invert_quantize_dither_factors_HF[5]
static
Initial value:
= {
163006, 163006, 216698, 361148, 1187538,
}

Definition at line 104 of file aptx.c.

◆ quantize_dither_factors_HF

const int32_t quantize_dither_factors_HF[5]
static
Initial value:
= {
0, 13423, 36113, 206598, 0,
}

Definition at line 107 of file aptx.c.

◆ quantize_factor_select_offset_HF

const int16_t quantize_factor_select_offset_HF[5]
static
Initial value:
= {
0, -8, 33, 95, 262,
}

Definition at line 110 of file aptx.c.

◆ hd_quantize_intervals_LF

const int32_t hd_quantize_intervals_LF[257]
static

Definition at line 115 of file aptx.c.

◆ hd_invert_quantize_dither_factors_LF

const int32_t hd_invert_quantize_dither_factors_LF[257]
static

Definition at line 150 of file aptx.c.

◆ hd_quantize_dither_factors_LF

const int32_t hd_quantize_dither_factors_LF[256]
static

Definition at line 184 of file aptx.c.

◆ hd_quantize_factor_select_offset_LF

const int16_t hd_quantize_factor_select_offset_LF[257]
static

Definition at line 218 of file aptx.c.

◆ hd_quantize_intervals_MLF

const int32_t hd_quantize_intervals_MLF[33]
static
Initial value:
= {
-21236, 21236, 63830, 106798, 150386, 194832, 240376, 287258,
335726, 386034, 438460, 493308, 550924, 611696, 676082, 744626,
817986, 896968, 982580, 1076118, 1179278, 1294344, 1424504, 1574386,
1751090, 1966260, 2240868, 2617662, 3196432, 4176450, 5658260, 7671068,
10380372,
}

Definition at line 254 of file aptx.c.

◆ hd_invert_quantize_dither_factors_MLF

const int32_t hd_invert_quantize_dither_factors_MLF[33]
static
Initial value:
= {
21236, 21236, 21360, 21608, 21978, 22468, 23076, 23806,
24660, 25648, 26778, 28070, 29544, 31228, 33158, 35386,
37974, 41008, 44606, 48934, 54226, 60840, 69320, 80564,
96140, 119032, 155576, 221218, 357552, 622468, 859344, 1153464, 1555840,
}

Definition at line 261 of file aptx.c.

◆ hd_quantize_dither_factors_MLF

const int32_t hd_quantize_dither_factors_MLF[32]
static
Initial value:
= {
0, 31, 62, 93, 123, 152, 183, 214,
247, 283, 323, 369, 421, 483, 557, 647,
759, 900, 1082, 1323, 1654, 2120, 2811, 3894,
5723, 9136, 16411, 34084, 66229, 59219, 73530, 100594,
}

Definition at line 267 of file aptx.c.

◆ hd_quantize_factor_select_offset_MLF

const int16_t hd_quantize_factor_select_offset_MLF[33]
static
Initial value:
= {
0, -21, -16, -12, -7, -2, 3, 8,
13, 19, 24, 30, 36, 43, 50, 57,
65, 74, 83, 93, 104, 117, 131, 147,
166, 189, 219, 259, 322, 427, 521, 521, 521,
}

Definition at line 273 of file aptx.c.

◆ hd_quantize_intervals_MHF

const int32_t hd_quantize_intervals_MHF[9]
static
Initial value:
= {
-95044, 95044, 295844, 528780, 821332, 1226438, 1890540, 3344850, 6450664,
}

Definition at line 281 of file aptx.c.

◆ hd_invert_quantize_dither_factors_MHF

const int32_t hd_invert_quantize_dither_factors_MHF[9]
static
Initial value:
= {
95044, 95044, 105754, 127180, 165372, 39736, 424366, 1029946, 2075866,
}

Definition at line 284 of file aptx.c.

◆ hd_quantize_dither_factors_MHF

const int32_t hd_quantize_dither_factors_MHF[8]
static
Initial value:
= {
0, 2678, 5357, 9548, -31409, 96158, 151395, 261480,
}

Definition at line 287 of file aptx.c.

◆ hd_quantize_factor_select_offset_MHF

const int16_t hd_quantize_factor_select_offset_MHF[9]
static
Initial value:
= {
0, -17, 5, 30, 62, 105, 177, 334, 518,
}

Definition at line 290 of file aptx.c.

◆ hd_quantize_intervals_HF

const int32_t hd_quantize_intervals_HF[17]
static
Initial value:
= {
-45754, 45754, 138496, 234896, 337336, 448310, 570738, 708380,
866534, 1053262, 1281958, 1577438, 1993050, 2665984, 3900982, 5902844,
8897462,
}

Definition at line 295 of file aptx.c.

◆ hd_invert_quantize_dither_factors_HF

const int32_t hd_invert_quantize_dither_factors_HF[17]
static
Initial value:
= {
45754, 45754, 46988, 49412, 53026, 57950, 64478, 73164,
84988, 101740, 126958, 168522, 247092, 425842, 809154, 1192708, 1801910,
}

Definition at line 300 of file aptx.c.

◆ hd_quantize_dither_factors_HF

const int32_t hd_quantize_dither_factors_HF[16]
static
Initial value:
= {
0, 309, 606, 904, 1231, 1632, 2172, 2956,
4188, 6305, 10391, 19643, 44688, 95828, 95889, 152301,
}

Definition at line 304 of file aptx.c.

◆ hd_quantize_factor_select_offset_HF

const int16_t hd_quantize_factor_select_offset_HF[17]
static
Initial value:
= {
0, -18, -8, 2, 13, 25, 38, 53,
70, 90, 115, 147, 192, 264, 398, 521, 521,
}

Definition at line 308 of file aptx.c.

◆ ff_aptx_quant_tables

ConstTables ff_aptx_quant_tables[2][NB_SUBBANDS]

Definition at line 313 of file aptx.c.

Referenced by aptx_encode_channel(), and ff_aptx_invert_quantize_and_prediction().

◆ quantization_factors

const int16_t quantization_factors[32]
static
Initial value:
= {
2048, 2093, 2139, 2186, 2233, 2282, 2332, 2383,
2435, 2489, 2543, 2599, 2656, 2714, 2774, 2834,
2896, 2960, 3025, 3091, 3158, 3228, 3298, 3371,
3444, 3520, 3597, 3676, 3756, 3838, 3922, 4008,
}

Definition at line 368 of file aptx.c.

Referenced by aptx_invert_quantization().