[FFmpeg-devel] [PATCH v2 3/5] avfilter/vf_yadif: reformat code to improve readability

Chris Phlipot cphlipot0 at gmail.com
Thu Jul 21 05:25:12 EEST 2022


Reformat some of the code to improve readability and reduce code
duplication. This change is intended to be purely cosmentic and
shouldn't result in any functional changes.

Signed-off-by: Chris Phlipot <cphlipot0 at gmail.com>
---
 libavfilter/vf_yadif.c | 11 +++++------
 libavfilter/yadif.h    |  3 +--
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index 42f6246330..54109566be 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -211,16 +211,15 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
             uint8_t *cur  = &s->cur ->data[td->plane][y * refs];
             uint8_t *next = &s->next->data[td->plane][y * refs];
             uint8_t *dst  = &td->frame->data[td->plane][y * td->frame->linesize[td->plane]];
+            int     prefs = y + 1 < td->h ? refs : -refs;
+            int     mrefs = y ? -refs : refs;
+            int    parity = td->parity ^ td->tff;
             int     mode  = y == 1 || y + 2 == td->h ? 2 : s->mode;
             s->filter_line(dst + pix_3, prev + pix_3, cur + pix_3,
                            next + pix_3, td->w - edge,
-                           y + 1 < td->h ? refs : -refs,
-                           y ? -refs : refs,
-                           td->parity ^ td->tff, mode);
+                           prefs, mrefs, parity, mode);
             s->filter_edges(dst, prev, cur, next, td->w,
-                            y + 1 < td->h ? refs : -refs,
-                            y ? -refs : refs,
-                            td->parity ^ td->tff, mode, s->req_align);
+                            prefs, mrefs, parity, mode, s->req_align);
         } else {
             memcpy(&td->frame->data[td->plane][y * td->frame->linesize[td->plane]],
                    &s->cur->data[td->plane][y * refs], td->w * df);
diff --git a/libavfilter/yadif.h b/libavfilter/yadif.h
index b81f2fc1d9..f271fe8304 100644
--- a/libavfilter/yadif.h
+++ b/libavfilter/yadif.h
@@ -67,8 +67,7 @@ typedef struct YADIFContext {
      * Required alignment for filter_line
      */
     int req_align;
-    void (*filter_line)(void *dst,
-                        void *prev, void *cur, void *next,
+    void (*filter_line)(void *dst, void *prev, void *cur, void *next,
                         int w, int prefs, int mrefs, int parity, int mode);
     void (*filter_edges)(void *dst, void *prev, void *cur, void *next,
                          int w, int prefs, int mrefs, int parity, int mode,
-- 
2.25.1



More information about the ffmpeg-devel mailing list