diff --git a/libavcodec/vulkan/dpx_copy.comp b/libavcodec/vulkan/dpx_copy.comp index da0a11db93..4151fcb2b1 100644 --- a/libavcodec/vulkan/dpx_copy.comp +++ b/libavcodec/vulkan/dpx_copy.comp @@ -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++) diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index 3560d18324..de786ad808 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -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: diff --git a/libavcodec/vulkan_dpx.c b/libavcodec/vulkan_dpx.c index ab45ed935e..eaf131c383 100644 --- a/libavcodec/vulkan_dpx.c +++ b/libavcodec/vulkan_dpx.c @@ -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)