23 #include "config_components.h"
32 DXVA_PicParams_VP9
pp;
46 DXVA_PicParams_VP9 *pp)
54 memset(pp, 0,
sizeof(*pp));
58 pp->profile =
h->h.profile;
59 pp->wFormatAndPictureInfoFlags = ((
h->h.keyframe == 0) << 0) |
60 ((
h->h.invisible == 0) << 1) |
61 (
h->h.errorres << 2) |
65 (
h->h.refreshctx << 6) |
66 (
h->h.parallelmode << 7) |
67 (
h->h.intraonly << 8) |
68 (
h->h.framectxid << 9) |
69 (
h->h.resetctx << 11) |
70 ((
h->h.keyframe ? 0 :
h->h.highprecisionmvs) << 13) |
73 pp->width = avctx->
width;
74 pp->height = avctx->
height;
75 pp->BitDepthMinus8Luma = pixdesc->
comp[0].
depth - 8;
76 pp->BitDepthMinus8Chroma = pixdesc->
comp[1].
depth - 8;
78 pp->interp_filter =
h->h.filtermode ^ (
h->h.filtermode <= 1);
79 pp->Reserved8Bits = 0;
81 for (
i = 0;
i < 8;
i++) {
82 if (
h->refs[
i].f->buf[0]) {
84 pp->ref_frame_coded_width[
i] =
h->refs[
i].f->width;
85 pp->ref_frame_coded_height[
i] =
h->refs[
i].f->height;
87 pp->ref_frame_map[
i].bPicEntry = 0xFF;
90 for (
i = 0;
i < 3;
i++) {
91 uint8_t refidx =
h->h.refidx[
i];
92 if (
h->refs[refidx].f->buf[0])
95 pp->frame_refs[
i].bPicEntry = 0xFF;
97 pp->ref_frame_sign_bias[
i + 1] =
h->h.signbias[
i];
100 pp->filter_level =
h->h.filter.level;
101 pp->sharpness_level =
h->h.filter.sharpness;
103 pp->wControlInfoFlags = (
h->h.lf_delta.enabled << 0) |
104 (
h->h.lf_delta.updated << 1) |
105 (
h->h.use_last_frame_mvs << 2) |
108 for (
i = 0;
i < 4;
i++)
109 pp->ref_deltas[
i] =
h->h.lf_delta.ref[
i];
112 pp->mode_deltas[
i] =
h->h.lf_delta.mode[
i];
114 pp->base_qindex =
h->h.yac_qi;
115 pp->y_dc_delta_q =
h->h.ydc_qdelta;
116 pp->uv_dc_delta_q =
h->h.uvdc_qdelta;
117 pp->uv_ac_delta_q =
h->h.uvac_qdelta;
120 pp->stVP9Segments.wSegmentInfoFlags = (
h->h.segmentation.enabled << 0) |
121 (
h->h.segmentation.update_map << 1) |
122 (
h->h.segmentation.temporal << 2) |
123 (
h->h.segmentation.absolute_vals << 3) |
126 for (
i = 0;
i < 7;
i++)
127 pp->stVP9Segments.tree_probs[
i] =
h->h.segmentation.prob[
i];
129 if (
h->h.segmentation.temporal)
130 for (
i = 0;
i < 3;
i++)
131 pp->stVP9Segments.pred_probs[
i] =
h->h.segmentation.pred_prob[
i];
133 memset(pp->stVP9Segments.pred_probs, 255,
sizeof(pp->stVP9Segments.pred_probs));
135 for (
i = 0;
i < 8;
i++) {
136 pp->stVP9Segments.feature_mask[
i] = (
h->h.segmentation.feat[
i].q_enabled << 0) |
137 (
h->h.segmentation.feat[
i].lf_enabled << 1) |
138 (
h->h.segmentation.feat[
i].ref_enabled << 2) |
139 (
h->h.segmentation.feat[
i].skip_enabled << 3);
141 pp->stVP9Segments.feature_data[
i][0] =
h->h.segmentation.feat[
i].q_val;
142 pp->stVP9Segments.feature_data[
i][1] =
h->h.segmentation.feat[
i].lf_val;
143 pp->stVP9Segments.feature_data[
i][2] =
h->h.segmentation.feat[
i].ref_val;
144 pp->stVP9Segments.feature_data[
i][3] = 0;
147 pp->log2_tile_cols =
h->h.tiling.log2_tile_cols;
148 pp->log2_tile_rows =
h->h.tiling.log2_tile_rows;
150 pp->uncompressed_header_size_byte_aligned =
h->h.uncompressed_header_size;
151 pp->first_partition_size =
h->h.compressed_header_size;
153 pp->StatusReportFeedbackNumber = 1 + DXVA_CONTEXT_REPORT_ID(avctx,
ctx)++;
158 unsigned position,
unsigned size)
160 memset(slice, 0,
sizeof(*slice));
161 slice->BSNALunitDataLocation = position;
162 slice->SliceBytesInBuffer =
size;
163 slice->wBadSliceChopping = 0;
181 type = D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
185 &dxva_size, &dxva_data_ptr)))
191 type = DXVA2_BitStreamDateBufferType;
194 &dxva_data_ptr, &dxva_size)))
199 dxva_data = dxva_data_ptr;
201 if (ctx_pic->
slice.SliceBytesInBuffer > dxva_size) {
206 memcpy(dxva_data, ctx_pic->
bitstream, ctx_pic->
slice.SliceBytesInBuffer);
208 padding =
FFMIN(128 - ((ctx_pic->
slice.SliceBytesInBuffer) & 127), dxva_size - ctx_pic->
slice.SliceBytesInBuffer);
210 memset(dxva_data + ctx_pic->
slice.SliceBytesInBuffer, 0, padding);
211 ctx_pic->
slice.SliceBytesInBuffer += padding;
227 D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = bs;
228 memset(dsc11, 0,
sizeof(*dsc11));
229 dsc11->BufferType =
type;
230 dsc11->DataSize = ctx_pic->
slice.SliceBytesInBuffer;
231 dsc11->NumMBsInBuffer = 0;
233 type = D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL;
238 DXVA2_DecodeBufferDesc *dsc2 = bs;
239 memset(dsc2, 0,
sizeof(*dsc2));
240 dsc2->CompressedBufferType =
type;
241 dsc2->DataSize = ctx_pic->
slice.SliceBytesInBuffer;
242 dsc2->NumMBsInBuffer = 0;
244 type = DXVA2_SliceControlBufferType;
262 if (!DXVA_CONTEXT_VALID(avctx,
ctx))
303 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
309 #if CONFIG_VP9_DXVA2_HWACCEL
326 #if CONFIG_VP9_D3D11VA_HWACCEL
328 .
name =
"vp9_d3d11va",
343 #if CONFIG_VP9_D3D11VA2_HWACCEL
345 .
name =
"vp9_d3d11va2",