[FFmpeg-cvslog] avfilter/vsrc_ddagrab: set sRGB color information on output frames

Timo Rothenpieler git at videolan.org
Sat Aug 6 23:42:03 EEST 2022


ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Sat Aug  6 20:06:50 2022 +0200| [611f8435341bf928e8b129a16657be5792571780] | committer: Timo Rothenpieler

avfilter/vsrc_ddagrab: set sRGB color information on output frames

According to MSDN, all integer pixel formats contains sRGB compliant
pixel data, so set the color information on our output frames
accordingly.

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

 libavfilter/vsrc_ddagrab.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c
index 5300d46fc1..ce36716281 100644
--- a/libavfilter/vsrc_ddagrab.c
+++ b/libavfilter/vsrc_ddagrab.c
@@ -983,6 +983,18 @@ static int ddagrab_request_frame(AVFilterLink *outlink)
 
     frame->sample_aspect_ratio = (AVRational){1, 1};
 
+    if (desc.Format == DXGI_FORMAT_B8G8R8A8_UNORM ||
+        desc.Format == DXGI_FORMAT_R10G10B10A2_UNORM) {
+        // According to MSDN, all integer formats contain sRGB image data
+        frame->color_range     = AVCOL_RANGE_JPEG;
+        frame->color_primaries = AVCOL_PRI_BT709;
+        frame->color_trc       = AVCOL_TRC_IEC61966_2_1;
+        frame->colorspace      = AVCOL_SPC_RGB;
+    } else {
+        ret = AVERROR_BUG;
+        goto fail;
+    }
+
     av_frame_unref(dda->last_frame);
     ret = av_frame_ref(dda->last_frame, frame);
     if (ret < 0)



More information about the ffmpeg-cvslog mailing list