22 #include <va/va_enc_hevc.h>
89 char *
data,
size_t *data_len,
103 "%zu < %zu.\n", *data_len,
125 "type = %d.\n",
header->nal_unit_type);
133 char *
data,
size_t *data_len)
167 char *
data,
size_t *data_len)
193 char *
data,
size_t *data_len)
231 *
type = VAEncPackedHeaderRawData;
251 VAEncSequenceParameterBufferHEVC *vseq =
ctx->codec_sequence_params;
252 VAEncPictureParameterBufferHEVC *vpic =
ctx->codec_picture_params;
257 memset(
vps, 0,
sizeof(*
vps));
258 memset(
sps, 0,
sizeof(*
sps));
259 memset(
pps, 0,
sizeof(*
pps));
264 if (
desc->nb_components == 1) {
267 if (
desc->log2_chroma_w == 1 &&
desc->log2_chroma_h == 1) {
269 }
else if (
desc->log2_chroma_w == 1 &&
desc->log2_chroma_h == 0) {
271 }
else if (
desc->log2_chroma_w == 0 &&
desc->log2_chroma_h == 0) {
275 "%s is not supported.\n",
desc->name);
287 .nuh_temporal_id_plus1 = 1,
290 vps->vps_video_parameter_set_id = 0;
292 vps->vps_base_layer_internal_flag = 1;
293 vps->vps_base_layer_available_flag = 1;
294 vps->vps_max_layers_minus1 = 0;
295 vps->vps_max_sub_layers_minus1 = 0;
296 vps->vps_temporal_id_nesting_flag = 1;
302 if (chroma_format == 1) {
331 ctx->surface_width,
ctx->surface_height,
332 ctx->nb_slices,
ctx->tile_rows,
ctx->tile_cols,
333 (
ctx->b_per_p > 0) + 1);
339 "any normal level; using level 8.5.\n");
346 vps->vps_sub_layer_ordering_info_present_flag = 0;
347 vps->vps_max_dec_pic_buffering_minus1[0] =
ctx->max_b_depth + 1;
348 vps->vps_max_num_reorder_pics[0] =
ctx->max_b_depth;
349 vps->vps_max_latency_increase_plus1[0] = 0;
351 vps->vps_max_layer_id = 0;
352 vps->vps_num_layer_sets_minus1 = 0;
353 vps->layer_id_included_flag[0][0] = 1;
355 vps->vps_timing_info_present_flag = 1;
359 vps->vps_poc_proportional_to_timing_flag = 1;
360 vps->vps_num_ticks_poc_diff_one_minus1 = 0;
364 vps->vps_poc_proportional_to_timing_flag = 0;
366 vps->vps_num_hrd_parameters = 0;
374 .nuh_temporal_id_plus1 = 1,
377 sps->sps_video_parameter_set_id =
vps->vps_video_parameter_set_id;
379 sps->sps_max_sub_layers_minus1 =
vps->vps_max_sub_layers_minus1;
380 sps->sps_temporal_id_nesting_flag =
vps->vps_temporal_id_nesting_flag;
382 sps->profile_tier_level =
vps->profile_tier_level;
384 sps->sps_seq_parameter_set_id = 0;
386 sps->chroma_format_idc = chroma_format;
387 sps->separate_colour_plane_flag = 0;
389 sps->pic_width_in_luma_samples =
ctx->surface_width;
390 sps->pic_height_in_luma_samples =
ctx->surface_height;
392 if (avctx->
width !=
ctx->surface_width ||
394 sps->conformance_window_flag = 1;
395 sps->conf_win_left_offset = 0;
396 sps->conf_win_right_offset =
397 (
ctx->surface_width - avctx->
width) >>
desc->log2_chroma_w;
398 sps->conf_win_top_offset = 0;
399 sps->conf_win_bottom_offset =
400 (
ctx->surface_height - avctx->
height) >>
desc->log2_chroma_h;
402 sps->conformance_window_flag = 0;
408 sps->log2_max_pic_order_cnt_lsb_minus4 = 8;
410 sps->sps_sub_layer_ordering_info_present_flag =
411 vps->vps_sub_layer_ordering_info_present_flag;
412 for (
i = 0;
i <=
sps->sps_max_sub_layers_minus1;
i++) {
413 sps->sps_max_dec_pic_buffering_minus1[
i] =
414 vps->vps_max_dec_pic_buffering_minus1[
i];
415 sps->sps_max_num_reorder_pics[
i] =
416 vps->vps_max_num_reorder_pics[
i];
417 sps->sps_max_latency_increase_plus1[
i] =
418 vps->vps_max_latency_increase_plus1[
i];
425 sps->log2_min_luma_coding_block_size_minus3 = 0;
426 sps->log2_diff_max_min_luma_coding_block_size = 2;
428 sps->log2_min_luma_transform_block_size_minus2 = 0;
429 sps->log2_diff_max_min_luma_transform_block_size = 3;
431 sps->max_transform_hierarchy_depth_inter = 3;
432 sps->max_transform_hierarchy_depth_intra = 3;
434 sps->amp_enabled_flag = 1;
436 sps->sample_adaptive_offset_enabled_flag = 0;
437 sps->sps_temporal_mvp_enabled_flag = 0;
439 sps->pcm_enabled_flag = 0;
444 sps->num_short_term_ref_pic_sets = 0;
445 sps->long_term_ref_pics_present_flag = 0;
447 sps->vui_parameters_present_flag = 1;
453 { 1, 1 }, { 12, 11 }, { 10, 11 }, { 16, 11 },
454 { 40, 33 }, { 24, 11 }, { 20, 11 }, { 32, 11 },
455 { 80, 33 }, { 18, 11 }, { 15, 11 }, { 64, 33 },
456 { 160, 99 }, { 4, 3 }, { 3, 2 }, { 2, 1 },
462 if (num == sar_idc[
i].num &&
463 den == sar_idc[
i].den) {
519 .nuh_temporal_id_plus1 = 1,
522 pps->pps_pic_parameter_set_id = 0;
523 pps->pps_seq_parameter_set_id =
sps->sps_seq_parameter_set_id;
525 pps->num_ref_idx_l0_default_active_minus1 = 0;
526 pps->num_ref_idx_l1_default_active_minus1 = 0;
530 pps->cu_qp_delta_enabled_flag = (
ctx->va_rc_mode != VA_RC_CQP);
531 pps->diff_cu_qp_delta_depth = 0;
533 if (
ctx->tile_rows &&
ctx->tile_cols) {
536 pps->tiles_enabled_flag = 1;
537 pps->num_tile_columns_minus1 =
ctx->tile_cols - 1;
538 pps->num_tile_rows_minus1 =
ctx->tile_rows - 1;
543 for (
i = 0;
i <=
pps->num_tile_columns_minus1 &&
544 uniform_spacing;
i++) {
545 if (
ctx->col_width[
i] !=
546 (
i + 1) *
ctx->slice_block_cols /
ctx->tile_cols -
547 i *
ctx->slice_block_cols /
ctx->tile_cols)
550 for (
i = 0;
i <=
pps->num_tile_rows_minus1 &&
551 uniform_spacing;
i++) {
552 if (
ctx->row_height[
i] !=
553 (
i + 1) *
ctx->slice_block_rows /
ctx->tile_rows -
554 i *
ctx->slice_block_rows /
ctx->tile_rows)
557 pps->uniform_spacing_flag = uniform_spacing;
559 for (
i = 0;
i <=
pps->num_tile_columns_minus1;
i++)
560 pps->column_width_minus1[
i] =
ctx->col_width[
i] - 1;
561 for (
i = 0;
i <=
pps->num_tile_rows_minus1;
i++)
562 pps->row_height_minus1[
i] =
ctx->row_height[
i] - 1;
564 pps->loop_filter_across_tiles_enabled_flag = 1;
567 pps->pps_loop_filter_across_slices_enabled_flag = 1;
571 *vseq = (VAEncSequenceParameterBufferHEVC) {
572 .general_profile_idc =
vps->profile_tier_level.general_profile_idc,
573 .general_level_idc =
vps->profile_tier_level.general_level_idc,
574 .general_tier_flag =
vps->profile_tier_level.general_tier_flag,
576 .intra_period =
ctx->gop_size,
577 .intra_idr_period =
ctx->gop_size,
578 .ip_period =
ctx->b_per_p + 1,
579 .bits_per_second =
ctx->va_bit_rate,
581 .pic_width_in_luma_samples =
sps->pic_width_in_luma_samples,
582 .pic_height_in_luma_samples =
sps->pic_height_in_luma_samples,
585 .chroma_format_idc =
sps->chroma_format_idc,
586 .separate_colour_plane_flag =
sps->separate_colour_plane_flag,
587 .bit_depth_luma_minus8 =
sps->bit_depth_luma_minus8,
588 .bit_depth_chroma_minus8 =
sps->bit_depth_chroma_minus8,
589 .scaling_list_enabled_flag =
sps->scaling_list_enabled_flag,
590 .strong_intra_smoothing_enabled_flag =
591 sps->strong_intra_smoothing_enabled_flag,
592 .amp_enabled_flag =
sps->amp_enabled_flag,
593 .sample_adaptive_offset_enabled_flag =
594 sps->sample_adaptive_offset_enabled_flag,
595 .pcm_enabled_flag =
sps->pcm_enabled_flag,
596 .pcm_loop_filter_disabled_flag =
sps->pcm_loop_filter_disabled_flag,
597 .sps_temporal_mvp_enabled_flag =
sps->sps_temporal_mvp_enabled_flag,
600 .log2_min_luma_coding_block_size_minus3 =
601 sps->log2_min_luma_coding_block_size_minus3,
602 .log2_diff_max_min_luma_coding_block_size =
603 sps->log2_diff_max_min_luma_coding_block_size,
604 .log2_min_transform_block_size_minus2 =
605 sps->log2_min_luma_transform_block_size_minus2,
606 .log2_diff_max_min_transform_block_size =
607 sps->log2_diff_max_min_luma_transform_block_size,
608 .max_transform_hierarchy_depth_inter =
609 sps->max_transform_hierarchy_depth_inter,
610 .max_transform_hierarchy_depth_intra =
611 sps->max_transform_hierarchy_depth_intra,
613 .pcm_sample_bit_depth_luma_minus1 =
614 sps->pcm_sample_bit_depth_luma_minus1,
615 .pcm_sample_bit_depth_chroma_minus1 =
616 sps->pcm_sample_bit_depth_chroma_minus1,
617 .log2_min_pcm_luma_coding_block_size_minus3 =
618 sps->log2_min_pcm_luma_coding_block_size_minus3,
619 .log2_max_pcm_luma_coding_block_size_minus3 =
620 sps->log2_min_pcm_luma_coding_block_size_minus3 +
621 sps->log2_diff_max_min_pcm_luma_coding_block_size,
623 .vui_parameters_present_flag = 0,
626 *vpic = (VAEncPictureParameterBufferHEVC) {
627 .decoded_curr_pic = {
628 .picture_id = VA_INVALID_ID,
629 .flags = VA_PICTURE_HEVC_INVALID,
632 .coded_buf = VA_INVALID_ID,
634 .collocated_ref_pic_index = 0xff,
638 .pic_init_qp =
pps->init_qp_minus26 + 26,
639 .diff_cu_qp_delta_depth =
pps->diff_cu_qp_delta_depth,
640 .pps_cb_qp_offset =
pps->pps_cb_qp_offset,
641 .pps_cr_qp_offset =
pps->pps_cr_qp_offset,
643 .num_tile_columns_minus1 =
pps->num_tile_columns_minus1,
644 .num_tile_rows_minus1 =
pps->num_tile_rows_minus1,
646 .log2_parallel_merge_level_minus2 =
pps->log2_parallel_merge_level_minus2,
647 .ctu_max_bitsize_allowed = 0,
649 .num_ref_idx_l0_default_active_minus1 =
650 pps->num_ref_idx_l0_default_active_minus1,
651 .num_ref_idx_l1_default_active_minus1 =
652 pps->num_ref_idx_l1_default_active_minus1,
654 .slice_pic_parameter_set_id =
pps->pps_pic_parameter_set_id,
657 .sign_data_hiding_enabled_flag =
pps->sign_data_hiding_enabled_flag,
658 .constrained_intra_pred_flag =
pps->constrained_intra_pred_flag,
659 .transform_skip_enabled_flag =
pps->transform_skip_enabled_flag,
660 .cu_qp_delta_enabled_flag =
pps->cu_qp_delta_enabled_flag,
661 .weighted_pred_flag =
pps->weighted_pred_flag,
662 .weighted_bipred_flag =
pps->weighted_bipred_flag,
663 .transquant_bypass_enabled_flag =
pps->transquant_bypass_enabled_flag,
664 .tiles_enabled_flag =
pps->tiles_enabled_flag,
665 .entropy_coding_sync_enabled_flag =
pps->entropy_coding_sync_enabled_flag,
666 .loop_filter_across_tiles_enabled_flag =
667 pps->loop_filter_across_tiles_enabled_flag,
668 .scaling_list_data_present_flag = (
sps->sps_scaling_list_data_present_flag |
669 pps->pps_scaling_list_data_present_flag),
670 .screen_content_flag = 0,
671 .enable_gpu_weighted_prediction = 0,
672 .no_output_of_prior_pics_flag = 0,
676 if (
pps->tiles_enabled_flag) {
677 for (
i = 0;
i <= vpic->num_tile_rows_minus1;
i++)
678 vpic->row_height_minus1[
i] =
pps->row_height_minus1[
i];
679 for (
i = 0;
i <= vpic->num_tile_columns_minus1;
i++)
680 vpic->column_width_minus1[
i] =
pps->column_width_minus1[
i];
721 for (irap_ref = pic; irap_ref; irap_ref = irap_ref->
refs[1]) {
744 .nuh_temporal_id_plus1 = 1,
771 const int mapping[3] = {1, 2, 0};
772 const int chroma_den = 50000;
773 const int luma_den = 10000;
775 for (
i = 0;
i < 3;
i++) {
776 const int j = mapping[
i];
818 clli->max_pic_average_light_level =
FFMIN(clm->
MaxFALL, 65535);
824 vpic->decoded_curr_pic = (VAPictureHEVC) {
835 href =
ref->priv_data;
837 vpic->reference_frames[
i] = (VAPictureHEVC) {
838 .picture_id =
ref->recon_surface,
841 VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE : 0) |
843 VA_PICTURE_HEVC_RPS_ST_CURR_AFTER : 0),
847 vpic->reference_frames[
i] = (VAPictureHEVC) {
848 .picture_id = VA_INVALID_ID,
849 .flags = VA_PICTURE_HEVC_INVALID,
859 vpic->pic_fields.bits.idr_pic_flag = 1;
860 vpic->pic_fields.bits.coding_type = 1;
861 vpic->pic_fields.bits.reference_pic_flag = 1;
864 vpic->pic_fields.bits.idr_pic_flag = 0;
865 vpic->pic_fields.bits.coding_type = 1;
866 vpic->pic_fields.bits.reference_pic_flag = 1;
869 vpic->pic_fields.bits.idr_pic_flag = 0;
870 vpic->pic_fields.bits.coding_type = 2;
871 vpic->pic_fields.bits.reference_pic_flag = 1;
874 vpic->pic_fields.bits.idr_pic_flag = 0;
875 vpic->pic_fields.bits.coding_type = 3;
876 vpic->pic_fields.bits.reference_pic_flag = 0;
901 .nuh_temporal_id_plus1 = 1,
912 (1 << (
sps->log2_max_pic_order_cnt_lsb_minus4 + 4)) - 1;
919 int i, j, poc, rps_pics;
924 memset(rps, 0,
sizeof(*rps));
930 rps_used[rps_pics] = 1;
934 if (pic->
dpb[
i] == pic)
936 for (j = 0; j < pic->
nb_refs; j++) {
940 if (j < pic->nb_refs)
944 rps_used[rps_pics] = 0;
948 for (
i = 1;
i < rps_pics;
i++) {
949 for (j =
i; j > 0; j--) {
950 if (rps_poc[j] > rps_poc[j - 1])
953 FFSWAP(
int, rps_poc[j], rps_poc[j - 1]);
954 FFSWAP(
int, rps_used[j], rps_used[j - 1]);
960 for (
i = 0;
i < rps_pics;
i++) {
962 rps_poc[
i], rps_used[
i]);
966 for (
i = 0;
i < rps_pics;
i++) {
974 for (j =
i - 1; j >= 0; j--) {
982 for (j =
i; j < rps_pics; j++) {
992 sps->sps_temporal_mvp_enabled_flag;
1004 sps->sample_adaptive_offset_enabled_flag;
1014 *vslice = (VAEncSliceParameterBufferHEVC) {
1036 .slice_fields.bits = {
1040 .slice_temporal_mvp_enabled_flag =
1044 .num_ref_idx_active_override_flag =
1048 .slice_deblocking_filter_disabled_flag =
1050 .slice_loop_filter_across_slices_enabled_flag =
1057 vslice->ref_pic_list0[
i].picture_id = VA_INVALID_ID;
1058 vslice->ref_pic_list0[
i].flags = VA_PICTURE_HEVC_INVALID;
1059 vslice->ref_pic_list1[
i].picture_id = VA_INVALID_ID;
1060 vslice->ref_pic_list1[
i].flags = VA_PICTURE_HEVC_INVALID;
1068 vslice->ref_pic_list0[0] = vpic->reference_frames[0];
1073 vslice->ref_pic_list1[0] = vpic->reference_frames[1];
1089 if (
ctx->va_rc_mode == VA_RC_CQP) {
1109 "%d / %d / %d for IDR- / P- / B-frames.\n",
1119 ctx->roi_quant_range = 51 + 6 * (
ctx->profile->depth - 8);
1127 #if VA_CHECK_VERSION(0, 37, 0)
1131 #if VA_CHECK_VERSION(1, 2, 0)
1146 .default_quality = 25,
1152 .sequence_params_size =
sizeof(VAEncSequenceParameterBufferHEVC),
1155 .picture_params_size =
sizeof(VAEncPictureParameterBufferHEVC),
1158 .slice_params_size =
sizeof(VAEncSliceParameterBufferHEVC),
1161 .sequence_header_type = VAEncPackedHeaderSequence,
1164 .slice_header_type = VAEncPackedHeaderHEVC_Slice,
1184 "in 8-bit unsigned integer.\n", avctx->
level);
1188 ctx->desired_packed_headers =
1189 VA_ENC_PACKED_HEADER_SEQUENCE |
1190 VA_ENC_PACKED_HEADER_SLICE |
1191 VA_ENC_PACKED_HEADER_MISC;
1197 ctx->slice_block_width =
ctx->slice_block_height = 32;
1200 ctx->explicit_qp = priv->
qp;
1215 #define OFFSET(x) offsetof(VAAPIEncodeH265Context, x)
1216 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
1221 {
"qp",
"Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
1224 {
"aud",
"Include AUD",
1227 {
"profile",
"Set profile (general_profile_idc)",
1231 #define PROFILE(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
1232 { .i64 = value }, 0, 0, FLAGS, "profile"
1238 {
"tier",
"Set tier (general_tier_flag)",
1240 { .i64 = 0 }, 0, 1,
FLAGS,
"tier" },
1242 { .i64 = 0 }, 0, 0,
FLAGS,
"tier" },
1244 { .i64 = 1 }, 0, 0,
FLAGS,
"tier" },
1246 {
"level",
"Set level (general_level_idc)",
1250 #define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
1251 { .i64 = value }, 0, 0, FLAGS, "level"
1254 {
LEVEL(
"2.1", 63) },
1256 {
LEVEL(
"3.1", 93) },
1257 {
LEVEL(
"4", 120) },
1258 {
LEVEL(
"4.1", 123) },
1259 {
LEVEL(
"5", 150) },
1260 {
LEVEL(
"5.1", 153) },
1261 {
LEVEL(
"5.2", 156) },
1262 {
LEVEL(
"6", 180) },
1263 {
LEVEL(
"6.1", 183) },
1264 {
LEVEL(
"6.2", 186) },
1267 {
"sei",
"Set SEI to include",
1270 0, INT_MAX,
FLAGS,
"sei" },
1272 "Include HDR metadata for mastering display colour volume "
1273 "and content light level information",
1276 INT_MIN, INT_MAX,
FLAGS,
"sei" },
1278 {
"tiles",
"Tile columns x rows",
1289 {
"i_qfactor",
"1" },
1290 {
"i_qoffset",
"0" },
1291 {
"b_qfactor",
"6/5" },
1292 {
"b_qoffset",
"0" },
1306 .
name =
"hevc_vaapi",
1324 .wrapper_name =
"vaapi",
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
static const AVCodecDefault defaults[]
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
#define FF_PROFILE_UNKNOWN
#define FF_PROFILE_HEVC_MAIN_10
#define FF_PROFILE_HEVC_REXT
#define FF_PROFILE_HEVC_MAIN
static av_cold int init(AVCodecContext *avctx)
void ff_cbs_close(CodedBitstreamContext **ctx_ptr)
Close a context and free all internal state.
int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag, int position, CodedBitstreamUnitType type, void *content, AVBufferRef *content_buf)
Insert a new unit into a fragment with the given content.
void ff_cbs_fragment_reset(CodedBitstreamFragment *frag)
Free the units contained in a fragment as well as the fragment's own data buffer, but not the units a...
int ff_cbs_write_fragment_data(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Write the content of the fragment to its own internal buffer.
int ff_cbs_init(CodedBitstreamContext **ctx_ptr, enum AVCodecID codec_id, void *log_ctx)
Create and initialise a new context for the given codec.
void ff_cbs_fragment_free(CodedBitstreamFragment *frag)
Free the units array of a fragment in addition to what ff_cbs_fragment_reset does.
static int FUNC() pps(CodedBitstreamContext *ctx, RWContext *rw, H264RawPPS *current)
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
static int FUNC() sei(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEI *current)
static int FUNC() aud(CodedBitstreamContext *ctx, RWContext *rw, H264RawAUD *current)
static int FUNC() vps(CodedBitstreamContext *ctx, RWContext *rw, H265RawVPS *current)
int ff_cbs_sei_add_message(CodedBitstreamContext *ctx, CodedBitstreamFragment *au, int prefix, uint32_t payload_type, void *payload_data, AVBufferRef *payload_buf)
Add an SEI message to an access unit.
common internal and external API header
#define FFSWAP(type, a, b)
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
#define AVERROR_EOF
End of file.
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
@ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
#define LIBAVUTIL_VERSION_INT
const H265RawProfileTierLevel * ptl
const H265LevelDescriptor * ff_h265_guess_level(const H265RawProfileTierLevel *ptl, int64_t bitrate, int width, int height, int slice_segments, int tile_rows, int tile_cols, int max_dec_pic_buffering)
Guess the level of a stream from some parameters.
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
@ AVCHROMA_LOC_UNSPECIFIED
@ AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_JPEG
Full range content.
AVPixelFormat
Pixel format.
static const uint8_t header[24]
@ SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO
@ SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME
#define FF_ARRAY_ELEMS(a)
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
main external API structure.
int width
picture width / height.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
float b_quant_offset
qscale offset between IP and B-frames
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
float b_quant_factor
qscale factor between IP and B-frames If > 0 then the last P-frame quantizer will be used (q= lastp_q...
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
int64_t bit_rate
the average bitrate
enum AVColorSpace colorspace
YUV colorspace type.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
float i_quant_factor
qscale factor between P- and I-frames If > 0 then the last P-frame quantizer will be used (q = lastp_...
float i_quant_offset
qscale offset between P and I-frames
const char * name
Name of the codec implementation.
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
unsigned MaxFALL
Max average light level per frame (cd/m^2).
unsigned MaxCLL
Max content light level (cd/m^2).
Structure to hold side data for an AVFrame.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Rational number (pair of numerator and denominator).
Context structure for coded bitstream operations.
Coded bitstream fragment structure, combining one or more units.
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
size_t data_size
The number of bytes in the bitstream.
uint8_t * data
Pointer to the bitstream form of this fragment.
H265RawNALUnitHeader nal_unit_header
uint8_t general_level_idc
uint8_t general_profile_compatibility_flag[32]
uint8_t general_max_420chroma_constraint_flag
uint8_t general_max_8bit_constraint_flag
uint8_t general_tier_flag
uint8_t general_interlaced_source_flag
uint8_t general_intra_constraint_flag
uint8_t general_progressive_source_flag
uint8_t general_max_monochrome_constraint_flag
uint8_t general_profile_space
uint8_t general_max_422chroma_constraint_flag
uint8_t general_lower_bit_rate_constraint_flag
uint8_t general_frame_only_constraint_flag
uint8_t general_max_12bit_constraint_flag
uint8_t general_profile_idc
uint8_t general_non_packed_constraint_flag
uint8_t general_max_10bit_constraint_flag
uint8_t num_positive_pics
uint16_t delta_poc_s0_minus1[HEVC_MAX_REFS]
uint8_t num_negative_pics
uint8_t used_by_curr_pic_s0_flag[HEVC_MAX_REFS]
uint16_t delta_poc_s1_minus1[HEVC_MAX_REFS]
uint8_t used_by_curr_pic_s1_flag[HEVC_MAX_REFS]
H265RawSliceHeader header
uint8_t chroma_loc_info_present_flag
uint8_t chroma_sample_loc_type_bottom_field
uint8_t log2_max_mv_length_horizontal
uint8_t transfer_characteristics
uint8_t motion_vectors_over_pic_boundaries_flag
uint8_t video_signal_type_present_flag
uint8_t vui_timing_info_present_flag
uint8_t max_bytes_per_pic_denom
uint8_t colour_description_present_flag
uint8_t max_bits_per_min_cu_denom
uint8_t aspect_ratio_info_present_flag
uint8_t restricted_ref_pic_lists_flag
uint8_t log2_max_mv_length_vertical
uint8_t vui_poc_proportional_to_timing_flag
uint8_t vui_hrd_parameters_present_flag
uint32_t vui_num_ticks_poc_diff_one_minus1
uint8_t chroma_sample_loc_type_top_field
uint32_t vui_num_units_in_tick
uint8_t matrix_coefficients
uint8_t bitstream_restriction_flag
uint8_t video_full_range_flag
uint16_t max_content_light_level
uint16_t display_primaries_x[3]
uint16_t display_primaries_y[3]
uint32_t max_display_mastering_luminance
uint32_t min_display_mastering_luminance
AVHWFramesContext * input_frames
SEIRawMasteringDisplayColourVolume sei_mastering_display
VAAPIEncodeContext common
SEIRawContentLightLevelInfo sei_content_light_level
CodedBitstreamFragment current_access_unit
CodedBitstreamContext * cbc
void * codec_picture_params
struct VAAPIEncodePicture * refs[MAX_PICTURE_REFERENCES]
VASurfaceID recon_surface
struct VAAPIEncodePicture * dpb[MAX_DPB_SIZE]
struct VAAPIEncodePicture * prev
void * codec_slice_params
const VAAPIEncodeProfile * profiles
static int ref[MAX_W *MAX_W]
#define VAAPI_ENCODE_COMMON_OPTIONS
#define VAAPI_ENCODE_RC_OPTIONS
@ FLAG_NON_IDR_KEY_PICTURES
@ FLAG_B_PICTURE_REFERENCES
static int vaapi_encode_h265_write_slice_header(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice, char *data, size_t *data_len)
static int vaapi_encode_h265_write_sequence_header(AVCodecContext *avctx, char *data, size_t *data_len)
static av_cold int vaapi_encode_h265_init(AVCodecContext *avctx)
static const VAAPIEncodeType vaapi_encode_type_h265
static int vaapi_encode_h265_write_access_unit(AVCodecContext *avctx, char *data, size_t *data_len, CodedBitstreamFragment *au)
static av_cold int vaapi_encode_h265_close(AVCodecContext *avctx)
AVCodec ff_hevc_vaapi_encoder
static int vaapi_encode_h265_add_nal(AVCodecContext *avctx, CodedBitstreamFragment *au, void *nal_unit)
#define LEVEL(name, value)
static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx)
static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic)
@ SEI_CONTENT_LIGHT_LEVEL
static const VAAPIEncodeProfile vaapi_encode_h265_profiles[]
static const AVOption vaapi_encode_h265_options[]
static const AVCodecDefault vaapi_encode_h265_defaults[]
static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx)
#define PROFILE(name, value)
static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
static const AVClass vaapi_encode_h265_class
static int vaapi_encode_h265_write_extra_header(AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)