drm/amd/display: Add configurable SPL namespace prefix

[WHY]
SPL is a shared library that is used both in kernel and userspace.
When multiple libraries use SPL as statically linked, namespace
collision occur.

[HOW]
Create a configurable namespace prefix.
Add the prefix to all the public functions of the library to
distinguish between the SPL functions in each library.

Reviewed-by: Samson Tam <samson.tam@amd.com>
Signed-off-by: Navid Assadian <Navid.Assadian@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Navid Assadian 2025-11-12 14:35:12 -05:00 committed by Alex Deucher
parent 0e7f7b3a20
commit 25888a4663
15 changed files with 327 additions and 300 deletions

View File

@ -7,7 +7,7 @@
#include "dc_spl_isharp_filters.h"
#include "spl_debug.h"
#define IDENTITY_RATIO(ratio) (spl_fixpt_u3d19(ratio) == (1 << 19))
#define IDENTITY_RATIO(ratio) (SPL_NAMESPACE(spl_fixpt_u3d19(ratio)) == (1 << 19))
#define MIN_VIEWPORT_SIZE 12
static bool spl_is_yuv420(enum spl_pixel_format format)
@ -161,22 +161,24 @@ static struct spl_rect calculate_plane_rec_in_timing_active(
struct spl_fixed31_32 temp;
temp = spl_fixpt_from_fraction(rec_in->x * (long long)stream_dst->width,
stream_src->width);
temp = SPL_NAMESPACE(spl_fixpt_from_fraction(
rec_in->x * (long long)stream_dst->width,
stream_src->width));
rec_out.x = stream_dst->x + spl_fixpt_round(temp);
temp = spl_fixpt_from_fraction(
temp = SPL_NAMESPACE(spl_fixpt_from_fraction(
(rec_in->x + rec_in->width) * (long long)stream_dst->width,
stream_src->width);
stream_src->width));
rec_out.width = stream_dst->x + spl_fixpt_round(temp) - rec_out.x;
temp = spl_fixpt_from_fraction(rec_in->y * (long long)stream_dst->height,
stream_src->height);
temp = SPL_NAMESPACE(spl_fixpt_from_fraction(
rec_in->y * (long long)stream_dst->height,
stream_src->height));
rec_out.y = stream_dst->y + spl_fixpt_round(temp);
temp = spl_fixpt_from_fraction(
temp = SPL_NAMESPACE(spl_fixpt_from_fraction(
(rec_in->y + rec_in->height) * (long long)stream_dst->height,
stream_src->height);
stream_src->height));
rec_out.height = stream_dst->y + spl_fixpt_round(temp) - rec_out.y;
return rec_out;
@ -442,12 +444,12 @@ static void spl_calculate_scaling_ratios(struct spl_in *spl_in,
spl_in->basic_in.rotation == SPL_ROTATION_ANGLE_270)
spl_swap(surf_src.height, surf_src.width);
spl_scratch->scl_data.ratios.horz = spl_fixpt_from_fraction(
spl_scratch->scl_data.ratios.horz = SPL_NAMESPACE(spl_fixpt_from_fraction(
surf_src.width,
spl_in->basic_in.dst_rect.width);
spl_scratch->scl_data.ratios.vert = spl_fixpt_from_fraction(
spl_in->basic_in.dst_rect.width));
spl_scratch->scl_data.ratios.vert = SPL_NAMESPACE(spl_fixpt_from_fraction(
surf_src.height,
spl_in->basic_in.dst_rect.height);
spl_in->basic_in.dst_rect.height));
if (spl_in->basic_out.view_format == SPL_VIEW_3D_SIDE_BY_SIDE)
spl_scratch->scl_data.ratios.horz.value *= 2;
@ -480,14 +482,14 @@ static void spl_calculate_scaling_ratios(struct spl_in *spl_in,
* that is output/input. Currently we calculate input/output
* Store 1/ratio in recip_ratio for those lookups
*/
spl_scratch->scl_data.recip_ratios.horz = spl_fixpt_recip(
spl_scratch->scl_data.ratios.horz);
spl_scratch->scl_data.recip_ratios.vert = spl_fixpt_recip(
spl_scratch->scl_data.ratios.vert);
spl_scratch->scl_data.recip_ratios.horz_c = spl_fixpt_recip(
spl_scratch->scl_data.ratios.horz_c);
spl_scratch->scl_data.recip_ratios.vert_c = spl_fixpt_recip(
spl_scratch->scl_data.ratios.vert_c);
spl_scratch->scl_data.recip_ratios.horz = SPL_NAMESPACE(spl_fixpt_recip(
spl_scratch->scl_data.ratios.horz));
spl_scratch->scl_data.recip_ratios.vert = SPL_NAMESPACE(spl_fixpt_recip(
spl_scratch->scl_data.ratios.vert));
spl_scratch->scl_data.recip_ratios.horz_c = SPL_NAMESPACE(spl_fixpt_recip(
spl_scratch->scl_data.ratios.horz_c));
spl_scratch->scl_data.recip_ratios.vert_c = SPL_NAMESPACE(spl_fixpt_recip(
spl_scratch->scl_data.ratios.vert_c));
}
/* Calculate Viewport size */
@ -646,11 +648,11 @@ static void spl_calculate_inits_and_viewports(struct spl_in *spl_in,
switch (spl_in->basic_in.cositing) {
case CHROMA_COSITING_TOPLEFT:
init_adj_h = spl_fixpt_from_fraction(h_sign, 4);
init_adj_v = spl_fixpt_from_fraction(v_sign, 4);
init_adj_h = SPL_NAMESPACE(spl_fixpt_from_fraction(h_sign, 4));
init_adj_v = SPL_NAMESPACE(spl_fixpt_from_fraction(v_sign, 4));
break;
case CHROMA_COSITING_LEFT:
init_adj_h = spl_fixpt_from_fraction(h_sign, 4);
init_adj_h = SPL_NAMESPACE(spl_fixpt_from_fraction(h_sign, 4));
init_adj_v = spl_fixpt_zero;
break;
case CHROMA_COSITING_NONE:
@ -939,16 +941,16 @@ static void spl_get_taps_non_adaptive_scaler(
* Max downscale supported is 6.0x. Add ASSERT to catch if go beyond that
*/
check_max_downscale = spl_fixpt_le(spl_scratch->scl_data.ratios.horz,
spl_fixpt_from_fraction(6, 1));
SPL_NAMESPACE(spl_fixpt_from_fraction(6, 1)));
SPL_ASSERT(check_max_downscale);
check_max_downscale = spl_fixpt_le(spl_scratch->scl_data.ratios.vert,
spl_fixpt_from_fraction(6, 1));
SPL_NAMESPACE(spl_fixpt_from_fraction(6, 1)));
SPL_ASSERT(check_max_downscale);
check_max_downscale = spl_fixpt_le(spl_scratch->scl_data.ratios.horz_c,
spl_fixpt_from_fraction(6, 1));
SPL_NAMESPACE(spl_fixpt_from_fraction(6, 1)));
SPL_ASSERT(check_max_downscale);
check_max_downscale = spl_fixpt_le(spl_scratch->scl_data.ratios.vert_c,
spl_fixpt_from_fraction(6, 1));
SPL_NAMESPACE(spl_fixpt_from_fraction(6, 1)));
SPL_ASSERT(check_max_downscale);
@ -1194,35 +1196,39 @@ static void spl_set_manual_ratio_init_data(struct dscl_prog_data *dscl_prog_data
{
struct spl_fixed31_32 bot;
dscl_prog_data->ratios.h_scale_ratio = spl_fixpt_u3d19(scl_data->ratios.horz) << 5;
dscl_prog_data->ratios.v_scale_ratio = spl_fixpt_u3d19(scl_data->ratios.vert) << 5;
dscl_prog_data->ratios.h_scale_ratio_c = spl_fixpt_u3d19(scl_data->ratios.horz_c) << 5;
dscl_prog_data->ratios.v_scale_ratio_c = spl_fixpt_u3d19(scl_data->ratios.vert_c) << 5;
dscl_prog_data->ratios.h_scale_ratio = SPL_NAMESPACE(spl_fixpt_u3d19(
scl_data->ratios.horz)) << 5;
dscl_prog_data->ratios.v_scale_ratio = SPL_NAMESPACE(spl_fixpt_u3d19(
scl_data->ratios.vert)) << 5;
dscl_prog_data->ratios.h_scale_ratio_c = SPL_NAMESPACE(spl_fixpt_u3d19(
scl_data->ratios.horz_c)) << 5;
dscl_prog_data->ratios.v_scale_ratio_c = SPL_NAMESPACE(spl_fixpt_u3d19(
scl_data->ratios.vert_c)) << 5;
/*
* 0.24 format for fraction, first five bits zeroed
*/
dscl_prog_data->init.h_filter_init_frac =
spl_fixpt_u0d19(scl_data->inits.h) << 5;
SPL_NAMESPACE(spl_fixpt_u0d19(scl_data->inits.h)) << 5;
dscl_prog_data->init.h_filter_init_int =
spl_fixpt_floor(scl_data->inits.h);
dscl_prog_data->init.h_filter_init_frac_c =
spl_fixpt_u0d19(scl_data->inits.h_c) << 5;
SPL_NAMESPACE(spl_fixpt_u0d19(scl_data->inits.h_c)) << 5;
dscl_prog_data->init.h_filter_init_int_c =
spl_fixpt_floor(scl_data->inits.h_c);
dscl_prog_data->init.v_filter_init_frac =
spl_fixpt_u0d19(scl_data->inits.v) << 5;
SPL_NAMESPACE(spl_fixpt_u0d19(scl_data->inits.v)) << 5;
dscl_prog_data->init.v_filter_init_int =
spl_fixpt_floor(scl_data->inits.v);
dscl_prog_data->init.v_filter_init_frac_c =
spl_fixpt_u0d19(scl_data->inits.v_c) << 5;
SPL_NAMESPACE(spl_fixpt_u0d19(scl_data->inits.v_c)) << 5;
dscl_prog_data->init.v_filter_init_int_c =
spl_fixpt_floor(scl_data->inits.v_c);
bot = spl_fixpt_add(scl_data->inits.v, scl_data->ratios.vert);
dscl_prog_data->init.v_filter_init_bot_frac = spl_fixpt_u0d19(bot) << 5;
dscl_prog_data->init.v_filter_init_bot_frac = SPL_NAMESPACE(spl_fixpt_u0d19(bot)) << 5;
dscl_prog_data->init.v_filter_init_bot_int = spl_fixpt_floor(bot);
bot = spl_fixpt_add(scl_data->inits.v_c, scl_data->ratios.vert_c);
dscl_prog_data->init.v_filter_init_bot_frac_c = spl_fixpt_u0d19(bot) << 5;
dscl_prog_data->init.v_filter_init_bot_frac_c = SPL_NAMESPACE(spl_fixpt_u0d19(bot)) << 5;
dscl_prog_data->init.v_filter_init_bot_int_c = spl_fixpt_floor(bot);
}
@ -1270,7 +1276,7 @@ static void spl_set_dscl_prog_data(struct spl_in *spl_in, struct spl_scratch *sp
// Set viewport_c
dscl_prog_data->viewport_c = spl_scratch->scl_data.viewport_c;
// Set filters data
spl_set_filters_data(dscl_prog_data, data, enable_easf_v, enable_easf_h);
SPL_NAMESPACE(spl_set_filters_data(dscl_prog_data, data, enable_easf_v, enable_easf_h));
}
/* Calculate C0-C3 coefficients based on HDR_mult */
@ -1286,28 +1292,31 @@ static void spl_calculate_c0_c3_hdr(struct dscl_prog_data *dscl_prog_data, uint3
else
hdr_multx100_int = 100; /* default for 80 nits otherwise */
hdr_mult = spl_fixpt_from_fraction((long long)hdr_multx100_int, 100LL);
c0_mult = spl_fixpt_from_fraction(2126LL, 10000LL);
c1_mult = spl_fixpt_from_fraction(7152LL, 10000LL);
c2_mult = spl_fixpt_from_fraction(722LL, 10000LL);
hdr_mult = SPL_NAMESPACE(spl_fixpt_from_fraction((long long)hdr_multx100_int, 100LL));
c0_mult = SPL_NAMESPACE(spl_fixpt_from_fraction(2126LL, 10000LL));
c1_mult = SPL_NAMESPACE(spl_fixpt_from_fraction(7152LL, 10000LL));
c2_mult = SPL_NAMESPACE(spl_fixpt_from_fraction(722LL, 10000LL));
c0_calc = spl_fixpt_mul(hdr_mult, spl_fixpt_mul(c0_mult, spl_fixpt_from_fraction(
16384LL, 125LL)));
c1_calc = spl_fixpt_mul(hdr_mult, spl_fixpt_mul(c1_mult, spl_fixpt_from_fraction(
16384LL, 125LL)));
c2_calc = spl_fixpt_mul(hdr_mult, spl_fixpt_mul(c2_mult, spl_fixpt_from_fraction(
16384LL, 125LL)));
c0_calc = SPL_NAMESPACE(spl_fixpt_mul(hdr_mult, SPL_NAMESPACE(spl_fixpt_mul(c0_mult,
SPL_NAMESPACE(spl_fixpt_from_fraction(16384LL, 125LL))))));
c1_calc = SPL_NAMESPACE(spl_fixpt_mul(hdr_mult, SPL_NAMESPACE(spl_fixpt_mul(c1_mult,
SPL_NAMESPACE(spl_fixpt_from_fraction(16384LL, 125LL))))));
c2_calc = SPL_NAMESPACE(spl_fixpt_mul(hdr_mult, SPL_NAMESPACE(spl_fixpt_mul(c2_mult,
SPL_NAMESPACE(spl_fixpt_from_fraction(16384LL, 125LL))))));
fmt.exponenta_bits = 5;
fmt.mantissa_bits = 10;
fmt.sign = true;
// fp1.5.10, C0 coefficient (LN_rec709: HDR_MULT * 0.212600 * 2^14/125)
spl_convert_to_custom_float_format(c0_calc, &fmt, &dscl_prog_data->easf_matrix_c0);
SPL_NAMESPACE(spl_convert_to_custom_float_format(c0_calc, &fmt,
&dscl_prog_data->easf_matrix_c0));
// fp1.5.10, C1 coefficient (LN_rec709: HDR_MULT * 0.715200 * 2^14/125)
spl_convert_to_custom_float_format(c1_calc, &fmt, &dscl_prog_data->easf_matrix_c1);
SPL_NAMESPACE(spl_convert_to_custom_float_format(c1_calc, &fmt,
&dscl_prog_data->easf_matrix_c1));
// fp1.5.10, C2 coefficient (LN_rec709: HDR_MULT * 0.072200 * 2^14/125)
spl_convert_to_custom_float_format(c2_calc, &fmt, &dscl_prog_data->easf_matrix_c2);
SPL_NAMESPACE(spl_convert_to_custom_float_format(c2_calc, &fmt,
&dscl_prog_data->easf_matrix_c2));
dscl_prog_data->easf_matrix_c3 = 0x0; // fp1.5.10, C3 coefficient
}
@ -1325,48 +1334,48 @@ static void spl_set_easf_data(struct spl_scratch *spl_scratch, struct spl_out *s
dscl_prog_data->easf_v_bf1_en = 1; // 1-bit, BF1 calculation enable, 0=disable, 1=enable
dscl_prog_data->easf_v_bf2_mode = 0xF; // 4-bit, BF2 calculation mode
/* 2-bit, BF3 chroma mode correction calculation mode */
dscl_prog_data->easf_v_bf3_mode = spl_get_v_bf3_mode(
spl_scratch->scl_data.recip_ratios.vert);
dscl_prog_data->easf_v_bf3_mode = SPL_NAMESPACE(spl_get_v_bf3_mode(
spl_scratch->scl_data.recip_ratios.vert));
/* FP1.5.10 [ minCoef ]*/
dscl_prog_data->easf_v_ringest_3tap_dntilt_uptilt =
spl_get_3tap_dntilt_uptilt_offset(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert);
SPL_NAMESPACE(spl_get_3tap_dntilt_uptilt_offset(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert));
/* FP1.5.10 [ upTiltMaxVal ]*/
dscl_prog_data->easf_v_ringest_3tap_uptilt_max =
spl_get_3tap_uptilt_maxval(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert);
SPL_NAMESPACE(spl_get_3tap_uptilt_maxval(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert));
/* FP1.5.10 [ dnTiltSlope ]*/
dscl_prog_data->easf_v_ringest_3tap_dntilt_slope =
spl_get_3tap_dntilt_slope(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert);
SPL_NAMESPACE(spl_get_3tap_dntilt_slope(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert));
/* FP1.5.10 [ upTilt1Slope ]*/
dscl_prog_data->easf_v_ringest_3tap_uptilt1_slope =
spl_get_3tap_uptilt1_slope(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert);
SPL_NAMESPACE(spl_get_3tap_uptilt1_slope(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert));
/* FP1.5.10 [ upTilt2Slope ]*/
dscl_prog_data->easf_v_ringest_3tap_uptilt2_slope =
spl_get_3tap_uptilt2_slope(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert);
SPL_NAMESPACE(spl_get_3tap_uptilt2_slope(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert));
/* FP1.5.10 [ upTilt2Offset ]*/
dscl_prog_data->easf_v_ringest_3tap_uptilt2_offset =
spl_get_3tap_uptilt2_offset(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert);
SPL_NAMESPACE(spl_get_3tap_uptilt2_offset(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert));
/* FP1.5.10; (2.0) Ring reducer gain for 4 or 6-tap mode [H_REDUCER_GAIN4] */
dscl_prog_data->easf_v_ringest_eventap_reduceg1 =
spl_get_reducer_gain4(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert);
SPL_NAMESPACE(spl_get_reducer_gain4(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert));
/* FP1.5.10; (2.5) Ring reducer gain for 6-tap mode [V_REDUCER_GAIN6] */
dscl_prog_data->easf_v_ringest_eventap_reduceg2 =
spl_get_reducer_gain6(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert);
SPL_NAMESPACE(spl_get_reducer_gain6(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert));
/* FP1.5.10; (-0.135742) Ring gain for 6-tap set to -139/1024 */
dscl_prog_data->easf_v_ringest_eventap_gain1 =
spl_get_gainRing4(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert);
SPL_NAMESPACE(spl_get_gainRing4(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert));
/* FP1.5.10; (-0.024414) Ring gain for 6-tap set to -25/1024 */
dscl_prog_data->easf_v_ringest_eventap_gain2 =
spl_get_gainRing6(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert);
SPL_NAMESPACE(spl_get_gainRing6(spl_scratch->scl_data.taps.v_taps,
spl_scratch->scl_data.recip_ratios.vert));
dscl_prog_data->easf_v_bf_maxa = 63; //Vertical Max BF value A in U0.6 format.Selected if V_FCNTL == 0
dscl_prog_data->easf_v_bf_maxb = 63; //Vertical Max BF value A in U0.6 format.Selected if V_FCNTL == 1
dscl_prog_data->easf_v_bf_mina = 0; //Vertical Min BF value A in U0.6 format.Selected if V_FCNTL == 0
@ -1491,24 +1500,24 @@ static void spl_set_easf_data(struct spl_scratch *spl_scratch, struct spl_out *s
dscl_prog_data->easf_h_bf2_mode =
0xF; // 4-bit, BF2 calculation mode
/* 2-bit, BF3 chroma mode correction calculation mode */
dscl_prog_data->easf_h_bf3_mode = spl_get_h_bf3_mode(
spl_scratch->scl_data.recip_ratios.horz);
dscl_prog_data->easf_h_bf3_mode = SPL_NAMESPACE(spl_get_h_bf3_mode(
spl_scratch->scl_data.recip_ratios.horz));
/* FP1.5.10; (2.0) Ring reducer gain for 4 or 6-tap mode [H_REDUCER_GAIN4] */
dscl_prog_data->easf_h_ringest_eventap_reduceg1 =
spl_get_reducer_gain4(spl_scratch->scl_data.taps.h_taps,
spl_scratch->scl_data.recip_ratios.horz);
SPL_NAMESPACE(spl_get_reducer_gain4(spl_scratch->scl_data.taps.h_taps,
spl_scratch->scl_data.recip_ratios.horz));
/* FP1.5.10; (2.5) Ring reducer gain for 6-tap mode [V_REDUCER_GAIN6] */
dscl_prog_data->easf_h_ringest_eventap_reduceg2 =
spl_get_reducer_gain6(spl_scratch->scl_data.taps.h_taps,
spl_scratch->scl_data.recip_ratios.horz);
SPL_NAMESPACE(spl_get_reducer_gain6(spl_scratch->scl_data.taps.h_taps,
spl_scratch->scl_data.recip_ratios.horz));
/* FP1.5.10; (-0.135742) Ring gain for 6-tap set to -139/1024 */
dscl_prog_data->easf_h_ringest_eventap_gain1 =
spl_get_gainRing4(spl_scratch->scl_data.taps.h_taps,
spl_scratch->scl_data.recip_ratios.horz);
SPL_NAMESPACE(spl_get_gainRing4(spl_scratch->scl_data.taps.h_taps,
spl_scratch->scl_data.recip_ratios.horz));
/* FP1.5.10; (-0.024414) Ring gain for 6-tap set to -25/1024 */
dscl_prog_data->easf_h_ringest_eventap_gain2 =
spl_get_gainRing6(spl_scratch->scl_data.taps.h_taps,
spl_scratch->scl_data.recip_ratios.horz);
SPL_NAMESPACE(spl_get_gainRing6(spl_scratch->scl_data.taps.h_taps,
spl_scratch->scl_data.recip_ratios.horz));
dscl_prog_data->easf_h_bf_maxa = 63; //Horz Max BF value A in U0.6 format.Selected if H_FCNTL==0
dscl_prog_data->easf_h_bf_maxb = 63; //Horz Max BF value B in U0.6 format.Selected if H_FCNTL==1
dscl_prog_data->easf_h_bf_mina = 0; //Horz Min BF value B in U0.6 format.Selected if H_FCNTL==0
@ -1689,9 +1698,9 @@ static void spl_set_isharp_data(struct dscl_prog_data *dscl_prog_data,
return;
}
spl_build_isharp_1dlut_from_reference_curve(ratio, setup, adp_sharpness,
scale_to_sharpness_policy);
memcpy(dscl_prog_data->isharp_delta, spl_get_pregen_filter_isharp_1D_lut(setup),
SPL_NAMESPACE(spl_build_isharp_1dlut_from_reference_curve(ratio, setup, adp_sharpness,
scale_to_sharpness_policy));
memcpy(dscl_prog_data->isharp_delta, SPL_NAMESPACE(spl_get_pregen_filter_isharp_1D_lut(setup)),
sizeof(uint32_t) * ISHARP_LUT_TABLE_SIZE);
dscl_prog_data->sharpness_level = adp_sharpness.sharpness_level;
@ -1810,7 +1819,7 @@ static void spl_set_isharp_data(struct dscl_prog_data *dscl_prog_data,
}
// Set the values as per lookup table
spl_set_blur_scale_data(dscl_prog_data, data);
SPL_NAMESPACE(spl_set_blur_scale_data(dscl_prog_data, data));
}
/* Calculate recout, scaling ratio, and viewport, then get optimal number of taps */
@ -1922,4 +1931,3 @@ bool SPL_NAMESPACE(spl_get_number_of_taps(struct spl_in *spl_in, struct spl_out
spl_set_taps_data(dscl_prog_data, data);
return res;
}

View File

@ -9,14 +9,6 @@
#define BLACK_OFFSET_RGB_Y 0x0
#define BLACK_OFFSET_CBCR 0x8000
#ifndef SPL_PFX_
#define SPL_PFX_
#endif
#define SPL_EXPAND2(a, b) a##b
#define SPL_EXPAND(a, b) SPL_EXPAND2(a, b)
#define SPL_NAMESPACE(symbol) SPL_EXPAND(SPL_PFX_, symbol)
/* SPL interfaces */

View File

@ -4,8 +4,8 @@
#include "dc_spl_filters.h"
void convert_filter_s1_10_to_s1_12(const uint16_t *s1_10_filter,
uint16_t *s1_12_filter, int num_taps)
void SPL_NAMESPACE(convert_filter_s1_10_to_s1_12(const uint16_t *s1_10_filter,
uint16_t *s1_12_filter, int num_taps))
{
int num_entries = NUM_PHASES_COEFF * num_taps;
int i;

View File

@ -9,7 +9,7 @@
#define NUM_PHASES_COEFF 33
void convert_filter_s1_10_to_s1_12(const uint16_t *s1_10_filter,
uint16_t *s1_12_filter, int num_taps);
void SPL_NAMESPACE(convert_filter_s1_10_to_s1_12(const uint16_t *s1_10_filter,
uint16_t *s1_12_filter, int num_taps));
#endif /* __DC_SPL_FILTERS_H__ */

View File

@ -367,8 +367,8 @@ static unsigned int spl_calculate_sharpness_level_adj(struct spl_fixed31_32 rati
sharpness_level_down_adj = 0;
lookup_ptr = sharpness_level_adj;
while (j < NUM_SHARPNESS_ADJ_LEVELS) {
ratio_level = spl_fixpt_from_fraction(lookup_ptr->ratio_numer,
lookup_ptr->ratio_denom);
ratio_level = SPL_NAMESPACE(spl_fixpt_from_fraction(lookup_ptr->ratio_numer,
lookup_ptr->ratio_denom));
if (ratio.value >= ratio_level.value) {
sharpness_level_down_adj = lookup_ptr->level_down_adj;
break;
@ -447,8 +447,9 @@ static unsigned int spl_calculate_sharpness_level(struct spl_fixed31_32 ratio,
return sharpness_level;
}
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)
void SPL_NAMESPACE(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))
{
uint8_t *byte_ptr_1dlut_src, *byte_ptr_1dlut_dst;
struct spl_fixed31_32 sharp_base, sharp_calc, sharp_level;
@ -461,7 +462,7 @@ void spl_build_isharp_1dlut_from_reference_curve(struct spl_fixed31_32 ratio, en
unsigned int sharpnessX1000 = spl_calculate_sharpness_level(ratio,
sharpness.sharpness_level, setup,
sharpness.sharpness_range, scale_to_sharpness_policy);
sharp_level = spl_fixpt_from_fraction(sharpnessX1000, 1000);
sharp_level = SPL_NAMESPACE(spl_fixpt_from_fraction(sharpnessX1000, 1000));
/*
* Check if pregen 1dlut table is already precalculated
@ -486,10 +487,11 @@ void spl_build_isharp_1dlut_from_reference_curve(struct spl_fixed31_32 ratio, en
memset(byte_ptr_1dlut_dst, 0, size_1dlut);
for (j = 0; j < size_1dlut; j++) {
sharp_base = spl_fixpt_from_int((int)*byte_ptr_1dlut_src);
sharp_calc = spl_fixpt_mul(sharp_base, sharp_level);
sharp_calc = SPL_NAMESPACE(spl_fixpt_mul(sharp_base, sharp_level));
sharp_calc = spl_fixpt_div(sharp_calc, spl_fixpt_from_int(3));
sharp_calc = spl_fixpt_min(spl_fixpt_from_int(255), sharp_calc);
sharp_calc = spl_fixpt_add(sharp_calc, spl_fixpt_from_fraction(1, 2));
sharp_calc = spl_fixpt_add(sharp_calc,
SPL_NAMESPACE(spl_fixpt_from_fraction(1, 2)));
sharp_calc_int = spl_fixpt_floor(sharp_calc);
/* Clamp it at 0x7F so it doesn't wrap */
if (sharp_calc_int > 127)
@ -506,12 +508,12 @@ void spl_build_isharp_1dlut_from_reference_curve(struct spl_fixed31_32 ratio, en
filter_isharp_1D_lut_pregen[setup].sharpness_denom = 1000;
}
uint32_t *spl_get_pregen_filter_isharp_1D_lut(enum system_setup setup)
uint32_t *SPL_NAMESPACE(spl_get_pregen_filter_isharp_1D_lut(enum system_setup setup))
{
return filter_isharp_1D_lut_pregen[setup].value;
}
const uint16_t *spl_dscl_get_blur_scale_coeffs_64p(int taps)
const uint16_t *SPL_NAMESPACE(spl_dscl_get_blur_scale_coeffs_64p(int taps))
{
if (taps == 3)
return filter_isharp_bs_3tap_64p_s1_12;
@ -526,7 +528,7 @@ const uint16_t *spl_dscl_get_blur_scale_coeffs_64p(int taps)
}
}
const uint16_t *spl_dscl_get_blur_scale_coeffs_64p_s1_10(int taps)
const uint16_t *SPL_NAMESPACE(spl_dscl_get_blur_scale_coeffs_64p_s1_10(int taps))
{
if (taps == 3)
return filter_isharp_bs_3tap_64p;
@ -541,13 +543,12 @@ const uint16_t *spl_dscl_get_blur_scale_coeffs_64p_s1_10(int taps)
}
}
void spl_set_blur_scale_data(struct dscl_prog_data *dscl_prog_data,
const struct spl_scaler_data *data)
void SPL_NAMESPACE(spl_set_blur_scale_data(struct dscl_prog_data *dscl_prog_data,
const struct spl_scaler_data *data))
{
dscl_prog_data->filter_blur_scale_h =
spl_dscl_get_blur_scale_coeffs_64p(data->taps.h_taps);
SPL_NAMESPACE(spl_dscl_get_blur_scale_coeffs_64p(data->taps.h_taps));
dscl_prog_data->filter_blur_scale_v =
spl_dscl_get_blur_scale_coeffs_64p(data->taps.v_taps);
SPL_NAMESPACE(spl_dscl_get_blur_scale_coeffs_64p(data->taps.v_taps));
}

View File

@ -28,15 +28,17 @@ enum system_setup {
NUM_SHARPNESS_SETUPS
};
void spl_set_blur_scale_data(struct dscl_prog_data *dscl_prog_data,
const struct spl_scaler_data *data);
void SPL_NAMESPACE(spl_set_blur_scale_data(struct dscl_prog_data *dscl_prog_data,
const struct spl_scaler_data *data));
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_NAMESPACE(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_NAMESPACE(spl_get_pregen_filter_isharp_1D_lut(enum system_setup setup));
// public API
const uint16_t *spl_dscl_get_blur_scale_coeffs_64p(int taps);
const uint16_t *spl_dscl_get_blur_scale_coeffs_64p_s1_10(int taps);
const uint16_t *SPL_NAMESPACE(spl_dscl_get_blur_scale_coeffs_64p(int taps));
const uint16_t *SPL_NAMESPACE(spl_dscl_get_blur_scale_coeffs_64p_s1_10(int taps));
#endif /* __DC_SPL_ISHARP_FILTERS_H__ */

View File

@ -2194,19 +2194,19 @@ static struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt2_offset_lookup[]
static const uint16_t *spl_get_easf_filter_3tap_64p(struct spl_fixed31_32 ratio)
{
if (ratio.value < spl_fixpt_from_fraction(3, 10).value)
if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(3, 10)).value)
return easf_filter_3tap_64p_ratio_0_30_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(4, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 10)).value)
return easf_filter_3tap_64p_ratio_0_40_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(5, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 10)).value)
return easf_filter_3tap_64p_ratio_0_50_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(6, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(6, 10)).value)
return easf_filter_3tap_64p_ratio_0_60_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(7, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(7, 10)).value)
return easf_filter_3tap_64p_ratio_0_70_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(8, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(8, 10)).value)
return easf_filter_3tap_64p_ratio_0_80_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(9, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(9, 10)).value)
return easf_filter_3tap_64p_ratio_0_90_s1_12;
else
return easf_filter_3tap_64p_ratio_1_00_s1_12;
@ -2214,19 +2214,19 @@ static const uint16_t *spl_get_easf_filter_3tap_64p(struct spl_fixed31_32 ratio)
static const uint16_t *spl_get_easf_filter_4tap_64p(struct spl_fixed31_32 ratio)
{
if (ratio.value < spl_fixpt_from_fraction(3, 10).value)
if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(3, 10)).value)
return easf_filter_4tap_64p_ratio_0_30_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(4, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 10)).value)
return easf_filter_4tap_64p_ratio_0_40_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(5, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 10)).value)
return easf_filter_4tap_64p_ratio_0_50_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(6, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(6, 10)).value)
return easf_filter_4tap_64p_ratio_0_60_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(7, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(7, 10)).value)
return easf_filter_4tap_64p_ratio_0_70_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(8, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(8, 10)).value)
return easf_filter_4tap_64p_ratio_0_80_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(9, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(9, 10)).value)
return easf_filter_4tap_64p_ratio_0_90_s1_12;
else
return easf_filter_4tap_64p_ratio_1_00_s1_12;
@ -2234,25 +2234,26 @@ static const uint16_t *spl_get_easf_filter_4tap_64p(struct spl_fixed31_32 ratio)
static const uint16_t *spl_get_easf_filter_6tap_64p(struct spl_fixed31_32 ratio)
{
if (ratio.value < spl_fixpt_from_fraction(3, 10).value)
if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(3, 10)).value)
return easf_filter_6tap_64p_ratio_0_30_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(4, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 10)).value)
return easf_filter_6tap_64p_ratio_0_40_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(5, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 10)).value)
return easf_filter_6tap_64p_ratio_0_50_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(6, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(6, 10)).value)
return easf_filter_6tap_64p_ratio_0_60_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(7, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(7, 10)).value)
return easf_filter_6tap_64p_ratio_0_70_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(8, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(8, 10)).value)
return easf_filter_6tap_64p_ratio_0_80_s1_12;
else if (ratio.value < spl_fixpt_from_fraction(9, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(9, 10)).value)
return easf_filter_6tap_64p_ratio_0_90_s1_12;
else
return easf_filter_6tap_64p_ratio_1_00_s1_12;
}
const uint16_t *spl_dscl_get_easf_filter_coeffs_64p(int taps, struct spl_fixed31_32 ratio)
const uint16_t *SPL_NAMESPACE(spl_dscl_get_easf_filter_coeffs_64p(
int taps, struct spl_fixed31_32 ratio))
{
if (taps == 6)
return spl_get_easf_filter_6tap_64p(ratio);
@ -2269,19 +2270,19 @@ const uint16_t *spl_dscl_get_easf_filter_coeffs_64p(int taps, struct spl_fixed31
static const uint16_t *spl_get_easf_filter_3tap_64p_s1_10(struct spl_fixed31_32 ratio)
{
if (ratio.value < spl_fixpt_from_fraction(3, 10).value)
if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(3, 10)).value)
return easf_filter_3tap_64p_ratio_0_30;
else if (ratio.value < spl_fixpt_from_fraction(4, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 10)).value)
return easf_filter_3tap_64p_ratio_0_40;
else if (ratio.value < spl_fixpt_from_fraction(5, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 10)).value)
return easf_filter_3tap_64p_ratio_0_50;
else if (ratio.value < spl_fixpt_from_fraction(6, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(6, 10)).value)
return easf_filter_3tap_64p_ratio_0_60;
else if (ratio.value < spl_fixpt_from_fraction(7, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(7, 10)).value)
return easf_filter_3tap_64p_ratio_0_70;
else if (ratio.value < spl_fixpt_from_fraction(8, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(8, 10)).value)
return easf_filter_3tap_64p_ratio_0_80;
else if (ratio.value < spl_fixpt_from_fraction(9, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(9, 10)).value)
return easf_filter_3tap_64p_ratio_0_90;
else
return easf_filter_3tap_64p_ratio_1_00;
@ -2289,19 +2290,19 @@ static const uint16_t *spl_get_easf_filter_3tap_64p_s1_10(struct spl_fixed31_32
static const uint16_t *spl_get_easf_filter_4tap_64p_s1_10(struct spl_fixed31_32 ratio)
{
if (ratio.value < spl_fixpt_from_fraction(3, 10).value)
if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(3, 10)).value)
return easf_filter_4tap_64p_ratio_0_30;
else if (ratio.value < spl_fixpt_from_fraction(4, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 10)).value)
return easf_filter_4tap_64p_ratio_0_40;
else if (ratio.value < spl_fixpt_from_fraction(5, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 10)).value)
return easf_filter_4tap_64p_ratio_0_50;
else if (ratio.value < spl_fixpt_from_fraction(6, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(6, 10)).value)
return easf_filter_4tap_64p_ratio_0_60;
else if (ratio.value < spl_fixpt_from_fraction(7, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(7, 10)).value)
return easf_filter_4tap_64p_ratio_0_70;
else if (ratio.value < spl_fixpt_from_fraction(8, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(8, 10)).value)
return easf_filter_4tap_64p_ratio_0_80;
else if (ratio.value < spl_fixpt_from_fraction(9, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(9, 10)).value)
return easf_filter_4tap_64p_ratio_0_90;
else
return easf_filter_4tap_64p_ratio_1_00;
@ -2309,25 +2310,26 @@ static const uint16_t *spl_get_easf_filter_4tap_64p_s1_10(struct spl_fixed31_32
static const uint16_t *spl_get_easf_filter_6tap_64p_s1_10(struct spl_fixed31_32 ratio)
{
if (ratio.value < spl_fixpt_from_fraction(3, 10).value)
if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(3, 10)).value)
return easf_filter_6tap_64p_ratio_0_30;
else if (ratio.value < spl_fixpt_from_fraction(4, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 10)).value)
return easf_filter_6tap_64p_ratio_0_40;
else if (ratio.value < spl_fixpt_from_fraction(5, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 10)).value)
return easf_filter_6tap_64p_ratio_0_50;
else if (ratio.value < spl_fixpt_from_fraction(6, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(6, 10)).value)
return easf_filter_6tap_64p_ratio_0_60;
else if (ratio.value < spl_fixpt_from_fraction(7, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(7, 10)).value)
return easf_filter_6tap_64p_ratio_0_70;
else if (ratio.value < spl_fixpt_from_fraction(8, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(8, 10)).value)
return easf_filter_6tap_64p_ratio_0_80;
else if (ratio.value < spl_fixpt_from_fraction(9, 10).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(9, 10)).value)
return easf_filter_6tap_64p_ratio_0_90;
else
return easf_filter_6tap_64p_ratio_1_00;
}
const uint16_t *spl_dscl_get_easf_filter_coeffs_64p_s1_10(int taps, struct spl_fixed31_32 ratio)
const uint16_t *SPL_NAMESPACE(spl_dscl_get_easf_filter_coeffs_64p_s1_10(
int taps, struct spl_fixed31_32 ratio))
{
if (taps == 6)
return spl_get_easf_filter_6tap_64p_s1_10(ratio);
@ -2342,39 +2344,39 @@ const uint16_t *spl_dscl_get_easf_filter_coeffs_64p_s1_10(int taps, struct spl_f
}
}
void spl_set_filters_data(struct dscl_prog_data *dscl_prog_data,
void SPL_NAMESPACE(spl_set_filters_data(struct dscl_prog_data *dscl_prog_data,
const struct spl_scaler_data *data, bool enable_easf_v,
bool enable_easf_h)
bool enable_easf_h))
{
/*
* Old coefficients calculated scaling ratio = input / output
* New coefficients are calculated based on = output / input
*/
if (enable_easf_h) {
dscl_prog_data->filter_h = spl_dscl_get_easf_filter_coeffs_64p(
data->taps.h_taps, data->recip_ratios.horz);
dscl_prog_data->filter_h = SPL_NAMESPACE(spl_dscl_get_easf_filter_coeffs_64p(
data->taps.h_taps, data->recip_ratios.horz));
dscl_prog_data->filter_h_c = spl_dscl_get_easf_filter_coeffs_64p(
data->taps.h_taps_c, data->recip_ratios.horz_c);
dscl_prog_data->filter_h_c = SPL_NAMESPACE(spl_dscl_get_easf_filter_coeffs_64p(
data->taps.h_taps_c, data->recip_ratios.horz_c));
} else {
dscl_prog_data->filter_h = spl_dscl_get_filter_coeffs_64p(
data->taps.h_taps, data->ratios.horz);
dscl_prog_data->filter_h = SPL_NAMESPACE(spl_dscl_get_filter_coeffs_64p(
data->taps.h_taps, data->ratios.horz));
dscl_prog_data->filter_h_c = spl_dscl_get_filter_coeffs_64p(
data->taps.h_taps_c, data->ratios.horz_c);
dscl_prog_data->filter_h_c = SPL_NAMESPACE(spl_dscl_get_filter_coeffs_64p(
data->taps.h_taps_c, data->ratios.horz_c));
}
if (enable_easf_v) {
dscl_prog_data->filter_v = spl_dscl_get_easf_filter_coeffs_64p(
data->taps.v_taps, data->recip_ratios.vert);
dscl_prog_data->filter_v = SPL_NAMESPACE(spl_dscl_get_easf_filter_coeffs_64p(
data->taps.v_taps, data->recip_ratios.vert));
dscl_prog_data->filter_v_c = spl_dscl_get_easf_filter_coeffs_64p(
data->taps.v_taps_c, data->recip_ratios.vert_c);
dscl_prog_data->filter_v_c = SPL_NAMESPACE(spl_dscl_get_easf_filter_coeffs_64p(
data->taps.v_taps_c, data->recip_ratios.vert_c));
} else {
dscl_prog_data->filter_v = spl_dscl_get_filter_coeffs_64p(
data->taps.v_taps, data->ratios.vert);
dscl_prog_data->filter_v = SPL_NAMESPACE(spl_dscl_get_filter_coeffs_64p(
data->taps.v_taps, data->ratios.vert));
dscl_prog_data->filter_v_c = spl_dscl_get_filter_coeffs_64p(
data->taps.v_taps_c, data->ratios.vert_c);
dscl_prog_data->filter_v_c = SPL_NAMESPACE(spl_dscl_get_filter_coeffs_64p(
data->taps.v_taps_c, data->ratios.vert_c));
}
}
@ -2395,9 +2397,9 @@ static uint32_t spl_easf_get_scale_ratio_to_reg_value(struct spl_fixed31_32 rati
if (lookup_table_index_ptr->numer < 0)
break;
if (ratio.value < spl_fixpt_from_fraction(
if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(
lookup_table_index_ptr->numer,
lookup_table_index_ptr->denom).value) {
lookup_table_index_ptr->denom)).value) {
value = lookup_table_index_ptr->reg_value;
break;
}
@ -2406,7 +2408,7 @@ static uint32_t spl_easf_get_scale_ratio_to_reg_value(struct spl_fixed31_32 rati
}
return value;
}
uint32_t spl_get_v_bf3_mode(struct spl_fixed31_32 ratio)
uint32_t SPL_NAMESPACE(spl_get_v_bf3_mode(struct spl_fixed31_32 ratio))
{
uint32_t value;
unsigned int num_entries = sizeof(easf_v_bf3_mode_lookup) /
@ -2415,7 +2417,7 @@ uint32_t spl_get_v_bf3_mode(struct spl_fixed31_32 ratio)
easf_v_bf3_mode_lookup, num_entries);
return value;
}
uint32_t spl_get_h_bf3_mode(struct spl_fixed31_32 ratio)
uint32_t SPL_NAMESPACE(spl_get_h_bf3_mode(struct spl_fixed31_32 ratio))
{
uint32_t value;
unsigned int num_entries = sizeof(easf_h_bf3_mode_lookup) /
@ -2424,7 +2426,7 @@ uint32_t spl_get_h_bf3_mode(struct spl_fixed31_32 ratio)
easf_h_bf3_mode_lookup, num_entries);
return value;
}
uint32_t spl_get_reducer_gain6(int taps, struct spl_fixed31_32 ratio)
uint32_t SPL_NAMESPACE(spl_get_reducer_gain6(int taps, struct spl_fixed31_32 ratio))
{
uint32_t value;
unsigned int num_entries;
@ -2443,7 +2445,7 @@ uint32_t spl_get_reducer_gain6(int taps, struct spl_fixed31_32 ratio)
value = 0;
return value;
}
uint32_t spl_get_reducer_gain4(int taps, struct spl_fixed31_32 ratio)
uint32_t SPL_NAMESPACE(spl_get_reducer_gain4(int taps, struct spl_fixed31_32 ratio))
{
uint32_t value;
unsigned int num_entries;
@ -2462,7 +2464,7 @@ uint32_t spl_get_reducer_gain4(int taps, struct spl_fixed31_32 ratio)
value = 0;
return value;
}
uint32_t spl_get_gainRing6(int taps, struct spl_fixed31_32 ratio)
uint32_t SPL_NAMESPACE(spl_get_gainRing6(int taps, struct spl_fixed31_32 ratio))
{
uint32_t value;
unsigned int num_entries;
@ -2481,7 +2483,7 @@ uint32_t spl_get_gainRing6(int taps, struct spl_fixed31_32 ratio)
value = 0;
return value;
}
uint32_t spl_get_gainRing4(int taps, struct spl_fixed31_32 ratio)
uint32_t SPL_NAMESPACE(spl_get_gainRing4(int taps, struct spl_fixed31_32 ratio))
{
uint32_t value;
unsigned int num_entries;
@ -2500,7 +2502,8 @@ uint32_t spl_get_gainRing4(int taps, struct spl_fixed31_32 ratio)
value = 0;
return value;
}
uint32_t spl_get_3tap_dntilt_uptilt_offset(int taps, struct spl_fixed31_32 ratio)
uint32_t SPL_NAMESPACE(spl_get_3tap_dntilt_uptilt_offset(
int taps, struct spl_fixed31_32 ratio))
{
uint32_t value;
unsigned int num_entries;
@ -2514,7 +2517,7 @@ uint32_t spl_get_3tap_dntilt_uptilt_offset(int taps, struct spl_fixed31_32 ratio
value = 0;
return value;
}
uint32_t spl_get_3tap_uptilt_maxval(int taps, struct spl_fixed31_32 ratio)
uint32_t SPL_NAMESPACE(spl_get_3tap_uptilt_maxval(int taps, struct spl_fixed31_32 ratio))
{
uint32_t value;
unsigned int num_entries;
@ -2528,7 +2531,7 @@ uint32_t spl_get_3tap_uptilt_maxval(int taps, struct spl_fixed31_32 ratio)
value = 0;
return value;
}
uint32_t spl_get_3tap_dntilt_slope(int taps, struct spl_fixed31_32 ratio)
uint32_t SPL_NAMESPACE(spl_get_3tap_dntilt_slope(int taps, struct spl_fixed31_32 ratio))
{
uint32_t value;
unsigned int num_entries;
@ -2542,7 +2545,7 @@ uint32_t spl_get_3tap_dntilt_slope(int taps, struct spl_fixed31_32 ratio)
value = 0;
return value;
}
uint32_t spl_get_3tap_uptilt1_slope(int taps, struct spl_fixed31_32 ratio)
uint32_t SPL_NAMESPACE(spl_get_3tap_uptilt1_slope(int taps, struct spl_fixed31_32 ratio))
{
uint32_t value;
unsigned int num_entries;
@ -2556,7 +2559,7 @@ uint32_t spl_get_3tap_uptilt1_slope(int taps, struct spl_fixed31_32 ratio)
value = 0;
return value;
}
uint32_t spl_get_3tap_uptilt2_slope(int taps, struct spl_fixed31_32 ratio)
uint32_t SPL_NAMESPACE(spl_get_3tap_uptilt2_slope(int taps, struct spl_fixed31_32 ratio))
{
uint32_t value;
unsigned int num_entries;
@ -2570,7 +2573,7 @@ uint32_t spl_get_3tap_uptilt2_slope(int taps, struct spl_fixed31_32 ratio)
value = 0;
return value;
}
uint32_t spl_get_3tap_uptilt2_offset(int taps, struct spl_fixed31_32 ratio)
uint32_t SPL_NAMESPACE(spl_get_3tap_uptilt2_offset(int taps, struct spl_fixed31_32 ratio))
{
uint32_t value;
unsigned int num_entries;

View File

@ -13,25 +13,28 @@ struct scale_ratio_to_reg_value_lookup {
const uint32_t reg_value;
};
void spl_set_filters_data(struct dscl_prog_data *dscl_prog_data,
void SPL_NAMESPACE(spl_set_filters_data(struct dscl_prog_data *dscl_prog_data,
const struct spl_scaler_data *data, bool enable_easf_v,
bool enable_easf_h);
bool enable_easf_h));
uint32_t spl_get_v_bf3_mode(struct spl_fixed31_32 ratio);
uint32_t spl_get_h_bf3_mode(struct spl_fixed31_32 ratio);
uint32_t spl_get_reducer_gain6(int taps, struct spl_fixed31_32 ratio);
uint32_t spl_get_reducer_gain4(int taps, struct spl_fixed31_32 ratio);
uint32_t spl_get_gainRing6(int taps, struct spl_fixed31_32 ratio);
uint32_t spl_get_gainRing4(int taps, struct spl_fixed31_32 ratio);
uint32_t spl_get_3tap_dntilt_uptilt_offset(int taps, struct spl_fixed31_32 ratio);
uint32_t spl_get_3tap_uptilt_maxval(int taps, struct spl_fixed31_32 ratio);
uint32_t spl_get_3tap_dntilt_slope(int taps, struct spl_fixed31_32 ratio);
uint32_t spl_get_3tap_uptilt1_slope(int taps, struct spl_fixed31_32 ratio);
uint32_t spl_get_3tap_uptilt2_slope(int taps, struct spl_fixed31_32 ratio);
uint32_t spl_get_3tap_uptilt2_offset(int taps, struct spl_fixed31_32 ratio);
uint32_t SPL_NAMESPACE(spl_get_v_bf3_mode(struct spl_fixed31_32 ratio));
uint32_t SPL_NAMESPACE(spl_get_h_bf3_mode(struct spl_fixed31_32 ratio));
uint32_t SPL_NAMESPACE(spl_get_reducer_gain6(int taps, struct spl_fixed31_32 ratio));
uint32_t SPL_NAMESPACE(spl_get_reducer_gain4(int taps, struct spl_fixed31_32 ratio));
uint32_t SPL_NAMESPACE(spl_get_gainRing6(int taps, struct spl_fixed31_32 ratio));
uint32_t SPL_NAMESPACE(spl_get_gainRing4(int taps, struct spl_fixed31_32 ratio));
uint32_t SPL_NAMESPACE(spl_get_3tap_dntilt_uptilt_offset(
int taps, struct spl_fixed31_32 ratio));
uint32_t SPL_NAMESPACE(spl_get_3tap_uptilt_maxval(int taps, struct spl_fixed31_32 ratio));
uint32_t SPL_NAMESPACE(spl_get_3tap_dntilt_slope(int taps, struct spl_fixed31_32 ratio));
uint32_t SPL_NAMESPACE(spl_get_3tap_uptilt1_slope(int taps, struct spl_fixed31_32 ratio));
uint32_t SPL_NAMESPACE(spl_get_3tap_uptilt2_slope(int taps, struct spl_fixed31_32 ratio));
uint32_t SPL_NAMESPACE(spl_get_3tap_uptilt2_offset(int taps, struct spl_fixed31_32 ratio));
/* public API */
const uint16_t *spl_dscl_get_easf_filter_coeffs_64p(int taps, struct spl_fixed31_32 ratio);
const uint16_t *spl_dscl_get_easf_filter_coeffs_64p_s1_10(int taps, struct spl_fixed31_32 ratio);
const uint16_t *SPL_NAMESPACE(spl_dscl_get_easf_filter_coeffs_64p(
int taps, struct spl_fixed31_32 ratio));
const uint16_t *SPL_NAMESPACE(spl_dscl_get_easf_filter_coeffs_64p_s1_10(
int taps, struct spl_fixed31_32 ratio));
#endif /* __DC_SPL_SCL_EASF_FILTERS_H__ */

View File

@ -1134,9 +1134,9 @@ static const uint16_t *spl_get_filter_3tap_64p(struct spl_fixed31_32 ratio)
{
if (ratio.value < spl_fixpt_one.value)
return filter_3tap_64p_upscale;
else if (ratio.value < spl_fixpt_from_fraction(4, 3).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 3)).value)
return filter_3tap_64p_116;
else if (ratio.value < spl_fixpt_from_fraction(5, 3).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 3)).value)
return filter_3tap_64p_149;
else
return filter_3tap_64p_183;
@ -1146,9 +1146,9 @@ static const uint16_t *spl_get_filter_4tap_64p(struct spl_fixed31_32 ratio)
{
if (ratio.value < spl_fixpt_one.value)
return filter_4tap_64p_upscale;
else if (ratio.value < spl_fixpt_from_fraction(4, 3).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 3)).value)
return filter_4tap_64p_116;
else if (ratio.value < spl_fixpt_from_fraction(5, 3).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 3)).value)
return filter_4tap_64p_149;
else
return filter_4tap_64p_183;
@ -1158,9 +1158,9 @@ static const uint16_t *spl_get_filter_5tap_64p(struct spl_fixed31_32 ratio)
{
if (ratio.value < spl_fixpt_one.value)
return filter_5tap_64p_upscale;
else if (ratio.value < spl_fixpt_from_fraction(4, 3).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 3)).value)
return filter_5tap_64p_116;
else if (ratio.value < spl_fixpt_from_fraction(5, 3).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 3)).value)
return filter_5tap_64p_149;
else
return filter_5tap_64p_183;
@ -1170,9 +1170,9 @@ static const uint16_t *spl_get_filter_6tap_64p(struct spl_fixed31_32 ratio)
{
if (ratio.value < spl_fixpt_one.value)
return filter_6tap_64p_upscale;
else if (ratio.value < spl_fixpt_from_fraction(4, 3).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 3)).value)
return filter_6tap_64p_116;
else if (ratio.value < spl_fixpt_from_fraction(5, 3).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 3)).value)
return filter_6tap_64p_149;
else
return filter_6tap_64p_183;
@ -1182,9 +1182,9 @@ static const uint16_t *spl_get_filter_7tap_64p(struct spl_fixed31_32 ratio)
{
if (ratio.value < spl_fixpt_one.value)
return filter_7tap_64p_upscale;
else if (ratio.value < spl_fixpt_from_fraction(4, 3).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 3)).value)
return filter_7tap_64p_116;
else if (ratio.value < spl_fixpt_from_fraction(5, 3).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 3)).value)
return filter_7tap_64p_149;
else
return filter_7tap_64p_183;
@ -1194,9 +1194,9 @@ static const uint16_t *spl_get_filter_8tap_64p(struct spl_fixed31_32 ratio)
{
if (ratio.value < spl_fixpt_one.value)
return filter_8tap_64p_upscale;
else if (ratio.value < spl_fixpt_from_fraction(4, 3).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 3)).value)
return filter_8tap_64p_116;
else if (ratio.value < spl_fixpt_from_fraction(5, 3).value)
else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 3)).value)
return filter_8tap_64p_149;
else
return filter_8tap_64p_183;
@ -1207,7 +1207,8 @@ static const uint16_t *spl_get_filter_2tap_64p(void)
return filter_2tap_64p;
}
const uint16_t *spl_dscl_get_filter_coeffs_64p(int taps, struct spl_fixed31_32 ratio)
const uint16_t *SPL_NAMESPACE(spl_dscl_get_filter_coeffs_64p(
int taps, struct spl_fixed31_32 ratio))
{
if (taps == 8)
return spl_get_filter_8tap_64p(ratio);

View File

@ -8,6 +8,7 @@
#include "dc_spl_types.h"
/* public API */
const uint16_t *spl_dscl_get_filter_coeffs_64p(int taps, struct spl_fixed31_32 ratio);
const uint16_t *SPL_NAMESPACE(spl_dscl_get_filter_coeffs_64p(
int taps, struct spl_fixed31_32 ratio));
#endif /* __DC_SPL_SCL_FILTERS_H__ */

View File

@ -14,8 +14,8 @@ static bool spl_build_custom_float(struct spl_fixed31_32 value,
uint32_t exp_offset = (1 << (format->exponenta_bits - 1)) - 1;
const struct spl_fixed31_32 mantissa_constant_plus_max_fraction =
spl_fixpt_from_fraction((1LL << (format->mantissa_bits + 1)) - 1,
1LL << format->mantissa_bits);
SPL_NAMESPACE(spl_fixpt_from_fraction((1LL << (format->mantissa_bits + 1)) - 1,
1LL << format->mantissa_bits));
struct spl_fixed31_32 mantiss;
@ -134,9 +134,10 @@ static bool spl_setup_custom_float(const struct spl_custom_float_format *format,
return true;
}
bool spl_convert_to_custom_float_format(struct spl_fixed31_32 value,
const struct spl_custom_float_format *format,
uint32_t *result)
bool SPL_NAMESPACE(spl_convert_to_custom_float_format(
struct spl_fixed31_32 value,
const struct spl_custom_float_format *format,
uint32_t *result))
{
uint32_t mantissa;
uint32_t exponenta;

View File

@ -21,9 +21,9 @@ struct spl_custom_float_value {
bool negative;
};
bool spl_convert_to_custom_float_format(
bool SPL_NAMESPACE(spl_convert_to_custom_float_format(
struct spl_fixed31_32 value,
const struct spl_custom_float_format *format,
uint32_t *result);
uint32_t *result));
#endif //SPL_CUSTOM_FLOAT_H_

View File

@ -44,7 +44,8 @@ static inline unsigned long long spl_complete_integer_division_u64(
#define GET_FRACTIONAL_PART(x) \
(FRACTIONAL_PART_MASK & (x))
struct spl_fixed31_32 spl_fixpt_from_fraction(long long numerator, long long denominator)
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_from_fraction(
long long numerator, long long denominator))
{
struct spl_fixed31_32 res;
@ -96,7 +97,8 @@ struct spl_fixed31_32 spl_fixpt_from_fraction(long long numerator, long long den
return res;
}
struct spl_fixed31_32 spl_fixpt_mul(struct spl_fixed31_32 arg1, struct spl_fixed31_32 arg2)
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_mul(
struct spl_fixed31_32 arg1, struct spl_fixed31_32 arg2))
{
struct spl_fixed31_32 res;
@ -147,7 +149,7 @@ struct spl_fixed31_32 spl_fixpt_mul(struct spl_fixed31_32 arg1, struct spl_fixed
return res;
}
struct spl_fixed31_32 spl_fixpt_sqr(struct spl_fixed31_32 arg)
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_sqr(struct spl_fixed31_32 arg))
{
struct spl_fixed31_32 res;
@ -187,19 +189,19 @@ struct spl_fixed31_32 spl_fixpt_sqr(struct spl_fixed31_32 arg)
return res;
}
struct spl_fixed31_32 spl_fixpt_recip(struct spl_fixed31_32 arg)
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_recip(struct spl_fixed31_32 arg))
{
/*
* @note
* Good idea to use Newton's method
*/
return spl_fixpt_from_fraction(
return SPL_NAMESPACE(spl_fixpt_from_fraction(
spl_fixpt_one.value,
arg.value);
arg.value));
}
struct spl_fixed31_32 spl_fixpt_sinc(struct spl_fixed31_32 arg)
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_sinc(struct spl_fixed31_32 arg))
{
struct spl_fixed31_32 square;
@ -221,15 +223,15 @@ struct spl_fixed31_32 spl_fixpt_sinc(struct spl_fixed31_32 arg)
spl_fixpt_two_pi.value)));
}
square = spl_fixpt_sqr(arg_norm);
square = SPL_NAMESPACE(spl_fixpt_sqr(arg_norm));
do {
res = spl_fixpt_sub(
spl_fixpt_one,
spl_fixpt_div_int(
spl_fixpt_mul(
SPL_NAMESPACE(spl_fixpt_mul(
square,
res),
res)),
n * (n - 1)));
n -= 2;
@ -237,24 +239,24 @@ struct spl_fixed31_32 spl_fixpt_sinc(struct spl_fixed31_32 arg)
if (arg.value != arg_norm.value)
res = spl_fixpt_div(
spl_fixpt_mul(res, arg_norm),
SPL_NAMESPACE(spl_fixpt_mul(res, arg_norm)),
arg);
return res;
}
struct spl_fixed31_32 spl_fixpt_sin(struct spl_fixed31_32 arg)
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_sin(struct spl_fixed31_32 arg))
{
return spl_fixpt_mul(
return SPL_NAMESPACE(spl_fixpt_mul(
arg,
spl_fixpt_sinc(arg));
SPL_NAMESPACE(spl_fixpt_sinc(arg))));
}
struct spl_fixed31_32 spl_fixpt_cos(struct spl_fixed31_32 arg)
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_cos(struct spl_fixed31_32 arg))
{
/* TODO implement argument normalization */
const struct spl_fixed31_32 square = spl_fixpt_sqr(arg);
const struct spl_fixed31_32 square = SPL_NAMESPACE(spl_fixpt_sqr(arg));
struct spl_fixed31_32 res = spl_fixpt_one;
@ -264,9 +266,9 @@ struct spl_fixed31_32 spl_fixpt_cos(struct spl_fixed31_32 arg)
res = spl_fixpt_sub(
spl_fixpt_one,
spl_fixpt_div_int(
spl_fixpt_mul(
SPL_NAMESPACE(spl_fixpt_mul(
square,
res),
res)),
n * (n - 1)));
n -= 2;
@ -286,9 +288,9 @@ static struct spl_fixed31_32 spl_fixed31_32_exp_from_taylor_series(struct spl_fi
{
unsigned int n = 9;
struct spl_fixed31_32 res = spl_fixpt_from_fraction(
struct spl_fixed31_32 res = SPL_NAMESPACE(spl_fixpt_from_fraction(
n + 2,
n + 1);
n + 1));
/* TODO find correct res */
SPL_ASSERT(spl_fixpt_lt(arg, spl_fixpt_one));
@ -297,20 +299,20 @@ static struct spl_fixed31_32 spl_fixed31_32_exp_from_taylor_series(struct spl_fi
res = spl_fixpt_add(
spl_fixpt_one,
spl_fixpt_div_int(
spl_fixpt_mul(
SPL_NAMESPACE(spl_fixpt_mul(
arg,
res),
res)),
n));
while (--n != 1);
return spl_fixpt_add(
spl_fixpt_one,
spl_fixpt_mul(
SPL_NAMESPACE(spl_fixpt_mul(
arg,
res));
res)));
}
struct spl_fixed31_32 spl_fixpt_exp(struct spl_fixed31_32 arg)
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_exp(struct spl_fixed31_32 arg))
{
/*
* @brief
@ -353,7 +355,7 @@ struct spl_fixed31_32 spl_fixpt_exp(struct spl_fixed31_32 arg)
return spl_fixpt_one;
}
struct spl_fixed31_32 spl_fixpt_log(struct spl_fixed31_32 arg)
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_log(struct spl_fixed31_32 arg))
{
struct spl_fixed31_32 res = spl_fixpt_neg(spl_fixpt_one);
/* TODO improve 1st estimation */
@ -371,7 +373,7 @@ struct spl_fixed31_32 spl_fixpt_log(struct spl_fixed31_32 arg)
spl_fixpt_one),
spl_fixpt_div(
arg,
spl_fixpt_exp(res)));
SPL_NAMESPACE(spl_fixpt_exp(res))));
error = spl_fixpt_sub(
res,
@ -427,37 +429,37 @@ static inline unsigned int spl_clamp_ux_dy(
return min_clamp;
}
unsigned int spl_fixpt_u4d19(struct spl_fixed31_32 arg)
unsigned int SPL_NAMESPACE(spl_fixpt_u4d19(struct spl_fixed31_32 arg))
{
return spl_ux_dy(arg.value, 4, 19);
}
unsigned int spl_fixpt_u3d19(struct spl_fixed31_32 arg)
unsigned int SPL_NAMESPACE(spl_fixpt_u3d19(struct spl_fixed31_32 arg))
{
return spl_ux_dy(arg.value, 3, 19);
}
unsigned int spl_fixpt_u2d19(struct spl_fixed31_32 arg)
unsigned int SPL_NAMESPACE(spl_fixpt_u2d19(struct spl_fixed31_32 arg))
{
return spl_ux_dy(arg.value, 2, 19);
}
unsigned int spl_fixpt_u0d19(struct spl_fixed31_32 arg)
unsigned int SPL_NAMESPACE(spl_fixpt_u0d19(struct spl_fixed31_32 arg))
{
return spl_ux_dy(arg.value, 0, 19);
}
unsigned int spl_fixpt_clamp_u0d14(struct spl_fixed31_32 arg)
unsigned int SPL_NAMESPACE(spl_fixpt_clamp_u0d14(struct spl_fixed31_32 arg))
{
return spl_clamp_ux_dy(arg.value, 0, 14, 1);
}
unsigned int spl_fixpt_clamp_u0d10(struct spl_fixed31_32 arg)
unsigned int SPL_NAMESPACE(spl_fixpt_clamp_u0d10(struct spl_fixed31_32 arg))
{
return spl_clamp_ux_dy(arg.value, 0, 10, 1);
}
int spl_fixpt_s4d19(struct spl_fixed31_32 arg)
int SPL_NAMESPACE(spl_fixpt_s4d19(struct spl_fixed31_32 arg))
{
if (arg.value < 0)
return -(int)spl_ux_dy(spl_fixpt_abs(arg).value, 4, 19);
@ -465,9 +467,9 @@ int spl_fixpt_s4d19(struct spl_fixed31_32 arg)
return spl_ux_dy(arg.value, 4, 19);
}
struct spl_fixed31_32 spl_fixpt_from_ux_dy(unsigned int value,
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_from_ux_dy(unsigned int value,
unsigned int integer_bits,
unsigned int fractional_bits)
unsigned int fractional_bits))
{
struct spl_fixed31_32 fixpt_value = spl_fixpt_zero;
struct spl_fixed31_32 fixpt_int_value = spl_fixpt_zero;
@ -481,10 +483,10 @@ struct spl_fixed31_32 spl_fixpt_from_ux_dy(unsigned int value,
return fixpt_value;
}
struct spl_fixed31_32 spl_fixpt_from_int_dy(unsigned int int_value,
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_from_int_dy(unsigned int int_value,
unsigned int frac_value,
unsigned int integer_bits,
unsigned int fractional_bits)
unsigned int fractional_bits))
{
struct spl_fixed31_32 fixpt_value = spl_fixpt_from_int(int_value);

View File

@ -60,7 +60,8 @@ static const struct spl_fixed31_32 spl_fixpt_one = { 0x100000000LL };
* @brief
* result = numerator / denominator
*/
struct spl_fixed31_32 spl_fixpt_from_fraction(long long numerator, long long denominator);
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_from_fraction(
long long numerator, long long denominator));
/*
* @brief
@ -280,7 +281,8 @@ static inline struct spl_fixed31_32 spl_fixpt_sub_int(struct spl_fixed31_32 arg1
* @brief
* result = arg1 * arg2
*/
struct spl_fixed31_32 spl_fixpt_mul(struct spl_fixed31_32 arg1, struct spl_fixed31_32 arg2);
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_mul(
struct spl_fixed31_32 arg1, struct spl_fixed31_32 arg2));
/*
@ -289,14 +291,14 @@ struct spl_fixed31_32 spl_fixpt_mul(struct spl_fixed31_32 arg1, struct spl_fixed
*/
static inline struct spl_fixed31_32 spl_fixpt_mul_int(struct spl_fixed31_32 arg1, int arg2)
{
return spl_fixpt_mul(arg1, spl_fixpt_from_int(arg2));
return SPL_NAMESPACE(spl_fixpt_mul(arg1, spl_fixpt_from_int(arg2)));
}
/*
* @brief
* result = square(arg) := arg * arg
*/
struct spl_fixed31_32 spl_fixpt_sqr(struct spl_fixed31_32 arg);
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_sqr(struct spl_fixed31_32 arg));
/*
* @brief
@ -304,7 +306,8 @@ struct spl_fixed31_32 spl_fixpt_sqr(struct spl_fixed31_32 arg);
*/
static inline struct spl_fixed31_32 spl_fixpt_div_int(struct spl_fixed31_32 arg1, long long arg2)
{
return spl_fixpt_from_fraction(arg1.value, spl_fixpt_from_int((int)arg2).value);
return SPL_NAMESPACE(spl_fixpt_from_fraction(arg1.value,
spl_fixpt_from_int((int)arg2).value));
}
/*
@ -313,7 +316,7 @@ static inline struct spl_fixed31_32 spl_fixpt_div_int(struct spl_fixed31_32 arg1
*/
static inline struct spl_fixed31_32 spl_fixpt_div(struct spl_fixed31_32 arg1, struct spl_fixed31_32 arg2)
{
return spl_fixpt_from_fraction(arg1.value, arg2.value);
return SPL_NAMESPACE(spl_fixpt_from_fraction(arg1.value, arg2.value));
}
/*
@ -328,7 +331,7 @@ static inline struct spl_fixed31_32 spl_fixpt_div(struct spl_fixed31_32 arg1, st
* @note
* No special actions taken in case argument is zero.
*/
struct spl_fixed31_32 spl_fixpt_recip(struct spl_fixed31_32 arg);
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_recip(struct spl_fixed31_32 arg));
/*
* @brief
@ -343,7 +346,7 @@ struct spl_fixed31_32 spl_fixpt_recip(struct spl_fixed31_32 arg);
* Argument specified in radians,
* internally it's normalized to [-2pi...2pi] range.
*/
struct spl_fixed31_32 spl_fixpt_sinc(struct spl_fixed31_32 arg);
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_sinc(struct spl_fixed31_32 arg));
/*
* @brief
@ -353,7 +356,7 @@ struct spl_fixed31_32 spl_fixpt_sinc(struct spl_fixed31_32 arg);
* Argument specified in radians,
* internally it's normalized to [-2pi...2pi] range.
*/
struct spl_fixed31_32 spl_fixpt_sin(struct spl_fixed31_32 arg);
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_sin(struct spl_fixed31_32 arg));
/*
* @brief
@ -365,7 +368,7 @@ struct spl_fixed31_32 spl_fixpt_sin(struct spl_fixed31_32 arg);
* passing arguments outside that range
* will cause incorrect result!
*/
struct spl_fixed31_32 spl_fixpt_cos(struct spl_fixed31_32 arg);
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_cos(struct spl_fixed31_32 arg));
/*
* @brief
@ -379,7 +382,7 @@ struct spl_fixed31_32 spl_fixpt_cos(struct spl_fixed31_32 arg);
* @note
* Currently, function is verified for abs(arg) <= 1.
*/
struct spl_fixed31_32 spl_fixpt_exp(struct spl_fixed31_32 arg);
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_exp(struct spl_fixed31_32 arg));
/*
* @brief
@ -391,7 +394,7 @@ struct spl_fixed31_32 spl_fixpt_exp(struct spl_fixed31_32 arg);
* Currently, no special actions taken
* in case of invalid argument(s). Take care!
*/
struct spl_fixed31_32 spl_fixpt_log(struct spl_fixed31_32 arg);
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_log(struct spl_fixed31_32 arg));
/*
* @brief
@ -410,10 +413,10 @@ static inline struct spl_fixed31_32 spl_fixpt_pow(struct spl_fixed31_32 arg1, st
if (arg1.value == 0)
return arg2.value == 0 ? spl_fixpt_one : spl_fixpt_zero;
return spl_fixpt_exp(
spl_fixpt_mul(
spl_fixpt_log(arg1),
arg2));
return SPL_NAMESPACE(spl_fixpt_exp(
SPL_NAMESPACE(spl_fixpt_mul(
SPL_NAMESPACE(spl_fixpt_log(arg1)),
arg2))));
}
/*
@ -482,19 +485,19 @@ static inline int spl_fixpt_ceil(struct spl_fixed31_32 arg)
* fractional
*/
unsigned int spl_fixpt_u4d19(struct spl_fixed31_32 arg);
unsigned int SPL_NAMESPACE(spl_fixpt_u4d19(struct spl_fixed31_32 arg));
unsigned int spl_fixpt_u3d19(struct spl_fixed31_32 arg);
unsigned int SPL_NAMESPACE(spl_fixpt_u3d19(struct spl_fixed31_32 arg));
unsigned int spl_fixpt_u2d19(struct spl_fixed31_32 arg);
unsigned int SPL_NAMESPACE(spl_fixpt_u2d19(struct spl_fixed31_32 arg));
unsigned int spl_fixpt_u0d19(struct spl_fixed31_32 arg);
unsigned int SPL_NAMESPACE(spl_fixpt_u0d19(struct spl_fixed31_32 arg));
unsigned int spl_fixpt_clamp_u0d14(struct spl_fixed31_32 arg);
unsigned int SPL_NAMESPACE(spl_fixpt_clamp_u0d14(struct spl_fixed31_32 arg));
unsigned int spl_fixpt_clamp_u0d10(struct spl_fixed31_32 arg);
unsigned int SPL_NAMESPACE(spl_fixpt_clamp_u0d10(struct spl_fixed31_32 arg));
int spl_fixpt_s4d19(struct spl_fixed31_32 arg);
int SPL_NAMESPACE(spl_fixpt_s4d19(struct spl_fixed31_32 arg));
static inline struct spl_fixed31_32 spl_fixpt_truncate(struct spl_fixed31_32 arg, unsigned int frac_bits)
{
@ -513,10 +516,11 @@ static inline struct spl_fixed31_32 spl_fixpt_truncate(struct spl_fixed31_32 arg
return arg;
}
struct spl_fixed31_32 spl_fixpt_from_ux_dy(unsigned int value, unsigned int integer_bits, unsigned int fractional_bits);
struct spl_fixed31_32 spl_fixpt_from_int_dy(unsigned int int_value,
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_from_ux_dy(unsigned int value,
unsigned int integer_bits, unsigned int fractional_bits));
struct spl_fixed31_32 SPL_NAMESPACE(spl_fixpt_from_int_dy(unsigned int int_value,
unsigned int frac_value,
unsigned int integer_bits,
unsigned int fractional_bits);
unsigned int fractional_bits));
#endif

View File

@ -53,4 +53,13 @@ static inline int64_t spl_div64_s64(int64_t dividend, int64_t divisor)
#define spl_min(a, b) (((a) < (b)) ? (a):(b))
#endif
/* SPL namespace macros */
#ifndef SPL_PFX_
#define SPL_PFX_
#endif
#define SPL_EXPAND2(a, b) a##b
#define SPL_EXPAND(a, b) SPL_EXPAND2(a, b)
#define SPL_NAMESPACE(symbol) SPL_EXPAND(SPL_PFX_, symbol)
#endif /* _SPL_OS_TYPES_H_ */