You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
4.6 KiB
123 lines
4.6 KiB
#pragma once
|
|
|
|
#include <mutex>
|
|
#include <system/window.h>
|
|
#include "rkpq_api.h"
|
|
#include "pq_config.h"
|
|
#include "PqType.h"
|
|
|
|
namespace android {
|
|
|
|
#define PQ_CONFIG_PATH "/data/vendor/rkalgo/pq_config.json"
|
|
#define AIPQ_CONFIG_PATH "/data/vendor/rkalgo/aipq_config.json"
|
|
#define VOP_BASE_CONFIG_PATH "/vendor/etc/vop_base_config.json"
|
|
#define PQ_DUMP_IN_PATH_PREFIX "/data/vendor/rkalgo/pq_dump_in"
|
|
#define PQ_DUMP_OUT_PATH_PREFIX "/data/vendor/rkalgo/pq_dump_out"
|
|
|
|
class RkPqInterface {
|
|
public:
|
|
RkPqInterface();
|
|
virtual ~RkPqInterface();
|
|
virtual bool init(uint32_t src_width, uint32_t src_height, uint32_t* src_width_stride, uint32_t dst_width, uint32_t dst_height,
|
|
uint32_t alignment, uint32_t src_pix_format, uint32_t src_color_space, uint32_t dst_pix_format, uint32_t dst_color_space, uint32_t flag) = 0;
|
|
char* format_to_str(int format);
|
|
int convert_format(int format);
|
|
int convert_color_space(int format, uint64_t data_space);
|
|
void dump_data(char* path_prefix, int width, int height, int format ,char* dst_virtual, size_t size);
|
|
virtual int setAcmEnable(bool enable) = 0;
|
|
virtual bool getAcmEnable() = 0;
|
|
virtual int setDciEnable(bool enable) = 0;
|
|
virtual bool getDciEnable() = 0;
|
|
virtual int setSharpEnable(bool enable) = 0;
|
|
virtual bool getSharpEnable() = 0;
|
|
virtual int updatePqConfig(const char* path) = 0;
|
|
};
|
|
|
|
class RkPqInterface3588 : public RkPqInterface {
|
|
public:
|
|
RkPqInterface3588();
|
|
~RkPqInterface3588();
|
|
bool init(uint32_t src_width, uint32_t src_height, uint32_t* src_width_stride, uint32_t dst_width, uint32_t dst_height,
|
|
uint32_t alignment, uint32_t src_pix_format, uint32_t src_color_space, uint32_t dst_pix_format, uint32_t dst_color_space, uint32_t flag);
|
|
bool dopq(uint32_t src_fd, uint32_t dst_fd, uint32_t mode, uint32_t src_buffer_id = 0, uint32_t dst_buffer_id = 0);
|
|
int setAcmEnable(bool enable);
|
|
bool getAcmEnable();
|
|
int setDciEnable(bool enable);
|
|
bool getDciEnable();
|
|
int setSharpEnable(bool enable);
|
|
bool getSharpEnable();
|
|
int updatePqConfig(const char* path);
|
|
void updateRKPQProcParams(rkpq_proc_params* params);
|
|
bool localDimmingInit(uint32_t src_width, uint32_t src_height, uint32_t* src_width_stride,
|
|
uint32_t dst_width, uint32_t dst_height, uint32_t alignment, uint32_t src_pix_format, uint32_t src_color_space,
|
|
uint32_t dst_pix_format, uint32_t dst_color_space, uint32_t crtc_id);
|
|
bool doLocalDimming(PqImageInfo src, PqImageInfo dst, bool enablePQ);
|
|
|
|
private:
|
|
pq_config* pq_config_;
|
|
rkpq_context pqCxt_;
|
|
rkpq_proc_params* pqProcParams_;
|
|
int pq_timeline;
|
|
int pq_index_;
|
|
pthread_mutex_t mLock_;
|
|
uint32_t src_width_;
|
|
uint32_t src_height_;
|
|
uint32_t dst_width_;
|
|
uint32_t dst_height_;
|
|
int src_pix_format_;
|
|
int dst_pix_format_;
|
|
int brightness_bpc_ = 0;
|
|
int brightness_max_ = 0;
|
|
int brightness_min_ = 0;
|
|
int hzone_num_ = 0;
|
|
int vzone_num_ = 0;
|
|
int zone_max_ = 0;
|
|
int magic_num_ = 0;
|
|
size_t frameSize_;
|
|
rkpq_csc_cfg *pCscConfig;
|
|
rkpq_csc_cfg *pCscConfig1;
|
|
rkpq_dci_cfg *pDciConfig;
|
|
rkpq_acm_cfg *pAcmConfig;
|
|
rkpq_zme_cfg *pZmeConfig;
|
|
rkpq_shp_cfg *pShpConfig;
|
|
rkpq_sd_cfg *pSDConfig;
|
|
rkpq_sr_cfg *pSRConfig;
|
|
rkpq_dci_acm_cfg *pDciAcmConfig;
|
|
rkpq_ld_cfg *pLdConfig;
|
|
int pipeline_mode;
|
|
};
|
|
|
|
#ifdef USE_LIBPQ_HWPQ
|
|
class RkPqInterface3576 : public RkPqInterface {
|
|
public:
|
|
RkPqInterface3576();
|
|
~RkPqInterface3576();
|
|
bool init(uint32_t src_width, uint32_t src_height, uint32_t* src_width_stride, uint32_t dst_width, uint32_t dst_height,
|
|
uint32_t alignment, uint32_t src_pix_format, uint32_t src_color_space, uint32_t dst_pix_format, uint32_t dst_color_space, uint32_t flag);
|
|
bool dohwpq(HwPqImageInfo src, HwPqImageInfo dst, HwPqPreInfo preInfo);
|
|
int setAcmEnable(bool enable);
|
|
bool getAcmEnable();
|
|
int setDciEnable(bool enable);
|
|
bool getDciEnable();
|
|
int setSharpEnable(bool enable);
|
|
bool getSharpEnable();
|
|
int updatePqConfig(const char* path);
|
|
bool aipqInit(int fps);
|
|
bool doaipq(HwPqImageInfo *src, HwPqImageInfo *dst, uint8_t* pHistBuf,
|
|
float* results, uint8_t* outputNum, bool* renderIntegerFrame);
|
|
void setHwPqMeta(buffer_handle_t buffer, int64_t size, int64_t offset,
|
|
void *dciInfo, uint32_t sceneSize, void* sceneData);
|
|
bool buildCache();
|
|
int getHwPqRegConfig(rk_hwpq_reg *reg);
|
|
private:
|
|
rk_hwpq_cfg hwpq_cfg;
|
|
rk_hwpq_reg hwpq_reg;
|
|
uint8_t* p_hist_buf;
|
|
bool dovdpp(HwPqImageInfo src, HwPqImageInfo dst);
|
|
bool do_aipq_merge(HwPqPreInfo preInfo);
|
|
void setupPqStatus(HwPqPreInfo preInfo, HwPqImageInfo src);
|
|
};
|
|
#endif
|
|
}
|
|
|