mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
slight optimization to conversion of M/S->L/R
This commit is contained in:
@@ -1981,7 +1981,7 @@ FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FL
|
||||
{
|
||||
unsigned channel;
|
||||
unsigned i;
|
||||
FLAC__int32 mid, side, left, right;
|
||||
FLAC__int32 mid, side;
|
||||
unsigned frame_crc; /* the one we calculate from the input stream */
|
||||
FLAC__uint32 x;
|
||||
|
||||
@@ -2063,15 +2063,19 @@ FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FL
|
||||
case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
|
||||
FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
|
||||
for(i = 0; i < decoder->private_->frame.header.blocksize; i++) {
|
||||
#if 1
|
||||
mid = decoder->private_->output[0][i];
|
||||
side = decoder->private_->output[1][i];
|
||||
mid <<= 1;
|
||||
if(side & 1) /* i.e. if 'side' is odd... */
|
||||
mid++;
|
||||
left = mid + side;
|
||||
right = mid - side;
|
||||
decoder->private_->output[0][i] = left >> 1;
|
||||
decoder->private_->output[1][i] = right >> 1;
|
||||
mid |= (side & 1); /* i.e. if 'side' is odd... */
|
||||
decoder->private_->output[0][i] = (mid + side) >> 1;
|
||||
decoder->private_->output[1][i] = (mid - side) >> 1;
|
||||
#else
|
||||
//@@@@@@ OPT: try without 'side' temp variable
|
||||
mid = (decoder->private_->output[0][i] << 1) | (decoder->private_->output[1][i] & 1); /* i.e. if 'side' is odd... */
|
||||
decoder->private_->output[0][i] = (mid + decoder->private_->output[1][i]) >> 1;
|
||||
decoder->private_->output[1][i] = (mid - decoder->private_->output[1][i]) >> 1;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user