[soc]: r4346 - in wmapro: wma3.h wma3dec.c
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;
faust3 wrote:
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
Maybe add a static table instead? Then 2 instances would share the table. MvH Benjamin Larsson
Hi, On Samstag, 30. Mai 2009, Benjamin Larsson wrote:
faust3 wrote:
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
Maybe add a static table instead? Then 2 instances would share the table.
Is this a needed requirement? After reading the discussion from r18681, I'm not sure. Regards Sascha
On Sun, May 31, 2009 at 10:32:55AM +0200, Sascha Sommer wrote:
Hi,
On Samstag, 30. Mai 2009, Benjamin Larsson wrote:
faust3 wrote:
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
Maybe add a static table instead? Then 2 instances would share the table.
Is this a needed requirement? After reading the discussion from r18681, I'm not sure.
Since it's only slightly above 100 bytes per context IMO no. It might still be a bit nicer though for users who decode many streams at once.
Sascha Sommer wrote:
Maybe add a static table instead? Then 2 instances would share the table.
Is this a needed requirement? After reading the discussion from r18681, I'm not sure.
Regards
Sascha
In this case the table isn't that big so it doesn't really matter to me. But I'm guessing this will be an issue for the merge. MvH Benjamin Larsson
Hi, On Sonntag, 31. Mai 2009, Benjamin Larsson wrote:
Sascha Sommer wrote:
Maybe add a static table instead? Then 2 instances would share the table.
Is this a needed requirement? After reading the discussion from r18681, I'm not sure.
Regards
Sascha
In this case the table isn't that big so it doesn't really matter to me. But I'm guessing this will be an issue for the merge.
Ok. I made the table static. Regards Sascha
participants (4)
-
Benjamin Larsson -
faust3 -
Reimar Döffinger -
Sascha Sommer