/* * Copyright (c) 2014 Amlogic, Inc. All rights reserved. * * This source code is subject to the terms and conditions defined in the * file 'LICENSE' which is part of this source code package. * * Description: header file */ #include #ifndef CONFIG_FILE_H_ #define CONFIG_FILE_H_ #define UBOOT_MODEL_NAME "model_name" #define MODEL_NAME_DEFAULT "DEFAULT" #define PANEL_INI_PATH "/vendor/etc/tvconfig/model" // model_sum.ini path #define PQ_DB_DEFAULT_PATH "/vendor/etc/tvconfig/pq/pq.db" #define OVERSCAN_DB_DEFAULT_PATH "/vendor/etc/tvconfig/pq/overscan.db" #define LDIM_BIN_DEFAULT_PATH "/vendor/etc/tvconfig/pq/ldim.bin" #define DV_BIN_FILE_DEFAULT_PATH "/vendor/etc/tvconfig/panel/dv_config.bin" #define DV_CFG_FILE_DEFAULT_PATH "/vendor/etc/tvconfig/panel/Amlogic_dv.cfg" #define PQ_CONFIG_DEFAULT_PATH "/vendor/etc/tvconfig/pq/pq_default.ini" #define PQ_SETTINGDATA_DEFAULT_PATH "/vendor/etc/tvconfig/pq" #define PQ_WHITEBALANCE_DEFAULT_PATH "/vendor/etc/tvconfig/pq" //for pq config #define CFG_SECTION_PQ "PQ" #define CFG_PQ_DB_CONFIG_PATH "pq_db_config_path" #define CFG_PQ_SETTINGDATA_FILE_PATH "pq_uiSettingDataFile_path" // 1)old struct for ssm_data; 2)new struct for TV_PICTURE #define CFG_PQ_WHITEBALANCE_FILE_PATH "pq_FactorywhiteBalance_path" #define CFG_PQ_DV_BIN_PATH "pq_dv_bin_path" #define CFG_PQ_DV_CFG_PATH "pq_dv_cfg_path" #define CFG_PQ_LDIM_BIN_PATH "pq_ldim_bin_path" #define CFG_PQ_UI_SETTING_PATH "pq_ui_setting_path" #define CFG_BIG_SMALL_DB_ENABLE "pq.big_small_db.en" #define CFG_ALL_PQ_MODULE_ENABLE "pq.all_pq_module.en" #define CFG_PQ_MODE_CHECK_SOURCE_ENABLE "pq.pq_mode_check_source.en" #define CFG_TVHAL_ENABLE "pq.tvhal.en" #define CFG_BLACK_BLUE_CHROMA_DB_ENABLE "pq.black_blue_chroma_db.en" //amvecm module config #define CFG_AMVECM_BASCI_ENABLE "pq.amvecm_basic.en" #define CFG_SHARPNESS_ENABLE "pq.sharpness.en" #define CFG_SHARPNESS0_ENABLE "pq.sharpness0.en" #define CFG_SHARPNESS1_ENABLE "pq.sharpness1.en" #define CFG_SHARPNESSPI_ENABLE "pq.sharpnesspi.en" #define CFG_DNLP_ENABLE "pq.dnlp.en" #define CFG_CM2_ENABLE "pq.cm2.en" #define CFG_CONTRAST_RGB_ENABLE "pq.contrast_rgb.en" #define CFG_WHITEBALANCE_ENABLE "pq.white_balance.en" #define CFG_GAMMA_ENABLE "pq.gamma.en" #define CFG_LOCAL_CONTRAST_ENABLE "pq.local_contrast.en" #define CFG_BLACKEXTENSION_ENABLE "pq.black_extension.en" #define CFG_WHITEEXTENSION_ENABLE "pq.white_extension.en" #define CFG_BLUESTRETCH_ENABLE "pq.blue_stretch.en" #define CFG_CHROMA_COR_ENABLE "pq.chroma_cor.en" #define CFG_XVYCC_ENABLE "pq.xvycc.en" #define CFG_HDRTMO_ENABLE "pq.hdr_tmo.en" #define CFG_COLOR_SPACE "pq.color_space.en" #define CFG_GAMUT_ENABLE "pq.gamut.en" #define CFG_SUPER_RESOLUTION "pq.super_resolution.en" #define CFG_AMVECM_BASCI_WITHOSD_ENABLE "pq.amvecm_basic_with_osd.en" #define CFG_CONTRAST_RGB_WITHOSD_ENABLE "pq.contrast_rgb_with_osd.en" #define CFG_OSD_PIC_ENABLE "pq.osd_pic.en" #define CFG_OSD_SHARPNEDD "pq.ssd_sharpness.en" //di module config #define CFG_DI_ENABLE "pq.di.en" #define CFG_MCDI_ENABLE "pq.mcdi.en" #define CFG_DEBLOCK_ENABLE "pq.deblock.en" #define CFG_NOISEREDUCTION_ENABLE "pq.noise_reduction.en" #define CFG_DEMOSQUITO_ENABLE "pq.demosquito.en" #define CFG_SMOOTHPLUS_ENABLE "pq.smooth_plus.en" //ai module config #define CFG_AI_ENABLE "pq.ai_pq.en" #define CFG_AICOLOR_ENABLE "pq.ai_color.en" #define CFG_AISR_ENABLE "pq.ai_sr.en" #define CFG_INLINEAISR_ENABLE "pq.inline_aisr.en" //memc module config #define CFG_MEMC_ENABLE "pq.memc.en" //backlight module config #define CFG_BACKLIGHT_ENABLE "pq.backlight.en" #define CFG_GLOBAL_DIMMING_ENABLE "pq.global_dimming.en" #define CFG_LOCAL_DIMMING_ENABLE "pq.local_dimming.en" //av decode config #define CFG_CVD2_ENABLE "pq.cvd2.en" #define CFG_AAD_ENABLE "pq.aad.en" #define CFG_CABC_ENABLE "pq.cabc.en" //others module config #define CFG_HDMI_COLOR_RANGE_MODE "pq.hdmi_color_range_mode.en" #define CFG_DISPLAY_OVERSCAN_ENABLE "pq.display_overscan.en" #define CFG_FILM_MODE "pq.film_mode.en" #define CFG_DONGLE_LOW_POWER "pq.dongle_low_power.en" #define CFG_NEW_PICTURE_MODE_ENABLE "pq.new_picture_mode.en" #define CFG_DPSS_ENABLE "pq.dpss.en" #define CFG_EYE_PROTECTION_ENABLE "pq.EyeProtectionMode.en" //pq param default value #define CFG_PICTUREMODE_DEF "pq.PictureMode.def" #define CFG_DV_PICTUREMODE_DEF "pq.DvPictureMode.def" #define CFG_COLORTEMPTUREMODE_DEF "pq.ColorTemperature.def" #define CFG_COLORDEMOMODE_DEF "pq.ColorDemoMode.def" #define CFG_COLORBASEMODE_DEF "pq.ColorBaseMode.def" #define CFG_COLORSPACE_DEF "pq.ColorSpace.def" #define CFG_RGBGAIN_R_DEF "pq.RGBGainR.def" #define CFG_RGBGAIN_G_DEF "pq.RGBGainG.def" #define CFG_RGBGAIN_B_DEF "pq.RGBGainB.def" #define CFG_RGBPOSTOFFSET_R_DEF_DEF "pq.RGBPostOffsetR.def" #define CFG_RGBPOSTOFFSET_G_DEF_DEF "pq.RGBPostOffsetG.def" #define CFG_RGBPOSTOFFSET_B_DEF_DEF "pq.RGBPostOffsetB.def" #define CFG_GAMMALEVEL_DEF "pq.GammaLevel.def" #define CFG_DISPLAYMODE_DEF "pq.DisplayMode.def" #define CFG_AUTOASPECT_DEF "pq.AutoAspect.def" #define CFG_43STRETCH_DEF "pq.43Stretch.def" #define CFG_DNLPLEVEL_DEF "pq.DnlpLevel.def" #define CFG_DNLPGAIN_DEF "pq.DnlpGain.def" #define CFG_EYEPROJECTMODE_DEF "pq.EyeProtectionMode.def" #define CFG_DDRSSC_DEF "pq.DDRSSC.def" #define CFG_LVDSSSC_DEF "pq.LVDSSSC.def" #define CFG_LOCALCONTRASTMODE_DEF "pq.LocalContrastMode.def" #define CFG_MEMCMODE_DEF "pq.MemcMode.def" #define CFG_MEMCDEBLURLEVEL_DEF "pq.MemcDeblurLevel.def" #define CFG_MEMCDEJUDDERLEVEL_DEF "pq.MemcDeJudderLevel.def" #define CFG_DEBLOCKMODE_DEF "pq.DeblockMode.def" #define CFG_DEMOSQUITOMODE_DEF "pq.DemoSquitoMode.def" #define CFG_MCDI_DEF "pq.McDiMode.def" #define CFG_BLACKSTRETCH_DEF "pq.BlackStretch.def" #define CFG_BLUESTRETCH_DEF "pq.BlueStretch.def" #define CFG_CHMROMACORING_DEF "pq.ChromaCoring.def" #define CFG_LOCALDIMMING_DEF "pq.LocalDimming.def" #define CFG_DYNAMICBACKLIGHT_DEF "pq.DynamicBacklight.def" #define CFG_FMM_MODE_DEF "pq.FilmMakerMode.def" #define CFG_AISRMODE_DEF "pq.AisrMode.def" #define CFG_AIPQMODE_DEF "pq.AipqMode.def" //for backlight #define CFG_SECTION_BACKLIGHT "BACKLIGHT" #define CFG_LCD_HDR_INFO_ENABLE "lcd.hdrinfo.en" #define CFG_AUTOBACKLIGHT_THTF "auto.backlight.thtf" #define CFG_AUTOBACKLIGHT_LUTMODE "auto.backlight.lutmode" #define CFG_AUTOBACKLIGHT_LUTHIGH "auto.backlight.lutvalue_high" #define CFG_AUTOBACKLIGHT_LUTLOW "auto.backlight.lutvalue_low" //For HDMI #define CFG_SECTION_HDMI "HDMI" #define CFG_EDID_VERSION_DEF "hdmi.edid.version.def" #define CFG_HDCP_SWITCHER_DEF "hdmi.hdcp.switcher.def" #define CFG_COLOR_RANGE_MODE_DEF "hdmi.color.range.mode.def" #define CFG_HDMI_OUT_WITH_FBC_ENABLE "hdmi.out.with.fbc.en" #define CGF_HDMI_AUTOSWITCH_ALLM_EN "hdmi.autoswitch.allm.en" #define CGF_HDMI_AUTOSWITCH_ITCONTENT_EN "hdmi.autoswitch.itcontent.en" #define CGF_HDMI_AUTOSWITCH_DVI_EN "hdmi.autoswitch.dvi.en" //for auto nr #define CFG_SECTION_AUTO_NR "AUTO_NR" #define CFG_AUTO_NR_MOTION_TH "auto.nr.motion_th" #define CFG_AUTO_NR_MOTION_LP_YGAIN "auto.nr.motion_lp_ygain" #define CFG_AUTO_NR_MOTION_HP_YGAIN "auto.nr.motion_hp_ygain" #define CFG_AUTO_NR_MOTION_LP_CGAIN "auto.nr.motion_lp_cgain" #define CFG_AUTO_NR_MOTION_HP_CGAIN "auto.nr.motion_hp_cgain" #define CFG_AUTO_NR_APL_GAIN "auto.nr.apl_gain" //for CMS #define CFG_SECTION_CMS "CMS" #define CFG_CMS_CM_READ "color.customize.cm.red" #define CFG_CMS_CM_GREEN "color.customize.cm.green" #define CFG_CMS_CM_BLUE "color.customize.cm.blue" #define CFG_CMS_CM_CYAN "color.customize.cm.cyan" #define CFG_CMS_CM_PURPLE "color.customize.cm.purple" #define CFG_CMS_CM_YELLOW "color.customize.cm.yellow" #define CFG_CMS_CM_SKIN "color.customize.cm.skin" #define CFG_CMS_CM_YELLOW_GREEN "color.customize.cm.yellow.green" #define CFG_CMS_CM_BLUE_GREEN "color.customize.cm.blue.green" #define CFG_CMS_3DLUT_EN "color.customize.3dlut.en" #define CFG_CMS_3DLUT_RED "color.customize.3dlut.red" #define CFG_CMS_3DLUT_GREEN "color.customize.3dlut.green" #define CFG_CMS_3DLUT_BLUE "color.customize.3dlut.blue" #define CFG_CMS_3DLUT_CYAN "color.customize.3dlut.cyan" #define CFG_CMS_3DLUT_MAGENTA "color.customize.3dlut.magenta" #define CFG_CMS_3DLUT_YELLOW "color.customize.3dlut.yellow" //for eye protection level #define CFG_EYE_PROTECTION "EYE_PROTECTION" #define CFG_EYE_R_GAIN "eye.r.gain" #define CFG_EYE_G_GAIN "eye.g.gain" #define CFG_EYE_B_GAIN "eye.b.gain" static const int MAX_CONFIG_FILE_LINE_LEN = 512; typedef enum _LINE_TYPE { LINE_TYPE_SECTION = 0, LINE_TYPE_KEY, LINE_TYPE_COMMENT, } LINE_TYPE; typedef struct _LINE { LINE_TYPE type; char Text[MAX_CONFIG_FILE_LINE_LEN]; int LineLen; char *pKeyStart; char *pKeyEnd; char *pValueStart; char *pValueEnd; struct _LINE *pNext; } LINE; typedef struct _SECTION { LINE *pLine; struct _SECTION *pNext; } SECTION; class CConfigFile { public: CConfigFile(); ~CConfigFile(); static CConfigFile *GetInstance(); bool isFileExist(const char *file_name); int LoadFromFile(const char *filename); int SaveToFile(const char *filename = NULL); int SetString(const char *section, const char *key, const char *value); int SetInt(const char *section, const char *key, int value); int SetFloat(const char *section, const char *key, float value); const char *GetString(const char *section, const char *key, const char *def_value); int GetInt(const char *section, const char *key, int def_value); float GetFloat(const char *section, const char *key, float def_value); const char *GetDatabaseFilePath(const char *section, const char *key, const char *def_value); const char *GetSettingDataFilePath(const char *section, const char *key, const char *def_value); const char *GetWhiteBalanceFilePath(const char *section, const char *key, const char *def_value); const char *GetFilePath(const char *section, const char *key, const char *def_value); void GetPqdbPath(char *file_path); void GetOverscandbPath(char *file_path); void GetDvFilePath(char *bin_file_path, char *cfg_file_path); void GetLdimBinPath(char *file_path); public: std::string PQ_INI_PATH = ""; private: LINE_TYPE getLineType(char *Str); void allTrim(char *Str); SECTION *getSection(const char *section); LINE *getKeyLineAtSec(SECTION *pSec, const char *key); void FreeAllMem(); int InsertSection(SECTION *pSec); int InsertKeyLine(SECTION *pSec, LINE *line); bool GetCustomerFilePath(std::string& file_path); bool get_panel_name(std::string& panel_id); bool get_File_name(std::string& file_name, const std::string& panel_id); bool get_File_name0(std::string& file_name, const std::string& panel_id); static CConfigFile *mInstance; FILE *mpConfigFile; LINE *mpFirstLine; SECTION *mpFirstSection; char mpFileName[256]; std::string mLocalDimmingBinPth{""}; }; #endif //end of CONFIG_FILE_H_