33 DXVA_PictureParameters
pp;
42 DXVA_PictureParameters *
pp)
47 memset(pp, 0,
sizeof(*pp));
48 pp->wDecodedPictureIndex =
53 pp->wForwardRefPictureIndex = 0xffff;
57 pp->wBackwardRefPictureIndex = 0xffff;
60 pp->wPicWidthInMBminus1 = avctx->
width - 1;
61 pp->wPicHeightInMBminus1= avctx->
height - 1;
64 pp->wPicWidthInMBminus1 = s->
mb_width - 1;
65 pp->wPicHeightInMBminus1= s->
mb_height - 1;
67 pp->bMacroblockWidthMinus1 = 15;
68 pp->bMacroblockHeightMinus1 = 15;
69 pp->bBlockWidthMinus1 = 7;
70 pp->bBlockHeightMinus1 = 7;
73 pp->bPicStructure |= 0x01;
75 pp->bPicStructure |= 0x02;
79 pp->bBidirectionalAveragingMode = (1 << 7) |
80 ((DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) != 0) << 6) |
81 ((DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) != 0) << 5) |
89 DXVA_CONTEXT_REPORT_ID(avctx, ctx)++;
90 if (DXVA_CONTEXT_REPORT_ID(avctx, ctx) >= (1 << 16))
91 DXVA_CONTEXT_REPORT_ID(avctx, ctx) = 1;
92 pp->bPicScanFixed = DXVA_CONTEXT_REPORT_ID(avctx, ctx) >> 8;
93 pp->bPicScanMethod = DXVA_CONTEXT_REPORT_ID(avctx, ctx) & 0xff;
94 pp->bPicReadbackRequests = 0;
95 pp->bRcontrol = v->
rnd;
109 pp->bPicDeblocked = ((!pp->bPicBackwardPrediction && v->
overlap) << 6) |
131 pp->bReservedBits = 0;
134 pp->wBitstreamPCEelements = v->
lumshift;
140 pp->bBitstreamConcealmentNeed = 0;
141 pp->bBitstreamConcealmentMethod = 0;
145 unsigned position,
unsigned size)
150 memset(slice, 0,
sizeof(*slice));
151 slice->wHorizontalPosition = 0;
152 slice->wVerticalPosition = s->
mb_y;
153 slice->dwSliceBitsInBuffer = 8 *
size;
154 slice->dwSliceDataLocation = position;
155 slice->bStartCodeBitOffset = 0;
156 slice->bReservedBits = 0;
159 slice->wQuantizerScaleCode = v->
pq;
160 slice->wBadSliceChopping = 0;
172 DXVA_SliceInfo *
slice = &ctx_pic->
si;
174 static const uint8_t start_code[] = { 0, 0, 1, 0x0d };
176 const unsigned slice_size = slice->dwSliceBitsInBuffer / 8;
177 const unsigned padding = 128 - ((start_code_size + slice_size) & 127);
178 const unsigned data_size = start_code_size + slice_size + padding;
188 type = D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
189 if (FAILED(ID3D11VideoContext_GetDecoderBuffer(D3D11VA_CONTEXT(ctx)->video_context,
190 D3D11VA_CONTEXT(ctx)->decoder,
192 &dxva_size, &dxva_data_ptr)))
198 type = DXVA2_BitStreamDateBufferType;
199 if (FAILED(IDirectXVideoDecoder_GetBuffer(DXVA2_CONTEXT(ctx)->decoder,
201 &dxva_data_ptr, &dxva_size)))
206 dxva_data = dxva_data_ptr;
207 result = data_size <= dxva_size ? 0 : -1;
209 if (start_code_size > 0)
210 memcpy(dxva_data, start_code, start_code_size);
211 memcpy(dxva_data + start_code_size,
212 ctx_pic->
bitstream + slice->dwSliceDataLocation, slice_size);
214 memset(dxva_data + start_code_size + slice_size, 0, padding);
215 slice->dwSliceBitsInBuffer = 8 * data_size;
219 if (FAILED(ID3D11VideoContext_ReleaseDecoderBuffer(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->
decoder, type)))
224 if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(DXVA2_CONTEXT(ctx)->
decoder, type)))
232 D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = bs;
233 memset(dsc11, 0,
sizeof(*dsc11));
234 dsc11->BufferType = type;
235 dsc11->DataSize = data_size;
238 type = D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL;
243 DXVA2_DecodeBufferDesc *dsc2 = bs;
244 memset(dsc2, 0,
sizeof(*dsc2));
245 dsc2->CompressedBufferType = type;
246 dsc2->DataSize = data_size;
249 type = DXVA2_SliceControlBufferType;
252 assert((data_size & 127) == 0);
267 if (DXVA_CONTEXT_DECODER(avctx, ctx) ==
NULL ||
268 DXVA_CONTEXT_CFG(avctx, ctx) ==
NULL ||
269 DXVA_CONTEXT_COUNT(avctx, ctx) <= 0)
314 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
322 #if CONFIG_WMV3_DXVA2_HWACCEL 324 .
name =
"wmv3_dxva2",
335 #if CONFIG_VC1_DXVA2_HWACCEL 348 #if CONFIG_WMV3_D3D11VA_HWACCEL 350 .
name =
"wmv3_d3d11va",
361 #if CONFIG_VC1_D3D11VA_HWACCEL 363 .
name =
"vc1_d3d11va",
in the bitstream is reported as 00b
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.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int fastuvmc
Rounding of qpel vector to hpel ? (not in Simple)
DXVA_SliceInfo slice[MAX_SLICES]
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
void * hwaccel_context
Hardware accelerator context.
int panscanflag
NUMPANSCANWIN, TOPLEFT{X,Y}, BOTRIGHT{X,Y} present.
int interlace
Progressive/interlaced (RPTFTM syntax element)
int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame, const void *pp, unsigned pp_size, const void *qm, unsigned qm_size, int(*commit_bs_si)(AVCodecContext *, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *slice))
int profile
Sequence header data for all Profiles TODO: choose between ints, uint8_ts and monobit flags...
#define PICT_BOTTOM_FIELD
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
static int dxva2_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
int psf
Progressive Segmented Frame.
int overlap
overlapped transforms in use
in the bitstream is reported as 11b
int quarter_sample
1->qpel, 0->half pel ME/MC
int resync_marker
could this stream contain resync markers
int postprocflag
Per-frame processing suggestion flag present.
static void fill_picture_parameters(AVCodecContext *avctx, AVDXVAContext *ctx, const VC1Context *v, DXVA_PictureParameters *pp)
const char * name
Name of the hardware accelerated codec.
int tfcntrflag
TFCNTR present.
static const chunk_decoder decoder[8]
int width
picture width / height.
uint8_t mv_mode
Frame decoding info for all profiles.
Picture * current_picture_ptr
pointer to the current picture
void * hwaccel_picture_private
Hardware accelerator private data.
uint8_t lumscale
Luma compensation parameters.
static void fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, unsigned size)
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.
int chromaformat
2 bits, 2=4:2:0, only defined
unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, const AVDXVAContext *ctx, const AVFrame *frame)
int multires
frame-level RESPIC syntax element present
main external API structure.
int ff_dxva2_commit_buffer(AVCodecContext *avctx, AVDXVAContext *ctx, DECODER_BUFFER_DESC *dsc, unsigned type, const void *data, unsigned size, unsigned mb_count)
int extended_dmv
Additional extended dmv range at P/B-frame-level.
static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *sc)
int quantizer_mode
2 bits, quantizer mode used for sequence, see QUANT_*
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer. ...
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
static int dxva2_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
const uint8_t * bitstream
enum FrameCodingMode fcm
Frame decoding info for Advanced profile.
Picture last_picture
copy of the previous picture structure.
static int dxva2_vc1_end_frame(AVCodecContext *avctx)
Picture next_picture
copy of the next picture structure.
HW decoding through Direct3D11, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer...
int dquant
How qscale varies with MBs, 2 bits (not in Simple)
uint8_t mv_mode2
Secondary MV coding mode (B-frames)