Skip to content

Commit

Permalink
* Fix Vulkan GPU acceleration for FFmpeg (pull #1497)
Browse files Browse the repository at this point in the history
  • Loading branch information
grill2010 authored May 2, 2024
1 parent 60ea8a5 commit 61dda4e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Fix Vulkan GPU acceleration for FFmpeg ([pull #1497](https://github.com/bytedeco/javacpp-presets/pull/1497))
* Build FFmpeg with zimg to enable zscale filter ([pull #1481](https://github.com/bytedeco/javacpp-presets/pull/1481))
* Enable PulseAudio support for FFmpeg on Linux ([pull #1472](https://github.com/bytedeco/javacpp-presets/pull/1472))
* Virtualize `btCollisionWorld`, `btOverlapFilterCallback`, `btOverlapCallback` from Bullet Physics SDK ([pull #1475](https://github.com/bytedeco/javacpp-presets/pull/1475))
Expand Down
1 change: 1 addition & 0 deletions ffmpeg/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export PKG_CONFIG_PATH=$INSTALL_PATH/lib/pkgconfig/
patch -Np1 -d $LAME < ../../lame.patch
patch -Np1 -d $OPENSSL < ../../openssl-android.patch
patch -Np1 -d ffmpeg-$FFMPEG_VERSION < ../../ffmpeg.patch
patch -Np1 -d ffmpeg-$FFMPEG_VERSION < ../../ffmpeg-vulkan.patch
# patch -Np1 -d ffmpeg-$FFMPEG_VERSION < ../../ffmpeg-flv-support-hevc-opus.patch
sedinplace 's/bool bEnableavx512/bool bEnableavx512 = false/g' x265-*/source/common/param.h
sedinplace 's/detect512()/false/g' x265-*/source/common/quant.cpp
Expand Down
14 changes: 14 additions & 0 deletions ffmpeg/ffmpeg-vulkan.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 67b9526255..e3c0c4c24a 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -605,6 +605,9 @@ int ff_vk_exec_add_dep_frame(FFVulkanContext *s, FFVkExecContext *e, AVFrame *f,
VkImageLayout *layout_dst;
uint32_t *queue_family_dst;
VkAccessFlagBits *access_dst;

+ if (!f || !f->hw_frames_ctx)
+ return 1;
+
AVHWFramesContext *hwfc = (AVHWFramesContext *)f->hw_frames_ctx->data;
AVVulkanFramesContext *vkfc = hwfc->hwctx;

0 comments on commit 61dda4e

Please sign in to comment.