Signed-off-by: James Almer <jamrial@gmail.com>tags/n3.1
| @@ -31,6 +31,7 @@ version <next>: | |||
| - Duck TrueMotion 2.0 Real Time decoder | |||
| - Wideband Single-bit Data (WSD) demuxer | |||
| - VAAPI-accelerated H.264/HEVC/MJPEG encoding | |||
| - DTS Express (LBR) decoder | |||
| version 3.0: | |||
| - Common Encryption (CENC) MP4 encoding and decoding support | |||
| @@ -232,7 +232,7 @@ OBJS-$(CONFIG_CPIA_DECODER) += cpia.o | |||
| OBJS-$(CONFIG_CSCD_DECODER) += cscd.o | |||
| OBJS-$(CONFIG_CYUV_DECODER) += cyuv.o | |||
| OBJS-$(CONFIG_DCA_DECODER) += dcadec.o dca.o dcadata.o dcahuff.o \ | |||
| dca_core.o dca_exss.o dca_xll.o \ | |||
| dca_core.o dca_exss.o dca_xll.o dca_lbr.o \ | |||
| dcadsp.o dcadct.o synth_filter.o | |||
| OBJS-$(CONFIG_DCA_ENCODER) += dcaenc.o dca.o dcadata.o | |||
| OBJS-$(CONFIG_DDS_DECODER) += dds.o | |||
| @@ -0,0 +1,130 @@ | |||
| /* | |||
| * Copyright (C) 2016 foo86 | |||
| * | |||
| * This file is part of FFmpeg. | |||
| * | |||
| * FFmpeg is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Lesser General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2.1 of the License, or (at your option) any later version. | |||
| * | |||
| * FFmpeg is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Lesser General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Lesser General Public | |||
| * License along with FFmpeg; if not, write to the Free Software | |||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
| */ | |||
| #ifndef AVCODEC_DCA_LBR_H | |||
| #define AVCODEC_DCA_LBR_H | |||
| #include "libavutil/common.h" | |||
| #include "libavutil/float_dsp.h" | |||
| #include "libavutil/mem.h" | |||
| #include "avcodec.h" | |||
| #include "internal.h" | |||
| #include "get_bits.h" | |||
| #include "dca.h" | |||
| #include "dca_exss.h" | |||
| #include "dcadsp.h" | |||
| #include "fft.h" | |||
| #define DCA_LBR_CHANNELS 6 | |||
| #define DCA_LBR_CHANNELS_TOTAL 32 | |||
| #define DCA_LBR_SUBBANDS 32 | |||
| #define DCA_LBR_TONES 512 | |||
| #define DCA_LBR_TIME_SAMPLES 128 | |||
| #define DCA_LBR_TIME_HISTORY 8 | |||
| typedef struct DCALbrTone { | |||
| uint8_t x_freq; ///< Spectral line offset | |||
| uint8_t f_delt; ///< Difference between original and center frequency | |||
| uint8_t ph_rot; ///< Phase rotation | |||
| uint8_t pad; ///< Padding field | |||
| uint8_t amp[DCA_LBR_CHANNELS]; ///< Per-channel amplitude | |||
| uint8_t phs[DCA_LBR_CHANNELS]; ///< Per-channel phase | |||
| } DCALbrTone; | |||
| typedef struct DCALbrDecoder { | |||
| AVCodecContext *avctx; | |||
| GetBitContext gb; | |||
| int sample_rate; ///< Sample rate of LBR audio | |||
| int ch_mask; ///< LBR speaker mask | |||
| int flags; ///< Flags for LBR decoder initialization | |||
| int bit_rate_orig; ///< Original bit rate | |||
| int bit_rate_scaled; ///< Scaled bit rate | |||
| int nchannels; ///< Number of fullband channels to decode | |||
| int nchannels_total; ///< Total number of fullband channels | |||
| int freq_range; ///< Frequency range of LBR audio | |||
| int band_limit; ///< Band limit factor | |||
| int limited_rate; ///< Band limited sample rate | |||
| int limited_range; ///< Band limited frequency range | |||
| int res_profile; ///< Resolution profile | |||
| int nsubbands; ///< Number of encoded subbands | |||
| int g3_avg_only_start_sb; ///< Subband index where grid 3 scale factors end | |||
| int min_mono_subband; ///< Subband index where mono encoding starts | |||
| int max_mono_subband; ///< Subband index where mono encoding ends | |||
| int framenum; ///< Lower 5 bits of current frame number | |||
| int lbr_rand; ///< Seed for subband randomization | |||
| int warned; ///< Flags for warning suppression | |||
| uint8_t quant_levels[DCA_LBR_CHANNELS / 2][DCA_LBR_SUBBANDS]; ///< Quantization levels | |||
| uint8_t sb_indices[DCA_LBR_SUBBANDS]; ///< Subband reordering indices | |||
| uint8_t sec_ch_sbms[DCA_LBR_CHANNELS / 2][DCA_LBR_SUBBANDS]; ///< Right channel inversion or mid/side decoding flags | |||
| uint8_t sec_ch_lrms[DCA_LBR_CHANNELS / 2][DCA_LBR_SUBBANDS]; ///< Flags indicating if left/right channel are swapped | |||
| uint32_t ch_pres[DCA_LBR_CHANNELS]; ///< Subband allocation flags | |||
| uint8_t grid_1_scf[DCA_LBR_CHANNELS][12][8]; ///< Grid 1 scale factors | |||
| uint8_t grid_2_scf[DCA_LBR_CHANNELS][3][64]; ///< Grid 2 scale factors | |||
| int8_t grid_3_avg[DCA_LBR_CHANNELS][DCA_LBR_SUBBANDS - 4]; ///< Grid 3 average values | |||
| int8_t grid_3_scf[DCA_LBR_CHANNELS][DCA_LBR_SUBBANDS - 4][8]; ///< Grid 3 scale factors | |||
| uint32_t grid_3_pres[DCA_LBR_CHANNELS]; ///< Grid 3 scale factors presence flags | |||
| uint8_t high_res_scf[DCA_LBR_CHANNELS][DCA_LBR_SUBBANDS][8]; ///< High-frequency resolution scale factors | |||
| uint8_t part_stereo[DCA_LBR_CHANNELS][DCA_LBR_SUBBANDS / 4][5]; ///< Partial stereo coefficients | |||
| uint8_t part_stereo_pres; ///< Partial stereo coefficients presence flags | |||
| float lpc_coeff[2][DCA_LBR_CHANNELS][3][2][8]; ///< Predictor coefficients | |||
| float sb_scf[DCA_LBR_SUBBANDS]; ///< Subband randomization scale factors | |||
| float *time_samples[DCA_LBR_CHANNELS][DCA_LBR_SUBBANDS]; ///< Time samples | |||
| float *ts_buffer; ///< Time sample buffer base | |||
| unsigned int ts_size; ///< Time sample buffer size | |||
| DECLARE_ALIGNED(32, float, history)[DCA_LBR_CHANNELS][DCA_LBR_SUBBANDS * 4]; ///< IMDCT history | |||
| DECLARE_ALIGNED(32, float, window)[DCA_LBR_SUBBANDS * 4]; ///< Long window for IMDCT | |||
| DECLARE_ALIGNED(32, float, lfe_data)[64]; ///< Decimated LFE samples | |||
| DECLARE_ALIGNED(32, float, lfe_history)[5][2]; ///< LFE IIR filter history | |||
| float lfe_scale; ///< Scale factor of LFE samples before IIR filter | |||
| uint8_t tonal_scf[6]; ///< Tonal scale factors | |||
| uint16_t tonal_bounds[5][32][2]; ///< Per-group per-subframe start/end positions of tones | |||
| DCALbrTone tones[DCA_LBR_TONES]; ///< Circular buffer of tones | |||
| int ntones; ///< Circular buffer head position | |||
| FFTContext imdct; | |||
| AVFloatDSPContext *fdsp; | |||
| DCADSPContext *dcadsp; | |||
| } DCALbrDecoder; | |||
| int ff_dca_lbr_parse(DCALbrDecoder *s, uint8_t *data, DCAExssAsset *asset); | |||
| int ff_dca_lbr_filter_frame(DCALbrDecoder *s, AVFrame *frame); | |||
| av_cold void ff_dca_lbr_flush(DCALbrDecoder *s); | |||
| av_cold int ff_dca_lbr_init(DCALbrDecoder *s); | |||
| av_cold void ff_dca_lbr_close(DCALbrDecoder *s); | |||
| #endif | |||
| @@ -8729,3 +8729,469 @@ const int32_t ff_dca_sampling_freqs[16] = { | |||
| 8000, 16000, 32000, 64000, 128000, 22050, 44100, 88200, | |||
| 176400, 352800, 12000, 24000, 48000, 96000, 192000, 384000, | |||
| }; | |||
| const uint16_t ff_dca_avg_g3_freqs[3] = { 16000, 18000, 24000 }; | |||
| const uint16_t ff_dca_fst_amp[44] = { | |||
| 0, 1, 2, 3, | |||
| 4, 6, 8, 10, | |||
| 12, 16, 20, 24, | |||
| 28, 36, 44, 52, | |||
| 60, 76, 92, 108, | |||
| 124, 156, 188, 220, | |||
| 252, 316, 380, 444, | |||
| 508, 636, 764, 892, | |||
| 1020, 1276, 1532, 1788, | |||
| 2044, 2556, 3068, 3580, | |||
| 4092, 5116, 6140, 7164 | |||
| }; | |||
| const uint8_t ff_dca_freq_to_sb[32] = { | |||
| 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, | |||
| 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 | |||
| }; | |||
| const int8_t ff_dca_ph0_shift[8] = { | |||
| -32, +96, -96, +32, +96, -32, +32, -96 | |||
| }; | |||
| const uint8_t ff_dca_grid_1_to_scf[11] = { | |||
| 0, 1, 2, 3, 4, 6, 7, 10, 14, 19, 26 | |||
| }; | |||
| const uint8_t ff_dca_grid_2_to_scf[3] = { | |||
| 4, 10, 18 | |||
| }; | |||
| const uint8_t ff_dca_scf_to_grid_1[32] = { | |||
| 0, 1, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, | |||
| 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10 | |||
| }; | |||
| const uint8_t ff_dca_scf_to_grid_2[32] = { | |||
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, | |||
| 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 | |||
| }; | |||
| const uint8_t ff_dca_grid_1_weights[12][32] = { | |||
| { | |||
| 128, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| }, { | |||
| 0, 128, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| }, { | |||
| 0, 0, 128, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| }, { | |||
| 0, 0, 0, 128, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| }, { | |||
| 0, 0, 0, 0, 128, 128, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| }, { | |||
| 0, 0, 0, 0, 0, 0, 128, 85, | |||
| 43, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| }, { | |||
| 0, 0, 0, 0, 0, 0, 0, 43, | |||
| 85, 128, 96, 64, 32, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| }, { | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 32, 64, 96, 128, 102, 77, | |||
| 51, 26, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| }, { | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 26, 51, | |||
| 77, 102, 128, 107, 85, 64, 43, 21, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| }, { | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 21, 43, 64, 85, 107, | |||
| 128, 110, 91, 73, 55, 37, 18, 0, | |||
| }, { | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 0, 0, 0, 0, | |||
| 0, 18, 37, 55, 73, 91, 110, 128, | |||
| }, { | |||
| /* empty */ | |||
| } | |||
| }; | |||
| const uint8_t ff_dca_sb_reorder[8][8] = { | |||
| { 0, 1, 2, 3, 4, 5, 6, 7 }, | |||
| { 1, 0, 2, 3, 4, 5, 6, 7 }, | |||
| { 3, 1, 0, 2, 4, 5, 6, 7 }, | |||
| { 1, 2, 3, 0, 4, 5, 6, 7 }, | |||
| { 1, 2, 5, 3, 0, 4, 6, 7 }, | |||
| { 1, 2, 2, 5, 3, 0, 4, 6 }, | |||
| { 1, 2, 2, 6, 5, 3, 0, 4 }, | |||
| { 1, 2, 2, 6, 5, 4, 0, 3 } | |||
| }; | |||
| const int8_t ff_dca_lfe_delta_index_16[8] = { | |||
| -4, -3, -2, -1, 2, 4, 6, 8 | |||
| }; | |||
| const int8_t ff_dca_lfe_delta_index_24[32] = { | |||
| -8, -8, -7, -7, -6, -6, -5, -5, -4, -4, -3, -3, -2, -2, -1, -1, | |||
| 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8 | |||
| }; | |||
| const uint16_t ff_dca_rsd_pack_5_in_8[256] = { | |||
| 0x0000, 0x0100, 0x0200, 0x0040, 0x0140, 0x0240, 0x0080, 0x0180, | |||
| 0x0280, 0x0010, 0x0110, 0x0210, 0x0050, 0x0150, 0x0250, 0x0090, | |||
| 0x0190, 0x0290, 0x0020, 0x0120, 0x0220, 0x0060, 0x0160, 0x0260, | |||
| 0x00a0, 0x01a0, 0x02a0, 0x0004, 0x0104, 0x0204, 0x0044, 0x0144, | |||
| 0x0244, 0x0084, 0x0184, 0x0284, 0x0014, 0x0114, 0x0214, 0x0054, | |||
| 0x0154, 0x0254, 0x0094, 0x0194, 0x0294, 0x0024, 0x0124, 0x0224, | |||
| 0x0064, 0x0164, 0x0264, 0x00a4, 0x01a4, 0x02a4, 0x0008, 0x0108, | |||
| 0x0208, 0x0048, 0x0148, 0x0248, 0x0088, 0x0188, 0x0288, 0x0018, | |||
| 0x0118, 0x0218, 0x0058, 0x0158, 0x0258, 0x0098, 0x0198, 0x0298, | |||
| 0x0028, 0x0128, 0x0228, 0x0068, 0x0168, 0x0268, 0x00a8, 0x01a8, | |||
| 0x02a8, 0x0001, 0x0101, 0x0201, 0x0041, 0x0141, 0x0241, 0x0081, | |||
| 0x0181, 0x0281, 0x0011, 0x0111, 0x0211, 0x0051, 0x0151, 0x0251, | |||
| 0x0091, 0x0191, 0x0291, 0x0021, 0x0121, 0x0221, 0x0061, 0x0161, | |||
| 0x0261, 0x00a1, 0x01a1, 0x02a1, 0x0005, 0x0105, 0x0205, 0x0045, | |||
| 0x0145, 0x0245, 0x0085, 0x0185, 0x0285, 0x0015, 0x0115, 0x0215, | |||
| 0x0055, 0x0155, 0x0255, 0x0095, 0x0195, 0x0295, 0x0025, 0x0125, | |||
| 0x0225, 0x0065, 0x0165, 0x0265, 0x00a5, 0x01a5, 0x02a5, 0x0009, | |||
| 0x0109, 0x0209, 0x0049, 0x0149, 0x0249, 0x0089, 0x0189, 0x0289, | |||
| 0x0019, 0x0119, 0x0219, 0x0059, 0x0159, 0x0259, 0x0099, 0x0199, | |||
| 0x0299, 0x0029, 0x0129, 0x0229, 0x0069, 0x0169, 0x0269, 0x00a9, | |||
| 0x01a9, 0x02a9, 0x0002, 0x0102, 0x0202, 0x0042, 0x0142, 0x0242, | |||
| 0x0082, 0x0182, 0x0282, 0x0012, 0x0112, 0x0212, 0x0052, 0x0152, | |||
| 0x0252, 0x0092, 0x0192, 0x0292, 0x0022, 0x0122, 0x0222, 0x0062, | |||
| 0x0162, 0x0262, 0x00a2, 0x01a2, 0x02a2, 0x0006, 0x0106, 0x0206, | |||
| 0x0046, 0x0146, 0x0246, 0x0086, 0x0186, 0x0286, 0x0016, 0x0116, | |||
| 0x0216, 0x0056, 0x0156, 0x0256, 0x0096, 0x0196, 0x0296, 0x0026, | |||
| 0x0126, 0x0226, 0x0066, 0x0166, 0x0266, 0x00a6, 0x01a6, 0x02a6, | |||
| 0x000a, 0x010a, 0x020a, 0x004a, 0x014a, 0x024a, 0x008a, 0x018a, | |||
| 0x028a, 0x001a, 0x011a, 0x021a, 0x005a, 0x015a, 0x025a, 0x009a, | |||
| 0x019a, 0x029a, 0x002a, 0x012a, 0x022a, 0x006a, 0x016a, 0x026a, | |||
| 0x00aa, 0x01aa, 0x02aa, 0x0155, 0x0155, 0x0155, 0x0155, 0x0155, | |||
| 0x0155, 0x0155, 0x0155, 0x0155, 0x0155, 0x0155, 0x0155, 0x0155 | |||
| }; | |||
| const uint8_t ff_dca_rsd_pack_3_in_7[128][3] = { | |||
| { 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 2 }, { 0, 0, 3 }, | |||
| { 0, 0, 4 }, { 0, 1, 0 }, { 0, 1, 1 }, { 0, 1, 2 }, | |||
| { 0, 1, 3 }, { 0, 1, 4 }, { 0, 2, 0 }, { 0, 2, 1 }, | |||
| { 0, 2, 2 }, { 0, 2, 3 }, { 0, 2, 4 }, { 0, 3, 0 }, | |||
| { 0, 3, 1 }, { 0, 3, 2 }, { 0, 3, 3 }, { 0, 3, 4 }, | |||
| { 0, 4, 0 }, { 0, 4, 1 }, { 0, 4, 2 }, { 0, 4, 3 }, | |||
| { 0, 4, 4 }, { 1, 0, 0 }, { 1, 0, 1 }, { 1, 0, 2 }, | |||
| { 1, 0, 3 }, { 1, 0, 4 }, { 1, 1, 0 }, { 1, 1, 1 }, | |||
| { 1, 1, 2 }, { 1, 1, 3 }, { 1, 1, 4 }, { 1, 2, 0 }, | |||
| { 1, 2, 1 }, { 1, 2, 2 }, { 1, 2, 3 }, { 1, 2, 4 }, | |||
| { 1, 3, 0 }, { 1, 3, 1 }, { 1, 3, 2 }, { 1, 3, 3 }, | |||
| { 1, 3, 4 }, { 1, 4, 0 }, { 1, 4, 1 }, { 1, 4, 2 }, | |||
| { 1, 4, 3 }, { 1, 4, 4 }, { 2, 0, 0 }, { 2, 0, 1 }, | |||
| { 2, 0, 2 }, { 2, 0, 3 }, { 2, 0, 4 }, { 2, 1, 0 }, | |||
| { 2, 1, 1 }, { 2, 1, 2 }, { 2, 1, 3 }, { 2, 1, 4 }, | |||
| { 2, 2, 0 }, { 2, 2, 1 }, { 2, 2, 2 }, { 2, 2, 3 }, | |||
| { 2, 2, 4 }, { 2, 3, 0 }, { 2, 3, 1 }, { 2, 3, 2 }, | |||
| { 2, 3, 3 }, { 2, 3, 4 }, { 2, 4, 0 }, { 2, 4, 1 }, | |||
| { 2, 4, 2 }, { 2, 4, 3 }, { 2, 4, 4 }, { 3, 0, 0 }, | |||
| { 3, 0, 1 }, { 3, 0, 2 }, { 3, 0, 3 }, { 3, 0, 4 }, | |||
| { 3, 1, 0 }, { 3, 1, 1 }, { 3, 1, 2 }, { 3, 1, 3 }, | |||
| { 3, 1, 4 }, { 3, 2, 0 }, { 3, 2, 1 }, { 3, 2, 2 }, | |||
| { 3, 2, 3 }, { 3, 2, 4 }, { 3, 3, 0 }, { 3, 3, 1 }, | |||
| { 3, 3, 2 }, { 3, 3, 3 }, { 3, 3, 4 }, { 3, 4, 0 }, | |||
| { 3, 4, 1 }, { 3, 4, 2 }, { 3, 4, 3 }, { 3, 4, 4 }, | |||
| { 4, 0, 0 }, { 4, 0, 1 }, { 4, 0, 2 }, { 4, 0, 3 }, | |||
| { 4, 0, 4 }, { 4, 1, 0 }, { 4, 1, 1 }, { 4, 1, 2 }, | |||
| { 4, 1, 3 }, { 4, 1, 4 }, { 4, 2, 0 }, { 4, 2, 1 }, | |||
| { 4, 2, 2 }, { 4, 2, 3 }, { 4, 2, 4 }, { 4, 3, 0 }, | |||
| { 4, 3, 1 }, { 4, 3, 2 }, { 4, 3, 3 }, { 4, 3, 4 }, | |||
| { 4, 4, 0 }, { 4, 4, 1 }, { 4, 4, 2 }, { 4, 4, 3 }, | |||
| { 4, 4, 4 }, { 2, 2, 2 }, { 2, 2, 2 }, { 2, 2, 2 } | |||
| }; | |||
| const float ff_dca_rsd_level_2a[2] = { | |||
| -0.47, 0.47 | |||
| }; | |||
| const float ff_dca_rsd_level_2b[2] = { | |||
| -0.645, 0.645 | |||
| }; | |||
| const float ff_dca_rsd_level_3[3] = { | |||
| -0.645, 0.0, 0.645 | |||
| }; | |||
| const float ff_dca_rsd_level_5[5] = { | |||
| -0.875, -0.375, 0.0, 0.375, 0.875 | |||
| }; | |||
| const float ff_dca_rsd_level_8[8] = { | |||
| -1.0, -0.625, -0.291666667, 0.0, 0.25, 0.5, 0.75, 1.0 | |||
| }; | |||
| const float ff_dca_rsd_level_16[16] = { | |||
| -1.3125, -1.1375, -0.9625, -0.7875, | |||
| -0.6125, -0.4375, -0.2625, -0.0875, | |||
| 0.0875, 0.2625, 0.4375, 0.6125, | |||
| 0.7875, 0.9625, 1.1375, 1.3125 | |||
| }; | |||
| const float ff_dca_synth_env[32] = { | |||
| 0.00240763666390, 0.00960735979838, 0.02152983213390, 0.03806023374436, | |||
| 0.05903936782582, 0.08426519384873, 0.11349477331863, 0.14644660940673, | |||
| 0.18280335791818, 0.22221488349020, 0.26430163158700, 0.30865828381746, | |||
| 0.35485766137277, 0.40245483899194, 0.45099142983522, 0.5, | |||
| 0.54900857016478, 0.59754516100806, 0.64514233862723, 0.69134171618254, | |||
| 0.73569836841300, 0.77778511650980, 0.81719664208182, 0.85355339059327, | |||
| 0.88650522668137, 0.91573480615127, 0.94096063217418, 0.96193976625564, | |||
| 0.97847016786610, 0.99039264020162, 0.99759236333610, 1.0 | |||
| }; | |||
| const float ff_dca_corr_cf[32][11] = { | |||
| {-0.01179, 0.04281, 0.46712, 0.46345,-3.94525, 3.94525, | |||
| -0.46345,-0.46712,-0.04281, 0.01179,-0.00299 }, | |||
| {-0.00929, 0.04882, 0.45252, 0.37972,-3.85446, 4.03189, | |||
| -0.55069,-0.48040,-0.03599, 0.01445,-0.00229 }, | |||
| {-0.00696, 0.05403, 0.43674, 0.29961,-3.75975, 4.11413, | |||
| -0.64135,-0.49221,-0.02834, 0.01726,-0.00156 }, | |||
| {-0.00481, 0.05847, 0.41993, 0.22319,-3.66138, 4.19175, | |||
| -0.73529,-0.50241,-0.01983, 0.02021,-0.00080 }, | |||
| {-0.00284, 0.06216, 0.40224, 0.15053,-3.55963, 4.26452, | |||
| -0.83239,-0.51085,-0.01047, 0.02328,-0.00003 }, | |||
| {-0.00105, 0.06515, 0.38378, 0.08168,-3.45475, 4.33225, | |||
| -0.93249,-0.51738,-0.00024, 0.02646, 0.00074 }, | |||
| { 0.00054, 0.06745, 0.36471, 0.01668,-3.34703, 4.39475, | |||
| -1.03543,-0.52184, 0.01085, 0.02973, 0.00152 }, | |||
| { 0.00195, 0.06912, 0.34515,-0.04445,-3.23676, 4.45185, | |||
| -1.14105,-0.52410, 0.02280, 0.03306, 0.00228 }, | |||
| { 0.00318, 0.07017, 0.32521,-0.10168,-3.12422, 4.50339, | |||
| -1.24914,-0.52400, 0.03561, 0.03643, 0.00302 }, | |||
| { 0.00422, 0.07065, 0.30503,-0.15503,-3.00969, 4.54921, | |||
| -1.35952,-0.52141, 0.04925, 0.03981, 0.00373 }, | |||
| { 0.00508, 0.07061, 0.28471,-0.20450,-2.89348, 4.58919, | |||
| -1.47197,-0.51618, 0.06370, 0.04319, 0.00440 }, | |||
| { 0.00577, 0.07007, 0.26436,-0.25013,-2.77587, 4.62321, | |||
| -1.58627,-0.50818, 0.07895, 0.04652, 0.00501 }, | |||
| { 0.00629, 0.06909, 0.24410,-0.29194,-2.65716, 4.65118, | |||
| -1.70219,-0.49727, 0.09494, 0.04979, 0.00556 }, | |||
| { 0.00666, 0.06769, 0.22400,-0.33000,-2.53764, 4.67302, | |||
| -1.81949,-0.48335, 0.11166, 0.05295, 0.00604 }, | |||
| { 0.00687, 0.06592, 0.20416,-0.36435,-2.41760, 4.68866, | |||
| -1.93791,-0.46627, 0.12904, 0.05597, 0.00642 }, | |||
| { 0.00694, 0.06383, 0.18468,-0.39506,-2.29732, 4.69806, | |||
| -2.05720,-0.44593, 0.14705, 0.05881, 0.00671 }, | |||
| { 0.00689, 0.06144, 0.16561,-0.42223,-2.17710, 4.70120, | |||
| -2.17710,-0.42223, 0.16561, 0.06144, 0.00689 }, | |||
| { 0.00671, 0.05881, 0.14705,-0.44593,-2.05720, 4.69806, | |||
| -2.29732,-0.39506, 0.18468, 0.06383, 0.00694 }, | |||
| { 0.00642, 0.05597, 0.12904,-0.46627,-1.93791, 4.68865, | |||
| -2.41759,-0.36435, 0.20416, 0.06592, 0.00687 }, | |||
| { 0.00604, 0.05295, 0.11166,-0.48334,-1.81949, 4.67301, | |||
| -2.53763,-0.33000, 0.22400, 0.06769, 0.00666 }, | |||
| { 0.00556, 0.04979, 0.09494,-0.49727,-1.70219, 4.65117, | |||
| -2.65715,-0.29194, 0.24409, 0.06909, 0.00629 }, | |||
| { 0.00501, 0.04652, 0.07894,-0.50818,-1.58627, 4.62321, | |||
| -2.77587,-0.25013, 0.26436, 0.07007, 0.00577 }, | |||
| { 0.00440, 0.04319, 0.06370,-0.51618,-1.47197, 4.58919, | |||
| -2.89348,-0.20450, 0.28471, 0.07061, 0.00508 }, | |||
| { 0.00373, 0.03981, 0.04925,-0.52141,-1.35952, 4.54921, | |||
| -3.00970,-0.15503, 0.30503, 0.07065, 0.00422 }, | |||
| { 0.00302, 0.03643, 0.03561,-0.52400,-1.24915, 4.50339, | |||
| -3.12422,-0.10168, 0.32521, 0.07017, 0.00318 }, | |||
| { 0.00228, 0.03306, 0.02280,-0.52410,-1.14105, 4.45186, | |||
| -3.23677,-0.04445, 0.34515, 0.06912, 0.00195 }, | |||
| { 0.00152, 0.02973, 0.01085,-0.52184,-1.03544, 4.39477, | |||
| -3.34704, 0.01668, 0.36471, 0.06745, 0.00054 }, | |||
| { 0.00074, 0.02646,-0.00024,-0.51738,-0.93249, 4.33226, | |||
| -3.45476, 0.08168, 0.38378, 0.06515,-0.00105 }, | |||
| {-0.00003, 0.02328,-0.01047,-0.51085,-0.83239, 4.26452, | |||
| -3.55963, 0.15053, 0.40224, 0.06216,-0.00284 }, | |||
| {-0.00080, 0.02021,-0.01983,-0.50241,-0.73529, 4.19174, | |||
| -3.66138, 0.22319, 0.41993, 0.05847,-0.00481 }, | |||
| {-0.00156, 0.01726,-0.02834,-0.49221,-0.64135, 4.11413, | |||
| -3.75974, 0.29961, 0.43674, 0.05403,-0.00696 }, | |||
| {-0.00229, 0.01445,-0.03599,-0.48040,-0.55069, 4.03188, | |||
| -3.85445, 0.37972, 0.45251, 0.04882,-0.00929 }, | |||
| }; | |||
| const float ff_dca_quant_amp[57] = { | |||
| 4.88281250E-04, 1.46484375E-03, 2.32267031E-03, 3.28475167E-03, | |||
| 4.64534014E-03, 6.56950334E-03, 9.29068029E-03, 1.31390067E-02, | |||
| 1.85813606E-02, 2.62780134E-02, 3.71627212E-02, 5.25560267E-02, | |||
| 7.43254423E-02, 1.05112053E-01, 1.48650885E-01, 2.10224107E-01, | |||
| 2.97301769E-01, 4.20448214E-01, 5.94603539E-01, 8.40896428E-01, | |||
| 1.18920708E+00, 1.68179286E+00, 2.37841415E+00, 3.36358571E+00, | |||
| 4.75682831E+00, 6.72717142E+00, 9.51365662E+00, 1.34543428E+01, | |||
| 1.90273132E+01, 2.69086857E+01, 3.80546265E+01, 5.38173714E+01, | |||
| 7.61092529E+01, 1.07634743E+02, 1.52218506E+02, 2.15269485E+02, | |||
| 3.04437012E+02, 4.30538971E+02, 6.08874023E+02, 8.61077942E+02, | |||
| 1.21774805E+03, 1.72215588E+03, 2.43549609E+03, 3.44431177E+03, | |||
| 4.87099219E+03, 6.88862354E+03, 9.74198438E+03, 1.37772471E+04, | |||
| 1.94839688E+04, 2.75544941E+04, 3.89679375E+04, 5.51089883E+04, | |||
| 7.79358750E+04, 1.10217977E+05, 1.55871750E+05, 2.20435953E+05, | |||
| 0.00000000E+00, | |||
| }; | |||
| const float ff_dca_st_coeff[34] = { | |||
| 2.69086857E+01, 2.69086857E+01, 1.34543419E+01, 6.72717142E+00, | |||
| 3.36358571E+00, 1.68179286E+00, 8.40896428E-01, 5.94603479E-01, | |||
| 4.20448214E-01, 2.97301799E-01, 2.10224107E-01, 1.48650900E-01, | |||
| 1.05112098E-01, 7.43253976E-02, 5.25560006E-02, 3.71626988E-02, | |||
| 3.12500000E-02, 2.62780003E-02, 1.85813997E-02, 1.31390002E-02, | |||
| 9.29069985E-03, 6.56950008E-03, 4.64530010E-03, 3.28480010E-03, | |||
| 2.32270011E-03, 1.64240005E-03, 1.16130000E-03, 5.80699998E-04, | |||
| 2.90299999E-04, 1.45200000E-04, 7.25999998E-05, 3.62999999E-05, | |||
| 1.82000003E-05, 0.00000000E+00, | |||
| }; | |||
| const float ff_dca_long_window[128] = { | |||
| 0.00000000E+00, 7.42882412E-06, 5.28020973E-05, 1.71007006E-04, | |||
| 3.96653224E-04, 7.63946096E-04, 1.30655791E-03, 2.05750111E-03, | |||
| 3.04900459E-03, 4.31239139E-03, 5.87796280E-03, 7.77488295E-03, | |||
| 1.00310687E-02, 1.26730874E-02, 1.57260559E-02, 1.92135461E-02, | |||
| 2.31574941E-02, 2.75781266E-02, 3.24938744E-02, 3.79213169E-02, | |||
| 4.38751020E-02, 5.03679104E-02, 5.74104004E-02, 6.50111660E-02, | |||
| 7.31767192E-02, 8.19114447E-02, 9.12176073E-02, 1.01095326E-01, | |||
| 1.11542597E-01, 1.22555278E-01, 1.34127125E-01, 1.46249816E-01, | |||
| 1.58912972E-01, 1.72104210E-01, 1.85809180E-01, 2.00011641E-01, | |||
| 2.14693516E-01, 2.29834959E-01, 2.45414421E-01, 2.61408776E-01, | |||
| 2.77793378E-01, 2.94542134E-01, 3.11627686E-01, 3.29021394E-01, | |||
| 3.46693635E-01, 3.64613682E-01, 3.82750064E-01, 4.01070446E-01, | |||
| 4.19541985E-01, 4.38131332E-01, 4.56804723E-01, 4.75528270E-01, | |||
| 4.94267941E-01, 5.12989700E-01, 5.31659782E-01, 5.50244689E-01, | |||
| 5.68711281E-01, 5.87027133E-01, 6.05160415E-01, 6.23080134E-01, | |||
| 6.40756190E-01, 6.58159554E-01, 6.75262392E-01, 6.92038059E-01, | |||
| 7.08461344E-01, 7.24508464E-01, 7.40157187E-01, 7.55386829E-01, | |||
| 7.70178556E-01, 7.84515142E-01, 7.98381269E-01, 8.11763465E-01, | |||
| 8.24650168E-01, 8.37031603E-01, 8.48900259E-01, 8.60250235E-01, | |||
| 8.71077836E-01, 8.81381273E-01, 8.91160548E-01, 9.00417745E-01, | |||
| 9.09156621E-01, 9.17382956E-01, 9.25104082E-01, 9.32328999E-01, | |||
| 9.39068437E-01, 9.45334494E-01, 9.51140642E-01, 9.56501782E-01, | |||
| 9.61433768E-01, 9.65953648E-01, 9.70079303E-01, 9.73829389E-01, | |||
| 9.77223217E-01, 9.80280578E-01, 9.83021557E-01, 9.85466540E-01, | |||
| 9.87635851E-01, 9.89549816E-01, 9.91228402E-01, 9.92691338E-01, | |||
| 9.93957877E-01, 9.95046616E-01, 9.95975435E-01, 9.96761382E-01, | |||
| 9.97420728E-01, 9.97968733E-01, 9.98419642E-01, 9.98786569E-01, | |||
| 9.99081731E-01, 9.99315977E-01, 9.99499321E-01, 9.99640644E-01, | |||
| 9.99747574E-01, 9.99826968E-01, 9.99884665E-01, 9.99925494E-01, | |||
| 9.99953628E-01, 9.99972343E-01, 9.99984324E-01, 9.99991655E-01, | |||
| 9.99995887E-01, 9.99998152E-01, 9.99999285E-01, 9.99999762E-01, | |||
| 9.99999940E-01, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, | |||
| }; | |||
| const float ff_dca_lfe_step_size_16[101] = { | |||
| 2.1362956633198035E-004, 2.4414807580797754E-004, 2.7466658528397473E-004, | |||
| 2.7466658528397473E-004, 3.0518509475997192E-004, 3.3570360423596911E-004, | |||
| 3.9674062318796350E-004, 4.2725913266396069E-004, 4.5777764213995788E-004, | |||
| 5.1881466109195227E-004, 5.7985168004394665E-004, 6.1037018951994385E-004, | |||
| 6.7140720847193823E-004, 7.6296273689992981E-004, 8.2399975585192419E-004, | |||
| 9.1555528427991577E-004, 1.0071108127079073E-003, 1.0986663411358989E-003, | |||
| 1.2207403790398877E-003, 1.3428144169438765E-003, 1.4648884548478652E-003, | |||
| 1.6174810022278512E-003, 1.7700735496078372E-003, 1.9531846064638203E-003, | |||
| 2.1362956633198035E-003, 2.3499252296517838E-003, 2.5940733054597613E-003, | |||
| 2.8687398907437361E-003, 3.1434064760277108E-003, 3.4485915707876827E-003, | |||
| 3.7842951750236518E-003, 4.1810357982116153E-003, 4.6082949308755760E-003, | |||
| 5.0660725730155339E-003, 5.5543687246314890E-003, 6.1037018951994385E-003, | |||
| 6.7445905941953795E-003, 7.4159978026673177E-003, 8.1484420300912512E-003, | |||
| 8.9419232764671782E-003, 9.8574785607470940E-003, 1.0834070863979004E-002, | |||
| 1.1932737205114903E-002, 1.3122959074678793E-002, 1.4435254982146673E-002, | |||
| 1.5869624927518540E-002, 1.7456587420270394E-002, 1.9196142460402233E-002, | |||
| 2.1118808557390057E-002, 2.3224585711233862E-002, 2.5543992431409649E-002, | |||
| 2.8107547227393413E-002, 3.0915250099185155E-002, 3.4028138065736867E-002, | |||
| 3.7415692617572556E-002, 4.1169469283120215E-002, 4.5258949552903834E-002, | |||
| 4.9806207464827418E-002, 5.4780724509414958E-002, 6.0274056215094456E-002, | |||
| 6.6286202581865905E-002, 7.2908719138157288E-002, 8.0202642902920618E-002, | |||
| 8.8229010895107887E-002, 9.7048860133671075E-002, 1.0675374614703818E-001, | |||
| 1.1743522446363720E-001, 1.2918485061189611E-001, 1.4209418012024294E-001, | |||
| 1.5628528702658162E-001, 1.7191076387829218E-001, 1.8912320322275461E-001, | |||
| 2.0804467909787286E-001, 2.2882778405102694E-001, 2.5171666615802485E-001, | |||
| 2.7689443647572254E-001, 3.0457472457045198E-001, 3.3503219702749720E-001, | |||
| 3.6854152043214211E-001, 4.0537736136967073E-001, 4.4593646046327096E-001, | |||
| 4.9052400280770286E-001, 5.3956724753563035E-001, 5.9352397228919340E-001, | |||
| 6.5288247322000792E-001, 7.1816156498916595E-001, 7.9000213629566329E-001, | |||
| 8.6898403881954400E-001, 9.5590075380718409E-001, 1.0514847254860074E+000, | |||
| 1.1566209906308176E+000, 1.2722861415448470E+000, 1.3995178075502792E+000, | |||
| 1.5394756920072024E+000, 1.6934110538041323E+000, 1.8627582628864405E+000, | |||
| 2.0490432447279274E+000, 2.2539445173497725E+000, 2.4793237098300120E+000, | |||
| 2.7272865993224893E+000, 3.0000000000000000E+000 | |||
| }; | |||
| const float ff_dca_lfe_step_size_24[144] = { | |||
| 3.5762791128491298E-006, 3.9339070241340428E-006, 4.4107442391805934E-006, | |||
| 4.7683721504655064E-006, 5.2452093655120570E-006, 5.8412558843202453E-006, | |||
| 6.4373024031284336E-006, 7.0333489219366219E-006, 7.7486047445064479E-006, | |||
| 8.4638605670762738E-006, 9.4175349971693751E-006, 1.0252000123500839E-005, | |||
| 1.1324883857355578E-005, 1.2516976894971954E-005, 1.3709069932588331E-005, | |||
| 1.5139581577727983E-005, 1.6570093222867636E-005, 1.8239023475530564E-005, | |||
| 2.0146372335716766E-005, 2.2053721195902969E-005, 2.4318697967374082E-005, | |||
| 2.6702884042606836E-005, 2.9444698029124504E-005, 3.2305721319403807E-005, | |||
| 3.5643581824729662E-005, 3.9100651633817152E-005, 4.3034558657951193E-005, | |||
| 4.7326093593370149E-005, 5.2094465743835655E-005, 5.7339675109347712E-005, | |||
| 6.3061721689906320E-005, 6.9379814789273121E-005, 7.6293954407448102E-005, | |||
| 8.3923349848192912E-005, 9.2268001111507552E-005, 1.0156632680491529E-004, | |||
| 1.1169911762465449E-004, 1.2290479217824841E-004, 1.3518335046569711E-004, | |||
| 1.4865400179076216E-004, 1.6355516476096688E-004, 1.7988683937631122E-004, | |||
| 1.9788744424431852E-004, 2.1767618866875036E-004, 2.3949149125713007E-004, | |||
| 2.6345256131321922E-004, 2.8979781744454115E-004, 3.1876567825861912E-004, | |||
| 3.5059456236297636E-004, 3.8564209766889782E-004, 4.2426591208766842E-004, | |||
| 4.6670442422681142E-004, 5.1331526199761173E-004, 5.6469447191887759E-004, | |||
| 6.2108047259813216E-004, 6.8318851985794547E-004, 7.5149545091336386E-004, | |||
| 8.2671652158695713E-004, 9.0932856909377204E-004, 1.0002852678639017E-003, | |||
| 1.1003018737199156E-003, 1.2103320610919071E-003, 1.3314487137137310E-003, | |||
| 1.4646055060154803E-003, 1.6109945310347714E-003, 1.7721655097205054E-003, | |||
| 1.9493105351102991E-003, 2.1442177467605765E-003, 2.3586752842277626E-003, | |||
| 2.5945904963720436E-003, 2.8539899413573674E-003, 3.1393770145627278E-003, | |||
| 3.4533743206708813E-003, 3.7987236736683454E-003, 4.1785245154529228E-003, | |||
| 4.5963531251374630E-003, 5.0560242004423382E-003, 5.5617100669992049E-003, | |||
| 6.1178214690472445E-003, 6.7296036159519689E-003, 7.4025401356864135E-003, | |||
| 8.1428299120461841E-003, 8.9571486660419298E-003, 9.8527681652031147E-003, | |||
| 1.0838033060793050E-002, 1.1921884050593860E-002, 1.3114096297513997E-002, | |||
| 1.4425517848195773E-002, 1.5868069633015350E-002, 1.7454864675386508E-002, | |||
| 1.9200327301064409E-002, 2.1120431556753107E-002, 2.3232462791498040E-002, | |||
| 2.5555613703204836E-002, 2.8111222757246822E-002, 3.0922297349250002E-002, | |||
| 3.4014586688826884E-002, 3.7415985753057691E-002, 4.1157608170224208E-002, | |||
| 4.5273428591898514E-002, 4.9800759530157987E-002, 5.4780847404104160E-002, | |||
| 6.0258872539862694E-002, 6.6284783635709721E-002, 7.2913297762071824E-002, | |||
| 8.0204615617348624E-002, 8.8225017574431602E-002, 9.7047578936526643E-002, | |||
| 1.0675228914645780E-001, 1.1742748229831246E-001, 1.2917031397465634E-001, | |||
| 1.4208735729305236E-001, 1.5629603341770570E-001, 1.7192568444319778E-001, | |||
| 1.8911816944100493E-001, 2.0803001022696618E-001, 2.2883310661710579E-001, | |||
| 2.5171640535788598E-001, 2.7688804589367461E-001, 3.0457679087839018E-001, | |||
| 3.3503452957088109E-001, 3.6853794676517804E-001, 4.0539174144169587E-001, | |||
| 4.4593089174400469E-001, 4.9052399283933557E-001, 5.3957635636047796E-001, | |||
| 5.9353406352210802E-001, 6.5288742219059737E-001, 7.1817609288407480E-001, | |||
| 7.8999373793527339E-001, 8.6899314749159184E-001, 9.5589243839889027E-001, | |||
| 1.0514817299225008E+000, 1.1566298194682383E+000, 1.2722928848615747E+000, | |||
| 1.3995221137430804E+000, 1.5394743131964581E+000, 1.6934218041207556E+000, | |||
| 1.8627639845328312E+000, 2.0490403233814627E+000, 2.2539444272451910E+000, | |||
| 2.4793389414952922E+000, 2.7272728356448215E+000, 2.9999998807906962E+000 | |||
| }; | |||
| const float ff_dca_bank_coeff[10] = { | |||
| 0.022810893, 0.41799772, 0.90844810, 0.99973983, | |||
| 0.068974845, 0.34675997, 0.29396889, 0.19642374, | |||
| 0.308658270, 0.038060233 | |||
| }; | |||
| const float ff_dca_lfe_iir[5][4] = { | |||
| { -0.98618466, 1.9861259, 1.0, -1.9840510 }, | |||
| { -0.98883152, 1.9887193, 1.0, -1.9979848 }, | |||
| { -0.99252087, 1.9923381, 1.0, -1.9990897 }, | |||
| { -0.99591690, 1.9956781, 1.0, -1.9993745 }, | |||
| { -0.99872285, 1.9984550, 1.0, -1.9994639 } | |||
| }; | |||
| @@ -73,4 +73,51 @@ extern const int32_t ff_dca_xll_band_coeff[20]; | |||
| extern const int32_t ff_dca_sampling_freqs[16]; | |||
| extern const uint16_t ff_dca_avg_g3_freqs[3]; | |||
| extern const uint16_t ff_dca_fst_amp[44]; | |||
| extern const uint8_t ff_dca_freq_to_sb[32]; | |||
| extern const int8_t ff_dca_ph0_shift[8]; | |||
| extern const uint8_t ff_dca_grid_1_to_scf[11]; | |||
| extern const uint8_t ff_dca_grid_2_to_scf[3]; | |||
| extern const uint8_t ff_dca_scf_to_grid_1[32]; | |||
| extern const uint8_t ff_dca_scf_to_grid_2[32]; | |||
| extern const uint8_t ff_dca_grid_1_weights[12][32]; | |||
| extern const uint8_t ff_dca_sb_reorder[8][8]; | |||
| extern const int8_t ff_dca_lfe_delta_index_16[8]; | |||
| extern const int8_t ff_dca_lfe_delta_index_24[32]; | |||
| extern const uint16_t ff_dca_rsd_pack_5_in_8[256]; | |||
| extern const uint8_t ff_dca_rsd_pack_3_in_7[128][3]; | |||
| extern const float ff_dca_rsd_level_2a[2]; | |||
| extern const float ff_dca_rsd_level_2b[2]; | |||
| extern const float ff_dca_rsd_level_3[3]; | |||
| extern const float ff_dca_rsd_level_5[5]; | |||
| extern const float ff_dca_rsd_level_8[8]; | |||
| extern const float ff_dca_rsd_level_16[16]; | |||
| extern const float ff_dca_synth_env[32]; | |||
| extern const float ff_dca_corr_cf[32][11]; | |||
| extern const float ff_dca_quant_amp[57]; | |||
| extern const float ff_dca_st_coeff[34]; | |||
| extern const float ff_dca_long_window[128]; | |||
| extern const float ff_dca_lfe_step_size_16[101]; | |||
| extern const float ff_dca_lfe_step_size_24[144]; | |||
| extern const float ff_dca_bank_coeff[10]; | |||
| extern const float ff_dca_lfe_iir[5][4]; | |||
| #endif /* AVCODEC_DCADATA_H */ | |||
| @@ -235,6 +235,16 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void *data, | |||
| } | |||
| } | |||
| // Parse LBR component in EXSS | |||
| if (asset && (asset->extension_mask & DCA_EXSS_LBR)) { | |||
| if ((ret = ff_dca_lbr_parse(&s->lbr, input, asset)) < 0) { | |||
| if (ret == AVERROR(ENOMEM) || (avctx->err_recognition & AV_EF_EXPLODE)) | |||
| return ret; | |||
| } else { | |||
| s->packet |= DCA_PACKET_LBR; | |||
| } | |||
| } | |||
| // Parse core extensions in EXSS or backward compatible core sub-stream | |||
| if ((s->packet & DCA_PACKET_CORE) | |||
| && (ret = ff_dca_core_parse_exss(&s->core, input, asset)) < 0) | |||
| @@ -242,7 +252,10 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void *data, | |||
| } | |||
| // Filter the frame | |||
| if (s->packet & DCA_PACKET_XLL) { | |||
| if (s->packet & DCA_PACKET_LBR) { | |||
| if ((ret = ff_dca_lbr_filter_frame(&s->lbr, frame)) < 0) | |||
| return ret; | |||
| } else if (s->packet & DCA_PACKET_XLL) { | |||
| if (s->packet & DCA_PACKET_CORE) { | |||
| int x96_synth = -1; | |||
| @@ -297,6 +310,7 @@ static av_cold void dcadec_flush(AVCodecContext *avctx) | |||
| ff_dca_core_flush(&s->core); | |||
| ff_dca_xll_flush(&s->xll); | |||
| ff_dca_lbr_flush(&s->lbr); | |||
| s->core_residual_valid = 0; | |||
| } | |||
| @@ -307,6 +321,7 @@ static av_cold int dcadec_close(AVCodecContext *avctx) | |||
| ff_dca_core_close(&s->core); | |||
| ff_dca_xll_close(&s->xll); | |||
| ff_dca_lbr_close(&s->lbr); | |||
| av_freep(&s->buffer); | |||
| s->buffer_size = 0; | |||
| @@ -322,15 +337,20 @@ static av_cold int dcadec_init(AVCodecContext *avctx) | |||
| s->core.avctx = avctx; | |||
| s->exss.avctx = avctx; | |||
| s->xll.avctx = avctx; | |||
| s->lbr.avctx = avctx; | |||
| ff_dca_init_vlcs(); | |||
| if (ff_dca_core_init(&s->core) < 0) | |||
| return AVERROR(ENOMEM); | |||
| if (ff_dca_lbr_init(&s->lbr) < 0) | |||
| return AVERROR(ENOMEM); | |||
| ff_dcadsp_init(&s->dcadsp); | |||
| s->core.dcadsp = &s->dcadsp; | |||
| s->xll.dcadsp = &s->dcadsp; | |||
| s->lbr.dcadsp = &s->dcadsp; | |||
| s->crctab = av_crc_get_table(AV_CRC_16_CCITT); | |||
| @@ -32,13 +32,15 @@ | |||
| #include "dca_core.h" | |||
| #include "dca_exss.h" | |||
| #include "dca_xll.h" | |||
| #include "dca_lbr.h" | |||
| #define DCA_BUFFER_PADDING_SIZE 1024 | |||
| #define DCA_PACKET_CORE 0x01 | |||
| #define DCA_PACKET_EXSS 0x02 | |||
| #define DCA_PACKET_XLL 0x04 | |||
| #define DCA_PACKET_RECOVERY 0x08 | |||
| #define DCA_PACKET_LBR 0x08 | |||
| #define DCA_PACKET_RECOVERY 0x10 | |||
| typedef struct DCAContext { | |||
| const AVClass *class; ///< class for AVOptions | |||
| @@ -47,6 +49,7 @@ typedef struct DCAContext { | |||
| DCACoreDecoder core; ///< Core decoder context | |||
| DCAExssParser exss; ///< EXSS parser context | |||
| DCAXllDecoder xll; ///< XLL decoder context | |||
| DCALbrDecoder lbr; ///< LBR decoder context | |||
| DCADSPContext dcadsp; | |||
| @@ -385,6 +385,77 @@ static void assemble_freq_bands_c(int32_t *dst, int32_t *src0, int32_t *src1, | |||
| } | |||
| } | |||
| static void lbr_bank_c(float output[32][4], float **input, | |||
| const float *coeff, ptrdiff_t ofs, ptrdiff_t len) | |||
| { | |||
| float SW0 = coeff[0]; | |||
| float SW1 = coeff[1]; | |||
| float SW2 = coeff[2]; | |||
| float SW3 = coeff[3]; | |||
| float C1 = coeff[4]; | |||
| float C2 = coeff[5]; | |||
| float C3 = coeff[6]; | |||
| float C4 = coeff[7]; | |||
| float AL1 = coeff[8]; | |||
| float AL2 = coeff[9]; | |||
| int i; | |||
| // Short window and 8 point forward MDCT | |||
| for (i = 0; i < len; i++) { | |||
| float *src = input[i] + ofs; | |||
| float a = src[-4] * SW0 - src[-1] * SW3; | |||
| float b = src[-3] * SW1 - src[-2] * SW2; | |||
| float c = src[ 2] * SW1 + src[ 1] * SW2; | |||
| float d = src[ 3] * SW0 + src[ 0] * SW3; | |||
| output[i][0] = C1 * b - C2 * c + C4 * a - C3 * d; | |||
| output[i][1] = C1 * d - C2 * a - C4 * b - C3 * c; | |||
| output[i][2] = C3 * b + C2 * d - C4 * c + C1 * a; | |||
| output[i][3] = C3 * a - C2 * b + C4 * d - C1 * c; | |||
| } | |||
| // Aliasing cancellation for high frequencies | |||
| for (i = 12; i < len - 1; i++) { | |||
| float a = output[i ][3] * AL1; | |||
| float b = output[i+1][0] * AL1; | |||
| output[i ][3] += b - a; | |||
| output[i+1][0] -= b + a; | |||
| a = output[i ][2] * AL2; | |||
| b = output[i+1][1] * AL2; | |||
| output[i ][2] += b - a; | |||
| output[i+1][1] -= b + a; | |||
| } | |||
| } | |||
| static void lfe_iir_c(float *output, const float *input, | |||
| const float iir[5][4], float hist[5][2], | |||
| ptrdiff_t factor) | |||
| { | |||
| float res, tmp; | |||
| int i, j, k; | |||
| for (i = 0; i < 64; i++) { | |||
| res = *input++; | |||
| for (j = 0; j < factor; j++) { | |||
| for (k = 0; k < 5; k++) { | |||
| tmp = hist[k][0] * iir[k][0] + hist[k][1] * iir[k][1] + res; | |||
| res = hist[k][0] * iir[k][2] + hist[k][1] * iir[k][3] + tmp; | |||
| hist[k][0] = hist[k][1]; | |||
| hist[k][1] = tmp; | |||
| } | |||
| *output++ = res; | |||
| res = 0; | |||
| } | |||
| } | |||
| } | |||
| av_cold void ff_dcadsp_init(DCADSPContext *s) | |||
| { | |||
| s->decode_hf = decode_hf_c; | |||
| @@ -411,6 +482,9 @@ av_cold void ff_dcadsp_init(DCADSPContext *s) | |||
| s->assemble_freq_bands = assemble_freq_bands_c; | |||
| s->lbr_bank = lbr_bank_c; | |||
| s->lfe_iir = lfe_iir_c; | |||
| if (ARCH_X86) | |||
| ff_dcadsp_init_x86(s); | |||
| } | |||
| @@ -84,6 +84,13 @@ typedef struct DCADSPContext { | |||
| void (*assemble_freq_bands)(int32_t *dst, int32_t *src0, int32_t *src1, | |||
| const int32_t *coeff, ptrdiff_t len); | |||
| void (*lbr_bank)(float output[32][4], float **input, | |||
| const float *coeff, ptrdiff_t ofs, ptrdiff_t len); | |||
| void (*lfe_iir)(float *output, const float *input, | |||
| const float iir[5][4], float hist[5][2], | |||
| ptrdiff_t factor); | |||
| } DCADSPContext; | |||
| av_cold void ff_dcadsp_init(DCADSPContext *s); | |||
| @@ -1038,13 +1038,209 @@ static const uint8_t *const bitalloc_bits[DCA_CODE_BOOKS][8] = { | |||
| bitalloc_129_bits_e, bitalloc_129_bits_f, bitalloc_129_bits_g, NULL } | |||
| }; | |||
| static const uint16_t vlc_offs[63] = { | |||
| static const uint16_t tnl_grp_0_codes[37] = { | |||
| 0x0000, 0x0003, 0x0004, 0x0007, 0x0001, 0x0009, 0x000a, 0x000d, | |||
| 0x000e, 0x0006, 0x0012, 0x0005, 0x0015, 0x0016, 0x0022, 0x0025, | |||
| 0x0035, 0x0076, 0x0002, 0x0042, 0x00b6, 0x0036, 0x00c2, 0x0136, | |||
| 0x0182, 0x01c2, 0x03c2, 0x0482, 0x0682, 0x0082, 0x0882, 0x0a82, | |||
| 0x0282, 0x2282, 0x3282, 0x1282, 0x5282, | |||
| }; | |||
| static const uint16_t tnl_grp_1_codes[34] = { | |||
| 0x0001, 0x0003, 0x0006, 0x0000, 0x0002, 0x0004, 0x0005, 0x0007, | |||
| 0x0008, 0x000f, 0x001a, 0x001c, 0x001d, 0x000a, 0x002c, 0x002d, | |||
| 0x000d, 0x002a, 0x004c, 0x004d, 0x006a, 0x008c, 0x00cd, 0x00ea, | |||
| 0x000c, 0x010c, 0x01ea, 0x020c, 0x030c, 0x07ea, 0x0bea, 0x03ea, | |||
| 0x13ea, 0x33ea, | |||
| }; | |||
| static const uint16_t tnl_grp_2_codes[31] = { | |||
| 0x0001, 0x0003, 0x0006, 0x0007, 0x0004, 0x0008, 0x000c, 0x0010, | |||
| 0x0012, 0x001a, 0x0022, 0x0000, 0x000a, 0x0020, 0x0040, 0x004a, | |||
| 0x006a, 0x0002, 0x002a, 0x0042, 0x0082, 0x00aa, 0x00e0, 0x0060, | |||
| 0x00c2, 0x01c2, 0x0160, 0x0360, 0x0f60, 0x0760, 0x1760, | |||
| }; | |||
| static const uint16_t tnl_grp_3_codes[28] = { | |||
| 0x0001, 0x0006, 0x0008, 0x0014, 0x001c, 0x0000, 0x0002, 0x0004, | |||
| 0x000a, 0x000c, 0x0010, 0x0012, 0x001a, 0x0020, 0x002a, 0x002c, | |||
| 0x0032, 0x003a, 0x0022, 0x0030, 0x0062, 0x0064, 0x0070, 0x0024, | |||
| 0x00a4, 0x01a4, 0x03a4, 0x07a4, | |||
| }; | |||
| static const uint16_t tnl_grp_4_codes[23] = { | |||
| 0x0001, 0x0000, 0x000a, 0x0006, 0x0012, 0x001e, 0x0022, 0x002e, | |||
| 0x0036, 0x003e, 0x0002, 0x0016, 0x0032, 0x004e, 0x0056, 0x000e, | |||
| 0x0042, 0x0072, 0x00c2, 0x00f2, 0x008e, 0x018e, 0x038e, | |||
| }; | |||
| static const uint16_t tnl_scf_codes[20] = { | |||
| 0x0000, 0x0001, 0x0002, 0x0005, 0x0006, 0x0007, 0x000b, 0x000c, | |||
| 0x0013, 0x0014, 0x0003, 0x0004, 0x0023, 0x0064, 0x00a4, 0x0024, | |||
| 0x0124, 0x0324, 0x0724, 0x0f24, | |||
| }; | |||
| static const uint16_t damp_codes[7] = { | |||
| 0x0001, 0x0000, 0x0002, 0x0006, 0x000e, 0x001e, 0x003e, | |||
| }; | |||
| static const uint16_t dph_codes[9] = { | |||
| 0x0000, 0x0002, 0x0003, 0x0001, 0x0009, 0x000d, 0x0005, 0x0015, | |||
| 0x0035, | |||
| }; | |||
| static const uint16_t fst_rsd_amp_codes[24] = { | |||
| 0x0003, 0x0005, 0x0006, 0x0007, 0x0000, 0x0001, 0x0002, 0x0008, | |||
| 0x0009, 0x000a, 0x0014, 0x0004, 0x001a, 0x001c, 0x0024, 0x002c, | |||
| 0x003a, 0x000c, 0x003c, 0x004c, 0x00fc, 0x007c, 0x017c, 0x037c, | |||
| }; | |||
| static const uint16_t rsd_apprx_codes[6] = { | |||
| 0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, | |||
| }; | |||
| static const uint16_t rsd_amp_codes[33] = { | |||
| 0x0001, 0x0000, 0x0002, 0x0003, 0x0004, 0x000e, 0x000f, 0x0016, | |||
| 0x0007, 0x0027, 0x0037, 0x0026, 0x0066, 0x0006, 0x0017, 0x0046, | |||
| 0x0097, 0x00d7, 0x0086, 0x00c6, 0x01c6, 0x0157, 0x0186, 0x0257, | |||
| 0x0357, 0x0057, 0x0786, 0x0386, 0x0b86, 0x0457, 0x0c57, 0x1457, | |||
| 0x1c57, | |||
| }; | |||
| static const uint16_t avg_g3_codes[18] = { | |||
| 0x0001, 0x0002, 0x0003, 0x0000, 0x000c, 0x0014, 0x0018, 0x0004, | |||
| 0x0008, 0x0028, 0x0068, 0x0024, 0x00a4, 0x00e4, 0x0164, 0x0064, | |||
| 0x0264, 0x0664, | |||
| }; | |||
| static const uint16_t st_grid_codes[22] = { | |||
| 0x0001, 0x0002, 0x0000, 0x0004, 0x0008, 0x001c, 0x004c, 0x006c, | |||
| 0x000c, 0x002c, 0x008c, 0x00ac, 0x012c, 0x018c, 0x01ac, 0x038c, | |||
| 0x03ac, 0x032c, 0x072c, 0x0f2c, 0x172c, 0x1f2c, | |||
| }; | |||
| static const uint16_t grid_2_codes[20] = { | |||
| 0x0000, 0x0002, 0x0003, 0x0001, 0x0005, 0x000d, 0x003d, 0x005d, | |||
| 0x009d, 0x011d, 0x001d, 0x061d, 0x041d, 0x0c1d, 0x0a1d, 0x121d, | |||
| 0x021d, 0x1a1d, 0x221d, 0x3a1d, | |||
| }; | |||
| static const uint16_t grid_3_codes[13] = { | |||
| 0x0001, 0x0002, 0x0000, 0x0004, 0x000c, 0x001c, 0x007c, 0x003c, | |||
| 0x01bc, 0x00bc, 0x06bc, 0x02bc, 0x0abc, | |||
| }; | |||
| static const uint16_t rsd_codes[9] = { | |||
| 0x0001, 0x0003, 0x0000, 0x0002, 0x0006, 0x0004, 0x000c, 0x001c, | |||
| 0x003c, | |||
| }; | |||
| static const uint8_t tnl_grp_0_bitvals[74] = { | |||
| 3, 5, 3, 9, 3, 4, 3, 6, 4, 10, 4, 13, 4, 7, 4, 11, | |||
| 4, 8, 5, 12, 5, 14, 6, 15, 6, 18, 6, 1, 6, 17, 6, 16, | |||
| 6, 21, 7, 20, 8, 19, 8, 22, 8, 25, 9, 26, 9, 23, 9, 3, | |||
| 9, 24, 10, 29, 10, 27, 11, 28, 11, 30, 12, 33, 12, 31, 12, 32, | |||
| 14, 34, 14, 37, 14, 36, 15, 35, 15, 0, | |||
| }; | |||
| static const uint8_t tnl_grp_1_bitvals[68] = { | |||
| 3, 9, 3, 6, 3, 5, 4, 4, 4, 8, 4, 10, 4, 1, 4, 11, | |||
| 4, 7, 4, 13, 5, 12, 5, 14, 5, 17, 6, 16, 6, 15, 6, 18, | |||
| 7, 20, 7, 19, 7, 21, 8, 25, 8, 23, 8, 22, 8, 24, 9, 26, | |||
| 10, 3, 10, 29, 10, 30, 10, 27, 10, 28, 11, 31, 12, 32, 13, 33, | |||
| 14, 34, 14, 0, | |||
| }; | |||
| static const uint8_t tnl_grp_2_bitvals[62] = { | |||
| 2, 1, 3, 6, 3, 5, 3, 7, 4, 9, 4, 8, 4, 4, 5, 10, | |||
| 5, 11, 5, 13, 6, 12, 7, 14, 7, 16, 7, 15, 7, 17, 7, 18, | |||
| 7, 19, 8, 22, 8, 20, 8, 21, 8, 3, 8, 24, 8, 25, 9, 23, | |||
| 9, 26, 9, 27, 10, 28, 11, 29, 12, 31, 13, 30, 13, 0, | |||
| }; | |||
| static const uint8_t tnl_grp_3_bitvals[56] = { | |||
| 1, 1, 3, 6, 4, 5, 5, 9, 5, 4, 6, 8, 6, 14, 6, 10, | |||
| 6, 21, 6, 13, 6, 7, 6, 3, 6, 16, 6, 2, 6, 18, 6, 17, | |||
| 6, 11, 6, 15, 7, 19, 7, 23, 7, 24, 7, 22, 7, 12, 8, 20, | |||
| 9, 25, 10, 26, 11, 27, 11, 0, | |||
| }; | |||
| static const uint8_t tnl_grp_4_bitvals[46] = { | |||
| 1, 1, 2, 2, 4, 4, 5, 5, 6, 6, 6, 8, 6, 3, 6, 19, | |||
| 6, 20, 6, 9, 7, 7, 7, 11, 7, 13, 7, 17, 7, 10, 8, 12, | |||
| 8, 15, 8, 14, 8, 21, 8, 18, 9, 16, 10, 22, 10, 0, | |||
| }; | |||
| static const uint8_t tnl_scf_bitvals[40] = { | |||
| 3, 3, 3, 1, 3, 2, 3, 5, 3, 4, 3, 6, 4, 8, 4, 7, | |||
| 5, 10, 5, 9, 6, 12, 6, 11, 6, 13, 7, 14, 8, 15, 9, 16, | |||
| 10, 17, 11, 18, 12, 19, 12, 0, | |||
| }; | |||
| static const uint8_t damp_bitvals[14] = { | |||
| 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 0, | |||
| }; | |||
| static const uint8_t dph_bitvals[18] = { | |||
| 2, 2, 2, 1, 2, 8, 4, 3, 4, 7, 4, 4, 5, 6, 6, 5, | |||
| 6, 0, | |||
| }; | |||
| static const uint8_t fst_rsd_amp_bitvals[48] = { | |||
| 3, 13, 3, 15, 3, 16, 3, 14, 4, 12, 4, 10, 4, 11, 4, 17, | |||
| 4, 18, 5, 19, 5, 9, 6, 1, 6, 7, 6, 6, 6, 8, 6, 5, | |||
| 6, 4, 7, 20, 7, 2, 7, 3, 8, 21, 9, 22, 10, 23, 10, 0, | |||
| }; | |||
| static const uint8_t rsd_apprx_bitvals[12] = { | |||
| 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 0, | |||
| }; | |||
| static const uint8_t rsd_amp_bitvals[66] = { | |||
| 2, 3, 3, 2, 3, 5, 3, 4, 3, 1, 4, 7, 4, 6, 5, 9, | |||
| 6, 8, 6, 11, 6, 10, 7, 12, 7, 13, 8, 14, 8, 18, 8, 16, | |||
| 8, 15, 8, 22, 9, 20, 9, 24, 9, 17, 10, 28, 10, 26, 10, 21, | |||
| 10, 23, 11, 30, 11, 19, 12, 25, 12, 32, 13, 36, 13, 29, 13, 34, | |||
| 13, 0, | |||
| }; | |||
| static const uint8_t avg_g3_bitvals[36] = { | |||
| 2, 15, 2, 16, 2, 17, 4, 14, 4, 18, 5, 12, 5, 13, 6, 10, | |||
| 6, 11, 7, 19, 7, 9, 8, 20, 8, 8, 8, 7, 9, 21, 10, 6, | |||
| 11, 23, 11, 0, | |||
| }; | |||
| static const uint8_t st_grid_bitvals[44] = { | |||
| 1, 6, 2, 1, 4, 4, 4, 8, 4, 3, 5, 10, 7, 12, 7, 5, | |||
| 8, 14, 9, 16, 9, 7, 9, 18, 10, 11, 10, 9, 10, 20, 10, 22, | |||
| 10, 2, 11, 13, 13, 17, 13, 24, 13, 15, 13, 0, | |||
| }; | |||
| static const uint8_t grid_2_bitvals[40] = { | |||
| 2, 3, 2, 2, 2, 1, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, | |||
| 8, 9, 9, 10, 11, 11, 11, 12, 12, 13, 12, 17, 13, 15, 13, 18, | |||
| 14, 19, 14, 16, 14, 14, 14, 0, | |||
| }; | |||
| static const uint8_t grid_3_bitvals[26] = { | |||
| 1, 17, 2, 16, 3, 18, 4, 15, 5, 19, 6, 14, 7, 20, 8, 13, | |||
| 9, 21, 10, 12, 11, 22, 12, 11, 12, 0, | |||
| }; | |||
| static const uint8_t rsd_bitvals[18] = { | |||
| 2, 2, 2, 3, 3, 1, 3, 4, 3, 0, 4, 5, 5, 6, 6, 7, | |||
| 6, 4, | |||
| }; | |||
| static const uint16_t vlc_offs[80] = { | |||
| 0, 512, 640, 768, 1282, 1794, 2436, 3080, 3770, 4454, 5364, | |||
| 5372, 5380, 5388, 5392, 5396, 5412, 5420, 5428, 5460, 5492, 5508, | |||
| 5572, 5604, 5668, 5796, 5860, 5892, 6412, 6668, 6796, 7308, 7564, | |||
| 7820, 8076, 8620, 9132, 9388, 9910, 10166, 10680, 11196, 11726, 12240, | |||
| 12752, 13298, 13810, 14326, 14840, 15500, 16022, 16540, 17158, 17678, 18264, | |||
| 18796, 19352, 19926, 20468, 21472, 22398, 23014, 23622, | |||
| 18796, 19352, 19926, 20468, 21472, 22398, 23014, 23622, 24200, 24748, 25276, | |||
| 25792, 26306, 26826, 26890, 26954, 27468, 27500, 28038, 28554, 29086, 29630, | |||
| 30150, 30214 | |||
| }; | |||
| DCAVLC ff_dca_vlc_bit_allocation; | |||
| @@ -1052,9 +1248,22 @@ DCAVLC ff_dca_vlc_transition_mode; | |||
| DCAVLC ff_dca_vlc_scale_factor; | |||
| DCAVLC ff_dca_vlc_quant_index[DCA_CODE_BOOKS]; | |||
| VLC ff_dca_vlc_tnl_grp[5]; | |||
| VLC ff_dca_vlc_tnl_scf; | |||
| VLC ff_dca_vlc_damp; | |||
| VLC ff_dca_vlc_dph; | |||
| VLC ff_dca_vlc_fst_rsd_amp; | |||
| VLC ff_dca_vlc_rsd_apprx; | |||
| VLC ff_dca_vlc_rsd_amp; | |||
| VLC ff_dca_vlc_avg_g3; | |||
| VLC ff_dca_vlc_st_grid; | |||
| VLC ff_dca_vlc_grid_2; | |||
| VLC ff_dca_vlc_grid_3; | |||
| VLC ff_dca_vlc_rsd; | |||
| av_cold void ff_dca_init_vlcs(void) | |||
| { | |||
| static VLC_TYPE dca_table[23622][2]; | |||
| static VLC_TYPE dca_table[30214][2]; | |||
| static int vlcs_initialized = 0; | |||
| int i, j, k = 0; | |||
| @@ -1095,5 +1304,34 @@ av_cold void ff_dca_init_vlcs(void) | |||
| bitalloc_sizes[i], bitalloc_bits[i][j], bitalloc_codes[i][j]); | |||
| } | |||
| #define LBR_INIT_VLC(vlc, tab, nb_bits) \ | |||
| do { \ | |||
| vlc.table = &dca_table[vlc_offs[k]]; \ | |||
| vlc.table_allocated = vlc_offs[k + 1] - vlc_offs[k]; \ | |||
| ff_init_vlc_sparse(&vlc, nb_bits, FF_ARRAY_ELEMS(tab##_codes), \ | |||
| &tab##_bitvals[0], 2, 1, \ | |||
| tab##_codes, 2, 2, \ | |||
| &tab##_bitvals[1], 2, 1, \ | |||
| INIT_VLC_LE | INIT_VLC_USE_NEW_STATIC); \ | |||
| k++; \ | |||
| } while (0) | |||
| LBR_INIT_VLC(ff_dca_vlc_tnl_grp[0], tnl_grp_0, 9); | |||
| LBR_INIT_VLC(ff_dca_vlc_tnl_grp[1], tnl_grp_1, 9); | |||
| LBR_INIT_VLC(ff_dca_vlc_tnl_grp[2], tnl_grp_2, 9); | |||
| LBR_INIT_VLC(ff_dca_vlc_tnl_grp[3], tnl_grp_3, 9); | |||
| LBR_INIT_VLC(ff_dca_vlc_tnl_grp[4], tnl_grp_4, 9); | |||
| LBR_INIT_VLC(ff_dca_vlc_tnl_scf, tnl_scf, 9); | |||
| LBR_INIT_VLC(ff_dca_vlc_damp, damp, 6); | |||
| LBR_INIT_VLC(ff_dca_vlc_dph, dph, 6); | |||
| LBR_INIT_VLC(ff_dca_vlc_fst_rsd_amp, fst_rsd_amp, 9); | |||
| LBR_INIT_VLC(ff_dca_vlc_rsd_apprx, rsd_apprx, 5); | |||
| LBR_INIT_VLC(ff_dca_vlc_rsd_amp, rsd_amp, 9); | |||
| LBR_INIT_VLC(ff_dca_vlc_avg_g3, avg_g3, 9); | |||
| LBR_INIT_VLC(ff_dca_vlc_st_grid, st_grid, 9); | |||
| LBR_INIT_VLC(ff_dca_vlc_grid_2, grid_2, 9); | |||
| LBR_INIT_VLC(ff_dca_vlc_grid_3, grid_3, 9); | |||
| LBR_INIT_VLC(ff_dca_vlc_rsd, rsd, 6); | |||
| vlcs_initialized = 1; | |||
| } | |||
| @@ -41,6 +41,19 @@ extern DCAVLC ff_dca_vlc_transition_mode; | |||
| extern DCAVLC ff_dca_vlc_scale_factor; | |||
| extern DCAVLC ff_dca_vlc_quant_index[DCA_CODE_BOOKS]; | |||
| extern VLC ff_dca_vlc_tnl_grp[5]; | |||
| extern VLC ff_dca_vlc_tnl_scf; | |||
| extern VLC ff_dca_vlc_damp; | |||
| extern VLC ff_dca_vlc_dph; | |||
| extern VLC ff_dca_vlc_fst_rsd_amp; | |||
| extern VLC ff_dca_vlc_rsd_apprx; | |||
| extern VLC ff_dca_vlc_rsd_amp; | |||
| extern VLC ff_dca_vlc_avg_g3; | |||
| extern VLC ff_dca_vlc_st_grid; | |||
| extern VLC ff_dca_vlc_grid_2; | |||
| extern VLC ff_dca_vlc_grid_3; | |||
| extern VLC ff_dca_vlc_rsd; | |||
| av_cold void ff_dca_init_vlcs(void); | |||
| #endif /* AVCODEC_DCAHUFF_H */ | |||