45 VAPictureParameterBufferMPEG2 *pic_param;
46 VAIQMatrixBufferMPEG2 *iq_matrix;
55 pic_param->horizontal_size = s->
width;
56 pic_param->vertical_size = s->
height;
57 pic_param->forward_reference_picture = VA_INVALID_ID;
58 pic_param->backward_reference_picture = VA_INVALID_ID;
59 pic_param->picture_coding_type = s->
pict_type;
61 pic_param->picture_coding_extension.value = 0;
63 pic_param->picture_coding_extension.bits.picture_structure = s->
picture_structure;
64 pic_param->picture_coding_extension.bits.top_field_first = s->
top_field_first;
67 pic_param->picture_coding_extension.bits.q_scale_type = s->
q_scale_type;
68 pic_param->picture_coding_extension.bits.intra_vlc_format = s->
intra_vlc_format;
69 pic_param->picture_coding_extension.bits.alternate_scan = s->
alternate_scan;
71 pic_param->picture_coding_extension.bits.progressive_frame = s->
progressive_frame;
87 iq_matrix->load_intra_quantiser_matrix = 1;
88 iq_matrix->load_non_intra_quantiser_matrix = 1;
89 iq_matrix->load_chroma_intra_quantiser_matrix = 1;
90 iq_matrix->load_chroma_non_intra_quantiser_matrix = 1;
92 for (i = 0; i < 64; i++) {
95 iq_matrix->non_intra_quantiser_matrix[i] = s->
inter_matrix[
n];
106 VASliceParameterBufferMPEG2 *slice_param;
108 uint32_t quantiser_scale_code, intra_slice_flag, macroblock_offset;
114 quantiser_scale_code =
get_bits(&gb, 5);
116 if (intra_slice_flag) {
127 slice_param->macroblock_offset = macroblock_offset;
128 slice_param->slice_horizontal_position = s->
mb_x;
130 slice_param->quantiser_scale_code = quantiser_scale_code;
131 slice_param->intra_slice_flag = intra_slice_flag;
136 .
name =
"mpeg2_vaapi",
VASliceParameterBufferBase * ff_vaapi_alloc_slice(FFVAContext *vactx, const uint8_t *buffer, uint32_t size)
Allocate a new slice descriptor for the input slice.
int ff_vaapi_context_fini(AVCodecContext *avctx)
Common AVHWAccel.uninit() implementation.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
uint16_t chroma_intra_matrix[64]
uint16_t chroma_inter_matrix[64]
unsigned int slice_param_size
Size of a slice parameter element.
static int mpeg2_get_f_code(MpegEncContext *s)
Reconstruct bitstream f_code.
static int get_bits_count(const GetBitContext *s)
void * ff_vaapi_alloc_iq_matrix(FFVAContext *vactx, unsigned int size)
Allocate a new IQ matrix buffer.
static FFVAContext * ff_vaapi_get_context(AVCodecContext *avctx)
Extract vaapi_context from an AVCodecContext.
int ff_vaapi_context_init(AVCodecContext *avctx)
Common AVHWAccel.init() implementation.
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.
static VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
Extract VASurfaceID from an AVFrame.
uint8_t idct_permutation[64]
IDCT input permutation.
preferred ID for MPEG-1/2 video decoding
int first_field
is 1 for the first field of a field picture 0 otherwise
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.
void * ff_vaapi_alloc_pic_param(FFVAContext *vactx, unsigned int size)
Allocate a new picture parameter buffer.
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
static int mpeg2_get_is_frame_start(MpegEncContext *s)
Determine frame start: first field for field picture or frame picture.
struct AVCodecContext * avctx
common internal api header.
Picture last_picture
copy of the previous picture structure.
Picture next_picture
copy of the next picture structure.
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx)
static int skip_1stop_8data_bits(GetBitContext *gb)