28 DXVA_PictureParameters
pp;
37 DXVA_PictureParameters *pp)
42 memset(pp, 0,
sizeof(*pp));
43 pp->wDecodedPictureIndex =
48 pp->wForwardRefPictureIndex = 0xffff;
52 pp->wBackwardRefPictureIndex = 0xffff;
55 pp->wPicWidthInMBminus1 = avctx->
width - 1;
56 pp->wPicHeightInMBminus1= avctx->
height - 1;
59 pp->wPicWidthInMBminus1 = s->
mb_width - 1;
60 pp->wPicHeightInMBminus1= s->
mb_height - 1;
62 pp->bMacroblockWidthMinus1 = 15;
63 pp->bMacroblockHeightMinus1 = 15;
64 pp->bBlockWidthMinus1 = 7;
65 pp->bBlockHeightMinus1 = 7;
68 pp->bPicStructure |= 0x01;
70 pp->bPicStructure |= 0x02;
74 pp->bBidirectionalAveragingMode = (1 << 7) |
75 ((ctx->
cfg->ConfigIntraResidUnsigned != 0) << 6) |
76 ((ctx->
cfg->ConfigResidDiffAccelerator != 0) << 5) |
88 pp->bPicScanMethod = ctx->
report_id & 0xff;
89 pp->bPicReadbackRequests = 0;
90 pp->bRcontrol = v->
rnd;
104 pp->bPicDeblocked = ((!pp->bPicBackwardPrediction && v->
overlap) << 6) |
126 pp->bReservedBits = 0;
129 pp->wBitstreamPCEelements = v->
lumshift;
135 pp->bBitstreamConcealmentNeed = 0;
136 pp->bBitstreamConcealmentMethod = 0;
140 unsigned position,
unsigned size)
145 memset(slice, 0,
sizeof(*slice));
146 slice->wHorizontalPosition = 0;
147 slice->wVerticalPosition = s->
mb_y;
148 slice->dwSliceBitsInBuffer = 8 *
size;
149 slice->dwSliceDataLocation = position;
150 slice->bStartCodeBitOffset = 0;
151 slice->bReservedBits = 0;
154 slice->wQuantizerScaleCode = v->
pq;
155 slice->wBadSliceChopping = 0;
159 DXVA2_DecodeBufferDesc *bs,
160 DXVA2_DecodeBufferDesc *sc)
167 DXVA_SliceInfo *
slice = &ctx_pic->
si;
169 static const uint8_t start_code[] = { 0, 0, 1, 0x0d };
171 const unsigned slice_size = slice->dwSliceBitsInBuffer / 8;
172 const unsigned padding = 128 - ((start_code_size + slice_size) & 127);
173 const unsigned data_size = start_code_size + slice_size + padding;
179 if (FAILED(IDirectXVideoDecoder_GetBuffer(ctx->
decoder,
180 DXVA2_BitStreamDateBufferType,
181 (
void **)&dxva_data, &dxva_size)))
184 result = data_size <= dxva_size ? 0 : -1;
186 if (start_code_size > 0) {
187 memcpy(dxva_data, start_code, start_code_size);
191 memcpy(dxva_data + start_code_size,
192 ctx_pic->
bitstream + slice->dwSliceDataLocation, slice_size);
194 memset(dxva_data + start_code_size + slice_size, 0, padding);
195 slice->dwSliceBitsInBuffer = 8 * data_size;
197 if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(ctx->
decoder,
198 DXVA2_BitStreamDateBufferType)))
203 memset(bs, 0,
sizeof(*bs));
204 bs->CompressedBufferType = DXVA2_BitStreamDateBufferType;
205 bs->DataSize = data_size;
207 assert((bs->DataSize & 127) == 0);
210 DXVA2_SliceControlBufferType,
211 slice,
sizeof(*slice), bs->NumMBsInBuffer);
265 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
270 #if CONFIG_WMV3_DXVA2_HWACCEL
272 .
name =
"wmv3_dxva2",