vulkan_decode: do not align single-plane images to subsampling

Unlike multiplane images, single-plane images do not need to be
aligned to chroma width.
Saves a bit of memory.
This commit is contained in:
Lynne committed 2026-01-19 16:37:16 +01:00
1 parent 8dcf02ac63
commit 713e3c4f91
1 file changed
+6 -5
+6 -5
View File
@@ -1150,7 +1150,10 @@ int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
if (err < 0)
return err;
frames_ctx->format = AV_PIX_FMT_VULKAN;
frames_ctx->sw_format = avctx->sw_pix_fmt;
frames_ctx->width = avctx->coded_width;
frames_ctx->height = avctx->coded_height;
if (!DECODER_IS_SDR(avctx->codec_id)) {
prof = av_mallocz(sizeof(FFVulkanDecodeProfileData));
@@ -1166,6 +1169,9 @@ int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
return err;
}
const AVPixFmtDescriptor *pdesc = av_pix_fmt_desc_get(frames_ctx->sw_format);
frames_ctx->width = FFALIGN(frames_ctx->width, 1 << pdesc->log2_chroma_w);
frames_ctx->height = FFALIGN(frames_ctx->height, 1 << pdesc->log2_chroma_h);
frames_ctx->user_opaque = prof;
frames_ctx->free = free_profile_data;
@@ -1211,11 +1217,6 @@ int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
}
}
const AVPixFmtDescriptor *pdesc = av_pix_fmt_desc_get(frames_ctx->sw_format);
frames_ctx->width = FFALIGN(avctx->coded_width, 1 << pdesc->log2_chroma_w);
frames_ctx->height = FFALIGN(avctx->coded_height, 1 << pdesc->log2_chroma_h);
frames_ctx->format = AV_PIX_FMT_VULKAN;
hwfc->tiling = VK_IMAGE_TILING_OPTIMAL;
hwfc->usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
VK_IMAGE_USAGE_STORAGE_BIT |