Skip to content

Commit

Permalink
Add final Vulkan AV1 ext and VVC support
Browse files Browse the repository at this point in the history
Fixes #9464
  • Loading branch information
slouken committed Apr 15, 2024
1 parent 57a5b26 commit d51b53e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions test/testffmpeg.c
Expand Up @@ -46,17 +46,17 @@
#endif
#endif

#define DRM_FORMAT_MOD_VENDOR_NONE 0
#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1)
#define DRM_FORMAT_MOD_VENDOR_NONE 0
#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1)

#define fourcc_mod_get_vendor(modifier) \
(((modifier) >> 56) & 0xff)
(((modifier) >> 56) & 0xff)

#define fourcc_mod_is_vendor(modifier, vendor) \
(fourcc_mod_get_vendor(modifier) == DRM_FORMAT_MOD_VENDOR_## vendor)
(fourcc_mod_get_vendor(modifier) == DRM_FORMAT_MOD_VENDOR_## vendor)

#define fourcc_mod_code(vendor, val) \
((((Uint64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
((((Uint64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))

#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED)
#define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0)
Expand Down Expand Up @@ -478,6 +478,14 @@ static AVCodecContext *OpenVideoStream(AVFormatContext *ic, int stream, const AV
/* Allow supported hardware accelerated pixel formats */
context->get_format = GetSupportedPixelFormat;

if (codecpar->codec_id == AV_CODEC_ID_VVC) {
context->strict_std_compliance = -2;

/* Enable threaded decoding, VVC decode is slow */
context->thread_count = SDL_GetCPUCount();
context->thread_type = (FF_THREAD_FRAME | FF_THREAD_SLICE);
}

result = avcodec_open2(context, codec, NULL);
if (result < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open codec %s: %s", avcodec_get_name(context->codec_id), av_err2str(result));
Expand Down
2 changes: 1 addition & 1 deletion test/testffmpeg_vulkan.c
Expand Up @@ -561,7 +561,7 @@ static int createDevice(VulkanVideoContext *context)
VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME,
VK_KHR_VIDEO_DECODE_H264_EXTENSION_NAME,
VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME,
"VK_MESA_video_decode_av1"
VK_KHR_VIDEO_DECODE_AV1_EXTENSION_NAME
};
VkDeviceCreateInfo deviceCreateInfo = { 0 };
VkDeviceQueueCreateInfo *queueCreateInfos = NULL;
Expand Down

0 comments on commit d51b53e

Please sign in to comment.