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,
59 .picture_coding_extension.bits = {
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++) {
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,
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 int mpeg2_get_f_code(const MpegEncContext *s)
Reconstruct bitstream f_code.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static av_cold int init(AVCodecContext *avctx)
int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, int type, const void *data, size_t size)
uint16_t chroma_intra_matrix[64]
uint16_t chroma_inter_matrix[64]
static VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
int ff_vaapi_decode_uninit(AVCodecContext *avctx)
static av_cold int uninit(AVCodecContext *avctx)
int ff_vaapi_decode_issue(AVCodecContext *avctx, VAAPIDecodePicture *pic)
static int get_bits_count(const GetBitContext *s)
static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
const char * name
Name of the hardware accelerated codec.
int ff_vaapi_decode_init(AVCodecContext *avctx)
Picture * current_picture_ptr
pointer to the current picture
void * hwaccel_picture_private
Hardware accelerator private data.
static int mpeg2_get_is_frame_start(const MpegEncContext *s)
Determine frame start: first field for field picture or frame picture.
uint8_t idct_permutation[64]
IDCT input permutation.
static int vaapi_mpeg2_end_frame(AVCodecContext *avctx)
preferred ID for MPEG-1/2 video decoding
int first_field
is 1 for the first field of a field picture 0 otherwise
VASurfaceID output_surface
uint16_t inter_matrix[64]
int concealment_motion_vectors
main external API structure.
int height
picture size. must be a multiple of 16
static unsigned int get_bits1(GetBitContext *s)
AVHWAccel ff_mpeg2_vaapi_hwaccel
static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
const uint8_t ff_zigzag_direct[64]
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
int ff_vaapi_decode_cancel(AVCodecContext *avctx, VAAPIDecodePicture *pic)
struct AVCodecContext * avctx
common internal api header.
Picture last_picture
copy of the previous picture structure.
#define HWACCEL_CAP_ASYNC_SAFE
Picture next_picture
copy of the next picture structure.
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
static int skip_1stop_8data_bits(GetBitContext *gb)
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)