/* * Copyright (c) 2019 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: */ #define LOG_MODULE_TAG "PQ" #define LOG_CLASS_TAG "PqClient" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "CPQLog.h" #include "PqClient.h" #include "pqcmd.h" using namespace android; enum { CMD_START = IBinder::FIRST_CALL_TRANSACTION, CMD_PQ_ACTION = IBinder::FIRST_CALL_TRANSACTION + 1, CMD_SET_PQ_CB = IBinder::FIRST_CALL_TRANSACTION + 2, CMD_CLR_PQ_CB = IBinder::FIRST_CALL_TRANSACTION + 3, CMD_HDR_DT_CB = IBinder::FIRST_CALL_TRANSACTION + 4, CMD_ALLM_GAME_CB = IBinder::FIRST_CALL_TRANSACTION + 5, CMD_FMM_PQ_CB = IBinder::FIRST_CALL_TRANSACTION + 6, CMD_REFRESH_RATE_CB = IBinder::FIRST_CALL_TRANSACTION + 7, CMD_PQMODE_AUTO_CHANGED_CB = IBinder::FIRST_CALL_TRANSACTION + 8, CMD_PQMODE_MANUAL_CHANGED_CB = IBinder::FIRST_CALL_TRANSACTION + 9, CMD_PQ_SET_DDR_SSC, CMD_PQ_GET_DDR_SSC, CMD_PQ_SET_LVDS_SSC_LEVEL, CMD_PQ_GET_LVDS_SSC_LEVEL, CMD_PQ_SET_LVDS_SSC_FREP, CMD_PQ_GET_LVDS_SSC_FREP, CMD_PQ_SET_LVDS_SSC_MODE, CMD_PQ_GET_LVDS_SSC_MODE, CMD_PQ_SET_COLORTEMPERATURE_USER_PARAM, CMD_PQ_GET_COLORTEMPERATURE_USER_PARAM, CMD_PQ_RESET_PICTURE_MODE, CMD_PQ_RESET_ALL_PICTURE_MODE, CMD_PQ_GET_PICTURE_MODE_PARAM, CMD_PQ_GET_DEFAULT_PICTURE_MODE_PARAM, CMD_PQ_GET_DEFAULT_ALL_PQ_PARAM, CMD_PQ_COPY_VALUES_FROM_PICTURE_MODE, CMD_PQ_COPY_PICTURE_MODE_PARAM_TO_ALL_SOURCE, CMD_PQ_SET_GAMMA_TABLE, CMD_PQ_GET_GAMMA_TABLE, CMD_PQ_CLEAR_GAMMA_TABLE, PQ_SET_PQ_BYPASS_LEVEL, PQ_SET_GAMMA_PATTERN, }; class PqClientPriv : public BBinder { public: PqClientPriv(); ~PqClientPriv(); static PqClientPriv *GetInstance(); protected: void SendMethodCall(const char *CmdString, std::string &retBuf); int SplitRetBuf(std::string const &commandData, std::vector &result); status_t Transact(uint32_t code, const Parcel &data, Parcel *reply) { if (mpqServicebinder != NULL) { return mpqServicebinder->transact(code, data, reply); } return UNKNOWN_ERROR; } int RegisterObserver(PqClient::PqClientIObserver *observer); private: sp mpqServicebinder; virtual status_t onTransact(uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags = 0); private: int TransactCbData(CPqClientCb &cb_data); static int GetHdrTypeFromPqserver(const void *param); static int GetAllmGameModeFromPqserver(const void *param); static int GetFilmMakerFromPqserver(const void *param); static int GetRefreshRateFromPqserver(const void *param); static int GetPqModeAutoChangedFromPqserver(const void *param); static int GetPqModeManualChangedFromPqserver(const void *param); std::vector mPqClientObserver; int mpqServicebinderId; friend class PqClient; }; const int RET_SUCCESS = 0; const int RET_FAILED = -1; const int EVENT_SIGLE_DETECT = 4; const int EVENT_SOURCE_CONNECT = 10; PqClientPriv *PqClientPriv::GetInstance() { static sp inst_; if (inst_.get() == nullptr) { inst_ = new PqClientPriv(); } LOGD("%s: getid %d\n", __FUNCTION__, getpid()); return inst_.get(); } PqClientPriv::PqClientPriv() { sp proc(ProcessState::self()); proc->startThreadPool(); Parcel send, reply; sp serviceManager = defaultServiceManager(); init_pq_logging(); do { mpqServicebinder = serviceManager->getService(String16("pqservice")); LOGD("%s mpqServicebinder is %p\n", __FUNCTION__, mpqServicebinder); if (mpqServicebinder != 0) break; LOGD("%s PqClient: Waiting pqservice published.\n", __FUNCTION__); usleep(500000); } while (true); mpqServicebinderId = 0; LOGD("Connected to pqservice.\n"); } PqClientPriv::~PqClientPriv() { if (mpqServicebinder != NULL) { Parcel send, reply; send.writeInt32(mpqServicebinderId); mpqServicebinder->transact(CMD_CLR_PQ_CB, send, &reply); mpqServicebinder = NULL; } LOGD("%s\n", __FUNCTION__); } void PqClientPriv::SendMethodCall(const char *CmdString, std::string &retBuf) { LOGD("%s\n", __FUNCTION__); Parcel send, reply; if (mpqServicebinder != NULL) { send.writeCString(CmdString); if (mpqServicebinder->transact(CMD_PQ_ACTION, send, &reply) != 0) { LOGE("PqClient: call %s failed\n", CmdString); } retBuf = reply.readCString(); } LOGE("PqClient: retBuf %s\n", retBuf.c_str()); } int PqClientPriv::SplitRetBuf(std::string const &commandData, std::vector &result) { LOGD("%s\n", __FUNCTION__); int split_cnt = 0; std::istringstream iss(commandData); std::string sub; while (std::getline(iss, sub, '.')) { result.push_back(sub); split_cnt++; } return split_cnt; } status_t PqClientPriv::onTransact(uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) { LOGD("PqClient get tanscode: %u\n", code); switch (code) { case CMD_HDR_DT_CB: { GetHdrTypeFromPqserver(&data); break; } case CMD_ALLM_GAME_CB: { GetAllmGameModeFromPqserver(&data); break; } case CMD_FMM_PQ_CB: { GetFilmMakerFromPqserver(&data); break; } case CMD_REFRESH_RATE_CB: { GetRefreshRateFromPqserver(&data); break; } case CMD_PQMODE_AUTO_CHANGED_CB: { GetPqModeAutoChangedFromPqserver(&data); break; } case CMD_PQMODE_MANUAL_CHANGED_CB: { GetPqModeManualChangedFromPqserver(&data); break; } case CMD_START: default: return BBinder::onTransact(code, data, reply, flags); } return (0); } // for callback method int PqClientPriv::RegisterObserver(PqClient::PqClientIObserver *observer) { LOGD("%s the main process pid %d\n", __FUNCTION__, getpid()); // send client binder proxy object to server if (mpqServicebinder != 0) { Parcel send, reply; send.writeStrongBinder(sp(this)); mpqServicebinder->transact(CMD_SET_PQ_CB, send, &reply); mpqServicebinderId = reply.readInt32(); LOGD("%s mpqServicebinderId %d\n", __FUNCTION__, mpqServicebinderId); } // register upper client observer if (observer != nullptr) { mPqClientObserver.emplace_back(observer); LOGD("%s mPqClientObserver[%p] has been register\n", __FUNCTION__, observer); } else { LOGE("%s observer is NULL\n", __FUNCTION__); } return 0; } int PqClientPriv::TransactCbData(CPqClientCb &cb_data) { int clientSize = mPqClientObserver.size(); LOGD("%s now has %d pqclient\n", __FUNCTION__, clientSize); int i = 0; for (i = 0; i < clientSize; i++) { if (mPqClientObserver[i] != NULL) { mPqClientObserver[i]->GetPqCbData(cb_data); LOGD("%s mPqClientObserver[%d] %p\n", __FUNCTION__, i, mPqClientObserver[i]); } else { LOGD("%s mPqClientObserver[%d] is NULL\n", __FUNCTION__, i); } } LOGD("%s send event for %d count PqClientObserver!\n", __FUNCTION__, i); return 0; } int PqClientPriv::GetHdrTypeFromPqserver(const void *param) { LOGD("%s the main process pid %d\n", __FUNCTION__, getpid()); Parcel *parcel = (Parcel *)param; PqClientCb::HdrTypeCb cb_data; cb_data.mHdrType = parcel->readInt32(); LOGD("%s cb_data.mHdrType %d\n", __FUNCTION__, cb_data.mHdrType); GetInstance()->TransactCbData(cb_data); return 0; } int PqClientPriv::GetAllmGameModeFromPqserver(const void *param) { LOGD("%s the main process pid %d\n", __FUNCTION__, getpid()); Parcel *parcel = (Parcel *)param; PqClientCb::AllmGameModeCb cb_data; cb_data.mAllmGameMode = parcel->readInt32(); LOGD("%s cb_data.mAllmGameMode %d\n", __FUNCTION__, cb_data.mAllmGameMode); GetInstance()->TransactCbData(cb_data); return 0; } int PqClientPriv::GetFilmMakerFromPqserver(const void *param) { LOGD("%s the main process pid %d\n", __FUNCTION__, getpid()); Parcel *parcel = (Parcel *)param; PqClientCb::FilmMakerModeCb cb_data; cb_data.mFilmMakerMode = parcel->readInt32(); LOGD("%s cb_data.mFilmMakerMode %d\n", __FUNCTION__, cb_data.mFilmMakerMode); GetInstance()->TransactCbData(cb_data); return 0; } int PqClientPriv::GetRefreshRateFromPqserver(const void *param) { LOGD("%s the main process pid %d\n", __FUNCTION__, getpid()); Parcel *parcel = (Parcel *)param; PqClientCb::RefreshRateCb cb_data; cb_data.mRefreshRate = parcel->readInt32(); LOGD("%s cb_data.mRefreshRate %d\n", __FUNCTION__, cb_data.mRefreshRate); GetInstance()->TransactCbData(cb_data); return 0; } int PqClientPriv::GetPqModeAutoChangedFromPqserver(const void *param) { LOGD("%s the main process pid %p\n", __FUNCTION__, getpid()); Parcel *parcel = (Parcel *)param; PqClientCb::PqModeChangedCb cb_data; cb_data.pq_mode_info.pq_mode = parcel->readInt32(); cb_data.pq_mode_info.hdr_type = parcel->readInt32(); cb_data.pq_mode_info.input_src = parcel->readInt32(); cb_data.pq_mode_info.low_latency = parcel->readInt32(); LOGD("%s pq_mode %d, hdr_type %d, input_src %d, low_latency %d\n", __FUNCTION__, cb_data.pq_mode_info.pq_mode, cb_data.pq_mode_info.hdr_type, cb_data.pq_mode_info.input_src, cb_data.pq_mode_info.low_latency); GetInstance()->TransactCbData(cb_data); return 0; } int PqClientPriv::GetPqModeManualChangedFromPqserver(const void *param) { LOGD("%s the main process pid %p\n", __FUNCTION__, getpid()); Parcel *parcel = (Parcel *)param; PqClientCb::PictureModeCb cb_data; cb_data.mPictureMode = parcel->readInt32(); LOGD("%s pq mode %d\n", __FUNCTION__, cb_data.mPictureMode); GetInstance()->TransactCbData(cb_data); return 0; } int PqClient::SetPQMode(int mode, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_PICTURE_MODE, mode, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetPQMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_PICTURE_MODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetLastPQMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_LAST_PICTURE_MODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetColorTemperature(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_COLOR_TEMPERATURE_MODE, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetColorTemperature(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_COLOR_TEMPERATURE_MODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetColorTemperatureUserParam(tvpq_rgb_ogo_t *pData) { LOGD("%s\n", __FUNCTION__); if (pData == NULL) { LOGE("%s pData is null\n", __FUNCTION__); return -1; } int ret = -1; Parcel send, reply; send.writeInt32(pData->en); send.writeInt32(pData->r_gain); send.writeInt32(pData->g_gain); send.writeInt32(pData->b_gain); send.writeInt32(pData->r_post_offset); send.writeInt32(pData->g_post_offset); send.writeInt32(pData->b_post_offset); send.writeInt32(pData->r_pre_offset); send.writeInt32(pData->g_pre_offset); send.writeInt32(pData->b_pre_offset); if (PqClientPriv::GetInstance()->Transact( CMD_PQ_SET_COLORTEMPERATURE_USER_PARAM, send, &reply) != 0) { LOGE("PqClient: call %d failed\n", CMD_PQ_SET_COLORTEMPERATURE_USER_PARAM); return -1; } ret = reply.readInt32(); LOGE("PqClient: ret %d.\n", ret); return ret; } tvpq_rgb_ogo_t PqClient::GetColorTemperatureUserParam(void) { LOGD("%s\n", __FUNCTION__); tvpq_rgb_ogo_t param; memset(¶m, 0, sizeof(tvpq_rgb_ogo_t)); Parcel send, reply; if (PqClientPriv::GetInstance()->Transact( CMD_PQ_GET_COLORTEMPERATURE_USER_PARAM, send, &reply) != 0) { LOGE("PqClient: call %d failed\n", CMD_PQ_GET_COLORTEMPERATURE_USER_PARAM); return param; } param.en = reply.readInt32(); param.r_gain = reply.readInt32(); param.g_gain = reply.readInt32(); param.b_gain = reply.readInt32(); param.r_post_offset = reply.readInt32(); param.g_post_offset = reply.readInt32(); param.b_post_offset = reply.readInt32(); param.r_pre_offset = reply.readInt32(); param.g_pre_offset = reply.readInt32(); param.b_pre_offset = reply.readInt32(); return param; } int PqClient::SetBrightness(int value, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_BRIGHTNESS, value, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetBrightness() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_BRIGHTNESS); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetContrast(int value, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_CONTRAST, value, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetContrast() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_CONTRAST); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetSaturation(int value, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_SATURATION, value, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetSaturation() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_SATURATION); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetHue(int value, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_HUE, value, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetHue() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_HUE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetSharpness(int value, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_SHARPNESS, value, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetSharpness() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_SHARPNESS); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetNoiseReductionMode(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_NOISE_REDUCTION_MODE, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetNoiseReductionMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_NOISE_REDUCTION_MODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetEyeProtectionMode(int sourceInput, int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d", PQ_SET_EYE_PROTECTION_MODE, sourceInput, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetEyeProtectionMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_EYE_PROTECTION_MODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetGammaValue(int value, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_GAMMA, value, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetGammaValue() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_GAMMA); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetDisplayMode(int isUsed, int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d", PQ_SET_DISPLAY_MODE, isUsed, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetDisplayMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_DISPLAY_MODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SaveDisplayMode(int sourceInput, int level) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SAVE_DISPLAY_MODE, sourceInput, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetBacklight(int value, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_BACKLIGHT, value, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetBacklight() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_BACKLIGHT); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetDynamicBacklight(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_DYNAMICBACKLIGHT, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetDynamicBacklight() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_DYNAMICBACKLIGHT); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetLocalContrastMode(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_LOCALCONTRAST, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetLocalContrastMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_LOCALCONTRAST); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetColorBaseMode(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_CM, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetColorBaseMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_CM); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::setCurrentSourceInfo(int sourceInput, int sigFmt, int transFmt) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d", PQ_SET_SOURCE_CHANNEL, sourceInput, sigFmt, transFmt); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } source_input_param_t PqClient::getCurrentSourceInfo() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d", PQ_GET_SOURCE_CHANNEL); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); std::vector result; PqClientPriv::GetInstance()->SplitRetBuf(retbuf, result); source_input_param_t param; param.source_input = atoi(result.at(0).c_str()); param.sig_fmt = atoi(result.at(1).c_str()); param.trans_fmt = atoi(result.at(2).c_str()); return param; } int PqClient::SetColorGamutMode(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_COLORGAMUT, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetColorGamutMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_COLORGAMUT); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetSourceHDRType() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_SOURCE_HDR_TYPE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetDynamicContrastMode(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_DYNAMICCONTRAST, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetDynamicContrastMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_DYNAMICCONTRAST); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SSMRecovery(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d", PQ_SET_RECOVERYPQ); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetMemcMode(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_MEMCMODE, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetMemcMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_MEMCMODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetMemcDeBlurLevel(int value, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_MEMC_DEBLUR, value, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetMemcDeBlurLevel() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_MEMC_DEBLUR); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetMemcDeJudderLevel(int value, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_MEMC_DEJUDDER, value, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetMemcDeJudderLevel() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_MEMC_DEJUDDER); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetDecontourMode(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_DECONTOUR, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetDecontourMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_DECONTOUR); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetDeBlockMode(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_DEBLOCK, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetDeBlockMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_DEBLOCK); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetDeMosquitoMode(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_DEMOSQUITO, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetDeMosquitoMode() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_DEMOSQUITO); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetBlackStretch(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_BLACKSTRETCH, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetBlackStretch() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_BLACKSTRETCH); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetWhiteStretch(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_WHITESTRETCH, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetWhiteStretch() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_SET_WHITESTRETCH); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetBlueStretch(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_BLUESTRETCH, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetBlueStretch() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_BLUESTRETCH); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetAipqEnable(int level) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d", PQ_SET_AIPQ, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetAipqEnable() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_AIPQ); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetAiSrMode(int level, int is_save) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_AISR, level, is_save); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetAiSrMode(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_AISR); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetAiSrModeRange(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_AISR_MODE_RANGE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetLdim(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_LDIM, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetLdim() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_LDIM); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetMpegNr(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_MPEGNR, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetMpegNr() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_MPEGNR); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::ResetPictureUiSetting(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d", PQ_SET_PICTURE_UI_CLEAR); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetColorCustomize(int color, int type, int value, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d.%d", PQ_SET_COLOR_CUSTOMIZE, color, type, value, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } vpp_single_color_param_cm_t PqClient::GetColorCustomize(int color) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d.%d", PQ_GET_COLOR_CUSTOMIZE, color); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); std::vector result; PqClientPriv::GetInstance()->SplitRetBuf(retbuf, result); vpp_single_color_param_cm_t param; param.sat = atoi(result.at(0).c_str()); param.hue = atoi(result.at(1).c_str()); param.luma = atoi(result.at(2).c_str()); return param; } int PqClient::SetColorCustomizeEnable(int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d", PQ_SET_COLOR_CUSTOMIZE_ENABLE, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetColorCustomizeEnable(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_COLOR_CUSTOMIZE_ENABLE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); return ret; } int PqClient::SetColorCustomizeBy3DLut(int color, int type, int value, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d.%d", PQ_SET_COLOR_CUSTOMIZE_3DLUT, color, type, value, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } vpp_single_color_param_3dlut_t PqClient::GetColorCustomizeBy3DLut(int color) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d.%d", PQ_GET_COLOR_CUSTOMIZE_3DLUT, color); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); std::vector result; PqClientPriv::GetInstance()->SplitRetBuf(retbuf, result); vpp_single_color_param_3dlut_t param; param.red = atoi(result.at(0).c_str()); param.green = atoi(result.at(1).c_str()); param.blue = atoi(result.at(2).c_str()); return param; } int PqClient::ResetColorCustomize(int level) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d", PQ_RESET_COLOR_CUSTOMIZE, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetWhitebalanceGammaEnable(int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d", PQ_SET_WB_GAMMA_ENABLE, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetWhitebalanceGammaEnable(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_WB_GAMMA_ENABLE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); return ret; } int PqClient::SetWhitebalanceGammaMode(int lavel) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d", PQ_SET_WB_GAMMA_MODE, lavel); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetWhitebalanceGammaMode(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_GET_WB_GAMMA_MODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); return ret; } int PqClient::SetWhitebalanceGamma(int channel, int point, int offset) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d", PQ_SET_WB_GAMMA_DATA, channel, point, offset); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetWhitebalanceGamma(int channel, int point) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d.%d.%d", PQ_GET_WB_GAMMA_DATA, channel, point); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); int ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetSuperResolution(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_SUPERRESOLUTION, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetSuperResolution(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d", PQ_GET_SUPERRESOLUTION); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); int ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetHdrToneMappingMode(int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_HDR_TONE_MAPPING_MODE, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetHdrToneMappingMode(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d", PQ_GET_HDR_TONE_MAPPING_MODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); int ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } tvpq_databaseinfo_t PqClient::GetDbVersionInfo(int level, int type) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d.%d.%d", PQ_GET_DB_VERSION_INFO, level, type); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); tvpq_databaseinfo_t param; memset(¶m, 0, sizeof(tvpq_databaseinfo_t)); memcpy(param.version, retbuf.c_str(), sizeof(param.version)); LOGD("%s param.version:%s\n", __FUNCTION__, param.version); return param; } int PqClient::SetFilmMakerMode(int level, int isSave) { /* * int level: 0(Disable), 1(Auto) */ LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_FILM_MAKER_MODE, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetFilmMakerMode(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d", PQ_GET_FILM_MAKER_MODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); int ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); /* * return: 0(Disable), 1(Auto) */ return ret; } int PqClient::HasPqCaseFunc(pq_case_func_e level) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d.%d", PQ_GET_PQ_CASE_FUNC, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::SetLoadPq(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d", PQ_SET_LOAD_PQ); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::SetPQModuleDemoState(int level, int state) { /* * int module: demo module select * 0(memc demo), 1(aisr demo) * int state: demo state * 0(demo off), 1(demo on) */ LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_SET_DEMO_STATE, level, state); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetPQModuleDemoState(int level) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d.%d", PQ_GET_DEMO_STATE, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); int ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); /* * return current level demo state: 0(demo off), 1(demo on) */ return ret; } int PqClient::SetPQModuleDemoAisrWin(int level) { /* * int level: use to set aisr demo axis win left or right on/off * 0(aleft off, right on), 1(left on, right off) */ LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d", PQ_SET_AISR_DEMO_WIN, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::GetPQModuleDemoAisrWin(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d", PQ_GET_AISR_DEMO_WIN); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); int ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); /* * return current aisr demo axis win left or right on/off * 0(left off, right on), 1(left on, right off) */ return ret; } int PqClient::SetPQModuleDemoAisrAxis(int xstart, int ystart, int xend, int yend) { /* * int xstart/ystart/xend/yend: use to set aisr demo axis win size */ LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d.%d", PQ_SET_AISR_DEMO_AXIS, xstart, ystart, xend, yend); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } pq_module_demo_aisr_axis_t PqClient::GetPQModuleDemoAisrAxis(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d", PQ_GET_AISR_DEMO_AXIS); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); std::vector result; PqClientPriv::GetInstance()->SplitRetBuf(retbuf, result); pq_module_demo_aisr_axis_t param; param.xstart = atoi(result.at(0).c_str()); param.ystart = atoi(result.at(1).c_str()); param.xend = atoi(result.at(2).c_str()); param.yend = atoi(result.at(3).c_str()); /* * return current aisr demo axis xstart/ystart/xend/yend size * Note: now this api no effect, normal upper no need it, just reserve */ return param; } vdin_sig_info_t PqClient::GetVdinSigInfo(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d", PQ_GET_VDIN_SIG_INFO); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); std::vector result; PqClientPriv::GetInstance()->SplitRetBuf(retbuf, result); vdin_sig_info_t param; param.fps = atoi(result.at(0).c_str()); param.allm_mode = atoi(result.at(1).c_str()); param.it_content = atoi(result.at(2).c_str()); param.cn_type = atoi(result.at(3).c_str()); param.vrr_mode = atoi(result.at(4).c_str()); return param; } // PQ Factory cmd int PqClient::FactoryResetPQMode(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.set.%d", PQ_FACTORY_RESET_PICTURE_MODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryResetColorTemp(void) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.set.%d", PQ_FACTORY_RESET_COLOR_TEMPERATURE_MODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryWhiteBalanceSetColorTemperature(int sourceInput, int sigFmt, int transFmt, int level, int isSave) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_FACTORY_SET_COLOR_TEMPERATURE_MODE, level, isSave); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryWhiteBalanceGetColorTemperature() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d", PQ_FACTORY_GET_COLOR_TEMPERATURE_MODE); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetPQMode_Brightness(int sourceInput, int sigFmt, int transFmt, int pqMode, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d.%d.%d", PQ_FACTORY_SET_BRIGHTNESS, sourceInput, sigFmt, transFmt, pqMode, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetPQMode_Brightness(int sourceInput, int sigFmt, int transFmt, int pqMode) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d.%d.%d.%d.%d", PQ_FACTORY_GET_BRIGHTNESS, sourceInput, sigFmt, transFmt, pqMode); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetPQMode_Contrast(int sourceInput, int sigFmt, int transFmt, int pqMode, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d.%d.%d", PQ_FACTORY_SET_CONTRAST, sourceInput, sigFmt, transFmt, pqMode, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetPQMode_Contrast(int sourceInput, int sigFmt, int transFmt, int pqMode) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d.%d.%d.%d.%d", PQ_FACTORY_GET_CONTRAST, sourceInput, sigFmt, transFmt, pqMode); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetPQMode_Saturation(int sourceInput, int sigFmt, int transFmt, int pqMode, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d.%d.%d", PQ_FACTORY_SET_SATURATION, sourceInput, sigFmt, transFmt, pqMode, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetPQMode_Saturation(int sourceInput, int sigFmt, int transFmt, int pqMode) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d.%d.%d.%d.%d", PQ_FACTORY_GET_SATURATION, sourceInput, sigFmt, transFmt, pqMode); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetPQMode_Hue(int sourceInput, int sigFmt, int transFmt, int pqMode, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d.%d.%d", PQ_FACTORY_SET_HUE, sourceInput, sigFmt, transFmt, pqMode, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetPQMode_Hue(int sourceInput, int sigFmt, int transFmt, int pqMode) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d.%d.%d.%d.%d", PQ_FACTORY_GET_HUE, sourceInput, sigFmt, transFmt, pqMode); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetPQMode_Sharpness(int sourceInput, int sigFmt, int transFmt, int pqMode, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d.%d.%d", PQ_FACTORY_SET_SHARPNESS, sourceInput, sigFmt, transFmt, pqMode, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetPQMode_Sharpness(int sourceInput, int sigFmt, int transFmt, int pqMode) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.get.%d.%d.%d.%d.%d", PQ_FACTORY_GET_SHARPNESS, sourceInput, sigFmt, transFmt, pqMode); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetOverscanParams(int sourceInput, int sigFmt, int transFmt, int level, tvin_cutwin_t param) { LOGD("%s\n", __FUNCTION__); char buf[256] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d.%d.%d.%d.%d.%d", PQ_FACTORY_SET_OVERSCAN, sourceInput, sigFmt, transFmt, level, param.hs, param.he, param.vs, param.ve); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } tvin_cutwin_t PqClient::FactoryGetOverscanParams(int sourceInput, int sigFmt, int transFmt, int level) { LOGD("%s\n", __FUNCTION__); char buf[256] = {0}; sprintf(buf, "pq.get.%d.%d.%d.%d.%d", PQ_FACTORY_GET_OVERSCAN, sourceInput, sigFmt, transFmt, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); std::vector result; PqClientPriv::GetInstance()->SplitRetBuf(retbuf, result); tvin_cutwin_t param; param.hs = atoi(result.at(0).c_str()); param.he = atoi(result.at(1).c_str()); param.vs = atoi(result.at(2).c_str()); param.ve = atoi(result.at(3).c_str()); //LOGD("%s %d %d %d %d\n", __FUNCTION__, param.hs, param.he, param.vs, param.ve); return param; } int PqClient::FactorySetWhiteBalanceRedGain(int sourceInput, int sigFmt, int transFmt, int level, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.set.%d.%d.%d.%d", PQ_FACTORY_SET_WB_RED_GAIN, sourceInput, level, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetWhiteBalanceRedGain(int sourceInput, int sigFmt, int transFmt, int level) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.get.%d.%d.%d", PQ_FACTORY_GET_WB_RED_GAIN, sourceInput, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetWhiteBalanceGreenGain(int sourceInput, int sigFmt, int transFmt, int level, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.set.%d.%d.%d.%d", PQ_FACTORY_SET_WB_GREEN_GAIN, sourceInput, level, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetWhiteBalanceGreenGain(int sourceInput, int sigFmt, int transFmt, int level) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.get.%d.%d.%d", PQ_FACTORY_GET_WB_GREEN_GAIN, sourceInput, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetWhiteBalanceBlueGain(int sourceInput, int sigFmt, int transFmt, int level, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.set.%d.%d.%d.%d", PQ_FACTORY_SET_WB_BLUE_GAIN, sourceInput, level, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetWhiteBalanceBlueGain(int sourceInput, int sigFmt, int transFmt, int level) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.get.%d.%d.%d", PQ_FACTORY_GET_WB_BLUE_GAIN, sourceInput, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetWhiteBalanceRedPostOffset(int sourceInput, int sigFmt, int transFmt, int level, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.set.%d.%d.%d.%d", PQ_FACTORY_SET_WB_RED_OFFSET, sourceInput, level, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetWhiteBalanceRedPostOffset(int sourceInput, int sigFmt, int transFmt, int level) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.get.%d.%d.%d", PQ_FACTORY_GET_WB_RED_OFFSET, sourceInput, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetWhiteBalanceGreenPostOffset(int sourceInput, int sigFmt, int transFmt, int level, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.set.%d.%d.%d.%d", PQ_FACTORY_SET_WB_GREEN_OFFSET, sourceInput, level, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetWhiteBalanceGreenPostOffset(int sourceInput, int sigFmt, int transFmt, int level) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.get.%d.%d.%d", PQ_FACTORY_GET_WB_GREEN_OFFSET, sourceInput, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetWhiteBalanceBluePostOffset(int sourceInput, int sigFmt, int transFmt, int level, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.set.%d.%d.%d.%d", PQ_FACTORY_SET_WB_BLUE_OFFSET, sourceInput, level, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetWhiteBalanceBluePostOffset(int sourceInput, int sigFmt, int transFmt, int level) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.get.%d.%d.%d", PQ_FACTORY_GET_WB_BLUE_OFFSET, sourceInput, level); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetRGBPattern(int r, int g, int b) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.set.%d.%d.%d.%d", PQ_FACTORY_SET_RGB_PATTERN, r, g, b); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetRGBPattern() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.get.%d", PQ_FACTORY_GET_RGB_PATTERN); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetGrayPattern(int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.set.%d.%d", PQ_FACTORY_SET_GRAY_PATTERN, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetGrayPattern() { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.get.%d", PQ_FACTORY_GET_GRAY_PATTERN); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetSharpnessParams(int sourceInput, int sigFmt, int transFmt, int sdhd, int type) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.get.%d.%d.%d.%d.%d.%d", PQ_FACTORY_GET_Sharpness_Params, sourceInput, sigFmt, transFmt, sdhd, type); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetSharpnessParams(int sourceInput, int sigFmt, int transFmt, int sdhd, int type, int val) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.get.%d.%d.%d.%d.%d.%d.%d", PQ_FACTORY_SET_Sharpness_Params, sourceInput, sigFmt, transFmt, sdhd, type, val); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetPQEn(int type, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d", PQ_FACTORY_SET_PQ_ENABLE, type, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetPQEn(int type) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d.%d", PQ_FACTORY_GET_PQ_ENABLE, type); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); std::vector result; PqClientPriv::GetInstance()->SplitRetBuf(retbuf, result); int value = atoi(result.at(0).c_str()); LOGE("PqClient: value %d.\n", value); return value; } noline_params_t PqClient::FactoryGetNolineParams(source_input_param_t param, int type) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.set.%d.%d.%d.%d.%d", PQ_FACTORY_GET_NOLINE_PARAMS, param.source_input, param.sig_fmt, param.trans_fmt, type); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); std::vector result; PqClientPriv::GetInstance()->SplitRetBuf(retbuf, result); noline_params_t nl_param; nl_param.osd0 = atoi(result.at(0).c_str()); nl_param.osd25 = atoi(result.at(1).c_str()); nl_param.osd50 = atoi(result.at(2).c_str()); nl_param.osd75 = atoi(result.at(3).c_str()); nl_param.osd100 = atoi(result.at(4).c_str()); LOGE("PqClient: [osd0:%d][osd25:%d][osd50:%d][osd75:%d][osd100:%d].\n", nl_param.osd0, nl_param.osd25, nl_param.osd50, nl_param.osd75, nl_param.osd100); return nl_param; } int PqClient::FactorySetNolineParams(source_input_param_t param, int type, noline_params_t nl_param) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d", PQ_FACTORY_SET_NOLINE_PARAMS, param.source_input, param.sig_fmt, param.trans_fmt, type, nl_param.osd0, nl_param.osd25, nl_param.osd50, nl_param.osd75, nl_param.osd100); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetBrightnessNolineParams(source_input_param_t param, noline_params_t nl_param) { return FactorySetNolineParams(param, NOLINE_PARAMS_TYPE_BRIGHTNESS, nl_param); } int PqClient::FactorySetContrastNolineParams(source_input_param_t param, noline_params_t nl_param) { return FactorySetNolineParams(param, NOLINE_PARAMS_TYPE_CONTRAST, nl_param); } int PqClient::FactorySetSaturationNolineParams(source_input_param_t param, noline_params_t nl_param) { return FactorySetNolineParams(param, NOLINE_PARAMS_TYPE_SATURATION, nl_param); } int PqClient::FactorySetHueNolineParams(source_input_param_t param, noline_params_t nl_param) { return FactorySetNolineParams(param, NOLINE_PARAMS_TYPE_HUE, nl_param); } int PqClient::FactorySetSharpnessNolineParams(source_input_param_t param, noline_params_t nl_param) { return FactorySetNolineParams(param, NOLINE_PARAMS_TYPE_SHARPNESS, nl_param); } int PqClient::FactorySetVolumeNolineParams(source_input_param_t param, noline_params_t nl_param) { return FactorySetNolineParams(param, NOLINE_PARAMS_TYPE_VOLUME, nl_param); } noline_params_t PqClient::FactoryGetBrightnessNolineParams(source_input_param_t param) { return FactoryGetNolineParams(param, NOLINE_PARAMS_TYPE_BRIGHTNESS); } noline_params_t PqClient::FactoryGetContrastNolineParams(source_input_param_t param) { return FactoryGetNolineParams(param, NOLINE_PARAMS_TYPE_CONTRAST); } noline_params_t PqClient::FactoryGetSaturationNolineParams(source_input_param_t param) { return FactoryGetNolineParams(param, NOLINE_PARAMS_TYPE_SATURATION); } noline_params_t PqClient::FactoryGetHueNolineParams(source_input_param_t param) { return FactoryGetNolineParams(param, NOLINE_PARAMS_TYPE_HUE); } noline_params_t PqClient::FactoryGetSharpnessNolineParams(source_input_param_t param) { return FactoryGetNolineParams(param, NOLINE_PARAMS_TYPE_SHARPNESS); } noline_params_t PqClient::FactoryGetVolumeNolineParams(source_input_param_t param) { return FactoryGetNolineParams(param, NOLINE_PARAMS_TYPE_VOLUME); } int PqClient::FactorySetColorParams(int level, tvpq_rgb_ogo_t param) { LOGD("%s\n", __FUNCTION__); char buf[128] = {0}; int ret = -1; sprintf(buf, "pqFactory.set.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d", PQ_FACTORY_SET_COLOR_PARAMS, level, param.en, param.r_pre_offset, param.g_pre_offset, param.b_pre_offset, param.r_gain, param.g_gain, param.b_gain, param.r_post_offset, param.g_post_offset, param.b_post_offset); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetColorParams(int level, tvpq_rgb_ogo_t *pData) { LOGD("%s\n", __FUNCTION__); char buf[128] = {0}; int ret = -1; sprintf(buf, "pqFactory.get.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d", PQ_FACTORY_GET_COLOR_PARAMS, level, pData->en, pData->r_pre_offset, pData->g_pre_offset, pData->b_pre_offset, pData->r_gain, pData->g_gain, pData->b_gain, pData->r_post_offset, pData->g_post_offset, pData->b_post_offset); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); std::vector result; PqClientPriv::GetInstance()->SplitRetBuf(retbuf, result); // pData->en = atoi(result.at(0).c_str()); pData->r_pre_offset = atoi(result.at(1).c_str()); pData->g_pre_offset = atoi(result.at(2).c_str()); pData->b_pre_offset = atoi(result.at(3).c_str()); pData->r_gain = atoi(result.at(4).c_str()); pData->g_gain = atoi(result.at(5).c_str()); pData->b_gain = atoi(result.at(6).c_str()); pData->r_post_offset = atoi(result.at(7).c_str()); pData->g_post_offset = atoi(result.at(8).c_str()); pData->b_post_offset = atoi(result.at(9).c_str()); ret = atoi(result.at(0).c_str()); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetDecodeLumaParams(int sourceInput, int sigFmt, int transFmt, int type, int value) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.set.%d.%d.%d.%d.%d.%d", PQ_FACTORY_SET_DEC_LUMA_PARAMS, sourceInput, sigFmt, transFmt, type, value); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactoryGetDecodeLumaParams(int sourceInput, int sigFmt, int transFmt, int type) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pqFactory.get.%d.%d.%d.%d.%d", PQ_FACTORY_GET_DEC_LUMA_PARAMS, sourceInput, sigFmt, transFmt, type); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } // ddr int PqClient::FactorySetDDRSSC(int level) { Parcel send, reply; send.writeInt32(step); if (PqClientPriv::GetInstance()->Transact( CMD_PQ_SET_DDR_SSC, send, &reply) != 0) { LOGD("%s CMD_PQ_SET_DDR_SSC level %d fail\n", __FUNCTION__, level); return -1; } return reply.readInt32(); } int PqClient::FactoryGetDDRSSC(void) { Parcel send, reply; if (PqClientPriv::GetInstance()->Transact( CMD_PQ_GET_DDR_SSC, send, &reply) != 0) { LOGD("%s CMD_PQ_GET_DDR_SSC fail\n", __FUNCTION__); return -1; } return reply.readInt32(); } // lcd int PqClient::FactorySetLVDSSSCLevel(int level) { Parcel send, reply; send.writeInt32(level); if (PqClientPriv::GetInstance()->Transact( CMD_PQ_SET_LVDS_SSC_LEVEL, send, &reply) != 0) { LOGD("%s CMD_PQ_SET_LVDS_SSC_LEVEL level %d fail\n", __FUNCTION__, level); return -1; } return reply.readInt32(); } int PqClient::FactoryGetLVDSSSCLevel(void) { Parcel send, reply; if (PqClientPriv::GetInstance()->Transact( CMD_PQ_GET_LVDS_SSC_LEVEL, send, &reply) != 0) { LOGD("%s CMD_PQ_GET_LVDS_SSC_LEVEL fail\n", __FUNCTION__); return -1; } return reply.readInt32(); } int PqClient::FactorySetLVDSSSCFrep(int level) { Parcel send, reply; send.writeInt32(level); if (PqClientPriv::GetInstance()->Transact( CMD_PQ_SET_LVDS_SSC_FREP, send, &reply) != 0) { LOGD("%s CMD_PQ_SET_LVDS_SSC_FREP level %d fail\n", __FUNCTION__, level); return -1; } return reply.readInt32(); } int PqClient::FactoryGetLVDSSSCFrep(void) { Parcel send, reply; if (PqClientPriv::GetInstance()->Transact( CMD_PQ_GET_LVDS_SSC_FREP, send, &reply) != 0) { LOGD("%s CMD_PQ_GET_LVDS_SSC_FREP fail\n", __FUNCTION__); return -1; } return reply.readInt32(); } int PqClient::FactorySetLVDSSSCMode(int level) { Parcel send, reply; send.writeInt32(level); if (PqClientPriv::GetInstance()->Transact( CMD_PQ_SET_LVDS_SSC_MODE, send, &reply) != 0) { LOGD("%s CMD_PQ_SET_LVDS_SSC_MODE level %d fail\n", __FUNCTION__, level); return -1; } return reply.readInt32(); } int PqClient::FactoryGetLVDSSSCMode(void) { Parcel send, reply; if (PqClientPriv::GetInstance()->Transact( CMD_PQ_GET_LVDS_SSC_MODE, send, &reply) != 0) { LOGD("%s CMD_PQ_GET_LVDS_SSC_MODE fail\n", __FUNCTION__); return -1; } return reply.readInt32(); } int PqClient::FactorySetWhitebalanceGamma(int level, int channel, int point, int offset) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d.%d", PQ_FACTORY_SET_WB_GAMMA_DATA, level, channel, point, offset); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::FactoryGetWhitebalanceGamma(int level, int channel, int point) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d.%d.%d.%d", PQ_FACTORY_GET_WB_GAMMA_DATA, level, channel, point); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); int ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::FactorySetPictureMode(int source, int hdrType, int pqMode) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; int ret = -1; sprintf(buf, "pq.set.%d.%d.%d.%d", PQ_FACTORY_SET_PICTURE_MODE, source, hdrType, pqMode); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); ret = std::stoi(retbuf); LOGE("PqClient: ret %d\n", ret); return ret; } int PqClient::FactoryGetPictureMode(int source, int hdrType) { LOGD("%s\n", __FUNCTION__); char buf[32] = {0}; sprintf(buf, "pq.get.%d.%d.%d", PQ_FACTORY_GET_PICTURE_MODE, source, hdrType); std::string retbuf; PqClientPriv::GetInstance()->SendMethodCall(buf, retbuf); int ret = std::stoi(retbuf); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::ResetCurrentPictureMode(void) { int ret = -1; Parcel send, reply; if (PqClientPriv::GetInstance()->Transact( CMD_PQ_RESET_PICTURE_MODE, send, &reply) != 0) { LOGD("%s CMD_PQ_RESET_PICTURE_MODE fail\n", __FUNCTION__); return -1; } ret = reply.readInt32(); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::ResetAllPictureSettings(void) { int ret = -1; Parcel send, reply; if (PqClientPriv::GetInstance()->Transact( CMD_PQ_RESET_ALL_PICTURE_MODE, send, &reply) != 0) { LOGD("%s CMD_PQ_RESET_ALL_PICTURE_MODE fail\n", __FUNCTION__); return -1; } ret = reply.readInt32(); LOGE("PqClient: ret %d.\n", ret); return ret; } pq_mode_parameters PqClient::GetCurrentParameterValues(int pqMode) { pq_mode_parameters param; memset(¶m, 0, sizeof(pq_mode_parameters)); Parcel send, reply; send.writeInt32(pqMode); if (PqClientPriv::GetInstance()->Transact( CMD_PQ_GET_PICTURE_MODE_PARAM, send, &reply) != 0) { LOGD("%s CMD_PQ_GET_PICTURE_MODE_PARAM fail\n", __FUNCTION__); return param; } param.backlight = reply.readInt32(); param.brightness = reply.readInt32(); param.contrast = reply.readInt32(); param.saturation = reply.readInt32(); param.sharpness = reply.readInt32(); param.gamma = reply.readInt32(); param.dynamic_backlight = reply.readInt32(); param.local_contrast = reply.readInt32(); param.dynamic_contrast = reply.readInt32(); param.super_resolution = reply.readInt32(); param.color_temperature = reply.readInt32(); param.hue = reply.readInt32(); param.eye_protection = reply.readInt32(); param.hdr_tone_mapping = reply.readInt32(); param.color_gamut = reply.readInt32(); param.display_mode = reply.readInt32(); param.noise_reduction = reply.readInt32(); param.MPEG_noise_reduction = reply.readInt32(); param.smooth_plus = reply.readInt32(); return param; } pq_mode_parameters PqClient::GetDefaultParameterValues(int pqMode) { pq_mode_parameters param; memset(¶m, 0, sizeof(pq_mode_parameters)); Parcel send, reply; send.writeInt32(pqMode); if (PqClientPriv::GetInstance()->Transact( CMD_PQ_GET_DEFAULT_PICTURE_MODE_PARAM, send, &reply) != 0) { LOGD("%s CMD_PQ_GET_DEFAULT_PICTURE_MODE_PARAM fail\n", __FUNCTION__); return param; } param.backlight = reply.readInt32(); param.brightness = reply.readInt32(); param.contrast = reply.readInt32(); param.saturation = reply.readInt32(); param.sharpness = reply.readInt32(); param.gamma = reply.readInt32(); param.dynamic_backlight = reply.readInt32(); param.local_contrast = reply.readInt32(); param.dynamic_contrast = reply.readInt32(); param.super_resolution = reply.readInt32(); param.color_temperature = reply.readInt32(); param.hue = reply.readInt32(); param.eye_protection = reply.readInt32(); param.hdr_tone_mapping = reply.readInt32(); param.color_gamut = reply.readInt32(); param.display_mode = reply.readInt32(); param.noise_reduction = reply.readInt32(); param.MPEG_noise_reduction = reply.readInt32(); param.smooth_plus = reply.readInt32(); return param; } all_pq_parameters PqClient::GetALLDefaultPQParameterValues(void) { all_pq_parameters param; memset(¶m, 0, sizeof(all_pq_parameters)); //int GammaMode = GetWhitebalanceGammaMode(); Parcel send, reply; if (PqClientPriv::GetInstance()->Transact( CMD_PQ_GET_DEFAULT_ALL_PQ_PARAM, send, &reply) != 0) { LOGD("%s CMD_PQ_GET_DEFAULT_ALL_PQ_PARAM fail\n", __FUNCTION__); return param; } // pqmode params param.PictureModeData.backlight = reply.readInt32(); param.PictureModeData.brightness = reply.readInt32(); param.PictureModeData.contrast = reply.readInt32(); param.PictureModeData.saturation = reply.readInt32(); param.PictureModeData.sharpness = reply.readInt32(); param.PictureModeData.gamma = reply.readInt32(); param.PictureModeData.dynamic_backlight = reply.readInt32(); param.PictureModeData.local_contrast = reply.readInt32(); param.PictureModeData.dynamic_contrast = reply.readInt32(); param.PictureModeData.super_resolution = reply.readInt32(); param.PictureModeData.color_temperature = reply.readInt32(); param.PictureModeData.hue = reply.readInt32(); param.PictureModeData.eye_protection = reply.readInt32(); param.PictureModeData.hdr_tone_mapping = reply.readInt32(); param.PictureModeData.color_gamut = reply.readInt32(); param.PictureModeData.display_mode = reply.readInt32(); param.PictureModeData.noise_reduction = reply.readInt32(); param.PictureModeData.MPEG_noise_reduction = reply.readInt32(); param.PictureModeData.smooth_plus = reply.readInt32(); // wb params for (int i = 0; i < MAX_WB_GAMMA_POINT; i++) { param.WBGammaData.R_OFFSET[i] = reply.readInt32(); param.WBGammaData.G_OFFSET[i] = reply.readInt32(); param.WBGammaData.B_OFFSET[i] = reply.readInt32(); } /* int i = 0; for (i = 0; i < GetWBGammaPointNum(GammaMode); ++i) { param.WBGammaData.R_OFFSET[i] = reply.readInt32(); param.WBGammaData.G_OFFSET[i] = reply.readInt32(); param.WBGammaData.B_OFFSET[i] = reply.readInt32(); } for (; i < MAX_WB_GAMMA_POINT; ++i) { param.WBGammaData.R_OFFSET[i] = 0; param.WBGammaData.G_OFFSET[i] = 0; param.WBGammaData.B_OFFSET[i] = 0; } */ // color tuner for (int j = 0; j < VPP_COLOR_9_MAX; j++) { param.color_tune.data[j].sat = reply.readInt32(); param.color_tune.data[j].hue = reply.readInt32(); param.color_tune.data[j].luma = reply.readInt32(); } return param; } int PqClient::CopyValuesFromPqMode(int pqMode) { int ret = -1; Parcel send, reply; send.writeInt32(pqMode); if (PqClientPriv::GetInstance()->Transact( CMD_PQ_COPY_VALUES_FROM_PICTURE_MODE, send, &reply) != 0) { LOGD("%s CMD_PQ_COPY_VALUES_FROM_PICTURE_MODE mode %d fail\n", __FUNCTION__, pqMode); return -1; } ret = reply.readInt32(); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::ApplyUserSettingsToAllSources(void) { int ret = -1; Parcel send, reply; if (PqClientPriv::GetInstance()->Transact( CMD_PQ_COPY_PICTURE_MODE_PARAM_TO_ALL_SOURCE, send, &reply) != 0) { LOGD("%s CMD_PQ_COPY_PICTURE_MODE_PARAM_TO_ALL_SOURCE fail\n",__FUNCTION__); return -1; } ret = reply.readInt32(); LOGE("PqClient: ret %d.\n", ret); return ret; } int PqClient::GetWBGammaPointNum(int level) { int PointNum = 0; if (mode > WB_GAMMA_MODE_MAX || mode < WB_GAMMA_MODE_2POINT) { mode = WB_GAMMA_MODE_11POINT; } switch (level) { case WB_GAMMA_MODE_2POINT: PointNum = 4; break; case WB_GAMMA_MODE_10POINT: PointNum = 11; break; case WB_GAMMA_MODE_11POINT: PointNum = 12; break; case WB_GAMMA_MODE_20POINT: PointNum = 21; break; default: PointNum = 12; break; } return PointNum; } int PqClient::SetGammaTable(unsigned int *pData, int level, int type, int len) { int ret = -1; Parcel send, reply; send.writeInt32(level); send.writeInt32(type); send.writeInt32(len); for (int i = 0; i < len; i++) { send.writeInt32(pData[i]); } if (PqClientPriv::GetInstance()->Transact( CMD_PQ_SET_GAMMA_TABLE, send, &reply) != 0) { LOGE("%s CMD_PQ_SET_GAMMA_TABLE level:%d type:%d len:%d fail\n",__FUNCTION__, level, type, len); return -1; } ret = reply.readInt32(); return ret; } int PqClient::GetGammaTable(unsigned int *pData, int level, int type, int len) { int ret = -1; Parcel send, reply; send.writeInt32(level); send.writeInt32(type); send.writeInt32(len); if (PqClientPriv::GetInstance()->Transact( CMD_PQ_GET_GAMMA_TABLE, send, &reply) != 0) { LOGE("%s CMD_PQ_GET_GAMMA_TABLE level:%d type:%d len:%d fail\n",__FUNCTION__, level, type, len); return -1; } ret = reply.readInt32(); if (ret < 0) { return ret; } for (int i = 0; i < len; i++) { pData[i] = reply.readInt32(); } return ret; } int PqClient::ClearGammaTable(void) { int ret = -1; Parcel send, reply; if (PqClientPriv::GetInstance()->Transact( CMD_PQ_CLEAR_GAMMA_TABLE, send, &reply) != 0) { LOGE("%s CMD_PQ_CLEAR_GAMMA_TABLE fail\n",__FUNCTION__); return -1; } ret = reply.readInt32(); return ret; } int PqClient::SetPQByPassLevel(int level) { int ret = -1; Parcel send, reply; send.writeInt32(level); if (PqClientPriv::GetInstance()->Transact( PQ_SET_PQ_BYPASS_LEVEL, send, &reply) != 0) { LOGE("%s PQ_SET_PQ_BYPASS_LEVEL fail\n",__FUNCTION__); return -1; } ret = reply.readInt32(); return ret; } int PqClient::SetGammaPattern(int enable, int R, int G, int B) { int ret = -1; Parcel send, reply; send.writeInt32(enable); send.writeInt32(R); send.writeInt32(G); send.writeInt32(B); if (PqClientPriv::GetInstance()->Transact( PQ_SET_GAMMA_PATTERN, send, &reply) != 0) { LOGE("%s PQ_SET_GAMMA_PATTERN fail\n",__FUNCTION__); return -1; } ret = reply.readInt32(); return ret; } PqClient::PqClient() {} PqClient::~PqClient() {} int PqClient::RegisterObserverToPqClient(PqClientIObserver *observer) { return PqClientPriv::GetInstance()->RegisterObserver(observer); } PqClient *PqClient::GetInstance() { static std::shared_ptr inst_; if (inst_.get() == nullptr) { inst_ = std::shared_ptr(new PqClient(), [](PqClient *ptr) { delete ptr; }); } return inst_.get(); }