Lines Matching refs:dxva
170 …MPP_RET vdpu_av1d_filtermem_alloc(Av1dHalCtx *p_hal, VdpuAv1dRegCtx *ctx, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_filtermem_alloc() argument
173 RK_U32 pic_height = MPP_ALIGN(dxva->height, 64); in vdpu_av1d_filtermem_alloc()
177 RK_U32 num_tile_cols = 1 << dxva->tile_cols_log2;//dxva->tiles.cols; in vdpu_av1d_filtermem_alloc()
678 static RK_S32 GetRelativeDist(DXVA_PicParams_AV1 *dxva, RK_S32 a, RK_S32 b) in GetRelativeDist() argument
680 if (!dxva->order_hint_bits) return 0; in GetRelativeDist()
681 const RK_S32 bits = dxva->order_hint_bits - 1; in GetRelativeDist()
693 ref_offset[0] = GetRelativeDist(dxva, dxva->frame_refs[idx].order_hint, \
694 dxva->frame_refs[idx].lst_frame_offset); \
695 ref_offset[1] = GetRelativeDist(dxva, dxva->frame_refs[idx].order_hint, \
696 dxva->frame_refs[idx].lst2_frame_offset); \
697 ref_offset[2] = GetRelativeDist(dxva, dxva->frame_refs[idx].order_hint, \
698 dxva->frame_refs[idx].lst3_frame_offset); \
699 ref_offset[3] = GetRelativeDist(dxva, dxva->frame_refs[idx].order_hint, \
700 dxva->frame_refs[idx].gld_frame_offset); \
701 ref_offset[4] = GetRelativeDist(dxva, dxva->frame_refs[idx].order_hint, \
702 dxva->frame_refs[idx].bwd_frame_offset); \
703 ref_offset[5] = GetRelativeDist(dxva, dxva->frame_refs[idx].order_hint, \
704 dxva->frame_refs[idx].alt2_frame_offset); \
705 ref_offset[6] = GetRelativeDist(dxva, dxva->frame_refs[idx].order_hint, \
706 dxva->frame_refs[idx].alt_frame_offset); \
735 static void set_frame_sign_bias(Av1dHalCtx *p_hal, DXVA_PicParams_AV1 *dxva) in set_frame_sign_bias() argument
739 if (!dxva->order_hint_bits || dxva->format.frame_type == AV1_FRAME_INTRA_ONLY || in set_frame_sign_bias()
740 dxva->format.frame_type == AV1_FRAME_KEY) { in set_frame_sign_bias()
749 if (dxva->frame_refs[i].Index >= 0) { in set_frame_sign_bias()
750 RK_S32 ref_frame_offset = dxva->frame_refs[i].order_hint; in set_frame_sign_bias()
751 RK_S32 rel_off = GetRelativeDist(dxva, ref_frame_offset, dxva->order_hint); in set_frame_sign_bias()
754 i, dxva->order_hint, ref_frame_offset); in set_frame_sign_bias()
759 static void vdpu_av1d_set_prob(Av1dHalCtx *p_hal, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_set_prob() argument
766 memcpy(prob_base, dxva->cdfs, sizeof(AV1CDFs)); in vdpu_av1d_set_prob()
767 if (dxva->format.frame_type == AV1_FRAME_INTRA_ONLY || in vdpu_av1d_set_prob()
768 dxva->format.frame_type == AV1_FRAME_KEY) { in vdpu_av1d_set_prob()
770 memcpy(prob_base + mv_cdf_offset, dxva->cdfs_ndvc, sizeof(MvCDFs)); in vdpu_av1d_set_prob()
778 …id vdpu_av1d_set_reference_frames(Av1dHalCtx *p_hal, VdpuAv1dRegCtx *ctx, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_set_reference_frames() argument
793 if (!dxva->coding.intrabc) { in vdpu_av1d_set_reference_frames()
795 if (dxva->frame_refs[i].Index >= 0) in vdpu_av1d_set_reference_frames()
796 ref_count[dxva->frame_refs[i].Index]++; in vdpu_av1d_set_reference_frames()
806 cur_width = dxva->width; in vdpu_av1d_set_reference_frames()
807 cur_height = dxva->height; in vdpu_av1d_set_reference_frames()
809 set_frame_sign_bias(p_hal, dxva); in vdpu_av1d_set_reference_frames()
814 if (dxva->coding.intrabc) { in vdpu_av1d_set_reference_frames()
815 idx = dxva->CurrPicTextureIndex; in vdpu_av1d_set_reference_frames()
819 tmp1 = dxva->frame_refs[ref].width; in vdpu_av1d_set_reference_frames()
820 tmp2 = dxva->frame_refs[ref].height; in vdpu_av1d_set_reference_frames()
821 if (dxva->frame_refs[ref].Index > 0) { in vdpu_av1d_set_reference_frames()
822 idx = dxva->frame_refs[ref].Index; in vdpu_av1d_set_reference_frames()
859 regs->swreg184.sw_ref0_gm_mode = dxva->frame_refs[0].wmtype; in vdpu_av1d_set_reference_frames()
860 regs->swreg185.sw_ref1_gm_mode = dxva->frame_refs[1].wmtype; in vdpu_av1d_set_reference_frames()
861 regs->swreg186.sw_ref2_gm_mode = dxva->frame_refs[2].wmtype; in vdpu_av1d_set_reference_frames()
862 regs->swreg187.sw_ref3_gm_mode = dxva->frame_refs[3].wmtype; in vdpu_av1d_set_reference_frames()
863 regs->swreg188.sw_ref4_gm_mode = dxva->frame_refs[4].wmtype; in vdpu_av1d_set_reference_frames()
864 regs->swreg257.sw_ref5_gm_mode = dxva->frame_refs[5].wmtype; in vdpu_av1d_set_reference_frames()
865 regs->swreg262.sw_ref6_gm_mode = dxva->frame_refs[6].wmtype; in vdpu_av1d_set_reference_frames()
868 if (dxva->coding.intrabc) { in vdpu_av1d_set_reference_frames()
869 ctx->prev_out_buffer_i = dxva->CurrPicTextureIndex; in vdpu_av1d_set_reference_frames()
871 ctx->prev_out_buffer_i = dxva->frame_refs[0].Index; // LAST in vdpu_av1d_set_reference_frames()
882 RK_S32 cur_frame_offset = dxva->order_hint; in vdpu_av1d_set_reference_frames()
888 RK_S32 cur_mi_cols = (dxva->width + 7) >> 3; in vdpu_av1d_set_reference_frames()
889 RK_S32 cur_mi_rows = (dxva->height + 7) >> 3; in vdpu_av1d_set_reference_frames()
895 if (dxva->frame_refs[alt_buf_idx].Index >= 0) in vdpu_av1d_set_reference_frames()
896 alt_frame_offset = dxva->frame_refs[alt_buf_idx].order_hint; in vdpu_av1d_set_reference_frames()
897 if (dxva->frame_refs[gld_buf_idx].Index >= 0) in vdpu_av1d_set_reference_frames()
898 gld_frame_offset = dxva->frame_refs[gld_buf_idx].order_hint; in vdpu_av1d_set_reference_frames()
899 if (dxva->frame_refs[bwd_buf_idx].Index >= 0) in vdpu_av1d_set_reference_frames()
900 bwd_frame_offset = dxva->frame_refs[bwd_buf_idx].order_hint; in vdpu_av1d_set_reference_frames()
901 if (dxva->frame_refs[alt2_buf_idx].Index >= 0) in vdpu_av1d_set_reference_frames()
902 alt2_frame_offset = dxva->frame_refs[alt2_buf_idx].order_hint; in vdpu_av1d_set_reference_frames()
909 dxva->frame_refs[lst_buf_idx].Index, in vdpu_av1d_set_reference_frames()
910 dxva->frame_refs[lst_buf_idx].alt_frame_offset); in vdpu_av1d_set_reference_frames()
912 if (dxva->frame_refs[lst_buf_idx].Index >= 0) { in vdpu_av1d_set_reference_frames()
914 dxva->frame_refs[lst_buf_idx].alt_frame_offset; in vdpu_av1d_set_reference_frames()
919 (dxva->frame_refs[lst_buf_idx].width + 7) >> 3; in vdpu_av1d_set_reference_frames()
921 (dxva->frame_refs[lst_buf_idx].height + 7) >> 3; in vdpu_av1d_set_reference_frames()
924 dxva->frame_refs[lst_buf_idx].intra_only || in vdpu_av1d_set_reference_frames()
925 dxva->frame_refs[lst_buf_idx].is_intra_frame; in vdpu_av1d_set_reference_frames()
935 if (GetRelativeDist(dxva, bwd_frame_offset, cur_frame_offset) > 0) { in vdpu_av1d_set_reference_frames()
937 (dxva->frame_refs[bwd_buf_idx].width + 7) >> 3; in vdpu_av1d_set_reference_frames()
939 (dxva->frame_refs[bwd_buf_idx].height + 7) >> 3; in vdpu_av1d_set_reference_frames()
940 RK_S32 bwd_intra_only = dxva->frame_refs[bwd_buf_idx].intra_only || in vdpu_av1d_set_reference_frames()
941 dxva->frame_refs[bwd_buf_idx].is_intra_frame; in vdpu_av1d_set_reference_frames()
950 if (GetRelativeDist(dxva, alt2_frame_offset, cur_frame_offset) > 0) { in vdpu_av1d_set_reference_frames()
952 (dxva->frame_refs[alt2_buf_idx].width + 7) >> 3; in vdpu_av1d_set_reference_frames()
954 (dxva->frame_refs[alt2_buf_idx].height + 7) >> 3; in vdpu_av1d_set_reference_frames()
956 dxva->frame_refs[alt2_buf_idx].intra_only || in vdpu_av1d_set_reference_frames()
957 dxva->frame_refs[alt2_buf_idx].is_intra_frame; in vdpu_av1d_set_reference_frames()
966 if (GetRelativeDist(dxva, alt_frame_offset, cur_frame_offset) > 0 && in vdpu_av1d_set_reference_frames()
969 (dxva->frame_refs[alt_buf_idx].width + 7) >> 3; in vdpu_av1d_set_reference_frames()
971 (dxva->frame_refs[alt_buf_idx].height + 7) >> 3; in vdpu_av1d_set_reference_frames()
972 RK_S32 alt_intra_only = dxva->frame_refs[alt_buf_idx].intra_only || in vdpu_av1d_set_reference_frames()
973 dxva->frame_refs[alt_buf_idx].is_intra_frame; in vdpu_av1d_set_reference_frames()
982 if (ref_stamp >= 0 && dxva->frame_refs[lst2_buf_idx].Index >= 0) { in vdpu_av1d_set_reference_frames()
984 (dxva->frame_refs[lst2_buf_idx].width + 7) >> 3; in vdpu_av1d_set_reference_frames()
986 (dxva->frame_refs[lst2_buf_idx].height + 7) >> 3; in vdpu_av1d_set_reference_frames()
988 dxva->frame_refs[lst2_buf_idx].intra_only || in vdpu_av1d_set_reference_frames()
989 dxva->frame_refs[lst2_buf_idx].is_intra_frame; in vdpu_av1d_set_reference_frames()
1001 RK_S32 buf_idx = dxva->frame_refs[rf].Index; in vdpu_av1d_set_reference_frames()
1004 GetRelativeDist(dxva, cur_frame_offset, in vdpu_av1d_set_reference_frames()
1005 dxva->frame_refs[rf].order_hint); in vdpu_av1d_set_reference_frames()
1007 GetRelativeDist(dxva, dxva->frame_refs[rf].order_hint, in vdpu_av1d_set_reference_frames()
1009 … offset[%d : %d] hin %d\n", rf, buf_idx, cur_offset[rf], cur_roffset[rf], dxva->frame_refs[rf].ord… in vdpu_av1d_set_reference_frames()
1021 if (dxva->coding.use_ref_frame_mvs && ref_ind > 0 && in vdpu_av1d_set_reference_frames()
1028 if (dxva->coding.use_ref_frame_mvs && ref_ind > 1 && in vdpu_av1d_set_reference_frames()
1035 if (dxva->coding.use_ref_frame_mvs && ref_ind > 2 && in vdpu_av1d_set_reference_frames()
1043 if (dxva->segmentation.enabled && in vdpu_av1d_set_reference_frames()
1044 dxva->primary_ref_frame < ALLOWED_REFS_PER_FRAME_EX) { in vdpu_av1d_set_reference_frames()
1046 RK_S32 prim_buf_idx = dxva->frame_refs[dxva->primary_ref_frame].Index; in vdpu_av1d_set_reference_frames()
1062 if (dxva->primary_ref_frame < ALLOWED_REFS_PER_FRAME_EX) { in vdpu_av1d_set_reference_frames()
1063 RK_S32 prim_buf_idx = dxva->primary_ref_frame; in vdpu_av1d_set_reference_frames()
1066 (RK_S32)((dxva->frame_refs[prim_buf_idx].width + 7) >> in vdpu_av1d_set_reference_frames()
1069 (RK_S32)((dxva->frame_refs[prim_buf_idx].height + 7) >> in vdpu_av1d_set_reference_frames()
1099 static void vdpu_av1d_superres_params(Av1dHalCtx *p_hal, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_superres_params() argument
1123 if (dxva->coding.superres) { in vdpu_av1d_superres_params()
1128 width = (dxva->upscaled_width * SCALE_NUMERATOR + in vdpu_av1d_superres_params()
1131 RK_U32 min_w = MPP_MIN(16, dxva->upscaled_width); in vdpu_av1d_superres_params()
1133 if (width == dxva->upscaled_width) { in vdpu_av1d_superres_params()
1144 RK_S32 upscaledLumaPlaneW = dxva->upscaled_width; in vdpu_av1d_superres_params()
1211 static void vdpu_av1d_set_picture_dimensions(Av1dHalCtx *p_hal, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_set_picture_dimensions() argument
1218 regs->swreg4.sw_pic_width_in_cbs = MPP_ALIGN(dxva->width, 8) >> 3; in vdpu_av1d_set_picture_dimensions()
1219 regs->swreg4.sw_pic_height_in_cbs = MPP_ALIGN(dxva->height, 8) >> 3; in vdpu_av1d_set_picture_dimensions()
1220 regs->swreg12.sw_pic_width_pad = MPP_ALIGN(dxva->width, 8) - dxva->width; in vdpu_av1d_set_picture_dimensions()
1221 regs->swreg12.sw_pic_height_pad = MPP_ALIGN(dxva->height, 8) - dxva->height; in vdpu_av1d_set_picture_dimensions()
1223 regs->swreg8.sw_superres_pic_width = dxva->upscaled_width; in vdpu_av1d_set_picture_dimensions()
1224 regs->swreg9.sw_scale_denom_minus9 = dxva->superres_denom; in vdpu_av1d_set_picture_dimensions()
1226 vdpu_av1d_superres_params(p_hal, dxva); in vdpu_av1d_set_picture_dimensions()
1229 static void vdpu_av1d_set_segmentation(VdpuAv1dRegCtx *ctx, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_set_segmentation() argument
1238 regs->swreg13.sw_segment_temp_upd_e = dxva->segmentation.temporal_update; in vdpu_av1d_set_segmentation()
1239 regs->swreg13.sw_segment_upd_e = dxva->segmentation.update_map; in vdpu_av1d_set_segmentation()
1240 regs->swreg13.sw_segment_e = dxva->segmentation.enabled; in vdpu_av1d_set_segmentation()
1243 regs->swreg5.sw_error_resilient = dxva->coding.error_resilient_mode; in vdpu_av1d_set_segmentation()
1245 if ((!dxva->format.frame_type || dxva->format.frame_type == AV1_FRAME_INTRA_ONLY) in vdpu_av1d_set_segmentation()
1250 regs->swreg14.sw_filt_level0 = dxva->loop_filter.filter_level[0]; in vdpu_av1d_set_segmentation()
1251 regs->swreg15.sw_filt_level1 = dxva->loop_filter.filter_level[1]; in vdpu_av1d_set_segmentation()
1252 regs->swreg16.sw_filt_level2 = dxva->loop_filter.filter_level_u; in vdpu_av1d_set_segmentation()
1253 regs->swreg17.sw_filt_level3 = dxva->loop_filter.filter_level_v; in vdpu_av1d_set_segmentation()
1268 if (dxva->segmentation.enabled) { in vdpu_av1d_set_segmentation()
1269 RK_S32 (*segdata)[SEG_AV1_LVL_MAX] = dxva->segmentation.feature_data; in vdpu_av1d_set_segmentation()
1272 if (dxva->segmentation.feature_mask[s] & (1 << SEG_AV1_LVL_ALT_Q)) { in vdpu_av1d_set_segmentation()
1278 if (dxva->segmentation.feature_mask[s] & (1 << SEG_AV1_LVL_ALT_LF_Y_V)) in vdpu_av1d_set_segmentation()
1282 if (dxva->segmentation.feature_mask[s] & (1 << SEG_AV1_LVL_ALT_LF_Y_H)) in vdpu_av1d_set_segmentation()
1286 if (dxva->segmentation.feature_mask[s] & (1 << SEG_AV1_LVL_ALT_LF_U)) in vdpu_av1d_set_segmentation()
1290 if (dxva->segmentation.feature_mask[s] & (1 << SEG_AV1_LVL_ALT_LF_V)) in vdpu_av1d_set_segmentation()
1294 if (dxva->format.frame_type && in vdpu_av1d_set_segmentation()
1295 dxva->segmentation.feature_mask[s] & (1 << SEG_AV1_LVL_REF_FRAME)) in vdpu_av1d_set_segmentation()
1299 if (dxva->segmentation.feature_mask[s] & (1 << SEG_AV1_LVL_SKIP)) in vdpu_av1d_set_segmentation()
1301 if (dxva->segmentation.feature_mask[s] & (1 << SEG_AV1_LVL_GLOBALMV)) in vdpu_av1d_set_segmentation()
1308 if (dxva->segmentation.feature_mask[i] & (1 << j)) { in vdpu_av1d_set_segmentation()
1393 static void vdpu_av1d_set_loopfilter(Av1dHalCtx *p_hal, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_set_loopfilter() argument
1397 …regs->swreg3.sw_filtering_dis = (dxva->loop_filter.filter_level[0] == 0) && (dxva->loop_filte… in vdpu_av1d_set_loopfilter()
1398 regs->swreg5.sw_filt_level_base_gt32 = dxva->loop_filter.filter_level[0] > 32; in vdpu_av1d_set_loopfilter()
1399 regs->swreg30.sw_filt_sharpness = dxva->loop_filter.sharpness_level; in vdpu_av1d_set_loopfilter()
1400 if (dxva->loop_filter.mode_ref_delta_enabled) { in vdpu_av1d_set_loopfilter()
1401 regs->swreg59.sw_filt_ref_adj_0 = dxva->loop_filter.ref_deltas[0]; in vdpu_av1d_set_loopfilter()
1402 regs->swreg59.sw_filt_ref_adj_1 = dxva->loop_filter.ref_deltas[1]; in vdpu_av1d_set_loopfilter()
1403 regs->swreg59.sw_filt_ref_adj_2 = dxva->loop_filter.ref_deltas[2]; in vdpu_av1d_set_loopfilter()
1404 regs->swreg59.sw_filt_ref_adj_3 = dxva->loop_filter.ref_deltas[3]; in vdpu_av1d_set_loopfilter()
1405 regs->swreg30.sw_filt_ref_adj_4 = dxva->loop_filter.ref_deltas[4]; in vdpu_av1d_set_loopfilter()
1406 regs->swreg30.sw_filt_ref_adj_5 = dxva->loop_filter.ref_deltas[5]; in vdpu_av1d_set_loopfilter()
1407 regs->swreg49.sw_filt_ref_adj_7 = dxva->loop_filter.ref_deltas[6]; in vdpu_av1d_set_loopfilter()
1408 regs->swreg49.sw_filt_ref_adj_6 = dxva->loop_filter.ref_deltas[7]; in vdpu_av1d_set_loopfilter()
1409 regs->swreg30.sw_filt_mb_adj_0 = dxva->loop_filter.mode_deltas[0]; in vdpu_av1d_set_loopfilter()
1410 regs->swreg30.sw_filt_mb_adj_1 = dxva->loop_filter.mode_deltas[1]; in vdpu_av1d_set_loopfilter()
1429 static void vdpu_av1d_set_global_model(Av1dHalCtx *p_hal, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_set_global_model() argument
1437 mpp_assert(dxva->frame_refs[ref_frame].wmtype <= 3); in vdpu_av1d_set_global_model()
1442 *(RK_S32 *)(dst) = dxva->frame_refs[ref_frame].wmmat[3]; in vdpu_av1d_set_global_model()
1444 *(RK_S32 *)(dst) = dxva->frame_refs[ref_frame].wmmat[2]; in vdpu_av1d_set_global_model()
1446 *(RK_S32 *)(dst) = dxva->frame_refs[ref_frame].wmmat[i]; in vdpu_av1d_set_global_model()
1450 *(RK_S16 *)(dst) = dxva->frame_refs[ref_frame].alpha;//-32768; in vdpu_av1d_set_global_model()
1452 *(RK_S16 *)(dst) = dxva->frame_refs[ref_frame].beta;//-32768; in vdpu_av1d_set_global_model()
1454 *(RK_S16 *)(dst) = dxva->frame_refs[ref_frame].gamma;//-32768; in vdpu_av1d_set_global_model()
1456 *(RK_S16 *)(dst) = dxva->frame_refs[ref_frame].delta;//-32768; in vdpu_av1d_set_global_model()
1460 dxva->frame_refs[ref_frame].alpha, in vdpu_av1d_set_global_model()
1461 dxva->frame_refs[ref_frame].beta, in vdpu_av1d_set_global_model()
1462 dxva->frame_refs[ref_frame].gamma, in vdpu_av1d_set_global_model()
1463 dxva->frame_refs[ref_frame].delta); in vdpu_av1d_set_global_model()
1471 static void vdpu_av1d_set_tile_info_regs(VdpuAv1dRegCtx *ctx, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_set_tile_info_regs() argument
1475 size_t context_update_tile_id = dxva->tiles.context_update_id; in vdpu_av1d_set_tile_info_regs()
1476 size_t context_update_y = context_update_tile_id / dxva->tiles.cols; in vdpu_av1d_set_tile_info_regs()
1477 size_t context_update_x = context_update_tile_id % dxva->tiles.cols; in vdpu_av1d_set_tile_info_regs()
1482 context_update_x * dxva->tiles.rows + context_update_y; in vdpu_av1d_set_tile_info_regs()
1484 regs->swreg10.sw_tile_enable = (dxva->tiles.cols > 1) || (dxva->tiles.rows > 1); in vdpu_av1d_set_tile_info_regs()
1485 regs->swreg10.sw_num_tile_cols_8k = dxva->tiles.cols; in vdpu_av1d_set_tile_info_regs()
1486 regs->swreg10.sw_num_tile_rows_8k_av1 = dxva->tiles.rows; in vdpu_av1d_set_tile_info_regs()
1489 regs->swreg11.sw_dec_tile_size_mag = dxva->tiles.tile_sz_mag; in vdpu_av1d_set_tile_info_regs()
1496 static int check_tile_width(DXVA_PicParams_AV1 *dxva, RK_S32 width, RK_S32 leftmost) in check_tile_width() argument
1499 …if (!leftmost && dxva->coding.use_128x128_superblock == 0 && dxva->coding.superres && width == 1) { in check_tile_width()
1504 const RK_S32 sb_size_log2 = dxva->coding.use_128x128_superblock ? 7 : 6; in check_tile_width()
1506 if (dxva->coding.superres) { in check_tile_width()
1508 (tile_width_pixels * (9 + dxva->superres_denom) + 4) / 8; in check_tile_width()
1511 if (dxva->coding.superres) in check_tile_width()
1520 static void vdpu_av1d_set_tile_info_mem(Av1dHalCtx *p_hal, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_set_tile_info_mem() argument
1525 RK_S32 tmp = dxva->frame_tag_size + dxva->offset_to_dct_parts; in vdpu_av1d_set_tile_info_mem()
1528 RK_S32 size0 = transpose ? dxva->tiles.cols : dxva->tiles.rows; in vdpu_av1d_set_tile_info_mem()
1529 RK_S32 size1 = transpose ? dxva->tiles.rows : dxva->tiles.cols; in vdpu_av1d_set_tile_info_mem()
1538 for (i = 0; i < dxva->tiles.cols; i++) { in vdpu_av1d_set_tile_info_mem()
1540 val += dxva->tiles.widths[i]; in vdpu_av1d_set_tile_info_mem()
1545 for (i = 0; i < dxva->tiles.rows; i++) { in vdpu_av1d_set_tile_info_mem()
1547 val += dxva->tiles.heights[i]; in vdpu_av1d_set_tile_info_mem()
1565 RK_U8 leftmost = (tile_x == dxva->tiles.cols - 1); in vdpu_av1d_set_tile_info_mem()
1567 not_valid_tile_dimension = !check_tile_width(dxva, x1 - x0, leftmost); in vdpu_av1d_set_tile_info_mem()
1568 if ((x0 << (dxva->coding.use_128x128_superblock ? 7 : 6)) >= dxva->width || in vdpu_av1d_set_tile_info_mem()
1569 (y0 << (dxva->coding.use_128x128_superblock ? 7 : 6)) >= dxva->height) in vdpu_av1d_set_tile_info_mem()
1583 start = dxva->tiles.tile_offset_start[tile_id]; in vdpu_av1d_set_tile_info_mem()
1594 end = dxva->tiles.tile_offset_end[tile_id]; in vdpu_av1d_set_tile_info_mem()
1610 static void vdpu_av1d_set_cdef(Av1dHalCtx *p_hal, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_set_cdef() argument
1621 regs->swreg7.sw_cdef_bits = dxva->cdef.bits; in vdpu_av1d_set_cdef()
1622 regs->swreg7.sw_cdef_damping = dxva->cdef.damping; in vdpu_av1d_set_cdef()
1625 if (i == (1 << (dxva->cdef.bits))) break; in vdpu_av1d_set_cdef()
1626 luma_pri_strength |= dxva->cdef.y_strengths[i].primary << (i * 4); in vdpu_av1d_set_cdef()
1627 luma_sec_strength |= dxva->cdef.y_strengths[i].secondary << (i * 2); in vdpu_av1d_set_cdef()
1628 chroma_pri_strength |= dxva->cdef.uv_strengths[i].primary << (i * 4); in vdpu_av1d_set_cdef()
1629 chroma_sec_strength |= dxva->cdef.uv_strengths[i].secondary << (i * 2); in vdpu_av1d_set_cdef()
1642 static void vdpu_av1d_set_lr(Av1dHalCtx *p_hal, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_set_lr() argument
1651 lr_type |= dxva->loop_filter.frame_restoration_type[i] << (i * 2); in vdpu_av1d_set_lr()
1652 lr_unit_size |= dxva->loop_filter.log2_restoration_unit_size[i] << (i * 2); in vdpu_av1d_set_lr()
1689 static void vdpu_av1d_set_fgs(VdpuAv1dRegCtx *ctx, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_set_fgs() argument
1707 if (!dxva->film_grain.apply_grain) { in vdpu_av1d_set_fgs()
1725 regs->swreg7.sw_num_y_points_b = dxva->film_grain.num_y_points > 0; in vdpu_av1d_set_fgs()
1726 regs->swreg7.sw_num_cb_points_b = dxva->film_grain.num_cb_points > 0; in vdpu_av1d_set_fgs()
1727 regs->swreg7.sw_num_cr_points_b = dxva->film_grain.num_cr_points > 0; in vdpu_av1d_set_fgs()
1728 regs->swreg8.sw_scaling_shift = dxva->film_grain.scaling_shift_minus8 + 8; in vdpu_av1d_set_fgs()
1729 if (! dxva->film_grain.chroma_scaling_from_luma) { in vdpu_av1d_set_fgs()
1730 regs->swreg28.sw_cb_mult = dxva->film_grain.cb_mult - 128; in vdpu_av1d_set_fgs()
1731 regs->swreg28.sw_cb_luma_mult = dxva->film_grain.cb_luma_mult - 128; in vdpu_av1d_set_fgs()
1732 regs->swreg28.sw_cb_offset = dxva->film_grain.cb_offset - 256; in vdpu_av1d_set_fgs()
1733 regs->swreg29.sw_cr_mult = dxva->film_grain.cr_mult - 128; in vdpu_av1d_set_fgs()
1734 regs->swreg29.sw_cr_luma_mult = dxva->film_grain.cr_luma_mult - 128; in vdpu_av1d_set_fgs()
1735 regs->swreg29.sw_cr_offset = dxva->film_grain.cr_offset - 256; in vdpu_av1d_set_fgs()
1744 regs->swreg7.sw_overlap_flag = dxva->film_grain.overlap_flag; in vdpu_av1d_set_fgs()
1745 regs->swreg7.sw_clip_to_restricted_range = dxva->film_grain.clip_to_restricted_range; in vdpu_av1d_set_fgs()
1746 regs->swreg7.sw_chroma_scaling_from_luma = dxva->film_grain.chroma_scaling_from_luma; in vdpu_av1d_set_fgs()
1747 regs->swreg7.sw_random_seed = dxva->film_grain.grain_seed; in vdpu_av1d_set_fgs()
1749 init_scaling_function(dxva->film_grain.scaling_points_y, dxva->film_grain.num_y_points, in vdpu_av1d_set_fgs()
1752 if (dxva->film_grain.chroma_scaling_from_luma) { in vdpu_av1d_set_fgs()
1758 init_scaling_function(dxva->film_grain.scaling_points_cb, in vdpu_av1d_set_fgs()
1759 dxva->film_grain.num_cb_points, ctx->fgsmem.scaling_lut_cb); in vdpu_av1d_set_fgs()
1760 init_scaling_function(dxva->film_grain.scaling_points_cr, in vdpu_av1d_set_fgs()
1761 dxva->film_grain.num_cr_points, ctx->fgsmem.scaling_lut_cr); in vdpu_av1d_set_fgs()
1767 ar_coeffs_y[i] = dxva->film_grain.ar_coeffs_y[i] - 128; in vdpu_av1d_set_fgs()
1769 ar_coeffs_cb[i] = dxva->film_grain.ar_coeffs_cb[i] - 128; in vdpu_av1d_set_fgs()
1770 ar_coeffs_cr[i] = dxva->film_grain.ar_coeffs_cr[i] - 128; in vdpu_av1d_set_fgs()
1773 ar_coeff_lag = dxva->film_grain.ar_coeff_lag; in vdpu_av1d_set_fgs()
1774 ar_coeff_shift = dxva->film_grain.ar_coeff_shift_minus6 + 6; in vdpu_av1d_set_fgs()
1775 grain_scale_shift = dxva->film_grain.grain_scale_shift; in vdpu_av1d_set_fgs()
1776 bitdepth = dxva->bitdepth; in vdpu_av1d_set_fgs()
1781 GenerateLumaGrainBlock(luma_grain_block, bitdepth, dxva->film_grain.num_y_points, in vdpu_av1d_set_fgs()
1784 dxva->film_grain.grain_seed); in vdpu_av1d_set_fgs()
1788 dxva->film_grain.num_y_points, dxva->film_grain.num_cb_points, in vdpu_av1d_set_fgs()
1789 dxva->film_grain.num_cr_points, grain_scale_shift, ar_coeff_lag, ar_coeffs_cb, in vdpu_av1d_set_fgs()
1791 dxva->film_grain.chroma_scaling_from_luma, dxva->film_grain.grain_seed); in vdpu_av1d_set_fgs()
1818 static MPP_RET vdpu_av1d_setup_tile_bufs(void *hal, DXVA_PicParams_AV1 *dxva) in vdpu_av1d_setup_tile_bufs() argument
1822 RK_U32 out_w = MPP_ALIGN(dxva->max_width * dxva->bitdepth, 16 * 8) / 8; in vdpu_av1d_setup_tile_bufs()
1823 …RK_U32 num_sbs = (MPP_ALIGN(dxva->max_width, 64) / 64 + 1) * (MPP_ALIGN(dxva->max_height, 64) / 64… in vdpu_av1d_setup_tile_bufs()
1825 RK_U32 out_h = MPP_ALIGN(dxva->max_height, 16); in vdpu_av1d_setup_tile_bufs()
1859 DXVA_PicParams_AV1 *dxva = (DXVA_PicParams_AV1*)task->dec.syntax.data; in vdpu_av1d_gen_regs() local
1863 RK_U32 height = dxva->height; in vdpu_av1d_gen_regs()
1864 RK_U32 width = dxva->width; in vdpu_av1d_gen_regs()
1868 RK_U32 num_tile_cols = 1 << dxva->tile_cols_log2; in vdpu_av1d_gen_regs()
1872 ctx->refresh_frame_flags = dxva->refresh_frame_flags; in vdpu_av1d_gen_regs()
1897 vdpu_av1d_setup_tile_bufs(p_hal, dxva); in vdpu_av1d_gen_regs()
1902 ret = vdpu_av1d_filtermem_alloc(p_hal, ctx, dxva); in vdpu_av1d_gen_regs()
1926 dxva->bitdepth, mpp_frame_get_fmt(mframe), in vdpu_av1d_gen_regs()
1927 dxva->format.subsampling_x, dxva->format.subsampling_y, in vdpu_av1d_gen_regs()
1937 regs->swreg3.sw_skip_mode = dxva->coding.skip_mode; in vdpu_av1d_gen_regs()
1942 regs->swreg5.sw_tempor_mvp_e = dxva->coding.use_ref_frame_mvs; in vdpu_av1d_gen_regs()
1943 regs->swreg5.sw_delta_lf_res_log = dxva->loop_filter.delta_lf_res; in vdpu_av1d_gen_regs()
1944 regs->swreg5.sw_delta_lf_multi = dxva->loop_filter.delta_lf_multi; in vdpu_av1d_gen_regs()
1945 regs->swreg5.sw_delta_lf_present = dxva->loop_filter.delta_lf_present; in vdpu_av1d_gen_regs()
1946 regs->swreg5.sw_disable_cdf_update = dxva->coding.disable_cdf_update; in vdpu_av1d_gen_regs()
1947 regs->swreg5.sw_allow_warp = dxva->coding.warped_motion; in vdpu_av1d_gen_regs()
1948 regs->swreg5.sw_show_frame = dxva->format.show_frame; in vdpu_av1d_gen_regs()
1949 regs->swreg5.sw_switchable_motion_mode = dxva->coding.switchable_motion_mode; in vdpu_av1d_gen_regs()
1950 regs->swreg5.sw_enable_cdef = !(dxva->cdef.bits == 0 && dxva->cdef.damping == 0 && in vdpu_av1d_gen_regs()
1951 dxva->cdef.y_strengths[0].primary == 0 && in vdpu_av1d_gen_regs()
1952 dxva->cdef.y_strengths[0].secondary == 0 && in vdpu_av1d_gen_regs()
1953 dxva->cdef.uv_strengths[0].primary == 0 && in vdpu_av1d_gen_regs()
1954 dxva->cdef.uv_strengths[0].secondary == 0); in vdpu_av1d_gen_regs()
1955 regs->swreg5.sw_allow_masked_compound = dxva->coding.masked_compound; in vdpu_av1d_gen_regs()
1956 regs->swreg5.sw_allow_interintra = dxva->coding.interintra_compound; in vdpu_av1d_gen_regs()
1957 regs->swreg5.sw_enable_intra_edge_filter = dxva->coding.intra_edge_filter; in vdpu_av1d_gen_regs()
1958 regs->swreg5.sw_allow_filter_intra = dxva->coding.filter_intra; in vdpu_av1d_gen_regs()
1959 regs->swreg5.sw_enable_jnt_comp = dxva->coding.jnt_comp; in vdpu_av1d_gen_regs()
1960 regs->swreg5.sw_enable_dual_filter = dxva->coding.dual_filter; in vdpu_av1d_gen_regs()
1961 regs->swreg5.sw_reduced_tx_set_used = dxva->coding.reduced_tx_set; in vdpu_av1d_gen_regs()
1962 regs->swreg5.sw_allow_screen_content_tools = dxva->coding.screen_content_tools; in vdpu_av1d_gen_regs()
1963 regs->swreg5.sw_allow_intrabc = dxva->coding.intrabc; in vdpu_av1d_gen_regs()
1965 regs->swreg5.sw_force_interger_mv = dxva->coding.integer_mv; in vdpu_av1d_gen_regs()
1967 vdpu_av1d_set_global_model(p_hal, dxva); in vdpu_av1d_gen_regs()
1968 vdpu_av1d_set_tile_info_mem(p_hal, dxva); in vdpu_av1d_gen_regs()
1970 if ((dxva->format.frame_type && (dxva->format.frame_type != AV1_FRAME_INTRA_ONLY)) in vdpu_av1d_gen_regs()
1971 || dxva->coding.intrabc) { in vdpu_av1d_gen_regs()
1972 vdpu_av1d_set_reference_frames(p_hal, ctx, dxva); in vdpu_av1d_gen_regs()
1974 vdpu_av1d_set_segmentation(ctx, dxva); in vdpu_av1d_gen_regs()
1975 vdpu_av1d_set_loopfilter(p_hal, dxva); in vdpu_av1d_gen_regs()
1976 vdpu_av1d_set_picture_dimensions(p_hal, dxva); in vdpu_av1d_gen_regs()
1977 vdpu_av1d_set_cdef(p_hal, dxva); in vdpu_av1d_gen_regs()
1978 vdpu_av1d_set_lr(p_hal, dxva); in vdpu_av1d_gen_regs()
1979 vdpu_av1d_set_fgs(ctx, dxva); in vdpu_av1d_gen_regs()
1980 vdpu_av1d_set_prob(p_hal, dxva); in vdpu_av1d_gen_regs()
1981 vdpu_av1d_set_tile_info_regs(ctx, dxva); in vdpu_av1d_gen_regs()
2056 regs->swreg7.sw_blackwhite_e = dxva->format.mono_chrome; in vdpu_av1d_gen_regs()
2057 regs->swreg7.sw_clip_to_restricted_range = dxva->film_grain.clip_to_restricted_range; in vdpu_av1d_gen_regs()
2058 regs->swreg7.sw_delta_q_res_log = dxva->quantization.delta_q_res; in vdpu_av1d_gen_regs()
2059 regs->swreg7.sw_delta_q_present = dxva->quantization.delta_q_present; in vdpu_av1d_gen_regs()
2061 regs->swreg8.sw_idr_pic_e = dxva->format.frame_type == AV1_FRAME_KEY || in vdpu_av1d_gen_regs()
2062 dxva->format.frame_type == AV1_FRAME_INTRA_ONLY; in vdpu_av1d_gen_regs()
2063 regs->swreg8.sw_quant_base_qindex = dxva->quantization.base_qindex; in vdpu_av1d_gen_regs()
2064 regs->swreg8.sw_bit_depth_y_minus8 = dxva->bitdepth - 8; in vdpu_av1d_gen_regs()
2065 regs->swreg8.sw_bit_depth_c_minus8 = dxva->bitdepth - 8; in vdpu_av1d_gen_regs()
2067 regs->swreg11.sw_mcomp_filt_type = dxva->interp_filter; in vdpu_av1d_gen_regs()
2068 regs->swreg11.sw_high_prec_mv_e = dxva->coding.high_precision_mv; in vdpu_av1d_gen_regs()
2069 regs->swreg11.sw_comp_pred_mode = dxva->coding.reference_mode ? 2 : 0; in vdpu_av1d_gen_regs()
2070 regs->swreg11.sw_transform_mode = dxva->coding.tx_mode ? (dxva->coding.tx_mode + 2) : 0; in vdpu_av1d_gen_regs()
2071 regs->swreg12.sw_max_cb_size = dxva->coding.use_128x128_superblock ? 7 : 6;; in vdpu_av1d_gen_regs()
2088 regs->swreg13.sw_qp_delta_y_dc_av1 = dxva->quantization.y_dc_delta_q; in vdpu_av1d_gen_regs()
2089 regs->swreg13.sw_qp_delta_ch_dc_av1 = dxva->quantization.u_dc_delta_q; in vdpu_av1d_gen_regs()
2090 regs->swreg13.sw_qp_delta_ch_ac_av1 = dxva->quantization.u_ac_delta_q; in vdpu_av1d_gen_regs()
2091 regs->swreg47.sw_qmlevel_y = dxva->quantization.qm_y; in vdpu_av1d_gen_regs()
2092 regs->swreg48.sw_qmlevel_u = dxva->quantization.qm_u; in vdpu_av1d_gen_regs()
2093 regs->swreg49.sw_qmlevel_v = dxva->quantization.qm_v; in vdpu_av1d_gen_regs()
2095 regs->swreg13.sw_lossless_e = dxva->coded_lossless; in vdpu_av1d_gen_regs()
2096 regs->swreg28.sw_quant_delta_v_dc = dxva->quantization.v_dc_delta_q; in vdpu_av1d_gen_regs()
2097 regs->swreg29.sw_quant_delta_v_ac = dxva->quantization.v_ac_delta_q; in vdpu_av1d_gen_regs()
2099 regs->swreg31.sw_skip_ref0 = dxva->skip_ref0 ? dxva->skip_ref0 : 1; in vdpu_av1d_gen_regs()
2100 regs->swreg32.sw_skip_ref1 = dxva->skip_ref1 ? dxva->skip_ref1 : 1; in vdpu_av1d_gen_regs()
2112 RK_U32 offset = (dxva->frame_tag_size & (~0xf)); in vdpu_av1d_gen_regs()
2126 … regs->swreg5.sw_strm_start_bit = (dxva->frame_tag_size & 0xf) * 8; // bit start to decode in vdpu_av1d_gen_regs()
2135 AV1D_DBG(AV1D_DBG_LOG, "stream tag_size %d\n", dxva->frame_tag_size); in vdpu_av1d_gen_regs()
2178 regs->vdpu_av1d_pp_cfg.swreg329.sw_pp_out_y_stride = dxva->bitdepth > 8 ? in vdpu_av1d_gen_regs()
2180 regs->vdpu_av1d_pp_cfg.swreg329.sw_pp_out_c_stride = dxva->bitdepth > 8 ? in vdpu_av1d_gen_regs()