39 DXVA_PicParams_AV1
pp;
57 DXVA_PicParams_AV1 *pp)
67 memset(pp, 0,
sizeof(*pp));
69 pp->width = avctx->
width;
70 pp->height = avctx->
height;
83 pp->tiles.context_update_id =
frame_header->context_update_tile_id;
85 for (
i = 0;
i < pp->tiles.cols;
i++)
88 for (
i = 0;
i < pp->tiles.rows;
i++)
96 pp->coding.warped_motion =
frame_header->allow_warped_motion;
99 pp->coding.screen_content_tools =
frame_header->allow_screen_content_tools;
105 pp->coding.high_precision_mv =
frame_header->allow_high_precision_mv;
106 pp->coding.switchable_motion_mode =
frame_header->is_motion_mode_switchable;
108 pp->coding.disable_frame_end_update_cdf =
frame_header->disable_frame_end_update_cdf;
109 pp->coding.disable_cdf_update =
frame_header->disable_cdf_update;
110 pp->coding.reference_mode =
frame_header->reference_select;
112 pp->coding.reduced_tx_set =
frame_header->reduced_tx_set;
115 pp->coding.use_ref_frame_mvs =
frame_header->use_ref_frame_mvs;
117 pp->coding.reference_frame_update = 1;
122 pp->format.showable_frame =
frame_header->showable_frame;
128 pp->primary_ref_frame =
frame_header->primary_ref_frame;
132 memset(pp->RefFrameMapTextureIndex, 0xFF,
sizeof(pp->RefFrameMapTextureIndex));
135 AVFrame *ref_frame =
h->ref[ref_idx].tf.f;
137 pp->frame_refs[
i].width = ref_frame->
width;
138 pp->frame_refs[
i].height = ref_frame->
height;
139 pp->frame_refs[
i].Index = ref_frame->
buf[0] ? ref_idx : 0xFF;
144 for (j = 0; j < 6; ++j) {
150 if (ref_frame->
buf[0])
155 pp->loop_filter.filter_level[0] =
frame_header->loop_filter_level[0];
156 pp->loop_filter.filter_level[1] =
frame_header->loop_filter_level[1];
157 pp->loop_filter.filter_level_u =
frame_header->loop_filter_level[2];
158 pp->loop_filter.filter_level_v =
frame_header->loop_filter_level[3];
159 pp->loop_filter.sharpness_level =
frame_header->loop_filter_sharpness;
160 pp->loop_filter.mode_ref_delta_enabled =
frame_header->loop_filter_delta_enabled;
161 pp->loop_filter.mode_ref_delta_update =
frame_header->loop_filter_delta_update;
162 pp->loop_filter.delta_lf_multi =
frame_header->delta_lf_multi;
163 pp->loop_filter.delta_lf_present =
frame_header->delta_lf_present;
164 pp->loop_filter.delta_lf_res =
frame_header->delta_lf_res;
167 pp->loop_filter.ref_deltas[
i] =
frame_header->loop_filter_ref_deltas[
i];
170 pp->loop_filter.mode_deltas[0] =
frame_header->loop_filter_mode_deltas[0];
171 pp->loop_filter.mode_deltas[1] =
frame_header->loop_filter_mode_deltas[1];
172 pp->loop_filter.frame_restoration_type[0] = remap_lr_type[
frame_header->lr_type[0]];
173 pp->loop_filter.frame_restoration_type[1] = remap_lr_type[
frame_header->lr_type[1]];
174 pp->loop_filter.frame_restoration_type[2] = remap_lr_type[
frame_header->lr_type[2]];
176 pp->loop_filter.log2_restoration_unit_size[0] = uses_lr ? (6 +
frame_header->lr_unit_shift) : 8;
177 pp->loop_filter.log2_restoration_unit_size[1] = uses_lr ? (6 +
frame_header->lr_unit_shift -
frame_header->lr_uv_shift) : 8;
178 pp->loop_filter.log2_restoration_unit_size[2] = uses_lr ? (6 +
frame_header->lr_unit_shift -
frame_header->lr_uv_shift) : 8;
181 pp->quantization.delta_q_present =
frame_header->delta_q_present;
182 pp->quantization.delta_q_res =
frame_header->delta_q_res;
183 pp->quantization.base_qindex =
frame_header->base_q_idx;
184 pp->quantization.y_dc_delta_q =
frame_header->delta_q_y_dc;
185 pp->quantization.u_dc_delta_q =
frame_header->delta_q_u_dc;
186 pp->quantization.v_dc_delta_q =
frame_header->delta_q_v_dc;
187 pp->quantization.u_ac_delta_q =
frame_header->delta_q_u_ac;
188 pp->quantization.v_ac_delta_q =
frame_header->delta_q_v_ac;
196 for (
i = 0;
i < 8;
i++) {
197 pp->cdef.y_strengths[
i].primary =
frame_header->cdef_y_pri_strength[
i];
198 pp->cdef.y_strengths[
i].secondary =
frame_header->cdef_y_sec_strength[
i];
199 pp->cdef.uv_strengths[
i].primary =
frame_header->cdef_uv_pri_strength[
i];
200 pp->cdef.uv_strengths[
i].secondary =
frame_header->cdef_uv_sec_strength[
i];
207 pp->segmentation.enabled =
frame_header->segmentation_enabled;
208 pp->segmentation.update_map =
frame_header->segmentation_update_map;
209 pp->segmentation.update_data =
frame_header->segmentation_update_data;
210 pp->segmentation.temporal_update =
frame_header->segmentation_temporal_update;
213 pp->segmentation.feature_mask[
i].mask |=
frame_header->feature_enabled[
i][j] << j;
214 pp->segmentation.feature_data[
i][j] =
frame_header->feature_value[
i][j];
220 pp->film_grain.apply_grain = 1;
230 pp->film_grain.grain_seed = film_grain->
grain_seed;
246 for (
i = 0;
i < 24;
i++) {
249 for (
i = 0;
i < 25;
i++) {
253 pp->film_grain.cb_mult = film_grain->
cb_mult;
255 pp->film_grain.cr_mult = film_grain->
cr_mult;
257 pp->film_grain.cb_offset = film_grain->
cb_offset;
258 pp->film_grain.cr_offset = film_grain->
cr_offset;
259 pp->film_grain.cr_offset = film_grain->
cr_offset;
276 if (!DXVA_CONTEXT_VALID(avctx,
ctx))
306 if (ctx_pic->
tile_count ==
h->tg_end -
h->tg_start + 1) {
310 for (uint32_t tile_num = 0; tile_num < ctx_pic->
tile_count; tile_num++) {
311 ctx_pic->
tiles[tile_num].DataOffset =
h->tile_group_info[tile_num].tile_offset;
312 ctx_pic->
tiles[tile_num].DataSize =
h->tile_group_info[tile_num].tile_size;
313 ctx_pic->
tiles[tile_num].row =
h->tile_group_info[tile_num].tile_row;
314 ctx_pic->
tiles[tile_num].column =
h->tile_group_info[tile_num].tile_column;
315 ctx_pic->
tiles[tile_num].anchor_frame = 0xFF;
331 for (uint32_t tile_num =
h->tg_start; tile_num <= h->tg_end; tile_num++) {
332 ctx_pic->
tiles[tile_num].DataOffset = ctx_pic->
bitstream_size +
h->tile_group_info[tile_num].tile_offset;
333 ctx_pic->
tiles[tile_num].DataSize =
h->tile_group_info[tile_num].tile_size;
334 ctx_pic->
tiles[tile_num].row =
h->tile_group_info[tile_num].tile_row;
335 ctx_pic->
tiles[tile_num].column =
h->tile_group_info[tile_num].tile_column;
336 ctx_pic->
tiles[tile_num].anchor_frame = 0xFF;
359 type = D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
363 &dxva_size, &dxva_data_ptr)))
369 type = DXVA2_BitStreamDateBufferType;
372 &dxva_data_ptr, &dxva_size)))
377 dxva_data = dxva_data_ptr;
405 D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = bs;
406 memset(dsc11, 0,
sizeof(*dsc11));
407 dsc11->BufferType =
type;
409 dsc11->NumMBsInBuffer = 0;
411 type = D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL;
416 DXVA2_DecodeBufferDesc *dsc2 = bs;
417 memset(dsc2, 0,
sizeof(*dsc2));
418 dsc2->CompressedBufferType =
type;
420 dsc2->NumMBsInBuffer = 0;
422 type = DXVA2_SliceControlBufferType;
440 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
452 ctx->bitstream_allocated = 0;
457 #if CONFIG_AV1_DXVA2_HWACCEL
474 #if CONFIG_AV1_D3D11VA_HWACCEL
476 .
name =
"av1_d3d11va",
491 #if CONFIG_AV1_D3D11VA2_HWACCEL
493 .
name =
"av1_d3d11va2",