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;
125 pp->bReservedBits = 0;
128 pp->wBitstreamPCEelements = v->
lumshift;
134 pp->bBitstreamConcealmentNeed = 0;
135 pp->bBitstreamConcealmentMethod = 0;
139 unsigned position,
unsigned size)
144 memset(slice, 0,
sizeof(*slice));
145 slice->wHorizontalPosition = 0;
146 slice->wVerticalPosition = s->
mb_y;
147 slice->dwSliceBitsInBuffer = 8 *
size;
148 slice->dwSliceDataLocation = position;
149 slice->bStartCodeBitOffset = 0;
150 slice->bReservedBits = 0;
153 slice->wQuantizerScaleCode = v->
pq;
154 slice->wBadSliceChopping = 0;
158 DXVA2_DecodeBufferDesc *bs,
159 DXVA2_DecodeBufferDesc *sc)
166 DXVA_SliceInfo *
slice = &ctx_pic->
si;
168 static const uint8_t start_code[] = { 0, 0, 1, 0x0d };
170 const unsigned slice_size = slice->dwSliceBitsInBuffer / 8;
171 const unsigned padding = 128 - ((start_code_size + slice_size) & 127);
172 const unsigned data_size = start_code_size + slice_size + padding;
178 if (FAILED(IDirectXVideoDecoder_GetBuffer(ctx->
decoder,
179 DXVA2_BitStreamDateBufferType,
180 &dxva_data, &dxva_size)))
183 result = data_size <= dxva_size ? 0 : -1;
185 if (start_code_size > 0)
186 memcpy(dxva_data, start_code, start_code_size);
187 memcpy(dxva_data + start_code_size,
188 ctx_pic->
bitstream + slice->dwSliceDataLocation, slice_size);
190 memset(dxva_data + start_code_size + slice_size, 0, padding);
191 slice->dwSliceBitsInBuffer = 8 * data_size;
193 if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(ctx->
decoder,
194 DXVA2_BitStreamDateBufferType)))
199 memset(bs, 0,
sizeof(*bs));
200 bs->CompressedBufferType = DXVA2_BitStreamDateBufferType;
201 bs->DataSize = data_size;
203 assert((bs->DataSize & 127) == 0);
206 DXVA2_SliceControlBufferType,
207 slice,
sizeof(*slice), bs->NumMBsInBuffer);
261 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
266 #if CONFIG_WMV3_DXVA2_HWACCEL
268 .
name =
"wmv3_dxva2",