[FFmpeg-cvslog] lavfi/tonemap_vaapi: By default use bt709 for output frame

Haihao Xiang git at videolan.org
Thu Apr 18 10:08:02 EEST 2024


ffmpeg | branch: master | Haihao Xiang <haihao.xiang at intel.com> | Mon Mar 18 16:12:44 2024 +0800| [3172a6722e945bd31c3a71d510471103680a3459] | committer: Haihao Xiang

lavfi/tonemap_vaapi: By default use bt709 for output frame

By default don't use the color properties from input frame as output
frame properties when performing HDR to SDR conversion

Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3172a6722e945bd31c3a71d510471103680a3459
---

 doc/filters.texi               | 4 ++--
 libavfilter/vf_tonemap_vaapi.c | 7 +++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 665246b038..09c7349313 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -27853,7 +27853,7 @@ Default is nv12.
 @item primaries, p
 Set the output color primaries.
 
-Default is same as input.
+Default is bt709.
 
 @item transfer, t
 Set the output transfer characteristics.
@@ -27863,7 +27863,7 @@ Default is bt709.
 @item matrix, m
 Set the output colorspace matrix.
 
-Default is same as input.
+Default is bt709.
 
 @end table
 
diff --git a/libavfilter/vf_tonemap_vaapi.c b/libavfilter/vf_tonemap_vaapi.c
index 0b767202d2..a21f565e3a 100644
--- a/libavfilter/vf_tonemap_vaapi.c
+++ b/libavfilter/vf_tonemap_vaapi.c
@@ -278,13 +278,16 @@ static int tonemap_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame
     if (err < 0)
         goto fail;
 
+    /* Use BT709 by default for HDR to SDR output frame */
+    output_frame->color_primaries = AVCOL_PRI_BT709;
+    output_frame->color_trc = AVCOL_TRC_BT709;
+    output_frame->colorspace = AVCOL_SPC_BT709;
+
     if (ctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
         output_frame->color_primaries = ctx->color_primaries;
 
     if (ctx->color_transfer != AVCOL_TRC_UNSPECIFIED)
         output_frame->color_trc = ctx->color_transfer;
-    else
-        output_frame->color_trc = AVCOL_TRC_BT709;
 
     if (ctx->color_matrix != AVCOL_SPC_UNSPECIFIED)
         output_frame->colorspace = ctx->color_matrix;



More information about the ffmpeg-cvslog mailing list