| 401 | } |
| 402 | |
| 403 | static int init_idct_shader(AVCodecContext *avctx, FFVulkanContext *s, |
| 404 | FFVkExecPool *pool, FFVulkanShader *shd, |
| 405 | int max_num_mbs, int interlaced) |
| 406 | { |
| 407 | int err; |
| 408 | AVHWFramesContext *dec_frames_ctx; |
| 409 | dec_frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data; |
| 410 | |
| 411 | SPEC_LIST_CREATE(sl, 2 + 64, (2 + 64)*sizeof(uint32_t)) |
| 412 | SPEC_LIST_ADD(sl, 0, 32, interlaced); |
| 413 | SPEC_LIST_ADD(sl, 16, 32, 4*2); /* nb_blocks */ |
| 414 | |
| 415 | const double idct_8_scales[8] = { |
| 416 | cos(4.0*M_PI/16.0) / 2.0, cos(1.0*M_PI/16.0) / 2.0, |
| 417 | cos(2.0*M_PI/16.0) / 2.0, cos(3.0*M_PI/16.0) / 2.0, |
| 418 | cos(4.0*M_PI/16.0) / 2.0, cos(5.0*M_PI/16.0) / 2.0, |
| 419 | cos(6.0*M_PI/16.0) / 2.0, cos(7.0*M_PI/16.0) / 2.0, |
| 420 | }; |
| 421 | for (int i = 0; i < 64; i++) |
| 422 | SPEC_LIST_ADD(sl, 18 + i, 32, |
| 423 | av_float2int(idct_8_scales[i >> 3]*idct_8_scales[i & 7])); |
| 424 | |
| 425 | ff_vk_shader_load(shd, |
| 426 | VK_SHADER_STAGE_COMPUTE_BIT, sl, |
| 427 | (uint32_t []) { 32, 2, 1 }, 0); |
| 428 | |
| 429 | ff_vk_shader_add_push_const(shd, 0, sizeof(ProresVkParameters), |
| 430 | VK_SHADER_STAGE_COMPUTE_BIT); |
| 431 | |
| 432 | const FFVulkanDescriptorSetBinding desc_set[] = { |
| 433 | { /* quant_idx_buf */ |
| 434 | .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, |
| 435 | .stages = VK_SHADER_STAGE_COMPUTE_BIT, |
| 436 | }, |
| 437 | { /* qmat_buf */ |
| 438 | .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, |
| 439 | .stages = VK_SHADER_STAGE_COMPUTE_BIT, |
| 440 | }, |
| 441 | { /* dst */ |
| 442 | .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, |
| 443 | .stages = VK_SHADER_STAGE_COMPUTE_BIT, |
| 444 | .elems = av_pix_fmt_count_planes(dec_frames_ctx->sw_format), |
| 445 | }, |
| 446 | }; |
| 447 | RET(ff_vk_shader_add_descriptor_set(s, shd, desc_set, 3, 0, 0)); |
| 448 | |
| 449 | RET(ff_vk_shader_link(s, shd, |
| 450 | ff_prores_idct_comp_spv_data, |
| 451 | ff_prores_idct_comp_spv_len, "main")); |
| 452 | |
| 453 | RET(ff_vk_shader_register_exec(s, pool, shd)); |
| 454 | |
| 455 | fail: |
| 456 | return 0; |
| 457 | } |
| 458 | |
| 459 | static void vk_decode_prores_uninit(FFVulkanDecodeShared *ctx) |
| 460 | { |
no test coverage detected