[FFmpeg-cvslog] avfilter/vf_scale: Avoid unnecessary indirection

Andreas Rheinhardt git at videolan.org
Thu Aug 12 17:40:51 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Aug 10 19:07:36 2021 +0200| [3dc6e4d60243cc32e6d2e17ad6e19db531d39fbc] | committer: Andreas Rheinhardt

avfilter/vf_scale: Avoid unnecessary indirection

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavfilter/vf_scale.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index aa855b894a..160ad8b584 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -530,31 +530,31 @@ static int config_props(AVFilterLink *outlink)
 
         for (i = 0; i < 3; i++) {
             int in_v_chr_pos = scale->in_v_chr_pos, out_v_chr_pos = scale->out_v_chr_pos;
-            struct SwsContext **s = swscs[i];
-            *s = sws_alloc_context();
-            if (!*s)
+            struct SwsContext *const s = sws_alloc_context();
+            if (!s)
                 return AVERROR(ENOMEM);
-
-            av_opt_set_int(*s, "srcw", inlink0 ->w, 0);
-            av_opt_set_int(*s, "srch", inlink0 ->h >> !!i, 0);
-            av_opt_set_int(*s, "src_format", inlink0->format, 0);
-            av_opt_set_int(*s, "dstw", outlink->w, 0);
-            av_opt_set_int(*s, "dsth", outlink->h >> !!i, 0);
-            av_opt_set_int(*s, "dst_format", outfmt, 0);
-            av_opt_set_int(*s, "sws_flags", scale->flags, 0);
-            av_opt_set_int(*s, "param0", scale->param[0], 0);
-            av_opt_set_int(*s, "param1", scale->param[1], 0);
+            *swscs[i] = s;
+
+            av_opt_set_int(s, "srcw", inlink0 ->w, 0);
+            av_opt_set_int(s, "srch", inlink0 ->h >> !!i, 0);
+            av_opt_set_int(s, "src_format", inlink0->format, 0);
+            av_opt_set_int(s, "dstw", outlink->w, 0);
+            av_opt_set_int(s, "dsth", outlink->h >> !!i, 0);
+            av_opt_set_int(s, "dst_format", outfmt, 0);
+            av_opt_set_int(s, "sws_flags", scale->flags, 0);
+            av_opt_set_int(s, "param0", scale->param[0], 0);
+            av_opt_set_int(s, "param1", scale->param[1], 0);
             if (scale->in_range != AVCOL_RANGE_UNSPECIFIED)
-                av_opt_set_int(*s, "src_range",
+                av_opt_set_int(s, "src_range",
                                scale->in_range == AVCOL_RANGE_JPEG, 0);
             if (scale->out_range != AVCOL_RANGE_UNSPECIFIED)
-                av_opt_set_int(*s, "dst_range",
+                av_opt_set_int(s, "dst_range",
                                scale->out_range == AVCOL_RANGE_JPEG, 0);
 
             if (scale->opts) {
                 AVDictionaryEntry *e = NULL;
                 while ((e = av_dict_get(scale->opts, "", e, AV_DICT_IGNORE_SUFFIX))) {
-                    if ((ret = av_opt_set(*s, e->key, e->value, 0)) < 0)
+                    if ((ret = av_opt_set(s, e->key, e->value, 0)) < 0)
                         return ret;
                 }
             }
@@ -569,12 +569,12 @@ static int config_props(AVFilterLink *outlink)
                 out_v_chr_pos = (i == 0) ? 128 : (i == 1) ? 64 : 192;
             }
 
-            av_opt_set_int(*s, "src_h_chr_pos", scale->in_h_chr_pos, 0);
-            av_opt_set_int(*s, "src_v_chr_pos", in_v_chr_pos, 0);
-            av_opt_set_int(*s, "dst_h_chr_pos", scale->out_h_chr_pos, 0);
-            av_opt_set_int(*s, "dst_v_chr_pos", out_v_chr_pos, 0);
+            av_opt_set_int(s, "src_h_chr_pos", scale->in_h_chr_pos, 0);
+            av_opt_set_int(s, "src_v_chr_pos", in_v_chr_pos, 0);
+            av_opt_set_int(s, "dst_h_chr_pos", scale->out_h_chr_pos, 0);
+            av_opt_set_int(s, "dst_v_chr_pos", out_v_chr_pos, 0);
 
-            if ((ret = sws_init_context(*s, NULL, NULL)) < 0)
+            if ((ret = sws_init_context(s, NULL, NULL)) < 0)
                 return ret;
             if (!scale->interlaced)
                 break;



More information about the ffmpeg-cvslog mailing list