[vlc-commits] [Git][videolan/vlc][3.0.x] 3 commits: dav1d: fix compilation with (upcoming) dav1d 1.0

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Tue May 3 07:47:32 UTC 2022



Hugo Beauzée-Luyssen pushed to branch 3.0.x at VideoLAN / VLC


Commits:
2202c892 by Steve Lhomme at 2022-05-02T07:18:45+00:00
dav1d: fix compilation with (upcoming) dav1d 1.0

(cherry picked from commit dbf45cea2a8abdfbef897b8a71f3eb782bb1b712) (edited)
edited:
- 3.0 has the 128 pixels padding elsewhere
- 3.0 has an extra parameter for add_integer_with_range()
- 3.0 was setting i_extra_picture_buffers further down in the code
- 3.0 uses 16 threads max

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
4b75be8a by Steve Lhomme at 2022-05-02T07:18:45+00:00
contrib: dav1d: update to 1.0.0

(cherry picked from commit c857056738aec2e66d21b54d2d086c60255e6a91) (edited)
edited:
- 3.0 had a different way to comment the git URL line

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
d38ddd72 by Steve Lhomme at 2022-05-02T07:18:45+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.

(cherry picked from commit a32031dc0f5f32083fc54a21397bce732742ccbe) (rebased)
rebased:
- the code dav1d 1.0.0 in 3.0 uses different max versions

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -


3 changed files:

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


Changes:

=====================================
contrib/src/dav1d/SHA512SUMS
=====================================
@@ -1 +1 @@
-87026f8b14e408ff50fc8f137ec2ede4b14c5f69687e615d2359d0f718ae5cb5176522490786d9ae1f7838182f82615c2674f7c2961b6dcec83f1ee587c3af7c  dav1d-0.9.2.tar.xz
+a3a7e162e45181449cd42af3a4d36669a850a4ee9ab17641dcd63d84406444566e8ebc7caa55b0620ab581039f36d19a90218a40f52ebbe525b37ed9493fb3f3  dav1d-1.0.0.tar.xz


=====================================
contrib/src/dav1d/rules.mak
=====================================
@@ -1,6 +1,6 @@
 # libdav1d
 
-DAV1D_VERSION := 0.9.2
+DAV1D_VERSION := 1.0.0
 DAV1D_URL := $(VIDEOLAN)/dav1d/$(DAV1D_VERSION)/dav1d-$(DAV1D_VERSION).tar.xz
 
 PKGS += dav1d
@@ -12,7 +12,7 @@ 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_URL),,$(DAV1D_HASH))
+#	$(call download_git,$(DAV1D_GITURL),,$(DAV1D_HASH))
 
 .sum-dav1d: dav1d-$(DAV1D_VERSION).tar.xz
 


=====================================
modules/codec/dav1d.c
=====================================
@@ -63,10 +63,16 @@ vlc_module_begin ()
     set_category(CAT_INPUT)
     set_subcategory(SUBCAT_INPUT_VCODEC)
 
+#if DAV1D_API_VERSION_MAJOR >= 6
+    add_integer_with_range("dav1d-thread-frames", 0, 0, DAV1D_MAX_THREADS,
+                THREAD_FRAMES_TEXT, THREAD_FRAMES_LONGTEXT, false)
+    add_obsolete_string("dav1d-thread-tiles") // unused with dav1d 1.0
+#else
     add_integer_with_range("dav1d-thread-frames", 0, 0, DAV1D_MAX_FRAME_THREADS,
                 THREAD_FRAMES_TEXT, THREAD_FRAMES_LONGTEXT, false)
     add_integer_with_range("dav1d-thread-tiles", 0, 0, DAV1D_MAX_TILE_THREADS,
                 THREAD_TILES_TEXT, THREAD_TILES_LONGTEXT, false)
+#endif
 vlc_module_end ()
 
 /*****************************************************************************
@@ -294,6 +300,32 @@ static int OpenDecoder(vlc_object_t *p_this)
         return VLC_ENOMEM;
 
     dav1d_default_settings(&p_sys->s);
+#if DAV1D_API_VERSION_MAJOR >= 6
+    p_sys->s.n_threads = var_InheritInteger(p_this, "dav1d-thread-frames");
+    if (p_sys->s.n_threads == 0)
+        p_sys->s.n_threads = (i_core_count < 16) ? i_core_count : 16;
+
+#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 =
@@ -303,6 +335,7 @@ static int OpenDecoder(vlc_object_t *p_this)
     p_sys->s.n_frame_threads = var_InheritInteger(p_this, "dav1d-thread-frames");
     if (p_sys->s.n_frame_threads == 0)
         p_sys->s.n_frame_threads = (i_core_count < 16) ? i_core_count : 16;
+#endif
     p_sys->s.allocator.cookie = dec;
     p_sys->s.allocator.alloc_picture_callback = NewPicture;
     p_sys->s.allocator.release_picture_callback = FreePicture;
@@ -313,12 +346,20 @@ static int OpenDecoder(vlc_object_t *p_this)
         return VLC_EGENERIC;
     }
 
+#if DAV1D_API_VERSION_MAJOR >= 6
+    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.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);
 
+    dec->i_extra_picture_buffers = (p_sys->s.n_frame_threads - 1);
+#endif
+
     dec->pf_decode = Decode;
     dec->pf_flush = FlushDecoder;
-    dec->i_extra_picture_buffers = (p_sys->s.n_frame_threads - 1);
 
     dec->fmt_out.video.i_width = dec->fmt_in.video.i_width;
     dec->fmt_out.video.i_height = dec->fmt_in.video.i_height;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f0b1ddca0dc575d34076d9062056ccb316f9a8c4...d38ddd7270ffaea705981b6a48086778850d3c96

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f0b1ddca0dc575d34076d9062056ccb316f9a8c4...d38ddd7270ffaea705981b6a48086778850d3c96
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