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

Function init_sequence_headers

libavcodec/vulkan_encode_av1.c:739–792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

737}
738
739static av_cold int init_sequence_headers(AVCodecContext *avctx)
740{
741 VulkanEncodeAV1Context *enc = avctx->priv_data;
742 FFVulkanEncodeContext *ctx = &enc->common;
743 FFVulkanContext *s = &ctx->s;
744 FFHWBaseEncodeContext *base_ctx = &ctx->base;
745
746 AV1RawOBU *seq_obu = &enc->seq_hdr_obu;
747 AV1RawSequenceHeader *seq = &seq_obu->obu.sequence_header;
748
749 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->frames->sw_format);
750 if (!desc)
751 return AVERROR(EINVAL);
752
753 seq_obu->header.obu_type = AV1_OBU_SEQUENCE_HEADER;
754 *seq = (AV1RawSequenceHeader) {
755 .seq_profile = avctx->profile,
756 .seq_force_integer_mv = seq->seq_force_screen_content_tools ?
757 AV1_SELECT_SCREEN_CONTENT_TOOLS :
758 AV1_SELECT_INTEGER_MV,
759 .frame_width_bits_minus_1 = av_log2(base_ctx->surface_width),
760 .frame_height_bits_minus_1 = av_log2(base_ctx->surface_height),
761 .max_frame_width_minus_1 = base_ctx->surface_width - 1,
762 .max_frame_height_minus_1 = base_ctx->surface_height - 1,
763 .enable_order_hint = 1,
764 .order_hint_bits_minus_1 = av_clip_intp2(av_log2(ctx->base.gop_size), 3),
765 .use_128x128_superblock = !!(enc->caps.superblockSizes & VK_VIDEO_ENCODE_AV1_SUPERBLOCK_SIZE_128_BIT_KHR),
766 .color_config = (AV1RawColorConfig) {
767 .high_bitdepth = desc->comp[0].depth > 8,
768 .color_primaries = avctx->color_primaries,
769 .transfer_characteristics = avctx->color_trc,
770 .matrix_coefficients = avctx->colorspace,
771 .color_description_present_flag = (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
772 avctx->color_trc != AVCOL_TRC_UNSPECIFIED ||
773 avctx->colorspace != AVCOL_SPC_UNSPECIFIED),
774 .subsampling_x = desc->log2_chroma_w,
775 .subsampling_y = desc->log2_chroma_h,
776 .chroma_sample_position = avctx->chroma_sample_location == AVCHROMA_LOC_LEFT ?
777 AV1_CSP_VERTICAL :
778 avctx->chroma_sample_location == AVCHROMA_LOC_TOPLEFT ?
779 AV1_CSP_COLOCATED :
780 AV1_CSP_UNKNOWN,
781 },
782
783 /* Operating point */
784 .seq_tier = { enc->seq_tier },
785 .seq_level_idx = { enc->seq_level_idx },
786 .decoder_buffer_delay = { base_ctx->decode_delay },
787 .encoder_buffer_delay = { base_ctx->output_delay },
788 .operating_points_cnt_minus_1 = 1 - 1,
789 };
790
791 return 0;
792}
793
794typedef struct VulkanAV1Units {
795 StdVideoAV1SequenceHeader seq_hdr;

Callers 1

init_base_unitsFunction · 0.70

Calls 2

av_pix_fmt_desc_getFunction · 0.85
av_log2Function · 0.85

Tested by

no test coverage detected