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;
104 pp->bPicDeblocked = ((!pp->bPicBackwardPrediction && v->
overlap) << 6) |
126 pp->bReservedBits = 0;
129 pp->wBitstreamPCEelements = v->
lumshift;
135 pp->bBitstreamConcealmentNeed = 0;
136 pp->bBitstreamConcealmentMethod = 0;
140 unsigned position,
unsigned size)
145 memset(slice, 0,
sizeof(*slice));
146 slice->wHorizontalPosition = 0;
147 slice->wVerticalPosition = s->
mb_y;
148 slice->dwSliceBitsInBuffer = 8 *
size;
149 slice->dwSliceDataLocation = position;
150 slice->bStartCodeBitOffset = 0;
151 slice->bReservedBits = 0;
154 slice->wQuantizerScaleCode = v->
pq;
155 slice->wBadSliceChopping = 0;
159 DXVA2_DecodeBufferDesc *bs,
160 DXVA2_DecodeBufferDesc *sc)
167 DXVA_SliceInfo *
slice = &ctx_pic->
si;
169 static const uint8_t start_code[] = { 0, 0, 1, 0x0d };
171 const unsigned slice_size = slice->dwSliceBitsInBuffer / 8;
172 const unsigned padding = 128 - ((start_code_size + slice_size) & 127);
173 const unsigned data_size = start_code_size + slice_size + padding;
180 DXVA2_BitStreamDateBufferType,
181 (
void **)&dxva_data, &dxva_size)))
184 result = data_size <= dxva_size ? 0 : -1;
186 if (start_code_size > 0) {
187 memcpy(dxva_data, start_code, start_code_size);
191 memcpy(dxva_data + start_code_size,
192 ctx_pic->
bitstream + slice->dwSliceDataLocation, slice_size);
194 memset(dxva_data + start_code_size + slice_size, 0, padding);
195 slice->dwSliceBitsInBuffer = 8 * data_size;
198 DXVA2_BitStreamDateBufferType)))
203 memset(bs, 0,
sizeof(*bs));
204 bs->CompressedBufferType = DXVA2_BitStreamDateBufferType;
205 bs->DataSize = data_size;
207 assert((bs->DataSize & 127) == 0);
210 DXVA2_SliceControlBufferType,
211 slice,
sizeof(*slice), bs->NumMBsInBuffer);
267 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
275 #if CONFIG_WMV3_DXVA2_HWACCEL 277 .
name =
"wmv3_dxva2",
#define PICT_BOTTOM_FIELD
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.
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 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 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
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
#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.
int ff_dxva2_common_end_frame(AVCodecContext *avctx, Picture *pic, const void *pp, unsigned pp_size, const void *qm, unsigned qm_size, int(*commit_bs_si)(AVCodecContext *, DXVA2_DecodeBufferDesc *bs, DXVA2_DecodeBufferDesc *slice))
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.
Picture * current_picture_ptr
pointer to the current picture
void * hwaccel_picture_private
hardware accelerator private data
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 FFmpeg AVHWAccel implementation.
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.
int quantizer_mode
2bits, 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.
the buffer and buffer reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFilterBuffer structures They must not be accessed but through references stored in AVFilterBufferRef structures Several references can point to the same buffer
static int dxva2_vc1_end_frame(AVCodecContext *avctx)
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)
This structure is used to provides the necessary configurations and data to the DXVA2 FFmpeg HWAccel ...