adpcm: Only increment heap_pos after finding a good enough sample

This increases the PSNR slightly (about 0.1 dB) for trellis sizes
below 8, and gives equal PSNR for sizes above that.

Originally committed as revision 25769 to svn://svn.ffmpeg.org/ffmpeg/trunk
oldabi
Martin Storsjö 14 years ago
parent d764e3ece9
commit 78f9d35c9a
  1. 3
      libavcodec/adpcm.c

@ -401,9 +401,10 @@ static void adpcm_compress_trellis(AVCodecContext *avctx, const short *samples,
} else {\ } else {\
/* Try to replace one of the leaf nodes with the new \ /* Try to replace one of the leaf nodes with the new \
* one, but try a different slot each time. */\ * one, but try a different slot each time. */\
pos = (frontier >> 1) + (heap_pos++ & ((frontier >> 1) - 1));\ pos = (frontier >> 1) + (heap_pos & ((frontier >> 1) - 1));\
if (ssd > nodes_next[pos]->ssd)\ if (ssd > nodes_next[pos]->ssd)\
goto next_##NAME;\ goto next_##NAME;\
heap_pos++;\
}\ }\
*h = generation;\ *h = generation;\
u = nodes_next[pos];\ u = nodes_next[pos];\

Loading…
Cancel
Save