MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / init_sequence_headers

Function init_sequence_headers

libavcodec/vulkan_encode_h265.c:727–817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

725}
726
727static av_cold int init_sequence_headers(AVCodecContext *avctx)
728{
729 int err;
730 VulkanEncodeH265Context *enc = avctx->priv_data;
731 FFVulkanEncodeContext *ctx = &enc->common;
732 FFHWBaseEncodeContext *base_ctx = &ctx->base;
733
734 FFHWBaseEncodeH265 *units = &enc->units;
735 FFHWBaseEncodeH265Opts *unit_opts = &enc->unit_opts;
736
737 int max_ctb_size;
738 unsigned min_tb_size;
739 unsigned max_tb_size;
740 unsigned max_transform_hierarchy;
741
742 unit_opts->tier = enc->common.opts.tier;
743 unit_opts->fixed_qp_idr = enc->fixed_qp_idr;
744 unit_opts->cu_qp_delta_enabled_flag = enc->common.opts.rc_mode != VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR;
745
746 unit_opts->nb_slices = 1;
747
748 unit_opts->slice_block_rows = (avctx->height + base_ctx->slice_block_height - 1) /
749 base_ctx->slice_block_height;
750 unit_opts->slice_block_cols = (avctx->width + base_ctx->slice_block_width - 1) /
751 base_ctx->slice_block_width;
752
753 /* cabac already set via an option */
754 /* fixed_qp_idr initialized in init_enc_options() */
755 /* hrd_buffer_size initialized in init_enc_options() */
756 /* initial_buffer_fullness initialized in init_enc_options() */
757
758 err = ff_hw_base_encode_init_params_h265(&enc->common.base, avctx,
759 units, unit_opts);
760 if (err < 0)
761 return err;
762
763 units->raw_sps.sample_adaptive_offset_enabled_flag =
764 !!(enc->caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H265_STD_SAMPLE_ADAPTIVE_OFFSET_ENABLED_FLAG_SET_BIT_KHR);
765 units->raw_pps.transform_skip_enabled_flag =
766 !!(enc->caps.stdSyntaxFlags & VK_VIDEO_ENCODE_H265_STD_TRANSFORM_SKIP_ENABLED_FLAG_SET_BIT_KHR);
767
768 max_ctb_size = 16;
769
770 /* coding blocks from 8x8 to max CTB size. */
771 if (enc->caps.ctbSizes & VK_VIDEO_ENCODE_H265_CTB_SIZE_64_BIT_KHR)
772 max_ctb_size = 64;
773 else if (enc->caps.ctbSizes & VK_VIDEO_ENCODE_H265_CTB_SIZE_32_BIT_KHR)
774 max_ctb_size = 32;
775
776 min_tb_size = 0;
777 max_tb_size = 0;
778 if (enc->caps.transformBlockSizes & VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_4_BIT_KHR)
779 min_tb_size = 4;
780 else if (enc->caps.transformBlockSizes & VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_8_BIT_KHR)
781 min_tb_size = 8;
782 else if (enc->caps.transformBlockSizes & VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_16_BIT_KHR)
783 min_tb_size = 16;
784 else if (enc->caps.transformBlockSizes & VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_32_BIT_KHR)

Callers 1

init_base_unitsFunction · 0.70

Calls 2

av_log2Function · 0.85

Tested by

no test coverage detected