[FFmpeg-cvslog] lavfi/kerndeint: use aligned linesizes for the temporary buffer.

Clément Bœsch git at videolan.org
Sat Feb 16 00:18:06 CET 2013


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Sun Jan  6 19:34:16 2013 +0100| [51ba843f195c11acef20e91c98c037e39d5fe79e] | committer: Stefano Sabatini

lavfi/kerndeint: use aligned linesizes for the temporary buffer.

This improves the performances just enough to match mp=kerndeint.

Signed-off-by: Stefano Sabatini <stefasab at gmail.com>

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

 libavfilter/vf_kerndeint.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_kerndeint.c b/libavfilter/vf_kerndeint.c
index 12eb969..8449d00 100644
--- a/libavfilter/vf_kerndeint.c
+++ b/libavfilter/vf_kerndeint.c
@@ -40,8 +40,9 @@ typedef struct {
     int           frame; ///< frame count, starting from 0
     int           thresh, map, order, sharp, twoway;
     int           vsub;
-    uint8_t       *tmp_data [4];  ///< temporary plane data buffer
-    int           tmp_bwidth[4];  ///< temporary plane byte width
+    uint8_t       *tmp_data    [4];  ///< temporary plane data buffer
+    int            tmp_linesize[4];  ///< temporary plane byte linesize
+    int            tmp_bwidth  [4];  ///< temporary plane byte width
 } KerndeintContext;
 
 #define OFFSET(x) offsetof(KerndeintContext, x)
@@ -101,11 +102,15 @@ static int config_props(AVFilterLink *inlink)
 
     kerndeint->vsub = desc->log2_chroma_h;
 
-    ret = av_image_alloc(kerndeint->tmp_data, kerndeint->tmp_bwidth,
-                          inlink->w, inlink->h, inlink->format, 1);
+    ret = av_image_alloc(kerndeint->tmp_data, kerndeint->tmp_linesize,
+                         inlink->w, inlink->h, inlink->format, 16);
     if (ret < 0)
         return ret;
     memset(kerndeint->tmp_data[0], 0, ret);
+
+    if ((ret = av_image_fill_linesizes(kerndeint->tmp_bwidth, inlink->format, inlink->w)) < 0)
+        return ret;
+
     return 0;
 }
 
@@ -161,7 +166,7 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inpic)
 
         srcp = srcp_saved = inpic->data[plane];
         src_linesize      = inpic->linesize[plane];
-        psrc_linesize     = kerndeint->tmp_bwidth[plane];
+        psrc_linesize     = kerndeint->tmp_linesize[plane];
         dstp = dstp_saved = outpic->data[plane];
         dst_linesize      = outpic->linesize[plane];
         srcp              = srcp_saved + (1 - order) * src_linesize;



More information about the ffmpeg-cvslog mailing list