aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/adpcm.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2010-11-19 17:36:29 +0000
committerMartin Storsjö <martin@martin.st>2010-11-19 17:36:29 +0000
commit78f9d35c9abeb9842656fa9344ca34fe370ce1db (patch)
tree15639138f664daa87fa60731b06a8a74c28180c8 /libavcodec/adpcm.c
parentd764e3ece9608613c6332a6f96f2673dfe086f3a (diff)
downloadffmpeg-78f9d35c9abeb9842656fa9344ca34fe370ce1db.tar.gz
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
Diffstat (limited to 'libavcodec/adpcm.c')
-rw-r--r--libavcodec/adpcm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 6a6c77b574..5e7c54f754 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -401,9 +401,10 @@ static void adpcm_compress_trellis(AVCodecContext *avctx, const short *samples,
} else {\
/* Try to replace one of the leaf nodes with the new \
* 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)\
goto next_##NAME;\
+ heap_pos++;\
}\
*h = generation;\
u = nodes_next[pos];\