static s16 saturation_ma_shift;
static s16 saturation_mb_shift;
+static int cm2_hue_array[ecm2colormd_max][3];
+static int cm2_luma_array[ecm2colormd_max][3];
+static int cm2_sat_array[ecm2colormd_max][3];
+static int cm2_hue_by_hs_array[ecm2colormd_max][3];
+
unsigned int sr1_reg_val[101];
unsigned int sr1_ret_val[101];
struct vpp_hist_param_s vpp_hist_param;
void pq_user_latch_process(void)
{
+ int i = 0;
if (pq_user_latch_flag & PQ_USER_BLK_EN) {
pq_user_latch_flag &= ~PQ_USER_BLK_EN;
amvecm_black_ext_enable(true);
} else if (pq_user_latch_flag & PQ_USER_SR1_DERECTION_DIS) {
pq_user_latch_flag &= ~PQ_USER_SR1_DERECTION_DIS;
amvecm_sr1_derection_enable(false);
+ } else if (
+ pq_user_latch_flag & PQ_USER_CMS_CURVE_SAT ||
+ pq_user_latch_flag & PQ_USER_CMS_CURVE_LUMA ||
+ pq_user_latch_flag & PQ_USER_CMS_CURVE_HUE_HS ||
+ pq_user_latch_flag & PQ_USER_CMS_CURVE_HUE) {
+ if (pq_user_latch_flag & PQ_USER_CMS_CURVE_SAT) {
+ pq_user_latch_flag &= ~PQ_USER_CMS_CURVE_SAT;
+ for (i = 0; i < ecm2colormd_max; i++) {
+ if (cm2_sat_array[i][2] == 1) {
+ cm2_curve_update_sat(i);
+ cm2_sat_array[i][2] = 0;
+ }
+ }
+ }
+ if (pq_user_latch_flag & PQ_USER_CMS_CURVE_LUMA) {
+ pq_user_latch_flag &= ~PQ_USER_CMS_CURVE_LUMA;
+ for (i = 0; i < ecm2colormd_max; i++) {
+ if (cm2_luma_array[i][2] == 1) {
+ cm2_curve_update_luma(i);
+ cm2_luma_array[i][2] = 0;
+ }
+ }
+ }
+ if (pq_user_latch_flag & PQ_USER_CMS_CURVE_HUE_HS) {
+ pq_user_latch_flag &= ~PQ_USER_CMS_CURVE_HUE_HS;
+ for (i = 0; i < ecm2colormd_max; i++) {
+ if (cm2_hue_by_hs_array[i][2] == 1) {
+ cm2_curve_update_hue_by_hs(i);
+ cm2_hue_by_hs_array[i][2] = 0;
+ }
+ }
+ }
+ if (pq_user_latch_flag & PQ_USER_CMS_CURVE_HUE) {
+ pq_user_latch_flag &= ~PQ_USER_CMS_CURVE_HUE;
+ for (i = 0; i < ecm2colormd_max; i++) {
+ if (cm2_hue_array[i][2] == 1) {
+ cm2_curve_update_hue(i);
+ cm2_hue_array[i][2] = 0;
+ }
+ }
+ }
}
}
WRITE_VPP_REG(addr_clipbot, value_clipbot);
}
-static int cm2_hue_array[eCM2ColorMd_max][2];
-static int cm2_luma_array[eCM2ColorMd_max][2];
-static int cm2_sat_array[eCM2ColorMd_max][2];
-static int cm2_hue_by_hs_array[eCM2ColorMd_max][2];
-
#define MAX_CLIP_VAL ((1<<30)-1)
static ssize_t amvecm_clamp_color_top_show(struct class *cla,
struct class_attribute *attr, char *buf)
int i;
int pos = 0;
- for (i = 0; i < eCM2ColorMd_max; i++)
+ for (i = 0; i < ecm2colormd_max; i++)
pos += sprintf(buf + pos, "%d %d %d\n", i,
cm2_hue_array[i][0], cm2_hue_array[i][1]);
return pos;
goto kfree_buf;
cm2_hue_array[color_mode][1] = val;
+ cm2_hue_array[color_mode][2] = 1;
cm2_hue(color_mode, cm2_hue_array[color_mode][0],
cm2_hue_array[color_mode][1]);
+ pq_user_latch_flag |= PQ_USER_CMS_CURVE_HUE;
pr_info("cm2_hue ok\n");
}
kfree(buf_orig);
int i;
int pos = 0;
- for (i = 0; i < eCM2ColorMd_max; i++)
+ for (i = 0; i < ecm2colormd_max; i++)
pos += sprintf(buf + pos, "%d %d %d\n", i,
cm2_luma_array[i][0], cm2_luma_array[i][1]);
return pos;
goto kfree_buf;
cm2_luma_array[color_mode][1] = val;
+ cm2_luma_array[color_mode][2] = 1;
cm2_luma(color_mode, cm2_luma_array[color_mode][0],
cm2_luma_array[color_mode][1]);
+ pq_user_latch_flag |= PQ_USER_CMS_CURVE_LUMA;
pr_info("cm2_luma ok\n");
}
kfree(buf_orig);
int i;
int pos = 0;
- for (i = 0; i < eCM2ColorMd_max; i++)
+ for (i = 0; i < ecm2colormd_max; i++)
pos += sprintf(buf + pos, "%d %d %d\n", i,
cm2_sat_array[i][0], cm2_sat_array[i][1]);
return pos;
goto kfree_buf;
cm2_sat_array[color_mode][1] = val;
+ cm2_sat_array[color_mode][2] = 1;
cm2_sat(color_mode, cm2_sat_array[color_mode][0],
cm2_sat_array[color_mode][1]);
+ pq_user_latch_flag |= PQ_USER_CMS_CURVE_SAT;
pr_info("cm2_sat ok\n");
}
kfree(buf_orig);
int i;
int pos = 0;
- for (i = 0; i < eCM2ColorMd_max; i++)
+ for (i = 0; i < ecm2colormd_max; i++)
pos += sprintf(buf + pos, "%d %d %d\n", i,
cm2_hue_by_hs_array[i][0], cm2_hue_by_hs_array[i][1]);
return pos;
goto kfree_buf;
cm2_hue_by_hs_array[color_mode][1] = val;
+ cm2_hue_by_hs_array[color_mode][2] = 1;
cm2_hue_by_hs(color_mode, cm2_hue_by_hs_array[color_mode][0],
cm2_hue_by_hs_array[color_mode][1]);
+ pq_user_latch_flag |= PQ_USER_CMS_CURVE_HUE_HS;
pr_info("cm2_hue_by_hs ok\n");
}
kfree(buf_orig);
#include "cm2_adj.h"
#define NUM_MATRIX_PARAM 7
-#define NUM_COLOR_MAX eCM2ColorMd_max
+#define NUM_COLOR_MAX ecm2colormd_max
#define NUM_SMTH_PARAM 11
static uint lpf_coef_matrix_param = NUM_MATRIX_PARAM;
static uint lpf_coef[NUM_MATRIX_PARAM] = {
40, 60, 85, 105, 115, 120, 115, 105, 85, 60, 30
};
+static char adj_hue_via_s[NUM_COLOR_MAX][5][32];
+static char adj_hue_via_hue[NUM_COLOR_MAX][32];
+static char adj_sat_via_hs[NUM_COLOR_MAX][3][32];
+static char adj_luma_via_hue[NUM_COLOR_MAX][32];
+
module_param_array(lpf_coef, uint,
&lpf_coef_matrix_param, 0664);
MODULE_PARM_DESC(lpf_coef, "\n lpf_coef\n");
* @param colormode [description]
* @param Adj_Hue_via_S[][32] [description]
*/
-static void cm2_curve_update_hue_by_hs(enum eCM2ColorMd colormode,
- char Adj_Hue_via_S[][32])
+void cm2_curve_update_hue_by_hs(enum ecm2colormd colormode)
{
unsigned int i, j, start = 0, end = 0;
unsigned int val1[5] = {0}, val2[5] = {0};
if (j == reg_node1) {
/*curve 0,1*/
val1[j] &= 0x0000ffff;
- temp = Adj_Hue_via_S[0][i];
+ temp = adj_hue_via_s[colormode][0][i];
val1[j] |= (temp << 16) & 0x00ff0000;
- temp = Adj_Hue_via_S[1][i];
+ temp = adj_hue_via_s[colormode][1][i];
val1[j] |= (temp << 24) & 0xff000000;
continue;
}
}
for (j = 0; j < 5; j++) {
- WRITE_VPP_REG(VPP_CHROMA_ADDR_PORT,
- 0x100 + i*8 + j);
+ WRITE_VPP_REG(
+ VPP_CHROMA_ADDR_PORT,
+ 0x100 + i * 8 + j);
WRITE_VPP_REG(VPP_CHROMA_DATA_PORT, val1[j]);
}
if (j == reg_node2) {
/*curve 2,3,4*/
val2[j] &= 0xff000000;
- val2[j] |= Adj_Hue_via_S[2][i]
+ val2[j] |= adj_hue_via_s[colormode][2][i]
& 0x000000ff;
- temp = Adj_Hue_via_S[3][i];
+ temp = adj_hue_via_s[colormode][3][i];
val2[j] |= (temp << 8) & 0x0000ff00;
- temp = Adj_Hue_via_S[4][i];
+ temp = adj_hue_via_s[colormode][4][i];
val2[j] |= (temp << 16) & 0x00ff0000;
continue;
}
}
for (j = 0; j < 5; j++) {
- WRITE_VPP_REG(VPP_CHROMA_ADDR_PORT,
- 0x100 + i*8 + j);
+ WRITE_VPP_REG(
+ VPP_CHROMA_ADDR_PORT,
+ 0x100 + i * 8 + j);
WRITE_VPP_REG(VPP_CHROMA_DATA_PORT, val2[j]);
}
}
}
-static void cm2_curve_update_hue(enum eCM2ColorMd colormode,
- char *hue_lut)
+void cm2_curve_update_hue(enum ecm2colormd colormode)
{
unsigned int i, j, start = 0, end = 0;
unsigned int val1[5] = {0};
if (j == reg_node) {
/*curve 0*/
val1[j] &= 0xffffff00;
- temp = hue_lut[i];
+ temp = adj_hue_via_hue[colormode][i];
val1[j] |= (temp) & 0x000000ff;
continue;
}
}
for (j = 0; j < 5; j++) {
- WRITE_VPP_REG(VPP_CHROMA_ADDR_PORT,
- 0x100 + i*8 + j);
+ WRITE_VPP_REG(
+ VPP_CHROMA_ADDR_PORT,
+ 0x100 + i * 8 + j);
WRITE_VPP_REG(VPP_CHROMA_DATA_PORT, val1[j]);
}
}
* @param colormode [description]
* @param luma_lut [description]
*/
-static void cm2_curve_update_luma(enum eCM2ColorMd colormode,
- char *luma_lut)
+void cm2_curve_update_luma(enum ecm2colormd colormode)
{
unsigned int i, j, start = 0, end = 0;
unsigned int val1[5] = {0};
if (j == reg_node) {
/*curve 0*/
val1[j] &= 0xffffff00;
- temp = luma_lut[i];
+ temp = adj_luma_via_hue[colormode][i];
val1[j] |= (temp) & 0x000000ff;
continue;
}
}
for (j = 0; j < 5; j++) {
- WRITE_VPP_REG(VPP_CHROMA_ADDR_PORT,
- CM2_ENH_COEF0_H00 + i*8 + j);
+ WRITE_VPP_REG(
+ VPP_CHROMA_ADDR_PORT,
+ CM2_ENH_COEF0_H00 + i * 8 + j);
WRITE_VPP_REG(VPP_CHROMA_DATA_PORT, val1[j]);
}
}
* @param colormode [description]
* @param Adj_Sat_via_HS[3][32] [description]
*/
-static void cm2_curve_update_sat(enum eCM2ColorMd colormode,
- char Adj_Sat_via_HS[3][32])
+void cm2_curve_update_sat(enum ecm2colormd colormode)
{
unsigned int i, j, start = 0, end = 0;
unsigned int val1[5] = {0};
if (j == reg_node) {
val1[j] &= 0x000000ff;
/*curve 0*/
- temp = Adj_Sat_via_HS[0][i];
+ temp = adj_sat_via_hs[colormode][0][i];
val1[j] |= (temp << 8) & 0x0000ff00;
/*curve 1*/
- temp = Adj_Sat_via_HS[1][i];
+ temp = adj_sat_via_hs[colormode][1][i];
val1[j] |= (temp << 16) & 0x00ff0000;
/*curve 2*/
- temp = Adj_Sat_via_HS[2][i];
+ temp = adj_sat_via_hs[colormode][2][i];
val1[j] |= (temp << 24) & 0xff000000;
continue;
}
}
for (j = 0; j < 5; j++) {
- WRITE_VPP_REG(VPP_CHROMA_ADDR_PORT,
- CM2_ENH_COEF0_H00 + i*8 + j);
- WRITE_VPP_REG(VPP_CHROMA_DATA_PORT, val1[j]);
- /*pr_info("0x%x,\n", val1);*/
+ WRITE_VPP_REG(
+ VPP_CHROMA_ADDR_PORT,
+ CM2_ENH_COEF0_H00 + i * 8 + j);
+ WRITE_VPP_REG(VPP_CHROMA_DATA_PORT, val1[j]);
}
}
}
* @param sat_val [-100 ~ 100]
* @param lpf_en [1:on 0:off]
*/
-void cm2_hue_by_hs(enum eCM2ColorMd colormode, int hue_val, int lpf_en)
+void cm2_hue_by_hs(enum ecm2colormd colormode, int hue_val, int lpf_en)
{
int inp_color = colormode;
/*[-100, 100], color_adj will mapping to value [-128, 127]*/
int inp_val = hue_val;
int temp;
int out_lut[32];
- char reg_CM2_Adj_Hue_via_S[5][32];
/*int lpf_en = 0;*/
int k, i;
- memset(out_lut, 0, sizeof(int)*32);
- memset(reg_CM2_Adj_Hue_via_S, 0, sizeof(char)*32*5);
+ memset(out_lut, 0, sizeof(int) * 32);
+ memset(adj_hue_via_s[colormode], 0, sizeof(char) * 32 * 5);
/*pr_info("color mode:%d, input val =%d\n", colormode, hue_val);*/
color_adj(inp_color, inp_val, lpf_en, lpf_coef,
/*pr_info("\n Adj_Hue via %d\n", k);*/
for (i = 0; i < 32; i++) {
temp = out_lut[i] * huegain_via_sat5[inp_color][k];
- reg_CM2_Adj_Hue_via_S[k][i] = (char)(rsround(temp)/100);
+ adj_hue_via_s[colormode][k][i] =
+ (char)(rsround(temp) / 100);
/*pr_info("%d ", reg_CM2_Adj_Hue_via_S[k][i]);*/
}
}
- cm2_curve_update_hue_by_hs(colormode, reg_CM2_Adj_Hue_via_S);
/*pr_info("\n ---end\n");*/
}
* @param lpf_en [1:on 0:off]
*/
-void cm2_hue(enum eCM2ColorMd colormode, int hue_val, int lpf_en)
+void cm2_hue(enum ecm2colormd colormode, int hue_val, int lpf_en)
{
int inp_color = colormode;
/*[-100, 100], color_adj will mapping to value [-128, 127]*/
int inp_val = hue_val;
int i;
int out_lut[32];
- char reg_CM2_Adj_Hue_via_Hue[32];
/*int lpf_en = 0;*/
- memset(out_lut, 0, sizeof(int)*32);
- memset(reg_CM2_Adj_Hue_via_Hue, 0, sizeof(char)*32);
+ memset(out_lut, 0, sizeof(int) * 32);
+ memset(adj_hue_via_hue[colormode], 0, sizeof(char) * 32);
/*pr_info("color mode:%d, input val =%d\n", colormode, hue_val);*/
color_adj(inp_color, inp_val, lpf_en, lpf_coef,
color_key_pts, smth_coef_hue, out_lut);
for (i = 0; i < 32; i++) {
- reg_CM2_Adj_Hue_via_Hue[i] = (char)out_lut[i];
+ adj_hue_via_hue[colormode][i] = (char)out_lut[i];
/*pr_info("%d ", reg_CM2_Adj_Hue_via_S[k][i]);*/
}
- cm2_curve_update_hue(colormode, reg_CM2_Adj_Hue_via_Hue);
/*pr_info("\n ---end\n");*/
}
* @param sat_val [-100 ~ 100]
* @param lpf_en [1:on 0:off]
*/
-void cm2_luma(enum eCM2ColorMd colormode, int luma_val, int lpf_en)
+void cm2_luma(enum ecm2colormd colormode, int luma_val, int lpf_en)
{
- char reg_CM2_Adj_Luma_via_Hue[32];
int out_luma_lut[32];
int i;
int inp_color = colormode;
int inp_val = luma_val;
/*pr_info("colormode:%d, input val %d\n",colormode, luma_val);*/
- memset(reg_CM2_Adj_Luma_via_Hue, 0, sizeof(char)*32);
- memset(out_luma_lut, 0, sizeof(int)*32);
+ memset(adj_luma_via_hue[colormode], 0, sizeof(char) * 32);
+ memset(out_luma_lut, 0, sizeof(int) * 32);
color_adj(inp_color, inp_val, lpf_en, lpf_coef, color_key_pts,
smth_coef_luma, out_luma_lut);
for (i = 0; i < 32; i++) {
- reg_CM2_Adj_Luma_via_Hue[i] = (char)out_luma_lut[i];
+ adj_luma_via_hue[colormode][i] = (char)out_luma_lut[i];
/*pr_info("%d,", out_luma_lut[i]);*/
}
- cm2_curve_update_luma(colormode, reg_CM2_Adj_Luma_via_Hue);
/*pr_info("\n---end\n");*/
}
* @param sat_val [-100 ~ 100]
* @param lpf_en [1:on 0:off]
*/
-void cm2_sat(enum eCM2ColorMd colormode, int sat_val, int lpf_en)
+void cm2_sat(enum ecm2colormd colormode, int sat_val, int lpf_en)
{
int inp_color = colormode;
int inp_val = sat_val;
- char reg_CM2_Adj_Sat_via_HS[3][32];
int out_sat_lut[32];
int k, i;
int temp;
/*pr_info("colormode:%d, input val %d\n",colormode, sat_val);*/
- memset(reg_CM2_Adj_Sat_via_HS, 0, sizeof(char)*32*3);
- memset(out_sat_lut, 0, sizeof(int)*32);
+ memset(adj_sat_via_hs[colormode], 0, sizeof(char) * 32 * 3);
+ memset(out_sat_lut, 0, sizeof(int) * 32);
color_adj(inp_color, inp_val, lpf_en, lpf_coef, color_key_pts,
smth_coef_sat, out_sat_lut);
/*pr_info("\n Adj_sat %d\n", k);*/
for (i = 0; i < 32; i++) {
temp = out_sat_lut[i] * satgain_via_sat3[inp_color][k];
- reg_CM2_Adj_Sat_via_HS[k][i] =
+ adj_sat_via_hs[colormode][k][i] =
(char)(rsround(temp)/100);
/*pr_info("%d ", reg_CM2_Adj_Sat_via_HS[k][i]);*/
}
}
- cm2_curve_update_sat(colormode, reg_CM2_Adj_Sat_via_HS);
/*pr_info("\n---end\n");*/
}