jpegdecapi.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /*------------------------------------------------------------------------------
  2. -- --
  3. -- This software is confidential and proprietary and may be used --
  4. -- only as expressly authorized by a licensing agreement from --
  5. -- --
  6. -- Hantro Products Oy. --
  7. -- --
  8. -- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  9. -- ALL RIGHTS RESERVED --
  10. -- --
  11. -- The entire notice above must be reproduced --
  12. -- on all copies and should not be removed. --
  13. -- --
  14. --------------------------------------------------------------------------------
  15. --
  16. -- Description : JPEG decoder header file
  17. --
  18. ------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: jpegdecapi.h,v $
  23. -- $Revision: 1.8 $
  24. -- $Date: 2008/11/12 12:47:03 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef __JPEGDECAPI_H__
  28. #define __JPEGDECAPI_H__
  29. #ifdef __cplusplus
  30. extern "C"
  31. {
  32. #endif
  33. /*------------------------------------------------------------------------------
  34. Table of contents
  35. 1. Include headers
  36. 2. External compiler flags
  37. 3. Module defines
  38. 4. Local function prototypes
  39. 5. Functions
  40. ------------------------------------------------------------------------------*/
  41. /*------------------------------------------------------------------------------
  42. 1. Include headers
  43. ------------------------------------------------------------------------------*/
  44. #include "basetype.h"
  45. #include "decapicommon.h"
  46. /*------------------------------------------------------------------------------
  47. 2. Module defines
  48. ------------------------------------------------------------------------------*/
  49. #define JPEGDEC_YCbCr400 0x080000U
  50. #define JPEGDEC_YCbCr420_SEMIPLANAR 0x020001U
  51. #define JPEGDEC_YCbCr422_SEMIPLANAR 0x010001U
  52. #define JPEGDEC_YCbCr440 0x010004U
  53. #define JPEGDEC_YCbCr411_SEMIPLANAR 0x100000U
  54. #define JPEGDEC_YCbCr444_SEMIPLANAR 0x200000U
  55. #define JPEGDEC_BASELINE 0x0
  56. #define JPEGDEC_PROGRESSIVE 0x1
  57. #define JPEGDEC_NONINTERLEAVED 0x2
  58. /*------------------------------------------------------------------------------
  59. 3. Data types
  60. ------------------------------------------------------------------------------*/
  61. typedef void *JpegDecInst;
  62. typedef enum
  63. {
  64. JPEGDEC_SLICE_READY = 2,
  65. JPEGDEC_FRAME_READY = 1,
  66. JPEGDEC_STRM_PROCESSED = 3,
  67. JPEGDEC_SCAN_PROCESSED = 4,
  68. JPEGDEC_OK = 0,
  69. JPEGDEC_ERROR = -1,
  70. JPEGDEC_UNSUPPORTED = -2,
  71. JPEGDEC_PARAM_ERROR = -3,
  72. JPEGDEC_MEMFAIL = -4,
  73. JPEGDEC_INITFAIL = -5,
  74. JPEGDEC_INVALID_STREAM_LENGTH = -6,
  75. JPEGDEC_STRM_ERROR = -7,
  76. JPEGDEC_INVALID_INPUT_BUFFER_SIZE = -8,
  77. JPEGDEC_HW_RESERVED = -9,
  78. JPEGDEC_INCREASE_INPUT_BUFFER = -10,
  79. JPEGDEC_SLICE_MODE_UNSUPPORTED = -11,
  80. JPEGDEC_DWL_HW_TIMEOUT = -253,
  81. JPEGDEC_DWL_ERROR = -254,
  82. JPEGDEC_HW_BUS_ERROR = -255,
  83. JPEGDEC_SYSTEM_ERROR = -256,
  84. JPEGDEC_FORMAT_NOT_SUPPORTED = -1000
  85. } JpegDecRet;
  86. enum
  87. {
  88. JPEGDEC_NO_UNITS = 0, /* No units, X and Y specify
  89. * the pixel aspect ratio */
  90. JPEGDEC_DOTS_PER_INCH = 1, /* X and Y are dots per inch */
  91. JPEGDEC_DOTS_PER_CM = 2 /* X and Y are dots per cm */
  92. };
  93. enum
  94. {
  95. JPEGDEC_THUMBNAIL_JPEG = 0x10,
  96. JPEGDEC_THUMBNAIL_NOT_SUPPORTED_FORMAT = 0x11,
  97. JPEGDEC_NO_THUMBNAIL = 0x12
  98. };
  99. enum
  100. {
  101. JPEGDEC_IMAGE = 0,
  102. JPEGDEC_THUMBNAIL = 1
  103. };
  104. typedef struct
  105. {
  106. u32 *pVirtualAddress;
  107. u32 busAddress;
  108. } JpegDecLinearMem;
  109. /* Image information */
  110. typedef struct
  111. {
  112. u32 displayWidth;
  113. u32 displayHeight;
  114. u32 outputWidth; /* Number of pixels/line in the image */
  115. u32 outputHeight; /* Number of lines in in the image */
  116. u32 version;
  117. u32 units;
  118. u32 xDensity;
  119. u32 yDensity;
  120. u32 outputFormat; /* JPEGDEC_YCbCr400
  121. * JPEGDEC_YCbCr420
  122. * JPEGDEC_YCbCr422
  123. */
  124. u32 codingMode; /* JPEGDEC_BASELINE
  125. * JPEGDEC_PROGRESSIVE
  126. * JPEGDEC_NONINTERLEAVED
  127. */
  128. u32 thumbnailType; /* Thumbnail exist or not or not supported */
  129. u32 displayWidthThumb;
  130. u32 displayHeightThumb;
  131. u32 outputWidthThumb; /* Number of pixels/line in the image */
  132. u32 outputHeightThumb; /* Number of lines in in the image */
  133. u32 outputFormatThumb; /* JPEGDEC_YCbCr400
  134. * JPEGDEC_YCbCr420
  135. * JPEGDEC_YCbCr422
  136. */
  137. u32 codingModeThumb; /* JPEGDEC_BASELINE
  138. * JPEGDEC_PROGRESSIVE
  139. * JPEGDEC_NONINTERLEAVED
  140. */
  141. } JpegDecImageInfo;
  142. /* Decoder input JFIF information */
  143. typedef struct
  144. {
  145. JpegDecLinearMem streamBuffer; /* input stream buffer */
  146. u32 streamLength; /* input stream length or buffer size */
  147. u32 bufferSize; /* input stream buffer size */
  148. u32 decImageType; /* Full image or Thumbnail to be decoded */
  149. u32 sliceMbSet; /* slice mode: mcu rows to decode */
  150. JpegDecLinearMem pictureBufferY; /* luma output address ==> if user allocated */
  151. JpegDecLinearMem pictureBufferCbCr; /* chroma output address ==> if user allocated */
  152. JpegDecLinearMem pictureBufferCr; /* chroma output address ==> if user allocated */
  153. } JpegDecInput;
  154. /* Decoder output */
  155. typedef struct
  156. {
  157. JpegDecLinearMem outputPictureY; /* Pointer to the Luma output image */
  158. JpegDecLinearMem outputPictureCbCr; /* Pointer to the Chroma output image */
  159. JpegDecLinearMem outputPictureCr; /* Pointer to the Chroma output image */
  160. } JpegDecOutput;
  161. typedef struct
  162. {
  163. u32 major; /* API major version */
  164. u32 minor; /* API minor version */
  165. } JpegDecApiVersion;
  166. typedef struct
  167. {
  168. u32 swBuild; /* Software build ID */
  169. u32 hwBuild; /* Hardware build ID */
  170. DecHwConfig hwConfig; /* hardware supported configuration */
  171. } JpegDecBuild;
  172. /*------------------------------------------------------------------------------
  173. 4. Function prototypes
  174. ------------------------------------------------------------------------------*/
  175. /* Version information */
  176. JpegDecApiVersion JpegGetAPIVersion(void);
  177. /* Build information */
  178. JpegDecBuild JpegDecGetBuild(void);
  179. /* Initialization */
  180. JpegDecRet JpegDecInit(JpegDecInst * pDecInst);
  181. /* Release */
  182. void JpegDecRelease(JpegDecInst decInst);
  183. /* Get image information of the JFIF */
  184. JpegDecRet JpegDecGetImageInfo(JpegDecInst decInst,
  185. JpegDecInput * pDecIn,
  186. JpegDecImageInfo * pImageInfo);
  187. /* Decode JFIF */
  188. JpegDecRet JpegDecDecode(JpegDecInst decInst,
  189. JpegDecInput * pDecIn, JpegDecOutput * pDecOut);
  190. /*------------------------------------------------------------------------------
  191. Prototype of the API trace funtion. Traces all API entries and returns.
  192. This must be implemented by the application using the decoder API!
  193. Argument:
  194. string - trace message, a null terminated string
  195. ------------------------------------------------------------------------------*/
  196. void JpegDecTrace(const char *string);
  197. #ifdef __cplusplus
  198. }
  199. #endif
  200. #endif