23 #include "config_components.h"
33 DXVA_PicParams_VP9
pp;
47 DXVA_PicParams_VP9 *pp)
55 memset(pp, 0,
sizeof(*pp));
59 pp->profile =
h->h.profile;
60 pp->wFormatAndPictureInfoFlags = ((
h->h.keyframe == 0) << 0) |
61 ((
h->h.invisible == 0) << 1) |
62 (
h->h.errorres << 2) |
66 (
h->h.refreshctx << 6) |
67 (
h->h.parallelmode << 7) |
68 (
h->h.intraonly << 8) |
69 (
h->h.framectxid << 9) |
70 (
h->h.resetctx << 11) |
71 ((
h->h.keyframe ? 0 :
h->h.highprecisionmvs) << 13) |
74 pp->width = avctx->
width;
75 pp->height = avctx->
height;
76 pp->BitDepthMinus8Luma = pixdesc->
comp[0].
depth - 8;
77 pp->BitDepthMinus8Chroma = pixdesc->
comp[1].
depth - 8;
79 pp->interp_filter =
h->h.filtermode ^ (
h->h.filtermode <= 1);
80 pp->Reserved8Bits = 0;
82 for (
i = 0;
i < 8;
i++) {
83 if (
h->refs[
i].f->buf[0]) {
85 pp->ref_frame_coded_width[
i] =
h->refs[
i].f->width;
86 pp->ref_frame_coded_height[
i] =
h->refs[
i].f->height;
88 pp->ref_frame_map[
i].bPicEntry = 0xFF;
91 for (
i = 0;
i < 3;
i++) {
92 uint8_t refidx =
h->h.refidx[
i];
93 if (
h->refs[refidx].f->buf[0])
96 pp->frame_refs[
i].bPicEntry = 0xFF;
98 pp->ref_frame_sign_bias[
i + 1] =
h->h.signbias[
i];
101 pp->filter_level =
h->h.filter.level;
102 pp->sharpness_level =
h->h.filter.sharpness;
104 pp->wControlInfoFlags = (
h->h.lf_delta.enabled << 0) |
105 (
h->h.lf_delta.updated << 1) |
106 (
h->h.use_last_frame_mvs << 2) |
109 for (
i = 0;
i < 4;
i++)
110 pp->ref_deltas[
i] =
h->h.lf_delta.ref[
i];
113 pp->mode_deltas[
i] =
h->h.lf_delta.mode[
i];
115 pp->base_qindex =
h->h.yac_qi;
116 pp->y_dc_delta_q =
h->h.ydc_qdelta;
117 pp->uv_dc_delta_q =
h->h.uvdc_qdelta;
118 pp->uv_ac_delta_q =
h->h.uvac_qdelta;
121 pp->stVP9Segments.wSegmentInfoFlags = (
h->h.segmentation.enabled << 0) |
122 (
h->h.segmentation.update_map << 1) |
123 (
h->h.segmentation.temporal << 2) |
124 (
h->h.segmentation.absolute_vals << 3) |
127 for (
i = 0;
i < 7;
i++)
128 pp->stVP9Segments.tree_probs[
i] =
h->h.segmentation.prob[
i];
130 if (
h->h.segmentation.temporal)
131 for (
i = 0;
i < 3;
i++)
132 pp->stVP9Segments.pred_probs[
i] =
h->h.segmentation.pred_prob[
i];
134 memset(pp->stVP9Segments.pred_probs, 255,
sizeof(pp->stVP9Segments.pred_probs));
136 for (
i = 0;
i < 8;
i++) {
137 pp->stVP9Segments.feature_mask[
i] = (
h->h.segmentation.feat[
i].q_enabled << 0) |
138 (
h->h.segmentation.feat[
i].lf_enabled << 1) |
139 (
h->h.segmentation.feat[
i].ref_enabled << 2) |
140 (
h->h.segmentation.feat[
i].skip_enabled << 3);
142 pp->stVP9Segments.feature_data[
i][0] =
h->h.segmentation.feat[
i].q_val;
143 pp->stVP9Segments.feature_data[
i][1] =
h->h.segmentation.feat[
i].lf_val;
144 pp->stVP9Segments.feature_data[
i][2] =
h->h.segmentation.feat[
i].ref_val;
145 pp->stVP9Segments.feature_data[
i][3] = 0;
148 pp->log2_tile_cols =
h->h.tiling.log2_tile_cols;
149 pp->log2_tile_rows =
h->h.tiling.log2_tile_rows;
151 pp->uncompressed_header_size_byte_aligned =
h->h.uncompressed_header_size;
152 pp->first_partition_size =
h->h.compressed_header_size;
154 pp->StatusReportFeedbackNumber = 1 + DXVA_CONTEXT_REPORT_ID(avctx,
ctx)++;
159 unsigned position,
unsigned size)
161 memset(slice, 0,
sizeof(*slice));
162 slice->BSNALunitDataLocation = position;
163 slice->SliceBytesInBuffer =
size;
164 slice->wBadSliceChopping = 0;
182 type = D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
186 &dxva_size, &dxva_data_ptr)))
192 type = DXVA2_BitStreamDateBufferType;
195 &dxva_data_ptr, &dxva_size)))
200 dxva_data = dxva_data_ptr;
202 if (ctx_pic->
slice.SliceBytesInBuffer > dxva_size) {
207 memcpy(dxva_data, ctx_pic->
bitstream, ctx_pic->
slice.SliceBytesInBuffer);
209 padding =
FFMIN(128 - ((ctx_pic->
slice.SliceBytesInBuffer) & 127), dxva_size - ctx_pic->
slice.SliceBytesInBuffer);
211 memset(dxva_data + ctx_pic->
slice.SliceBytesInBuffer, 0, padding);
212 ctx_pic->
slice.SliceBytesInBuffer += padding;
228 D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = bs;
229 memset(dsc11, 0,
sizeof(*dsc11));
230 dsc11->BufferType =
type;
231 dsc11->DataSize = ctx_pic->
slice.SliceBytesInBuffer;
232 dsc11->NumMBsInBuffer = 0;
234 type = D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL;
239 DXVA2_DecodeBufferDesc *dsc2 = bs;
240 memset(dsc2, 0,
sizeof(*dsc2));
241 dsc2->CompressedBufferType =
type;
242 dsc2->DataSize = ctx_pic->
slice.SliceBytesInBuffer;
243 dsc2->NumMBsInBuffer = 0;
245 type = DXVA2_SliceControlBufferType;
263 if (!DXVA_CONTEXT_VALID(avctx,
ctx))
304 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
310 #if CONFIG_VP9_DXVA2_HWACCEL
312 .
p.
name =
"vp9_dxva2",
327 #if CONFIG_VP9_D3D11VA_HWACCEL
329 .
p.
name =
"vp9_d3d11va",
344 #if CONFIG_VP9_D3D11VA2_HWACCEL
346 .
p.
name =
"vp9_d3d11va2",