pixdesc.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. * pixel format descriptor
  3. * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at>
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include "libavutil/pixfmt.h"
  22. #include "pixdesc.h"
  23. static const AVPixFmtDescriptor pix_fmt_desc[PIX_FMT_NB] = {
  24. [PIX_FMT_YUV422P] = {
  25. .nb_channels = 3,
  26. .log2_chroma_w= 1,
  27. .log2_chroma_h= 0,
  28. .comp = {
  29. {0,0,1,0,7},
  30. {1,0,1,0,7},
  31. {2,0,1,0,7},
  32. },
  33. },
  34. [PIX_FMT_YUV420P] = {
  35. .nb_channels = 3,
  36. .log2_chroma_w= 1,
  37. .log2_chroma_h= 1,
  38. .comp = {
  39. {0,0,1,0,7},
  40. {1,0,1,0,7},
  41. {2,0,1,0,7},
  42. },
  43. },
  44. [PIX_FMT_YUV410P] = {
  45. .nb_channels = 3,
  46. .log2_chroma_w= 2,
  47. .log2_chroma_h= 2,
  48. .comp = {
  49. {0,0,1,0,7},
  50. {1,0,1,0,7},
  51. {2,0,1,0,7},
  52. },
  53. },
  54. [PIX_FMT_NV12] = {
  55. .nb_channels = 3,
  56. .log2_chroma_w= 1,
  57. .log2_chroma_h= 1,
  58. .comp = {
  59. {0,0,1,0,7},
  60. {1,1,1,0,7},
  61. {1,1,2,0,7},
  62. },
  63. },
  64. [PIX_FMT_YUYV422] = {
  65. .nb_channels = 3,
  66. .log2_chroma_w= 1,
  67. .log2_chroma_h= 0,
  68. .comp = {
  69. {0,1,1,0,7},
  70. {0,3,2,0,7},
  71. {0,3,4,0,7},
  72. },
  73. },
  74. [PIX_FMT_UYVY422] = {
  75. .nb_channels = 3,
  76. .log2_chroma_w= 1,
  77. .log2_chroma_h= 0,
  78. .comp = {
  79. {0,1,2,0,7},
  80. {0,3,1,0,7},
  81. {0,3,3,0,7},
  82. },
  83. },
  84. [PIX_FMT_GRAY16LE] = {
  85. .nb_channels = 1,
  86. .log2_chroma_w= 0,
  87. .log2_chroma_h= 0,
  88. .comp = {
  89. {0,1,1,0,15},
  90. },
  91. },
  92. [PIX_FMT_GRAY16BE] = {
  93. .nb_channels = 1,
  94. .log2_chroma_w= 0,
  95. .log2_chroma_h= 0,
  96. .comp = {
  97. {0,1,1,0,15},
  98. },
  99. .flags = PIX_FMT_BE,
  100. },
  101. [PIX_FMT_RGB24] = {
  102. .nb_channels = 3,
  103. .log2_chroma_w= 0,
  104. .log2_chroma_h= 0,
  105. .comp = {
  106. {0,2,1,0,7},
  107. {0,2,2,0,7},
  108. {0,2,3,0,7},
  109. },
  110. },
  111. [PIX_FMT_RGBA] = {
  112. .nb_channels = 4,
  113. .log2_chroma_w= 0,
  114. .log2_chroma_h= 0,
  115. .comp = {
  116. {0,3,1,0,7},
  117. {0,3,2,0,7},
  118. {0,3,3,0,7},
  119. {0,3,4,0,7},
  120. },
  121. },
  122. [PIX_FMT_RGB48LE] = {
  123. .nb_channels = 3,
  124. .log2_chroma_w= 0,
  125. .log2_chroma_h= 0,
  126. .comp = {
  127. {0,5,1,0,15},
  128. {0,5,3,0,15},
  129. {0,5,5,0,15},
  130. },
  131. },
  132. [PIX_FMT_RGB48BE] = {
  133. .nb_channels = 3,
  134. .log2_chroma_w= 0,
  135. .log2_chroma_h= 0,
  136. .comp = {
  137. {0,5,1,0,15},
  138. {0,5,3,0,15},
  139. {0,5,5,0,15},
  140. },
  141. .flags = PIX_FMT_BE,
  142. },
  143. //FIXME change pix fmt defines so that we have a LE & BE instead of a native-endian
  144. #if 0
  145. [PIX_FMT_RGB565_LE] = {
  146. .nb_channels = 3,
  147. .log2_chroma_w= 0,
  148. .log2_chroma_h= 0,
  149. .comp = {
  150. {0,1,1,0,4},
  151. {0,1,1,5,5},
  152. {0,1,2,3,4},
  153. },
  154. },
  155. [PIX_FMT_RGB565_BE] = {
  156. .nb_channels = 3,
  157. .log2_chroma_w= 0,
  158. .log2_chroma_h= 0,
  159. .comp = {
  160. {0,1,1, 0,4},
  161. {0,1,1, 5,5},
  162. {0,1,0, 3,4},
  163. },
  164. .flags = PIX_FMT_BE,
  165. },
  166. #endif
  167. [PIX_FMT_MONOBLACK] = {
  168. .nb_channels = 1,
  169. .log2_chroma_w= 0,
  170. .log2_chroma_h= 0,
  171. .comp = {
  172. {0,0,1,7,0},
  173. },
  174. .flags = PIX_FMT_BITSTREAM,
  175. },
  176. [PIX_FMT_PAL8] = {
  177. .nb_channels = 1,
  178. .log2_chroma_w= 0,
  179. .log2_chroma_h= 0,
  180. .comp = {
  181. {0,0,1,0,7},
  182. },
  183. .flags = PIX_FMT_PAL,
  184. },
  185. };