Commit 88e84200 authored by Ruijing Dong's avatar Ruijing Dong Committed by Marek Olšák
Browse files

radeonsi/vcn: update av1 decoding to support vcn4



Apply changes of vcn4 on av1 decoding.

Signed-off-by: Ruijing Dong's avatarRuijing Dong <ruijing.dong@amd.com>
parent a8ed7f4f
This commit is part of merge request !16328. Comments created here will be created in the context of that merge request.
......@@ -400,6 +400,9 @@
#define RDECODE_FRAME_HDR_INFO_AV1_DISABLE_CDF_UPDATE_MASK (0x00000002)
#define RDECODE_FRAME_HDR_INFO_AV1_SHOW_FRAME_MASK (0x00000001)
#define RDECODE_AV1_VER_0 0
#define RDECODE_AV1_VER_1 1
typedef struct rvcn_decode_buffer_s {
unsigned int valid_buf_flag;
unsigned int msg_buffer_address_hi;
......@@ -1117,6 +1120,13 @@ typedef struct rvcn_dec_vp9_probs_segment_s {
};
} rvcn_dec_vp9_probs_segment_t;
struct rvcn_av1_prob_funcs
{
void (*init_mode_probs)(void * prob);
void (*init_mv_probs)(void *prob);
void (*default_coef_probs)(void *prob, int index);
};
typedef struct rvcn_dec_av1_fg_init_buf_s {
short luma_grain_block[64][96];
short cb_grain_block[32][48];
......
......@@ -29,6 +29,7 @@
#define _RADEON_VCN_AV1_DEFAULT_H
#define TXB_SKIP_CONTEXTS 13
#define EOB_COEF_CONTEXTS_VCN4 9
#define EOB_COEF_CONTEXTS 22
#define SIG_COEF_CONTEXTS_EOB 4
#define SIG_COEF_CONTEXTS_2D 26
......@@ -199,6 +200,8 @@ typedef enum {
#define EXT_TX_SIZES 4
#define EXT_TX_SETS_INTER 4
#define EXT_TX_SETS_INTRA 3
#define EXT_TX_SETS_INTER_VCN4 3
#define EXT_TX_SETS_INTRA_VCN4 2
#define DELTA_Q_SMALL 3
#define DELTA_Q_PROBS (DELTA_Q_SMALL)
#define DELTA_LF_SMALL 3
......@@ -412,9 +415,9 @@ typedef enum {
#define AOM_CDF16(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) AOM_ICDF(a0), AOM_ICDF(a1), AOM_ICDF(a2), AOM_ICDF(a3), AOM_ICDF(a4), AOM_ICDF(a5), \
AOM_ICDF(a6), AOM_ICDF(a7), AOM_ICDF(a8), AOM_ICDF(a9), AOM_ICDF(a10), AOM_ICDF(a11), AOM_ICDF(a12), AOM_ICDF(a13), AOM_ICDF(a14), AOM_ICDF(CDF_PROB_TOP), 0
typedef struct rvcn_av1_hw_frame_contexts {
typedef struct rvcn_av1_vcn4_frame_contexts {
uint16_t txb_skip_cdf[AV1_TX_SIZES][TXB_SKIP_CONTEXTS][CDF_SIZE(2)];
uint16_t eob_extra_cdf[AV1_TX_SIZES][AV1_PLANE_TYPES][EOB_COEF_CONTEXTS][CDF_SIZE(2)];
uint16_t eob_extra_cdf[AV1_TX_SIZES][AV1_PLANE_TYPES][EOB_COEF_CONTEXTS_VCN4][CDF_SIZE(2)];
uint16_t dc_sign_cdf[AV1_PLANE_TYPES][DC_SIGN_CONTEXTS][CDF_SIZE(2)];
uint16_t newmv_cdf[NEWMV_MODE_CONTEXTS][CDF_SIZE(2)];
uint16_t zeromv_cdf[ZEROMV_MODE_CONTEXTS][CDF_SIZE(2)];
......@@ -463,7 +466,7 @@ typedef struct rvcn_av1_hw_frame_contexts {
uint16_t pred_cdf[SEG_TEMPORAL_PRED_CTXS][CDF_SIZE(2)];
uint16_t compound_index_cdf[COMP_INDEX_CONTEXTS][CDF_SIZE(2)];
uint16_t comp_group_idx_cdf[COMP_GROUP_IDX_CONTEXTS][CDF_SIZE(2)];
uint16_t reserve0[2];
uint16_t reserve0[8];
uint16_t coeff_base_eob_cdf[AV1_TX_SIZES][AV1_PLANE_TYPES][SIG_COEF_CONTEXTS_EOB][CDF_SIZE(3)];
uint16_t motion_mode_cdf[AV1_BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)];
uint16_t switchable_restore_cdf[CDF_SIZE(RESTORE_SWITCHABLE_TYPES)];
......@@ -517,11 +520,10 @@ typedef struct rvcn_av1_hw_frame_contexts {
uint16_t uv_mode_cdf[CFL_ALLOWED_TYPES][AV1_INTRA_MODES][CDF_SIZE(UV_INTRA_MODES)];
uint16_t reserve6[10];
uint16_t wedge_idx_cdf[AV1_BLOCK_SIZES_ALL][CDF_SIZE(16)];
uint16_t intra_ext_tx_cdf[EXT_TX_SETS_INTRA][EXT_TX_SIZES][AV1_INTRA_MODES][CDF_SIZE(AV1_TX_TYPES)];
uint16_t inter_ext_tx_cdf[EXT_TX_SETS_INTER][EXT_TX_SIZES][CDF_SIZE(AV1_TX_TYPES)];
uint16_t intra_ext_tx_cdf[EXT_TX_SETS_INTRA_VCN4][EXT_TX_SIZES][AV1_INTRA_MODES][CDF_SIZE(AV1_TX_TYPES)];
uint16_t inter_ext_tx_cdf[EXT_TX_SETS_INTER_VCN4][EXT_TX_SIZES][CDF_SIZE(AV1_TX_TYPES)];
uint16_t cfl_alpha_cdf[CFL_ALPHA_CONTEXTS][CDF_SIZE(CFL_ALPHABET_SIZE)];
uint16_t reserve7[8];
} rvcn_av1_hw_frame_context_t;
} rvcn_av1_vcn4_frame_context_t;
static const av1_nmv_context default_nmv_context =
{
......
......@@ -1156,6 +1156,67 @@ static void rvcn_init_mode_probs(void *prob)
memcpy(fc->intrabc_cdf, default_intrabc_cdf, sizeof(default_intrabc_cdf));
}
static void rvcn_vcn4_init_mode_probs(void *prob)
{
rvcn_av1_vcn4_frame_context_t * fc = (rvcn_av1_vcn4_frame_context_t*)prob;
int i;
memcpy(fc->palette_y_size_cdf, default_palette_y_size_cdf, sizeof(default_palette_y_size_cdf));
memcpy(fc->palette_uv_size_cdf, default_palette_uv_size_cdf, sizeof(default_palette_uv_size_cdf));
memcpy(fc->palette_y_color_index_cdf, default_palette_y_color_index_cdf, sizeof(default_palette_y_color_index_cdf));
memcpy(fc->palette_uv_color_index_cdf, default_palette_uv_color_index_cdf, sizeof(default_palette_uv_color_index_cdf));
memcpy(fc->kf_y_cdf, default_kf_y_mode_cdf, sizeof(default_kf_y_mode_cdf));
memcpy(fc->angle_delta_cdf, default_angle_delta_cdf, sizeof(default_angle_delta_cdf));
memcpy(fc->comp_inter_cdf, default_comp_inter_cdf, sizeof(default_comp_inter_cdf));
memcpy(fc->comp_ref_type_cdf, default_comp_ref_type_cdf,sizeof(default_comp_ref_type_cdf));
memcpy(fc->uni_comp_ref_cdf, default_uni_comp_ref_cdf, sizeof(default_uni_comp_ref_cdf));
memcpy(fc->palette_y_mode_cdf, default_palette_y_mode_cdf, sizeof(default_palette_y_mode_cdf));
memcpy(fc->palette_uv_mode_cdf, default_palette_uv_mode_cdf, sizeof(default_palette_uv_mode_cdf));
memcpy(fc->comp_ref_cdf, default_comp_ref_cdf, sizeof(default_comp_ref_cdf));
memcpy(fc->comp_bwdref_cdf, default_comp_bwdref_cdf, sizeof(default_comp_bwdref_cdf));
memcpy(fc->single_ref_cdf, default_single_ref_cdf, sizeof(default_single_ref_cdf));
memcpy(fc->txfm_partition_cdf, default_txfm_partition_cdf, sizeof(default_txfm_partition_cdf));
memcpy(fc->compound_index_cdf, default_compound_idx_cdfs, sizeof(default_compound_idx_cdfs));
memcpy(fc->comp_group_idx_cdf, default_comp_group_idx_cdfs, sizeof(default_comp_group_idx_cdfs));
memcpy(fc->newmv_cdf, default_newmv_cdf, sizeof(default_newmv_cdf));
memcpy(fc->zeromv_cdf, default_zeromv_cdf, sizeof(default_zeromv_cdf));
memcpy(fc->refmv_cdf, default_refmv_cdf, sizeof(default_refmv_cdf));
memcpy(fc->drl_cdf, default_drl_cdf, sizeof(default_drl_cdf));
memcpy(fc->motion_mode_cdf, default_motion_mode_cdf, sizeof(default_motion_mode_cdf));
memcpy(fc->obmc_cdf, default_obmc_cdf, sizeof(default_obmc_cdf));
memcpy(fc->inter_compound_mode_cdf, default_inter_compound_mode_cdf, sizeof(default_inter_compound_mode_cdf));
memcpy(fc->compound_type_cdf, default_compound_type_cdf, sizeof(default_compound_type_cdf));
memcpy(fc->wedge_idx_cdf, default_wedge_idx_cdf, sizeof(default_wedge_idx_cdf));
memcpy(fc->interintra_cdf, default_interintra_cdf, sizeof(default_interintra_cdf));
memcpy(fc->wedge_interintra_cdf, default_wedge_interintra_cdf, sizeof(default_wedge_interintra_cdf));
memcpy(fc->interintra_mode_cdf, default_interintra_mode_cdf, sizeof(default_interintra_mode_cdf));
memcpy(fc->pred_cdf, default_segment_pred_cdf, sizeof(default_segment_pred_cdf));
memcpy(fc->switchable_restore_cdf, default_switchable_restore_cdf, sizeof(default_switchable_restore_cdf));
memcpy(fc->wiener_restore_cdf, default_wiener_restore_cdf, sizeof(default_wiener_restore_cdf));
memcpy(fc->sgrproj_restore_cdf, default_sgrproj_restore_cdf, sizeof(default_sgrproj_restore_cdf));
memcpy(fc->y_mode_cdf, default_if_y_mode_cdf, sizeof(default_if_y_mode_cdf));
memcpy(fc->uv_mode_cdf, default_uv_mode_cdf, sizeof(default_uv_mode_cdf));
memcpy(fc->switchable_interp_cdf, default_switchable_interp_cdf, sizeof(default_switchable_interp_cdf));
memcpy(fc->partition_cdf, default_partition_cdf, sizeof(default_partition_cdf));
memcpy(fc->intra_ext_tx_cdf, &default_intra_ext_tx_cdf[1], sizeof(default_intra_ext_tx_cdf[1]) * 2);
memcpy(fc->inter_ext_tx_cdf, &default_inter_ext_tx_cdf[1], sizeof(default_inter_ext_tx_cdf[1]) * 3);
memcpy(fc->skip_cdfs, default_skip_cdfs, sizeof(default_skip_cdfs));
memcpy(fc->intra_inter_cdf, default_intra_inter_cdf, sizeof(default_intra_inter_cdf));
memcpy(fc->tree_cdf, default_seg_tree_cdf, sizeof(default_seg_tree_cdf));
for (i = 0; i < SPATIAL_PREDICTION_PROBS; ++i)
memcpy(fc->spatial_pred_seg_cdf[i], default_spatial_pred_seg_tree_cdf[i], sizeof(default_spatial_pred_seg_tree_cdf[i]));
memcpy(fc->tx_size_cdf, default_tx_size_cdf, sizeof(default_tx_size_cdf));
memcpy(fc->delta_q_cdf, default_delta_q_cdf, sizeof(default_delta_q_cdf));
memcpy(fc->skip_mode_cdfs, default_skip_mode_cdfs, sizeof(default_skip_mode_cdfs));
memcpy(fc->delta_lf_cdf, default_delta_lf_cdf, sizeof(default_delta_lf_cdf));
memcpy(fc->delta_lf_multi_cdf, default_delta_lf_multi_cdf, sizeof(default_delta_lf_multi_cdf));
memcpy(fc->cfl_sign_cdf, default_cfl_sign_cdf, sizeof(default_cfl_sign_cdf));
memcpy(fc->cfl_alpha_cdf, default_cfl_alpha_cdf, sizeof(default_cfl_alpha_cdf));
memcpy(fc->filter_intra_cdfs, default_filter_intra_cdfs, sizeof(default_filter_intra_cdfs));
memcpy(fc->filter_intra_mode_cdf, default_filter_intra_mode_cdf, sizeof(default_filter_intra_mode_cdf));
memcpy(fc->intrabc_cdf, default_intrabc_cdf, sizeof(default_intrabc_cdf));
}
static void rvcn_av1_init_mv_probs(void *prob)
{
rvcn_av1_frame_context_t * fc = (rvcn_av1_frame_context_t*)prob;
......@@ -1196,6 +1257,46 @@ static void rvcn_av1_init_mv_probs(void *prob)
memcpy(fc->ndvc_1_sign_cdf, default_nmv_context.comps[1].sign_cdf, sizeof(default_nmv_context.comps[1].sign_cdf));
}
static void rvcn_vcn4_av1_init_mv_probs(void *prob)
{
rvcn_av1_vcn4_frame_context_t * fc = (rvcn_av1_vcn4_frame_context_t*)prob;
memcpy(fc->nmvc_joints_cdf, default_nmv_context.joints_cdf, sizeof(default_nmv_context.joints_cdf));
memcpy(fc->nmvc_0_bits_cdf, default_nmv_context.comps[0].bits_cdf, sizeof(default_nmv_context.comps[0].bits_cdf));
memcpy(fc->nmvc_0_class0_cdf, default_nmv_context.comps[0].class0_cdf, sizeof(default_nmv_context.comps[0].class0_cdf));
memcpy(fc->nmvc_0_class0_fp_cdf, default_nmv_context.comps[0].class0_fp_cdf, sizeof(default_nmv_context.comps[0].class0_fp_cdf));
memcpy(fc->nmvc_0_class0_hp_cdf, default_nmv_context.comps[0].class0_hp_cdf, sizeof(default_nmv_context.comps[0].class0_hp_cdf));
memcpy(fc->nmvc_0_classes_cdf, default_nmv_context.comps[0].classes_cdf, sizeof(default_nmv_context.comps[0].classes_cdf));
memcpy(fc->nmvc_0_fp_cdf, default_nmv_context.comps[0].fp_cdf, sizeof(default_nmv_context.comps[0].fp_cdf));
memcpy(fc->nmvc_0_hp_cdf, default_nmv_context.comps[0].hp_cdf, sizeof(default_nmv_context.comps[0].hp_cdf));
memcpy(fc->nmvc_0_sign_cdf, default_nmv_context.comps[0].sign_cdf, sizeof(default_nmv_context.comps[0].sign_cdf));
memcpy(fc->nmvc_1_bits_cdf, default_nmv_context.comps[1].bits_cdf, sizeof(default_nmv_context.comps[1].bits_cdf));
memcpy(fc->nmvc_1_class0_cdf, default_nmv_context.comps[1].class0_cdf, sizeof(default_nmv_context.comps[1].class0_cdf));
memcpy(fc->nmvc_1_class0_fp_cdf, default_nmv_context.comps[1].class0_fp_cdf, sizeof(default_nmv_context.comps[1].class0_fp_cdf));
memcpy(fc->nmvc_1_class0_hp_cdf, default_nmv_context.comps[1].class0_hp_cdf, sizeof(default_nmv_context.comps[1].class0_hp_cdf));
memcpy(fc->nmvc_1_classes_cdf, default_nmv_context.comps[1].classes_cdf, sizeof(default_nmv_context.comps[1].classes_cdf));
memcpy(fc->nmvc_1_fp_cdf, default_nmv_context.comps[1].fp_cdf, sizeof(default_nmv_context.comps[1].fp_cdf));
memcpy(fc->nmvc_1_hp_cdf, default_nmv_context.comps[1].hp_cdf, sizeof(default_nmv_context.comps[1].hp_cdf));
memcpy(fc->nmvc_1_sign_cdf, default_nmv_context.comps[1].sign_cdf, sizeof(default_nmv_context.comps[1].sign_cdf));
memcpy(fc->ndvc_joints_cdf, default_nmv_context.joints_cdf, sizeof(default_nmv_context.joints_cdf));
memcpy(fc->ndvc_0_bits_cdf, default_nmv_context.comps[0].bits_cdf, sizeof(default_nmv_context.comps[0].bits_cdf));
memcpy(fc->ndvc_0_class0_cdf, default_nmv_context.comps[0].class0_cdf, sizeof(default_nmv_context.comps[0].class0_cdf));
memcpy(fc->ndvc_0_class0_fp_cdf, default_nmv_context.comps[0].class0_fp_cdf, sizeof(default_nmv_context.comps[0].class0_fp_cdf));
memcpy(fc->ndvc_0_class0_hp_cdf, default_nmv_context.comps[0].class0_hp_cdf, sizeof(default_nmv_context.comps[0].class0_hp_cdf));
memcpy(fc->ndvc_0_classes_cdf, default_nmv_context.comps[0].classes_cdf, sizeof(default_nmv_context.comps[0].classes_cdf));
memcpy(fc->ndvc_0_fp_cdf, default_nmv_context.comps[0].fp_cdf, sizeof(default_nmv_context.comps[0].fp_cdf));
memcpy(fc->ndvc_0_hp_cdf, default_nmv_context.comps[0].hp_cdf, sizeof(default_nmv_context.comps[0].hp_cdf));
memcpy(fc->ndvc_0_sign_cdf, default_nmv_context.comps[0].sign_cdf, sizeof(default_nmv_context.comps[0].sign_cdf));
memcpy(fc->ndvc_1_bits_cdf, default_nmv_context.comps[1].bits_cdf, sizeof(default_nmv_context.comps[1].bits_cdf));
memcpy(fc->ndvc_1_class0_cdf, default_nmv_context.comps[1].class0_cdf, sizeof(default_nmv_context.comps[1].class0_cdf));
memcpy(fc->ndvc_1_class0_fp_cdf, default_nmv_context.comps[1].class0_fp_cdf, sizeof(default_nmv_context.comps[1].class0_fp_cdf));
memcpy(fc->ndvc_1_class0_hp_cdf, default_nmv_context.comps[1].class0_hp_cdf, sizeof(default_nmv_context.comps[1].class0_hp_cdf));
memcpy(fc->ndvc_1_classes_cdf, default_nmv_context.comps[1].classes_cdf, sizeof(default_nmv_context.comps[1].classes_cdf));
memcpy(fc->ndvc_1_fp_cdf, default_nmv_context.comps[1].fp_cdf, sizeof(default_nmv_context.comps[1].fp_cdf));
memcpy(fc->ndvc_1_hp_cdf, default_nmv_context.comps[1].hp_cdf, sizeof(default_nmv_context.comps[1].hp_cdf));
memcpy(fc->ndvc_1_sign_cdf, default_nmv_context.comps[1].sign_cdf, sizeof(default_nmv_context.comps[1].sign_cdf));
}
static void rvcn_av1_default_coef_probs(void *prob, int index)
{
rvcn_av1_frame_context_t * fc = (rvcn_av1_frame_context_t*)prob;
......@@ -1215,6 +1316,37 @@ static void rvcn_av1_default_coef_probs(void *prob, int index)
memcpy(fc->eob_flag_cdf1024, av1_default_eob_multi1024_cdfs[index], sizeof(av1_default_eob_multi1024_cdfs[index]));
}
static void rvcn_vcn4_av1_default_coef_probs(void *prob, int index)
{
rvcn_av1_vcn4_frame_context_t * fc = (rvcn_av1_vcn4_frame_context_t*)prob;
void *p;
int i, j;
unsigned size;
memcpy(fc->txb_skip_cdf, av1_default_txb_skip_cdfs[index], sizeof(av1_default_txb_skip_cdfs[index]));
p = (void *)fc->eob_extra_cdf;
size = sizeof(av1_default_eob_extra_cdfs[0][0][0][0]) * EOB_COEF_CONTEXTS_VCN4;
for (i = 0; i < AV1_TX_SIZES; i++) {
for ( j = 0; j < AV1_PLANE_TYPES; j++) {
memcpy(p, &av1_default_eob_extra_cdfs[index][i][j][3], size);
p += size;
}
}
memcpy(fc->dc_sign_cdf, av1_default_dc_sign_cdfs[index], sizeof(av1_default_dc_sign_cdfs[index]));
memcpy(fc->coeff_br_cdf, av1_default_coeff_lps_multi_cdfs[index], sizeof(av1_default_coeff_lps_multi_cdfs[index]));
memcpy(fc->coeff_base_cdf, av1_default_coeff_base_multi_cdfs[index], sizeof(av1_default_coeff_base_multi_cdfs[index]));
memcpy(fc->coeff_base_eob_cdf, av1_default_coeff_base_eob_multi_cdfs[index], sizeof(av1_default_coeff_base_eob_multi_cdfs[index]));
memcpy(fc->eob_flag_cdf16, av1_default_eob_multi16_cdfs[index], sizeof(av1_default_eob_multi16_cdfs[index]));
memcpy(fc->eob_flag_cdf32, av1_default_eob_multi32_cdfs[index], sizeof(av1_default_eob_multi32_cdfs[index]));
memcpy(fc->eob_flag_cdf64, av1_default_eob_multi64_cdfs[index], sizeof(av1_default_eob_multi64_cdfs[index]));
memcpy(fc->eob_flag_cdf128, av1_default_eob_multi128_cdfs[index], sizeof(av1_default_eob_multi128_cdfs[index]));
memcpy(fc->eob_flag_cdf256, av1_default_eob_multi256_cdfs[index], sizeof(av1_default_eob_multi256_cdfs[index]));
memcpy(fc->eob_flag_cdf512, av1_default_eob_multi512_cdfs[index], sizeof(av1_default_eob_multi512_cdfs[index]));
memcpy(fc->eob_flag_cdf1024, av1_default_eob_multi1024_cdfs[index], sizeof(av1_default_eob_multi1024_cdfs[index]));
}
static unsigned calc_ctx_size_h265_main(struct radeon_decoder *dec)
{
unsigned width = align(dec->base.width, VL_MACROBLOCK_WIDTH);
......@@ -1902,22 +2034,37 @@ static struct pb_buffer *rvcn_dec_message_decode(struct radeon_decoder *dec,
index_codec->message_id = RDECODE_MESSAGE_AV1;
if (dec->ctx.res == NULL) {
unsigned ctx_size = (9 + 4) * align(sizeof(rvcn_av1_hw_frame_context_t), 2048) +
9 * 64 * 34 * 512 + 9 * 64 * 34 * 256 * 5;
unsigned frame_ctxt_size = dec->av1_version == RDECODE_AV1_VER_0
? align(sizeof(rvcn_av1_frame_context_t), 2048)
: align(sizeof(rvcn_av1_vcn4_frame_context_t), 2048);
unsigned ctx_size = (9 + 4) * frame_ctxt_size + 9 * 64 * 34 * 512 + 9 * 64 * 34 * 256 * 5;
int num_64x64_CTB_8k = 68;
int num_128x128_CTB_8k = 34;
int sdb_pitch_64x64 = align(32 * num_64x64_CTB_8k, 256);
int sdb_pitch_128x128 = align(32 * num_128x128_CTB_8k, 256);
int sdb_lf_size_ctb_64x64 = sdb_pitch_64x64 * (1728 / 32);
int sdb_lf_size_ctb_128x128 = sdb_pitch_128x128 * (3008 / 32);
int sdb_superres_size_ctb_64x64 = sdb_pitch_64x64 * (3232 / 32);
int sdb_superres_size_ctb_128x128 = sdb_pitch_128x128 * (6208 / 32);
int sdb_output_size_ctb_64x64 = sdb_pitch_64x64 * (1312 / 32);
int sdb_output_size_ctb_128x128 = sdb_pitch_128x128 * (2336 / 32);
int sdb_fg_avg_luma_size_ctb_64x64 = sdb_pitch_64x64 * (384 / 32);
int sdb_fg_avg_luma_size_ctb_128x128 = sdb_pitch_128x128 * (640 / 32);
int sdb_pitch_64x64 = align(32 * num_64x64_CTB_8k, 256) * 2;
int sdb_pitch_128x128 = align(32 * num_128x128_CTB_8k, 256) * 2;
int sdb_lf_size_ctb_64x64 = sdb_pitch_64x64 * (align(1728, 64) / 64);
int sdb_lf_size_ctb_128x128 = sdb_pitch_128x128 * (align(3008, 64) / 64);
int sdb_superres_size_ctb_64x64 = sdb_pitch_64x64 * (align(3232, 64) / 64);
int sdb_superres_size_ctb_128x128 = sdb_pitch_128x128 * (align(6208, 64) / 64);
int sdb_output_size_ctb_64x64 = sdb_pitch_64x64 * (align(1312, 64) / 64);
int sdb_output_size_ctb_128x128 = sdb_pitch_128x128 * (align(2336, 64) / 64);
int sdb_fg_avg_luma_size_ctb_64x64 = sdb_pitch_64x64 * (align(384, 64) / 64);
int sdb_fg_avg_luma_size_ctb_128x128 = sdb_pitch_128x128 * (align(640, 64) / 64);
uint8_t *ptr;
int i;
struct rvcn_av1_prob_funcs prob;
if (dec->av1_version == RDECODE_AV1_VER_0) {
prob.init_mode_probs = rvcn_init_mode_probs;
prob.init_mv_probs = rvcn_av1_init_mv_probs;
prob.default_coef_probs = rvcn_av1_default_coef_probs;
} else {
prob.init_mode_probs = rvcn_vcn4_init_mode_probs;
prob.init_mv_probs = rvcn_vcn4_av1_init_mv_probs;
prob.default_coef_probs = rvcn_vcn4_av1_default_coef_probs;
}
ctx_size += (MAX2(sdb_lf_size_ctb_64x64, sdb_lf_size_ctb_128x128) +
MAX2(sdb_superres_size_ctb_64x64, sdb_superres_size_ctb_128x128) +
......@@ -1931,9 +2078,9 @@ static struct pb_buffer *rvcn_dec_message_decode(struct radeon_decoder *dec,
ptr = dec->ws->buffer_map(dec->ws, dec->ctx.res->buf, &dec->cs, PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
for (i = 0; i < 4; ++i) {
rvcn_init_mode_probs((void*)(ptr + i * align(sizeof(rvcn_av1_frame_context_t), 2048)));
rvcn_av1_init_mv_probs((void*)(ptr + i * align(sizeof(rvcn_av1_frame_context_t), 2048)));
rvcn_av1_default_coef_probs((void*)(ptr + i * align(sizeof(rvcn_av1_frame_context_t), 2048)), i);
prob.init_mode_probs((void*)(ptr + i * frame_ctxt_size));
prob.init_mv_probs((void*)(ptr + i * frame_ctxt_size));
prob.default_coef_probs((void*)(ptr + i * frame_ctxt_size), i);
}
dec->ws->buffer_unmap(dec->ws, dec->ctx.res->buf);
}
......@@ -2678,6 +2825,7 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context,
si_vid_clear_buffer(context, &dec->sessionctx);
dec->addr_gfx_mode = RDECODE_ARRAY_MODE_LINEAR;
dec->av1_version = RDECODE_AV1_VER_0;
switch (sctx->family) {
case CHIP_RAVEN:
......@@ -2717,6 +2865,7 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context,
case CHIP_GFX1102:
dec->jpg.direct_reg = true;
dec->addr_gfx_mode = RDECODE_ARRAY_MODE_ADDRLIB_SEL_GFX11;
dec->av1_version = RDECODE_AV1_VER_1;
break;
default:
RVID_ERR("VCN is not supported.\n");
......
......@@ -76,6 +76,7 @@ struct radeon_decoder {
void *render_pic_list[32];
unsigned h264_valid_ref_num[17];
unsigned h264_valid_poc_num[34];
unsigned av1_version;
bool show_frame;
unsigned ref_idx;
bool tmz_ctx;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment