23 #include "config_components.h"
42 DXVA_PicParams_AV1
pp;
60 DXVA_PicParams_AV1 *pp)
70 memset(pp, 0,
sizeof(*pp));
72 pp->width = avctx->
width;
73 pp->height = avctx->
height;
86 pp->tiles.context_update_id =
frame_header->context_update_tile_id;
88 for (
i = 0;
i < pp->tiles.cols;
i++)
91 for (
i = 0;
i < pp->tiles.rows;
i++)
99 pp->coding.warped_motion =
frame_header->allow_warped_motion;
102 pp->coding.screen_content_tools =
frame_header->allow_screen_content_tools;
108 pp->coding.high_precision_mv =
frame_header->allow_high_precision_mv;
109 pp->coding.switchable_motion_mode =
frame_header->is_motion_mode_switchable;
111 pp->coding.disable_frame_end_update_cdf =
frame_header->disable_frame_end_update_cdf;
112 pp->coding.disable_cdf_update =
frame_header->disable_cdf_update;
113 pp->coding.reference_mode =
frame_header->reference_select;
115 pp->coding.reduced_tx_set =
frame_header->reduced_tx_set;
118 pp->coding.use_ref_frame_mvs =
frame_header->use_ref_frame_mvs;
120 pp->coding.reference_frame_update = 1;
125 pp->format.showable_frame =
frame_header->showable_frame;
131 pp->primary_ref_frame =
frame_header->primary_ref_frame;
135 memset(pp->RefFrameMapTextureIndex, 0xFF,
sizeof(pp->RefFrameMapTextureIndex));
142 pp->frame_refs[
i].Index =
ref_frame->
buf[0] ? ref_idx : 0xFF;
147 for (j = 0; j < 6; ++j) {
158 pp->loop_filter.filter_level[0] =
frame_header->loop_filter_level[0];
159 pp->loop_filter.filter_level[1] =
frame_header->loop_filter_level[1];
160 pp->loop_filter.filter_level_u =
frame_header->loop_filter_level[2];
161 pp->loop_filter.filter_level_v =
frame_header->loop_filter_level[3];
162 pp->loop_filter.sharpness_level =
frame_header->loop_filter_sharpness;
163 pp->loop_filter.mode_ref_delta_enabled =
frame_header->loop_filter_delta_enabled;
164 pp->loop_filter.mode_ref_delta_update =
frame_header->loop_filter_delta_update;
165 pp->loop_filter.delta_lf_multi =
frame_header->delta_lf_multi;
166 pp->loop_filter.delta_lf_present =
frame_header->delta_lf_present;
167 pp->loop_filter.delta_lf_res =
frame_header->delta_lf_res;
170 pp->loop_filter.ref_deltas[
i] =
frame_header->loop_filter_ref_deltas[
i];
173 pp->loop_filter.mode_deltas[0] =
frame_header->loop_filter_mode_deltas[0];
174 pp->loop_filter.mode_deltas[1] =
frame_header->loop_filter_mode_deltas[1];
175 pp->loop_filter.frame_restoration_type[0] = remap_lr_type[
frame_header->lr_type[0]];
176 pp->loop_filter.frame_restoration_type[1] = remap_lr_type[
frame_header->lr_type[1]];
177 pp->loop_filter.frame_restoration_type[2] = remap_lr_type[
frame_header->lr_type[2]];
179 pp->loop_filter.log2_restoration_unit_size[0] = uses_lr ? (6 +
frame_header->lr_unit_shift) : 8;
180 pp->loop_filter.log2_restoration_unit_size[1] = uses_lr ? (6 +
frame_header->lr_unit_shift -
frame_header->lr_uv_shift) : 8;
181 pp->loop_filter.log2_restoration_unit_size[2] = uses_lr ? (6 +
frame_header->lr_unit_shift -
frame_header->lr_uv_shift) : 8;
184 pp->quantization.delta_q_present =
frame_header->delta_q_present;
185 pp->quantization.delta_q_res =
frame_header->delta_q_res;
186 pp->quantization.base_qindex =
frame_header->base_q_idx;
187 pp->quantization.y_dc_delta_q =
frame_header->delta_q_y_dc;
188 pp->quantization.u_dc_delta_q =
frame_header->delta_q_u_dc;
189 pp->quantization.v_dc_delta_q =
frame_header->delta_q_v_dc;
190 pp->quantization.u_ac_delta_q =
frame_header->delta_q_u_ac;
191 pp->quantization.v_ac_delta_q =
frame_header->delta_q_v_ac;
199 for (
i = 0;
i < 8;
i++) {
200 pp->cdef.y_strengths[
i].primary =
frame_header->cdef_y_pri_strength[
i];
201 pp->cdef.y_strengths[
i].secondary =
frame_header->cdef_y_sec_strength[
i];
202 pp->cdef.uv_strengths[
i].primary =
frame_header->cdef_uv_pri_strength[
i];
203 pp->cdef.uv_strengths[
i].secondary =
frame_header->cdef_uv_sec_strength[
i];
210 pp->segmentation.enabled =
frame_header->segmentation_enabled;
211 pp->segmentation.update_map =
frame_header->segmentation_update_map;
212 pp->segmentation.update_data =
frame_header->segmentation_update_data;
213 pp->segmentation.temporal_update =
frame_header->segmentation_temporal_update;
216 pp->segmentation.feature_mask[
i].mask |=
frame_header->feature_enabled[
i][j] << j;
217 pp->segmentation.feature_data[
i][j] =
frame_header->feature_value[
i][j];
223 pp->film_grain.apply_grain = 1;
233 pp->film_grain.grain_seed = film_grain->
grain_seed;
249 for (
i = 0;
i < 24;
i++) {
252 for (
i = 0;
i < 25;
i++) {
256 pp->film_grain.cb_mult = film_grain->
cb_mult;
258 pp->film_grain.cr_mult = film_grain->
cr_mult;
260 pp->film_grain.cb_offset = film_grain->
cb_offset;
261 pp->film_grain.cr_offset = film_grain->
cr_offset;
262 pp->film_grain.cr_offset = film_grain->
cr_offset;
279 if (!DXVA_CONTEXT_VALID(avctx,
ctx))
309 if (ctx_pic->
tile_count ==
h->tg_end -
h->tg_start + 1) {
313 for (uint32_t tile_num = 0; tile_num < ctx_pic->
tile_count; tile_num++) {
314 ctx_pic->
tiles[tile_num].DataOffset =
h->tile_group_info[tile_num].tile_offset;
315 ctx_pic->
tiles[tile_num].DataSize =
h->tile_group_info[tile_num].tile_size;
316 ctx_pic->
tiles[tile_num].row =
h->tile_group_info[tile_num].tile_row;
317 ctx_pic->
tiles[tile_num].column =
h->tile_group_info[tile_num].tile_column;
318 ctx_pic->
tiles[tile_num].anchor_frame = 0xFF;
334 for (uint32_t tile_num =
h->tg_start; tile_num <= h->tg_end; tile_num++) {
335 ctx_pic->
tiles[tile_num].DataOffset = ctx_pic->
bitstream_size +
h->tile_group_info[tile_num].tile_offset;
336 ctx_pic->
tiles[tile_num].DataSize =
h->tile_group_info[tile_num].tile_size;
337 ctx_pic->
tiles[tile_num].row =
h->tile_group_info[tile_num].tile_row;
338 ctx_pic->
tiles[tile_num].column =
h->tile_group_info[tile_num].tile_column;
339 ctx_pic->
tiles[tile_num].anchor_frame = 0xFF;
362 type = D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
366 &dxva_size, &dxva_data_ptr)))
372 type = DXVA2_BitStreamDateBufferType;
375 &dxva_data_ptr, &dxva_size)))
380 dxva_data = dxva_data_ptr;
408 D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = bs;
409 memset(dsc11, 0,
sizeof(*dsc11));
410 dsc11->BufferType =
type;
412 dsc11->NumMBsInBuffer = 0;
414 type = D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL;
419 DXVA2_DecodeBufferDesc *dsc2 = bs;
420 memset(dsc2, 0,
sizeof(*dsc2));
421 dsc2->CompressedBufferType =
type;
423 dsc2->NumMBsInBuffer = 0;
425 type = DXVA2_SliceControlBufferType;
443 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
455 ctx->bitstream_allocated = 0;
460 #if CONFIG_AV1_DXVA2_HWACCEL
462 .
p.
name =
"av1_dxva2",
477 #if CONFIG_AV1_D3D11VA_HWACCEL
479 .
p.
name =
"av1_d3d11va",
494 #if CONFIG_AV1_D3D11VA2_HWACCEL
496 .
p.
name =
"av1_d3d11va2",