diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2016-01-02 13:08:29 +0100 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2016-01-02 13:08:29 +0100 |
commit | af1238f863fda4a1a6fc00525b651a3d9b31eccd (patch) | |
tree | 52f1c7491bf534916c297e3ceaead865b6ad3335 /libavcodec/dcadsp.c | |
parent | a51c2fcdc15dd37a2d95265a5b74d522b0b0b232 (diff) | |
parent | aebf07075f4244caf591a3af71e5872fe314e87b (diff) | |
download | ffmpeg-af1238f863fda4a1a6fc00525b651a3d9b31eccd.tar.gz |
Merge commit 'aebf07075f4244caf591a3af71e5872fe314e87b'
* commit 'aebf07075f4244caf591a3af71e5872fe314e87b':
dca: change the core to work with integer coefficients.
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec/dcadsp.c')
-rw-r--r-- | libavcodec/dcadsp.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c index 97e46fd7f7..412c1dcf1f 100644 --- a/libavcodec/dcadsp.c +++ b/libavcodec/dcadsp.c @@ -25,6 +25,7 @@ #include "libavutil/intreadwrite.h" #include "dcadsp.h" +#include "dcamath.h" static void decode_hf_c(float dst[DCA_SUBBANDS][8], const int32_t vq_num[DCA_SUBBANDS], @@ -44,6 +45,21 @@ static void decode_hf_c(float dst[DCA_SUBBANDS][8], } } +static void decode_hf_int_c(int32_t dst[DCA_SUBBANDS][8], + const int32_t vq_num[DCA_SUBBANDS], + const int8_t hf_vq[1024][32], intptr_t vq_offset, + int32_t scale[DCA_SUBBANDS][2], + intptr_t start, intptr_t end) +{ + int i, j; + + for (j = start; j < end; j++) { + const int8_t *ptr = &hf_vq[vq_num[j]][vq_offset]; + for (i = 0; i < 8; i++) + dst[j][i] = ptr[i] * scale[j][0] + 8 >> 4; + } +} + static inline void dca_lfe_fir(float *out, const float *in, const float *coefs, int decifactor) { @@ -93,6 +109,22 @@ static void dca_qmf_32_subbands(float samples_in[32][8], int sb_act, } } +static void dequantize_c(int32_t *samples, uint32_t step_size, uint32_t scale) +{ + int64_t step = (int64_t)step_size * scale; + int shift, i; + int32_t step_scale; + + if (step > (1 << 23)) + shift = av_log2(step >> 23) + 1; + else + shift = 0; + step_scale = (int32_t)(step >> shift); + + for (i = 0; i < 8; i++) + samples[i] = dca_clip23(dca_norm((int64_t)samples[i] * step_scale, 22 - shift)); +} + static void dca_lfe_fir0_c(float *out, const float *in, const float *coefs) { dca_lfe_fir(out, in, coefs, 32); @@ -109,6 +141,8 @@ av_cold void ff_dcadsp_init(DCADSPContext *s) s->lfe_fir[1] = dca_lfe_fir1_c; s->qmf_32_subbands = dca_qmf_32_subbands; s->decode_hf = decode_hf_c; + s->decode_hf_int = decode_hf_int_c; + s->dequantize = dequantize_c; if (ARCH_AARCH64) ff_dcadsp_init_aarch64(s); |