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",
#define PICT_BOTTOM_FIELD
in the bitstream is reported as 00b
AV_WL32 AV_WL24 AV_WL16 AV_RB32
int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s, const void *pp, unsigned pp_size, const void *qm, unsigned qm_size, int(*commit_bs_si)(AVCodecContext *, DXVA2_DecodeBufferDesc *bs, DXVA2_DecodeBufferDesc *slice))
void * hwaccel_picture_private
hardware accelerator private data (Libav-allocated)
int extended_mv
Ext MV in P/B (not in Simple)
int broadcast
TFF/RFF present.
uint8_t rangeredfrm
Frame decoding info for S/M profiles only.
int fastuvmc
Rounding of qpel vector to hpel ? (not in Simple)
const DXVA2_ConfigPictureDecode * cfg
DXVA2 configuration used to create the decoder.
unsigned surface_count
The number of surface in the surface array.
DXVA_SliceInfo slice[MAX_SLICES]
void * hwaccel_context
Hardware accelerator context.
int panscanflag
NUMPANSCANWIN, TOPLEFT{X,Y}, BOTRIGHT{X,Y} present.
int interlace
Progressive/interlaced (RPTFTM syntax element)
int resync_marker
could this stream contain resync markers
int profile
Sequence header data for all Profiles TODO: choose between ints, uint8_ts and monobit flags...
static int get_bits_count(const GetBitContext *s)
int refdist_flag
REFDIST syntax element present in II, IP, PI or PP field picture headers.
int mb_height
number of MBs horizontally & vertically
int psf
Progressive Segmented Frame.
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer. ...
in the bitstream is reported as 11b
#define IS_MARKER(state, i, buf, buf_size)
int quarter_sample
1->qpel, 0->half pel ME/MC
int postprocflag
Per-frame processing suggestion flag present.
const char * name
Name of the hardware accelerated codec.
int tfcntrflag
TFCNTR present.
int width
picture width / height.
uint8_t mv_mode
Frame decoding info for all profiles.
static int start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
Picture * current_picture_ptr
pointer to the current picture
int ff_dxva2_commit_buffer(AVCodecContext *avctx, struct dxva_context *ctx, DXVA2_DecodeBufferDesc *dsc, unsigned type, const void *data, unsigned size, unsigned mb_count)
uint8_t lumscale
Luma compensation parameters.
static void fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, unsigned size)
unsigned report_id
Private to the Libav AVHWAccel implementation.
int first_field
is 1 for the first field of a field picture 0 otherwise
int rangered
RANGEREDFRM (range reduction) syntax element present at frame level.
int finterpflag
INTERPFRM present.
unsigned ff_dxva2_get_surface_index(const struct dxva_context *ctx, const Picture *picture)
int chromaformat
2bits, 2=4:2:0, only defined
static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, DXVA2_DecodeBufferDesc *bs, DXVA2_DecodeBufferDesc *sc)
int multires
frame-level RESPIC syntax element present
main external API structure.
int extended_dmv
Additional extended dmv range at P/B frame-level.
static int end_frame(AVCodecContext *avctx)
int quantizer_mode
2bits, quantizer mode used for sequence, see QUANT_*
int max_b_frames
max number of b-frames for encoding
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
int vstransform
variable-size [48]x[48] transform type + info
const uint8_t * bitstream
enum FrameCodingMode fcm
Frame decoding info for Advanced profile.
Picture last_picture
copy of the previous picture structure.
Picture next_picture
copy of the next picture structure.
AVHWAccel ff_vc1_dxva2_hwaccel
int dquant
How qscale varies with MBs, 2bits (not in Simple)
uint8_t mv_mode2
Secondary MV coding mode (B frames)
IDirectXVideoDecoder * decoder
DXVA2 decoder object.
static void fill_picture_parameters(AVCodecContext *avctx, struct dxva_context *ctx, const VC1Context *v, DXVA_PictureParameters *pp)
static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
This structure is used to provides the necessary configurations and data to the DXVA2 Libav HWAccel i...