[arch-commits] Commit in blender/trunk (D8355-ffmpeg43.patch PKGBUILD)

Sven-Hendrik Haase svenstaro at archlinux.org
Mon Jul 27 00:56:10 UTC 2020


    Date: Monday, July 27, 2020 @ 00:56:08
  Author: svenstaro
Revision: 665400

upgpkg: blender 17:2.83.3-3: Fix crash with FFMPEG 4.3 (FS#67402)

Added:
  blender/trunk/D8355-ffmpeg43.patch
Modified:
  blender/trunk/PKGBUILD

----------------------+
 D8355-ffmpeg43.patch |   35 +++++++++++++++++++++++++++++++++++
 PKGBUILD             |   24 +++++++++++++++---------
 2 files changed, 50 insertions(+), 9 deletions(-)

Added: D8355-ffmpeg43.patch
===================================================================
--- D8355-ffmpeg43.patch	                        (rev 0)
+++ D8355-ffmpeg43.patch	2020-07-27 00:56:08 UTC (rev 665400)
@@ -0,0 +1,35 @@
+diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
+--- a/source/blender/imbuf/intern/anim_movie.c
++++ b/source/blender/imbuf/intern/anim_movie.c
+@@ -1205,7 +1205,29 @@
+   }
+ 
+   IMB_freeImBuf(anim->last_frame);
+-  anim->last_frame = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect);
++
++  /* Certain versions of FFmpeg have a bug in libswscale which ends up in crash
++   * when destination buffer is not properly aligned. For example, this happens
++   * in FFmpeg 4.3.1. It got fixed later on, but for compatibility reasons is
++   * still best to avoid crash.
++   *
++   * This is achieved by using own allocation call rather than relying on
++   * IMB_allocImBuf() to do so since the IMB_allocImBuf() is not guaranteed
++   * to perform aligned allocation.
++   *
++   * In theory this could give better performance, since SIMD operations on
++   * aligned data are usually faster.
++   *
++   * Note that even though sometimes vertical flip is required it does not
++   * affect on alignment of data passed to sws_scale because if the X dimension
++   * is not 32 byte aligned special intermediate buffer is allocated.
++   *
++   * The issue was reported to FFmpeg under ticket #8747 in the FFmpeg tracker
++   * and is fixed in the newer versions than 4.3.1. */
++  anim->last_frame = IMB_allocImBuf(anim->x, anim->y, 32, 0);
++  anim->last_frame->rect = MEM_mallocN_aligned((size_t)4 * anim->x * anim->y, 32, "ffmpeg ibuf");
++  anim->last_frame->mall |= IB_rect;
++
+   anim->last_frame->rect_colorspace = colormanage_colorspace_get_named(anim->colorspace);
+ 
+   ffmpeg_postprocess(anim);
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-07-27 00:35:20 UTC (rev 665399)
+++ PKGBUILD	2020-07-27 00:56:08 UTC (rev 665400)
@@ -20,7 +20,7 @@
 pkgname=blender
 pkgver=2.83.3
 [[ -n $_gitcommit ]] && pkgver=${pkgver}.git1.${_gitcommit:0:8}
-pkgrel=2
+pkgrel=3
 epoch=17
 pkgdesc="A fully integrated 3D graphics creation suite"
 arch=('x86_64')
@@ -40,6 +40,7 @@
         "git://git.blender.org/blender-dev-tools.git"
         embree.patch
         D8063-cuda11.diff
+        D8355-ffmpeg43.patch
         https://developer.download.nvidia.com/redist/optix/v7.0/OptiX-7.0.0-include.zip)
 if [[ -n $_gittag ]]; then
     source+=("${pkgname}-${pkgver}::git://git.blender.org/blender.git#tag=${_gittag}")
@@ -52,6 +53,7 @@
             'SKIP'
             '6de779ad8649a034ee65c45a36d7838ac0b8b32c3336b4d476186265c060f56276e3e0a2860ec4bff42bef7d5582ee82238013845f6a697672767a05a455aaca'
             '7b0dc31c8babaaeed35807d27cc54e6e9fb79a08c4c267244bea2b47149e05089fe495f239fff7d4fff9b1ebcafd588396e8d1db5529dc7ac49d78731575e128'
+            '70e3bd8762c573cac4ec1d6772cdaab3ce6a248c26c78cbfe729d29058b3bf764305ee02525529955f292ad682883433ca20a91096ccb10d0cfe0148a67ee15f'
             'b2cff73def3757d4259f4b4d318a8ccfe166bf7c215cbb2124f1c81bd6e742f96207285b24eb4d99b527b7b97dc6d5e8fdf2f16d78d5d1e2684c26d681328491'
             'SKIP')
 
@@ -68,15 +70,19 @@
   patch -Np1 -i "$srcdir"/embree.patch
   patch -Np1 -i "$srcdir"/D8063-cuda11.diff
 
+  # Fix crash with ffmpeg 4.3 (https://bugs.archlinux.org/task/67402)
+  patch -Np1 -i "$srcdir"/D8355-ffmpeg43.patch
+
   mkdir build
 }
 
 build() {
-  cd "$srcdir/$pkgname-$pkgver"/build
+  cd "$srcdir/$pkgname-$pkgver"
 
-  cmake \
+  cmake . \
+    -Bbuild \
     -GNinja \
-    -C../build_files/cmake/config/blender_release.cmake .. \
+    -Cbuild_files/cmake/config/blender_release.cmake \
     -DOPTIX_ROOT_DIR="$srcdir"/include \
     -DWITH_CYCLES_EMBREE=ON \
     -DCMAKE_INSTALL_PREFIX=/usr \
@@ -87,16 +93,16 @@
     -DPYTHON_LIBPATH=/usr/lib \
     -DPYTHON_LIBRARY=python3.8 \
     -DPYTHON_INCLUDE_DIRS=/usr/include/python3.8
-  ninja
+  ninja -C build
 }
 
 package() {
-  cd "$srcdir/$pkgname-$pkgver/build"
+  cd "$srcdir/$pkgname-$pkgver"
 
-  DESTDIR="${pkgdir}" ninja install
-  install -Dm755 ../release/bin/blender-softwaregl "${pkgdir}/usr/bin/blender-softwaregl"
+  DESTDIR="${pkgdir}" ninja -C build install
+  install -Dm755 release/bin/blender-softwaregl "${pkgdir}/usr/bin/blender-softwaregl"
   python -m compileall "${pkgdir}/usr/share/blender"
   python -O -m compileall "${pkgdir}/usr/share/blender"
 
-  install -Dm644 ../release/freedesktop/org.blender.Blender.appdata.xml "${pkgdir}/usr/share/metainfo/org.blender.Blender.appdata.xml"
+  install -Dm644 release/freedesktop/org.blender.Blender.appdata.xml "${pkgdir}/usr/share/metainfo/org.blender.Blender.appdata.xml"
 }



More information about the arch-commits mailing list