| 403 | } |
| 404 | |
| 405 | static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, |
| 406 | FFHWBaseEncodePicture *pic) |
| 407 | { |
| 408 | FFHWBaseEncodeContext *base_ctx = avctx->priv_data; |
| 409 | #if !CONFIG_VAAPI_1 |
| 410 | VAAPIEncodeContext *ctx = avctx->priv_data; |
| 411 | #endif |
| 412 | VAAPIEncodeH264Context *priv = avctx->priv_data; |
| 413 | VAAPIEncodePicture *vaapi_pic = pic->priv; |
| 414 | VAAPIEncodeH264Picture *hpic = pic->codec_priv; |
| 415 | FFHWBaseEncodePicture *prev = pic->prev; |
| 416 | VAAPIEncodeH264Picture *hprev = prev ? prev->codec_priv : NULL; |
| 417 | VAEncPictureParameterBufferH264 *vpic = vaapi_pic->codec_picture_params; |
| 418 | int i, j = 0; |
| 419 | |
| 420 | if (pic->type == FF_HW_PICTURE_TYPE_IDR) { |
| 421 | av_assert0(pic->display_order == pic->encode_order); |
| 422 | |
| 423 | hpic->frame_num = 0; |
| 424 | hpic->last_idr_frame = pic->display_order; |
| 425 | hpic->idr_pic_id = hprev ? hprev->idr_pic_id + 1 : 0; |
| 426 | |
| 427 | hpic->primary_pic_type = 0; |
| 428 | hpic->slice_type = 7; |
| 429 | } else { |
| 430 | av_assert0(prev); |
| 431 | |
| 432 | hpic->frame_num = hprev->frame_num + prev->is_reference; |
| 433 | |
| 434 | hpic->last_idr_frame = hprev->last_idr_frame; |
| 435 | hpic->idr_pic_id = hprev->idr_pic_id; |
| 436 | |
| 437 | if (pic->type == FF_HW_PICTURE_TYPE_I) { |
| 438 | hpic->slice_type = 7; |
| 439 | hpic->primary_pic_type = 0; |
| 440 | } else if (pic->type == FF_HW_PICTURE_TYPE_P) { |
| 441 | hpic->slice_type = 5; |
| 442 | hpic->primary_pic_type = 1; |
| 443 | } else { |
| 444 | hpic->slice_type = 6; |
| 445 | hpic->primary_pic_type = 2; |
| 446 | } |
| 447 | } |
| 448 | hpic->pic_order_cnt = pic->display_order - hpic->last_idr_frame; |
| 449 | if (priv->units.raw_sps.pic_order_cnt_type == 2) { |
| 450 | hpic->pic_order_cnt *= 2; |
| 451 | } |
| 452 | |
| 453 | hpic->dpb_delay = pic->display_order - pic->encode_order + base_ctx->max_b_depth; |
| 454 | hpic->cpb_delay = pic->encode_order - hpic->last_idr_frame; |
| 455 | |
| 456 | if (priv->aud) { |
| 457 | priv->aud_needed = 1; |
| 458 | priv->raw_aud = (H264RawAUD) { |
| 459 | .nal_unit_header = { |
| 460 | .nal_unit_type = H264_NAL_AUD, |
| 461 | }, |
| 462 | .primary_pic_type = hpic->primary_pic_type, |
nothing calls this directly
no test coverage detected