[FFmpeg-devel] [PATCH 3/5] lavfi/select/scene: use pointer increments instead of y*linesize.

Clément Bœsch ubitux at gmail.com
Sat Oct 13 18:31:44 CEST 2012


---
 libavfilter/vf_select.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_select.c b/libavfilter/vf_select.c
index f308a90..1dd0e73 100644
--- a/libavfilter/vf_select.c
+++ b/libavfilter/vf_select.c
@@ -211,12 +211,13 @@ static double get_scene_score(AVFilterContext *ctx, AVFilterBufferRef *picref)
         uint8_t *p2 = prev_picref->data[0];
         const int linesize = picref->linesize[0];
 
-        for (y = 0; y < picref->video->h - 8; y += 8)
+        for (y = 0; y < picref->video->h - 8; y += 8) {
             for (x = 0; x < picref->video->w*3 - 8; x += 8)
-                sad += select->c.sad[1](select,
-                                        p1 + y * linesize + x,
-                                        p2 + y * linesize + x,
+                sad += select->c.sad[1](select, p1 + x, p2 + x,
                                         linesize, 8);
+            p1 += 8 * linesize;
+            p2 += 8 * linesize;
+        }
         emms_c();
         mafd = sad / (picref->video->h * picref->video->w * 3);
         diff = fabs(mafd - select->prev_mafd);
-- 
1.7.12.2



More information about the ffmpeg-devel mailing list