[FFmpeg-devel] [PATCH 05/29] avfilter/vf_scale: make use of color_range from filter links
Paul B Mahol
onemda at gmail.com
Sun Dec 10 15:14:12 EET 2017
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libavfilter/vf_scale.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 9f45032e85..802f841cc3 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -303,9 +303,15 @@ static int config_props(AVFilterLink *outlink)
if (scale->in_range != AVCOL_RANGE_UNSPECIFIED)
av_opt_set_int(*s, "src_range",
scale->in_range == AVCOL_RANGE_JPEG, 0);
+ else
+ av_opt_set_int(*s, "src_range",
+ inlink->color_range == AVCOL_RANGE_JPEG, 0);
if (scale->out_range != AVCOL_RANGE_UNSPECIFIED)
av_opt_set_int(*s, "dst_range",
scale->out_range == AVCOL_RANGE_JPEG, 0);
+ else
+ av_opt_set_int(*s, "dst_range",
+ outlink->color_range == AVCOL_RANGE_JPEG, 0);
if (scale->opts) {
AVDictionaryEntry *e = NULL;
@@ -416,6 +422,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
if( in->width != link->w
|| in->height != link->h
|| in->format != link->format
+ || in->color_range != link->color_range
|| in->sample_aspect_ratio.den != link->sample_aspect_ratio.den || in->sample_aspect_ratio.num != link->sample_aspect_ratio.num) {
int ret;
@@ -429,6 +436,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
link->dst->inputs[0]->format = in->format;
link->dst->inputs[0]->w = in->width;
link->dst->inputs[0]->h = in->height;
+ link->dst->inputs[0]->color_range = in->color_range;
link->dst->inputs[0]->sample_aspect_ratio.den = in->sample_aspect_ratio.den;
link->dst->inputs[0]->sample_aspect_ratio.num = in->sample_aspect_ratio.num;
--
2.11.0
More information about the ffmpeg-devel
mailing list