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

Function vaapi_encode_h265_init_picture_params

libavcodec/vaapi_encode_h265.c:459–673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457}
458
459static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
460 FFHWBaseEncodePicture *pic)
461{
462 FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
463 VAAPIEncodeH265Context *priv = avctx->priv_data;
464 VAAPIEncodePicture *vaapi_pic = pic->priv;
465 VAAPIEncodeH265Picture *hpic = pic->codec_priv;
466 FFHWBaseEncodePicture *prev = pic->prev;
467 VAAPIEncodeH265Picture *hprev = prev ? prev->codec_priv : NULL;
468 VAEncPictureParameterBufferHEVC *vpic = vaapi_pic->codec_picture_params;
469 int i, j = 0;
470
471 if (pic->type == FF_HW_PICTURE_TYPE_IDR) {
472 av_assert0(pic->display_order == pic->encode_order);
473
474 hpic->last_idr_frame = pic->display_order;
475
476 hpic->slice_nal_unit = HEVC_NAL_IDR_W_RADL;
477 hpic->slice_type = HEVC_SLICE_I;
478 hpic->pic_type = 0;
479 } else {
480 av_assert0(prev);
481 hpic->last_idr_frame = hprev->last_idr_frame;
482
483 if (pic->type == FF_HW_PICTURE_TYPE_I) {
484 hpic->slice_nal_unit = HEVC_NAL_CRA_NUT;
485 hpic->slice_type = HEVC_SLICE_I;
486 hpic->pic_type = 0;
487 } else if (pic->type == FF_HW_PICTURE_TYPE_P) {
488 av_assert0(pic->refs[0]);
489 hpic->slice_nal_unit = HEVC_NAL_TRAIL_R;
490 hpic->slice_type = HEVC_SLICE_P;
491 hpic->pic_type = 1;
492 } else {
493 FFHWBaseEncodePicture *irap_ref;
494 av_assert0(pic->refs[0][0] && pic->refs[1][0]);
495 for (irap_ref = pic; irap_ref; irap_ref = irap_ref->refs[1][0]) {
496 if (irap_ref->type == FF_HW_PICTURE_TYPE_I)
497 break;
498 }
499 if (pic->b_depth == base_ctx->max_b_depth) {
500 hpic->slice_nal_unit = irap_ref ? HEVC_NAL_RASL_N
501 : HEVC_NAL_TRAIL_N;
502 } else {
503 hpic->slice_nal_unit = irap_ref ? HEVC_NAL_RASL_R
504 : HEVC_NAL_TRAIL_R;
505 }
506 hpic->slice_type = HEVC_SLICE_B;
507 hpic->pic_type = 2;
508 }
509 }
510 hpic->pic_order_cnt = pic->display_order - hpic->last_idr_frame;
511
512 if (priv->aud) {
513 priv->aud_needed = 1;
514 priv->raw_aud = (H265RawAUD) {
515 .nal_unit_header = {
516 .nal_unit_type = HEVC_NAL_AUD,

Callers

nothing calls this directly

Calls 5

av_frame_get_side_dataFunction · 0.85
lrintFunction · 0.85
av_q2dFunction · 0.85
av_freepFunction · 0.85
ff_alloc_a53_seiFunction · 0.85

Tested by

no test coverage detected