]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
mlp: Simplify adressing of state and coeffs arrays for both filters by making
authorramiro <ramiro@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Fri, 15 May 2009 15:34:22 +0000 (15:34 +0000)
committerramiro <ramiro@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Fri, 15 May 2009 15:34:22 +0000 (15:34 +0000)
the arrays sequential.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18841 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/dsputil.h
libavcodec/mlp.h
libavcodec/mlpdec.c
libavcodec/mlpdsp.c

index 365f596fc9f0eab1f85c2381fbaa611912e05913..9dc89409c422c13aa2e8e8636080e92ac25a2ec6 100644 (file)
@@ -476,8 +476,8 @@ typedef struct DSPContext {
     void (*shrink[4])(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
 
     /* mlp/truehd functions */
-    void (*mlp_filter_channel)(int32_t *firbuf, const int32_t *fircoeff, int firorder,
-                               int32_t *iirbuf, const int32_t *iircoeff, int iirorder,
+    void (*mlp_filter_channel)(int32_t *state, const int32_t *coeff,
+                               int firorder, int iirorder,
                                unsigned int filter_shift, int32_t mask, int blocksize,
                                int32_t *sample_buffer);
 
index c1c0abd7c21d2aa3d7e633bcfb313efea86a4893..b83881653c0d60f8daa9327be1e8c8549bf45b06 100644 (file)
@@ -73,13 +73,13 @@ typedef struct {
     uint8_t     order; ///< number of taps in filter
     uint8_t     shift; ///< Right shift to apply to output of filter.
 
-    int32_t     coeff[MAX_FIR_ORDER];
     int32_t     state[MAX_FIR_ORDER];
 } FilterParams;
 
 /** sample data coding information */
 typedef struct {
     FilterParams filter_params[NUM_FILTERS];
+    int32_t     coeff[NUM_FILTERS][MAX_FIR_ORDER];
 
     int16_t     huff_offset;      ///< Offset to apply to residual values.
     int32_t     sign_huff_offset; ///< sign/rounding-corrected version of huff_offset
index 0a64d79897bf2751ce1a929bdecdcd681ab9b312..88803959bf0f5e5316c344093570a7a430628c7f 100644 (file)
@@ -495,6 +495,7 @@ static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp,
     fp->order = order;
 
     if (order > 0) {
+        int32_t *fcoeff = m->channel_params[channel].coeff[filter];
         int coeff_bits, coeff_shift;
 
         fp->shift = get_bits(gbp, 4);
@@ -515,7 +516,7 @@ static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp,
         }
 
         for (i = 0; i < order; i++)
-            fp->coeff[i] = get_sbits(gbp, coeff_bits) << coeff_shift;
+            fcoeff[i] = get_sbits(gbp, coeff_bits) << coeff_shift;
 
         if (get_bits1(gbp)) {
             int state_bits, state_shift;
@@ -718,10 +719,10 @@ static void filter_channel(MLPDecodeContext *m, unsigned int substr,
                            unsigned int channel)
 {
     SubStream *s = &m->substream[substr];
-    int32_t fir_state_buffer[MAX_BLOCKSIZE + MAX_FIR_ORDER];
-    int32_t iir_state_buffer[MAX_BLOCKSIZE + MAX_IIR_ORDER];
-    int32_t *firbuf = fir_state_buffer + MAX_BLOCKSIZE;
-    int32_t *iirbuf = iir_state_buffer + MAX_BLOCKSIZE;
+    const int32_t *fircoeff = m->channel_params[channel].coeff[FIR];
+    int32_t state_buffer[NUM_FILTERS][MAX_BLOCKSIZE + MAX_FIR_ORDER];
+    int32_t *firbuf = state_buffer[FIR] + MAX_BLOCKSIZE;
+    int32_t *iirbuf = state_buffer[IIR] + MAX_BLOCKSIZE;
     FilterParams *fir = &m->channel_params[channel].filter_params[FIR];
     FilterParams *iir = &m->channel_params[channel].filter_params[IIR];
     unsigned int filter_shift = fir->shift;
@@ -730,8 +731,8 @@ static void filter_channel(MLPDecodeContext *m, unsigned int substr,
     memcpy(firbuf, fir->state, MAX_FIR_ORDER * sizeof(int32_t));
     memcpy(iirbuf, iir->state, MAX_IIR_ORDER * sizeof(int32_t));
 
-    m->dsp.mlp_filter_channel(firbuf, fir->coeff, fir->order,
-                              iirbuf, iir->coeff, iir->order,
+    m->dsp.mlp_filter_channel(firbuf, fircoeff,
+                              fir->order, iir->order,
                               filter_shift, mask, s->blocksize,
                               &m->sample_buffer[s->blockpos][channel]);
 
index 4b4b7b5beb0ebccec53e6a545f75daafba3e80c0..6519b16eab9a866320fd7531ea919609560121d2 100644 (file)
 #include "libavcodec/mlp.h"
 #include "dsputil.h"
 
-static void ff_mlp_filter_channel(int32_t *firbuf, const int32_t *fircoeff, int firorder,
-                                  int32_t *iirbuf, const int32_t *iircoeff, int iirorder,
+static void ff_mlp_filter_channel(int32_t *state, const int32_t *coeff,
+                                  int firorder, int iirorder,
                                   unsigned int filter_shift, int32_t mask, int blocksize,
                                   int32_t *sample_buffer)
 {
+    int32_t *firbuf = state;
+    int32_t *iirbuf = state + MAX_BLOCKSIZE + MAX_FIR_ORDER;
+    const int32_t *fircoeff = coeff;
+    const int32_t *iircoeff = coeff + MAX_FIR_ORDER;
     int i;
 
     for (i = 0; i < blocksize; i++) {