[vlc-commits] [Git][videolan/vlc][master] 2 commits: contrib: dav1d: use newer version with the frame delay API

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Tue Apr 12 19:41:59 UTC 2022



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
3f3ae0e4 by Steve Lhomme at 2022-04-12T18:13:42+00:00
contrib: dav1d: use newer version with the frame delay API

This should become dav1d 1.0.1 or 1.1.0 at some point.

- - - - -
a32031dc by Steve Lhomme at 2022-04-12T18:13:42+00:00
dav1d: limit the number of extra frames needed by the decoder

The i_extra_picture_buffers is used to add pictures to the pool that the core
will allocate. dav1d is actually using n_threads frames. And the core is
allocating 10 frames per default for AV1. So we need to add the missing ones.

- - - - -


2 changed files:

- contrib/src/dav1d/rules.mak
- modules/codec/dav1d.c


Changes:

=====================================
contrib/src/dav1d/rules.mak
=====================================
@@ -2,6 +2,9 @@
 
 DAV1D_VERSION := 1.0.0
 DAV1D_URL := $(VIDEOLAN)/dav1d/$(DAV1D_VERSION)/dav1d-$(DAV1D_VERSION).tar.xz
+DAV1D_HASH := 6777dd0a61ab78cc9fab92af53558ea44c135056
+DAV1D_VERSION := $(DAV1D_HASH)
+DAV1D_GITURL := https://code.videolan.org/videolan/dav1d.git
 
 PKGS += dav1d
 ifeq ($(call need_pkg,"dav1d"),)
@@ -11,10 +14,12 @@ endif
 DAV1D_CONF = -D enable_tests=false -D enable_tools=false
 
 $(TARBALLS)/dav1d-$(DAV1D_VERSION).tar.xz:
-	$(call download_pkg,$(DAV1D_URL),dav1d)
-#	$(call download_git,$(DAV1D_GITURL),,$(DAV1D_HASH))
+	# $(call download_pkg,$(DAV1D_URL),dav1d)
+	$(call download_git,$(DAV1D_GITURL),,$(DAV1D_HASH))
 
 .sum-dav1d: dav1d-$(DAV1D_VERSION).tar.xz
+	$(call check_githash,$(DAV1D_VERSION))
+	touch $@
 
 dav1d: dav1d-$(DAV1D_VERSION).tar.xz .sum-dav1d
 	$(UNPACK)


=====================================
modules/codec/dav1d.c
=====================================
@@ -411,7 +411,28 @@ static int OpenDecoder(vlc_object_t *p_this)
     p_sys->s.n_threads = var_InheritInteger(p_this, "dav1d-thread-frames");
     if (p_sys->s.n_threads == 0)
         p_sys->s.n_threads = __MAX(1, vlc_GetCPUCount());
-#else
+
+#if DAV1D_API_VERSION_MAJOR > 6 || DAV1D_API_VERSION_MINOR >= 7
+    // after dav1d 1.0.0
+    p_sys->s.max_frame_delay = dav1d_get_frame_delay( &p_sys->s );
+#else // 1.0.0
+    // corresponds to c->n_fc when max_frame_delay is 0 in dav1d 1.0.0
+    static const uint8_t fc_lut[49] = {
+        1,                                     /*     1 */
+        2, 2, 2,                               /*  2- 4 */
+        3, 3, 3, 3, 3,                         /*  5- 9 */
+        4, 4, 4, 4, 4, 4, 4,                   /* 10-16 */
+        5, 5, 5, 5, 5, 5, 5, 5, 5,             /* 17-25 */
+        6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,       /* 26-36 */
+        7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 37-49 */
+    };
+    if (p_sys->s.n_threads >= 50)
+        p_sys->s.max_frame_delay = 8;
+    else
+        p_sys->s.max_frame_delay = fc_lut[p_sys->s.n_threads - 1];
+#endif
+
+#else // before dav1d 1.0.0
     p_sys->s.n_tile_threads = var_InheritInteger(p_this, "dav1d-thread-tiles");
     if (p_sys->s.n_tile_threads == 0)
         p_sys->s.n_tile_threads = VLC_CLIP(vlc_GetCPUCount(), 1, 4);
@@ -467,7 +488,7 @@ static int OpenDecoder(vlc_object_t *p_this)
     msg_Dbg(p_this, "Using dav1d version %s with %d threads",
             dav1d_version(), p_sys->s.n_threads);
 
-    dec->i_extra_picture_buffers = (p_sys->s.n_threads - 1);
+    dec->i_extra_picture_buffers = p_sys->s.max_frame_delay;
 #else
     msg_Dbg(p_this, "Using dav1d version %s with %d/%d frame/tile threads",
             dav1d_version(), p_sys->s.n_frame_threads, p_sys->s.n_tile_threads);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4f74c5ca37117cab4071df392c47611317779b48...a32031dc0f5f32083fc54a21397bce732742ccbe

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4f74c5ca37117cab4071df392c47611317779b48...a32031dc0f5f32083fc54a21397bce732742ccbe
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list