[FFmpeg-devel] [PATCH 22/24] lavfi/vf_scale: pass only the private context to scale_slice()

Anton Khirnov anton at khirnov.net
Mon May 31 10:55:13 EEST 2021


Not the input link. The function does nothing with the link except
extract the private context from it.
---
 libavfilter/vf_scale.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 8516919556..37899de6a1 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -625,9 +625,8 @@ static int request_frame_ref(AVFilterLink *outlink)
     return ff_request_frame(outlink->src->inputs[1]);
 }
 
-static int scale_slice(AVFilterLink *link, AVFrame *out_buf, AVFrame *cur_pic, struct SwsContext *sws, int y, int h, int mul, int field)
+static int scale_slice(ScaleContext *scale, AVFrame *out_buf, AVFrame *cur_pic, struct SwsContext *sws, int y, int h, int mul, int field)
 {
-    ScaleContext *scale = link->dst->priv;
     const uint8_t *in[4];
     uint8_t *out[4];
     int in_stride[4],out_stride[4];
@@ -795,8 +794,8 @@ scale:
               INT_MAX);
 
     if (scale->interlaced>0 || (scale->interlaced<0 && in->interlaced_frame)) {
-        scale_slice(link, out, in, scale->isws[0], 0, (link->h+1)/2, 2, 0);
-        scale_slice(link, out, in, scale->isws[1], 0,  link->h   /2, 2, 1);
+        scale_slice(scale, out, in, scale->isws[0], 0, (link->h+1)/2, 2, 0);
+        scale_slice(scale, out, in, scale->isws[1], 0,  link->h   /2, 2, 1);
     } else if (scale->nb_slices) {
         int i, slice_h, slice_start, slice_end = 0;
         const int nb_slices = FFMIN(scale->nb_slices, link->h);
@@ -804,10 +803,10 @@ scale:
             slice_start = slice_end;
             slice_end   = (link->h * (i+1)) / nb_slices;
             slice_h     = slice_end - slice_start;
-            scale_slice(link, out, in, scale->sws, slice_start, slice_h, 1, 0);
+            scale_slice(scale, out, in, scale->sws, slice_start, slice_h, 1, 0);
         }
     } else {
-        scale_slice(link, out, in, scale->sws, 0, link->h, 1, 0);
+        scale_slice(scale, out, in, scale->sws, 0, link->h, 1, 0);
     }
 
     av_frame_free(&in);
-- 
2.30.2



More information about the ffmpeg-devel mailing list