[FFmpeg-devel] [PATCH v2] avcodec/libdav1d: honor the requested skip_frame level

James Almer jamrial at gmail.com
Thu Dec 15 01:51:35 EET 2022


This allows dropping non-reference, non-intra, or non-key frames on supported
libdav1d versions.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/libdav1d.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 2f151d2d1b..5a4daa3e23 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -260,6 +260,20 @@ static av_cold int libdav1d_init(AVCodecContext *c)
            s.n_frame_threads, s.n_tile_threads);
 #endif
 
+#if FF_DAV1D_VERSION_AT_LEAST(6,8)
+    switch (c->skip_frame) {
+    case AVDISCARD_NONREF:
+        s.decode_frame_type = DAV1D_DECODEFRAMETYPE_REFERENCE;
+        break;
+    case AVDISCARD_NONINTRA:
+        s.decode_frame_type = DAV1D_DECODEFRAMETYPE_INTRA;
+        break;
+    case AVDISCARD_NONKEY:
+        s.decode_frame_type = DAV1D_DECODEFRAMETYPE_KEY;
+        break;
+    }
+#endif
+
     res = libdav1d_parse_extradata(c);
     if (res < 0)
         return res;
-- 
2.38.1



More information about the ffmpeg-devel mailing list