History

avfilter/vf_scale: Avoid unnecessary indirection

Andreas Rheinhardt committed 5 years ago

Commit 3dc6e4d1 parent f040c1e1 file · +21 −21Browse files

Unified · Split

libavfilter/vf_scale.c+21−21
@@ -530,31 +530,31 @@ static int config_props(AVFilterLink *outlink) · 529 unmodified lines
530530
531531 for (i = 0; i < 3; i++) {
532532 int in_v_chr_pos = scale->in_v_chr_pos, out_v_chr_pos = scale->out_v_chr_pos;
533− struct SwsContext **s = swscs[i];
534− *s = sws_alloc_context();
535− if (!*s)
533+ struct SwsContext *const s = sws_alloc_context();
534+ if (!s)
536535 return AVERROR(ENOMEM);
537−
538− av_opt_set_int(*s, "srcw", inlink0 ->w, 0);
539− av_opt_set_int(*s, "srch", inlink0 ->h >> !!i, 0);
540− av_opt_set_int(*s, "src_format", inlink0->format, 0);
541− av_opt_set_int(*s, "dstw", outlink->w, 0);
542− av_opt_set_int(*s, "dsth", outlink->h >> !!i, 0);
543− av_opt_set_int(*s, "dst_format", outfmt, 0);
544− av_opt_set_int(*s, "sws_flags", scale->flags, 0);
545− av_opt_set_int(*s, "param0", scale->param[0], 0);
546− av_opt_set_int(*s, "param1", scale->param[1], 0);
536+ *swscs[i] = s;
537+
538+ av_opt_set_int(s, "srcw", inlink0 ->w, 0);
539+ av_opt_set_int(s, "srch", inlink0 ->h >> !!i, 0);
540+ av_opt_set_int(s, "src_format", inlink0->format, 0);
541+ av_opt_set_int(s, "dstw", outlink->w, 0);
542+ av_opt_set_int(s, "dsth", outlink->h >> !!i, 0);
543+ av_opt_set_int(s, "dst_format", outfmt, 0);
544+ av_opt_set_int(s, "sws_flags", scale->flags, 0);
545+ av_opt_set_int(s, "param0", scale->param[0], 0);
546+ av_opt_set_int(s, "param1", scale->param[1], 0);
547547 if (scale->in_range != AVCOL_RANGE_UNSPECIFIED)
548− av_opt_set_int(*s, "src_range",
548+ av_opt_set_int(s, "src_range",
549549 scale->in_range == AVCOL_RANGE_JPEG, 0);
550550 if (scale->out_range != AVCOL_RANGE_UNSPECIFIED)
551− av_opt_set_int(*s, "dst_range",
551+ av_opt_set_int(s, "dst_range",
552552 scale->out_range == AVCOL_RANGE_JPEG, 0);
553553
554554 if (scale->opts) {
555555 AVDictionaryEntry *e = NULL;
556556 while ((e = av_dict_get(scale->opts, "", e, AV_DICT_IGNORE_SUFFIX))) {
557− if ((ret = av_opt_set(*s, e->key, e->value, 0)) < 0)
557+ if ((ret = av_opt_set(s, e->key, e->value, 0)) < 0)
558558 return ret;
559559 }
560560 }
@@ -569,12 +569,12 @@ static int config_props(AVFilterLink *outlink) · 8 unmodified lines
569569 out_v_chr_pos = (i == 0) ? 128 : (i == 1) ? 64 : 192;
570570 }
571571
572− av_opt_set_int(*s, "src_h_chr_pos", scale->in_h_chr_pos, 0);
573− av_opt_set_int(*s, "src_v_chr_pos", in_v_chr_pos, 0);
574− av_opt_set_int(*s, "dst_h_chr_pos", scale->out_h_chr_pos, 0);
575− av_opt_set_int(*s, "dst_v_chr_pos", out_v_chr_pos, 0);
572+ av_opt_set_int(s, "src_h_chr_pos", scale->in_h_chr_pos, 0);
573+ av_opt_set_int(s, "src_v_chr_pos", in_v_chr_pos, 0);
574+ av_opt_set_int(s, "dst_h_chr_pos", scale->out_h_chr_pos, 0);
575+ av_opt_set_int(s, "dst_v_chr_pos", out_v_chr_pos, 0);
576576
577− if ((ret = sws_init_context(*s, NULL, NULL)) < 0)
577+ if ((ret = sws_init_context(s, NULL, NULL)) < 0)
578578 return ret;
579579 if (!scale->interlaced)
580580 break;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t