amvecm: have CMS setting applied in isr [1/1]
authorXihai Zhu <xihai.zhu@amlogic.com>
Thu, 10 Oct 2019 11:40:11 +0000 (07:40 -0400)
committerTao Zeng <tao.zeng@amlogic.com>
Wed, 16 Oct 2019 06:02:51 +0000 (23:02 -0700)
PD#SWPL-15013

Problem:
CMS setting is overrided by CM2 apply

Solution:
similar as CM2 apply, have CMS setting get
programed in isr

Verify:
tl1

Change-Id: I662c6c4eaff62cc031d0ca58186a83921bbc0224
Signed-off-by: Xihai Zhu <xihai.zhu@amlogic.com>
drivers/amlogic/media/enhancement/amvecm/amcm.c
drivers/amlogic/media/enhancement/amvecm/amvecm.c
drivers/amlogic/media/enhancement/amvecm/cm2_adj.c
drivers/amlogic/media/enhancement/amvecm/cm2_adj.h
include/linux/amlogic/media/amvecm/amvecm.h

index c84a10e..d0f82bf 100644 (file)
@@ -473,27 +473,21 @@ void cm_latch_process(void)
        do {
                if (vecm_latch_flag & FLAG_REG_MAP0) {
                        cm_regmap_latch(&amregs0, FLAG_REG_MAP0);
-                       break;
                }
                if (vecm_latch_flag & FLAG_REG_MAP1) {
                        cm_regmap_latch(&amregs1, FLAG_REG_MAP1);
-                       break;
                }
                if (vecm_latch_flag & FLAG_REG_MAP2) {
                        cm_regmap_latch(&amregs2, FLAG_REG_MAP2);
-                       break;
                }
                if (vecm_latch_flag & FLAG_REG_MAP3) {
                        cm_regmap_latch(&amregs3, FLAG_REG_MAP3);
-                       break;
                }
                if (vecm_latch_flag & FLAG_REG_MAP4) {
                        cm_regmap_latch(&amregs4, FLAG_REG_MAP4);
-                       break;
                }
                if (vecm_latch_flag & FLAG_REG_MAP5) {
                        cm_regmap_latch(&amregs5, FLAG_REG_MAP5);
-                       break;
                }
                if ((cm2_patch_flag & 0xff) > 0)
                        cm2_frame_switch_patch();
index fea39e9..a09edf2 100644 (file)
@@ -119,6 +119,11 @@ static s16 saturation_mb;
 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;
@@ -4238,6 +4243,7 @@ void amvecm_sr1_derection_enable(unsigned int enable)
 
 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);
@@ -4298,6 +4304,47 @@ void pq_user_latch_process(void)
        } 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;
+                               }
+                       }
+               }
        }
 }
 
@@ -5040,11 +5087,6 @@ static void vpp_clip_config(unsigned int mode_sel, unsigned int color,
        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)
@@ -5092,7 +5134,7 @@ static ssize_t amvecm_cm2_hue_show(struct class *cla,
        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;
@@ -5124,8 +5166,10 @@ static ssize_t amvecm_cm2_hue_store(struct class *cla,
                        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);
@@ -5142,7 +5186,7 @@ static ssize_t amvecm_cm2_luma_show(struct class *cla,
        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;
@@ -5174,8 +5218,10 @@ static ssize_t amvecm_cm2_luma_store(struct class *cla,
                        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);
@@ -5192,7 +5238,7 @@ static ssize_t amvecm_cm2_sat_show(struct class *cla,
        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;
@@ -5224,8 +5270,10 @@ static ssize_t amvecm_cm2_sat_store(struct class *cla,
                        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);
@@ -5243,7 +5291,7 @@ static ssize_t amvecm_cm2_hue_by_hs_show(struct class *cla,
        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;
@@ -5276,8 +5324,10 @@ static ssize_t amvecm_cm2_hue_by_hs_store(struct class *cla,
                        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);
index a82bc1d..3641c64 100644 (file)
@@ -21,7 +21,7 @@
 #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] = {
@@ -58,6 +58,11 @@ static uint smth_coef_sat[NUM_SMTH_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");
@@ -218,8 +223,7 @@ static void color_adj(int inp_color, int inp_val, int lpf_en,
  * @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};
@@ -242,17 +246,18 @@ static void cm2_curve_update_hue_by_hs(enum eCM2ColorMd colormode,
                        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]);
                }
 
@@ -263,11 +268,11 @@ static void cm2_curve_update_hue_by_hs(enum eCM2ColorMd colormode,
                        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;
                        }
@@ -275,15 +280,15 @@ static void cm2_curve_update_hue_by_hs(enum eCM2ColorMd colormode,
                }
 
                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};
@@ -304,14 +309,15 @@ static void cm2_curve_update_hue(enum eCM2ColorMd colormode,
                        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]);
                }
        }
