diff mbox series

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

Message ID 20221214235135.1604-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,v2] avcodec/libdav1d: honor the requested skip_frame level | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer Dec. 14, 2022, 11:51 p.m. UTC
This allows dropping non-reference, non-intra, or non-key frames on supported
libdav1d versions.

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

Patch

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;