[FFmpeg-soc] [soc]: r4346 - in wmapro: wma3.h wma3dec.c
faust3
subversion at mplayerhq.hu
Sat May 30 22:36:24 CEST 2009
Author: faust3
Date: Sat May 30 22:36:24 2009
New Revision: 4346
Log:
use a sine table when calculating the decorrelation matrix
Modified:
wmapro/wma3.h
wmapro/wma3dec.c
Modified: wmapro/wma3.h
==============================================================================
--- wmapro/wma3.h Sat May 30 21:22:28 2009 (r4345)
+++ wmapro/wma3.h Sat May 30 22:36:24 2009 (r4346)
@@ -93,6 +93,7 @@ typedef struct WMA3DecodeContext {
MDCTContext mdct_ctx[BLOCK_NB_SIZES]; ///< MDCT context per block size
DECLARE_ALIGNED_16(float, tmp[BLOCK_MAX_SIZE]); ///< imdct output buffer
float* windows[BLOCK_NB_SIZES]; ///< window per block size
+ float sin64[33]; ///< sinus table for decorrelation
VLC sf_vlc; ///< scale factor dpcm vlc
VLC sf_rl_vlc; ///< scale factor run length vlc
VLC vec4_vlc; ///< 4 coefficients per symbol
Modified: wmapro/wma3dec.c
==============================================================================
--- wmapro/wma3dec.c Sat May 30 21:22:28 2009 (r4345)
+++ wmapro/wma3dec.c Sat May 30 22:36:24 2009 (r4346)
@@ -432,6 +432,10 @@ static av_cold int wma_decode_init(AVCod
}
}
+ /** calculate sine values for the decorrelation matrix */
+ for(i=0;i<33;i++)
+ s->sin64[i] = sin(i*M_PI / 64.0);
+
wma_dump_context(s);
avctx->channel_layout = channel_mask;
return 0;
@@ -644,11 +648,19 @@ static void wma_decode_decorrelation_mat
float v1 = tmp1[y];
float v2 = tmp2[y];
int n = rotation_offset[offset + x];
- float cosv = sin(n*M_PI / 64.0); // FIXME: use one table for this
- float sinv = -cos(n*M_PI / 64.0);
+ float sinv;
+ float cosv;
- chgroup->decorrelation_matrix[y + x * chgroup->num_channels] = (v1 * cosv) + (v2 * sinv);
- chgroup->decorrelation_matrix[y + i * chgroup->num_channels] = (v1 * -sinv) + (v2 * cosv);
+ if(n<32){
+ sinv = s->sin64[n];
+ cosv = s->sin64[32-n];
+ }else{
+ sinv = s->sin64[64-n];
+ cosv = -s->sin64[n-32];
+ }
+
+ chgroup->decorrelation_matrix[y + x * chgroup->num_channels] = (v1 * sinv) - (v2 * cosv);
+ chgroup->decorrelation_matrix[y + i * chgroup->num_channels] = (v1 * cosv) + (v2 * sinv);
}
}
offset += i;
More information about the FFmpeg-soc
mailing list