hi_avs_lut_generate.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /******************************************************************************
  2. Copyright (C), 2017-2018, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : hi_avs_lut_generate.h
  5. Version : Version 4.1 (for Hi3559A)
  6. Created : 2017/7/5
  7. Last Modified :
  8. Description : API for mesh(LUT) library in ARM.
  9. Function List :
  10. History :
  11. 1.Date : 2018/02/26
  12. Modification : First time to delivery
  13. ******************************************************************************/
  14. #ifndef __HI_AVS_LUT_GENERATE_H__
  15. #define __HI_AVS_LUT_GENERATE_H__
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #include "hi_type.h"
  20. #include "hi_comm_avs.h"
  21. #define AVS_MAX_CAMERA_NUMBER 8
  22. #define AVS_LUT_SIZE 0x400000 //4MB
  23. #define AVS_CALIBRATION_FILE_LENGTH 0x2800 //10KB
  24. /* the status of avs interface returned */
  25. typedef enum hiAVS_STATUS_E
  26. {
  27. AVS_STATUS_EOF = -1, /*internal error codes*/
  28. AVS_STATUS_OK = 0, /*success*/
  29. /* error statuses*/
  30. AVS_STATUS_FILE_READ_ERROR,
  31. AVS_STATUS_FILE_WRITE_ERROR,
  32. AVS_STATUS_FILE_INVALID,
  33. AVS_STATUS_ALLOC_FAILED,
  34. AVS_STATUS_INVALID_PARAM,
  35. AVS_STATUS_BUTT
  36. }AVS_STATUS_E;
  37. /*
  38. Specification of calibration file type
  39. AVS_TYPE_AVSP: calibration file come from AVSP calibration
  40. AVS_TYPE_PTGUI: calibration file come from PTGUI calibration
  41. AVS_TYPE_HUGIN: calibration file come from HUGIN calibration
  42. AVS_TYPE_BUTT: reserved.
  43. */
  44. typedef enum hiAVS_TYPE_E
  45. {
  46. AVS_TYPE_AVSP = 0,
  47. AVS_TYPE_PTGUI = 1,
  48. AVS_TYPE_HUGIN = 2,
  49. AVS_TYPE_BUTT
  50. }AVS_TYPE_E;
  51. /*
  52. Specification of the mask type
  53. AVS_MASK_SHAPE_RECT: build a rect shape mask;
  54. AVS_MASK_SHAPE_ELLIPSE: build a ecllipse shape mask, including circl shape;
  55. AVS_MASK_SHAPE_BUTT: reserved.
  56. */
  57. typedef enum hiAVS_MASK_SHAPE_E
  58. {
  59. AVS_MASK_SHAPE_RECT = 0,
  60. AVS_MASK_SHAPE_ELLIPSE = 1,
  61. AVS_MASK_SHAPE_BUTT
  62. }AVS_MASK_SHAPE_E;
  63. /*
  64. Specification of the mask define.
  65. enMaskShape : The mask shape type
  66. s32OffsetH : The offset of center in x direction
  67. s32OffsetV : The offset of center in y direction
  68. u32HalfMajorAxis : The half of long axis in X direction
  69. u32HalfMinorAxis : The half of short axis in Y direction
  70. */
  71. typedef struct hiAVS_MASK_DEFINE_S
  72. {
  73. AVS_MASK_SHAPE_E enMaskShape;
  74. HI_S32 s32OffsetH;
  75. HI_S32 s32OffsetV;
  76. HI_U32 u32HalfMajorAxis;
  77. HI_U32 u32HalfMinorAxis;
  78. }AVS_MASK_DEFINE_S;
  79. /*
  80. Specification of each lut mask input.
  81. bSameMask: If true, all the mask using mask[0] parameters, otherwise using eack mask parameters;
  82. bInputYuvMask: If ture, using the yuv400 mask directly; else creat a new yuv400 by using stMaskDefine parameters.
  83. stMaskDefine : Mask define for each camera
  84. u64MaskVirAddr : Virtual memory for saving each mask, the memory size for each one should be sizeof(HI_U16)*u32Width*u32Height, which u32Width and u32Height are the input resolution.
  85. */
  86. typedef struct hiAVS_LUT_MASK_S
  87. {
  88. HI_BOOL bSameMask;
  89. HI_BOOL bInputYuvMask;
  90. AVS_MASK_DEFINE_S stMaskDefine[AVS_MAX_CAMERA_NUMBER];
  91. HI_U64 u64MaskVirAddr[AVS_MAX_CAMERA_NUMBER];
  92. }AVS_LUT_MASK_S;
  93. /*
  94. Specification of fine tuning for each camera.
  95. bAdjustEn: the enable of fine tuning for each camera.
  96. s32Yaw: the Yaw-direction adjustment for each camera.
  97. s32Pitch : the Pitch-direction adjustment for each camera.
  98. s32Roll: the Roll-direction adjustment for each camera.
  99. s32OffsetX: the X-direction adjustment for each camera.
  100. s32OffsetY : the Y-direction adjustment for each camera.
  101. */
  102. typedef struct hiAVS_ADJUST_S
  103. {
  104. HI_BOOL bAdjustEn;
  105. HI_S32 s32Yaw; /* Range: [-18000, 18000]; Yaw angle. */
  106. HI_S32 s32Pitch; /* Range: [-18000, 18000]; Pitch angle. */
  107. HI_S32 s32Roll; /* Range: [-18000, 18000]; Roll angle. */
  108. HI_S32 s32OffsetX;
  109. HI_S32 s32OffsetY;
  110. } AVS_ADJUST_S;
  111. /*
  112. Specification of fine tuning.
  113. bFineTuningEn: the enable of fine tuning function.
  114. stAdjust: the adjustment for each camera.
  115. */
  116. typedef struct hiAVS_FINE_TUNING_S
  117. {
  118. HI_BOOL bFineTuningEn;
  119. AVS_ADJUST_S stAdjust[AVS_MAX_CAMERA_NUMBER];
  120. } AVS_FINE_TUNING_S;
  121. /*
  122. the input of lut generate function.
  123. enType: input calibration file type
  124. u64FileInputVirAddr: Virtual memory for saving input calibration file, the max memory size is 10KB;
  125. pstMask : The input parameters which define the mask
  126. fStitchDistance: The radius of the sphere used to create points to sample from. Stitching will be performed correctly at this distance. (Ignored if calibration from PTGui.)
  127. enLutAccuracy: The accuracy of the lookup table. Valid values are 0 or 1.
  128. stFineTuningCfg : Pitch/Yaw/Roll/Xoffset/Yoffset for each camera
  129. */
  130. typedef struct hiAVS_LUT_GENERATE_INPUT_S
  131. {
  132. AVS_TYPE_E enType;
  133. HI_U64 u64FileInputVirAddr;
  134. AVS_LUT_MASK_S *pstMask;
  135. HI_FLOAT fStitchDistance;
  136. AVS_LUT_ACCURACY_E enLutAccuracy;
  137. AVS_FINE_TUNING_S stFineTuningCfg;
  138. }AVS_LUT_GENERATE_INPUT_S;
  139. /*
  140. Generates mesh(LUT) files.
  141. stLutInput: the input of lut Generates.
  142. u64LutOutputVirAddr: Virtual memory for saving each output lookup tables, the memory size for each one should be 4MB.
  143. */
  144. AVS_STATUS_E HI_AVS_LutGenerate(AVS_LUT_GENERATE_INPUT_S stLutInput, HI_U64 u64LutOutputVirAddr[AVS_MAX_CAMERA_NUMBER]);
  145. #ifdef __cplusplus
  146. }
  147. #endif
  148. #endif // __hi_avs_lut_generate_H__