[FFmpeg-devel] [RFC]Allow to change colour range with the scale filter
Carl Eugen Hoyos
cehoyos at ag.or.at
Tue May 19 23:46:02 CEST 2015
Hi!
The scale filter currently skips scaling if width, height and pix_fmt do not
change. I suspect it should scale if the user specified different colour
ranges for input and output.
Attached patch is not sufficient, libswscale decides to use "simple copy"
before srcRange and dstRange are set. I also failed to set them with the
src_range and dst_range option from the command line: How can this be solved?
See also
http://thread.gmane.org/gmane.comp.video.ffmpeg.user/57005/focus=57093
Carl Eugen
-------------- next part --------------
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 2a3d008..7cc731c 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -344,6 +344,7 @@ static int config_props(AVFilterLink *outlink)
sws_freeContext(scale->isws[1]);
scale->isws[0] = scale->isws[1] = scale->sws = NULL;
if (inlink->w == outlink->w && inlink->h == outlink->h &&
+ scale->in_range == scale->out_range &&
inlink->format == outlink->format)
;
else {
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index b426fa1..baf21a0 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1736,6 +1736,7 @@ void ff_get_unscaled_swscale(SwsContext *c)
#define isPlanarGray(x) (isGray(x) && (x) != AV_PIX_FMT_YA8 && (x) != AV_PIX_FMT_YA16LE && (x) != AV_PIX_FMT_YA16BE)
/* simple copy */
+ if (c->srcRange == c->dstRange)
if ( srcFormat == dstFormat ||
(srcFormat == AV_PIX_FMT_YUVA420P && dstFormat == AV_PIX_FMT_YUV420P) ||
(srcFormat == AV_PIX_FMT_YUV420P && dstFormat == AV_PIX_FMT_YUVA420P) ||
More information about the ffmpeg-devel
mailing list