25 #define MAX_SLICES (SLICE_MAX_START_CODE - SLICE_MIN_START_CODE + 1)
27 DXVA_PictureParameters
pp;
39 DXVA_PictureParameters *pp)
44 memset(pp, 0,
sizeof(*pp));
46 pp->wDeblockedPictureIndex = 0;
50 pp->wForwardRefPictureIndex = 0xffff;
54 pp->wBackwardRefPictureIndex = 0xffff;
55 pp->wPicWidthInMBminus1 = s->
mb_width - 1;
56 pp->wPicHeightInMBminus1 = (s->
mb_height >> is_field) - 1;
57 pp->bMacroblockWidthMinus1 = 15;
58 pp->bMacroblockHeightMinus1 = 15;
59 pp->bBlockWidthMinus1 = 7;
60 pp->bBlockHeightMinus1 = 7;
66 pp->bBidirectionalAveragingMode = 0;
67 pp->bMVprecisionAndChromaRelation= 0;
69 pp->bPicScanFixed = 1;
71 pp->bPicReadbackRequests = 0;
73 pp->bPicSpatialResid8 = 0;
74 pp->bPicOverflowBlocks = 0;
75 pp->bPicExtrapolation = 0;
76 pp->bPicDeblocked = 0;
77 pp->bPicDeblockConfined = 0;
78 pp->bPic4MVallowed = 0;
82 pp->bReservedBits = 0;
83 pp->wBitstreamFcodes = (s->
mpeg_f_code[0][0] << 12) |
98 pp->bBitstreamConcealmentNeed = 0;
99 pp->bBitstreamConcealmentMethod = 0;
105 DXVA_QmatrixData *qm)
108 for (i = 0; i < 4; i++)
109 qm->bNewQmatrix[i] = 1;
110 for (i = 0; i < 64; i++) {
121 DXVA_SliceInfo *slice,
128 memset(slice, 0,
sizeof(*slice));
129 slice->wHorizontalPosition = s->
mb_x;
130 slice->wVerticalPosition = s->
mb_y >> is_field;
131 slice->dwSliceBitsInBuffer = 8 *
size;
132 slice->dwSliceDataLocation = position;
133 slice->bStartCodeBitOffset = 0;
134 slice->bReservedBits = 0;
137 slice->wBadSliceChopping = 0;
141 slice->wQuantizerScaleCode =
get_bits(&gb, 5);
148 DXVA2_DecodeBufferDesc *bs,
149 DXVA2_DecodeBufferDesc *sc)
161 if (FAILED(IDirectXVideoDecoder_GetBuffer(ctx->
decoder,
162 DXVA2_BitStreamDateBufferType,
163 (
void **)&dxva_data, &dxva_size)))
166 end = dxva_data + dxva_size;
170 unsigned position = slice->dwSliceDataLocation;
171 unsigned size = slice->dwSliceBitsInBuffer / 8;
172 if (size > end - current) {
176 slice->dwSliceDataLocation = current - dxva_data;
179 slice->wNumberMBsInSlice =
180 slice[1].wNumberMBsInSlice - slice[0].wNumberMBsInSlice;
182 slice->wNumberMBsInSlice =
183 mb_count - slice[0].wNumberMBsInSlice;
185 memcpy(current, &ctx_pic->
bitstream[position], size);
188 if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(ctx->
decoder,
189 DXVA2_BitStreamDateBufferType)))
194 memset(bs, 0,
sizeof(*bs));
195 bs->CompressedBufferType = DXVA2_BitStreamDateBufferType;
196 bs->DataSize = current - dxva_data;
197 bs->NumMBsInBuffer = mb_count;
200 DXVA2_SliceControlBufferType,
259 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
260 &ctx_pic->
qm,
sizeof(ctx_pic->
qm),
268 .
name =
"mpeg2_dxva2",