change default blocksize from 4608 to 4096 for LPC mode
authorJosh Coalson <jcoalson@users.sourceforce.net>
Tue, 6 Feb 2007 05:02:46 +0000 (05:02 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Tue, 6 Feb 2007 05:02:46 +0000 (05:02 +0000)
doc/html/documentation_format_overview.html
doc/html/documentation_tools_flac.html
doc/html/ogg_mapping.html
man/flac.sgml
src/flac/main.c
src/libFLAC/stream_decoder.c
src/libFLAC/stream_encoder.c

index 59c9796..fe5e256 100644 (file)
@@ -72,7 +72,7 @@
                <br />
                <b>BLOCKING</b><br />
                <br />
-               The block size is an important parameter to encoding.  If it is too small, the frame overhead will lower the compression.  If it is too large, the modeling stage of the compressor will not be able to generate an efficient model.  Understanding FLAC's modeling will help you to improve compression for some kinds of input by varying the block size.  In the most general case, using linear prediction on 44.1kHz audio, the optimal block size will be between 2-6 ksamples.  <span class="commandname">flac</span> defaults to a block size of 4608 in this case.  Using the fast fixed predictors, a smaller block size is usually preferable because of the smaller frame header.<br />
+               The block size is an important parameter to encoding.  If it is too small, the frame overhead will lower the compression.  If it is too large, the modeling stage of the compressor will not be able to generate an efficient model.  Understanding FLAC's modeling will help you to improve compression for some kinds of input by varying the block size.  In the most general case, using linear prediction on 44.1kHz audio, the optimal block size will be between 2-6 ksamples.  <span class="commandname">flac</span> defaults to a block size of 4096 in this case.  Using the fast fixed predictors, a smaller block size is usually preferable because of the smaller frame header.<br />
                <br />
                <b>INTER-CHANNEL DECORRELATION</b><br />
                <br />
index aefd26c..d5d3bbd 100644 (file)
                                        <span class="argument">-3</span>, <span class="argument">--compression-level-3</span>
                                </td>
                                <td>
-                                       Synonymous with <span class="argument">-l 6 -b 4608 -r 4</span>
+                                       Synonymous with <span class="argument">-l 6 -b 4096 -r 4</span>
                                </td>
                        </tr>
                        <tr>
                                        <span class="argument">-4</span>, <span class="argument">--compression-level-4</span>
                                </td>
                                <td>
-                                       Synonymous with <span class="argument">-l 8 -b 4608 -M -r 4</span>
+                                       Synonymous with <span class="argument">-l 8 -b 4096 -M -r 4</span>
                                </td>
                        </tr>
                        <tr>
                                        <span class="argument">-5</span>, <span class="argument">--compression-level-5</span>
                                </td>
                                <td>
-                                       Synonymous with <span class="argument">-l 8 -b 4608 -m -r 5</span>
+                                       Synonymous with <span class="argument">-l 8 -b 4096 -m -r 5</span>
                                </td>
                        </tr>
                        <tr>
                                        <span class="argument">-6</span>, <span class="argument">--compression-level-6</span>
                                </td>
                                <td>
-                                       Synonymous with <span class="argument">-l 8 -b 4608 -m -r 6</span>
+                                       Synonymous with <span class="argument">-l 8 -b 4096 -m -r 6</span>
                                </td>
                        </tr>
                        <tr>
                                        <span class="argument">-7</span>, <span class="argument">--compression-level-7</span>
                                </td>
                                <td>
-                                       Synonymous with <span class="argument">-l 8 -b 4608 -m -e -r 6</span>
+                                       Synonymous with <span class="argument">-l 8 -b 4096 -m -e -r 6</span>
                                </td>
                        </tr>
                        <tr>
                                        <span class="argument">-8</span>, <span class="argument">--compression-level-8</span>
                                </td>
                                <td>
-                                       Synonymous with <span class="argument">-l 12 -b 4608 -m -e -r 6</span>
+                                       Synonymous with <span class="argument">-l 12 -b 4096 -m -e -r 6</span>
                                </td>
                        </tr>
                        <tr>
index 39aec94..587d512 100644 (file)
@@ -57,7 +57,7 @@
                <br />
                This presents a problem when trying to encapsulate FLAC in other true transport layers; the choice has to be made between redundancy and complexity.  In pursuit of correctness, a mapping could be created that removed from native FLAC the transport data, and merged the remaining frame header information into the audio packets.  The disadvantage is that current native FLAC decoder software could not be used to decode because of the tight coupling with the transport.  Either a separate decoding implementation would have to be created and maintained, or an Ogg FLAC decoder would have to synthesize native FLAC frames from Ogg FLAC packets and feed them to a native FLAC decoder.<br />
                <br />
-               The alternative is to treat native FLAC frames as Ogg packets and accept the transport redundancy.  It turns out that this is not much of a penalty; a maximum of 12 bytes per frame will be wasted.  Given the common case of stereo CD audio encoded with a blocksize of 4608 samples, a compressed frame will be 4-16 Kbytes.  The redundancy amounts to a fraction of a percent.<br />
+               The alternative is to treat native FLAC frames as Ogg packets and accept the transport redundancy.  It turns out that this is not much of a penalty; a maximum of 12 bytes per frame will be wasted.  Given the common case of stereo CD audio encoded with a blocksize of 4096 samples, a compressed frame will be 4-16 Kbytes.  The redundancy amounts to a fraction of a percent.<br />
                <br />
                In the interest of simplicity and expediency, the second method was chosen for the first official FLAC-&gt;Ogg mapping.  A mapping version is included in the first packet so that a less redundant mapping can be defined in the future.<br />
                <br />
index 21822c7..412e8d6 100644 (file)
                <term><option>-3</option>, <option>--compression-level-3</option></term>
 
                <listitem>
-                 <para>Synonymous with -l 6 -b 4608 -r 4</para>
+                 <para>Synonymous with -l 6 -b 4096 -r 4</para>
                </listitem>
              </varlistentry>
 
                <term><option>-4</option>, <option>--compression-level-4</option></term>
 
                <listitem>
-                 <para>Synonymous with -l 8 -b 4608 -M -r 4</para>
+                 <para>Synonymous with -l 8 -b 4096 -M -r 4</para>
                </listitem>
              </varlistentry>
 
                <term><option>-5</option>, <option>--compression-level-5</option></term>
 
                <listitem>
-                 <para>Synonymous with -l 8 -b 4608 -m -r 5</para>
+                 <para>Synonymous with -l 8 -b 4096 -m -r 5</para>
                </listitem>
              </varlistentry>
 
                <term><option>-6</option>, <option>--compression-level-6</option></term>
 
                <listitem>
-                 <para>Synonymous with -l 8 -b 4608 -m -r 6</para>
+                 <para>Synonymous with -l 8 -b 4096 -m -r 6</para>
                </listitem>
              </varlistentry>
 
                <term><option>-7</option>, <option>--compression-level-7</option></term>
 
                <listitem>
-                 <para>Synonymous with -l 8 -b 4608 -m -e -r 6</para>
+                 <para>Synonymous with -l 8 -b 4096 -m -e -r 6</para>
                </listitem>
              </varlistentry>
 
                <term><option>-8</option>, <option>--compression-level-8</option></term>
 
                <listitem>
-                 <para>Synonymous with -l 12 -b 4608 -m -e -r 6</para>
+                 <para>Synonymous with -l 12 -b 4096 -m -e -r 6</para>
                </listitem>
              </varlistentry>
            </variablelist>
index 6f0d72a..326d1cf 100644 (file)
@@ -1163,12 +1163,12 @@ void show_help(void)
        printf("  -0, --compression-level-0, --fast  Synonymous with -l 0 -b 1152 -r 3\n");
        printf("  -1, --compression-level-1          Synonymous with -l 0 -b 1152 -M -r 3\n");
        printf("  -2, --compression-level-2          Synonymous with -l 0 -b 1152 -m -r 3\n");
-       printf("  -3, --compression-level-3          Synonymous with -l 6 -b 4608 -r 4\n");
-       printf("  -4, --compression-level-4          Synonymous with -l 8 -b 4608 -M -r 4\n");
-       printf("  -5, --compression-level-5          Synonymous with -l 8 -b 4608 -m -r 5\n");
-       printf("  -6, --compression-level-6          Synonymous with -l 8 -b 4608 -m -r 6\n");
-       printf("  -7, --compression-level-7          Synonymous with -l 8 -b 4608 -m -e -r 6\n");
-       printf("  -8, --compression-level-8, --best  Synonymous with -l 12 -b 4608 -m -e -r 6\n");
+       printf("  -3, --compression-level-3          Synonymous with -l 6 -b 4096 -r 4\n");
+       printf("  -4, --compression-level-4          Synonymous with -l 8 -b 4096 -M -r 4\n");
+       printf("  -5, --compression-level-5          Synonymous with -l 8 -b 4096 -m -r 5\n");
+       printf("  -6, --compression-level-6          Synonymous with -l 8 -b 4096 -m -r 6\n");
+       printf("  -7, --compression-level-7          Synonymous with -l 8 -b 4096 -m -e -r 6\n");
+       printf("  -8, --compression-level-8, --best  Synonymous with -l 12 -b 4096 -m -e -r 6\n");
        printf("  -b, --blocksize=#                  Specify blocksize in samples\n");
        printf("  -m, --mid-side                     Try mid-side coding for each frame\n");
        printf("  -M, --adaptive-mid-side            Adaptive mid-side coding for all frames\n");
@@ -1429,20 +1429,20 @@ void show_explain(void)
        printf("                               block of 8192 bytes by default, or 65536 bytes\n");
        printf("                               if the input audio is more than 20 minutes long.\n");
        printf("  -b, --blocksize=#            Specify the blocksize in samples; the default is\n");
-       printf("                               1152 for -l 0, else 4608; must be one of 192,\n");
+       printf("                               1152 for -l 0, else 4096; must be one of 192,\n");
        printf("                               576, 1152, 2304, 4608, 256, 512, 1024, 2048,\n");
        printf("                               4096 (and 8192 or 16384 if the sample rate is\n");
        printf("                               >48kHz) for Subset streams.\n");
        printf("  -0, --compression-level-0, --fast  Synonymous with -l 0 -b 1152 -r 3\n");
        printf("  -1, --compression-level-1          Synonymous with -l 0 -b 1152 -M -r 3\n");
        printf("  -2, --compression-level-2          Synonymous with -l 0 -b 1152 -m -r 3\n");
-       printf("  -3, --compression-level-3          Synonymous with -l 6 -b 4608 -r 4\n");
-       printf("  -4, --compression-level-4          Synonymous with -l 8 -b 4608 -M -r 4\n");
-       printf("  -5, --compression-level-5          Synonymous with -l 8 -b 4608 -m -r 5\n");
+       printf("  -3, --compression-level-3          Synonymous with -l 6 -b 4096 -r 4\n");
+       printf("  -4, --compression-level-4          Synonymous with -l 8 -b 4096 -M -r 4\n");
+       printf("  -5, --compression-level-5          Synonymous with -l 8 -b 4096 -m -r 5\n");
        printf("                                     -5 is the default setting\n");
-       printf("  -6, --compression-level-6          Synonymous with -l 8 -b 4608 -m -r 6\n");
-       printf("  -7, --compression-level-7          Synonymous with -l 8 -b 4608 -m -e -r 6\n");
-       printf("  -8, --compression-level-8, --best  Synonymous with -l 12 -b 4608 -m -e -r 6\n");
+       printf("  -6, --compression-level-6          Synonymous with -l 8 -b 4096 -m -r 6\n");
+       printf("  -7, --compression-level-7          Synonymous with -l 8 -b 4096 -m -e -r 6\n");
+       printf("  -8, --compression-level-8, --best  Synonymous with -l 12 -b 4096 -m -e -r 6\n");
        printf("  -m, --mid-side                     Try mid-side coding for each frame\n");
        printf("                                     (stereo only)\n");
        printf("  -M, --adaptive-mid-side            Adaptive mid-side coding for all frames\n");
index a347220..c0240fb 100644 (file)
@@ -2965,7 +2965,7 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s
                approx_bytes_per_frame = min_blocksize * channels * bps/8 + 64;
        }
        else
-               approx_bytes_per_frame = 4608 * channels * bps/8 + 64;
+               approx_bytes_per_frame = 4096 * channels * bps/8 + 64;
 
        /*
         * First, we set an upper and lower bound on where in the
index 58620de..bea7935 100644 (file)
@@ -674,7 +674,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_(
                if(encoder->protected_->max_lpc_order == 0)
                        encoder->protected_->blocksize = 1152;
                else
-                       encoder->protected_->blocksize = 4608;
+                       encoder->protected_->blocksize = 4096;
        }
 
        if(encoder->protected_->blocksize < FLAC__MIN_BLOCK_SIZE || encoder->protected_->blocksize > FLAC__MAX_BLOCK_SIZE)