44#define DCA_MAX_FRAME_SIZE 16384
45#define DCA_HEADER_SIZE 13
46#define DCA_LFE_SAMPLES 8
48#define DCAENC_SUBBANDS 32
51#define SUBBAND_SAMPLES (SUBFRAMES * SUBSUBFRAMES * 8)
54#define COS_T(x) (c->cos_table[(x) & 2047])
115 double f1 =
f / 1000;
117 return -3.64 * pow(f1, -0.8)
118 + 6.8 *
exp(-0.6 * (f1 - 3.4) * (f1 - 3.4))
119 - 6.0 *
exp(-0.15 * (f1 - 8.7) * (f1 - 8.7))
120 - 0.0006 * (f1 * f1) * (f1 * f1);
129 return 20 * log10(
h);
145 c->subband[ch][band] = bufer +
155 if (
c->subband[0][0]) {
158 c->subband[0][0] =
NULL;
168 const uint8_t (**src_tablep)[2])
170 const uint8_t (*src_table)[2] = *src_tablep;
173 for (
unsigned i = 0;
i < count;
i++) {
174 unsigned dst_idx = src_table[
i][0];
176 dst[dst_idx][0] =
code >> (16 - src_table[
i][1]);
177 dst[dst_idx][1] = src_table[
i][1];
179 code += 1 << (16 - src_table[
i][1]);
181 *src_tablep += count;
207 int i, j, k, min_frame_bits;
214 c->fullband_channels =
c->channels =
layout.nb_channels;
215 c->lfe_channel = (
c->channels == 3 ||
c->channels == 6);
216 c->band_interpolation =
c->band_interpolation_tab[1];
217 c->band_spectrum =
c->band_spectrum_tab[1];
218 c->worst_quantization_noise = -2047;
219 c->worst_noise_ever = -2047;
220 c->consumed_adpcm_bits = 0;
225 switch (
layout.nb_channels) {
227 c->channel_config = 0;
230 c->channel_config = 2;
233 c->channel_config = 8;
236 c->channel_config = 9;
239 c->channel_config = 9;
245 if (
c->lfe_channel) {
246 c->fullband_channels--;
257 c->bit_allocation_sel[
i] = 6;
261 c->prediction_mode[
i][j] = -1;
266 for (
i = 0;
i < 9;
i++) {
272 c->samplerate_index =
i;
280 c->bitrate_index =
i;
282 min_frame_bits = 132 + (493 + 28 * 32) *
c->fullband_channels +
c->lfe_channel * 72;
286 c->frame_size = (
c->frame_bits + 7) / 8;
294 c->cos_table[0] = 0x7fffffff;
295 c->cos_table[512] = 0;
296 c->cos_table[1024] = -
c->cos_table[0];
297 for (
i = 1;
i < 512;
i++) {
299 c->cos_table[1024-
i] = -
c->cos_table[
i];
300 c->cos_table[1024+
i] = -
c->cos_table[
i];
301 c->cos_table[2048-
i] = +
c->cos_table[
i];
304 for (
i = 0;
i < 2048;
i++)
307 for (k = 0; k < 32; k++) {
308 for (j = 0; j < 8; j++) {
314 for (
i = 0;
i < 512;
i++) {
319 for (
i = 0;
i < 9;
i++) {
320 for (j = 0; j <
AUBANDS; j++) {
321 for (k = 0; k < 256; k++) {
329 for (
i = 0;
i < 256;
i++) {
331 c->cb_to_add[
i] = (
int32_t)(100 * log10(add));
333 for (j = 0; j < 8; j++) {
335 for (
i = 0;
i < 512;
i++) {
337 accum += reconst * cos(2 *
M_PI * (
i + 0.5 - 256) * (j + 0.5) / 512);
339 c->band_spectrum_tab[0][j] = (
int32_t)(200 * log10(accum));
341 for (j = 0; j < 8; j++) {
343 for (
i = 0;
i < 512;
i++) {
345 accum += reconst * cos(2 *
M_PI * (
i + 0.5 - 256) * (j + 0.5) / 512);
347 c->band_spectrum_tab[1][j] = (
int32_t)(200 * log10(accum));
366 int ch, subs,
i, k, j;
368 for (ch = 0; ch <
c->fullband_channels; ch++) {
372 const int chi =
c->channel_order_tab[ch];
374 memcpy(hist, &
c->history[ch][0], 512 *
sizeof(
int32_t));
382 memset(accum, 0, 64 *
sizeof(
int32_t));
384 for (k = 0,
i = hist_start, j = 0;
385 i < 512; k = (k + 1) & 63,
i++, j++)
386 accum[k] +=
mul32(hist[
i],
c->band_interpolation[j]);
387 for (
i = 0;
i < hist_start; k = (k + 1) & 63,
i++, j++)
388 accum[k] +=
mul32(hist[
i],
c->band_interpolation[j]);
390 for (k = 16; k < 32; k++)
391 accum[k] = accum[k] - accum[31 - k];
392 for (k = 32; k < 48; k++)
393 accum[k] = accum[k] + accum[95 - k];
395 for (band = 0; band < 32; band++) {
397 for (
i = 16;
i < 48;
i++) {
398 int s = (2 * band + 1) * (2 * (
i + 16) + 1);
402 c->subband[ch][band][subs] = ((band + 1) & 2) ? -resp : resp;
406 for (
i = 0;
i < 32;
i++)
407 hist[
i + hist_start] = input[(subs * 32 +
i) *
c->channels + chi];
409 hist_start = (hist_start + 32) & 511;
417 const int lfech =
lfe_index[
c->channel_config];
423 memcpy(hist, &
c->history[
c->channels - 1][0], 512 *
sizeof(
int32_t));
429 for (
i = hist_start, j = 0;
i < 512;
i++, j++)
430 accum +=
mul32(hist[
i],
c->lfe_fir_64i[j]);
431 for (
i = 0;
i < hist_start;
i++, j++)
432 accum +=
mul32(hist[
i],
c->lfe_fir_64i[j]);
434 c->downsampled_lfe[lfes] = accum;
437 for (
i = 0;
i < 64;
i++)
438 hist[
i + hist_start] = input[(lfes * 64 +
i) *
c->channels + lfech];
440 hist_start = (hist_start + 64) & 511;
447 for (
unsigned i = 0;
i < n;
i++)
453 uint8_t n, uint8_t sel)
455 for (
unsigned i = 0;
i < n;
i++)
461 uint8_t sel, uint8_t
table)
464 for (
unsigned i = 0;
i < n;
i++)
470 uint8_t n, uint8_t sel, uint8_t
table)
472 for (
unsigned i = 0;
i < n;
i++)
482 for (
i = 1024;
i > 0;
i >>= 1) {
483 if (
c->cb_to_level[
i + res] >= in)
496 return a +
c->cb_to_add[
a -
b];
506 for (
i = 0;
i < 512;
i++)
510 for (
i = 0;
i < 256;
i++) {
524 const int samplerate_index =
c->samplerate_index;
529 for (j = 0; j < 256; j++)
530 out_cb_unnorm[j] = -2047;
534 for (j = 0; j < 256; j++)
535 denom =
add_cb(
c, denom,
power[j] +
c->auf[samplerate_index][
i][j]);
536 for (j = 0; j < 256; j++)
537 out_cb_unnorm[j] =
add_cb(
c, out_cb_unnorm[j],
538 -denom +
c->auf[samplerate_index][
i][j]);
541 for (j = 0; j < 256; j++)
542 out_cb[j] =
add_cb(
c, out_cb[j], -out_cb_unnorm[j] - ca_cb - cs_cb);
555 for (
f = 0;
f < 4;
f++)
558 for (
f = 0;
f < 8;
f++)
559 walk(
c, band, band - 1, 8 * band - 4 +
f,
570 for (
f = 0;
f < 4;
f++)
573 for (
f = 0;
f < 8;
f++)
574 walk(
c, band, band + 1, 8 * band + 4 +
f,
586 c->band_masking_cb[band1] =
value;
591 int i, k, band, ch, ssf;
594 for (
i = 0;
i < 256;
i++)
596 c->masking_curve_cb[ssf][
i] = -2047;
599 for (ch = 0; ch <
c->fullband_channels; ch++) {
600 const int chi =
c->channel_order_tab[ch];
602 for (
i = 0, k = 128 + 256 * ssf; k < 512;
i++, k++)
603 data[
i] =
c->history[ch][k];
604 for (k -= 512;
i < 512;
i++, k++)
605 data[
i] = input[k *
c->channels + chi];
608 for (
i = 0;
i < 256;
i++) {
612 if (
c->masking_curve_cb[ssf][
i] < m)
613 m =
c->masking_curve_cb[ssf][
i];
614 c->eff_masking_curve_cb[
i] = m;
617 for (band = 0; band < 32; band++) {
618 c->band_masking_cb[band] = 2048;
640 for (ch = 0; ch <
c->fullband_channels; ch++) {
641 for (band = 0; band < 32; band++)
642 c->peak_cb[ch][band] =
find_peak(
c,
c->subband[ch][band],
657 c->consumed_adpcm_bits = 0;
658 for (ch = 0; ch <
c->fullband_channels; ch++) {
659 for (band = 0; band < 32; band++) {
663 if (pred_vq_id >= 0) {
664 c->prediction_mode[ch][band] = pred_vq_id;
665 c->consumed_adpcm_bits += 12;
666 c->diff_peak_cb[ch][band] =
find_peak(
c, estimated_diff, 16);
668 c->prediction_mode[ch][band] = -1;
676#define USED_26ABITS 4
682 if (
c->bitrate_index == 3)
694 int our_nscale, try_remove;
701 peak =
c->cb_to_level[-peak_cb];
703 for (try_remove = 64; try_remove > 0; try_remove >>= 1) {
710 our_nscale -= try_remove;
713 if (our_nscale >= 125)
726 int32_t diff_peak_cb =
c->diff_peak_cb[ch][band];
729 &
c->quant[ch][band]);
735 step_size,
c->adpcm_history[ch][band],
c->subband[ch][band],
736 c->adpcm_history[ch][band] + 4,
c->quantized[ch][band],
744 for (ch = 0; ch <
c->fullband_channels; ch++)
745 for (band = 0; band < 32; band++)
746 if (
c->prediction_mode[ch][band] >= 0)
754 for (ch = 0; ch <
c->fullband_channels; ch++) {
755 for (band = 0; band < 32; band++) {
756 if (
c->prediction_mode[ch][band] == -1) {
770 uint8_t sel,
id = abits - 1;
783 uint32_t t,
bits = 0;
788 if (vlc_bits[
i][0] == 0) {
795 best_sel_bits[
i] = vlc_bits[
i][0];
798 if (best_sel_bits[
i] > vlc_bits[
i][sel] && vlc_bits[
i][sel]) {
799 best_sel_bits[
i] = vlc_bits[
i][sel];
800 best_sel_id[
i] = sel;
805 t = best_sel_bits[
i] + 2;
806 if (t < clc_bits[
i]) {
807 res[
i] = best_sel_id[
i];
827 if (abits[
i] > 12 || abits[
i] == 0) {
850 uint32_t bits_counter = 0;
852 c->consumed_bits = 132 + 333 *
c->fullband_channels;
853 c->consumed_bits +=
c->consumed_adpcm_bits;
855 c->consumed_bits += 72;
858 for (ch = 0; ch <
c->fullband_channels; ch++) {
859 for (band = 0; band < 32; band++) {
860 int snr_cb =
c->peak_cb[ch][band] -
c->band_masking_cb[band] -
noise;
862 if (snr_cb >= 1312) {
863 c->abits[ch][band] = 26;
865 }
else if (snr_cb >= 222) {
866 c->abits[ch][band] = 8 +
mul32(snr_cb - 222, 69000000);
868 }
else if (snr_cb >= 0) {
869 c->abits[ch][band] = 2 +
mul32(snr_cb, 106000000);
871 }
else if (forbid_zero || snr_cb >= -140) {
872 c->abits[ch][band] = 1;
875 c->abits[ch][band] = 0;
880 &
c->bit_allocation_sel[ch]);
886 for (ch = 0; ch <
c->fullband_channels; ch++) {
887 for (band = 0; band < 32; band++) {
888 if (
c->prediction_mode[ch][band] == -1) {
891 &
c->quant[ch][band]);
900 for (ch = 0; ch <
c->fullband_channels; ch++) {
901 for (band = 0; band < 32; band++) {
904 c->quantized[ch][band],
905 huff_bit_count_accum[ch][
c->abits[ch][band] - 1]);
906 clc_bit_count_accum[ch][
c->abits[ch][band] - 1] +=
bit_consumption[
c->abits[ch][band]];
913 for (ch = 0; ch <
c->fullband_channels; ch++) {
915 clc_bit_count_accum[ch],
916 c->quant_index_sel[ch]);
919 c->consumed_bits += bits_counter;
932 low =
high =
c->worst_quantization_noise;
933 if (
c->consumed_bits >
c->frame_bits) {
934 while (
c->consumed_bits >
c->frame_bits) {
944 while (
c->consumed_bits <=
c->frame_bits) {
954 for (down =
snr_fudge >> 1; down; down >>= 1) {
956 if (
c->consumed_bits <=
c->frame_bits)
961 c->worst_quantization_noise =
high;
962 if (
high >
c->worst_noise_ever)
963 c->worst_noise_ever =
high;
970 for (k = 0; k < 512; k++)
971 for (ch = 0; ch <
c->channels; ch++) {
972 const int chi =
c->channel_order_tab[ch];
974 c->history[ch][k] = input[k *
c->channels + chi];
986 for (ch = 0; ch <
c->channels; ch++) {
987 for (band = 0; band < 32; band++) {
989 if (
c->prediction_mode[ch][band] == -1) {
993 c->quantized[ch][band]+12, step_size,
996 AV_COPY128U(
c->adpcm_history[ch][band],
c->adpcm_history[ch][band]+4);
1006 samples[0] =
c->adpcm_history[ch][band][0] * (1 << 7);
1007 samples[1] =
c->adpcm_history[ch][band][1] * (1 << 7);
1008 samples[2] =
c->adpcm_history[ch][band][2] * (1 << 7);
1009 samples[3] =
c->adpcm_history[ch][band][3] * (1 << 7);
1110 put_bits(&
c->pb, 3,
c->fullband_channels - 1);
1113 for (ch = 0; ch <
c->fullband_channels; ch++)
1117 for (ch = 0; ch <
c->fullband_channels; ch++)
1121 for (ch = 0; ch <
c->fullband_channels; ch++)
1125 for (ch = 0; ch <
c->fullband_channels; ch++)
1129 for (ch = 0; ch <
c->fullband_channels; ch++)
1133 for (ch = 0; ch <
c->fullband_channels; ch++)
1134 put_bits(&
c->pb, 3,
c->bit_allocation_sel[ch]);
1138 for (ch = 0; ch <
c->fullband_channels; ch++)
1143 for (ch = 0; ch <
c->fullband_channels; ch++)
1152 int i, j, sum,
bits, sel;
1155 sel =
c->quant_index_sel[ch][
c->abits[ch][band] - 1];
1159 sel,
c->abits[ch][band] - 1);
1164 if (
c->abits[ch][band] <= 7) {
1165 for (
i = 0;
i < 8;
i += 4) {
1167 for (j = 3; j >= 0; j--) {
1169 sum +=
c->quantized[ch][band][
ss * 8 +
i + j];
1178 for (
i = 0;
i < 8;
i++) {
1186 int i, band,
ss, ch;
1195 for (ch = 0; ch <
c->fullband_channels; ch++)
1197 put_bits(&
c->pb, 1, !(
c->prediction_mode[ch][band] == -1));
1200 for (ch = 0; ch <
c->fullband_channels; ch++)
1202 if (
c->prediction_mode[ch][band] >= 0)
1203 put_bits(&
c->pb, 12,
c->prediction_mode[ch][band]);
1206 for (ch = 0; ch <
c->fullband_channels; ch++) {
1207 if (
c->bit_allocation_sel[ch] == 6) {
1213 c->bit_allocation_sel[ch]);
1219 for (ch = 0; ch <
c->fullband_channels; ch++)
1221 if (
c->abits[ch][band])
1226 for (ch = 0; ch <
c->fullband_channels; ch++)
1228 if (
c->abits[ch][band])
1229 put_bits(&
c->pb, 7,
c->scale_factor[ch][band]);
1239 if (
c->lfe_channel) {
1247 for (ch = 0; ch <
c->fullband_channels; ch++)
1249 if (
c->abits[ch][band])
1273 if (
c->options.adpcm_mode)
1290 *got_packet_ptr = 1;
1294#define DCAENC_FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
1302 .class_name =
"DCA (DTS Coherent Acoustics)",
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
static const float bands[]
const FFCodec ff_dca_encoder
static const FFCodecDefault defaults[]
static av_cold void close(AVCodecParserContext *s)
static av_cold int encode_init(AVCodecContext *avctx)
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 i(width, name, range_min, range_max)
#define ss(width, name, subs,...)
Public libavutil channel layout APIs header.
#define CODEC_SAMPLERATES_ARRAY(array)
#define CODEC_CH_LAYOUTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define CODEC_SAMPLEFMTS(...)
common internal and external API header
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static void ff_dca_core_dequantize(int32_t *output, const int32_t *input, int32_t step_size, int32_t scale, int residual, int len)
static const int8_t channel_reorder_lfe[7][5]
static const uint8_t lfe_index[7]
static const int8_t channel_reorder_nolfe[7][5]
int ff_dcaadpcm_subband_analysis(const DCAADPCMEncContext *s, const int32_t *in, int len, int *diff)
int ff_dcaadpcm_do_real(int pred_vq_index, softfloat quant, int32_t scale_factor, int32_t step_size, const int32_t *prev_hist, const int32_t *in, int32_t *next_hist, int32_t *out, int len, int32_t peak)
av_cold void ff_dcaadpcm_free(DCAADPCMEncContext *s)
av_cold int ff_dcaadpcm_init(DCAADPCMEncContext *s)
const uint8_t ff_dca_quant_index_sel_nbits[DCA_CODE_BOOKS]
const float ff_dca_fir_32bands_nonperfect[512]
const uint32_t ff_dca_lossless_quant[32]
const uint32_t ff_dca_scale_factor_quant7[128]
const uint8_t ff_dca_quant_index_group_size[DCA_CODE_BOOKS]
const uint32_t ff_dca_lossy_quant[32]
const float ff_dca_fir_32bands_perfect[512]
const uint32_t ff_dca_quant_levels[32]
const float ff_dca_lfe_fir_64[256]
const uint32_t ff_dca_bit_rates[32]
static double hom(double f)
static void calc_lfe_scales(DCAEncContext *c)
static uint16_t bitalloc_table[DCA_NUM_BITALLOC_CODES][2]
static void put_frame_header(DCAEncContext *c)
static const int snr_fudge
static void walk_band_low(DCAEncContext *c, int band, int channel, walk_band_t walk, int32_t *arg)
static const uint16_t(*[DCA_CODE_BOOKS][8] bitalloc_tables)[2]
static void assign_bits(DCAEncContext *c)
static uint32_t dca_vlc_calc_quant_bits(const int values[], uint8_t n, uint8_t sel, uint8_t table)
#define DCA_MAX_FRAME_SIZE
static void shift_history(DCAEncContext *c, const int32_t *input)
static void calc_power(DCAEncContext *c, const int32_t in[2 *256], int32_t power[256])
static int init_quantization_noise(DCAEncContext *c, int noise, int forbid_zero)
static void put_subframe(DCAEncContext *c, int subframe)
static void adjust_jnd(DCAEncContext *c, const int32_t in[512], int32_t out_cb[256])
static void dca_vlc_enc_alloc(PutBitContext *pb, const int values[], uint8_t n, uint8_t sel)
void(* walk_band_t)(DCAEncContext *c, int band1, int band2, int f, int32_t spectrum1, int32_t spectrum2, int channel, int32_t *arg)
static int subband_bufer_alloc(DCAEncContext *c)
static int32_t get_step_size(DCAEncContext *c, int ch, int band)
static void adpcm_analysis(DCAEncContext *c)
static int32_t find_peak(DCAEncContext *c, const int32_t *in, int len)
static void quantize_pcm(DCAEncContext *c)
static av_cold int encode_init(AVCodecContext *avctx)
static av_cold int encode_close(AVCodecContext *avctx)
static void quantize_adpcm(DCAEncContext *c)
static int32_t add_cb(DCAEncContext *c, int32_t a, int32_t b)
static void subband_transform(DCAEncContext *c, const int32_t *input)
static uint32_t dca_vlc_calc_alloc_bits(const int values[], uint8_t n, uint8_t sel)
static uint32_t set_best_code(uint32_t vlc_bits[DCA_CODE_BOOKS][7], uint32_t clc_bits[DCA_CODE_BOOKS], int32_t res[DCA_CODE_BOOKS])
static void put_primary_audio_header(DCAEncContext *c)
static uint16_t bitalloc_12_table[DCA_BITALLOC_12_COUNT][12+1][2]
static av_cold void dcaenc_init_static_tables(void)
static av_cold void create_enc_table(uint16_t dst[][2], unsigned count, const uint8_t(**src_tablep)[2])
static void calc_masking(DCAEncContext *c, const int32_t *input)
static uint32_t set_best_abits_code(int abits[DCAENC_SUBBANDS], int bands, int32_t *res)
static double gammafilter(int i, double f)
static void lfe_downsample(DCAEncContext *c, const int32_t *input)
static void walk_band_high(DCAEncContext *c, int band, int channel, walk_band_t walk, int32_t *arg)
static void put_subframe_samples(DCAEncContext *c, int ss, int band, int ch)
static void accumulate_huff_bit_consumption(int abits, int32_t *quantized, uint32_t *result)
static const AVClass dcaenc_class
static int calc_one_scale(DCAEncContext *c, int32_t peak_cb, int abits, softfloat *quant)
static void update_band_masking(DCAEncContext *c, int band1, int band2, int f, int32_t spectrum1, int32_t spectrum2, int channel, int32_t *arg)
static int32_t get_cb(DCAEncContext *c, int32_t in)
static void subband_bufer_free(DCAEncContext *c)
static void fill_in_adpcm_bufer(DCAEncContext *c)
static void find_peaks(DCAEncContext *c)
static void quantize_adpcm_subband(DCAEncContext *c, int ch, int band)
static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
static void dca_vlc_enc_quant(PutBitContext *pb, const int values[], uint8_t n, uint8_t sel, uint8_t table)
static int32_t quantize_value(int32_t value, softfloat quant)
static const softfloat scalefactor_inv[128]
static const int sample_rates[]
static const uint16_t fc[]
static const int bit_consumption[27]
static const softfloat stepsize_inv[27]
static const uint8_t bitstream_sfreq[]
static const uint16_t erb[]
const uint8_t ff_dca_vlc_src_tables[][2]
const int8_t ff_dca_bitalloc_offsets[DCA_CODE_BOOKS]
const uint8_t ff_dca_bitalloc_sizes[DCA_CODE_BOOKS]
#define DCA_NUM_BITALLOC_CODES
#define DCA_BITALLOC_12_COUNT
static int32_t mul32(int32_t a, int32_t b)
static int32_t norm__(int64_t a, int bits)
int(* init)(AVBSFContext *ctx)
channel
Use these values when setting the channel map with ebur128_set_channel().
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
static const uint8_t bits[8]
internal math functions header
static av_always_inline double ff_exp10(double x)
Compute 10^x for floating point values.
static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame, AVPacket *pkt)
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_EXPERIMENTAL
Codec is experimental and is thus avoided in favor of non experimental encoders.
#define AV_CHANNEL_LAYOUT_5POINT0
#define AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_2_2
#define AV_CHANNEL_LAYOUT_5POINT1
#define AV_CHANNEL_LAYOUT_MONO
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_SAMPLE_FMT_S32
signed 32 bits
#define LIBAVUTIL_VERSION_INT
static void scale(int *out, const int *in, const int w, const int h, const int shift)
#define AV_COPY128U(d, s)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static int ff_thread_once(char *control, void(*routine)(void))
#define FFSWAP(type, a, b)
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
#define LOCAL_ALIGNED_32(t, v,...)
static int noise(AVBSFContext *ctx, AVPacket *pkt)
static float power(float r, float g, float b, float max)
static const uint16_t table[]
static void put_sbits(PutBitContext *pb, int n, int32_t value)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
static int put_bytes_left(const PutBitContext *s, int round_up)
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
An AVChannelLayout holds information about the channel layout of audio data.
Describe the class of an AVClass context structure.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
int64_t bit_rate
the average bitrate
int sample_rate
samples per second
int frame_size
Number of samples per channel in an audio frame.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
const int32_t * band_interpolation
int scale_factor[MAX_CHANNELS][DCAENC_SUBBANDS]
int32_t eff_masking_curve_cb[256]
int32_t masking_curve_cb[SUBSUBFRAMES][256]
int32_t downsampled_lfe[DCA_LFE_SAMPLES]
int32_t peak_cb[MAX_CHANNELS][DCAENC_SUBBANDS]
int32_t adpcm_history[MAX_CHANNELS][DCAENC_SUBBANDS][DCA_ADPCM_COEFFS *2]
int32_t quant_index_sel[MAX_CHANNELS][DCA_CODE_BOOKS]
int32_t prediction_mode[MAX_CHANNELS][DCAENC_SUBBANDS]
DCAADPCMEncContext adpcm_ctx
int32_t worst_quantization_noise
const int8_t * channel_order_tab
channel reordering table, lfe and non lfe
int32_t * subband[MAX_CHANNELS][DCAENC_SUBBANDS]
int32_t band_masking_cb[32]
int32_t band_spectrum_tab[2][8]
int32_t quantized[MAX_CHANNELS][DCAENC_SUBBANDS][SUBBAND_SAMPLES]
int abits[MAX_CHANNELS][DCAENC_SUBBANDS]
int consumed_adpcm_bits
Number of bits to transmit ADPCM related info.
int32_t cb_to_level[2048]
int32_t auf[9][AUBANDS][256]
int32_t diff_peak_cb[MAX_CHANNELS][DCAENC_SUBBANDS]
expected peak of residual signal
int32_t band_interpolation_tab[2][512]
int32_t bit_allocation_sel[MAX_CHANNELS]
softfloat quant[MAX_CHANNELS][DCAENC_SUBBANDS]
int32_t history[MAX_CHANNELS][512]
const int32_t * band_spectrum
CompressionOptions options
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
static double cb(void *priv, double x, double y)
static const double coeff[2][5]
static const uint8_t quant[64]