#include "dc.h"
#include "opp.h"
#include "color_gamma.h"
#define PRECISE_LUT_REGION_START …
#define PRECISE_LUT_REGION_END …
static struct hw_x_point coordinates_x[MAX_HW_POINTS + 2];
static const unsigned long long pq_divider = …;
static const unsigned long long pq_numerator[MAX_HW_POINTS + 1] = …;
static const int32_t numerator01[] = …;
static const int32_t numerator02[] = …;
static const int32_t numerator03[] = …;
static const int32_t numerator04[] = …;
static const int32_t numerator05[] = …;
void setup_x_points_distribution(void)
{ … }
void log_x_points_distribution(struct dal_logger *logger)
{ … }
static void compute_pq(struct fixed31_32 in_x, struct fixed31_32 *out_y)
{ … }
static void compute_de_pq(struct fixed31_32 in_x, struct fixed31_32 *out_y)
{ … }
static void compute_hlg_eotf(struct fixed31_32 in_x,
struct fixed31_32 *out_y,
uint32_t sdr_white_level, uint32_t max_luminance_nits)
{ … }
static void compute_hlg_oetf(struct fixed31_32 in_x, struct fixed31_32 *out_y,
uint32_t sdr_white_level, uint32_t max_luminance_nits)
{ … }
void precompute_pq(void)
{ … }
void precompute_de_pq(void)
{ … }
struct dividers { … };
static bool build_coefficients(struct gamma_coefficients *coefficients,
enum dc_transfer_func_predefined type)
{ … }
static struct fixed31_32 translate_from_linear_space(
struct translate_from_linear_space_args *args)
{ … }
static struct fixed31_32 translate_from_linear_space_long(
struct translate_from_linear_space_args *args)
{ … }
static struct fixed31_32 calculate_gamma22(struct fixed31_32 arg, bool use_eetf, struct calculate_buffer *cal_buffer)
{ … }
static struct fixed31_32 translate_to_linear_space(
struct fixed31_32 arg,
struct fixed31_32 a0,
struct fixed31_32 a1,
struct fixed31_32 a2,
struct fixed31_32 a3,
struct fixed31_32 gamma)
{ … }
static struct fixed31_32 translate_from_linear_space_ex(
struct fixed31_32 arg,
struct gamma_coefficients *coeff,
uint32_t color_index,
struct calculate_buffer *cal_buffer)
{ … }
static inline struct fixed31_32 translate_to_linear_space_ex(
struct fixed31_32 arg,
struct gamma_coefficients *coeff,
uint32_t color_index)
{ … }
static bool find_software_points(
const struct dc_gamma *ramp,
const struct gamma_pixel *axis_x,
struct fixed31_32 hw_point,
enum channel_name channel,
uint32_t *index_to_start,
uint32_t *index_left,
uint32_t *index_right,
enum hw_point_position *pos)
{ … }
static bool build_custom_gamma_mapping_coefficients_worker(
const struct dc_gamma *ramp,
struct pixel_gamma_point *coeff,
const struct hw_x_point *coordinates_x,
const struct gamma_pixel *axis_x,
enum channel_name channel,
uint32_t number_of_points)
{ … }
static struct fixed31_32 calculate_mapped_value(
struct pwl_float_data *rgb,
const struct pixel_gamma_point *coeff,
enum channel_name channel,
uint32_t max_index)
{ … }
static void build_pq(struct pwl_float_data_ex *rgb_regamma,
uint32_t hw_points_num,
const struct hw_x_point *coordinate_x,
uint32_t sdr_white_level)
{ … }
static void build_de_pq(struct pwl_float_data_ex *de_pq,
uint32_t hw_points_num,
const struct hw_x_point *coordinate_x)
{ … }
static bool build_regamma(struct pwl_float_data_ex *rgb_regamma,
uint32_t hw_points_num,
const struct hw_x_point *coordinate_x,
enum dc_transfer_func_predefined type,
struct calculate_buffer *cal_buffer)
{ … }
static void hermite_spline_eetf(struct fixed31_32 input_x,
struct fixed31_32 max_display,
struct fixed31_32 min_display,
struct fixed31_32 max_content,
struct fixed31_32 *out_x)
{ … }
static bool build_freesync_hdr(struct pwl_float_data_ex *rgb_regamma,
uint32_t hw_points_num,
const struct hw_x_point *coordinate_x,
const struct hdr_tm_params *fs_params,
struct calculate_buffer *cal_buffer)
{ … }
static bool build_degamma(struct pwl_float_data_ex *curve,
uint32_t hw_points_num,
const struct hw_x_point *coordinate_x, enum dc_transfer_func_predefined type)
{ … }
static void build_hlg_degamma(struct pwl_float_data_ex *degamma,
uint32_t hw_points_num,
const struct hw_x_point *coordinate_x,
uint32_t sdr_white_level, uint32_t max_luminance_nits)
{ … }
static void build_hlg_regamma(struct pwl_float_data_ex *regamma,
uint32_t hw_points_num,
const struct hw_x_point *coordinate_x,
uint32_t sdr_white_level, uint32_t max_luminance_nits)
{ … }
static void scale_gamma(struct pwl_float_data *pwl_rgb,
const struct dc_gamma *ramp,
struct dividers dividers)
{ … }
static void scale_gamma_dx(struct pwl_float_data *pwl_rgb,
const struct dc_gamma *ramp,
struct dividers dividers)
{ … }
static void scale_user_regamma_ramp(struct pwl_float_data *pwl_rgb,
const struct regamma_ramp *ramp,
struct dividers dividers)
{ … }
static void apply_lut_1d(
const struct dc_gamma *ramp,
uint32_t num_hw_points,
struct dc_transfer_func_distributed_points *tf_pts)
{ … }
static void build_evenly_distributed_points(
struct gamma_pixel *points,
uint32_t numberof_points,
struct dividers dividers)
{ … }
static inline void copy_rgb_regamma_to_coordinates_x(
struct hw_x_point *coordinates_x,
uint32_t hw_points_num,
const struct pwl_float_data_ex *rgb_ex)
{ … }
static bool calculate_interpolated_hardware_curve(
const struct dc_gamma *ramp,
struct pixel_gamma_point *coeff128,
struct pwl_float_data *rgb_user,
const struct hw_x_point *coordinates_x,
const struct gamma_pixel *axis_x,
uint32_t number_of_points,
struct dc_transfer_func_distributed_points *tf_pts)
{ … }
static void interpolate_user_regamma(uint32_t hw_points_num,
struct pwl_float_data *rgb_user,
bool apply_degamma,
struct dc_transfer_func_distributed_points *tf_pts)
{ … }
static void build_new_custom_resulted_curve(
uint32_t hw_points_num,
struct dc_transfer_func_distributed_points *tf_pts)
{ … }
static void apply_degamma_for_user_regamma(struct pwl_float_data_ex *rgb_regamma,
uint32_t hw_points_num, struct calculate_buffer *cal_buffer)
{ … }
static bool map_regamma_hw_to_x_user(
const struct dc_gamma *ramp,
struct pixel_gamma_point *coeff128,
struct pwl_float_data *rgb_user,
struct hw_x_point *coords_x,
const struct gamma_pixel *axis_x,
const struct pwl_float_data_ex *rgb_regamma,
uint32_t hw_points_num,
struct dc_transfer_func_distributed_points *tf_pts,
bool map_user_ramp,
bool do_clamping)
{ … }
#define _EXTRA_POINTS …
bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf,
const struct regamma_lut *regamma,
struct calculate_buffer *cal_buffer,
const struct dc_gamma *ramp)
{ … }
bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf,
const struct regamma_lut *regamma,
struct calculate_buffer *cal_buffer,
const struct dc_gamma *ramp)
{ … }
bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps,
struct dc_transfer_func *input_tf,
const struct dc_gamma *ramp, bool map_user_ramp)
{ … }
static bool calculate_curve(enum dc_transfer_func_predefined trans,
struct dc_transfer_func_distributed_points *points,
struct pwl_float_data_ex *rgb_regamma,
const struct hdr_tm_params *fs_params,
uint32_t sdr_ref_white_level,
struct calculate_buffer *cal_buffer)
{ … }
bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
const struct dc_gamma *ramp,
bool map_user_ramp,
bool can_rom_be_used,
const struct hdr_tm_params *fs_params,
struct calculate_buffer *cal_buffer)
{ … }