1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

vulkan/ffv1dec: fix FFVkSPIRVCompiler leak

This commit is contained in:
averne
2025-06-10 20:58:57 +02:00
committed by Lynne
parent f604d1093f
commit 9e93163268

View File

@ -1033,23 +1033,17 @@ static int vk_decode_ffv1_init(AVCodecContext *avctx)
/* Intermediate frame pool for RCT */ /* Intermediate frame pool for RCT */
for (int i = 0; i < 2; i++) { /* 16/32 bit */ for (int i = 0; i < 2; i++) { /* 16/32 bit */
err = init_indirect(avctx, &ctx->s, &fv->intermediate_frames_ref[i], RET(init_indirect(avctx, &ctx->s, &fv->intermediate_frames_ref[i],
i ? AV_PIX_FMT_GBRAP32 : AV_PIX_FMT_GBRAP16); i ? AV_PIX_FMT_GBRAP32 : AV_PIX_FMT_GBRAP16));
if (err < 0)
return err;
} }
/* Setup shader */ /* Setup shader */
err = init_setup_shader(f, &ctx->s, &ctx->exec_pool, spv, &fv->setup); RET(init_setup_shader(f, &ctx->s, &ctx->exec_pool, spv, &fv->setup));
if (err < 0)
return err;
/* Reset shaders */ /* Reset shaders */
for (int i = 0; i < 2; i++) { /* AC/Golomb */ for (int i = 0; i < 2; i++) { /* AC/Golomb */
err = init_reset_shader(f, &ctx->s, &ctx->exec_pool, RET(init_reset_shader(f, &ctx->s, &ctx->exec_pool,
spv, &fv->reset[i], !i ? AC_RANGE_CUSTOM_TAB : 0); spv, &fv->reset[i], !i ? AC_RANGE_CUSTOM_TAB : 0));
if (err < 0)
return err;
} }
/* Decode shaders */ /* Decode shaders */
@ -1059,39 +1053,31 @@ static int vk_decode_ffv1_init(AVCodecContext *avctx)
AVHWFramesContext *dec_frames_ctx; AVHWFramesContext *dec_frames_ctx;
dec_frames_ctx = k ? (AVHWFramesContext *)fv->intermediate_frames_ref[i]->data : dec_frames_ctx = k ? (AVHWFramesContext *)fv->intermediate_frames_ref[i]->data :
(AVHWFramesContext *)avctx->hw_frames_ctx->data; (AVHWFramesContext *)avctx->hw_frames_ctx->data;
err = init_decode_shader(f, &ctx->s, &ctx->exec_pool, RET(init_decode_shader(f, &ctx->s, &ctx->exec_pool,
spv, &fv->decode[i][j][k], spv, &fv->decode[i][j][k],
dec_frames_ctx, dec_frames_ctx,
(AVHWFramesContext *)avctx->hw_frames_ctx->data, (AVHWFramesContext *)avctx->hw_frames_ctx->data,
i, i,
!j ? AC_RANGE_CUSTOM_TAB : AC_GOLOMB_RICE, !j ? AC_RANGE_CUSTOM_TAB : AC_GOLOMB_RICE,
k); k));
if (err < 0)
return err;
} }
} }
} }
/* Range coder data */ /* Range coder data */
err = ff_ffv1_vk_init_state_transition_data(&ctx->s, RET(ff_ffv1_vk_init_state_transition_data(&ctx->s,
&fv->rangecoder_static_buf, &fv->rangecoder_static_buf,
f); f));
if (err < 0)
return err;
/* Quantization table data */ /* Quantization table data */
err = ff_ffv1_vk_init_quant_table_data(&ctx->s, RET(ff_ffv1_vk_init_quant_table_data(&ctx->s,
&fv->quant_buf, &fv->quant_buf,
f); f));
if (err < 0)
return err;
/* CRC table buffer */ /* CRC table buffer */
err = ff_ffv1_vk_init_crc_table_data(&ctx->s, RET(ff_ffv1_vk_init_crc_table_data(&ctx->s,
&fv->crc_tab_buf, &fv->crc_tab_buf,
f); f));
if (err < 0)
return err;
/* Update setup global descriptors */ /* Update setup global descriptors */
RET(ff_vk_shader_update_desc_buffer(&ctx->s, &ctx->exec_pool.contexts[0], RET(ff_vk_shader_update_desc_buffer(&ctx->s, &ctx->exec_pool.contexts[0],
@ -1124,6 +1110,8 @@ static int vk_decode_ffv1_init(AVCodecContext *avctx)
} }
fail: fail:
spv->uninit(&spv);
return err; return err;
} }