// SPDX-License-Identifier: MIT // // Copyright 2024 Advanced Micro Devices, Inc. #include "spl_debug.h" #include "dc_spl_filters.h" #include "dc_spl_isharp_filters.h" //======================================== // Delta Gain 1DLUT // LUT content is packed as 4-bytes into one DWORD/entry // A_start = 0.000000 // A_end = 10.000000 // A_gain = 2.000000 // B_start = 11.000000 // B_end = 86.000000 // C_start = 40.000000 // C_end = 64.000000 //======================================== static const uint32_t filter_isharp_1D_lut_0[ISHARP_LUT_TABLE_SIZE] = …; //======================================== // Delta Gain 1DLUT // LUT content is packed as 4-bytes into one DWORD/entry // A_start = 0.000000 // A_end = 10.000000 // A_gain = 0.500000 // B_start = 11.000000 // B_end = 127.000000 // C_start = 96.000000 // C_end = 127.000000 //======================================== static const uint32_t filter_isharp_1D_lut_0p5x[ISHARP_LUT_TABLE_SIZE] = …; //======================================== // Delta Gain 1DLUT // LUT content is packed as 4-bytes into one DWORD/entry // A_start = 0.000000 // A_end = 10.000000 // A_gain = 1.000000 // B_start = 11.000000 // B_end = 127.000000 // C_start = 96.000000 // C_end = 127.000000 //======================================== static const uint32_t filter_isharp_1D_lut_1p0x[ISHARP_LUT_TABLE_SIZE] = …; //======================================== // Delta Gain 1DLUT // LUT content is packed as 4-bytes into one DWORD/entry // A_start = 0.000000 // A_end = 10.000000 // A_gain = 1.500000 // B_start = 11.000000 // B_end = 127.000000 // C_start = 96.000000 // C_end = 127.000000 //======================================== static const uint32_t filter_isharp_1D_lut_1p5x[ISHARP_LUT_TABLE_SIZE] = …; //======================================== // Delta Gain 1DLUT // LUT content is packed as 4-bytes into one DWORD/entry // A_start = 0.000000 // A_end = 10.000000 // A_gain = 2.000000 // B_start = 11.000000 // B_end = 127.000000 // C_start = 40.000000 // C_end = 127.000000 //======================================== static const uint32_t filter_isharp_1D_lut_2p0x[ISHARP_LUT_TABLE_SIZE] = …; //======================================== // Delta Gain 1DLUT // LUT content is packed as 4-bytes into one DWORD/entry // A_start = 0.000000 // A_end = 10.000000 // A_gain = 3.000000 // B_start = 11.000000 // B_end = 127.000000 // C_start = 40.000000 // C_end = 127.000000 //======================================== static const uint32_t filter_isharp_1D_lut_3p0x[ISHARP_LUT_TABLE_SIZE] = …; //======================================== // Wide scaler coefficients //======================================================== // <using> gen_scaler_coeffs.m // <date> 15-Dec-2021 // <coeffDescrip> 6t_64p_LanczosEd_p_1_p_10qb_ // <num_taps> 6 // <num_phases> 64 // <CoefType> LanczosEd // <CoefQuant> S1.10 //======================================================== static const uint16_t filter_isharp_wide_6tap_64p[198] = …; // Blur and scale coefficients //======================================================== // <using> gen_BlurScale_coeffs.m // <date> 25-Apr-2022 // <num_taps> 4 // <num_phases> 64 // <CoefType> Blur & Scale LPF // <CoefQuant> S1.10 //======================================================== static const uint16_t filter_isharp_bs_4tap_in_6_64p[198] = …; //======================================================== // <using> gen_BlurScale_coeffs.m // <date> 25-Apr-2022 // <num_taps> 4 // <num_phases> 64 // <CoefType> Blur & Scale LPF // <CoefQuant> S1.10 //======================================================== static const uint16_t filter_isharp_bs_4tap_64p[132] = …; //======================================================== // <using> gen_BlurScale_coeffs.m // <date> 09-Jun-2022 // <num_taps> 3 // <num_phases> 64 // <CoefType> Blur & Scale LPF // <CoefQuant> S1.10 //======================================================== static const uint16_t filter_isharp_bs_3tap_64p[99] = …; /* Converted Blur & Scale coeff tables from S1.10 to S1.12 */ static uint16_t filter_isharp_bs_4tap_in_6_64p_s1_12[198]; static uint16_t filter_isharp_bs_4tap_64p_s1_12[132]; static uint16_t filter_isharp_bs_3tap_64p_s1_12[99]; /* Pre-generated 1DLUT for given setup and sharpness level */ struct isharp_1D_lut_pregen filter_isharp_1D_lut_pregen[NUM_SHARPNESS_SETUPS] = …; struct scale_ratio_to_sharpness_level_adj sharpness_level_adj[NUM_SHARPNESS_ADJ_LEVELS] = …; const uint32_t *spl_get_filter_isharp_1D_lut_0(void) { … } const uint32_t *spl_get_filter_isharp_1D_lut_0p5x(void) { … } const uint32_t *spl_get_filter_isharp_1D_lut_1p0x(void) { … } const uint32_t *spl_get_filter_isharp_1D_lut_1p5x(void) { … } const uint32_t *spl_get_filter_isharp_1D_lut_2p0x(void) { … } const uint32_t *spl_get_filter_isharp_1D_lut_3p0x(void) { … } const uint16_t *spl_get_filter_isharp_wide_6tap_64p(void) { … } uint16_t *spl_get_filter_isharp_bs_4tap_in_6_64p(void) { … } uint16_t *spl_get_filter_isharp_bs_4tap_64p(void) { … } uint16_t *spl_get_filter_isharp_bs_3tap_64p(void) { … } static unsigned int spl_calculate_sharpness_level_adj(struct spl_fixed31_32 ratio) { … } static unsigned int spl_calculate_sharpness_level(struct spl_fixed31_32 ratio, int discrete_sharpness_level, enum system_setup setup, struct spl_sharpness_range sharpness_range, enum scale_to_sharpness_policy scale_to_sharpness_policy) { … } void spl_build_isharp_1dlut_from_reference_curve(struct spl_fixed31_32 ratio, enum system_setup setup, struct adaptive_sharpness sharpness, enum scale_to_sharpness_policy scale_to_sharpness_policy) { … } uint32_t *spl_get_pregen_filter_isharp_1D_lut(enum system_setup setup) { … } void spl_init_blur_scale_coeffs(void) { … } uint16_t *spl_dscl_get_blur_scale_coeffs_64p(int taps) { … } void spl_set_blur_scale_data(struct dscl_prog_data *dscl_prog_data, const struct spl_scaler_data *data) { … }