csi_g2d_types.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef __CSI_G2D_TYPES_H__
  2. #define __CSI_G2D_TYPES_H__
  3. #include <stdbool.h>
  4. #include <stddef.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. #define swap(a, b) \
  9. do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
  10. #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
  11. #define __cmp_once(x, y, op) ({ \
  12. typeof(x) __x = (x); \
  13. typeof(y) __y = (y); \
  14. __cmp(__x, __y, op); })
  15. #define min(x, y) __cmp_once(x, y, <)
  16. #define max(x, y) __cmp_once(x, y, >)
  17. #define csi_g2d_fourcc(a, b, c, d) \
  18. ((unsigned int )(a) | ((unsigned int)(b) << 8) | \
  19. ((unsigned int )(c) << 16) | ((unsigned int)(d) << 24))
  20. /* 32 bpp RGB */
  21. #define CSI_G2D_FMT_XRGB8888 csi_g2d_fourcc('X', 'R', '2', '4')
  22. #define CSI_G2D_FMT_ARGB8888 csi_g2d_fourcc('A', 'R', '2', '4')
  23. #define CSI_G2D_FMT_RGBX8888 csi_g2d_fourcc('R', 'A', '2', '4')
  24. #define CSI_G2D_FMT_RGBA8888 csi_g2d_fourcc('R', 'X', '2', '4')
  25. #define CSI_G2D_FMT_XBGR8888 csi_g2d_fourcc('X', 'B', '2', '4')
  26. #define CSI_G2D_FMT_ABGR8888 csi_g2d_fourcc('A', 'B', '2', '4')
  27. #define CSI_G2D_FMT_BGRX8888 csi_g2d_fourcc('B', 'X', '2', '4')
  28. #define CSI_G2D_FMT_BGRA8888 csi_g2d_fourcc('B', 'G', '2', '4')
  29. /* 24 bpp RGB */
  30. #define CSI_G2D_FMT_RGB888 csi_g2d_fourcc('R', 'G', '2', '4')
  31. #define CSI_G2D_FMT_BGR888 csi_g2d_fourcc('B', 'G', '2', '4')
  32. #define CSI_G2D_FMT_BGR888_PLANAR csi_g2d_fourcc('B', 'R', '8', 'P')
  33. #define CSI_G2D_FMT_RGB888_PLANAR csi_g2d_fourcc('R', 'B', '8', 'P')
  34. /* 16 bpp RGB */
  35. #define CSI_G2D_FMT_RGB565 csi_g2d_fourcc('R', 'G', '1', '6')
  36. #define CSI_G2D_FMT_BGR565 csi_g2d_fourcc('B', 'G', '1', '6')
  37. #define CSI_G2D_FMT_XRGB1555 csi_g2d_fourcc('X', 'R', '1', '5')
  38. #define CSI_G2D_FMT_ARGB1555 csi_g2d_fourcc('A', 'R', '1', '5')
  39. #define CSI_G2D_FMT_RGBX5551 csi_g2d_fourcc('R', 'X', '1', '5')
  40. #define CSI_G2D_FMT_RGBA5551 csi_g2d_fourcc('R', 'A', '1', '5')
  41. #define CSI_G2D_FMT_XBGR1555 csi_g2d_fourcc('X', 'B', '1', '5')
  42. #define CSI_G2D_FMT_ABGR1555 csi_g2d_fourcc('A', 'B', '1', '5')
  43. #define CSI_G2D_FMT_BGRX5551 csi_g2d_fourcc('B', 'X', '1', '5')
  44. #define CSI_G2D_FMT_BGRA5551 csi_g2d_fourcc('B', 'A', '1', '5')
  45. #define CSI_G2D_FMT_XRGB4444 csi_g2d_fourcc('X', 'R', '1', '2')
  46. #define CSI_G2D_FMT_ARGB4444 csi_g2d_fourcc('A', 'R', '1', '2')
  47. #define CSI_G2D_FMT_RGBX4444 csi_g2d_fourcc('R', 'X', '1', '2')
  48. #define CSI_G2D_FMT_RGBA4444 csi_g2d_fourcc('R', 'A', '1', '2')
  49. #define CSI_G2D_FMT_XBGR4444 csi_g2d_fourcc('X', 'B', '1', '2')
  50. #define CSI_G2D_FMT_ABGR4444 csi_g2d_fourcc('A', 'B', '1', '2')
  51. #define CSI_G2D_FMT_BGRX4444 csi_g2d_fourcc('B', 'X', '1', '2')
  52. #define CSI_G2D_FMT_BGRA4444 csi_g2d_fourcc('B', 'A', '1', '2')
  53. /* 10Bit RGB */
  54. #define CSI_G2D_FMT_XRGB2101010 csi_g2d_fourcc('X', 'R', '3', '0')
  55. #define CSI_G2D_FMT_ARGB2101010 csi_g2d_fourcc('A', 'R', '3', '0')
  56. #define CSI_G2D_FMT_RGBX1010102 csi_g2d_fourcc('R', 'X', '3', '0')
  57. #define CSI_G2D_FMT_RGBA1010102 csi_g2d_fourcc('R', 'A', '3', '0')
  58. #define CSI_G2D_FMT_XBGR2101010 csi_g2d_fourcc('X', 'B', '3', '0')
  59. #define CSI_G2D_FMT_ABGR2101010 csi_g2d_fourcc('A', 'B', '3', '0')
  60. #define CSI_G2D_FMT_BGRX1010102 csi_g2d_fourcc('B', 'X', '3', '0')
  61. #define CSI_G2D_FMT_BGRA1010102 csi_g2d_fourcc('B', 'A', '3', '0')
  62. /* 8 bpp RGB */
  63. #define CSI_G2D_FMT_A8 csi_g2d_fourcc('A', '8', ' ', ' ')
  64. #define CSI_G2D_FMT_INDEX8 csi_g2d_fourcc('I', '8', ' ', ' ')
  65. /* packed YUV formats */
  66. #define CSI_G2D_FMT_YUY2 csi_g2d_fourcc('Y', 'U', 'Y', 'V')
  67. #define CSI_G2D_FMT_YVYU csi_g2d_fourcc('Y', 'V', 'Y', 'U')
  68. #define CSI_G2D_FMT_UYVY csi_g2d_fourcc('U', 'Y', 'V', 'Y')
  69. #define CSI_G2D_FMT_VYUY csi_g2d_fourcc('V', 'Y', 'U', 'Y')
  70. /* planar YUV formats */
  71. #define CSI_G2D_FMT_I420 csi_g2d_fourcc('Y', 'U', '1', '2')
  72. #define CSI_G2D_FMT_YV12 csi_g2d_fourcc('Y', 'V', '1', '2')
  73. #define CSI_G2D_FMT_YUV422 csi_g2d_fourcc('Y', 'U', '1', '6')
  74. #define CSI_G2D_FMT_YVU422 csi_g2d_fourcc('Y', 'V', '1', '6')
  75. #define CSI_G2D_FMT_YUV444 csi_g2d_fourcc('Y', 'U', '2', '4')
  76. #define CSI_G2D_FMT_YVU444 csi_g2d_fourcc('Y', 'V', '2', '4')
  77. /* semi-planar YUV formats */
  78. #define CSI_G2D_FMT_NV16 csi_g2d_fourcc('N', 'V', '1', '6')
  79. #define CSI_G2D_FMT_NV61 csi_g2d_fourcc('N', 'V', '6', '1')
  80. #define CSI_G2D_FMT_NV12 csi_g2d_fourcc('N', 'V', '1', '2')
  81. #define CSI_G2D_FMT_NV21 csi_g2d_fourcc('N', 'V', '2', '1')
  82. #define CSI_G2D_FMT_P010 csi_g2d_fourcc('P', '0', '1', '0')
  83. /* TODO: verify below formats supported or not:
  84. gcvSURF_P010_LSB gcvSURF_I010 gcvSURF_I010_LSB
  85. */
  86. #define CSI_G2D_FMT_NV16_10BIT csi_g2d_fourcc('N', '1', '6', 'X')
  87. #define CSI_G2D_FMT_NV61_10BIT csi_g2d_fourcc('N', '6', '1', 'X')
  88. #define CSI_G2D_FMT_NV12_10BIT csi_g2d_fourcc('N', '1', '2', 'X')
  89. #define CSI_G2D_FMT_NV21_10BIT csi_g2d_fourcc('N', '2', '1', 'X')
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. #endif