Mercurial > libavcodec.hg
comparison wmaprodec.c @ 10006:4b91b74ff669 libavcodec
cosmetics: K&R coding style, prettyprinting
author | diego |
---|---|
date | Sun, 02 Aug 2009 13:35:42 +0000 |
parents | ca678269fa64 |
children | 57d76996ccb8 |
comparison
equal
deleted
inserted
replaced
10005:ca678269fa64 | 10006:4b91b74ff669 |
---|---|
11 av_freep(&s->num_sfb); | 11 av_freep(&s->num_sfb); |
12 av_freep(&s->sfb_offsets); | 12 av_freep(&s->sfb_offsets); |
13 av_freep(&s->subwoofer_cutoffs); | 13 av_freep(&s->subwoofer_cutoffs); |
14 av_freep(&s->sf_offsets); | 14 av_freep(&s->sf_offsets); |
15 | 15 |
16 for (i=0 ; i<WMAPRO_BLOCK_SIZES ; i++) | 16 for (i = 0 ; i < WMAPRO_BLOCK_SIZES ; i++) |
17 ff_mdct_end(&s->mdct_ctx[i]); | 17 ff_mdct_end(&s->mdct_ctx[i]); |
18 | 18 |
19 return 0; | 19 return 0; |
20 } | 20 } |
21 | 21 |
22 /** | 22 /** |
23 *@brief Calculate a decorrelation matrix from the bitstream parameters. | 23 *@brief Calculate a decorrelation matrix from the bitstream parameters. |
24 *@param s codec context | 24 *@param s codec context |
25 *@param chgroup channel group for which the matrix needs to be calculated | 25 *@param chgroup channel group for which the matrix needs to be calculated |
26 */ | 26 */ |
27 static void decode_decorrelation_matrix(WMA3DecodeContext* s, | 27 static void decode_decorrelation_matrix(WMA3DecodeContext *s, |
28 WMA3ChannelGroup* chgroup) | 28 WMA3ChannelGroup *chgroup) |
29 { | 29 { |
30 int i; | 30 int i; |
31 int offset = 0; | 31 int offset = 0; |
32 int8_t rotation_offset[WMAPRO_MAX_CHANNELS * WMAPRO_MAX_CHANNELS]; | 32 int8_t rotation_offset[WMAPRO_MAX_CHANNELS * WMAPRO_MAX_CHANNELS]; |
33 memset(chgroup->decorrelation_matrix,0, | 33 memset(chgroup->decorrelation_matrix,0, |
34 sizeof(float) *s->num_channels * s->num_channels); | 34 sizeof(float) *s->num_channels * s->num_channels); |
35 | 35 |
36 for (i=0;i<chgroup->num_channels * (chgroup->num_channels - 1) >> 1;i++) | 36 for (i = 0; i < chgroup->num_channels * (chgroup->num_channels - 1) >> 1; i++) |
37 rotation_offset[i] = get_bits(&s->gb,6); | 37 rotation_offset[i] = get_bits(&s->gb,6); |
38 | 38 |
39 for (i=0;i<chgroup->num_channels;i++) | 39 for (i = 0; i < chgroup->num_channels; i++) |
40 chgroup->decorrelation_matrix[chgroup->num_channels * i + i] = | 40 chgroup->decorrelation_matrix[chgroup->num_channels * i + i] = |
41 get_bits1(&s->gb) ? 1.0 : -1.0; | 41 get_bits1(&s->gb) ? 1.0 : -1.0; |
42 | 42 |
43 for (i=1;i<chgroup->num_channels;i++) { | 43 for (i = 1; i < chgroup->num_channels; i++) { |
44 int x; | 44 int x; |
45 for (x=0;x<i;x++) { | 45 for (x = 0; x < i; x++) { |
46 int y; | 46 int y; |
47 for (y=0;y < i + 1 ; y++) { | 47 for (y = 0; y < i + 1 ; y++) { |
48 float v1 = chgroup->decorrelation_matrix[x * chgroup->num_channels + y]; | 48 float v1 = chgroup->decorrelation_matrix[x * chgroup->num_channels + y]; |
49 float v2 = chgroup->decorrelation_matrix[i * chgroup->num_channels + y]; | 49 float v2 = chgroup->decorrelation_matrix[i * chgroup->num_channels + y]; |
50 int n = rotation_offset[offset + x]; | 50 int n = rotation_offset[offset + x]; |
51 float sinv; | 51 float sinv; |
52 float cosv; | 52 float cosv; |
53 | 53 |
54 if (n<32) { | 54 if (n < 32) { |
55 sinv = sin64[n]; | 55 sinv = sin64[n]; |
56 cosv = sin64[32-n]; | 56 cosv = sin64[32-n]; |
57 } else { | 57 } else { |
58 sinv = sin64[64-n]; | 58 sinv = sin64[64-n]; |
59 cosv = -sin64[n-32]; | 59 cosv = -sin64[n-32]; |
75 */ | 75 */ |
76 static void inverse_channel_transform(WMA3DecodeContext *s) | 76 static void inverse_channel_transform(WMA3DecodeContext *s) |
77 { | 77 { |
78 int i; | 78 int i; |
79 | 79 |
80 for (i=0;i<s->num_chgroups;i++) { | 80 for (i = 0; i < s->num_chgroups; i++) { |
81 | 81 |
82 if (s->chgroup[i].transform == 1) { | 82 if (s->chgroup[i].transform == 1) { |
83 /** M/S stereo decoding */ | 83 /** M/S stereo decoding */ |
84 int16_t* sfb_offsets = s->cur_sfb_offsets; | 84 int16_t* sfb_offsets = s->cur_sfb_offsets; |
85 float* ch0 = *sfb_offsets + s->channel[0].coeffs; | 85 float* ch0 = *sfb_offsets + s->channel[0].coeffs; |
117 for (sfb = s->cur_sfb_offsets ; | 117 for (sfb = s->cur_sfb_offsets ; |
118 sfb < s->cur_sfb_offsets + s->num_bands;sfb++) { | 118 sfb < s->cur_sfb_offsets + s->num_bands;sfb++) { |
119 if (*tb++ == 1) { | 119 if (*tb++ == 1) { |
120 int y; | 120 int y; |
121 /** multiply values with the decorrelation_matrix */ | 121 /** multiply values with the decorrelation_matrix */ |
122 for (y=sfb[0];y<FFMIN(sfb[1], s->subframe_len);y++) { | 122 for (y = sfb[0]; y < FFMIN(sfb[1], s->subframe_len); y++) { |
123 const float* mat = s->chgroup[i].decorrelation_matrix; | 123 const float* mat = s->chgroup[i].decorrelation_matrix; |
124 const float* data_end= data + num_channels; | 124 const float* data_end = data + num_channels; |
125 float* data_ptr= data; | 125 float* data_ptr = data; |
126 float** ch; | 126 float** ch; |
127 | 127 |
128 for (ch = ch_data;ch < ch_end; ch++) | 128 for (ch = ch_data;ch < ch_end; ch++) |
129 *data_ptr++ = (*ch)[y]; | 129 *data_ptr++ = (*ch)[y]; |
130 | 130 |