summaryrefslogtreecommitdiff
path: root/tvapi/libtv/vpp/CPQdb.h (plain)
blob: 300494a84404337ca5a1c32d349c134626549efb
1/*
2 * CPQdb.h
3 *
4 * Created on: 2011-12-13
5 * Author: casey
6 */
7
8#ifndef CPQDB_H_
9#define CPQDB_H_
10
11#define PQ_NO_ANDROID 0
12
13
14#if (PQ_NO_ANDROID == 1)
15#include "sqlite3.h"
16#else
17#include "../../sqlite/dist/sqlite3.h"
18#endif
19#include "tvutils/CFile.h"
20#include "../tvin/CTvin.h"
21#include "CVpp.h"
22#include "tvutils/CSqlite.h"
23
24#define SQL_DEBUG 0
25#define getSqlParams(func, buffer, args...) \
26 do{\
27 sprintf(buffer, ##args);\
28 if(SQL_DEBUG){\
29 LOGD("getSqlParams for %s\n", func);\
30 LOGD("%s = %s\n",#buffer, buffer);\
31 }\
32 }while(0)
33
34
35typedef enum tvpq_data_type_e {
36 TVPQ_DATA_BRIGHTNESS,
37 TVPQ_DATA_CONTRAST,
38 TVPQ_DATA_SATURATION,
39 TVPQ_DATA_HUE,
40 TVPQ_DATA_SHARPNESS,
41 TVPQ_DATA_VOLUME,
42
43 TVPQ_DATA_MAX,
44} tvpq_data_type_t;
45
46typedef struct tvpq_data_s {
47 int TotalNode;
48 int NodeValue;
49 int IndexValue;
50 int RegValue;
51 double step;
52} tvpq_data_t;
53
54typedef struct tvpq_sharpness_reg_s {
55 int TotalNode;
56 am_reg_t Value;
57 int NodeValue;
58 int IndexValue;
59 double step;
60} tvpq_sharpness_reg_t;
61
62typedef struct tvpq_sharpness_regs_s {
63 int length;
64 tvpq_sharpness_reg_t reg_data[50];
65} tvpq_sharpness_regs_t;
66
67typedef struct tvpq_nonlinear_s {
68 int osd0;
69 int osd25;
70 int osd50;
71 int osd75;
72 int osd100;
73} tvpq_nonlinear_t;
74
75
76class CPqData: public CSqlite {
77public:
78 CPqData();
79 ~CPqData();
80 int PQ_GetColorDemoParams(vpp_color_demomode_t demomode, void *params);
81 int PQ_GetBaseColorParams(vpp_color_basemode_t basemode, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs);
82 int PQ_GetCM2Params(vpp_color_management2_t basemode, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs);
83 int PQ_GetNR2Params(vpp_noise_reduction2_mode_t basemode, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs);
84 int PQ_GetXVYCCParams(vpp_xvycc_mode_t xvycc_mode, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs, am_regs_t *regs_1);
85 int PQ_GetMCDIParams(vpp_mcdi_mode_t mcdi_mode, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs);
86 int PQ_GetDeblockParams(vpp_deblock_mode_t mode, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs);
87 int PQ_ColorTemperatureRGBogo2Params(void *params, tcon_rgb_ogo_t rgb_ogo);
88 int PQ_ColorTemperatureParams2RGBogo(tcon_rgb_ogo_t *rgb_ogo, void *params);
89 int PQ_GetColorTemperatureParams(vpp_color_temperature_mode_t Tempmode, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, tvin_trans_fmt_t trans_fmt,
90 tcon_rgb_ogo_t *params);
91 int PQ_SetColorTemperatureParams(vpp_color_temperature_mode_t Tempmode, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, tvin_trans_fmt_t trans_fmt,
92 tcon_rgb_ogo_t params);
93 int PQ_ResetAllColorTemperatureParams(void);
94 int PQ_GetBacklightParams(tvin_port_t source_port, int level, int *params);
95 int PQ_SetBacklightParams(tvin_port_t source_port, int level, int params);
96 int PQ_SetNoLineAllBrightnessParams(tv_source_input_type_t source_type, int osd0, int osd25, int osd50, int osd75, int osd100);
97 int PQ_GetNoLineAllBrightnessParams(tv_source_input_type_t source_type, int *osd0, int *osd25, int *osd50, int *osd75, int *osd100);
98 int PQ_GetBrightnessParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int *params);
99 int PQ_SetBrightnessParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int params);
100 int PQ_SetNoLineAllContrastParams(tv_source_input_type_t source_type, int osd0, int osd25, int osd50, int osd75, int osd100);
101 int PQ_GetNoLineAllContrastParams(tv_source_input_type_t source_type, int *osd0, int *osd25, int *osd50, int *osd75, int *osd100);
102 int PQ_GetContrastParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int *params);
103 int PQ_SetContrastParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int params);
104 int PQ_SetNoLineAllSaturationParams(tv_source_input_type_t source_type, int osd0, int osd25, int osd50, int osd75, int osd100);
105 int PQ_GetNoLineAllSaturationParams(tv_source_input_type_t source_type, int *osd0, int *osd25, int *osd50, int *osd75, int *osd100);
106 int PQ_GetSaturationParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int *params);
107 int PQ_SetSaturationParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int params);
108 int PQ_SetNoLineAllHueParams(tv_source_input_type_t source_type, int osd0, int osd25, int osd50, int osd75, int osd100);
109 int PQ_GetNoLineAllHueParams(tv_source_input_type_t source_type, int *osd0, int *osd25, int *osd50, int *osd75, int *osd100);
110 int PQ_GetHueParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int *params);
111 int PQ_SetHueParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int params);
112 int PQ_SetNoLineAllSharpnessParams(tv_source_input_type_t source_type, int osd0, int osd25, int osd50, int osd75, int osd100);
113 int PQ_GetNoLineAllSharpnessParams(tv_source_input_type_t source_type, int *osd0, int *osd25, int *osd50, int *osd75, int *osd100);
114 int PQ_GetSharpnessParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, am_regs_t *regs, am_regs_t *regs_l);
115 int PQ_SetSharpnessParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, am_regs_t regs);
116 int PQ_SetNoLineAllVolumeParams(tv_source_input_type_t source_type, int osd0, int osd25, int osd50, int osd75, int osd100);
117 int PQ_GetNoLineAllVolumeParams(tv_source_input_type_t source_type, int *osd0, int *osd25, int *osd50, int *osd75, int *osd100);
118 int PQ_GetVolumeParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int *length, int *params);
119 int PQ_SetVolumeParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int params);
120 int PQ_ResetAllNoLineParams(void);
121 int PQ_GetNoiseReductionParams(vpp_noise_reduction_mode_t nr_mode, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int *params);
122 int PQ_SetNoiseReductionParams(vpp_noise_reduction_mode_t nr_mode, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int *params);
123 int PQ_GetDNLPParams(tvin_port_t source_port, tvin_sig_fmt_t fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, ve_dnlp_t *params, ve_dnlp_table_t *newParams, int *dnlpFlag);
124 int PQ_GetBlackExtParams(tv_source_input_type_t source_type, tvin_sig_fmt_t fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, ve_bext_t *params);
125 int PQ_GetOverscanParams(tv_source_input_type_t source_type, tvin_sig_fmt_t fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, vpp_display_mode_t dmode, tvin_cutwin_t *cutwin_t);
126 int PQ_SetOverscanParams(tv_source_input_type_t source_type, tvin_sig_fmt_t fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, tvin_cutwin_t cutwin_t);
127 int PQ_ResetAllOverscanParams(void);
128 int PQ_GetPQModeParams(tv_source_input_type_t source_type, vpp_picture_mode_t pq_mode, vpp_pq_para_t *params);
129 int PQ_SetPQModeParams(tv_source_input_type_t source_type, vpp_picture_mode_t pq_mode, vpp_pq_para_t *params);
130 int PQ_ResetAllPQModeParams(void);
131 int PQ_GetGammaTableR(int panel_id, tvin_port_t source_port, tvin_sig_fmt_t fmt, tcon_gamma_table_t *gamma_r);
132 int PQ_GetGammaTableG(int panel_id, tvin_port_t source_port, tvin_sig_fmt_t fmt, tcon_gamma_table_t *gamma_g);
133 int PQ_GetGammaTableB(int panel_id, tvin_port_t source_port, tvin_sig_fmt_t fmt, tcon_gamma_table_t *gamma_b);
134 int PQ_GetGammaSpecialTable(int gammaValue, const char *f_name, tcon_gamma_table_t *gamma_r);
135 int PQ_GetVGAAjustPara(tvin_sig_fmt_t vga_fmt, tvafe_vga_parm_t *adjparam);
136 int PQ_SetVGAAjustPara(tvin_sig_fmt_t vga_fmt, tvafe_vga_parm_t adjparam);
137 int PQ_GetPhaseArray(am_phase_t *am_phase);
138 int PQ_GetPLLParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, am_regs_t *regs);
139 int PQ_GetCVD2Params(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, am_regs_t *regs);
140
141 int openPqDB(const char *);
142 int closeDB();
143 int reopenDB();
144 int getRegValues(const char *table_name, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs);
145 int getRegValuesByValue(const char *name, const char *f_name, const char *f2_name, const int val, const int val2, am_regs_t *regs);
146 int getRegValuesByValue_long(const char *name, const char *f_name, const char *f2_name, const int val, const int val2, am_regs_t *regs, am_regs_t *regs_1);
147 int LoadAllPQData(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int flag);
148 void initialTable(int type);
149 void transferFixTable();
150 int replacePqDb(const char *newFilePath);
151 int getSharpnessFlag();
152
153private:
154 int CaculateLevelParam(tvpq_data_t *pq_data, int nodes, int level);
155 am_regs_t CaculateLevelRegsParam(tvpq_sharpness_regs_t *pq_regs, int level, int flag);
156 int GetNonlinearMapping(tvpq_data_type_t data_type, tvin_port_t source_port, int level, int *params);
157 int GetNonlinearMappingByOSDFac(tvpq_data_type_t data_type, tv_source_input_type_t source_type, int *params);
158 int SetNonlinearMapping(tvpq_data_type_t data_type, tv_source_input_type_t source_type, int osd0, int osd25, int osd50, int osd75, int osd100);
159 int LoadPQData(tvpq_data_type_t data_type, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int flag);
160 int loadSharpnessData(char *sqlmaster, char *table_name);
161 int PQ_GetGammaTable(int panel_id, tvin_port_t source_port, tvin_sig_fmt_t fmt, const char *f_name, tcon_gamma_table_t *val);
162 int SetNonlinearMappingByName(const char *name, tvpq_data_type_t data_type, tv_source_input_type_t source_type, int osd0, int osd25, int osd50, int osd75, int osd100);
163 int PQ_SetPQModeParamsByName(const char *name, tv_source_input_type_t source_type, vpp_picture_mode_t pq_mode, vpp_pq_para_t *params);
164
165 tvpq_data_t pq_bri_data[15];
166 tvpq_data_t pq_con_data[15];
167 tvpq_data_t pq_sat_data[15];
168 tvpq_data_t pq_hue_data[15];
169 tvpq_sharpness_regs_t pq_sharpness_reg_data[10];
170 tvpq_sharpness_regs_t pq_sharpness_reg_data_1[10];
171 int bri_nodes;
172 int con_nodes;
173 int hue_nodes;
174 int sat_nodes;
175 int sha_nodes;
176 int sha_nodes_1;
177 int sha_diff_flag;
178 char PQ_DB_PATH[256];
179};
180#endif
181