@@ -331,8 +337,7 @@ static void cm2_curve_update_hue(enum eCM2ColorMd colormode,
  * @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};
@@ -353,14 +358,15 @@ static void cm2_curve_update_luma(enum eCM2ColorMd colormode,
                        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]);
                }
        }
@@ -380,8 +386,7 @@ static void cm2_curve_update_luma(enum eCM2ColorMd colormode,
  * @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};
@@ -402,22 +407,22 @@ static void cm2_curve_update_sat(enum eCM2ColorMd colormode,
                        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]);
                }
        }
 }
@@ -428,19 +433,18 @@ static void cm2_curve_update_sat(enum eCM2ColorMd colormode,
  * @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,
@@ -450,11 +454,11 @@ void cm2_hue_by_hs(enum eCM2ColorMd colormode, int hue_val, int lpf_en)
                /*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");*/
 }
 
@@ -465,28 +469,26 @@ void cm2_hue_by_hs(enum eCM2ColorMd colormode, int hue_val, int lpf_en)
  * @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");*/
 }
 
@@ -496,27 +498,25 @@ void cm2_hue(enum eCM2ColorMd colormode, int hue_val, int lpf_en)
  * @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");*/
 }
 
@@ -526,19 +526,18 @@ void cm2_luma(enum eCM2ColorMd colormode, int luma_val, int lpf_en)
  * @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);
@@ -547,12 +546,11 @@ void cm2_sat(enum eCM2ColorMd colormode, int sat_val, int lpf_en)
                /*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");*/
 }
 
index 793f001..d4418b4 100644 (file)
 #define __CM2_ADJ__
 
 
-enum eCM2ColorMd {
-       eCM2ColorMd_purple = 0,
-       eCM2ColorMd_red,
-       eCM2ColorMd_skin,
-       eCM2ColorMd_yellow,
-       eCM2ColorMd_yellow_green,
-       eCM2ColorMd_green,
-       eCM2ColorMd_blue_green,
-       eCM2ColorMd_cyan,
-       eCM2ColorMd_blue,
-       eCM2ColorMd_max,
+enum ecm2colormd {
+       ecm2colormd_purple = 0,
+       ecm2colormd_red,
+       ecm2colormd_skin,
+       ecm2colormd_yellow,
+       ecm2colormd_yellow_green,
+       ecm2colormd_green,
+       ecm2colormd_blue_green,
+       ecm2colormd_cyan,
+       ecm2colormd_blue,
+       ecm2colormd_max,
 };
 
 /*H00 ~ H31*/
@@ -51,11 +51,15 @@ enum eCM2ColorMd {
 #define CM2_ENH_COEF3_H02 0x113
 #define CM2_ENH_COEF4_H02 0x114
 
+void cm2_curve_update_hue_by_hs(enum ecm2colormd colormode);
+void cm2_curve_update_hue(enum ecm2colormd colormode);
+void cm2_curve_update_luma(enum ecm2colormd colormode);
+void cm2_curve_update_sat(enum ecm2colormd colormode);
 
-extern void cm2_hue_by_hs(enum eCM2ColorMd colormode, int hue_val, int lpf_en);
-extern void cm2_hue(enum eCM2ColorMd colormode, int hue_val, int lpf_en);
-extern void cm2_luma(enum eCM2ColorMd colormode, int luma_val, int lpf_en);
-extern void cm2_sat(enum eCM2ColorMd colormode, int sat_val, int lpf_en);
+void cm2_hue_by_hs(enum ecm2colormd colormode, int hue_val, int lpf_en);
+void cm2_hue(enum ecm2colormd colormode, int hue_val, int lpf_en);
+void cm2_luma(enum ecm2colormd colormode, int luma_val, int lpf_en);
+void cm2_sat(enum ecm2colormd colormode, int sat_val, int lpf_en);
 
 #endif
 
index 27a6604..a6d66ce 100644 (file)
 #define VPP_DEMO_CM_EN              (1 << 0)
 
 /*PQ USER LATCH*/
+#define PQ_USER_CMS_CURVE_HUE_HS   BIT(23)
+#define PQ_USER_CMS_CURVE_HUE      BIT(22)
+#define PQ_USER_CMS_CURVE_LUMA     BIT(21)
+#define PQ_USER_CMS_CURVE_SAT      BIT(20)
 #define PQ_USER_SR1_DERECTION_DIS  (1 << 19)
 #define PQ_USER_SR1_DERECTION_EN   (1 << 18)
 #define PQ_USER_SR0_DERECTION_DIS  (1 << 17)