X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fdca_core.h;h=7dcfb13bc7cfad1cb412bec2b77f2bed9f90b5c1;hb=91c3b50d74ba8874ea090c29063f953f4cc90ba9;hp=e84bdab18e6fbeeb675de6128f801501fac0919a;hpb=18e2a446c52b0a5cb520f9b68d8fd4171a5f6471;p=ffmpeg diff --git a/libavcodec/dca_core.h b/libavcodec/dca_core.h index e84bdab18e6..7dcfb13bc7c 100644 --- a/libavcodec/dca_core.h +++ b/libavcodec/dca_core.h @@ -33,6 +33,7 @@ #include "dca_exss.h" #include "dcadsp.h" #include "dcadct.h" +#include "dcamath.h" #include "dcahuff.h" #include "fft.h" #include "synth_filter.h" @@ -43,7 +44,6 @@ #define DCA_SUBFRAMES 16 #define DCA_SUBBAND_SAMPLES 8 #define DCA_PCMBLOCK_SAMPLES 32 -#define DCA_ADPCM_COEFFS 4 #define DCA_LFE_HISTORY 8 #define DCA_ABITS_MAX 26 @@ -195,6 +195,29 @@ static inline int ff_dca_core_map_spkr(DCACoreDecoder *core, int spkr) return -1; } +static inline void ff_dca_core_dequantize(int32_t *output, const int32_t *input, + int32_t step_size, int32_t scale, int residual, int len) +{ + // Account for quantizer step size + int64_t step_scale = (int64_t)step_size * scale; + int n, shift = 0; + + // Limit scale factor resolution to 22 bits + if (step_scale > (1 << 23)) { + shift = av_log2(step_scale >> 23) + 1; + step_scale >>= shift; + } + + // Scale the samples + if (residual) { + for (n = 0; n < len; n++) + output[n] += clip23(norm__(input[n] * step_scale, 22 - shift)); + } else { + for (n = 0; n < len; n++) + output[n] = clip23(norm__(input[n] * step_scale, 22 - shift)); + } +} + int ff_dca_core_parse(DCACoreDecoder *s, uint8_t *data, int size); int ff_dca_core_parse_exss(DCACoreDecoder *s, uint8_t *data, DCAExssAsset *asset); int ff_dca_core_filter_fixed(DCACoreDecoder *s, int x96_synth);