41 va_pic->picture_id = VA_INVALID_ID;
42 va_pic->flags = VA_PICTURE_H264_INVALID;
43 va_pic->TopFieldOrderCnt = 0;
44 va_pic->BottomFieldOrderCnt = 0;
59 if (pic_structure == 0)
68 va_pic->flags |= (pic_structure &
PICT_TOP_FIELD) ? VA_PICTURE_H264_TOP_FIELD : VA_PICTURE_H264_BOTTOM_FIELD;
70 va_pic->flags |= pic->
long_ref ? VA_PICTURE_H264_LONG_TERM_REFERENCE : VA_PICTURE_H264_SHORT_TERM_REFERENCE;
72 va_pic->TopFieldOrderCnt = 0;
74 va_pic->TopFieldOrderCnt = pic->
field_poc[0];
76 va_pic->BottomFieldOrderCnt = 0;
78 va_pic->BottomFieldOrderCnt = pic->
field_poc[1];
101 for (i = 0; i < dpb->
size; i++) {
102 VAPictureH264 *
const va_pic = &dpb->
va_pics[
i];
104 VAPictureH264 temp_va_pic;
107 if ((temp_va_pic.flags ^ va_pic->flags) & (VA_PICTURE_H264_TOP_FIELD | VA_PICTURE_H264_BOTTOM_FIELD)) {
108 va_pic->flags |= temp_va_pic.flags & (VA_PICTURE_H264_TOP_FIELD | VA_PICTURE_H264_BOTTOM_FIELD);
110 if (temp_va_pic.flags & VA_PICTURE_H264_TOP_FIELD) {
111 va_pic->TopFieldOrderCnt = temp_va_pic.TopFieldOrderCnt;
113 va_pic->BottomFieldOrderCnt = temp_va_pic.BottomFieldOrderCnt;
133 dpb.
va_pics = pic_param->ReferenceFrames;
143 for (i = 0; i < 16; i++) {
161 unsigned int ref_count)
163 unsigned int i, n = 0;
164 for (i = 0; i < ref_count; i++)
165 if (ref_list[i].reference)
167 ref_list[i].reference);
190 unsigned char *luma_weight_flag,
191 short luma_weight[32],
192 short luma_offset[32],
193 unsigned char *chroma_weight_flag,
194 short chroma_weight[32][2],
195 short chroma_offset[32][2])
213 for (j = 0; j < 2; j++) {
219 chroma_offset[
i][j] = 0;
234 VAPictureParameterBufferH264 pic_param;
235 VAIQMatrixBufferH264 iq_matrix;
240 pic_param = (VAPictureParameterBufferH264) {
241 .picture_width_in_mbs_minus1 = h->
mb_width - 1,
242 .picture_height_in_mbs_minus1 = h->
mb_height - 1,
251 .mb_adaptive_frame_field_flag = sps->
mb_aff,
253 .MinLumaBiPredSize8x8 = sps->
level_idc >= 31,
255 .pic_order_cnt_type = sps->
poc_type,
259 .pic_init_qp_minus26 = pps->
init_qp - 26,
260 .pic_init_qs_minus26 = pps->
init_qs - 26,
264 .entropy_coding_mode_flag = pps->
cabac,
284 VAPictureParameterBufferType,
285 &pic_param,
sizeof(pic_param));
289 memcpy(iq_matrix.ScalingList4x4,
291 memcpy(iq_matrix.ScalingList8x8[0],
293 memcpy(iq_matrix.ScalingList8x8[1],
297 VAIQMatrixBufferType,
298 &iq_matrix,
sizeof(iq_matrix));
335 VASliceParameterBufferH264 slice_param;
338 slice_param = (VASliceParameterBufferH264) {
339 .slice_data_size =
size,
340 .slice_data_offset = 0,
341 .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
363 &slice_param.luma_weight_l0_flag,
364 slice_param.luma_weight_l0,
365 slice_param.luma_offset_l0,
366 &slice_param.chroma_weight_l0_flag,
367 slice_param.chroma_weight_l0,
368 slice_param.chroma_offset_l0);
370 &slice_param.luma_weight_l1_flag,
371 slice_param.luma_weight_l1,
372 slice_param.luma_offset_l1,
373 &slice_param.chroma_weight_l1_flag,
374 slice_param.chroma_weight_l1,
375 slice_param.chroma_offset_l1);
378 &slice_param,
sizeof(slice_param),
389 .
name =
"h264_vaapi",
int long_ref
1->long term reference 0->short term reference
const AVHWAccel ff_h264_vaapi_hwaccel
int chroma_qp_index_offset[2]
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)
int luma_weight_flag[2]
7.4.3.2 luma_weight_lX_flag
int chroma_weight[48][2][2][2]
static VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
int max_size
Max number of reference frames. This is FF_ARRAY_ELEMS(VAPictureParameterBufferH264.ReferenceFrames)
H264Picture * long_ref[32]
unsigned int ref_count[2]
num_ref_idx_l0/1_active_minus1 + 1
int ff_vaapi_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
static int vaapi_h264_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
Decode the given H.264 slice with VA API.
uint8_t scaling_matrix4[6][16]
int deblocking_filter_parameters_present
deblocking_filter_parameters_present_flag
int ff_vaapi_decode_uninit(AVCodecContext *avctx)
static av_cold int uninit(AVCodecContext *avctx)
static void fill_vaapi_plain_pred_weight_table(const H264Context *h, int list, unsigned char *luma_weight_flag, short luma_weight[32], short luma_offset[32], unsigned char *chroma_weight_flag, short chroma_weight[32][2], short chroma_offset[32][2])
Fill in prediction weight table.
int gaps_in_frame_num_allowed_flag
int slice_alpha_c0_offset
int bit_depth_chroma
bit_depth_chroma_minus8 + 8
int ff_vaapi_decode_issue(AVCodecContext *avctx, VAAPIDecodePicture *pic)
int chroma_weight_flag[2]
7.4.3.2 chroma_weight_lX_flag
int cabac
entropy_coding_mode_flag
static int get_bits_count(const GetBitContext *s)
int redundant_pic_cnt_present
redundant_pic_cnt_present_flag
int luma_weight[48][2][2]
void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height)
H.264 parameter set handling.
int mb_aff
mb_adaptive_frame_field_flag
int chroma_log2_weight_denom
int poc_type
pic_order_cnt_type
int constrained_intra_pred
constrained_intra_pred_flag
void * hwaccel_picture_private
hardware accelerator private data
int deblocking_filter
disable_deblocking_filter_idc with 1 <-> 0
int weighted_pred
weighted_pred_flag
int direct_spatial_mv_pred
int frame_num
frame_num (raw frame_num from slice header)
int residual_color_transform_flag
residual_colour_transform_flag
int ff_h264_get_slice_type(const H264SliceContext *sl)
Reconstruct bitstream slice_type.
int delta_pic_order_always_zero_flag
static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param, const H264Context *h)
Fill in VA API reference frames array.
static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32], const H264Ref *ref_list, unsigned int ref_count)
Fill in VA API reference picture lists from the FFmpeg reference picture list.
uint8_t scaling_matrix8[6][64]
#define HWACCEL_CAP_ASYNC_SAFE
int ref_frame_count
num_ref_frames
const char * name
Name of the hardware accelerated codec.
int ff_vaapi_decode_init(AVCodecContext *avctx)
static int vaapi_h264_end_frame(AVCodecContext *avctx)
End a hardware decoding based frame.
int luma_log2_weight_denom
int size
Current number of reference frames in the DPB.
int init_qp
pic_init_qp_minus26 + 26
H.264 / AVC / MPEG-4 part10 codec.
H264SliceContext * slice_ctx
int direct_8x8_inference_flag
#define FIELD_OR_MBAFF_PICTURE(h)
#define FF_ARRAY_ELEMS(a)
int pic_order_present
pic_order_present_flag
VASurfaceID output_surface
H264Picture * short_ref[32]
int field_poc[2]
top/bottom POC
main external API structure.
static void fill_vaapi_pic(VAPictureH264 *va_pic, const H264Picture *pic, int pic_structure)
Translate an FFmpeg Picture into its VA API form.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
static int dpb_add(DPB *dpb, const H264Picture *pic)
Append picture to the decoded picture buffer, in a VA API form that merges the second field picture a...
static int FUNC() pps(CodedBitstreamContext *ctx, RWContext *rw, H264RawPPS *current)
H264Picture * cur_pic_ptr
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
int log2_max_poc_lsb
log2_max_pic_order_cnt_lsb_minus4
int ff_vaapi_decode_cancel(AVCodecContext *avctx, VAAPIDecodePicture *pic)
int transform_8x8_mode
transform_8x8_mode_flag
int init_qs
pic_init_qs_minus26 + 26
int pic_id
pic_num (short -> no wrap version of pic_num, pic_num & max_pic_num; long -> long_pic_num) ...
int log2_max_frame_num
log2_max_frame_num_minus4 + 4
int bit_depth_luma
bit_depth_luma_minus8 + 8
static int vaapi_h264_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
Initialize and start decoding a frame with VA API.
static void init_vaapi_pic(VAPictureH264 *va_pic)
Initialize an empty VA API picture.
Decoded Picture Buffer (DPB).
H264Ref ref_list[2][48]
0..15: frame refs, 16..47: mbaff field refs.
VAPictureH264 * va_pics
Pointer to VAPictureParameterBufferH264.ReferenceFrames array.
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)
int short_ref_count
number of actual short term references