| 757 | } |
| 758 | |
| 759 | static int vaapi_encode_av1_write_picture_header(AVCodecContext *avctx, |
| 760 | FFHWBaseEncodePicture *pic, |
| 761 | char *data, size_t *data_len) |
| 762 | { |
| 763 | VAAPIEncodeAV1Context *priv = avctx->priv_data; |
| 764 | CodedBitstreamFragment *obu = &priv->current_obu; |
| 765 | CodedBitstreamAV1Context *cbctx = priv->cbc->priv_data; |
| 766 | AV1RawOBU *fh_obu = &priv->fh; |
| 767 | AV1RawFrameHeader *rep_fh = &fh_obu->obu.frame_header; |
| 768 | VAAPIEncodePicture *vaapi_pic = pic->priv; |
| 769 | VAAPIEncodeAV1Picture *href; |
| 770 | int ret = 0; |
| 771 | |
| 772 | vaapi_pic->tail_size = 0; |
| 773 | /** Pack repeat frame header. */ |
| 774 | if (pic->display_order > pic->encode_order) { |
| 775 | memset(fh_obu, 0, sizeof(*fh_obu)); |
| 776 | href = pic->refs[0][pic->nb_refs[0] - 1]->codec_priv; |
| 777 | fh_obu->header.obu_type = AV1_OBU_FRAME_HEADER; |
| 778 | fh_obu->header.obu_has_size_field = 1; |
| 779 | |
| 780 | rep_fh->show_existing_frame = 1; |
| 781 | rep_fh->frame_to_show_map_idx = href->slot == 0; |
| 782 | rep_fh->frame_type = AV1_FRAME_INTER; |
| 783 | rep_fh->frame_width_minus_1 = avctx->width - 1; |
| 784 | rep_fh->frame_height_minus_1 = avctx->height - 1; |
| 785 | rep_fh->render_width_minus_1 = rep_fh->frame_width_minus_1; |
| 786 | rep_fh->render_height_minus_1 = rep_fh->frame_height_minus_1; |
| 787 | |
| 788 | cbctx->seen_frame_header = 0; |
| 789 | |
| 790 | ret = vaapi_encode_av1_add_obu(avctx, obu, AV1_OBU_FRAME_HEADER, &priv->fh); |
| 791 | if (ret < 0) |
| 792 | goto end; |
| 793 | |
| 794 | ret = vaapi_encode_av1_write_obu(avctx, vaapi_pic->tail_data, &vaapi_pic->tail_size, obu); |
| 795 | if (ret < 0) |
| 796 | goto end; |
| 797 | |
| 798 | vaapi_pic->tail_size /= 8; |
| 799 | } |
| 800 | |
| 801 | memcpy(data, &priv->fh_data, MAX_PARAM_BUFFER_SIZE * sizeof(char)); |
| 802 | *data_len = priv->fh_data_len; |
| 803 | |
| 804 | end: |
| 805 | ff_cbs_fragment_reset(obu); |
| 806 | return ret; |
| 807 | } |
| 808 | |
| 809 | static int vaapi_encode_av1_write_extra_header(AVCodecContext *avctx, |
| 810 | FFHWBaseEncodePicture *base_pic, |
nothing calls this directly
no test coverage detected