Menu

#492 LAME3.99.5: ugly clip around 20kHz on CBR 320kbps (-1.5dBFS)

Quality
open
nobody
None
5
2019-07-26
2018-08-02
miero
No

See the attached image.

top: original signal
middle: cbr 320 (clip occurs when signal is between 0 and -1.6 dBFS)
bottom: vbr q0 (no clip)

Notice: only left channels of stereo files are displayed

Generated using:
sox -V3 -r 44100 -b 24 -n -c 2 x.wav synth 10 sin 10+22000 remix 1p-1 channels 2
sox -V3 x.wav -C .01 xv.mp3
sox -V3 x.wav -C 320.01 xc.mp3
sox -M x.wav xc.mp3 xv.mp3 -n remix 1 3 5 spectrogram -z 124 -x 880 -y 229

1 Attachments

Discussion

  • Elio Blanca

    Elio Blanca - 2019-01-09

    Performed the same test on my pc.

    $ sox -V3 -r 44100 -b 24 -n -c 2 x.wav synth 10 sin 10+22000 remix 1p-1 channels 2
    

    (created x.wav)

    Then encoded using the latest lame svn6437 :
    first, CBR

    $ frontend/lame -q 0 -b 320 x.wav xc.mp3
    LAME 3.100.1 64bits (http://lame.sf.net)
    Using polyphase lowpass filter, transition band: 20094 Hz - 20627 Hz
    Encoding x.wav to xc.mp3
    Encoding as 44.1 kHz j-stereo MPEG-1 Layer III (4.4x) 320 kbps qval=0
        Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA 
       384/384   (100%)|    0:00/    0:00|    0:00/    0:00|   30.510x|    0:00 
    -----------------------------------------------------------------------------------------------------------------------
       kbps        MS  %     long switch short %
      320.0      100.0        99.2   0.5   0.3
    Writing LAME Tag...done
    ReplayGain: -20.4dB
    

    then, VBR

    $ frontend/lame -q 0 -V 0 x.wav xv.mp3
    LAME 3.100.1 64bits (http://lame.sf.net)
    polyphase lowpass filter disabled
    Encoding x.wav to xv.mp3
    Encoding as 44.1 kHz j-stereo MPEG-1 Layer III VBR(q=0)
        Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA 
       384/384   (100%)|    0:00/    0:00|    0:00/    0:00|   72.414x|    0:00 
     32 [  0] 
     40 [  1] *
     48 [  9] ******
     56 [ 46] *******************************
     64 [ 97] ****************************************************************
     80 [166] *************************************************************************************************************
     96 [ 56] *************************************
    112 [  7] *****
    128 [  1] *
    160 [  0] 
    192 [  0] 
    224 [  1] *
    256 [  0] 
    320 [  0] 
    -----------------------------------------------------------------------------------------------------------------------
       kbps        MS  %     long switch short %
       75.6      100.0        97.9   1.3   0.8
    Writing LAME Tag...done
    ReplayGain: -20.4dB
    

    The only noticeable difference is that statement "polyphase lowpass filter disabled" during vbr encoding. Instead, a different statement "Using polyphase lowpass filter, transition band: 20094 Hz - 20627 Hz" gets printed during cbr encoding.

     
    • Robert Hegemann

      Robert Hegemann - 2019-07-23

      Is there any chance, that this issue is fixed too, after solving issue 496?

       
      • Elio Blanca

        Elio Blanca - 2019-07-26

        Still same behaviour using lame svn-r6448.
        Spectrogram attached.

         
        • Elio Blanca

          Elio Blanca - 2019-07-26

          Just tuned the lowpass frequency when encoding CBR at 320 kbps and I got a different spectrogram.
          The patch is simple as this:

          diff -ur lame-svn-r6448-trunk-lame_orig/libmp3lame/lame.c lame-svn-r6448-trunk-lame-1/libmp3lame/lame.c
          --- lame-svn-r6448-trunk-lame_orig/libmp3lame/lame.c    2019-06-28 15:05:47.000000000 +0200
          +++ lame-svn-r6448-trunk-lame-1/libmp3lame/lame.c   2019-07-26 11:13:22.802316849 +0200
          @@ -227,7 +227,7 @@
                   {192, 18600},
                   {224, 19400},
                   {256, 19700},
          -        {320, 20500}
          +        {320, 24000}
               };
          
          @@ -789,7 +789,7 @@
                   gfp->lowpassfreq = Min(24000, gfp->lowpassfreq);
               }
               else {
          -        gfp->lowpassfreq = Min(20500, gfp->lowpassfreq);
          +        gfp->lowpassfreq = Min(24000, gfp->lowpassfreq);
               }
               gfp->lowpassfreq = Min(gfp->samplerate_out / 2, gfp->lowpassfreq);
          

          Hope this helps.

           
  • miero

    miero - 2019-07-26

    In that case the low-pass filter is sensitive to samples with a high amplitude (or near the clip).

    It is interesting that for -V0 low-pass filter was completely disabled.

    BTW, I was reencoding samples in the NPR listening test and from the spectrogram it seems that the clipped or nearly-clipped samples show bad behaviour due to improper lowpass filter also on 128kbps bitrate. The filter is just configure for a lower frequency there.

    More: http://mr.ieero.com/pub/npr-aq-test/ (ignore -in_test.png graphs there)
    Script for graphs: http://mr.ieero.com/pub/npr-aq-test/mkgraphs.sh.txt
    Lame used for graphs: 3.99.5

    Explanation for attached graph:
    - first graph ... 128kbps CBR
    - second graph ... 320kpbs CBR
    - third grap ... original WAV

     

Log in to post a comment.