28 #define MAX_SLICES 256
31 DXVA_PicParams_HEVC
pp;
40 unsigned index,
unsigned flag)
42 av_assert0((index & 0x7f) == index && (flag & 0x01) == flag);
43 pic->bPicEntry = index | (flag << 7);
50 if ((pp->RefPicList[i].bPicEntry & 0x7f) == surface_index)
57 DXVA_PicParams_HEVC *pp)
62 memset(pp, 0,
sizeof(*pp));
156 pp->CurrPicOrderCntVal = h->
poc;
159 memset(&pp->RefPicList, 0xff,
sizeof(pp->RefPicList));
160 memset(&pp->RefPicSetStCurrBefore, 0xff,
sizeof(pp->RefPicSetStCurrBefore));
161 memset(&pp->RefPicSetStCurrAfter, 0xff,
sizeof(pp->RefPicSetStCurrAfter));
162 memset(&pp->RefPicSetLtCurr, 0xff,
sizeof(pp->RefPicSetLtCurr));
169 pp->PicOrderCntValList[j] = frame->
poc;
174 #define DO_REF_LIST(ref_idx, ref_list) { \
175 const RefPicList *rpl = &h->rps[ref_idx]; \
176 av_assert0(rpl->nb_refs <= FF_ARRAY_ELEMS(pp->ref_list)); \
177 for (j = 0, k = 0; j < rpl->nb_refs; j++) { \
179 pp->ref_list[k] = get_refpic_index(pp, ff_dxva2_get_surface_index(ctx, rpl->ref[j]->frame)); \
190 pp->StatusReportFeedbackNumber = 1 + ctx->
report_id++;
199 memset(qm, 0,
sizeof(*qm));
200 for (i = 0; i < 6; i++) {
201 for (j = 0; j < 16; j++) {
203 qm->ucScalingLists0[i][j] = sl->
sl[0][i][pos];
206 for (j = 0; j < 64; j++) {
208 qm->ucScalingLists1[i][j] = sl->
sl[1][i][pos];
209 qm->ucScalingLists2[i][j] = sl->
sl[2][i][pos];
212 qm->ucScalingLists3[i][j] = sl->
sl[3][i][pos];
215 qm->ucScalingListDCCoefSizeID2[i] = sl->
sl_dc[0][i];
217 qm->ucScalingListDCCoefSizeID3[i] = sl->
sl_dc[1][i];
222 unsigned position,
unsigned size)
224 memset(slice, 0,
sizeof(*slice));
225 slice->BSNALunitDataLocation = position;
226 slice->SliceBytesInBuffer =
size;
227 slice->wBadSliceChopping = 0;
231 DXVA2_DecodeBufferDesc *bs,
232 DXVA2_DecodeBufferDesc *sc)
238 DXVA_Slice_HEVC_Short *slice =
NULL;
249 DXVA2_BitStreamDateBufferType,
250 &dxva_data_ptr, &dxva_size)))
253 dxva_data = dxva_data_ptr;
255 end = dxva_data + dxva_size;
259 static const unsigned start_code_size =
sizeof(
start_code);
260 unsigned position,
size;
264 position = slice->BSNALunitDataLocation;
265 size = slice->SliceBytesInBuffer;
266 if (start_code_size + size > end - current) {
271 slice->BSNALunitDataLocation = current - dxva_data;
272 slice->SliceBytesInBuffer = start_code_size +
size;
274 memcpy(current, start_code, start_code_size);
275 current += start_code_size;
277 memcpy(current, &ctx_pic->
bitstream[position], size);
280 padding =
FFMIN(128 - ((current - dxva_data) & 127), end - current);
281 if (slice && padding > 0) {
282 memset(current, 0, padding);
285 slice->SliceBytesInBuffer += padding;
288 DXVA2_BitStreamDateBufferType)))
293 memset(bs, 0,
sizeof(*bs));
294 bs->CompressedBufferType = DXVA2_BitStreamDateBufferType;
295 bs->DataSize = current - dxva_data;
296 bs->NumMBsInBuffer = 0;
303 DXVA2_SliceControlBufferType,
304 slice_data, slice_size, 0);
359 int scale = ctx_pic->
pp.dwCodingParamToolFlags & 1;
366 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
367 scale ? &ctx_pic->
qm :
NULL, scale ?
sizeof(ctx_pic->
qm) : 0,
373 .
name =
"hevc_dxva2",