#include "gdc_device.h"
#include "isp.h"
#include "vamem.h"
#ifndef __INLINE_HMEM__
#define __INLINE_HMEM__
#endif
#include "hmem.h"
#define IA_CSS_INCLUDE_PARAMETERS
#define IA_CSS_INCLUDE_ACC_PARAMETERS
#include "hmm.h"
#include "sh_css_params.h"
#include "ia_css_queue.h"
#include "sw_event_global.h"
#include "platform_support.h"
#include "assert_support.h"
#include "misc_support.h"
#include "math_support.h"
#include "ia_css_stream.h"
#include "sh_css_params_internal.h"
#include "sh_css_param_shading.h"
#include "sh_css_param_dvs.h"
#include "ia_css_refcount.h"
#include "sh_css_internal.h"
#include "ia_css_control.h"
#include "ia_css_shading.h"
#include "sh_css_defs.h"
#include "sh_css_sp.h"
#include "ia_css_pipeline.h"
#include "ia_css_debug.h"
#include "ia_css_isp_param.h"
#include "ia_css_isp_params.h"
#include "ia_css_mipi.h"
#include "ia_css_morph.h"
#include "ia_css_host_data.h"
#include "ia_css_pipe.h"
#include "ia_css_pipe_binarydesc.h"
#include "anr/anr_1.0/ia_css_anr.host.h"
#include "cnr/cnr_1.0/ia_css_cnr.host.h"
#include "csc/csc_1.0/ia_css_csc.host.h"
#include "de/de_1.0/ia_css_de.host.h"
#include "dp/dp_1.0/ia_css_dp.host.h"
#include "bnr/bnr_1.0/ia_css_bnr.host.h"
#include "dvs/dvs_1.0/ia_css_dvs.host.h"
#include "fpn/fpn_1.0/ia_css_fpn.host.h"
#include "gc/gc_1.0/ia_css_gc.host.h"
#include "macc/macc_1.0/ia_css_macc.host.h"
#include "ctc/ctc_1.0/ia_css_ctc.host.h"
#include "ob/ob_1.0/ia_css_ob.host.h"
#include "raw/raw_1.0/ia_css_raw.host.h"
#include "fixedbds/fixedbds_1.0/ia_css_fixedbds_param.h"
#include "s3a/s3a_1.0/ia_css_s3a.host.h"
#include "sc/sc_1.0/ia_css_sc.host.h"
#include "sdis/sdis_1.0/ia_css_sdis.host.h"
#include "tnr/tnr_1.0/ia_css_tnr.host.h"
#include "uds/uds_1.0/ia_css_uds_param.h"
#include "wb/wb_1.0/ia_css_wb.host.h"
#include "ynr/ynr_1.0/ia_css_ynr.host.h"
#include "xnr/xnr_1.0/ia_css_xnr.host.h"
#include "aa/aa_2/ia_css_aa2.host.h"
#include "anr/anr_2/ia_css_anr2.host.h"
#include "bh/bh_2/ia_css_bh.host.h"
#include "cnr/cnr_2/ia_css_cnr2.host.h"
#include "ctc/ctc1_5/ia_css_ctc1_5.host.h"
#include "de/de_2/ia_css_de2.host.h"
#include "gc/gc_2/ia_css_gc2.host.h"
#include "sdis/sdis_2/ia_css_sdis2.host.h"
#include "ynr/ynr_2/ia_css_ynr2.host.h"
#include "fc/fc_1.0/ia_css_formats.host.h"
#include "xnr/xnr_3.0/ia_css_xnr3.host.h"
#include "sh_css_frac.h"
#include "ia_css_bufq.h"
static size_t fpntbl_bytes(const struct ia_css_binary *binary)
{ … }
static size_t sctbl_bytes(const struct ia_css_binary *binary)
{ … }
static size_t morph_plane_bytes(const struct ia_css_binary *binary)
{ … }
static ia_css_ptr sp_ddr_ptrs;
static ia_css_ptr xmem_sp_group_ptrs;
static ia_css_ptr xmem_sp_stage_ptrs[IA_CSS_PIPE_ID_NUM]
[SH_CSS_MAX_STAGES];
static ia_css_ptr xmem_isp_stage_ptrs[IA_CSS_PIPE_ID_NUM]
[SH_CSS_MAX_STAGES];
static ia_css_ptr default_gdc_lut;
static int interleaved_lut_temp[4][HRT_GDC_N];
static const int zoom_table[4][HRT_GDC_N] = …;
static const struct ia_css_dz_config default_dz_config = …;
static const struct ia_css_vector default_motion_config = …;
static const struct ia_css_shading_settings default_shading_settings = …;
struct ia_css_isp_skc_dvs_statistics { … };
static int
ref_sh_css_ddr_address_map(
struct sh_css_ddr_address_map *map,
struct sh_css_ddr_address_map *out);
static int
write_ia_css_isp_parameter_set_info_to_ddr(
struct ia_css_isp_parameter_set_info *me,
ia_css_ptr *out);
static int
free_ia_css_isp_parameter_set_info(ia_css_ptr ptr);
static int
sh_css_params_write_to_ddr_internal(
struct ia_css_pipe *pipe,
unsigned int pipe_id,
struct ia_css_isp_parameters *params,
const struct ia_css_pipeline_stage *stage,
struct sh_css_ddr_address_map *ddr_map,
struct sh_css_ddr_address_map_size *ddr_map_size);
static int
sh_css_create_isp_params(struct ia_css_stream *stream,
struct ia_css_isp_parameters **isp_params_out);
static bool
sh_css_init_isp_params_from_global(struct ia_css_stream *stream,
struct ia_css_isp_parameters *params,
bool use_default_config,
struct ia_css_pipe *pipe_in);
static int
sh_css_init_isp_params_from_config(struct ia_css_pipe *pipe,
struct ia_css_isp_parameters *params,
const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe_in);
static int
sh_css_set_global_isp_config_on_pipe(
struct ia_css_pipe *curr_pipe,
const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe);
static int
sh_css_set_per_frame_isp_config_on_pipe(
struct ia_css_stream *stream,
const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe);
static int
sh_css_update_uds_and_crop_info_based_on_zoom_region(
const struct ia_css_binary_info *info,
const struct ia_css_frame_info *in_frame_info,
const struct ia_css_frame_info *out_frame_info,
const struct ia_css_resolution *dvs_env,
const struct ia_css_dz_config *zoom,
const struct ia_css_vector *motion_vector,
struct sh_css_uds_info *uds,
struct sh_css_crop_pos *sp_out_crop_pos,
struct ia_css_resolution pipe_in_res,
bool enable_zoom);
ia_css_ptr
sh_css_params_ddr_address_map(void)
{ … }
static struct ia_css_host_data *
convert_allocate_fpntbl(struct ia_css_isp_parameters *params)
{ … }
static int
store_fpntbl(struct ia_css_isp_parameters *params, ia_css_ptr ptr)
{ … }
static void
convert_raw_to_fpn(struct ia_css_isp_parameters *params)
{ … }
static void
ia_css_process_kernel(struct ia_css_stream *stream,
struct ia_css_isp_parameters *params,
void (*process)(unsigned int pipe_id,
const struct ia_css_pipeline_stage *stage,
struct ia_css_isp_parameters *params))
{ … }
static int
sh_css_select_dp_10bpp_config(const struct ia_css_pipe *pipe,
bool *is_dp_10bpp)
{ … }
int
sh_css_set_black_frame(struct ia_css_stream *stream,
const struct ia_css_frame *raw_black_frame)
{ … }
bool
sh_css_params_set_binning_factor(struct ia_css_stream *stream,
unsigned int binning_fact)
{ … }
static void
sh_css_set_shading_table(struct ia_css_stream *stream,
struct ia_css_isp_parameters *params,
const struct ia_css_shading_table *table)
{ … }
void
ia_css_params_store_ia_css_host_data(
ia_css_ptr ddr_addr,
struct ia_css_host_data *data)
{ … }
struct ia_css_host_data *
ia_css_params_alloc_convert_sctbl(
const struct ia_css_pipeline_stage *stage,
const struct ia_css_shading_table *shading_table)
{ … }
int ia_css_params_store_sctbl(
const struct ia_css_pipeline_stage *stage,
ia_css_ptr sc_tbl,
const struct ia_css_shading_table *sc_config)
{ … }
static void
sh_css_enable_pipeline(const struct ia_css_binary *binary)
{ … }
static int
ia_css_process_zoom_and_motion(
struct ia_css_isp_parameters *params,
const struct ia_css_pipeline_stage *first_stage)
{ … }
static void
sh_css_set_gamma_table(struct ia_css_isp_parameters *params,
const struct ia_css_gamma_table *table)
{ … }
static void
sh_css_get_gamma_table(const struct ia_css_isp_parameters *params,
struct ia_css_gamma_table *table)
{ … }
static void
sh_css_set_ctc_table(struct ia_css_isp_parameters *params,
const struct ia_css_ctc_table *table)
{ … }
static void
sh_css_get_ctc_table(const struct ia_css_isp_parameters *params,
struct ia_css_ctc_table *table)
{ … }
static void
sh_css_set_macc_table(struct ia_css_isp_parameters *params,
const struct ia_css_macc_table *table)
{ … }
static void
sh_css_get_macc_table(const struct ia_css_isp_parameters *params,
struct ia_css_macc_table *table)
{ … }
void ia_css_morph_table_free(
struct ia_css_morph_table *me)
{ … }
struct ia_css_morph_table *ia_css_morph_table_allocate(
unsigned int width,
unsigned int height)
{ … }
static int sh_css_params_default_morph_table(
struct ia_css_morph_table **table,
const struct ia_css_binary *binary)
{ … }
static void
sh_css_set_morph_table(struct ia_css_isp_parameters *params,
const struct ia_css_morph_table *table)
{ … }
void
ia_css_translate_3a_statistics(
struct ia_css_3a_statistics *host_stats,
const struct ia_css_isp_3a_statistics_map *isp_stats)
{ … }
void
ia_css_isp_3a_statistics_map_free(struct ia_css_isp_3a_statistics_map *me)
{ … }
struct ia_css_isp_3a_statistics_map *
ia_css_isp_3a_statistics_map_allocate(
const struct ia_css_isp_3a_statistics *isp_stats,
void *data_ptr)
{ … }
int
ia_css_get_3a_statistics(struct ia_css_3a_statistics *host_stats,
const struct ia_css_isp_3a_statistics *isp_stats)
{ … }
static void
ia_css_set_param_exceptions(const struct ia_css_pipe *pipe,
struct ia_css_isp_parameters *params)
{ … }
static void
sh_css_set_nr_config(struct ia_css_isp_parameters *params,
const struct ia_css_nr_config *config)
{ … }
static void
sh_css_set_ee_config(struct ia_css_isp_parameters *params,
const struct ia_css_ee_config *config)
{ … }
static void
sh_css_get_ee_config(const struct ia_css_isp_parameters *params,
struct ia_css_ee_config *config)
{ … }
static void
sh_css_set_pipe_dvs_6axis_config(const struct ia_css_pipe *pipe,
struct ia_css_isp_parameters *params,
const struct ia_css_dvs_6axis_config *dvs_config)
{ … }
static void
sh_css_get_pipe_dvs_6axis_config(const struct ia_css_pipe *pipe,
const struct ia_css_isp_parameters *params,
struct ia_css_dvs_6axis_config *dvs_config)
{ … }
static void
sh_css_set_baa_config(struct ia_css_isp_parameters *params,
const struct ia_css_aa_config *config)
{ … }
static void
sh_css_get_baa_config(const struct ia_css_isp_parameters *params,
struct ia_css_aa_config *config)
{ … }
static void
sh_css_set_dz_config(struct ia_css_isp_parameters *params,
const struct ia_css_dz_config *config)
{ … }
static void
sh_css_get_dz_config(const struct ia_css_isp_parameters *params,
struct ia_css_dz_config *config)
{ … }
static void
sh_css_set_motion_vector(struct ia_css_isp_parameters *params,
const struct ia_css_vector *motion)
{ … }
static void
sh_css_get_motion_vector(const struct ia_css_isp_parameters *params,
struct ia_css_vector *motion)
{ … }
struct ia_css_isp_config *
sh_css_pipe_isp_config_get(struct ia_css_pipe *pipe)
{ … }
int
ia_css_stream_set_isp_config(
struct ia_css_stream *stream,
const struct ia_css_isp_config *config)
{ … }
int
ia_css_stream_set_isp_config_on_pipe(
struct ia_css_stream *stream,
const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe)
{ … }
int
ia_css_pipe_set_isp_config(struct ia_css_pipe *pipe,
struct ia_css_isp_config *config)
{ … }
static int
sh_css_set_global_isp_config_on_pipe(
struct ia_css_pipe *curr_pipe,
const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe)
{ … }
static int
sh_css_set_per_frame_isp_config_on_pipe(
struct ia_css_stream *stream,
const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe)
{ … }
static int
sh_css_init_isp_params_from_config(struct ia_css_pipe *pipe,
struct ia_css_isp_parameters *params,
const struct ia_css_isp_config *config,
struct ia_css_pipe *pipe_in)
{ … }
void
ia_css_stream_get_isp_config(
const struct ia_css_stream *stream,
struct ia_css_isp_config *config)
{ … }
void
ia_css_pipe_get_isp_config(struct ia_css_pipe *pipe,
struct ia_css_isp_config *config)
{ … }
static bool realloc_isp_css_mm_buf(
ia_css_ptr *curr_buf,
size_t *curr_size,
size_t needed_size,
bool force,
int *err)
{ … }
static bool reallocate_buffer(
ia_css_ptr *curr_buf,
size_t *curr_size,
size_t needed_size,
bool force,
int *err)
{ … }
struct ia_css_isp_3a_statistics *
ia_css_isp_3a_statistics_allocate(const struct ia_css_3a_grid_info *grid)
{ … }
void
ia_css_isp_3a_statistics_free(struct ia_css_isp_3a_statistics *me)
{ … }
struct ia_css_isp_skc_dvs_statistics *ia_css_skc_dvs_statistics_allocate(void)
{ … }
struct ia_css_metadata *
ia_css_metadata_allocate(const struct ia_css_metadata_info *metadata_info)
{ … }
void
ia_css_metadata_free(struct ia_css_metadata *me)
{ … }
void
ia_css_metadata_free_multiple(unsigned int num_bufs,
struct ia_css_metadata **bufs)
{ … }
static unsigned int g_param_buffer_dequeue_count;
static unsigned int g_param_buffer_enqueue_count;
int
ia_css_stream_isp_parameters_init(struct ia_css_stream *stream)
{ … }
static void
ia_css_set_sdis_config(
struct ia_css_isp_parameters *params,
const struct ia_css_dvs_coefficients *dvs_coefs)
{ … }
static void
ia_css_set_sdis2_config(
struct ia_css_isp_parameters *params,
const struct ia_css_dvs2_coefficients *dvs2_coefs)
{ … }
static int
sh_css_create_isp_params(struct ia_css_stream *stream,
struct ia_css_isp_parameters **isp_params_out)
{ … }
static bool
sh_css_init_isp_params_from_global(struct ia_css_stream *stream,
struct ia_css_isp_parameters *params,
bool use_default_config,
struct ia_css_pipe *pipe_in)
{ … }
int
sh_css_params_init(void)
{ … }
static void host_lut_store(const void *lut)
{ … }
int ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe,
const void *lut)
{ … }
ia_css_ptr sh_css_pipe_get_pp_gdc_lut(const struct ia_css_pipe *pipe)
{ … }
int sh_css_params_map_and_store_default_gdc_lut(void)
{ … }
void sh_css_params_free_default_gdc_lut(void)
{ … }
ia_css_ptr sh_css_params_get_default_gdc_lut(void)
{ … }
static void free_param_set_callback(
ia_css_ptr ptr)
{ … }
static void free_buffer_callback(
ia_css_ptr ptr)
{ … }
void
sh_css_param_clear_param_sets(void)
{ … }
#define safe_free(id, x) …
static void free_map(struct sh_css_ddr_address_map *map)
{ … }
void
ia_css_stream_isp_parameters_uninit(struct ia_css_stream *stream)
{ … }
void
sh_css_params_uninit(void)
{ … }
static struct ia_css_host_data *
convert_allocate_morph_plane(
unsigned short *data,
unsigned int width,
unsigned int height,
unsigned int aligned_width)
{ … }
static int
store_morph_plane(
unsigned short *data,
unsigned int width,
unsigned int height,
ia_css_ptr dest,
unsigned int aligned_width)
{ … }
static void sh_css_update_isp_params_to_ddr(
struct ia_css_isp_parameters *params,
ia_css_ptr ddr_ptr)
{ … }
static void sh_css_update_isp_mem_params_to_ddr(
const struct ia_css_binary *binary,
ia_css_ptr ddr_mem_ptr,
size_t size,
enum ia_css_isp_memories mem)
{ … }
void ia_css_dequeue_param_buffers( void)
{ … }
static void
process_kernel_parameters(unsigned int pipe_id,
struct ia_css_pipeline_stage *stage,
struct ia_css_isp_parameters *params,
unsigned int isp_pipe_version,
unsigned int raw_bit_depth)
{ … }
int
sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe,
struct ia_css_isp_parameters *params,
bool commit,
struct ia_css_pipe *pipe_in)
{ … }
static int
sh_css_params_write_to_ddr_internal(
struct ia_css_pipe *pipe,
unsigned int pipe_id,
struct ia_css_isp_parameters *params,
const struct ia_css_pipeline_stage *stage,
struct sh_css_ddr_address_map *ddr_map,
struct sh_css_ddr_address_map_size *ddr_map_size)
{ … }
const struct ia_css_fpn_table *ia_css_get_fpn_table(struct ia_css_stream
*stream)
{ … }
struct ia_css_shading_table *ia_css_get_shading_table(struct ia_css_stream
*stream)
{ … }
ia_css_ptr sh_css_store_sp_group_to_ddr(void)
{ … }
ia_css_ptr sh_css_store_sp_stage_to_ddr(
unsigned int pipe,
unsigned int stage)
{ … }
ia_css_ptr sh_css_store_isp_stage_to_ddr(
unsigned int pipe,
unsigned int stage)
{ … }
static int ref_sh_css_ddr_address_map(
struct sh_css_ddr_address_map *map,
struct sh_css_ddr_address_map *out)
{ … }
static int write_ia_css_isp_parameter_set_info_to_ddr(
struct ia_css_isp_parameter_set_info *me,
ia_css_ptr *out)
{ … }
static int
free_ia_css_isp_parameter_set_info(
ia_css_ptr ptr)
{ … }
void
sh_css_invalidate_params(struct ia_css_stream *stream)
{ … }
void
sh_css_update_uds_and_crop_info(
const struct ia_css_binary_info *info,
const struct ia_css_frame_info *in_frame_info,
const struct ia_css_frame_info *out_frame_info,
const struct ia_css_resolution *dvs_env,
const struct ia_css_dz_config *zoom,
const struct ia_css_vector *motion_vector,
struct sh_css_uds_info *uds,
struct sh_css_crop_pos *sp_out_crop_pos,
bool enable_zoom)
{ … }
static int
sh_css_update_uds_and_crop_info_based_on_zoom_region(
const struct ia_css_binary_info *info,
const struct ia_css_frame_info *in_frame_info,
const struct ia_css_frame_info *out_frame_info,
const struct ia_css_resolution *dvs_env,
const struct ia_css_dz_config *zoom,
const struct ia_css_vector *motion_vector,
struct sh_css_uds_info *uds,
struct sh_css_crop_pos *sp_out_crop_pos,
struct ia_css_resolution pipe_in_res,
bool enable_zoom)
{ … }
struct ia_css_3a_statistics *
ia_css_3a_statistics_allocate(const struct ia_css_3a_grid_info *grid)
{ … }
void
ia_css_3a_statistics_free(struct ia_css_3a_statistics *me)
{ … }
struct ia_css_dvs_statistics *
ia_css_dvs_statistics_allocate(const struct ia_css_dvs_grid_info *grid)
{ … }
void
ia_css_dvs_statistics_free(struct ia_css_dvs_statistics *me)
{ … }
struct ia_css_dvs_coefficients *
ia_css_dvs_coefficients_allocate(const struct ia_css_dvs_grid_info *grid)
{ … }
void
ia_css_dvs_coefficients_free(struct ia_css_dvs_coefficients *me)
{ … }
struct ia_css_dvs2_statistics *
ia_css_dvs2_statistics_allocate(const struct ia_css_dvs_grid_info *grid)
{ … }
void
ia_css_dvs2_statistics_free(struct ia_css_dvs2_statistics *me)
{ … }
struct ia_css_dvs2_coefficients *
ia_css_dvs2_coefficients_allocate(const struct ia_css_dvs_grid_info *grid)
{ … }
void
ia_css_dvs2_coefficients_free(struct ia_css_dvs2_coefficients *me)
{ … }
struct ia_css_dvs_6axis_config *
ia_css_dvs2_6axis_config_allocate(const struct ia_css_stream *stream)
{ … }
void
ia_css_dvs2_6axis_config_free(struct ia_css_dvs_6axis_config *dvs_6axis_config)
{ … }
void
ia_css_en_dz_capt_pipe(struct ia_css_stream *stream, bool enable)
{ … }