Commit 19801a18 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: atomisp: unify sh_css_params_shading_id_table_generate()

Instead of packing parameters differently on ISP2400 and ISP2401,
use just one way of passing them for both.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 5e094745
...@@ -199,30 +199,15 @@ crop_and_interpolate(unsigned int cropped_width, ...@@ -199,30 +199,15 @@ crop_and_interpolate(unsigned int cropped_width,
void void
sh_css_params_shading_id_table_generate( sh_css_params_shading_id_table_generate(
struct ia_css_shading_table **target_table, struct ia_css_shading_table **target_table,
#ifndef ISP2401
const struct ia_css_binary *binary)
#else
unsigned int table_width, unsigned int table_width,
unsigned int table_height) unsigned int table_height)
#endif
{ {
/* initialize table with ones, shift becomes zero */ /* initialize table with ones, shift becomes zero */
#ifndef ISP2401
unsigned int i, j, table_width, table_height;
#else
unsigned int i, j; unsigned int i, j;
#endif
struct ia_css_shading_table *result; struct ia_css_shading_table *result;
assert(target_table); assert(target_table);
#ifndef ISP2401
assert(binary);
#endif
#ifndef ISP2401
table_width = binary->sctbl_width_per_color;
table_height = binary->sctbl_height;
#endif
result = ia_css_shading_table_alloc(table_width, table_height); result = ia_css_shading_table_alloc(table_width, table_height);
if (!result) { if (!result) {
*target_table = NULL; *target_table = NULL;
...@@ -262,12 +247,9 @@ prepare_shading_table(const struct ia_css_shading_table *in_table, ...@@ -262,12 +247,9 @@ prepare_shading_table(const struct ia_css_shading_table *in_table,
assert(binary); assert(binary);
if (!in_table) { if (!in_table) {
#ifndef ISP2401
sh_css_params_shading_id_table_generate(target_table, binary);
#else
sh_css_params_shading_id_table_generate(target_table, sh_css_params_shading_id_table_generate(target_table,
binary->sctbl_legacy_width_per_color, binary->sctbl_legacy_height); binary->sctbl_legacy_width_per_color,
#endif binary->sctbl_legacy_height);
return; return;
} }
...@@ -332,15 +314,10 @@ prepare_shading_table(const struct ia_css_shading_table *in_table, ...@@ -332,15 +314,10 @@ prepare_shading_table(const struct ia_css_shading_table *in_table,
input_width = min(input_width, in_table->sensor_width); input_width = min(input_width, in_table->sensor_width);
input_height = min(input_height, in_table->sensor_height); input_height = min(input_height, in_table->sensor_height);
#ifndef ISP2401
table_width = binary->sctbl_width_per_color;
table_height = binary->sctbl_height;
#else
/* This prepare_shading_table() function is called only in legacy API (not in new API). /* This prepare_shading_table() function is called only in legacy API (not in new API).
Then, the legacy shading table width and height should be used. */ Then, the legacy shading table width and height should be used. */
table_width = binary->sctbl_legacy_width_per_color; table_width = binary->sctbl_legacy_width_per_color;
table_height = binary->sctbl_legacy_height; table_height = binary->sctbl_legacy_height;
#endif
result = ia_css_shading_table_alloc(table_width, table_height); result = ia_css_shading_table_alloc(table_width, table_height);
if (!result) { if (!result) {
......
...@@ -21,12 +21,8 @@ ...@@ -21,12 +21,8 @@
void void
sh_css_params_shading_id_table_generate( sh_css_params_shading_id_table_generate(
struct ia_css_shading_table **target_table, struct ia_css_shading_table **target_table,
#ifndef ISP2401
const struct ia_css_binary *binary);
#else
unsigned int table_width, unsigned int table_width,
unsigned int table_height); unsigned int table_height);
#endif
void void
prepare_shading_table(const struct ia_css_shading_table *in_table, prepare_shading_table(const struct ia_css_shading_table *in_table,
......
...@@ -4078,12 +4078,9 @@ sh_css_params_write_to_ddr_internal( ...@@ -4078,12 +4078,9 @@ sh_css_params_write_to_ddr_internal(
ia_css_shading_table_free(params->sc_config); ia_css_shading_table_free(params->sc_config);
params->sc_config = NULL; params->sc_config = NULL;
} }
#ifndef ISP2401
sh_css_params_shading_id_table_generate(&params->sc_config, binary);
#else
sh_css_params_shading_id_table_generate(&params->sc_config, sh_css_params_shading_id_table_generate(&params->sc_config,
binary->sctbl_width_per_color, binary->sctbl_height); binary->sctbl_width_per_color,
#endif binary->sctbl_height);
if (!params->sc_config) { if (!params->sc_config) {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY);
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
...@@ -4450,13 +4447,9 @@ struct ia_css_shading_table *ia_css_get_shading_table(struct ia_css_stream ...@@ -4450,13 +4447,9 @@ struct ia_css_shading_table *ia_css_get_shading_table(struct ia_css_stream
ia_css_shading_table_free(params->sc_config); ia_css_shading_table_free(params->sc_config);
params->sc_config = NULL; params->sc_config = NULL;
} }
#ifndef ISP2401
sh_css_params_shading_id_table_generate(&params->sc_config, binary);
#else
sh_css_params_shading_id_table_generate(&params->sc_config, sh_css_params_shading_id_table_generate(&params->sc_config,
binary->sctbl_width_per_color, binary->sctbl_height); binary->sctbl_width_per_color,
#endif binary->sctbl_height);
table = params->sc_config; table = params->sc_config;
/* The sc_config will be freed in the /* The sc_config will be freed in the
* ia_css_stream_isp_parameters_uninit function. */ * ia_css_stream_isp_parameters_uninit function. */
......
Markdown is supported
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