Go to the documentation of this file.
32 return (
s->mpeg_f_code[0][0] << 12) | (
s->mpeg_f_code[0][1] << 8) |
33 (
s->mpeg_f_code[1][0] << 4) |
s->mpeg_f_code[1][1];
39 return s->first_field ||
s->picture_structure ==
PICT_FRAME;
46 VAPictureParameterBufferMPEG2 pic_param;
47 VAIQMatrixBufferMPEG2 iq_matrix;
52 pic_param = (VAPictureParameterBufferMPEG2) {
53 .horizontal_size =
s->width,
54 .vertical_size =
s->height,
55 .forward_reference_picture = VA_INVALID_ID,
56 .backward_reference_picture = VA_INVALID_ID,
57 .picture_coding_type =
s->pict_type,
59 .picture_coding_extension.bits = {
60 .intra_dc_precision =
s->intra_dc_precision,
61 .picture_structure =
s->picture_structure,
62 .top_field_first =
s->top_field_first,
63 .frame_pred_frame_dct =
s->frame_pred_frame_dct,
64 .concealment_motion_vectors =
s->concealment_motion_vectors,
65 .q_scale_type =
s->q_scale_type,
66 .intra_vlc_format =
s->intra_vlc_format,
67 .alternate_scan =
s->alternate_scan,
68 .repeat_first_field =
s->repeat_first_field,
69 .progressive_frame =
s->progressive_frame,
74 switch (
s->pict_type) {
84 VAPictureParameterBufferType,
85 &pic_param,
sizeof(pic_param));
89 iq_matrix.load_intra_quantiser_matrix = 1;
90 iq_matrix.load_non_intra_quantiser_matrix = 1;
91 iq_matrix.load_chroma_intra_quantiser_matrix = 1;
92 iq_matrix.load_chroma_non_intra_quantiser_matrix = 1;
94 for (
i = 0;
i < 64;
i++) {
96 iq_matrix.intra_quantiser_matrix[
i] =
s->intra_matrix[n];
97 iq_matrix.non_intra_quantiser_matrix[
i] =
s->inter_matrix[n];
98 iq_matrix.chroma_intra_quantiser_matrix[
i] =
s->chroma_intra_matrix[n];
99 iq_matrix.chroma_non_intra_quantiser_matrix[
i] =
s->chroma_inter_matrix[n];
103 VAIQMatrixBufferType,
104 &iq_matrix,
sizeof(iq_matrix));
135 VASliceParameterBufferMPEG2 slice_param;
137 uint32_t quantiser_scale_code, intra_slice_flag, macroblock_offset;
144 quantiser_scale_code =
get_bits(&gb, 5);
146 if (intra_slice_flag) {
153 slice_param = (VASliceParameterBufferMPEG2) {
154 .slice_data_size =
size,
155 .slice_data_offset = 0,
156 .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
157 .macroblock_offset = macroblock_offset,
158 .slice_horizontal_position =
s->mb_x,
159 .slice_vertical_position =
s->mb_y >> (
s->picture_structure !=
PICT_FRAME),
160 .quantiser_scale_code = quantiser_scale_code,
161 .intra_slice_flag = intra_slice_flag,
165 &slice_param,
sizeof(slice_param),
176 .
name =
"mpeg2_vaapi",
static VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int get_bits_count(const GetBitContext *s)
int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, const void *params_data, size_t params_size, const void *slice_data, size_t slice_size)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, int type, const void *data, size_t size)
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
VASurfaceID output_surface
int ff_vaapi_decode_init(AVCodecContext *avctx)
int ff_vaapi_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
int ff_vaapi_decode_uninit(AVCodecContext *avctx)
int ff_vaapi_decode_issue(AVCodecContext *avctx, VAAPIDecodePicture *pic)
const AVHWAccel ff_mpeg2_vaapi_hwaccel
static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
static unsigned int get_bits1(GetBitContext *s)
static int mpeg2_get_is_frame_start(const MpegEncContext *s)
Determine frame start: first field for field picture or frame picture.
int ff_vaapi_decode_cancel(AVCodecContext *avctx, VAAPIDecodePicture *pic)
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
const char * name
Name of the hardware accelerated codec.
#define i(width, name, range_min, range_max)
#define HWACCEL_CAP_ASYNC_SAFE
const uint8_t ff_zigzag_direct[64]
static int skip_1stop_8data_bits(GetBitContext *gb)
main external API structure.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
static int vaapi_mpeg2_end_frame(AVCodecContext *avctx)
@ AV_PICTURE_TYPE_P
Predicted.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static av_cold int uninit(AVCodecContext *avctx)
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
static int mpeg2_get_f_code(const MpegEncContext *s)
Reconstruct bitstream f_code.