1 /* SPDX-License-Identifier: Apache-2.0 OR MIT */ 2 /* 3 * Copyright (c) 2024 Rockchip Electronics Co., Ltd. 4 */ 5 6 #ifndef __HWPQ_VDPP_PROC_API_H__ 7 #define __HWPQ_VDPP_PROC_API_H__ 8 9 typedef void* rk_vdpp_context; 10 11 /* hwpq vdpp color format definition */ 12 #define VDPP_FRAME_FMT_COLOR_MASK (0x000f0000) 13 #define VDPP_FRAME_FMT_YUV (0x00000000) 14 #define VDPP_FRAME_FMT_RGB (0x00010000) 15 16 typedef enum { 17 // YUV 18 VDPP_FMT_YUV_MIN = 0, /* the min YUV format value, please DO NOT use this item! */ 19 VDPP_FMT_NV24 = 0, /* YUV444SP, 2 plane YCbCr, 24bpp/8 bpc, non-subsampled Cr:Cb plane */ 20 VDPP_FMT_NV16, /* YUV422SP, 2 plane YCbCr, 16bpp/8 bpc, 2x1 subsampled Cr:Cb plane */ 21 VDPP_FMT_NV12, /* YUV420SP, 2 plane YCbCr, 12bpp/8 bpc, 2x2 subsampled Cr:Cb plane */ 22 VDPP_FMT_NV15, /* YUV420SP, 2 plane YCbCr, 15bpp/10bpc, 10bit packed data */ 23 VDPP_FMT_NV20, /* YUV422SP, 2 plane YCbCr, 20bpp/10bpc, 10bit packed data, output supported only */ /* reserved */ 24 VDPP_FMT_NV30, /* YUV444SP, 2 plane YCbCr, 30bpp/10bpc, 10bit packed data, output supported only */ 25 VDPP_FMT_P010, /* YUV420SP, 2 plane YCbCr, 24bpp/16bpc, 10bit unpacked data with MSB aligned, output supported only */ 26 VDPP_FMT_P210, /* YUV422SP, 2 plane YCbCr, 32bpp/16bpc, 10bit unpacked data with MSB aligned, output supported only */ /* reserved */ 27 VDPP_FMT_Q410, /* YUV444P , 3 plane YCbCr, 48bpp/16bpc, 10bit unpacked data with MSB aligned, output supported only */ 28 VDPP_FMT_Y_ONLY_8BIT, /* Only 8bit-Y Plane, For VDPP y-uv diff mode */ 29 VDPP_FMT_UV_ONLY_8BIT, /* Only 8bit-UV Plane, For VDPP y-uv diff mode */ 30 VDPP_FMT_NV24_VU, 31 VDPP_FMT_NV16_VU, 32 VDPP_FMT_NV12_VU, 33 VDPP_FMT_YUV_MAX, /* the max YUV format value, please DO NOT use this item! */ 34 35 // RGB 36 VDPP_FMT_RGB_MIN = 1000,/* the min RGB format value, please DO NOT use this item! */ 37 VDPP_FMT_RGBA = 1000, /* RGBA8888, 32bpp */ 38 VDPP_FMT_RG24, /* RGB888, 24bpp */ 39 VDPP_FMT_BG24, /* BGR888, 24bpp */ 40 VDPP_FMT_AB30, /* ABGR2101010, reserved */ 41 VDPP_FMT_RGB_MAX, /* the max RGB format value, please DO NOT use this item! */ 42 } vdpp_frame_format; 43 44 typedef enum { 45 VDPP_RUN_MODE_UNSUPPORTED = -1, 46 VDPP_RUN_MODE_VEP = 0, 47 VDPP_RUN_MODE_HIST = 1, 48 } VdppRunMode; 49 50 #define VDPP_HIST_LENGTH (10240) 51 52 typedef struct { 53 int fd; 54 void* addr; 55 int offset; 56 57 int w_vld; 58 int h_vld; 59 int w_vir; 60 int h_vir; 61 } vdpp_plane_info; 62 63 typedef struct { 64 vdpp_plane_info img_yrgb; 65 vdpp_plane_info img_cbcr; 66 67 vdpp_frame_format img_fmt; 68 } vdpp_img_info; 69 70 /* vdpp module config */ 71 typedef struct { 72 // dmsr config 73 unsigned int dmsr_en; 74 unsigned int str_pri_y; 75 unsigned int str_sec_y; 76 unsigned int dumping_y; 77 unsigned int reserve_dmsr[4]; 78 79 // es config 80 unsigned int es_en; 81 unsigned int es_iWgtGain; 82 unsigned int reserve_es[4]; 83 84 // zme config 85 unsigned int zme_dering_en; 86 unsigned int reserve_zme[4]; 87 88 // hist_cnt config 89 unsigned int hist_cnt_en; 90 unsigned int hist_csc_range; 91 unsigned int reserve_hist_cnt[4]; 92 93 // sharp config 94 unsigned int shp_en; 95 unsigned int peaking_gain; 96 unsigned int shp_shoot_ctrl_en; 97 unsigned int shp_shoot_ctrl_over; 98 unsigned int shp_shoot_ctrl_under; 99 unsigned int reserve_shp[4]; 100 } vdpp_params; 101 102 typedef struct { 103 void* p_hist_addr; 104 unsigned int hist_length; 105 unsigned short vdpp_img_w_in; 106 unsigned short vdpp_img_h_in; 107 unsigned short vdpp_img_w_out; 108 unsigned short vdpp_img_h_out; 109 unsigned short vdpp_blk_size_h; 110 unsigned short vdpp_blk_size_v; 111 } hwpq_vdpp_info_t; 112 113 typedef struct { 114 unsigned int frame_idx; 115 unsigned int yuv_diff_flag; 116 unsigned int hist_mode_en; 117 118 vdpp_img_info src_img_info; 119 vdpp_img_info dst_img_info; 120 unsigned int hist_buf_fd; 121 void* p_hist_buf; 122 123 unsigned int vdpp_config_update_flag; 124 vdpp_params vdpp_config; 125 126 hwpq_vdpp_info_t dci_vdpp_info; 127 128 } rk_vdpp_proc_params; 129 130 #ifdef __cplusplus 131 extern "C" 132 { 133 #endif 134 135 int hwpq_vdpp_init(rk_vdpp_context *p_ctx_ptr); 136 int hwpq_vdpp_check_work_mode(rk_vdpp_context ctx, rk_vdpp_proc_params *p_proc_param); 137 int hwpq_vdpp_proc(rk_vdpp_context ctx, rk_vdpp_proc_params *p_proc_param); 138 int hwpq_vdpp_deinit(rk_vdpp_context ctx); 139 140 #ifdef __cplusplus 141 } 142 #endif 143 144 #endif // __HWPQ_VDPP_PROC_API_H__