<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>the side channel bps is 1 larger than the raw bps because it's a difference between left and right channel values.<br></span></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Eri Eri &lt;guguieri@hotmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> flac-dev@xiph.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, September 26, 2011 1:17 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> [Flac-dev] mid-side coding
 and bits per sample<br> </font> </div> <br>
<meta http-equiv="x-dns-prefetch-control" content="off"><div id="yiv1590825462">

<style><!--
#yiv1590825462 .yiv1590825462hmmessage P
{
margin:0px;padding:0px;}
#yiv1590825462 body.yiv1590825462hmmessage
{
font-size:10pt;font-family:Tahoma;}
--></style>

<div><div dir="ltr">
Dear list,<br><br>i'm doing a bit of analisys on flac's source code and i've run into something i can't quite grasp.<br><br>flac version 1.2.1<br><br>flaclib C<br><br>stream_encoder.c<br><br>function "process_subframes_"<br><br>line 2999<br><br>++++++++++++++++++++++<br>&nbsp;&nbsp;&nbsp; if(do_mid_side) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FLAC__ASSERT(encoder-&gt;protected_-&gt;channels == 2);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for(channel = 0; channel &lt; 2; channel++) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; const unsigned w = get_wasted_bits_(encoder-&gt;private_-&gt;integer_signal_mid_side[channel], encoder-&gt;protected_-&gt;blocksize);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; encoder-&gt;private_-&gt;subframe_workspace_mid_side[channel][0].wasted_bits = encoder-&gt;private_-&gt;subframe_workspace_mid_side[channel][1].wasted_bits = w;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 encoder-&gt;private_-&gt;subframe_bps_mid_side[channel] = encoder-&gt;protected_-&gt;bits_per_sample - w + (channel==0? 0:1);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>++++++++++++++++++++++++<br><br>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?<br>Thank you very much in advance!<br>                                               </div></div>
</div><meta http-equiv="x-dns-prefetch-control" content="on"><br>_______________________________________________<br>Flac-dev mailing list<br><a ymailto="mailto:Flac-dev@xiph.org" href="mailto:Flac-dev@xiph.org">Flac-dev@xiph.org</a><br><a href="http://lists.xiph.org/mailman/listinfo/flac-dev" target="_blank">http://lists.xiph.org/mailman/listinfo/flac-dev</a><br><br><br> </div> </div> </blockquote></div>   </div></body></html>