cclib.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. #ifndef _CCLIB_H
  2. #define _CCLIB_H
  3. #include "cpuidlib.h"
  4. #ifdef __cplusplus
  5. extern "C"
  6. {
  7. #else
  8. #if !defined(bool)
  9. typedef int bool;
  10. #endif
  11. #endif
  12. int InitCCLib( PROCTYPE CpuType );
  13. void DeInitCCLib( void );
  14. extern void (*RGB32toYV12)( unsigned char *RGBABuffer, int ImageWidth, int ImageHeight,
  15. unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
  16. extern void (*RGB24toYV12)( unsigned char *RGBBuffer, int ImageWidth, int ImageHeight,
  17. unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
  18. extern void (*UYVYtoYV12)( unsigned char *UYVYBuffer, int ImageWidth, int ImageHeight,
  19. unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
  20. extern void (*YUY2toYV12)( unsigned char *UYVYBuffer, int ImageWidth, int ImageHeight,
  21. unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
  22. extern void (*YVYUtoYV12)( unsigned char *YVYUBuffer, int ImageWidth, int ImageHeight,
  23. unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
  24. extern void RGB24toYV12F
  25. (
  26. unsigned char *RGBBuffer,
  27. int ImageWidth,
  28. int ImageHeight,
  29. unsigned char *YBuffer,
  30. unsigned char *UBuffer,
  31. unsigned char *VBuffer,
  32. int SrcPitch,
  33. int DstPitch
  34. );
  35. extern void RGB32toYV12F
  36. (
  37. unsigned char *RGBBuffer,
  38. int ImageWidth,
  39. int ImageHeight,
  40. unsigned char *YBuffer,
  41. unsigned char *UBuffer,
  42. unsigned char *VBuffer,
  43. int SrcPitch,
  44. int DstPitch
  45. );
  46. extern void UYVYtoYV12F
  47. (
  48. unsigned char *UYVYBuffer,
  49. int ImageWidth,
  50. int ImageHeight,
  51. unsigned char *YBuffer,
  52. unsigned char *UBuffer,
  53. unsigned char *VBuffer,
  54. int SrcPitch,
  55. int DstPitch
  56. );
  57. extern void YUY2toYV12F
  58. (
  59. unsigned char *YUY2Buffer,
  60. int ImageWidth,
  61. int ImageHeight,
  62. unsigned char *YBuffer,
  63. unsigned char *UBuffer,
  64. unsigned char *VBuffer,
  65. int SrcPitch,
  66. int DstPitch
  67. );
  68. extern void YVYUtoYV12F
  69. (
  70. unsigned char *YVYUBuffer,
  71. int ImageWidth,
  72. int ImageHeight,
  73. unsigned char *YBuffer,
  74. unsigned char *UBuffer,
  75. unsigned char *VBuffer,
  76. int SrcPitch,
  77. int DstPitch
  78. );
  79. /*
  80. * Macros to make it easier to call the needed functions
  81. */
  82. #define CC_RGB32toYV12( _RGBABuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
  83. (*RGB32toYV12)( _RGBABuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*4, _ImageWidth )
  84. #define CC_RGB24toYV12( _RGBBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
  85. (*RGB24toYV12)( _RGBBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*3, _ImageWidth )
  86. #define CC_UYVYtoYV12( _UYVYBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
  87. (*UYVYtoYV12)( _UYVYBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*2, _ImageWidth )
  88. #define CC_YUY2toYV12( _YUY2Buffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
  89. (*YUY2toYV12)( _YUY2Buffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*2, _ImageWidth )
  90. #define CC_YVYUtoYV12( _YVYUBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
  91. (*YVYUtoYV12)( _YVYUBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*2, _ImageWidth )
  92. // super generic rgb to yuv color conversion can handle any rgb to yuv conversion
  93. // provided r,g,b components are 1 byte apiece, and that the resulting y is 1 byte
  94. extern void ConvertRGBtoYUV(
  95. const unsigned char* const pucSourceR, const unsigned char* const pucSourceG, const unsigned char* const pucSourceB,
  96. int width, int height, int rgb_step, int rgb_pitch,
  97. unsigned char* const pucDestY, unsigned char* const pucDestU, unsigned char* const pucDestV,
  98. int uv_width_shift, int uv_height_shift,
  99. int y_step, int y_pitch,int uv_step,int uv_pitch);
  100. extern void ConvertRGBtoYUVI(
  101. const unsigned char* const pucSourceR, const unsigned char* const pucSourceG, const unsigned char* const pucSourceB,
  102. int iWidth, int iHeight, int iStepRGB, int iStrideRGB,
  103. unsigned char* const pucDestY, unsigned char* const pucDestU, unsigned char* const pucDestV,
  104. int uv_width_shift, int uv_height_shift,
  105. int iStepY, int iStrideY, int iStepUV, int iStrideUV);
  106. // This assumes 3 byte RGB data with the same component ordering in the source and destination
  107. extern void ConvertRGBtoRGB(const unsigned char* const pucSource, long lWidth, long lHeight, long lStepIn, long lStrideIn,
  108. unsigned char* const pucDest, long lStepOut, long lStrideOut);
  109. extern void ConvertYUVtoRGB(
  110. const unsigned char* const pucYPlane, const unsigned char* const pucUPlane, const unsigned char* const pucVPlane,
  111. long lWidth, long lHeight,
  112. long uv_width_shift, long uv_height_shift, // not used, should both be set to 1
  113. long lStepY, long lStrideY,long lStepUV, long lStrideUV,
  114. unsigned char* const pucRPlane, unsigned char* const pucGPlane, unsigned char* const pucBPlane,
  115. long lStepRGB, long lStrideRGB);
  116. extern void ConvertYUVItoRGB(
  117. const unsigned char* const pucYPlane, const unsigned char* const pucUPlane, const unsigned char* const pucVPlane,
  118. long lWidth, long lHeight,
  119. long uv_width_shift, long uv_height_shift, // not used, should both be set to 1
  120. long lStepY, long lStrideY,long lStepUV, long lStrideUV,
  121. unsigned char* const pucRPlane, unsigned char* const pucGPlane, unsigned char* const pucBPlane,
  122. long lStepRGB, long lStrideRGB);
  123. extern void ConvertYUVtoRGB2(
  124. const unsigned char* const pucYPlane, const unsigned char* const pucUPlane, const unsigned char* const pucVPlane,
  125. long lWidth, long lHeight,
  126. long uv_width_shift, long uv_height_shift, // not used, should both be set to 1
  127. long lStepY, long lStrideY,long lStepUV, long lStrideUV,
  128. unsigned char* const pucRPlane, unsigned char* const pucGPlane, unsigned char* const pucBPlane,
  129. long lStepRGB, long lStrideRGB,
  130. bool bSupersampleHoriz, bool bSupersampleVert);
  131. extern void ConvertYUVItoRGB2(
  132. const unsigned char* const pucYPlane, const unsigned char* const pucUPlane, const unsigned char* const pucVPlane,
  133. long lWidth, long lHeight,
  134. long uv_width_shift, long uv_height_shift, // not used, should both be set to 1
  135. long lStepY, long lStrideY,long lStepUV, long lStrideUV,
  136. unsigned char* const pucRPlane, unsigned char* const pucGPlane, unsigned char* const pucBPlane,
  137. long lStepRGB, long lStrideRGB,
  138. bool bSupersampleHoriz, bool bSupersampleVert);
  139. // This assumes packed planar data
  140. extern void ConvertYUVtoYUV(const unsigned char* const pucYIn, const unsigned char* const pucUV1In, const unsigned char* const pucUV2In,
  141. long m_lWidth, long m_lHeight,
  142. unsigned char* const pucYOut, unsigned char* const pucUV1Out, unsigned char* const pucUV2Out);
  143. // This assumes packed planar data
  144. extern void ConvertYUVtoYUVI(const unsigned char* const pucYIn, const unsigned char* const pucUV1In, const unsigned char* const pucUV2In,
  145. long m_lWidth, long m_lHeight,
  146. unsigned char* const pucYOut, unsigned char* const pucUV1Out, unsigned char* const pucUV2Out);
  147. // This assumes packed planar data
  148. extern void ConvertYUVItoYUV(const unsigned char* const pucYIn, const unsigned char* const pucUV1In, const unsigned char* const pucUV2In,
  149. long m_lWidth, long m_lHeight,
  150. unsigned char* const pucYOut, unsigned char* const pucUV1Out, unsigned char* const pucUV2Out);
  151. #ifdef __cplusplus
  152. }
  153. #endif
  154. #endif /* _CCLIB_H */