33 DXVA_PictureParameters
pp;
42 DXVA_PictureParameters *pp)
56 memset(pp, 0,
sizeof(*pp));
57 pp->wDecodedPictureIndex =
62 pp->wForwardRefPictureIndex = 0xffff;
66 pp->wBackwardRefPictureIndex = 0xffff;
69 pp->wPicWidthInMBminus1 = avctx->
width - 1;
70 pp->wPicHeightInMBminus1= avctx->
height - 1;
73 pp->wPicWidthInMBminus1 = s->
mb_width - 1;
74 pp->wPicHeightInMBminus1= s->
mb_height - 1;
76 pp->bMacroblockWidthMinus1 = 15;
77 pp->bMacroblockHeightMinus1 = 15;
78 pp->bBlockWidthMinus1 = 7;
79 pp->bBlockHeightMinus1 = 7;
82 pp->bPicStructure |= 0x01;
84 pp->bPicStructure |= 0x02;
88 pp->bBidirectionalAveragingMode = (1 << 7) |
89 ((DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) != 0) << 6) |
90 ((DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) != 0) << 5) |
98 DXVA_CONTEXT_REPORT_ID(avctx, ctx)++;
99 if (DXVA_CONTEXT_REPORT_ID(avctx, ctx) >= (1 << 16))
100 DXVA_CONTEXT_REPORT_ID(avctx, ctx) = 1;
101 pp->bPicScanFixed = DXVA_CONTEXT_REPORT_ID(avctx, ctx) >> 8;
102 pp->bPicScanMethod = DXVA_CONTEXT_REPORT_ID(avctx, ctx) & 0xff;
103 pp->bPicReadbackRequests = 0;
104 pp->bRcontrol = v->
rnd;
118 pp->bPicDeblocked = ((!pp->bPicBackwardPrediction && v->
overlap) << 6) |
140 pp->bReservedBits = v->
pq;
144 pp->wBitstreamPCEelements = v->
lumshift;
146 pp->wBitstreamFcodes = 32;
147 pp->wBitstreamPCEelements = 0;
155 pp->wBitstreamFcodes = (32 << 8) | 32;
156 pp->wBitstreamPCEelements = 0;
159 pp->bBitstreamConcealmentNeed = 0;
160 pp->bBitstreamConcealmentMethod = 0;
164 unsigned position,
unsigned size)
169 memset(slice, 0,
sizeof(*slice));
170 slice->wHorizontalPosition = 0;
171 slice->wVerticalPosition = s->
mb_y;
172 slice->dwSliceBitsInBuffer = 8 *
size;
173 slice->dwSliceDataLocation = position;
174 slice->bStartCodeBitOffset = 0;
178 slice->wQuantizerScaleCode = v->
pq;
179 slice->wBadSliceChopping = 0;
191 DXVA_SliceInfo *
slice = &ctx_pic->
si;
195 const unsigned slice_size = slice->dwSliceBitsInBuffer / 8;
196 const unsigned padding = 128 - ((start_code_size + slice_size) & 127);
197 const unsigned data_size = start_code_size + slice_size + padding;
207 type = D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
208 if (
FAILED(ID3D11VideoContext_GetDecoderBuffer(D3D11VA_CONTEXT(ctx)->video_context,
209 D3D11VA_CONTEXT(ctx)->decoder,
211 &dxva_size, &dxva_data_ptr)))
217 type = DXVA2_BitStreamDateBufferType;
218 if (
FAILED(IDirectXVideoDecoder_GetBuffer(DXVA2_CONTEXT(ctx)->decoder,
220 &dxva_data_ptr, &dxva_size)))
225 dxva_data = dxva_data_ptr;
226 result = data_size <= dxva_size ? 0 : -1;
228 if (start_code_size > 0) {
229 memcpy(dxva_data, start_code, start_code_size);
233 memcpy(dxva_data + start_code_size,
234 ctx_pic->
bitstream + slice->dwSliceDataLocation, slice_size);
236 memset(dxva_data + start_code_size + slice_size, 0, padding);
237 slice->dwSliceBitsInBuffer = 8 * data_size;
241 if (
FAILED(ID3D11VideoContext_ReleaseDecoderBuffer(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->
decoder, type)))
246 if (
FAILED(IDirectXVideoDecoder_ReleaseBuffer(DXVA2_CONTEXT(ctx)->
decoder, type)))
254 D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = bs;
255 memset(dsc11, 0,
sizeof(*dsc11));
256 dsc11->BufferType =
type;
257 dsc11->DataSize = data_size;
260 type = D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL;
265 DXVA2_DecodeBufferDesc *dsc2 = bs;
266 memset(dsc2, 0,
sizeof(*dsc2));
267 dsc2->CompressedBufferType =
type;
268 dsc2->DataSize = data_size;
271 type = DXVA2_SliceControlBufferType;
274 assert((data_size & 127) == 0);
289 if (DXVA_CONTEXT_DECODER(avctx, ctx) ==
NULL ||
290 DXVA_CONTEXT_CFG(avctx, ctx) ==
NULL ||
291 DXVA_CONTEXT_COUNT(avctx, ctx) <= 0)
336 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
344 #if CONFIG_WMV3_DXVA2_HWACCEL
346 .
name =
"wmv3_dxva2",
357 #if CONFIG_VC1_DXVA2_HWACCEL
370 #if CONFIG_WMV3_D3D11VA_HWACCEL
372 .
name =
"wmv3_d3d11va",
383 #if CONFIG_VC1_D3D11VA_HWACCEL
385 .
name =
"vc1_d3d11va",
in the bitstream is reported as 00b
uint8_t bfraction_lut_index
Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[])
uint8_t lumscale2
for interlaced field P picture
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)
int refdist
distance of the current picture from reference
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))
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
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 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, ...
static const uint8_t start_code[]
int vstransform
variable-size [48]x[48] transform type + info
in the bitstream is reported as 10b
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)