mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-03-13 09:00:40 +08:00
ffv1enc_vulkan: make reset shader independent from the setup shader
Allows them to run in parallel.
This commit is contained in:
@@ -433,19 +433,21 @@ static int vulkan_encode_ffv1_submit_frame(AVCodecContext *avctx,
|
||||
nb_buf_bar = 0;
|
||||
|
||||
/* Run reset shader */
|
||||
ff_vk_shader_update_desc_buffer(&fv->s, exec, &fv->reset,
|
||||
1, 0, 0,
|
||||
slice_data_buf,
|
||||
0, slice_data_size*f->slice_count,
|
||||
VK_FORMAT_UNDEFINED);
|
||||
if (f->key_frame || fv->force_pcm) {
|
||||
ff_vk_shader_update_desc_buffer(&fv->s, exec, &fv->reset,
|
||||
1, 0, 0,
|
||||
slice_data_buf,
|
||||
0, slice_data_size*f->slice_count,
|
||||
VK_FORMAT_UNDEFINED);
|
||||
|
||||
ff_vk_exec_bind_shader(&fv->s, exec, &fv->reset);
|
||||
ff_vk_shader_update_push_const(&fv->s, exec, &fv->reset,
|
||||
VK_SHADER_STAGE_COMPUTE_BIT,
|
||||
0, sizeof(FFv1ShaderParams), &pd);
|
||||
ff_vk_exec_bind_shader(&fv->s, exec, &fv->reset);
|
||||
ff_vk_shader_update_push_const(&fv->s, exec, &fv->reset,
|
||||
VK_SHADER_STAGE_COMPUTE_BIT,
|
||||
0, sizeof(FFv1ShaderParams), &pd);
|
||||
|
||||
vk->CmdDispatch(exec->buf, fv->ctx.num_h_slices, fv->ctx.num_v_slices,
|
||||
f->plane_count);
|
||||
vk->CmdDispatch(exec->buf, fv->ctx.num_h_slices, fv->ctx.num_v_slices,
|
||||
f->plane_count);
|
||||
}
|
||||
|
||||
/* Sync between reset and encode shaders */
|
||||
ff_vk_buf_barrier(buf_bar[nb_buf_bar++], slice_data_buf,
|
||||
|
||||
@@ -55,7 +55,7 @@ const ivec2 chroma_shift = ivec2(chroma_shift_x, chroma_shift_y);
|
||||
/* Encoder-only */
|
||||
layout (constant_id = 15) const bool force_pcm = false;
|
||||
layout (constant_id = 16) const bool rct_search = false;
|
||||
layout (constant_id = 17) const bool context_model = false;
|
||||
layout (constant_id = 17) const uint context_model = 0;
|
||||
|
||||
layout (push_constant, scalar) uniform pushConstants {
|
||||
u8buf slice_data;
|
||||
|
||||
@@ -30,11 +30,7 @@ void main(void)
|
||||
{
|
||||
const uint slice_idx = gl_WorkGroupID.y*gl_NumWorkGroups.x + gl_WorkGroupID.x;
|
||||
|
||||
if (!key_frame && !slice_ctx[slice_idx].slice_reset_contexts)
|
||||
return;
|
||||
|
||||
const uint8_t qidx = slice_ctx[slice_idx].quant_table_idx[gl_WorkGroupID.z];
|
||||
uint contexts = context_count[qidx];
|
||||
uint contexts = context_count[context_model];
|
||||
uint64_t slice_state_off = uint64_t(slice_state) +
|
||||
slice_idx*plane_state_size*codec_planes;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user