History

avfilter/buffersrc: allow promoting color range to MPEG

Otherwise, passing an UNSPECIFIED frame to am MPEG-only filter graph would trigger insertion of an unnecessary vf_scale filter, which would perform a memcpy to convert between the two. This is safe to do because unspecified YUV frames are already universally assumed to be MPEG range, in particular by swscale.

Niklas Haas committed 2 years ago

Commit d2ae2aa1 parent 2303bf31 file · +8 −2Browse files

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

Unified · Split

libavfilter/buffersrc.c+8−2
@@ -506,8 +506,14 @@ static int query_formats(AVFilterContext *ctx) · 505 unmodified lines
506506 if ((ret = ff_add_format(&color_spaces, c->color_space)) < 0 ||
507507 (ret = ff_set_common_color_spaces(ctx, color_spaces)) < 0)
508508 return ret;
509− if ((ret = ff_add_format(&color_ranges, c->color_range)) < 0 ||
510− (ret = ff_set_common_color_ranges(ctx, color_ranges)) < 0)
509+ if ((ret = ff_add_format(&color_ranges, c->color_range)) < 0)
510+ return ret;
511+ if (c->color_range == AVCOL_RANGE_UNSPECIFIED) {
512+ /* allow implicitly promoting unspecified to mpeg */
513+ if ((ret = ff_add_format(&color_ranges, AVCOL_RANGE_MPEG)) < 0)
514+ return ret;
515+ }
516+ if ((ret = ff_set_common_color_ranges(ctx, color_ranges)) < 0)
511517 return ret;
512518 }
513519 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