| 163 | } |
| 164 | |
| 165 | static int vulkan_encode_ffv1_submit_frame(AVCodecContext *avctx, |
| 166 | FFVkExecContext *exec, |
| 167 | const AVFrame *pict) |
| 168 | { |
| 169 | int err; |
| 170 | VulkanEncodeFFv1Context *fv = avctx->priv_data; |
| 171 | FFV1Context *f = &fv->ctx; |
| 172 | FFVulkanFunctions *vk = &fv->s.vkfn; |
| 173 | |
| 174 | VulkanEncodeFFv1FrameData *fd = exec->opaque; |
| 175 | |
| 176 | /* Slice data */ |
| 177 | AVBufferRef *slice_data_ref; |
| 178 | FFVkBuffer *slice_data_buf; |
| 179 | uint32_t plane_state_size; |
| 180 | uint32_t slice_state_size; |
| 181 | uint32_t slice_data_size; |
| 182 | |
| 183 | /* Output data */ |
| 184 | size_t maxsize; |
| 185 | FFVkBuffer *out_data_buf; |
| 186 | |
| 187 | int has_inter = avctx->gop_size > 1; |
| 188 | uint32_t context_count = f->context_count[f->context_model]; |
| 189 | |
| 190 | VkImageMemoryBarrier2 img_bar[37]; |
| 191 | int nb_img_bar = 0; |
| 192 | VkBufferMemoryBarrier2 buf_bar[8]; |
| 193 | int nb_buf_bar = 0; |
| 194 | |
| 195 | /* Frame state */ |
| 196 | f->cur_enc_frame = pict; |
| 197 | if (avctx->gop_size == 0 || f->picture_number % avctx->gop_size == 0) { |
| 198 | av_buffer_unref(&fv->keyframe_slice_data_ref); |
| 199 | f->key_frame = fd->key_frame = 1; |
| 200 | f->gob_count++; |
| 201 | } else { |
| 202 | f->key_frame = fd->key_frame = 0; |
| 203 | } |
| 204 | |
| 205 | f->slice_count = f->max_slice_count; |
| 206 | |
| 207 | /* Allocate slice buffer data */ |
| 208 | if (f->ac == AC_GOLOMB_RICE) |
| 209 | plane_state_size = 8; |
| 210 | else |
| 211 | plane_state_size = CONTEXT_SIZE; |
| 212 | |
| 213 | plane_state_size *= context_count; |
| 214 | slice_state_size = plane_state_size*f->plane_count; |
| 215 | |
| 216 | slice_data_size = 256; /* Overestimation for the SliceContext struct */ |
| 217 | slice_state_size += slice_data_size; |
| 218 | slice_state_size = FFALIGN(slice_state_size, 8); |
| 219 | |
| 220 | /* Allocate slice data buffer */ |
| 221 | slice_data_ref = fv->keyframe_slice_data_ref; |
| 222 | if (!slice_data_ref) { |
no test coverage detected