hi_comm_hdr.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /******************************************************************************
  2. Copyright (C), 2016-2018, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : hi_comm_hdr.h
  5. Version : Initial Draft
  6. Author : Hisilicon multimedia software group
  7. Created : 2016/09/27
  8. Last Modified :
  9. Description :
  10. Function List :
  11. ******************************************************************************/
  12. #ifndef __HI_COMM_HDR_H__
  13. #define __HI_COMM_HDR_H__
  14. #ifdef __cplusplus
  15. #if __cplusplus
  16. extern "C" {
  17. #endif
  18. #endif /* __cplusplus */
  19. #include "hi_type.h"
  20. #include "hi_common.h"
  21. #include "hi_comm_video.h"
  22. #define SGAMMA_NODE_NUM 200
  23. #define HDR_GAMMA_NODE_NUM 1025
  24. #define HDR_CSC_IDC_NUM 3
  25. #define HDR_CSC_ODC_NUM 3
  26. #define HDR_CSC_COEF_NUM 9
  27. #define HI_ERR_HDR_NULL_PTR HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
  28. #define HI_ERR_HDR_NOTREADY HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
  29. #define HI_ERR_HDR_INVALID_DEVID HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
  30. #define HI_ERR_HDR_INVALID_CHNID HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
  31. #define HI_ERR_HDR_INVALID_PIPEID HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_PIPEID)
  32. #define HI_ERR_HDR_EXIST HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
  33. #define HI_ERR_HDR_UNEXIST HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
  34. #define HI_ERR_HDR_NOT_SUPPORT HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
  35. #define HI_ERR_HDR_NOT_PERM HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
  36. #define HI_ERR_HDR_NOMEM HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
  37. #define HI_ERR_HDR_NOBUF HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
  38. #define HI_ERR_HDR_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
  39. #define HI_ERR_HDR_BUSY HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
  40. #define HI_ERR_HDR_BUF_EMPTY HI_DEF_ERR(HI_ID_HDR, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
  41. /********************** CLUT **************************************/
  42. typedef struct hiHDR_CLUT_PARAM_S
  43. {
  44. HI_BOOL bEnable ; /* RW; Range:[0, 1];Format:1.0; Enable/Disable CLUT Function*/
  45. HI_U32 u32GainR ; /* RW; Range:[0,4095];Format:12.0;*/
  46. HI_U32 u32GainG ; /* RW; Range:[0,4095];Format:12.0;*/
  47. HI_U32 u32GainB ; /* RW; Range:[0,4095];Format:12.0;*/
  48. }HDR_CLUT_PARAM_S;
  49. /*CLUT LUT*/
  50. typedef struct hiHDR_CLUT_LUT_S
  51. {
  52. HI_S16 as16R[CLUT_R_NUM][CLUT_B_NUM][CLUT_G_NUM]; /* RW; Range:[-255,255];Format:9.0;*/
  53. HI_S16 as16G[CLUT_R_NUM][CLUT_B_NUM][CLUT_G_NUM]; /* RW; Range:[-255,255];Format:9.0;*/
  54. HI_S16 as16B[CLUT_R_NUM][CLUT_B_NUM][CLUT_G_NUM]; /* RW; Range:[-255,255];Format:9.0;*/
  55. }HDR_CLUT_LUT_S;
  56. /*****************************************************************/
  57. typedef enum hiHDR_OETF_CURVE_TYPE_E
  58. {
  59. HDR_OETF_CURVE_DEFAULT = 0, /*Default curve for OETF*/
  60. HDR_OETF_CURVE_SRGB, /*Default sRGB curve for OETF*/
  61. HDR_OETF_CURVE_HDR10, /*Default PQ(HDR10) curve for OETF*/
  62. HDR_OETF_CURVE_HLG, /*Default HLG curve for OETF*/
  63. HDR_OETF_CURVE_SLF, /*Default SLF curve for OETF*/
  64. HDR_OETF_CURVE_USER, /*Curve defined by user */
  65. HDR_OETF_CURVE_BUTT /*End of enumerate*/
  66. }HDR_OETF_CURVE_TYPE_E;
  67. typedef struct hiHDR_OETF_PARAM_S
  68. {
  69. HI_BOOL bEnable;
  70. HI_U16 au16GammaLut[HDR_GAMMA_NODE_NUM]; /*RW; Range: [0, 4095];Format:12.0; OETF LUT nodes value*/
  71. HI_U32 u32MaxLum; /*RW; Range: [0, 10000];Format:14.0; Max Luminance level of the PQ curve*/
  72. HI_U32 u32CurLum; /*RW; Range: [0, 10000]; Format:14.0;Current Luminance level of the PQ curve*/
  73. HDR_OETF_CURVE_TYPE_E enCurveType; /*RW; Range: [0, 5]; Format:ENUM;OETF curve type*/
  74. }HDR_OETF_PARAM_S;
  75. typedef struct hiHDR_TM_CUBIC_ATTR_S
  76. {
  77. HI_U16 u16X; /*RW; Range:[0, 1000]; Format:10.0;Position on the X-axis*/
  78. HI_U16 u16Y; /*RW; Range:[0, 1000]; Format:10.0;Position on the Y-axis*/
  79. HI_U16 u16Slope; /*RW; Range:[0, 10000];Format:14.0;Gradiant of the point*/
  80. } HDR_TM_CUBIC_ATTR_S;
  81. typedef struct hiHDR_TM_PARAM_S
  82. {
  83. HI_BOOL bEnable; /* RW; Range:[0, 1];Format:1.0; Enable/Disable TM Function*/
  84. HDR_TM_CUBIC_ATTR_S astCubicPoint[5]; /* RW; Points parameters used to draw TM cubic curve*/
  85. } HDR_TM_PARAM_S;
  86. /********************** CSC ******************************/
  87. typedef struct hiHDR_CSC_MATRIX_S
  88. {
  89. HI_S32 as32CSCIdc[HDR_CSC_IDC_NUM]; /*RW; Range:[-1024, 1023]; Format: S11.0; Input dc component for csc matrix*/
  90. HI_S32 as32CSCOdc[HDR_CSC_ODC_NUM]; /*RW; Range:[-1024, 1023]; Format: S11.0; Output dc component for csc matrix*/
  91. HI_S32 as32CSCCoef[HDR_CSC_COEF_NUM]; /*RW; Range:[-32768, 32767]; Format: S5.10; 3x3 coefficients for csc matrix*/
  92. } HDR_CSC_MATRIX_S;
  93. typedef struct hiHDR_CSC_PARAM_S
  94. {
  95. COLOR_GAMUT_E enHDRCscType; /*RW; Range: [0, 4]; Format:ENUM; Color gamut type*/
  96. HI_U32 u32LumaVal; /* RW; Range:[0, 100]; Format: U32; Luminance value*/
  97. HI_U32 u32ContrVal; /* RW; Range:[0, 100]; Format: U32; Contrast value*/
  98. HI_U32 u32HueVal; /* RW; Range:[0, 100]; Format: U32; Hue value*/
  99. HI_U32 u32SatuVal; /* RW; Range:[0, 100]; Format: U32; Saturation value*/
  100. HI_BOOL bLimitedRangeEn; /*RW; Range: [0x0, 0x1]; Format: Boolean; Enable/Disable: Enable Limited range output mode(default full range output) */
  101. HI_BOOL bExtCscEn; /*RW; Range: [0x0, 0x1]; Format: Boolean; Enable/Disable: Enable extended luma range*/
  102. HI_BOOL bCtModeEn; /*RW; Range: [0x0, 0x1]; Format: Boolean; Enable/Disable: Enable ct mode*/
  103. HDR_CSC_MATRIX_S stCSCMatrix; /*RW; Range: NA; Format: struct; Color Space Conversion matrix*/
  104. }HDR_CSC_PARAM_S;
  105. /********************** CCM ******************************/
  106. typedef struct hiHDR_CCM_MANUAL_S
  107. {
  108. HI_U16 au16CCM[CCM_MATRIX_SIZE]; /*RW; Range: [0x0, 0xFFFF]; Format:8.8(15th bit is sign bit,0 represents negative,1 represents positive); Manul CCM matrix,*/
  109. } HDR_CCM_MANUAL_S;
  110. typedef struct hiHDR_CCM_TAB_S
  111. {
  112. HI_U16 u16ColorTemp; /*RW; Range:[500 ,30000]; Format:16.0; the current color temperature */
  113. HI_U16 au16CCM[CCM_MATRIX_SIZE]; /*RW; Range: [0x0, 0xFFFF]; Format:8.8(15th bit is sign bit,0 represents negative,1 represents positive); CCM matrixes for different color temperature*/
  114. } HDR_CCM_TAB_S;
  115. typedef struct hiHDR_CCM_AUTO_S
  116. {
  117. HI_U16 u16CCMTabNum; /*RW; Range: [0x3, 0x7]; Format:16.0; The number of CCM matrixes*/
  118. HDR_CCM_TAB_S astCCMTab[CCM_MATRIX_NUM]; /*RW; Range: NA; Format: struct; Color temp and matrix*/
  119. } HDR_CCM_AUTO_S;
  120. typedef struct hiHDR_CCM_PARAM_S
  121. {
  122. OPERATION_MODE_E enOperationMode; /*RW; Range:[0, 1];Format:1.0; 0:Auto CCM, 1:Manual CCM*/
  123. HDR_CCM_MANUAL_S stManual; /*RW; Range: NA; Format: struct; Manual Color matrix*/
  124. HDR_CCM_AUTO_S stAuto; /*RW; Range: NA; Format: struct; Auto Color temp and matrix*/
  125. } HDR_CCM_PARAM_S;
  126. #ifdef __cplusplus
  127. #if __cplusplus
  128. }
  129. #endif
  130. #endif /* __cplusplus */
  131. #endif /* __HI_COMM_HDR_H__ */