amvecm: optimize g12a hdr effect
authorMingLiang Dong <mingliang.dong@amlogic.com>
Sun, 11 Feb 2018 12:14:46 +0000 (20:14 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Mon, 5 Mar 2018 07:34:32 +0000 (15:34 +0800)
PD#156734: amvecm: optimize g12a hdr effect

Change-Id: Iebb38ce8cc2f9884f6e3df3a740d5985a4e4cd2b
Signed-off-by: MingLiang Dong <mingliang.dong@amlogic.com>
drivers/amlogic/media/enhancement/amvecm/amcsc.c
drivers/amlogic/media/enhancement/amvecm/set_hdr2_v0.c

index bb915e2..92993cb 100644 (file)
@@ -200,11 +200,6 @@ static uint force_csc_type = 0xff;
 module_param(force_csc_type, uint, 0664);
 MODULE_PARM_DESC(force_csc_type, "\n force colour space convert type\n");
 
-static uint fresh_vs;
-module_param(fresh_vs, uint, 0664);
-MODULE_PARM_DESC(fresh_vs, "\n fresh_vs\n");
-
-
 static uint cur_hdr_support;
 module_param(cur_hdr_support, uint, 0664);
 MODULE_PARM_DESC(cur_hdr_support, "\n cur_hdr_support\n");
@@ -3009,7 +3004,8 @@ int signal_type_changed(struct vframe_s *vf, struct vinfo_s *vinfo)
        }
        if (cur_knee_factor != knee_factor) {
                pr_csc("Knee factor changed.\n");
-               //change_flag |= SIG_KNEE_FACTOR;
+               change_flag |= SIG_KNEE_FACTOR;
+               cur_knee_factor = knee_factor;
        }
        if (cur_hdr_process_mode != hdr_process_mode) {
                pr_csc("HDR mode changed.\n");
@@ -4820,12 +4816,6 @@ static int vpp_matrix_update(
        if (vf && vinfo)
                signal_change_flag = signal_type_changed(vf, vinfo);
 
-       if ((!signal_change_flag) && (force_csc_type == 0xff) && (!fresh_vs))
-               return 0;
-
-       if (fresh_vs > 0)
-               fresh_vs = 0;
-
        if (force_csc_type != 0xff)
                csc_type = force_csc_type;
        else
@@ -5129,7 +5119,8 @@ int amvecm_matrix_process(
                /* when sdr mode change */
                if ((vinfo->hdr_info.hdr_support & 0x4) &&
                        ((get_cpu_type() == MESON_CPU_MAJOR_ID_GXL) ||
-                       (get_cpu_type() == MESON_CPU_MAJOR_ID_GXM)))
+                       (get_cpu_type() == MESON_CPU_MAJOR_ID_GXM) ||
+                       (get_cpu_type() == MESON_CPU_MAJOR_ID_G12A)))
                        if (((sdr_process_mode != 1) && (sdr_mode > 0))
                                || ((sdr_process_mode > 0) && (sdr_mode == 0)))
                                null_vf_cnt = toggle_frame;
index 9737fbb..eb5eac3 100644 (file)
@@ -98,17 +98,6 @@ module_param_array(ogain_lut0, int, &num_ogain_lut0, 0664);
 MODULE_PARM_DESC(ogain_lut0, "\n knee_setting, 256=1.0\n");
 
 int cgain_lut0[65] = {
-       0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00,
-       0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00,
-       0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00,
-       0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00,
-       0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc00, 0xc0e,
-       0xc29, 0xc44, 0xc5f, 0xc79, 0xc92, 0xcab, 0xcc3, 0xcdb, 0xcf2,
-       0xd09, 0xd20, 0xd36, 0xd4c, 0xd61, 0xd76, 0xd8b, 0xd9f, 0xdb3,
-       0xdc7, 0xdda
-};
-
-int cgain_lut0_2[65] = {
        0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400,
        0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400,
        0x4c0, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400,
@@ -119,7 +108,6 @@ int cgain_lut0_2[65] = {
        0x68b, 0x69f
 };
 
-
 // hdr10 to gamma lut 12bit (hdr to sdr)
 int eotf_lut1[143] = {
        0xfc000, 0x10400, 0x17000, 0x1b000,
@@ -198,14 +186,14 @@ module_param_array(ogain_lut1, int, &num_ogain_lut1, 0664);
 MODULE_PARM_DESC(ogain_lut1, "\n ogain_lut1\n");
 
 int cgain_lut1[65] = {
-       0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f,
-       0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f,
-       0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f,
-       0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f,
-       0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f,
-       0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f,
-       0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f, 0x69f,
-       0x69f, 0x69f
+       0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400,
+       0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400,
+       0x4c0, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400,
+       0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x400, 0x40e,
+       0x429, 0x444, 0x45f, 0x479, 0x492, 0x4ab, 0x4c3, 0x4db, 0x4f2,
+       0x509, 0x520, 0x536, 0x54c, 0x561, 0x576, 0x58b, 0x59f, 0x5b3,
+       0x5c0, 0x5d0, 0x5f2, 0x609, 0x620, 0x636, 0x64c, 0x661, 0x676,
+       0x68b, 0x69f
 };
 
 // sdr to hdr 10bit (gamma to peak)
@@ -949,10 +937,7 @@ void set_hdr_matrix(
                /*gamut mode: 1->gamut before ootf*/
                                        /*2->gamut after ootf*/
                                        /*other->disable gamut*/
-               if (MTX_ON)
-                       WRITE_VPP_REG_BITS(hdr_ctrl, 0, 6, 2);
-               else
-                       WRITE_VPP_REG_BITS(hdr_ctrl, 0, 6, 2);
+               WRITE_VPP_REG_BITS(hdr_ctrl, 1, 6, 2);
 
            WRITE_VPP_REG(GMUT_CTRL, gmut_shift);
            WRITE_VPP_REG(GMUT_COEF0,
@@ -1332,7 +1317,7 @@ void sdr2hdr_func(enum hdr_module_sel module_sel)
                if (i < HDR2_EOTF_LUT_SIZE)
                        eotf_lut[i] = eotf_lut0[i];
                if (i < HDR2_CGAIN_LUT_SIZE)
-                       cgain_lut[i] = cgain_lut0_2[i] - 1;
+                       cgain_lut[i] = cgain_lut0[i] - 1;
        }
 #endif