[soc]: r4345 - in wmapro: wma3.h wma3dec.c
Author: faust3 Date: Sat May 30 21:22:28 2009 New Revision: 4345 Log: decode decorrelation matrix in wma_decode_decorrelation_matrix and reduced the channel group context size Modified: wmapro/wma3.h wmapro/wma3dec.c Modified: wmapro/wma3.h ============================================================================== --- wmapro/wma3.h Sat May 30 19:58:50 2009 (r4344) +++ wmapro/wma3.h Sat May 30 21:22:28 2009 (r4345) @@ -74,12 +74,11 @@ typedef struct { * @brief channel group for channel transformations */ typedef struct { - int num_channels; - int transform; ///< controls the type of the transform - char transform_band[MAX_BANDS]; ///< controls if the transform is enabled for a certain band - char rotation_offset[MAX_CHANNELS * MAX_CHANNELS]; - float decorrelation_matrix[MAX_CHANNELS*MAX_CHANNELS]; - char use_channel[MAX_CHANNELS]; + char num_channels; ///< number of channels in the group + char transform; ///< controls the type of the transform + char transform_band[MAX_BANDS]; ///< controls if the transform is enabled for a certain band + float decorrelation_matrix[MAX_CHANNELS*MAX_CHANNELS]; ///< decorrelation matrix + char use_channel[MAX_CHANNELS]; ///< channels that are part of the group } WMA3ChannelGroup; /** Modified: wmapro/wma3dec.c ============================================================================== --- wmapro/wma3dec.c Sat May 30 19:58:50 2009 (r4344) +++ wmapro/wma3dec.c Sat May 30 21:22:28 2009 (r4345) @@ -613,12 +613,24 @@ static int wma_decode_tilehdr(WMA3Decode /** *@brief Calculate a decorrelation matrix from the bitstream parameters. + *@param s codec context *@param chgroup channel group for which the matrix needs to be calculated */ -static void wma_calc_decorrelation_matrix(WMA3ChannelGroup* chgroup) +static void wma_decode_decorrelation_matrix(WMA3DecodeContext* s, WMA3ChannelGroup* chgroup) { int i; int offset = 0; + char rotation_offset[MAX_CHANNELS * MAX_CHANNELS]; + + for(i=0;i<chgroup->num_channels * (chgroup->num_channels - 1) >> 1;i++) + rotation_offset[i] = get_bits(&s->gb,6); + + for(i=0;i<chgroup->num_channels;i++){ + if(get_bits1(&s->gb)) + chgroup->decorrelation_matrix[chgroup->num_channels * i + i]= 1.0; + else + chgroup->decorrelation_matrix[chgroup->num_channels * i + i]= -1.0; + } for(i=1;i<chgroup->num_channels;i++){ int x; @@ -631,7 +643,7 @@ static void wma_calc_decorrelation_matri for(y=0;y < i + 1 ; y++){ float v1 = tmp1[y]; float v2 = tmp2[y]; - int n = chgroup->rotation_offset[offset + x]; + 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); @@ -714,22 +726,13 @@ static int wma_decode_channel_transform( } }else if(chgroup->num_channels > 2){ if(get_bits1(&s->gb)){ - if(get_bits1(&s->gb)){ - int n_offset = chgroup->num_channels * (chgroup->num_channels - 1) >> 1; - int i; - chgroup->transform = 2; - for(i=0;i<n_offset;i++){ - chgroup->rotation_offset[i] = get_bits(&s->gb,6); - } - for(i=0;i<chgroup->num_channels;i++) - chgroup->decorrelation_matrix[chgroup->num_channels * i + i] = get_bits1(&s->gb)?1.0:-1.0; - wma_calc_decorrelation_matrix(chgroup); - }else{ - chgroup->transform = 2; + chgroup->transform = 2; + if(get_bits1(&s->gb)) + wma_decode_decorrelation_matrix(s, chgroup); + else memcpy(chgroup->decorrelation_matrix, s->def_decorrelation_mat[chgroup->num_channels], chgroup->num_channels * chgroup->num_channels * sizeof(float)); - } } }
On Sat, May 30, 2009 at 09:22:28PM +0200, faust3 wrote:
Log: decode decorrelation matrix in wma_decode_decorrelation_matrix and reduced the channel group context size
You mix past and present tense in this sentence. This is ungrammatical and confusing. In general, you sometimes write your log messages in present tense, sometimes in past tense. I suggest that you stick to present tense. It sounds more natural and is generally used in FFmpeg. Also, please write log messages in an editor and keep line length below 80 characters. Diego
Hi, On Montag, 1. Juni 2009, Diego Biurrun wrote:
On Sat, May 30, 2009 at 09:22:28PM +0200, faust3 wrote:
Log: decode decorrelation matrix in wma_decode_decorrelation_matrix and reduced the channel group context size
You mix past and present tense in this sentence. This is ungrammatical and confusing.
In general, you sometimes write your log messages in present tense, sometimes in past tense. I suggest that you stick to present tense. It sounds more natural and is generally used in FFmpeg.
Also, please write log messages in an editor and keep line length below 80 characters.
Fixed. I often forget that commit messages are more than consecutive cues. Feel free to fix the other log messages directly. Regards Sascha
participants (3)
-
Diego Biurrun -
faust3 -
Sascha Sommer