summaryrefslogtreecommitdiff
path: root/libavcodec/dcadec.c
diff options
context:
space:
mode:
authorAlexandra Hájková <alexandra.khirnova@gmail.com>2015-12-30 15:29:03 +0100
committerJanne Grunau <janne-libav@jannau.net>2015-12-31 11:40:32 +0100
commit40d949677335a564f769823f4afdb7e7a3da8d6b (patch)
treec60f63fdd78712994004460b6f6a85cd17eb5a39 /libavcodec/dcadec.c
parent8563f9887194b07c972c3475d6b51592d77f73f7 (diff)
dca: use defines for subband related constants
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
Diffstat (limited to 'libavcodec/dcadec.c')
-rw-r--r--libavcodec/dcadec.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index a25436cdec..43992ddfb8 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -140,8 +140,6 @@ static const uint64_t dca_core_channel_layout[] = {
#define DCA_NSYNCAUX 0x9A1105A0
-#define SAMPLES_PER_SUBBAND 8 // number of samples per subband per subsubframe
-
/** Bit allocation */
typedef struct BitAlloc {
int offset; ///< code values offset
@@ -544,7 +542,7 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
}
static void qmf_32_subbands(DCAContext *s, int chans,
- float samples_in[32][SAMPLES_PER_SUBBAND], float *samples_out,
+ float samples_in[DCA_SUBBANDS][SAMPLES_PER_SUBBAND], float *samples_out,
float scale)
{
const float *prCoeff;
@@ -592,7 +590,8 @@ static QMF64_table *qmf64_precompute(void)
/* FIXME: Totally unoptimized. Based on the reference code and
* http://multimedia.cx/mirror/dca-transform.pdf, with guessed tweaks
* for doubling the size. */
-static void qmf_64_subbands(DCAContext *s, int chans, float samples_in[64][SAMPLES_PER_SUBBAND],
+static void qmf_64_subbands(DCAContext *s, int chans,
+ float samples_in[DCA_SUBBANDS_X96K][SAMPLES_PER_SUBBAND],
float *samples_out, float scale)
{
float raXin[64];
@@ -601,7 +600,7 @@ static void qmf_64_subbands(DCAContext *s, int chans, float samples_in[64][SAMPL
float *raZ = s->dca_chan[chans].subband_fir_noidea;
unsigned i, j, k, subindex;
- for (i = s->audio_header.subband_activity[chans]; i < 64; i++)
+ for (i = s->audio_header.subband_activity[chans]; i < DCA_SUBBANDS_X96K; i++)
raXin[i] = 0.0;
for (subindex = 0; subindex < SAMPLES_PER_SUBBAND; subindex++) {
for (i = 0; i < s->audio_header.subband_activity[chans]; i++)
@@ -622,14 +621,14 @@ static void qmf_64_subbands(DCAContext *s, int chans, float samples_in[64][SAMPL
raX[63 - k] = s->qmf64_table->rsin[k] * (A[k] - B[k]);
}
- for (i = 0; i < 64; i++) {
+ for (i = 0; i < DCA_SUBBANDS_X96K; i++) {
float out = raZ[i];
for (j = 0; j < 1024; j += 128)
out += ff_dca_fir_64bands[j + i] * (raX[j + i] - raX[j + 63 - i]);
*samples_out++ = out * scale;
}
- for (i = 0; i < 64; i++) {
+ for (i = 0; i < DCA_SUBBANDS_X96K; i++) {
float hist = 0.0;
for (j = 0; j < 1024; j += 128)
hist += ff_dca_fir_64bands[64 + j + i] * (-raX[i + j] - raX[j + 63 - i]);
@@ -938,7 +937,7 @@ static int dca_filter_channels(DCAContext *s, int block_index, int upsample)
int k;
if (upsample) {
- LOCAL_ALIGNED(32, float, samples, [64], [SAMPLES_PER_SUBBAND]);
+ LOCAL_ALIGNED(32, float, samples, [DCA_SUBBANDS_X96K], [SAMPLES_PER_SUBBAND]);
if (!s->qmf64_table) {
s->qmf64_table = qmf64_precompute();
@@ -952,7 +951,7 @@ static int dca_filter_channels(DCAContext *s, int block_index, int upsample)
s->dca_chan[k].subband_samples[block_index];
s->fmt_conv.int32_to_float(samples[0], subband_samples[0],
- 64 * SAMPLES_PER_SUBBAND);
+ DCA_SUBBANDS_X96K * SAMPLES_PER_SUBBAND);
if (s->channel_order_tab[k] >= 0)
qmf_64_subbands(s, k, samples,
@@ -962,14 +961,14 @@ static int dca_filter_channels(DCAContext *s, int block_index, int upsample)
}
} else {
/* 32 subbands QMF */
- LOCAL_ALIGNED(32, float, samples, [32], [SAMPLES_PER_SUBBAND]);
+ LOCAL_ALIGNED(32, float, samples, [DCA_SUBBANDS], [SAMPLES_PER_SUBBAND]);
for (k = 0; k < s->audio_header.prim_channels; k++) {
int32_t (*subband_samples)[SAMPLES_PER_SUBBAND] =
s->dca_chan[k].subband_samples[block_index];
s->fmt_conv.int32_to_float(samples[0], subband_samples[0],
- 32 * SAMPLES_PER_SUBBAND);
+ DCA_SUBBANDS * SAMPLES_PER_SUBBAND);
if (s->channel_order_tab[k] >= 0)
qmf_32_subbands(s, k, samples,