[flac-dev] [Flac-dev] mid-side coding and bits per sample

Josh Coalson xflac at yahoo.com
Wed Apr 25 13:22:57 PDT 2012


the side channel bps is 1 larger than the raw bps because it's a difference between left and right channel values.




>________________________________
> From: Eri Eri <guguieri at hotmail.com>
>To: flac-dev at xiph.org 
>Sent: Monday, September 26, 2011 1:17 AM
>Subject: [Flac-dev] mid-side coding and bits per sample
> 
>
> 
>Dear list,
>
>i'm doing a bit of analisys on flac's source code and i've run into something i can't quite grasp.
>
>flac version 1.2.1
>
>flaclib C
>
>stream_encoder.c
>
>function "process_subframes_"
>
>line 2999
>
>++++++++++++++++++++++
>    if(do_mid_side) {
>        FLAC__ASSERT(encoder->protected_->channels == 2);
>        for(channel = 0; channel < 2; channel++) {
>            const unsigned w = get_wasted_bits_(encoder->private_->integer_signal_mid_side[channel], encoder->protected_->blocksize);
>            encoder->private_->subframe_workspace_mid_side[channel][0].wasted_bits = encoder->private_->subframe_workspace_mid_side[channel][1].wasted_bits = w;
>            encoder->private_->subframe_bps_mid_side[channel] = encoder->protected_->bits_per_sample - w + (channel==0? 0:1);
>        }
>    }
>++++++++++++++++++++++++
>
>In that piece of code the encoder determines how many wasted bits there are in each channel (mid-side) and calculates effective BPS for each of them. What i don't understand is why it should add one bit to the BPS of the side channel "(channel==0? 0:1)", eventhough there is no "correction" to wasted bits. Could someone shed light on this?
>Thank you very much in advance!
>
>_______________________________________________
>Flac-dev mailing list
>Flac-dev at xiph.org
>http://lists.xiph.org/mailman/listinfo/flac-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20120425/0d943368/attachment.htm 


More information about the flac-dev mailing list