[FFmpeg-cvslog] avcodec/dovi_rpuenc: slightly improve profile autodetection

Niklas Haas git at videolan.org
Fri Aug 16 12:52:22 EEST 2024


ffmpeg | branch: master | Niklas Haas <git at haasn.dev> | Mon Jul 15 13:36:07 2024 +0200| [3e1b70383e3e3f47589bdc3c90e0831265c155c4] | committer: Niklas Haas

avcodec/dovi_rpuenc: slightly improve profile autodetection

In the absence of an RPU header, we can consult the colorspace tags to
make a more informed guess about whether we're looking at profile 5 or
profile 8.

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

 libavcodec/dovi_rpuenc.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/libavcodec/dovi_rpuenc.c b/libavcodec/dovi_rpuenc.c
index c73805037c..8113ec44bf 100644
--- a/libavcodec/dovi_rpuenc.c
+++ b/libavcodec/dovi_rpuenc.c
@@ -79,7 +79,20 @@ int ff_dovi_configure_ext(DOVIContext *s, AVCodecParameters *codecpar,
     switch (codecpar->codec_id) {
     case AV_CODEC_ID_AV1:  dv_profile = 10; break;
     case AV_CODEC_ID_H264: dv_profile = 9;  break;
-    case AV_CODEC_ID_HEVC: dv_profile = hdr ? ff_dovi_guess_profile_hevc(hdr) : 8; break;
+    case AV_CODEC_ID_HEVC:
+        if (hdr) {
+            dv_profile = ff_dovi_guess_profile_hevc(hdr);
+            break;
+        }
+
+        /* This is likely to be proprietary IPTPQc2 */
+        if (codecpar->color_space == AVCOL_SPC_IPT_C2 ||
+            (codecpar->color_space == AVCOL_SPC_UNSPECIFIED &&
+             codecpar->color_trc == AVCOL_TRC_UNSPECIFIED))
+            dv_profile = 5;
+        else
+            dv_profile = 8;
+        break;
     default:
         /* No other encoder should be calling this! */
         av_assert0(0);



More information about the ffmpeg-cvslog mailing list