summaryrefslogtreecommitdiff
path: root/libavfilter/vf_scale.c
diff options
context:
space:
mode:
authorKieran Kunhya <kierank@obe.tv>2014-12-24 23:52:46 +0000
committerMichael Niedermayer <michaelni@gmx.at>2014-12-25 02:53:29 +0100
commit1515bfb3132d9e040f856bc48fbe8a4f26b14c14 (patch)
treebedafd9c1417049da566c0c7155c886564b20477 /libavfilter/vf_scale.c
parentb51cc701bc4ac34959944f30ca8a7e01e1338d43 (diff)
vf_scale: Use correct chroma positions for YUV420P
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_scale.c')
-rw-r--r--libavfilter/vf_scale.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 64b88c2357..f77884c27a 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -373,6 +373,17 @@ static int config_props(AVFilterLink *outlink)
av_opt_set_int(*s, "dst_format", outfmt, 0);
av_opt_set_int(*s, "sws_flags", scale->flags, 0);
+ /* Override YUV420P settings to have the correct (MPEG-2) chroma positions
+ * MPEG-2 chroma positions are used by convention
+ * XXX: support other 4:2:0 pixel formats */
+ if (inlink->format == AV_PIX_FMT_YUV420P) {
+ scale->in_v_chr_pos = (i == 0) ? 128 : (i == 1) ? 64 : 192;
+ }
+
+ if (outlink->format == AV_PIX_FMT_YUV420P) {
+ scale->out_v_chr_pos = (i == 0) ? 128 : (i == 1) ? 64 : 192;
+ }
+
av_opt_set_int(*s, "src_h_chr_pos", scale->in_h_chr_pos, 0);
av_opt_set_int(*s, "src_v_chr_pos", scale->in_v_chr_pos, 0);
av_opt_set_int(*s, "dst_h_chr_pos", scale->out_h_chr_pos, 0);