[FFmpeg-cvslog] lavfi/mp=decimate: fix off-by-one logic in diff_C() x loop

Stefano Sabatini git at videolan.org
Fri Aug 31 16:05:31 CEST 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Wed Aug 29 13:08:49 2012 +0200| [6c0107822d3ed7588fa857c3ed1ee886b4ba62e9] | committer: Stefano Sabatini

lavfi/mp=decimate: fix off-by-one logic in diff_C() x loop

Set x offset values in the range 0-7, rather than in the range 8-1.

The y loop is changed accordingly, to avoid confusion.

This also fixes output difference with the new pending native decimate
filter.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c0107822d3ed7588fa857c3ed1ee886b4ba62e9
---

 libavfilter/libmpcodecs/vf_decimate.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/libmpcodecs/vf_decimate.c b/libavfilter/libmpcodecs/vf_decimate.c
index 1fd7bce..2d2aaf0 100644
--- a/libavfilter/libmpcodecs/vf_decimate.c
+++ b/libavfilter/libmpcodecs/vf_decimate.c
@@ -82,8 +82,8 @@ static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns)
 static int diff_C(unsigned char *old, unsigned char *new, int os, int ns)
 {
     int x, y, d=0;
-    for (y = 8; y; y--) {
-        for (x = 8; x; x--) {
+    for (y = 0; y < 8; y++) {
+        for (x = 0; x < 8; x++) {
             d += abs(new[x] - old[x]);
         }
         new += ns;



More information about the ffmpeg-cvslog mailing list