delta-mjpeg-fw.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) STMicroelectronics SA 2015
  4. * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
  5. */
  6. #ifndef DELTA_MJPEG_FW_H
  7. #define DELTA_MJPEG_FW_H
  8. /*
  9. * struct jpeg_decoded_buffer_address_t
  10. *
  11. * defines the addresses where the decoded picture/additional
  12. * info related to the block structures will be stored
  13. *
  14. * @display_luma_p: address of the luma buffer
  15. * @display_chroma_p: address of the chroma buffer
  16. */
  17. struct jpeg_decoded_buffer_address_t {
  18. u32 luma_p;
  19. u32 chroma_p;
  20. };
  21. /*
  22. * struct jpeg_display_buffer_address_t
  23. *
  24. * defines the addresses (used by the Display Reconstruction block)
  25. * where the pictures to be displayed will be stored
  26. *
  27. * @struct_size: size of the structure in bytes
  28. * @display_luma_p: address of the luma buffer
  29. * @display_chroma_p: address of the chroma buffer
  30. * @display_decimated_luma_p: address of the decimated luma buffer
  31. * @display_decimated_chroma_p: address of the decimated chroma buffer
  32. */
  33. struct jpeg_display_buffer_address_t {
  34. u32 struct_size;
  35. u32 display_luma_p;
  36. u32 display_chroma_p;
  37. u32 display_decimated_luma_p;
  38. u32 display_decimated_chroma_p;
  39. };
  40. /*
  41. * used for enabling main/aux outputs for both display &
  42. * reference reconstruction blocks
  43. */
  44. enum jpeg_rcn_ref_disp_enable_t {
  45. /* enable decimated (for display) reconstruction */
  46. JPEG_DISP_AUX_EN = 0x00000010,
  47. /* enable main (for display) reconstruction */
  48. JPEG_DISP_MAIN_EN = 0x00000020,
  49. /* enable both main & decimated (for display) reconstruction */
  50. JPEG_DISP_AUX_MAIN_EN = 0x00000030,
  51. /* enable only reference output(ex. for trick modes) */
  52. JPEG_REF_MAIN_EN = 0x00000100,
  53. /*
  54. * enable reference output with decimated
  55. * (for display) reconstruction
  56. */
  57. JPEG_REF_MAIN_DISP_AUX_EN = 0x00000110,
  58. /*
  59. * enable reference output with main
  60. * (for display) reconstruction
  61. */
  62. JPEG_REF_MAIN_DISP_MAIN_EN = 0x00000120,
  63. /*
  64. * enable reference output with main & decimated
  65. * (for display) reconstruction
  66. */
  67. JPEG_REF_MAIN_DISP_MAIN_AUX_EN = 0x00000130
  68. };
  69. /* identifies the horizontal decimation factor */
  70. enum jpeg_horizontal_deci_factor_t {
  71. /* no resize */
  72. JPEG_HDEC_1 = 0x00000000,
  73. /* Advanced H/2 resize using improved 8-tap filters */
  74. JPEG_HDEC_ADVANCED_2 = 0x00000101,
  75. /* Advanced H/4 resize using improved 8-tap filters */
  76. JPEG_HDEC_ADVANCED_4 = 0x00000102
  77. };
  78. /* identifies the vertical decimation factor */
  79. enum jpeg_vertical_deci_factor_t {
  80. /* no resize */
  81. JPEG_VDEC_1 = 0x00000000,
  82. /* V/2 , progressive resize */
  83. JPEG_VDEC_ADVANCED_2_PROG = 0x00000204,
  84. /* V/2 , interlaced resize */
  85. JPEG_VDEC_ADVANCED_2_INT = 0x000000208
  86. };
  87. /* status of the decoding process */
  88. enum jpeg_decoding_error_t {
  89. JPEG_DECODER_NO_ERROR = 0,
  90. JPEG_DECODER_UNDEFINED_HUFF_TABLE = 1,
  91. JPEG_DECODER_UNSUPPORTED_MARKER = 2,
  92. JPEG_DECODER_UNABLE_ALLOCATE_MEMORY = 3,
  93. JPEG_DECODER_NON_SUPPORTED_SAMP_FACTORS = 4,
  94. JPEG_DECODER_BAD_PARAMETER = 5,
  95. JPEG_DECODER_DECODE_ERROR = 6,
  96. JPEG_DECODER_BAD_RESTART_MARKER = 7,
  97. JPEG_DECODER_UNSUPPORTED_COLORSPACE = 8,
  98. JPEG_DECODER_BAD_SOS_SPECTRAL = 9,
  99. JPEG_DECODER_BAD_SOS_SUCCESSIVE = 10,
  100. JPEG_DECODER_BAD_HEADER_LENGTH = 11,
  101. JPEG_DECODER_BAD_COUNT_VALUE = 12,
  102. JPEG_DECODER_BAD_DHT_MARKER = 13,
  103. JPEG_DECODER_BAD_INDEX_VALUE = 14,
  104. JPEG_DECODER_BAD_NUMBER_HUFFMAN_TABLES = 15,
  105. JPEG_DECODER_BAD_QUANT_TABLE_LENGTH = 16,
  106. JPEG_DECODER_BAD_NUMBER_QUANT_TABLES = 17,
  107. JPEG_DECODER_BAD_COMPONENT_COUNT = 18,
  108. JPEG_DECODER_DIVIDE_BY_ZERO_ERROR = 19,
  109. JPEG_DECODER_NOT_JPG_IMAGE = 20,
  110. JPEG_DECODER_UNSUPPORTED_ROTATION_ANGLE = 21,
  111. JPEG_DECODER_UNSUPPORTED_SCALING = 22,
  112. JPEG_DECODER_INSUFFICIENT_OUTPUTBUFFER_SIZE = 23,
  113. JPEG_DECODER_BAD_HWCFG_GP_VERSION_VALUE = 24,
  114. JPEG_DECODER_BAD_VALUE_FROM_RED = 25,
  115. JPEG_DECODER_BAD_SUBREGION_PARAMETERS = 26,
  116. JPEG_DECODER_PROGRESSIVE_DECODE_NOT_SUPPORTED = 27,
  117. JPEG_DECODER_ERROR_TASK_TIMEOUT = 28,
  118. JPEG_DECODER_ERROR_FEATURE_NOT_SUPPORTED = 29
  119. };
  120. /* identifies the decoding mode */
  121. enum jpeg_decoding_mode_t {
  122. JPEG_NORMAL_DECODE = 0,
  123. };
  124. enum jpeg_additional_flags_t {
  125. JPEG_ADDITIONAL_FLAG_NONE = 0,
  126. /* request firmware to return values of the CEH registers */
  127. JPEG_ADDITIONAL_FLAG_CEH = 1,
  128. /* output storage of auxiliary reconstruction in Raster format. */
  129. JPEG_ADDITIONAL_FLAG_RASTER = 64,
  130. /* output storage of auxiliary reconstruction in 420MB format. */
  131. JPEG_ADDITIONAL_FLAG_420MB = 128
  132. };
  133. /*
  134. * struct jpeg_video_decode_init_params_t - initialization command parameters
  135. *
  136. * @circular_buffer_begin_addr_p: start address of fw circular buffer
  137. * @circular_buffer_end_addr_p: end address of fw circular buffer
  138. */
  139. struct jpeg_video_decode_init_params_t {
  140. u32 circular_buffer_begin_addr_p;
  141. u32 circular_buffer_end_addr_p;
  142. u32 reserved;
  143. };
  144. /*
  145. * struct jpeg_decode_params_t - decode command parameters
  146. *
  147. * @picture_start_addr_p: start address of jpeg picture
  148. * @picture_end_addr_p: end address of jpeg picture
  149. * @decoded_buffer_addr: decoded picture buffer
  150. * @display_buffer_addr: display picture buffer
  151. * @main_aux_enable: enable main and/or aux outputs
  152. * @horizontal_decimation_factor:horizontal decimation factor
  153. * @vertical_decimation_factor: vertical decimation factor
  154. * @xvalue0: the x(0) coordinate for subregion decoding
  155. * @xvalue1: the x(1) coordinate for subregion decoding
  156. * @yvalue0: the y(0) coordinate for subregion decoding
  157. * @yvalue1: the y(1) coordinate for subregion decoding
  158. * @decoding_mode: decoding mode
  159. * @additional_flags: additional flags
  160. * @field_flag: determines frame/field scan
  161. * @is_jpeg_image: 1 = still jpeg, 0 = motion jpeg
  162. */
  163. struct jpeg_decode_params_t {
  164. u32 picture_start_addr_p;
  165. u32 picture_end_addr_p;
  166. struct jpeg_decoded_buffer_address_t decoded_buffer_addr;
  167. struct jpeg_display_buffer_address_t display_buffer_addr;
  168. enum jpeg_rcn_ref_disp_enable_t main_aux_enable;
  169. enum jpeg_horizontal_deci_factor_t horizontal_decimation_factor;
  170. enum jpeg_vertical_deci_factor_t vertical_decimation_factor;
  171. u32 xvalue0;
  172. u32 xvalue1;
  173. u32 yvalue0;
  174. u32 yvalue1;
  175. enum jpeg_decoding_mode_t decoding_mode;
  176. u32 additional_flags;
  177. u32 field_flag;
  178. u32 reserved;
  179. u32 is_jpeg_image;
  180. };
  181. /*
  182. * struct jpeg_decode_return_params_t
  183. *
  184. * status returned by firmware after decoding
  185. *
  186. * @decode_time_in_us: decoding time in microseconds
  187. * @pm_cycles: profiling information
  188. * @pm_dmiss: profiling information
  189. * @pm_imiss: profiling information
  190. * @pm_bundles: profiling information
  191. * @pm_pft: profiling information
  192. * @error_code: status of the decoding process
  193. * @ceh_registers: array where values of the Contrast Enhancement
  194. * Histogram (CEH) registers will be stored.
  195. * ceh_registers[0] correspond to register MBE_CEH_0_7,
  196. * ceh_registers[1] correspond to register MBE_CEH_8_15
  197. * ceh_registers[2] correspond to register MBE_CEH_16_23
  198. * Note that elements of this array will be updated only
  199. * if additional_flags has JPEG_ADDITIONAL_FLAG_CEH set.
  200. */
  201. struct jpeg_decode_return_params_t {
  202. /* profiling info */
  203. u32 decode_time_in_us;
  204. u32 pm_cycles;
  205. u32 pm_dmiss;
  206. u32 pm_imiss;
  207. u32 pm_bundles;
  208. u32 pm_pft;
  209. enum jpeg_decoding_error_t error_code;
  210. u32 ceh_registers[32];
  211. };
  212. #endif /* DELTA_MJPEG_FW_H */