Hi, This patch improves compression a very tiny bit on average, but up to 0.1 percentage point for classical music. I haven't found any tracks that show worsening compression with this patch. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Improve-LPC-order-guess.patch Type: text/x-patch Size: 0 bytes Desc: not available Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20141203/47b22333/attachment.bin
Le 03/12/2014 15:34, Martijn van Beurden a ?crit :> Hi, > > This patch improves compression a very tiny bit on average, but up to > 0.1 percentage point for classical music. I haven't found any tracks > that show worsening compression with this patch. > > > _______________________________________________ > flac-dev mailing list > flac-dev at xiph.org > http://lists.xiph.org/mailman/listinfo/flac-devHi Martijn, If you want to check this on a single piano note, I would be happy to know if this improves the monophonic use case as well. http://littlejourney.net/FLACtest/rav-sus-C3-07-cl.wav Thanks, -- Olivier Tristan Research & Development www.uvi.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20141203/61dff438/attachment.htm
Op 03-12-14 om 15:49 schreef Olivier Tristan:> [...] > If you want to check this on a single piano note, I would be > happy to know if this improves the monophonic use case as well.This sample is indeed a case where the retuning of FLAC 1.3.1 shows a severe regression. It seems the patch does work quite well in this case, but it does not fully fix the regression. FLAC 1.3.0 -5: 1066kB FLAC 1.3.0 -8: 874kB FLAC 1.3.1 -5: 1066kB FLAC 1.3.1 -8: 1062kB Patch -5: 990kB Patch -8: 986kB
On Wed, Dec 03, 2014 at 03:34:58PM +0100, Martijn van Beurden wrote:> The recent compression preset retuning improved upon most material > but it the few tracks that show regression are usually classical > music. This patch improves compression by improving the LPC order > guess, of which classical music benefits most. > > Improvement is 0.007% on average but up to 0.1%. I haven't seen > regressions for any of my test samples.> @@ -1308,7 +1308,7 @@ FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample(FLAC__double lp > > FLAC__ASSERT(total_samples > 0); > > - error_scale = 0.5 * M_LN2 * M_LN2 / (FLAC__double)total_samples; > + error_scale = 0.5 / (FLAC__double)total_samples;Just curious, is there any explanation why this improves the compression ratio? Is it a bug? -- Miroslav Lichvar
Op 04-12-14 om 09:08 schreef Miroslav Lichvar:> Just curious, is there any explanation why this improves the > compression ratio? Is it a bug?The error scale is used directly in the calculation of the expected bits per residual sample. Substituting the current code gives bps = 0.5 * log(0.5 * M_LN2 * M_LN2 / (FLAC__double)total_samples * lpc_error) / M_LN2 which is equivalent to bps = 0.5 * log(0.5 / (FLAC__double)total_samples * lpc_error) / M_LN2 - 0.23 So, practically, this change increases the expected bits per sample by 0.23. Apparently this better estimates the residual bits per sample. I've been experimenting with different values, and it seems increasing the bps even further is beneficial for some kinds of music, but not for others. This value seems to benefit all kinds of sources.
Martijn van Beurden wrote:> This patch improves compression a very tiny bit on average, but > up to 0.1 percentage point for classical music. I haven't found > any tracks that show worsening compression with this patch.Applied, thanks. I think this points to the need to have a centralised repository of of test files for studying and validating compression ratios and speed. Martjin, are you able to make your test material available? DO you have any test scripts your use to run your tests? Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
On Dec 04 11:05:24, mle+la at mega-nerd.com wrote:> Martijn van Beurden wrote: > > > This patch improves compression a very tiny bit on average, but > > up to 0.1 percentage point for classical music. I haven't found > > any tracks that show worsening compression with this patch. > > Applied, thanks. > > I think this points to the need to have a centralised repository > of of test files for studying and validating compression ratios > and speed. > > Martjin, are you able to make your test material available? DO > you have any test scripts your use to run your tests?Surely Martijn has something more sophisticated, here is my test script using SoX to generate the audio. Jan #!/bin/sh # Test FLAC compression on a set of audio files. # For each of the test files, we measure the time it takes to compress, # and the compression ratio, for compression levels from -0 to -8. die() { echo $* >&2 exit 1 } FLAC=`which flac` test -n $FLAC || die flac not found FLAC="$FLAC --silent -f" SOX=`which sox` test -n $SOX || die sox not found SOX="$SOX -c 1 -b 16 -n" TIME=`which time` test -n $TIME || die time not found TIME="$TIME -p" _size() { ls -l "$1" | awk '{print$5}' } _time() { $TIME $* 2>&1 | grep real | awk '{print$2}' } while read wave ; do ifile=${wave%%:*}.wav synth=${wave##*:} SOXCL="$SOX $ifile synth 60 $synth gain -4" echo $SOXCL ; $SOXCL || die SoX failed isize=`_size $ifile` for level in 0 1 2 3 4 5 6 7 8 ; do ofile=$ifile.$level.flac otime=`_time $FLAC -$level $ifile -o $ofile` osize=`_size $ofile` ratio=`echo "scale = 10 ; $osize / $isize" | bc` printf "%16s -%d %d/%d bytes (%f) in %f seconds\n" \ $ifile $level $osize $isize $ratio $otime rm -f $ofile done rm -f $ifile done << EOF sine: sine 440 square: square 440 triangle: triangle 440 sawtooth: sawtooth 440 trapeze: trapez 440 exp: exp 440 whitenoise: whitenoise tpdfnoise: tpdfnoise pinknoise: pinknoise brownnoise: brownnoise EOF
Op 04-12-14 om 20:05 schreef Erik de Castro Lopo:> Martjin, are you able to make your test material available? DO > you have any test scripts your use to run your tests?Sorry, most of the testmaterial isn't copylefted, and I don't think it is possible to get a nice copylefted test library. That's because most copylefted material is indie, and sadly the mastering techniques usually differ quite a lot with those used of regular commercial stuff. The scripts I use are written in PHP and rely on quite a big variety of linux-specifics. For compression it's probably not necessary anyway: the scripts are written so that the test report accurate encoding and decoding speeds. So, if one has a nicely balanced pool of music/sounds just compressing it and checking the filesizes of each individually is probably the best way to do this. I do that last step by hand anyway. So, I don't think I can be of any specific help on this.