30 DXVA_PicParams_VP9
pp;
39 av_assert0((index & 0x7f) == index && (flag & 0x01) == flag);
40 pic->bPicEntry = index | (flag << 7);
44 DXVA_PicParams_VP9 *
pp)
52 memset(pp, 0,
sizeof(*pp));
57 pp->wFormatAndPictureInfoFlags = ((h->
h.
keyframe == 0) << 0) |
71 pp->width = avctx->
width;
72 pp->height = avctx->
height;
73 pp->BitDepthMinus8Luma = pixdesc->
comp[0].
depth - 8;
74 pp->BitDepthMinus8Chroma = pixdesc->
comp[1].
depth - 8;
77 pp->Reserved8Bits = 0;
79 for (i = 0; i < 8; i++) {
82 pp->ref_frame_coded_width[i] = h->
refs[i].
f->
width;
83 pp->ref_frame_coded_height[i] = h->
refs[i].
f->
height;
85 pp->ref_frame_map[i].bPicEntry = 0xFF;
88 for (i = 0; i < 3; i++) {
93 pp->frame_refs[i].bPicEntry = 0xFF;
95 pp->ref_frame_sign_bias[i + 1] = h->
h.
signbias[i];
106 for (i = 0; i < 4; i++)
109 for (i = 0; i < 2; i++)
124 for (i = 0; i < 7; i++)
128 for (i = 0; i < 3; i++)
131 memset(pp->stVP9Segments.pred_probs, 255,
sizeof(pp->stVP9Segments.pred_probs));
133 for (i = 0; i < 8; i++) {
142 pp->stVP9Segments.feature_data[i][3] = 0;
151 pp->StatusReportFeedbackNumber = 1 + DXVA_CONTEXT_REPORT_ID(avctx, ctx)++;
156 unsigned position,
unsigned size)
158 memset(slice, 0,
sizeof(*slice));
159 slice->BSNALunitDataLocation = position;
160 slice->SliceBytesInBuffer =
size;
161 slice->wBadSliceChopping = 0;
179 type = D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
183 &dxva_size, &dxva_data_ptr)))
189 type = DXVA2_BitStreamDateBufferType;
192 &dxva_data_ptr, &dxva_size)))
197 dxva_data = dxva_data_ptr;
199 if (ctx_pic->
slice.SliceBytesInBuffer > dxva_size) {
204 memcpy(dxva_data, ctx_pic->
bitstream, ctx_pic->
slice.SliceBytesInBuffer);
206 padding =
FFMIN(128 - ((ctx_pic->
slice.SliceBytesInBuffer) & 127), dxva_size - ctx_pic->
slice.SliceBytesInBuffer);
208 memset(dxva_data + ctx_pic->
slice.SliceBytesInBuffer, 0, padding);
209 ctx_pic->
slice.SliceBytesInBuffer += padding;
225 D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = bs;
226 memset(dsc11, 0,
sizeof(*dsc11));
227 dsc11->BufferType =
type;
228 dsc11->DataSize = ctx_pic->
slice.SliceBytesInBuffer;
229 dsc11->NumMBsInBuffer = 0;
231 type = D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL;
236 DXVA2_DecodeBufferDesc *dsc2 = bs;
237 memset(dsc2, 0,
sizeof(*dsc2));
238 dsc2->CompressedBufferType =
type;
239 dsc2->DataSize = ctx_pic->
slice.SliceBytesInBuffer;
240 dsc2->NumMBsInBuffer = 0;
242 type = DXVA2_SliceControlBufferType;
260 if (!DXVA_CONTEXT_VALID(avctx, ctx))
301 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
307 #if CONFIG_VP9_DXVA2_HWACCEL 324 #if CONFIG_VP9_D3D11VA_HWACCEL 326 .
name =
"vp9_d3d11va",
341 #if CONFIG_VP9_D3D11VA2_HWACCEL 343 .
name =
"vp9_d3d11va2",
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *sc)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
#define D3D11VA_CONTEXT(ctx)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static void fill_slice_short(DXVA_Slice_VPx_Short *slice, unsigned position, unsigned size)
int ff_dxva2_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
int ff_dxva2_decode_uninit(AVCodecContext *avctx)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
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))
const AVHWAccel ff_vp9_d3d11va2_hwaccel
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
const uint8_t * bitstream
int ff_dxva2_is_d3d11(const AVCodecContext *avctx)
#define DXVA2_CONTEXT(ctx)
void * hwaccel_picture_private
simple assert() macros that are a bit more flexible than ISO C assert().
const char * name
Name of the hardware accelerated codec.
static const chunk_decoder decoder[8]
int width
picture width / height.
int ff_dxva2_decode_init(AVCodecContext *avctx)
static void fill_picture_entry(DXVA_PicEntry_VPx *pic, unsigned index, unsigned flag)
unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, const AVDXVAContext *ctx, const AVFrame *frame)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
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)
static int fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, const VP9SharedContext *h, DXVA_PicParams_VP9 *pp)
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer. ...
Hardware surfaces for Direct3D11.
const AVHWAccel ff_vp9_dxva2_hwaccel
static int dxva2_vp9_end_frame(AVCodecContext *avctx)
DXVA_Slice_VPx_Short slice
static int dxva2_vp9_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
#define DXVA_CONTEXT(avctx)
static int dxva2_vp9_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
const AVHWAccel ff_vp9_d3d11va_hwaccel
HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView p...
int depth
Number of bits in the component.
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.