vulkan_dpx: fix GRAY16BE and big-endian marked 8-bit samples

This commit is contained in:
Lynne
2025-12-13 20:23:05 +01:00
parent c3291993eb
commit 5bb9cd23b7
3 changed files with 14 additions and 11 deletions

View File

@@ -33,7 +33,11 @@ void main(void)
if (!IS_WITHIN(pos, imageSize(dst[0])))
return;
uint offs = (pos.y*imageSize(dst[0]).x + pos.x)*COMPONENTS;
uint linesize;
linesize = align(imageSize(dst[0]).x*BITS_PER_COMP*COMPONENTS, 32);
linesize >>= BITS_LOG2;
uint offs = pos.y*linesize + pos.x*COMPONENTS;
#if NB_IMAGES == 1
TYPE_VEC val;
for (int i = 0; i < COMPONENTS; i++)

View File

@@ -1175,14 +1175,6 @@ int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
/* This should be more efficient for downloading and using */
frames_ctx->sw_format = AV_PIX_FMT_RGBA64;
break;
case AV_PIX_FMT_RGB48LE:
case AV_PIX_FMT_RGB48BE: /* DPX outputs RGB48BE, so we need both */
/* Almost nothing supports native 3-component RGB */
frames_ctx->sw_format = AV_PIX_FMT_GBRP16;
break;
case AV_PIX_FMT_RGBA64BE: /* DPX again, fix for little-endian systems */
frames_ctx->sw_format = AV_PIX_FMT_RGBA64;
break;
case AV_PIX_FMT_GBRP10:
/* This saves memory bandwidth when downloading */
frames_ctx->sw_format = AV_PIX_FMT_X2BGR10;
@@ -1192,7 +1184,13 @@ int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
/* mpv has issues with bgr0 mapping, so just remap it */
frames_ctx->sw_format = AV_PIX_FMT_RGB0;
break;
case AV_PIX_FMT_YUVA422P10: /* ProRes needs to clear the input image, which is not possible on YUV formats */
/* DPX endian mismatch remappings */
case AV_PIX_FMT_RGB48LE:
case AV_PIX_FMT_RGB48BE: frames_ctx->sw_format = AV_PIX_FMT_GBRP16; break;
case AV_PIX_FMT_RGBA64BE: frames_ctx->sw_format = AV_PIX_FMT_RGBA64; break;
case AV_PIX_FMT_GRAY16BE: frames_ctx->sw_format = AV_PIX_FMT_GRAY16; break;
/* ProRes needs to clear the input image, which is not possible on YUV formats */
case AV_PIX_FMT_YUVA422P10:
case AV_PIX_FMT_YUVA444P10:
case AV_PIX_FMT_YUVA422P12:
case AV_PIX_FMT_YUVA444P12:

View File

@@ -353,10 +353,11 @@ static int init_shader(AVCodecContext *avctx, FFVulkanContext *s,
};
RET(ff_vk_shader_add_descriptor_set(s, shd, desc_set, 2, 0, 0));
if (dpx->endian)
if (dpx->endian && bits > 8)
GLSLC(0, #define BIG_ENDIAN );
GLSLF(0, #define COMPONENTS (%i) ,dpx->components);
GLSLF(0, #define BITS_PER_COMP (%i) ,bits);
GLSLF(0, #define BITS_LOG2 (%i) ,av_log2(bits));
GLSLF(0, #define NB_IMAGES (%i) ,planes);
if (unpack) {
if (bits == 10)