Ratecontrol scratchfix VC logic

Hi @ywwg, 

here a version similar to VC logic and with waveform scratch fix.