Commit f53e96ed authored by Sascha Sommer's avatar Sascha Sommer

merge 2-channel M/S stereo decoding code with the multichannel version

Originally committed as revision 19718 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b97e0d7f
...@@ -161,34 +161,7 @@ static void inverse_channel_transform(WMA3DecodeContext *s) ...@@ -161,34 +161,7 @@ static void inverse_channel_transform(WMA3DecodeContext *s)
int i; int i;
for (i = 0; i < s->num_chgroups; i++) { for (i = 0; i < s->num_chgroups; i++) {
if (s->chgroup[i].transform) {
if (s->chgroup[i].transform == 1) {
/** M/S stereo decoding */
int16_t* sfb_offsets = s->cur_sfb_offsets;
float* ch0 = *sfb_offsets + s->channel[0].coeffs;
float* ch1 = *sfb_offsets++ + s->channel[1].coeffs;
const char* tb = s->chgroup[i].transform_band;
const char* tb_end = tb + s->num_bands;
while (tb < tb_end) {
const float* ch0_end = s->channel[0].coeffs +
FFMIN(*sfb_offsets, s->subframe_len);
if (*tb++ == 1) {
while (ch0 < ch0_end) {
const float v1 = *ch0;
const float v2 = *ch1;
*ch0++ = v1 - v2;
*ch1++ = v1 + v2;
}
} else {
while (ch0 < ch0_end) {
*ch0++ *= 181.0 / 128;
*ch1++ *= 181.0 / 128;
}
}
++sfb_offsets;
}
} else if (s->chgroup[i].transform) {
float data[WMAPRO_MAX_CHANNELS]; float data[WMAPRO_MAX_CHANNELS];
const int num_channels = s->chgroup[i].num_channels; const int num_channels = s->chgroup[i].num_channels;
float** ch_data = s->chgroup[i].channel_data; float** ch_data = s->chgroup[i].channel_data;
...@@ -199,8 +172,8 @@ static void inverse_channel_transform(WMA3DecodeContext *s) ...@@ -199,8 +172,8 @@ static void inverse_channel_transform(WMA3DecodeContext *s)
/** multichannel decorrelation */ /** multichannel decorrelation */
for (sfb = s->cur_sfb_offsets; for (sfb = s->cur_sfb_offsets;
sfb < s->cur_sfb_offsets + s->num_bands;sfb++) { sfb < s->cur_sfb_offsets + s->num_bands;sfb++) {
if (*tb++ == 1) {
int y; int y;
if (*tb++ == 1) {
/** multiply values with the decorrelation_matrix */ /** multiply values with the decorrelation_matrix */
for (y = sfb[0]; y < FFMIN(sfb[1], s->subframe_len); y++) { for (y = sfb[0]; y < FFMIN(sfb[1], s->subframe_len); y++) {
const float* mat = s->chgroup[i].decorrelation_matrix; const float* mat = s->chgroup[i].decorrelation_matrix;
...@@ -220,6 +193,11 @@ static void inverse_channel_transform(WMA3DecodeContext *s) ...@@ -220,6 +193,11 @@ static void inverse_channel_transform(WMA3DecodeContext *s)
(*ch)[y] = sum; (*ch)[y] = sum;
} }
} }
} else if (s->num_channels == 2) {
for (y = sfb[0]; y < FFMIN(sfb[1], s->subframe_len); y++) {
ch_data[0][y] *= 181.0 / 128;
ch_data[1][y] *= 181.0 / 128;
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment