/** Fill in VA API reference frames array. */ static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param, const H264Context *h) { DPB dpb; int i; dpb.size = 0; dpb.max_size = FF_ARRAY_ELEMS(pic_param->ReferenceFrames); dpb.va_pics = pic_param->ReferenceFrames; for (i = 0; i < dpb.max_size; i++) init_vaapi_pic(&dpb.va_pics[i]); for (i = 0; i < h->short_ref_count; i++) { const H264Picture *pic = h->short_ref[i]; if (pic && pic->reference && dpb_add(&dpb, pic) < 0) return -1; } for (i = 0; i < 16; i++) { const H264Picture *pic = h->long_ref[i]; if (pic && pic->reference && dpb_add(&dpb, pic) < 0) return -1; } return 0; }
/** * Fill in VA API reference picture lists from the Libav reference * picture list. * * @param[out] RefPicList VA API internal reference picture list * @param[in] ref_list A pointer to the Libav reference list * @param[in] ref_count The number of reference pictures in ref_list */ static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32], const H264Ref *ref_list, unsigned int ref_count) { unsigned int i, n = 0; for (i = 0; i < ref_count; i++) if (ref_list[i].reference) fill_vaapi_pic(&RefPicList[n++], ref_list[i].parent, 0); for (; n < 32; n++) init_vaapi_pic(&RefPicList[n]); }
static void fill_vaapi_ReferenceFrames(const HEVCContext *h, VAPictureParameterBufferHEVC *pp) { const HEVCFrame *current_picture = h->ref; int i, j, rps_type; for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->ReferenceFrames); i++) { const HEVCFrame *frame = NULL; while (!frame && j < FF_ARRAY_ELEMS(h->DPB)) { if (&h->DPB[j] != current_picture && (h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) frame = &h->DPB[j]; j++; } init_vaapi_pic(&pp->ReferenceFrames[i]); if (frame) { rps_type = find_frame_rps_type(h, frame); fill_vaapi_pic(&pp->ReferenceFrames[i], frame, rps_type); } } }