28 #define MAX_SLICES 1024
31 DXVA_PictureParameters
pp;
41 DXVA_PictureParameters *pp)
55 memset(pp, 0,
sizeof(*pp));
56 pp->wDecodedPictureIndex =
61 pp->wForwardRefPictureIndex = 0xffff;
65 pp->wBackwardRefPictureIndex = 0xffff;
68 pp->wPicWidthInMBminus1 = avctx->
width - 1;
69 pp->wPicHeightInMBminus1= avctx->
height - 1;
72 pp->wPicWidthInMBminus1 = s->
mb_width - 1;
73 pp->wPicHeightInMBminus1= s->
mb_height - 1;
75 pp->bMacroblockWidthMinus1 = 15;
76 pp->bMacroblockHeightMinus1 = 15;
77 pp->bBlockWidthMinus1 = 7;
78 pp->bBlockHeightMinus1 = 7;
81 pp->bPicStructure |= 0x01;
83 pp->bPicStructure |= 0x02;
87 pp->bBidirectionalAveragingMode = (1 << 7) |
88 ((DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) != 0) << 6) |
89 ((DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) != 0) << 5) |
97 DXVA_CONTEXT_REPORT_ID(avctx, ctx)++;
98 if (DXVA_CONTEXT_REPORT_ID(avctx, ctx) >= (1 << 16))
99 DXVA_CONTEXT_REPORT_ID(avctx, ctx) = 1;
100 pp->bPicScanFixed = DXVA_CONTEXT_REPORT_ID(avctx, ctx) >> 8;
101 pp->bPicScanMethod = DXVA_CONTEXT_REPORT_ID(avctx, ctx) & 0xff;
102 pp->bPicReadbackRequests = 0;
103 pp->bRcontrol = v->
rnd;
117 pp->bPicDeblocked = ((!pp->bPicBackwardPrediction && v->
overlap) << 6) |
139 pp->bReservedBits = v->
pq;
143 pp->wBitstreamPCEelements = v->
lumshift;
145 pp->wBitstreamFcodes = 32;
146 pp->wBitstreamPCEelements = 0;
154 pp->wBitstreamFcodes = (32 << 8) | 32;
155 pp->wBitstreamPCEelements = 0;
158 pp->bBitstreamConcealmentNeed = 0;
159 pp->bBitstreamConcealmentMethod = 0;
163 unsigned position,
unsigned size)
168 memset(slice, 0,
sizeof(*slice));
169 slice->wHorizontalPosition = 0;
170 slice->wVerticalPosition = s->
mb_y;
171 slice->dwSliceBitsInBuffer = 8 *
size;
172 slice->dwSliceDataLocation = position;
173 slice->bStartCodeBitOffset = 0;
178 slice->wQuantizerScaleCode = v->
pq;
179 slice->wBadSliceChopping = 0;
204 type = D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
208 &dxva_size, &dxva_data_ptr)))
214 type = DXVA2_BitStreamDateBufferType;
217 &dxva_data_ptr, &dxva_size)))
222 dxva_data = dxva_data_ptr;
224 end = dxva_data + dxva_size;
227 unsigned position,
size;
228 slice = &ctx_pic->
slice[i];
229 position = slice->dwSliceDataLocation;
230 size = slice->dwSliceBitsInBuffer / 8;
231 if (start_code_size + size > end - current) {
235 slice->dwSliceDataLocation = current - dxva_data;
238 slice->wNumberMBsInSlice =
239 slice[1].wNumberMBsInSlice - slice[0].wNumberMBsInSlice;
241 slice->wNumberMBsInSlice =
242 mb_count - slice[0].wNumberMBsInSlice;
245 if (start_code_size) {
246 memcpy(current, start_code, start_code_size);
252 current += start_code_size;
253 slice->dwSliceBitsInBuffer += start_code_size * 8;
256 memcpy(current, &ctx_pic->
bitstream[position], size);
259 padding =
FFMIN(128 - ((current - dxva_data) & 127), end - current);
260 if (slice && padding > 0) {
261 memset(current, 0, padding);
263 slice->dwSliceBitsInBuffer += padding * 8;
281 D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = bs;
282 memset(dsc11, 0,
sizeof(*dsc11));
283 dsc11->BufferType =
type;
284 dsc11->DataSize = current - dxva_data;
285 dsc11->NumMBsInBuffer = mb_count;
287 type = D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL;
292 DXVA2_DecodeBufferDesc *dsc2 = bs;
293 memset(dsc2, 0,
sizeof(*dsc2));
294 dsc2->CompressedBufferType =
type;
295 dsc2->DataSize = current - dxva_data;
296 dsc2->NumMBsInBuffer = mb_count;
298 type = DXVA2_SliceControlBufferType;
317 if (!DXVA_CONTEXT_VALID(avctx, ctx))
369 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
377 #if CONFIG_WMV3_DXVA2_HWACCEL
379 .
name =
"wmv3_dxva2",
394 #if CONFIG_VC1_DXVA2_HWACCEL
411 #if CONFIG_WMV3_D3D11VA_HWACCEL
413 .
name =
"wmv3_d3d11va",
428 #if CONFIG_WMV3_D3D11VA2_HWACCEL
430 .
name =
"wmv3_d3d11va2",
445 #if CONFIG_VC1_D3D11VA_HWACCEL
447 .
name =
"vc1_d3d11va",
462 #if CONFIG_VC1_D3D11VA2_HWACCEL
464 .
name =
"vc1_d3d11va2",
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)
#define D3D11VA_CONTEXT(ctx)
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
int refdist
distance of the current picture from reference
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
int ff_dxva2_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
int ff_dxva2_decode_uninit(AVCodecContext *avctx)
int panscanflag
NUMPANSCANWIN, TOPLEFT{X,Y}, BOTRIGHT{X,Y} present.
static av_cold int end(AVCodecContext *avctx)
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
DXVA_SliceInfo slice[MAX_SLICES]
static int dxva2_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
int psf
Progressive Segmented Frame.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int overlap
overlapped transforms in use
in the bitstream is reported as 11b
const AVHWAccel ff_vc1_d3d11va2_hwaccel
int ff_dxva2_is_d3d11(const AVCodecContext *avctx)
#define DXVA2_CONTEXT(ctx)
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 AVHWAccel ff_vc1_d3d11va_hwaccel
const char * name
Name of the hardware accelerated codec.
int tfcntrflag
TFCNTR present.
int field_mode
1 for interlaced field pictures
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.
int ff_dxva2_decode_init(AVCodecContext *avctx)
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.
const AVHWAccel ff_wmv3_d3d11va_hwaccel
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
Hardware surfaces for Direct3D11.
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.
const AVHWAccel ff_wmv3_dxva2_hwaccel
static int dxva2_vc1_end_frame(AVCodecContext *avctx)
Picture next_picture
copy of the next picture structure.
#define DXVA_CONTEXT(avctx)
const AVHWAccel ff_vc1_dxva2_hwaccel
const AVHWAccel ff_wmv3_d3d11va2_hwaccel
HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView p...
int dquant
How qscale varies with MBs, 2 bits (not in Simple)
uint8_t mv_mode2
Secondary MV coding mode (B-frames)