History

avfilter/vf_scale: Avoid unnecessary indirection

Andreas Rheinhardt committed 5 years ago

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

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_scale.c+21−21
@@ -530,31 +530,31 @@ static int config_props(AVFilterLink *outlink) · 529 unmodified lines
530 530
531 for (i = 0; i < 3; i++) {531 for (i = 0; i < 3; i++) {
532 int in_v_chr_pos = scale->in_v_chr_pos, out_v_chr_pos = scale->out_v_chr_pos;532 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];533 struct SwsContext *const s = sws_alloc_context();
534 *s = sws_alloc_context();534 if (!s)
535 if (!*s)
536 return AVERROR(ENOMEM);535 return AVERROR(ENOMEM);
537 536 *swscs[i] = s;
538 av_opt_set_int(*s, "srcw", inlink0 ->w, 0);537
539 av_opt_set_int(*s, "srch", inlink0 ->h >> !!i, 0);538 av_opt_set_int(s, "srcw", inlink0 ->w, 0);
540 av_opt_set_int(*s, "src_format", inlink0->format, 0);539 av_opt_set_int(s, "srch", inlink0 ->h >> !!i, 0);
541 av_opt_set_int(*s, "dstw", outlink->w, 0);540 av_opt_set_int(s, "src_format", inlink0->format, 0);
542 av_opt_set_int(*s, "dsth", outlink->h >> !!i, 0);541 av_opt_set_int(s, "dstw", outlink->w, 0);
543 av_opt_set_int(*s, "dst_format", outfmt, 0);542 av_opt_set_int(s, "dsth", outlink->h >> !!i, 0);
544 av_opt_set_int(*s, "sws_flags", scale->flags, 0);543 av_opt_set_int(s, "dst_format", outfmt, 0);
545 av_opt_set_int(*s, "param0", scale->param[0], 0);544 av_opt_set_int(s, "sws_flags", scale->flags, 0);
546 av_opt_set_int(*s, "param1", scale->param[1], 0);545 av_opt_set_int(s, "param0", scale->param[0], 0);
546 av_opt_set_int(s, "param1", scale->param[1], 0);
547 if (scale->in_range != AVCOL_RANGE_UNSPECIFIED)547 if (scale->in_range != AVCOL_RANGE_UNSPECIFIED)
548 av_opt_set_int(*s, "src_range",548 av_opt_set_int(s, "src_range",
549 scale->in_range == AVCOL_RANGE_JPEG, 0);549 scale->in_range == AVCOL_RANGE_JPEG, 0);
550 if (scale->out_range != AVCOL_RANGE_UNSPECIFIED)550 if (scale->out_range != AVCOL_RANGE_UNSPECIFIED)
551 av_opt_set_int(*s, "dst_range",551 av_opt_set_int(s, "dst_range",
552 scale->out_range == AVCOL_RANGE_JPEG, 0);552 scale->out_range == AVCOL_RANGE_JPEG, 0);
553 553
554 if (scale->opts) {554 if (scale->opts) {
555 AVDictionaryEntry *e = NULL;555 AVDictionaryEntry *e = NULL;
556 while ((e = av_dict_get(scale->opts, "", e, AV_DICT_IGNORE_SUFFIX))) {556 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)
558 return ret;558 return ret;
559 }559 }
560 }560 }
@@ -569,12 +569,12 @@ static int config_props(AVFilterLink *outlink) · 8 unmodified lines
569 out_v_chr_pos = (i == 0) ? 128 : (i == 1) ? 64 : 192;569 out_v_chr_pos = (i == 0) ? 128 : (i == 1) ? 64 : 192;
570 }570 }
571 571
572 av_opt_set_int(*s, "src_h_chr_pos", scale->in_h_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);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);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);575 av_opt_set_int(s, "dst_v_chr_pos", out_v_chr_pos, 0);
576 576
577 if ((ret = sws_init_context(*s, NULL, NULL)) < 0)577 if ((ret = sws_init_context(s, NULL, NULL)) < 0)
578 return ret;578 return ret;
579 if (!scale->interlaced)579 if (!scale->interlaced)
580 break;580 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