mirror of
https://github.com/jellyfin/jellyfin-ffmpeg.git
synced 2026-09-02 21:03:08 +03:00
Update more backported vulkan fixes from upstream
Signed-off-by: nyanmisaka <nst799610810@gmail.com>
This commit is contained in:
@@ -152,6 +152,79 @@ Index: FFmpeg/libavcodec/vulkan_encode_av1.c
|
||||
===================================================================
|
||||
--- FFmpeg.orig/libavcodec/vulkan_encode_av1.c
|
||||
+++ FFmpeg/libavcodec/vulkan_encode_av1.c
|
||||
@@ -593,7 +593,6 @@ static int init_profile(AVCodecContext *
|
||||
FFVulkanEncodeContext *ctx = &enc->common;
|
||||
FFVulkanContext *s = &ctx->s;
|
||||
FFVulkanFunctions *vk = &ctx->s.vkfn;
|
||||
- FFHWBaseEncodeContext *base_ctx = &ctx->base;
|
||||
|
||||
VkVideoEncodeAV1CapabilitiesKHR av1_caps = {
|
||||
.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_AV1_CAPABILITIES_KHR,
|
||||
@@ -631,31 +630,6 @@ static int init_profile(AVCodecContext *
|
||||
};
|
||||
profile->pNext = &enc->profile;
|
||||
|
||||
- /* Set level */
|
||||
- if (avctx->level == AV_LEVEL_UNKNOWN) {
|
||||
- const AV1LevelDescriptor *level;
|
||||
- float framerate = 0.0;
|
||||
-
|
||||
- if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
|
||||
- framerate = av_q2d(avctx->framerate);
|
||||
-
|
||||
- level = ff_av1_guess_level(avctx->bit_rate, enc->seq_tier,
|
||||
- base_ctx->surface_width, base_ctx->surface_height,
|
||||
- enc->tile_rows * enc->tile_cols,
|
||||
- enc->tile_cols, framerate);
|
||||
- if (level) {
|
||||
- av_log(avctx, AV_LOG_VERBOSE, "Using level %s.\n", level->name);
|
||||
- enc->seq_level_idx = level->level_idx;
|
||||
- } else {
|
||||
- av_log(avctx, AV_LOG_VERBOSE, "Stream will not conform to "
|
||||
- "any normal level, using level 7.3 by default.\n");
|
||||
- enc->seq_level_idx = STD_VIDEO_AV1_LEVEL_7_3;
|
||||
- enc->seq_tier = 1;
|
||||
- }
|
||||
- } else {
|
||||
- enc->seq_level_idx = ff_vk_av1_level_to_vk(avctx->level);
|
||||
- }
|
||||
-
|
||||
/* User has explicitly specified a profile. */
|
||||
if (avctx->profile != AV_PROFILE_UNKNOWN)
|
||||
return 0;
|
||||
@@ -750,6 +724,32 @@ static av_cold int init_sequence_headers
|
||||
if (!desc)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
+ enc->seq_tier = enc->common.opts.tier;
|
||||
+
|
||||
+ if (avctx->level == AV_LEVEL_UNKNOWN) {
|
||||
+ const AV1LevelDescriptor *level;
|
||||
+ float framerate = 0.0;
|
||||
+
|
||||
+ if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
|
||||
+ framerate = av_q2d(avctx->framerate);
|
||||
+
|
||||
+ level = ff_av1_guess_level(avctx->bit_rate, enc->seq_tier,
|
||||
+ base_ctx->surface_width, base_ctx->surface_height,
|
||||
+ enc->tile_rows * enc->tile_cols,
|
||||
+ enc->tile_cols, framerate);
|
||||
+ if (level) {
|
||||
+ av_log(avctx, AV_LOG_VERBOSE, "Using level %s.\n", level->name);
|
||||
+ enc->seq_level_idx = level->level_idx;
|
||||
+ } else {
|
||||
+ av_log(avctx, AV_LOG_VERBOSE, "Stream will not conform to "
|
||||
+ "any normal level, using level 7.3 by default.\n");
|
||||
+ enc->seq_level_idx = STD_VIDEO_AV1_LEVEL_7_3;
|
||||
+ enc->seq_tier = 1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ enc->seq_level_idx = avctx->level;
|
||||
+ }
|
||||
+
|
||||
seq_obu->header.obu_type = AV1_OBU_SEQUENCE_HEADER;
|
||||
*seq = (AV1RawSequenceHeader) {
|
||||
.seq_profile = avctx->profile,
|
||||
@@ -1023,7 +1023,7 @@ static int init_base_units(AVCodecContex
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_ERROR, "Unable to get feedback for AV1 sequence header = %zu\n",
|
||||
@@ -198,7 +271,16 @@ Index: FFmpeg/libavcodec/vulkan_encode_av1.c
|
||||
}
|
||||
|
||||
static int vulkan_encode_av1_add_obu(AVCodecContext *avctx,
|
||||
@@ -1359,6 +1361,10 @@ static av_cold int vulkan_encode_av1_ini
|
||||
@@ -1229,6 +1231,8 @@ static av_cold int vulkan_encode_av1_ini
|
||||
|
||||
if (avctx->profile == AV_PROFILE_UNKNOWN)
|
||||
avctx->profile = enc->common.opts.profile;
|
||||
+ if (avctx->level == AV_LEVEL_UNKNOWN)
|
||||
+ avctx->level = enc->common.opts.level;
|
||||
|
||||
enc->caps = (VkVideoEncodeAV1CapabilitiesKHR) {
|
||||
.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_AV1_CAPABILITIES_KHR,
|
||||
@@ -1359,6 +1363,10 @@ static av_cold int vulkan_encode_av1_ini
|
||||
static av_cold int vulkan_encode_av1_close(AVCodecContext *avctx)
|
||||
{
|
||||
VulkanEncodeAV1Context *enc = avctx->priv_data;
|
||||
|
||||
Reference in New Issue
Block a user