| 40 | } |
| 41 | |
| 42 | static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, |
| 43 | av_unused const AVBufferRef *buffer_ref, |
| 44 | av_unused const uint8_t *buffer, |
| 45 | av_unused uint32_t size) |
| 46 | { |
| 47 | const MpegEncContext *s = avctx->priv_data; |
| 48 | VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private; |
| 49 | VAPictureParameterBufferMPEG2 pic_param; |
| 50 | VAIQMatrixBufferMPEG2 iq_matrix; |
| 51 | int i, err; |
| 52 | |
| 53 | pic->output_surface = ff_vaapi_get_surface_id(s->cur_pic.ptr->f); |
| 54 | |
| 55 | pic_param = (VAPictureParameterBufferMPEG2) { |
| 56 | .horizontal_size = s->width, |
| 57 | .vertical_size = s->height, |
| 58 | .forward_reference_picture = VA_INVALID_ID, |
| 59 | .backward_reference_picture = VA_INVALID_ID, |
| 60 | .picture_coding_type = s->pict_type, |
| 61 | .f_code = mpeg2_get_f_code(s), |
| 62 | .picture_coding_extension.bits = { |
| 63 | .intra_dc_precision = s->intra_dc_precision, |
| 64 | .picture_structure = s->picture_structure, |
| 65 | .top_field_first = s->top_field_first, |
| 66 | .frame_pred_frame_dct = s->frame_pred_frame_dct, |
| 67 | .concealment_motion_vectors = s->concealment_motion_vectors, |
| 68 | .q_scale_type = s->q_scale_type, |
| 69 | .intra_vlc_format = s->intra_vlc_format, |
| 70 | .alternate_scan = s->alternate_scan, |
| 71 | .repeat_first_field = s->repeat_first_field, |
| 72 | .progressive_frame = s->progressive_frame, |
| 73 | .is_first_field = mpeg2_get_is_frame_start(s), |
| 74 | }, |
| 75 | }; |
| 76 | |
| 77 | switch (s->pict_type) { |
| 78 | case AV_PICTURE_TYPE_B: |
| 79 | pic_param.backward_reference_picture = ff_vaapi_get_surface_id(s->next_pic.ptr->f); |
| 80 | // fall-through |
| 81 | case AV_PICTURE_TYPE_P: |
| 82 | pic_param.forward_reference_picture = ff_vaapi_get_surface_id(s->last_pic.ptr->f); |
| 83 | break; |
| 84 | } |
| 85 | |
| 86 | err = ff_vaapi_decode_make_param_buffer(avctx, pic, |
| 87 | VAPictureParameterBufferType, |
| 88 | &pic_param, sizeof(pic_param)); |
| 89 | if (err < 0) |
| 90 | goto fail; |
| 91 | |
| 92 | iq_matrix.load_intra_quantiser_matrix = 1; |
| 93 | iq_matrix.load_non_intra_quantiser_matrix = 1; |
| 94 | iq_matrix.load_chroma_intra_quantiser_matrix = 1; |
| 95 | iq_matrix.load_chroma_non_intra_quantiser_matrix = 1; |
| 96 | |
| 97 | for (i = 0; i < 64; i++) { |
| 98 | int n = s->idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 99 | iq_matrix.intra_quantiser_matrix[i] = s->intra_matrix[n]; |
nothing calls this directly
no test coverage detected