aboutsummaryrefslogtreecommitdiff
path: root/lib/ffmpeg/libavcodec
diff options
context:
space:
mode:
authorBen Avison <bavison@riscosopen.org>2013-07-15 18:28:16 +0100
committerpopcornmix <popcornmix@gmail.com>2013-08-02 14:22:45 +0100
commit658e2d7939f89bdb7e178e013d3ebf1e75714230 (patch)
tree31838457b161b9d960a088125f731a7a3d12fb66 /lib/ffmpeg/libavcodec
parent1bdcc107596e98bd3b753a805bccc1f2af1cfc62 (diff)
[ffmpeg] - backport - dcadsp: Add a new method, qmf_32_subbands
This does most of the work formerly carried out by the static function qmf_32_subbands() in dcadec.c. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'lib/ffmpeg/libavcodec')
-rw-r--r--lib/ffmpeg/libavcodec/dcadec.c26
-rw-r--r--lib/ffmpeg/libavcodec/dcadsp.c30
-rw-r--r--lib/ffmpeg/libavcodec/dcadsp.h9
3 files changed, 44 insertions, 21 deletions
diff --git a/lib/ffmpeg/libavcodec/dcadec.c b/lib/ffmpeg/libavcodec/dcadec.c
index b6486135c5..4054d63abe 100644
--- a/lib/ffmpeg/libavcodec/dcadec.c
+++ b/lib/ffmpeg/libavcodec/dcadec.c
@@ -1108,10 +1108,8 @@ static void qmf_32_subbands(DCAContext *s, int chans,
float scale)
{
const float *prCoeff;
- int i;
int sb_act = s->subband_activity[chans];
- int subindex;
scale *= sqrt(1 / 8.0);
@@ -1121,25 +1119,11 @@ static void qmf_32_subbands(DCAContext *s, int chans,
else /* Perfect reconstruction */
prCoeff = fir_32bands_perfect;
- for (i = sb_act; i < 32; i++)
- s->raXin[i] = 0.0;
-
- /* Reconstructed channel sample index */
- for (subindex = 0; subindex < 8; subindex++) {
- /* Load in one sample from each subband and clear inactive subbands */
- for (i = 0; i < sb_act; i++) {
- unsigned sign = (i - 1) & 2;
- uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ sign << 30;
- AV_WN32A(&s->raXin[i], v);
- }
-
- s->synth.synth_filter_float(&s->imdct,
- s->subband_fir_hist[chans],
- &s->hist_index[chans],
- s->subband_fir_noidea[chans], prCoeff,
- samples_out, s->raXin, scale);
- samples_out += 32;
- }
+ s->dcadsp.qmf_32_subbands(samples_in, sb_act, &s->synth, &s->imdct,
+ s->subband_fir_hist[chans],
+ &s->hist_index[chans],
+ s->subband_fir_noidea[chans], prCoeff,
+ samples_out, s->raXin, scale);
}
static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
diff --git a/lib/ffmpeg/libavcodec/dcadsp.c b/lib/ffmpeg/libavcodec/dcadsp.c
index dd4994d276..ab63f1b6ff 100644
--- a/lib/ffmpeg/libavcodec/dcadsp.c
+++ b/lib/ffmpeg/libavcodec/dcadsp.c
@@ -20,6 +20,7 @@
*/
#include "config.h"
+#include "libavutil/intreadwrite.h"
#include "dcadsp.h"
static void dca_lfe_fir_c(float *out, const float *in, const float *coefs,
@@ -44,8 +45,37 @@ static void dca_lfe_fir_c(float *out, const float *in, const float *coefs,
}
}
+static void dca_qmf_32_subbands(float samples_in[32][8], int sb_act,
+ SynthFilterContext *synth, FFTContext *imdct,
+ float synth_buf_ptr[512],
+ int *synth_buf_offset, float synth_buf2[32],
+ const float window[512], float *samples_out,
+ float raXin[32], float scale)
+{
+ int i;
+ int subindex;
+
+ for (i = sb_act; i < 32; i++)
+ raXin[i] = 0.0;
+
+ /* Reconstructed channel sample index */
+ for (subindex = 0; subindex < 8; subindex++) {
+ /* Load in one sample from each subband and clear inactive subbands */
+ for (i = 0; i < sb_act; i++) {
+ unsigned sign = (i - 1) & 2;
+ uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ sign << 30;
+ AV_WN32A(&raXin[i], v);
+ }
+
+ synth->synth_filter_float(imdct, synth_buf_ptr, synth_buf_offset,
+ synth_buf2, window, samples_out, raXin, scale);
+ samples_out += 32;
+ }
+}
+
void ff_dcadsp_init(DCADSPContext *s)
{
s->lfe_fir = dca_lfe_fir_c;
+ s->qmf_32_subbands = dca_qmf_32_subbands;
if (ARCH_ARM) ff_dcadsp_init_arm(s);
}
diff --git a/lib/ffmpeg/libavcodec/dcadsp.h b/lib/ffmpeg/libavcodec/dcadsp.h
index bb157f7650..d86c1f32a6 100644
--- a/lib/ffmpeg/libavcodec/dcadsp.h
+++ b/lib/ffmpeg/libavcodec/dcadsp.h
@@ -19,9 +19,18 @@
#ifndef AVCODEC_DCADSP_H
#define AVCODEC_DCADSP_H
+#include "avfft.h"
+#include "synth_filter.h"
+
typedef struct DCADSPContext {
void (*lfe_fir)(float *out, const float *in, const float *coefs,
int decifactor, float scale);
+ void (*qmf_32_subbands)(float samples_in[32][8], int sb_act,
+ SynthFilterContext *synth, FFTContext *imdct,
+ float synth_buf_ptr[512],
+ int *synth_buf_offset, float synth_buf2[32],
+ const float window[512], float *samples_out,
+ float raXin[32], float scale);
} DCADSPContext;
void ff_dcadsp_init(DCADSPContext *s);