2
0

pixdesc.c 92 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885
  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 <stdio.h>
  22. #include <string.h>
  23. #include "avassert.h"
  24. #include "avstring.h"
  25. #include "common.h"
  26. #include "pixfmt.h"
  27. #include "pixdesc.h"
  28. #include "internal.h"
  29. #include "intreadwrite.h"
  30. #include "version.h"
  31. void av_read_image_line2(void *dst,
  32. const uint8_t *data[4], const int linesize[4],
  33. const AVPixFmtDescriptor *desc,
  34. int x, int y, int c, int w,
  35. int read_pal_component,
  36. int dst_element_size)
  37. {
  38. AVComponentDescriptor comp = desc->comp[c];
  39. int plane = comp.plane;
  40. int depth = comp.depth;
  41. unsigned mask = (1ULL << depth) - 1;
  42. int shift = comp.shift;
  43. int step = comp.step;
  44. int flags = desc->flags;
  45. uint16_t *dst16 = dst;
  46. uint32_t *dst32 = dst;
  47. if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
  48. int skip = x * step + comp.offset;
  49. const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
  50. int shift = 8 - depth - (skip & 7);
  51. while (w--) {
  52. int val = (*p >> shift) & mask;
  53. if (read_pal_component)
  54. val = data[1][4*val + c];
  55. shift -= step;
  56. p -= shift >> 3;
  57. shift &= 7;
  58. if (dst_element_size == 4) *dst32++ = val;
  59. else *dst16++ = val;
  60. }
  61. } else {
  62. const uint8_t *p = data[plane] + y * linesize[plane] +
  63. x * step + comp.offset;
  64. int is_8bit = shift + depth <= 8;
  65. int is_16bit= shift + depth <=16;
  66. if (is_8bit)
  67. p += !!(flags & AV_PIX_FMT_FLAG_BE);
  68. while (w--) {
  69. unsigned val;
  70. if (is_8bit) val = *p;
  71. else if(is_16bit) val = flags & AV_PIX_FMT_FLAG_BE ? AV_RB16(p) : AV_RL16(p);
  72. else val = flags & AV_PIX_FMT_FLAG_BE ? AV_RB32(p) : AV_RL32(p);
  73. val = (val >> shift) & mask;
  74. if (read_pal_component)
  75. val = data[1][4 * val + c];
  76. p += step;
  77. if (dst_element_size == 4) *dst32++ = val;
  78. else *dst16++ = val;
  79. }
  80. }
  81. }
  82. void av_read_image_line(uint16_t *dst,
  83. const uint8_t *data[4], const int linesize[4],
  84. const AVPixFmtDescriptor *desc,
  85. int x, int y, int c, int w,
  86. int read_pal_component)
  87. {
  88. av_read_image_line2(dst, data, linesize, desc,x, y, c, w,
  89. read_pal_component,
  90. 2);
  91. }
  92. void av_write_image_line2(const void *src,
  93. uint8_t *data[4], const int linesize[4],
  94. const AVPixFmtDescriptor *desc,
  95. int x, int y, int c, int w, int src_element_size)
  96. {
  97. AVComponentDescriptor comp = desc->comp[c];
  98. int plane = comp.plane;
  99. int depth = comp.depth;
  100. int step = comp.step;
  101. int flags = desc->flags;
  102. const uint32_t *src32 = src;
  103. const uint16_t *src16 = src;
  104. if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
  105. int skip = x * step + comp.offset;
  106. uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
  107. int shift = 8 - depth - (skip & 7);
  108. while (w--) {
  109. *p |= (src_element_size == 4 ? *src32++ : *src16++) << shift;
  110. shift -= step;
  111. p -= shift >> 3;
  112. shift &= 7;
  113. }
  114. } else {
  115. int shift = comp.shift;
  116. uint8_t *p = data[plane] + y * linesize[plane] +
  117. x * step + comp.offset;
  118. if (shift + depth <= 8) {
  119. p += !!(flags & AV_PIX_FMT_FLAG_BE);
  120. while (w--) {
  121. *p |= ((src_element_size == 4 ? *src32++ : *src16++) << shift);
  122. p += step;
  123. }
  124. } else {
  125. while (w--) {
  126. unsigned s = (src_element_size == 4 ? *src32++ : *src16++);
  127. if (shift + depth <= 16) {
  128. if (flags & AV_PIX_FMT_FLAG_BE) {
  129. uint16_t val = AV_RB16(p) | (s << shift);
  130. AV_WB16(p, val);
  131. } else {
  132. uint16_t val = AV_RL16(p) | (s << shift);
  133. AV_WL16(p, val);
  134. }
  135. } else {
  136. if (flags & AV_PIX_FMT_FLAG_BE) {
  137. uint32_t val = AV_RB32(p) | (s << shift);
  138. AV_WB32(p, val);
  139. } else {
  140. uint32_t val = AV_RL32(p) | (s << shift);
  141. AV_WL32(p, val);
  142. }
  143. }
  144. p += step;
  145. }
  146. }
  147. }
  148. }
  149. void av_write_image_line(const uint16_t *src,
  150. uint8_t *data[4], const int linesize[4],
  151. const AVPixFmtDescriptor *desc,
  152. int x, int y, int c, int w)
  153. {
  154. av_write_image_line2(src, data, linesize, desc, x, y, c, w, 2);
  155. }
  156. #if FF_API_PLUS1_MINUS1
  157. FF_DISABLE_DEPRECATION_WARNINGS
  158. #endif
  159. static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
  160. [AV_PIX_FMT_YUV420P] = {
  161. .name = "yuv420p",
  162. .nb_components = 3,
  163. .log2_chroma_w = 1,
  164. .log2_chroma_h = 1,
  165. .comp = {
  166. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  167. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  168. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  169. },
  170. .flags = AV_PIX_FMT_FLAG_PLANAR,
  171. },
  172. [AV_PIX_FMT_YUYV422] = {
  173. .name = "yuyv422",
  174. .nb_components = 3,
  175. .log2_chroma_w = 1,
  176. .log2_chroma_h = 0,
  177. .comp = {
  178. { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
  179. { 0, 4, 1, 0, 8, 3, 7, 2 }, /* U */
  180. { 0, 4, 3, 0, 8, 3, 7, 4 }, /* V */
  181. },
  182. },
  183. [AV_PIX_FMT_YVYU422] = {
  184. .name = "yvyu422",
  185. .nb_components = 3,
  186. .log2_chroma_w = 1,
  187. .log2_chroma_h = 0,
  188. .comp = {
  189. { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
  190. { 0, 4, 3, 0, 8, 3, 7, 4 }, /* U */
  191. { 0, 4, 1, 0, 8, 3, 7, 2 }, /* V */
  192. },
  193. },
  194. [AV_PIX_FMT_RGB24] = {
  195. .name = "rgb24",
  196. .nb_components = 3,
  197. .log2_chroma_w = 0,
  198. .log2_chroma_h = 0,
  199. .comp = {
  200. { 0, 3, 0, 0, 8, 2, 7, 1 }, /* R */
  201. { 0, 3, 1, 0, 8, 2, 7, 2 }, /* G */
  202. { 0, 3, 2, 0, 8, 2, 7, 3 }, /* B */
  203. },
  204. .flags = AV_PIX_FMT_FLAG_RGB,
  205. },
  206. [AV_PIX_FMT_BGR24] = {
  207. .name = "bgr24",
  208. .nb_components = 3,
  209. .log2_chroma_w = 0,
  210. .log2_chroma_h = 0,
  211. .comp = {
  212. { 0, 3, 2, 0, 8, 2, 7, 3 }, /* R */
  213. { 0, 3, 1, 0, 8, 2, 7, 2 }, /* G */
  214. { 0, 3, 0, 0, 8, 2, 7, 1 }, /* B */
  215. },
  216. .flags = AV_PIX_FMT_FLAG_RGB,
  217. },
  218. [AV_PIX_FMT_YUV422P] = {
  219. .name = "yuv422p",
  220. .nb_components = 3,
  221. .log2_chroma_w = 1,
  222. .log2_chroma_h = 0,
  223. .comp = {
  224. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  225. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  226. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  227. },
  228. .flags = AV_PIX_FMT_FLAG_PLANAR,
  229. },
  230. [AV_PIX_FMT_YUV444P] = {
  231. .name = "yuv444p",
  232. .nb_components = 3,
  233. .log2_chroma_w = 0,
  234. .log2_chroma_h = 0,
  235. .comp = {
  236. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  237. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  238. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  239. },
  240. .flags = AV_PIX_FMT_FLAG_PLANAR,
  241. },
  242. [AV_PIX_FMT_YUV410P] = {
  243. .name = "yuv410p",
  244. .nb_components = 3,
  245. .log2_chroma_w = 2,
  246. .log2_chroma_h = 2,
  247. .comp = {
  248. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  249. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  250. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  251. },
  252. .flags = AV_PIX_FMT_FLAG_PLANAR,
  253. },
  254. [AV_PIX_FMT_YUV411P] = {
  255. .name = "yuv411p",
  256. .nb_components = 3,
  257. .log2_chroma_w = 2,
  258. .log2_chroma_h = 0,
  259. .comp = {
  260. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  261. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  262. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  263. },
  264. .flags = AV_PIX_FMT_FLAG_PLANAR,
  265. },
  266. [AV_PIX_FMT_YUVJ411P] = {
  267. .name = "yuvj411p",
  268. .nb_components = 3,
  269. .log2_chroma_w = 2,
  270. .log2_chroma_h = 0,
  271. .comp = {
  272. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  273. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  274. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  275. },
  276. .flags = AV_PIX_FMT_FLAG_PLANAR,
  277. },
  278. [AV_PIX_FMT_GRAY8] = {
  279. .name = "gray",
  280. .nb_components = 1,
  281. .log2_chroma_w = 0,
  282. .log2_chroma_h = 0,
  283. .comp = {
  284. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  285. },
  286. .flags = FF_PSEUDOPAL,
  287. .alias = "gray8,y8",
  288. },
  289. [AV_PIX_FMT_MONOWHITE] = {
  290. .name = "monow",
  291. .nb_components = 1,
  292. .log2_chroma_w = 0,
  293. .log2_chroma_h = 0,
  294. .comp = {
  295. { 0, 1, 0, 0, 1, 0, 0, 1 }, /* Y */
  296. },
  297. .flags = AV_PIX_FMT_FLAG_BITSTREAM,
  298. },
  299. [AV_PIX_FMT_MONOBLACK] = {
  300. .name = "monob",
  301. .nb_components = 1,
  302. .log2_chroma_w = 0,
  303. .log2_chroma_h = 0,
  304. .comp = {
  305. { 0, 1, 0, 7, 1, 0, 0, 1 }, /* Y */
  306. },
  307. .flags = AV_PIX_FMT_FLAG_BITSTREAM,
  308. },
  309. [AV_PIX_FMT_PAL8] = {
  310. .name = "pal8",
  311. .nb_components = 1,
  312. .log2_chroma_w = 0,
  313. .log2_chroma_h = 0,
  314. .comp = {
  315. { 0, 1, 0, 0, 8, 0, 7, 1 },
  316. },
  317. .flags = AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_ALPHA,
  318. },
  319. [AV_PIX_FMT_YUVJ420P] = {
  320. .name = "yuvj420p",
  321. .nb_components = 3,
  322. .log2_chroma_w = 1,
  323. .log2_chroma_h = 1,
  324. .comp = {
  325. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  326. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  327. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  328. },
  329. .flags = AV_PIX_FMT_FLAG_PLANAR,
  330. },
  331. [AV_PIX_FMT_YUVJ422P] = {
  332. .name = "yuvj422p",
  333. .nb_components = 3,
  334. .log2_chroma_w = 1,
  335. .log2_chroma_h = 0,
  336. .comp = {
  337. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  338. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  339. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  340. },
  341. .flags = AV_PIX_FMT_FLAG_PLANAR,
  342. },
  343. [AV_PIX_FMT_YUVJ444P] = {
  344. .name = "yuvj444p",
  345. .nb_components = 3,
  346. .log2_chroma_w = 0,
  347. .log2_chroma_h = 0,
  348. .comp = {
  349. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  350. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  351. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  352. },
  353. .flags = AV_PIX_FMT_FLAG_PLANAR,
  354. },
  355. [AV_PIX_FMT_XVMC] = {
  356. .name = "xvmc",
  357. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  358. },
  359. [AV_PIX_FMT_UYVY422] = {
  360. .name = "uyvy422",
  361. .nb_components = 3,
  362. .log2_chroma_w = 1,
  363. .log2_chroma_h = 0,
  364. .comp = {
  365. { 0, 2, 1, 0, 8, 1, 7, 2 }, /* Y */
  366. { 0, 4, 0, 0, 8, 3, 7, 1 }, /* U */
  367. { 0, 4, 2, 0, 8, 3, 7, 3 }, /* V */
  368. },
  369. },
  370. [AV_PIX_FMT_UYYVYY411] = {
  371. .name = "uyyvyy411",
  372. .nb_components = 3,
  373. .log2_chroma_w = 2,
  374. .log2_chroma_h = 0,
  375. .comp = {
  376. { 0, 4, 1, 0, 8, 3, 7, 2 }, /* Y */
  377. { 0, 6, 0, 0, 8, 5, 7, 1 }, /* U */
  378. { 0, 6, 3, 0, 8, 5, 7, 4 }, /* V */
  379. },
  380. },
  381. [AV_PIX_FMT_BGR8] = {
  382. .name = "bgr8",
  383. .nb_components = 3,
  384. .log2_chroma_w = 0,
  385. .log2_chroma_h = 0,
  386. .comp = {
  387. { 0, 1, 0, 0, 3, 0, 2, 1 }, /* R */
  388. { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
  389. { 0, 1, 0, 6, 2, 0, 1, 1 }, /* B */
  390. },
  391. .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
  392. },
  393. [AV_PIX_FMT_BGR4] = {
  394. .name = "bgr4",
  395. .nb_components = 3,
  396. .log2_chroma_w = 0,
  397. .log2_chroma_h = 0,
  398. .comp = {
  399. { 0, 4, 3, 0, 1, 3, 0, 4 }, /* R */
  400. { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
  401. { 0, 4, 0, 0, 1, 3, 0, 1 }, /* B */
  402. },
  403. .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
  404. },
  405. [AV_PIX_FMT_BGR4_BYTE] = {
  406. .name = "bgr4_byte",
  407. .nb_components = 3,
  408. .log2_chroma_w = 0,
  409. .log2_chroma_h = 0,
  410. .comp = {
  411. { 0, 1, 0, 0, 1, 0, 0, 1 }, /* R */
  412. { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
  413. { 0, 1, 0, 3, 1, 0, 0, 1 }, /* B */
  414. },
  415. .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
  416. },
  417. [AV_PIX_FMT_RGB8] = {
  418. .name = "rgb8",
  419. .nb_components = 3,
  420. .log2_chroma_w = 0,
  421. .log2_chroma_h = 0,
  422. .comp = {
  423. { 0, 1, 0, 6, 2, 0, 1, 1 }, /* R */
  424. { 0, 1, 0, 3, 3, 0, 2, 1 }, /* G */
  425. { 0, 1, 0, 0, 3, 0, 2, 1 }, /* B */
  426. },
  427. .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
  428. },
  429. [AV_PIX_FMT_RGB4] = {
  430. .name = "rgb4",
  431. .nb_components = 3,
  432. .log2_chroma_w = 0,
  433. .log2_chroma_h = 0,
  434. .comp = {
  435. { 0, 4, 0, 0, 1, 3, 0, 1 }, /* R */
  436. { 0, 4, 1, 0, 2, 3, 1, 2 }, /* G */
  437. { 0, 4, 3, 0, 1, 3, 0, 4 }, /* B */
  438. },
  439. .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
  440. },
  441. [AV_PIX_FMT_RGB4_BYTE] = {
  442. .name = "rgb4_byte",
  443. .nb_components = 3,
  444. .log2_chroma_w = 0,
  445. .log2_chroma_h = 0,
  446. .comp = {
  447. { 0, 1, 0, 3, 1, 0, 0, 1 }, /* R */
  448. { 0, 1, 0, 1, 2, 0, 1, 1 }, /* G */
  449. { 0, 1, 0, 0, 1, 0, 0, 1 }, /* B */
  450. },
  451. .flags = AV_PIX_FMT_FLAG_RGB | FF_PSEUDOPAL,
  452. },
  453. [AV_PIX_FMT_NV12] = {
  454. .name = "nv12",
  455. .nb_components = 3,
  456. .log2_chroma_w = 1,
  457. .log2_chroma_h = 1,
  458. .comp = {
  459. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  460. { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
  461. { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
  462. },
  463. .flags = AV_PIX_FMT_FLAG_PLANAR,
  464. },
  465. [AV_PIX_FMT_NV21] = {
  466. .name = "nv21",
  467. .nb_components = 3,
  468. .log2_chroma_w = 1,
  469. .log2_chroma_h = 1,
  470. .comp = {
  471. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  472. { 1, 2, 1, 0, 8, 1, 7, 2 }, /* U */
  473. { 1, 2, 0, 0, 8, 1, 7, 1 }, /* V */
  474. },
  475. .flags = AV_PIX_FMT_FLAG_PLANAR,
  476. },
  477. [AV_PIX_FMT_ARGB] = {
  478. .name = "argb",
  479. .nb_components = 4,
  480. .log2_chroma_w = 0,
  481. .log2_chroma_h = 0,
  482. .comp = {
  483. { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
  484. { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
  485. { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
  486. { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
  487. },
  488. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
  489. },
  490. [AV_PIX_FMT_RGBA] = {
  491. .name = "rgba",
  492. .nb_components = 4,
  493. .log2_chroma_w = 0,
  494. .log2_chroma_h = 0,
  495. .comp = {
  496. { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
  497. { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
  498. { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
  499. { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
  500. },
  501. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
  502. },
  503. [AV_PIX_FMT_ABGR] = {
  504. .name = "abgr",
  505. .nb_components = 4,
  506. .log2_chroma_w = 0,
  507. .log2_chroma_h = 0,
  508. .comp = {
  509. { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
  510. { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
  511. { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
  512. { 0, 4, 0, 0, 8, 3, 7, 1 }, /* A */
  513. },
  514. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
  515. },
  516. [AV_PIX_FMT_BGRA] = {
  517. .name = "bgra",
  518. .nb_components = 4,
  519. .log2_chroma_w = 0,
  520. .log2_chroma_h = 0,
  521. .comp = {
  522. { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
  523. { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
  524. { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
  525. { 0, 4, 3, 0, 8, 3, 7, 4 }, /* A */
  526. },
  527. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
  528. },
  529. [AV_PIX_FMT_0RGB] = {
  530. .name = "0rgb",
  531. .nb_components= 3,
  532. .log2_chroma_w= 0,
  533. .log2_chroma_h= 0,
  534. .comp = {
  535. { 0, 4, 1, 0, 8, 3, 7, 2 }, /* R */
  536. { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
  537. { 0, 4, 3, 0, 8, 3, 7, 4 }, /* B */
  538. },
  539. .flags = AV_PIX_FMT_FLAG_RGB,
  540. },
  541. [AV_PIX_FMT_RGB0] = {
  542. .name = "rgb0",
  543. .nb_components= 3,
  544. .log2_chroma_w= 0,
  545. .log2_chroma_h= 0,
  546. .comp = {
  547. { 0, 4, 0, 0, 8, 3, 7, 1 }, /* R */
  548. { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
  549. { 0, 4, 2, 0, 8, 3, 7, 3 }, /* B */
  550. },
  551. .flags = AV_PIX_FMT_FLAG_RGB,
  552. },
  553. [AV_PIX_FMT_0BGR] = {
  554. .name = "0bgr",
  555. .nb_components= 3,
  556. .log2_chroma_w= 0,
  557. .log2_chroma_h= 0,
  558. .comp = {
  559. { 0, 4, 3, 0, 8, 3, 7, 4 }, /* R */
  560. { 0, 4, 2, 0, 8, 3, 7, 3 }, /* G */
  561. { 0, 4, 1, 0, 8, 3, 7, 2 }, /* B */
  562. },
  563. .flags = AV_PIX_FMT_FLAG_RGB,
  564. },
  565. [AV_PIX_FMT_BGR0] = {
  566. .name = "bgr0",
  567. .nb_components= 3,
  568. .log2_chroma_w= 0,
  569. .log2_chroma_h= 0,
  570. .comp = {
  571. { 0, 4, 2, 0, 8, 3, 7, 3 }, /* R */
  572. { 0, 4, 1, 0, 8, 3, 7, 2 }, /* G */
  573. { 0, 4, 0, 0, 8, 3, 7, 1 }, /* B */
  574. },
  575. .flags = AV_PIX_FMT_FLAG_RGB,
  576. },
  577. [AV_PIX_FMT_GRAY9BE] = {
  578. .name = "gray9be",
  579. .nb_components = 1,
  580. .log2_chroma_w = 0,
  581. .log2_chroma_h = 0,
  582. .comp = {
  583. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  584. },
  585. .flags = AV_PIX_FMT_FLAG_BE,
  586. .alias = "y9be",
  587. },
  588. [AV_PIX_FMT_GRAY9LE] = {
  589. .name = "gray9le",
  590. .nb_components = 1,
  591. .log2_chroma_w = 0,
  592. .log2_chroma_h = 0,
  593. .comp = {
  594. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  595. },
  596. .alias = "y9le",
  597. },
  598. [AV_PIX_FMT_GRAY10BE] = {
  599. .name = "gray10be",
  600. .nb_components = 1,
  601. .log2_chroma_w = 0,
  602. .log2_chroma_h = 0,
  603. .comp = {
  604. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  605. },
  606. .flags = AV_PIX_FMT_FLAG_BE,
  607. .alias = "y10be",
  608. },
  609. [AV_PIX_FMT_GRAY10LE] = {
  610. .name = "gray10le",
  611. .nb_components = 1,
  612. .log2_chroma_w = 0,
  613. .log2_chroma_h = 0,
  614. .comp = {
  615. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  616. },
  617. .alias = "y10le",
  618. },
  619. [AV_PIX_FMT_GRAY12BE] = {
  620. .name = "gray12be",
  621. .nb_components = 1,
  622. .log2_chroma_w = 0,
  623. .log2_chroma_h = 0,
  624. .comp = {
  625. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  626. },
  627. .flags = AV_PIX_FMT_FLAG_BE,
  628. .alias = "y12be",
  629. },
  630. [AV_PIX_FMT_GRAY12LE] = {
  631. .name = "gray12le",
  632. .nb_components = 1,
  633. .log2_chroma_w = 0,
  634. .log2_chroma_h = 0,
  635. .comp = {
  636. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  637. },
  638. .alias = "y12le",
  639. },
  640. [AV_PIX_FMT_GRAY14BE] = {
  641. .name = "gray14be",
  642. .nb_components = 1,
  643. .log2_chroma_w = 0,
  644. .log2_chroma_h = 0,
  645. .comp = {
  646. { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
  647. },
  648. .flags = AV_PIX_FMT_FLAG_BE,
  649. .alias = "y14be",
  650. },
  651. [AV_PIX_FMT_GRAY14LE] = {
  652. .name = "gray14le",
  653. .nb_components = 1,
  654. .log2_chroma_w = 0,
  655. .log2_chroma_h = 0,
  656. .comp = {
  657. { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
  658. },
  659. .alias = "y14le",
  660. },
  661. [AV_PIX_FMT_GRAY16BE] = {
  662. .name = "gray16be",
  663. .nb_components = 1,
  664. .log2_chroma_w = 0,
  665. .log2_chroma_h = 0,
  666. .comp = {
  667. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  668. },
  669. .flags = AV_PIX_FMT_FLAG_BE,
  670. .alias = "y16be",
  671. },
  672. [AV_PIX_FMT_GRAY16LE] = {
  673. .name = "gray16le",
  674. .nb_components = 1,
  675. .log2_chroma_w = 0,
  676. .log2_chroma_h = 0,
  677. .comp = {
  678. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  679. },
  680. .alias = "y16le",
  681. },
  682. [AV_PIX_FMT_YUV440P] = {
  683. .name = "yuv440p",
  684. .nb_components = 3,
  685. .log2_chroma_w = 0,
  686. .log2_chroma_h = 1,
  687. .comp = {
  688. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  689. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  690. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  691. },
  692. .flags = AV_PIX_FMT_FLAG_PLANAR,
  693. },
  694. [AV_PIX_FMT_YUVJ440P] = {
  695. .name = "yuvj440p",
  696. .nb_components = 3,
  697. .log2_chroma_w = 0,
  698. .log2_chroma_h = 1,
  699. .comp = {
  700. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  701. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  702. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  703. },
  704. .flags = AV_PIX_FMT_FLAG_PLANAR,
  705. },
  706. [AV_PIX_FMT_YUV440P10LE] = {
  707. .name = "yuv440p10le",
  708. .nb_components = 3,
  709. .log2_chroma_w = 0,
  710. .log2_chroma_h = 1,
  711. .comp = {
  712. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  713. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  714. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  715. },
  716. .flags = AV_PIX_FMT_FLAG_PLANAR,
  717. },
  718. [AV_PIX_FMT_YUV440P10BE] = {
  719. .name = "yuv440p10be",
  720. .nb_components = 3,
  721. .log2_chroma_w = 0,
  722. .log2_chroma_h = 1,
  723. .comp = {
  724. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  725. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  726. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  727. },
  728. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  729. },
  730. [AV_PIX_FMT_YUV440P12LE] = {
  731. .name = "yuv440p12le",
  732. .nb_components = 3,
  733. .log2_chroma_w = 0,
  734. .log2_chroma_h = 1,
  735. .comp = {
  736. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  737. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
  738. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
  739. },
  740. .flags = AV_PIX_FMT_FLAG_PLANAR,
  741. },
  742. [AV_PIX_FMT_YUV440P12BE] = {
  743. .name = "yuv440p12be",
  744. .nb_components = 3,
  745. .log2_chroma_w = 0,
  746. .log2_chroma_h = 1,
  747. .comp = {
  748. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  749. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
  750. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
  751. },
  752. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  753. },
  754. [AV_PIX_FMT_YUVA420P] = {
  755. .name = "yuva420p",
  756. .nb_components = 4,
  757. .log2_chroma_w = 1,
  758. .log2_chroma_h = 1,
  759. .comp = {
  760. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  761. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  762. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  763. { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
  764. },
  765. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  766. },
  767. [AV_PIX_FMT_YUVA422P] = {
  768. .name = "yuva422p",
  769. .nb_components = 4,
  770. .log2_chroma_w = 1,
  771. .log2_chroma_h = 0,
  772. .comp = {
  773. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  774. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  775. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  776. { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
  777. },
  778. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  779. },
  780. [AV_PIX_FMT_YUVA444P] = {
  781. .name = "yuva444p",
  782. .nb_components = 4,
  783. .log2_chroma_w = 0,
  784. .log2_chroma_h = 0,
  785. .comp = {
  786. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  787. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* U */
  788. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* V */
  789. { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
  790. },
  791. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  792. },
  793. [AV_PIX_FMT_YUVA420P9BE] = {
  794. .name = "yuva420p9be",
  795. .nb_components = 4,
  796. .log2_chroma_w = 1,
  797. .log2_chroma_h = 1,
  798. .comp = {
  799. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  800. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
  801. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
  802. { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
  803. },
  804. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  805. },
  806. [AV_PIX_FMT_YUVA420P9LE] = {
  807. .name = "yuva420p9le",
  808. .nb_components = 4,
  809. .log2_chroma_w = 1,
  810. .log2_chroma_h = 1,
  811. .comp = {
  812. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  813. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
  814. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
  815. { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
  816. },
  817. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  818. },
  819. [AV_PIX_FMT_YUVA422P9BE] = {
  820. .name = "yuva422p9be",
  821. .nb_components = 4,
  822. .log2_chroma_w = 1,
  823. .log2_chroma_h = 0,
  824. .comp = {
  825. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  826. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
  827. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
  828. { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
  829. },
  830. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  831. },
  832. [AV_PIX_FMT_YUVA422P9LE] = {
  833. .name = "yuva422p9le",
  834. .nb_components = 4,
  835. .log2_chroma_w = 1,
  836. .log2_chroma_h = 0,
  837. .comp = {
  838. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  839. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
  840. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
  841. { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
  842. },
  843. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  844. },
  845. [AV_PIX_FMT_YUVA444P9BE] = {
  846. .name = "yuva444p9be",
  847. .nb_components = 4,
  848. .log2_chroma_w = 0,
  849. .log2_chroma_h = 0,
  850. .comp = {
  851. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  852. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
  853. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
  854. { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
  855. },
  856. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  857. },
  858. [AV_PIX_FMT_YUVA444P9LE] = {
  859. .name = "yuva444p9le",
  860. .nb_components = 4,
  861. .log2_chroma_w = 0,
  862. .log2_chroma_h = 0,
  863. .comp = {
  864. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  865. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
  866. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
  867. { 3, 2, 0, 0, 9, 1, 8, 1 }, /* A */
  868. },
  869. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  870. },
  871. [AV_PIX_FMT_YUVA420P10BE] = {
  872. .name = "yuva420p10be",
  873. .nb_components = 4,
  874. .log2_chroma_w = 1,
  875. .log2_chroma_h = 1,
  876. .comp = {
  877. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  878. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  879. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  880. { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
  881. },
  882. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  883. },
  884. [AV_PIX_FMT_YUVA420P10LE] = {
  885. .name = "yuva420p10le",
  886. .nb_components = 4,
  887. .log2_chroma_w = 1,
  888. .log2_chroma_h = 1,
  889. .comp = {
  890. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  891. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  892. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  893. { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
  894. },
  895. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  896. },
  897. [AV_PIX_FMT_YUVA422P10BE] = {
  898. .name = "yuva422p10be",
  899. .nb_components = 4,
  900. .log2_chroma_w = 1,
  901. .log2_chroma_h = 0,
  902. .comp = {
  903. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  904. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  905. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  906. { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
  907. },
  908. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  909. },
  910. [AV_PIX_FMT_YUVA422P10LE] = {
  911. .name = "yuva422p10le",
  912. .nb_components = 4,
  913. .log2_chroma_w = 1,
  914. .log2_chroma_h = 0,
  915. .comp = {
  916. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  917. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  918. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  919. { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
  920. },
  921. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  922. },
  923. [AV_PIX_FMT_YUVA444P10BE] = {
  924. .name = "yuva444p10be",
  925. .nb_components = 4,
  926. .log2_chroma_w = 0,
  927. .log2_chroma_h = 0,
  928. .comp = {
  929. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  930. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  931. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  932. { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
  933. },
  934. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  935. },
  936. [AV_PIX_FMT_YUVA444P10LE] = {
  937. .name = "yuva444p10le",
  938. .nb_components = 4,
  939. .log2_chroma_w = 0,
  940. .log2_chroma_h = 0,
  941. .comp = {
  942. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  943. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  944. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  945. { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
  946. },
  947. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  948. },
  949. [AV_PIX_FMT_YUVA420P16BE] = {
  950. .name = "yuva420p16be",
  951. .nb_components = 4,
  952. .log2_chroma_w = 1,
  953. .log2_chroma_h = 1,
  954. .comp = {
  955. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  956. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
  957. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
  958. { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
  959. },
  960. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  961. },
  962. [AV_PIX_FMT_YUVA420P16LE] = {
  963. .name = "yuva420p16le",
  964. .nb_components = 4,
  965. .log2_chroma_w = 1,
  966. .log2_chroma_h = 1,
  967. .comp = {
  968. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  969. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
  970. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
  971. { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
  972. },
  973. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  974. },
  975. [AV_PIX_FMT_YUVA422P16BE] = {
  976. .name = "yuva422p16be",
  977. .nb_components = 4,
  978. .log2_chroma_w = 1,
  979. .log2_chroma_h = 0,
  980. .comp = {
  981. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  982. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
  983. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
  984. { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
  985. },
  986. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  987. },
  988. [AV_PIX_FMT_YUVA422P16LE] = {
  989. .name = "yuva422p16le",
  990. .nb_components = 4,
  991. .log2_chroma_w = 1,
  992. .log2_chroma_h = 0,
  993. .comp = {
  994. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  995. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
  996. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
  997. { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
  998. },
  999. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  1000. },
  1001. [AV_PIX_FMT_YUVA444P16BE] = {
  1002. .name = "yuva444p16be",
  1003. .nb_components = 4,
  1004. .log2_chroma_w = 0,
  1005. .log2_chroma_h = 0,
  1006. .comp = {
  1007. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  1008. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
  1009. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
  1010. { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
  1011. },
  1012. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  1013. },
  1014. [AV_PIX_FMT_YUVA444P16LE] = {
  1015. .name = "yuva444p16le",
  1016. .nb_components = 4,
  1017. .log2_chroma_w = 0,
  1018. .log2_chroma_h = 0,
  1019. .comp = {
  1020. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  1021. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
  1022. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
  1023. { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
  1024. },
  1025. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  1026. },
  1027. [AV_PIX_FMT_RGB48BE] = {
  1028. .name = "rgb48be",
  1029. .nb_components = 3,
  1030. .log2_chroma_w = 0,
  1031. .log2_chroma_h = 0,
  1032. .comp = {
  1033. { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
  1034. { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
  1035. { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
  1036. },
  1037. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
  1038. },
  1039. [AV_PIX_FMT_RGB48LE] = {
  1040. .name = "rgb48le",
  1041. .nb_components = 3,
  1042. .log2_chroma_w = 0,
  1043. .log2_chroma_h = 0,
  1044. .comp = {
  1045. { 0, 6, 0, 0, 16, 5, 15, 1 }, /* R */
  1046. { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
  1047. { 0, 6, 4, 0, 16, 5, 15, 5 }, /* B */
  1048. },
  1049. .flags = AV_PIX_FMT_FLAG_RGB,
  1050. },
  1051. [AV_PIX_FMT_RGBA64BE] = {
  1052. .name = "rgba64be",
  1053. .nb_components = 4,
  1054. .log2_chroma_w = 0,
  1055. .log2_chroma_h = 0,
  1056. .comp = {
  1057. { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
  1058. { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
  1059. { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
  1060. { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
  1061. },
  1062. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
  1063. },
  1064. [AV_PIX_FMT_RGBA64LE] = {
  1065. .name = "rgba64le",
  1066. .nb_components = 4,
  1067. .log2_chroma_w = 0,
  1068. .log2_chroma_h = 0,
  1069. .comp = {
  1070. { 0, 8, 0, 0, 16, 7, 15, 1 }, /* R */
  1071. { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
  1072. { 0, 8, 4, 0, 16, 7, 15, 5 }, /* B */
  1073. { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
  1074. },
  1075. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
  1076. },
  1077. [AV_PIX_FMT_RGB565BE] = {
  1078. .name = "rgb565be",
  1079. .nb_components = 3,
  1080. .log2_chroma_w = 0,
  1081. .log2_chroma_h = 0,
  1082. .comp = {
  1083. { 0, 2, -1, 3, 5, 1, 4, 0 }, /* R */
  1084. { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
  1085. { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
  1086. },
  1087. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
  1088. },
  1089. [AV_PIX_FMT_RGB565LE] = {
  1090. .name = "rgb565le",
  1091. .nb_components = 3,
  1092. .log2_chroma_w = 0,
  1093. .log2_chroma_h = 0,
  1094. .comp = {
  1095. { 0, 2, 1, 3, 5, 1, 4, 2 }, /* R */
  1096. { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
  1097. { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
  1098. },
  1099. .flags = AV_PIX_FMT_FLAG_RGB,
  1100. },
  1101. [AV_PIX_FMT_RGB555BE] = {
  1102. .name = "rgb555be",
  1103. .nb_components = 3,
  1104. .log2_chroma_w = 0,
  1105. .log2_chroma_h = 0,
  1106. .comp = {
  1107. { 0, 2, -1, 2, 5, 1, 4, 0 }, /* R */
  1108. { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
  1109. { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
  1110. },
  1111. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
  1112. },
  1113. [AV_PIX_FMT_RGB555LE] = {
  1114. .name = "rgb555le",
  1115. .nb_components = 3,
  1116. .log2_chroma_w = 0,
  1117. .log2_chroma_h = 0,
  1118. .comp = {
  1119. { 0, 2, 1, 2, 5, 1, 4, 2 }, /* R */
  1120. { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
  1121. { 0, 2, 0, 0, 5, 1, 4, 1 }, /* B */
  1122. },
  1123. .flags = AV_PIX_FMT_FLAG_RGB,
  1124. },
  1125. [AV_PIX_FMT_RGB444BE] = {
  1126. .name = "rgb444be",
  1127. .nb_components = 3,
  1128. .log2_chroma_w = 0,
  1129. .log2_chroma_h = 0,
  1130. .comp = {
  1131. { 0, 2, -1, 0, 4, 1, 3, 0 }, /* R */
  1132. { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
  1133. { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
  1134. },
  1135. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
  1136. },
  1137. [AV_PIX_FMT_RGB444LE] = {
  1138. .name = "rgb444le",
  1139. .nb_components = 3,
  1140. .log2_chroma_w = 0,
  1141. .log2_chroma_h = 0,
  1142. .comp = {
  1143. { 0, 2, 1, 0, 4, 1, 3, 2 }, /* R */
  1144. { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
  1145. { 0, 2, 0, 0, 4, 1, 3, 1 }, /* B */
  1146. },
  1147. .flags = AV_PIX_FMT_FLAG_RGB,
  1148. },
  1149. [AV_PIX_FMT_BGR48BE] = {
  1150. .name = "bgr48be",
  1151. .nb_components = 3,
  1152. .log2_chroma_w = 0,
  1153. .log2_chroma_h = 0,
  1154. .comp = {
  1155. { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
  1156. { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
  1157. { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
  1158. },
  1159. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
  1160. },
  1161. [AV_PIX_FMT_BGR48LE] = {
  1162. .name = "bgr48le",
  1163. .nb_components = 3,
  1164. .log2_chroma_w = 0,
  1165. .log2_chroma_h = 0,
  1166. .comp = {
  1167. { 0, 6, 4, 0, 16, 5, 15, 5 }, /* R */
  1168. { 0, 6, 2, 0, 16, 5, 15, 3 }, /* G */
  1169. { 0, 6, 0, 0, 16, 5, 15, 1 }, /* B */
  1170. },
  1171. .flags = AV_PIX_FMT_FLAG_RGB,
  1172. },
  1173. [AV_PIX_FMT_BGRA64BE] = {
  1174. .name = "bgra64be",
  1175. .nb_components = 4,
  1176. .log2_chroma_w = 0,
  1177. .log2_chroma_h = 0,
  1178. .comp = {
  1179. { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
  1180. { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
  1181. { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
  1182. { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
  1183. },
  1184. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
  1185. },
  1186. [AV_PIX_FMT_BGRA64LE] = {
  1187. .name = "bgra64le",
  1188. .nb_components = 4,
  1189. .log2_chroma_w = 0,
  1190. .log2_chroma_h = 0,
  1191. .comp = {
  1192. { 0, 8, 4, 0, 16, 7, 15, 5 }, /* R */
  1193. { 0, 8, 2, 0, 16, 7, 15, 3 }, /* G */
  1194. { 0, 8, 0, 0, 16, 7, 15, 1 }, /* B */
  1195. { 0, 8, 6, 0, 16, 7, 15, 7 }, /* A */
  1196. },
  1197. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
  1198. },
  1199. [AV_PIX_FMT_BGR565BE] = {
  1200. .name = "bgr565be",
  1201. .nb_components = 3,
  1202. .log2_chroma_w = 0,
  1203. .log2_chroma_h = 0,
  1204. .comp = {
  1205. { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
  1206. { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
  1207. { 0, 2, -1, 3, 5, 1, 4, 0 }, /* B */
  1208. },
  1209. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
  1210. },
  1211. [AV_PIX_FMT_BGR565LE] = {
  1212. .name = "bgr565le",
  1213. .nb_components = 3,
  1214. .log2_chroma_w = 0,
  1215. .log2_chroma_h = 0,
  1216. .comp = {
  1217. { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
  1218. { 0, 2, 0, 5, 6, 1, 5, 1 }, /* G */
  1219. { 0, 2, 1, 3, 5, 1, 4, 2 }, /* B */
  1220. },
  1221. .flags = AV_PIX_FMT_FLAG_RGB,
  1222. },
  1223. [AV_PIX_FMT_BGR555BE] = {
  1224. .name = "bgr555be",
  1225. .nb_components = 3,
  1226. .log2_chroma_w = 0,
  1227. .log2_chroma_h = 0,
  1228. .comp = {
  1229. { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
  1230. { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
  1231. { 0, 2, -1, 2, 5, 1, 4, 0 }, /* B */
  1232. },
  1233. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
  1234. },
  1235. [AV_PIX_FMT_BGR555LE] = {
  1236. .name = "bgr555le",
  1237. .nb_components = 3,
  1238. .log2_chroma_w = 0,
  1239. .log2_chroma_h = 0,
  1240. .comp = {
  1241. { 0, 2, 0, 0, 5, 1, 4, 1 }, /* R */
  1242. { 0, 2, 0, 5, 5, 1, 4, 1 }, /* G */
  1243. { 0, 2, 1, 2, 5, 1, 4, 2 }, /* B */
  1244. },
  1245. .flags = AV_PIX_FMT_FLAG_RGB,
  1246. },
  1247. [AV_PIX_FMT_BGR444BE] = {
  1248. .name = "bgr444be",
  1249. .nb_components = 3,
  1250. .log2_chroma_w = 0,
  1251. .log2_chroma_h = 0,
  1252. .comp = {
  1253. { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
  1254. { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
  1255. { 0, 2, -1, 0, 4, 1, 3, 0 }, /* B */
  1256. },
  1257. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
  1258. },
  1259. [AV_PIX_FMT_BGR444LE] = {
  1260. .name = "bgr444le",
  1261. .nb_components = 3,
  1262. .log2_chroma_w = 0,
  1263. .log2_chroma_h = 0,
  1264. .comp = {
  1265. { 0, 2, 0, 0, 4, 1, 3, 1 }, /* R */
  1266. { 0, 2, 0, 4, 4, 1, 3, 1 }, /* G */
  1267. { 0, 2, 1, 0, 4, 1, 3, 2 }, /* B */
  1268. },
  1269. .flags = AV_PIX_FMT_FLAG_RGB,
  1270. },
  1271. #if FF_API_VAAPI
  1272. [AV_PIX_FMT_VAAPI_MOCO] = {
  1273. .name = "vaapi_moco",
  1274. .log2_chroma_w = 1,
  1275. .log2_chroma_h = 1,
  1276. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  1277. },
  1278. [AV_PIX_FMT_VAAPI_IDCT] = {
  1279. .name = "vaapi_idct",
  1280. .log2_chroma_w = 1,
  1281. .log2_chroma_h = 1,
  1282. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  1283. },
  1284. [AV_PIX_FMT_VAAPI_VLD] = {
  1285. .name = "vaapi_vld",
  1286. .log2_chroma_w = 1,
  1287. .log2_chroma_h = 1,
  1288. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  1289. },
  1290. #else
  1291. [AV_PIX_FMT_VAAPI] = {
  1292. .name = "vaapi",
  1293. .log2_chroma_w = 1,
  1294. .log2_chroma_h = 1,
  1295. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  1296. },
  1297. #endif
  1298. [AV_PIX_FMT_YUV420P9LE] = {
  1299. .name = "yuv420p9le",
  1300. .nb_components = 3,
  1301. .log2_chroma_w = 1,
  1302. .log2_chroma_h = 1,
  1303. .comp = {
  1304. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  1305. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
  1306. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
  1307. },
  1308. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1309. },
  1310. [AV_PIX_FMT_YUV420P9BE] = {
  1311. .name = "yuv420p9be",
  1312. .nb_components = 3,
  1313. .log2_chroma_w = 1,
  1314. .log2_chroma_h = 1,
  1315. .comp = {
  1316. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  1317. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
  1318. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
  1319. },
  1320. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1321. },
  1322. [AV_PIX_FMT_YUV420P10LE] = {
  1323. .name = "yuv420p10le",
  1324. .nb_components = 3,
  1325. .log2_chroma_w = 1,
  1326. .log2_chroma_h = 1,
  1327. .comp = {
  1328. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  1329. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  1330. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  1331. },
  1332. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1333. },
  1334. [AV_PIX_FMT_YUV420P10BE] = {
  1335. .name = "yuv420p10be",
  1336. .nb_components = 3,
  1337. .log2_chroma_w = 1,
  1338. .log2_chroma_h = 1,
  1339. .comp = {
  1340. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  1341. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  1342. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  1343. },
  1344. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1345. },
  1346. [AV_PIX_FMT_YUV420P12LE] = {
  1347. .name = "yuv420p12le",
  1348. .nb_components = 3,
  1349. .log2_chroma_w = 1,
  1350. .log2_chroma_h = 1,
  1351. .comp = {
  1352. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  1353. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
  1354. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
  1355. },
  1356. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1357. },
  1358. [AV_PIX_FMT_YUV420P12BE] = {
  1359. .name = "yuv420p12be",
  1360. .nb_components = 3,
  1361. .log2_chroma_w = 1,
  1362. .log2_chroma_h = 1,
  1363. .comp = {
  1364. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  1365. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
  1366. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
  1367. },
  1368. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1369. },
  1370. [AV_PIX_FMT_YUV420P14LE] = {
  1371. .name = "yuv420p14le",
  1372. .nb_components = 3,
  1373. .log2_chroma_w = 1,
  1374. .log2_chroma_h = 1,
  1375. .comp = {
  1376. { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
  1377. { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
  1378. { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
  1379. },
  1380. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1381. },
  1382. [AV_PIX_FMT_YUV420P14BE] = {
  1383. .name = "yuv420p14be",
  1384. .nb_components = 3,
  1385. .log2_chroma_w = 1,
  1386. .log2_chroma_h = 1,
  1387. .comp = {
  1388. { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
  1389. { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
  1390. { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
  1391. },
  1392. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1393. },
  1394. [AV_PIX_FMT_YUV420P16LE] = {
  1395. .name = "yuv420p16le",
  1396. .nb_components = 3,
  1397. .log2_chroma_w = 1,
  1398. .log2_chroma_h = 1,
  1399. .comp = {
  1400. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  1401. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
  1402. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
  1403. },
  1404. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1405. },
  1406. [AV_PIX_FMT_YUV420P16BE] = {
  1407. .name = "yuv420p16be",
  1408. .nb_components = 3,
  1409. .log2_chroma_w = 1,
  1410. .log2_chroma_h = 1,
  1411. .comp = {
  1412. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  1413. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
  1414. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
  1415. },
  1416. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1417. },
  1418. [AV_PIX_FMT_YUV422P9LE] = {
  1419. .name = "yuv422p9le",
  1420. .nb_components = 3,
  1421. .log2_chroma_w = 1,
  1422. .log2_chroma_h = 0,
  1423. .comp = {
  1424. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  1425. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
  1426. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
  1427. },
  1428. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1429. },
  1430. [AV_PIX_FMT_YUV422P9BE] = {
  1431. .name = "yuv422p9be",
  1432. .nb_components = 3,
  1433. .log2_chroma_w = 1,
  1434. .log2_chroma_h = 0,
  1435. .comp = {
  1436. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  1437. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
  1438. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
  1439. },
  1440. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1441. },
  1442. [AV_PIX_FMT_YUV422P10LE] = {
  1443. .name = "yuv422p10le",
  1444. .nb_components = 3,
  1445. .log2_chroma_w = 1,
  1446. .log2_chroma_h = 0,
  1447. .comp = {
  1448. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  1449. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  1450. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  1451. },
  1452. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1453. },
  1454. [AV_PIX_FMT_YUV422P10BE] = {
  1455. .name = "yuv422p10be",
  1456. .nb_components = 3,
  1457. .log2_chroma_w = 1,
  1458. .log2_chroma_h = 0,
  1459. .comp = {
  1460. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  1461. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  1462. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  1463. },
  1464. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1465. },
  1466. [AV_PIX_FMT_YUV422P12LE] = {
  1467. .name = "yuv422p12le",
  1468. .nb_components = 3,
  1469. .log2_chroma_w = 1,
  1470. .log2_chroma_h = 0,
  1471. .comp = {
  1472. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  1473. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
  1474. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
  1475. },
  1476. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1477. },
  1478. [AV_PIX_FMT_YUV422P12BE] = {
  1479. .name = "yuv422p12be",
  1480. .nb_components = 3,
  1481. .log2_chroma_w = 1,
  1482. .log2_chroma_h = 0,
  1483. .comp = {
  1484. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  1485. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
  1486. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
  1487. },
  1488. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1489. },
  1490. [AV_PIX_FMT_YUV422P14LE] = {
  1491. .name = "yuv422p14le",
  1492. .nb_components = 3,
  1493. .log2_chroma_w = 1,
  1494. .log2_chroma_h = 0,
  1495. .comp = {
  1496. { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
  1497. { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
  1498. { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
  1499. },
  1500. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1501. },
  1502. [AV_PIX_FMT_YUV422P14BE] = {
  1503. .name = "yuv422p14be",
  1504. .nb_components = 3,
  1505. .log2_chroma_w = 1,
  1506. .log2_chroma_h = 0,
  1507. .comp = {
  1508. { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
  1509. { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
  1510. { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
  1511. },
  1512. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1513. },
  1514. [AV_PIX_FMT_YUV422P16LE] = {
  1515. .name = "yuv422p16le",
  1516. .nb_components = 3,
  1517. .log2_chroma_w = 1,
  1518. .log2_chroma_h = 0,
  1519. .comp = {
  1520. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  1521. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
  1522. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
  1523. },
  1524. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1525. },
  1526. [AV_PIX_FMT_YUV422P16BE] = {
  1527. .name = "yuv422p16be",
  1528. .nb_components = 3,
  1529. .log2_chroma_w = 1,
  1530. .log2_chroma_h = 0,
  1531. .comp = {
  1532. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  1533. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
  1534. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
  1535. },
  1536. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1537. },
  1538. [AV_PIX_FMT_YUV444P16LE] = {
  1539. .name = "yuv444p16le",
  1540. .nb_components = 3,
  1541. .log2_chroma_w = 0,
  1542. .log2_chroma_h = 0,
  1543. .comp = {
  1544. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  1545. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
  1546. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
  1547. },
  1548. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1549. },
  1550. [AV_PIX_FMT_YUV444P16BE] = {
  1551. .name = "yuv444p16be",
  1552. .nb_components = 3,
  1553. .log2_chroma_w = 0,
  1554. .log2_chroma_h = 0,
  1555. .comp = {
  1556. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  1557. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* U */
  1558. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* V */
  1559. },
  1560. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1561. },
  1562. [AV_PIX_FMT_YUV444P10LE] = {
  1563. .name = "yuv444p10le",
  1564. .nb_components = 3,
  1565. .log2_chroma_w = 0,
  1566. .log2_chroma_h = 0,
  1567. .comp = {
  1568. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  1569. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  1570. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  1571. },
  1572. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1573. },
  1574. [AV_PIX_FMT_YUV444P10BE] = {
  1575. .name = "yuv444p10be",
  1576. .nb_components = 3,
  1577. .log2_chroma_w = 0,
  1578. .log2_chroma_h = 0,
  1579. .comp = {
  1580. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  1581. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* U */
  1582. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* V */
  1583. },
  1584. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1585. },
  1586. [AV_PIX_FMT_YUV444P9LE] = {
  1587. .name = "yuv444p9le",
  1588. .nb_components = 3,
  1589. .log2_chroma_w = 0,
  1590. .log2_chroma_h = 0,
  1591. .comp = {
  1592. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  1593. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
  1594. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
  1595. },
  1596. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1597. },
  1598. [AV_PIX_FMT_YUV444P9BE] = {
  1599. .name = "yuv444p9be",
  1600. .nb_components = 3,
  1601. .log2_chroma_w = 0,
  1602. .log2_chroma_h = 0,
  1603. .comp = {
  1604. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
  1605. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* U */
  1606. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* V */
  1607. },
  1608. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1609. },
  1610. [AV_PIX_FMT_YUV444P12LE] = {
  1611. .name = "yuv444p12le",
  1612. .nb_components = 3,
  1613. .log2_chroma_w = 0,
  1614. .log2_chroma_h = 0,
  1615. .comp = {
  1616. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  1617. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
  1618. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
  1619. },
  1620. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1621. },
  1622. [AV_PIX_FMT_YUV444P12BE] = {
  1623. .name = "yuv444p12be",
  1624. .nb_components = 3,
  1625. .log2_chroma_w = 0,
  1626. .log2_chroma_h = 0,
  1627. .comp = {
  1628. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  1629. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
  1630. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
  1631. },
  1632. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1633. },
  1634. [AV_PIX_FMT_YUV444P14LE] = {
  1635. .name = "yuv444p14le",
  1636. .nb_components = 3,
  1637. .log2_chroma_w = 0,
  1638. .log2_chroma_h = 0,
  1639. .comp = {
  1640. { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
  1641. { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
  1642. { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
  1643. },
  1644. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1645. },
  1646. [AV_PIX_FMT_YUV444P14BE] = {
  1647. .name = "yuv444p14be",
  1648. .nb_components = 3,
  1649. .log2_chroma_w = 0,
  1650. .log2_chroma_h = 0,
  1651. .comp = {
  1652. { 0, 2, 0, 0, 14, 1, 13, 1 }, /* Y */
  1653. { 1, 2, 0, 0, 14, 1, 13, 1 }, /* U */
  1654. { 2, 2, 0, 0, 14, 1, 13, 1 }, /* V */
  1655. },
  1656. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
  1657. },
  1658. [AV_PIX_FMT_D3D11VA_VLD] = {
  1659. .name = "d3d11va_vld",
  1660. .log2_chroma_w = 1,
  1661. .log2_chroma_h = 1,
  1662. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  1663. },
  1664. [AV_PIX_FMT_DXVA2_VLD] = {
  1665. .name = "dxva2_vld",
  1666. .log2_chroma_w = 1,
  1667. .log2_chroma_h = 1,
  1668. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  1669. },
  1670. [AV_PIX_FMT_YA8] = {
  1671. .name = "ya8",
  1672. .nb_components = 2,
  1673. .comp = {
  1674. { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */
  1675. { 0, 2, 1, 0, 8, 1, 7, 2 }, /* A */
  1676. },
  1677. .flags = AV_PIX_FMT_FLAG_ALPHA,
  1678. .alias = "gray8a",
  1679. },
  1680. [AV_PIX_FMT_YA16LE] = {
  1681. .name = "ya16le",
  1682. .nb_components = 2,
  1683. .comp = {
  1684. { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
  1685. { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
  1686. },
  1687. .flags = AV_PIX_FMT_FLAG_ALPHA,
  1688. },
  1689. [AV_PIX_FMT_YA16BE] = {
  1690. .name = "ya16be",
  1691. .nb_components = 2,
  1692. .comp = {
  1693. { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */
  1694. { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */
  1695. },
  1696. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
  1697. },
  1698. [AV_PIX_FMT_VIDEOTOOLBOX] = {
  1699. .name = "videotoolbox_vld",
  1700. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  1701. },
  1702. [AV_PIX_FMT_GBRP] = {
  1703. .name = "gbrp",
  1704. .nb_components = 3,
  1705. .log2_chroma_w = 0,
  1706. .log2_chroma_h = 0,
  1707. .comp = {
  1708. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
  1709. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
  1710. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
  1711. },
  1712. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
  1713. },
  1714. [AV_PIX_FMT_GBRP9LE] = {
  1715. .name = "gbrp9le",
  1716. .nb_components = 3,
  1717. .log2_chroma_w = 0,
  1718. .log2_chroma_h = 0,
  1719. .comp = {
  1720. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
  1721. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
  1722. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
  1723. },
  1724. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
  1725. },
  1726. [AV_PIX_FMT_GBRP9BE] = {
  1727. .name = "gbrp9be",
  1728. .nb_components = 3,
  1729. .log2_chroma_w = 0,
  1730. .log2_chroma_h = 0,
  1731. .comp = {
  1732. { 2, 2, 0, 0, 9, 1, 8, 1 }, /* R */
  1733. { 0, 2, 0, 0, 9, 1, 8, 1 }, /* G */
  1734. { 1, 2, 0, 0, 9, 1, 8, 1 }, /* B */
  1735. },
  1736. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
  1737. },
  1738. [AV_PIX_FMT_GBRP10LE] = {
  1739. .name = "gbrp10le",
  1740. .nb_components = 3,
  1741. .log2_chroma_w = 0,
  1742. .log2_chroma_h = 0,
  1743. .comp = {
  1744. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
  1745. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
  1746. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
  1747. },
  1748. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
  1749. },
  1750. [AV_PIX_FMT_GBRP10BE] = {
  1751. .name = "gbrp10be",
  1752. .nb_components = 3,
  1753. .log2_chroma_w = 0,
  1754. .log2_chroma_h = 0,
  1755. .comp = {
  1756. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
  1757. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
  1758. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
  1759. },
  1760. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
  1761. },
  1762. [AV_PIX_FMT_GBRP12LE] = {
  1763. .name = "gbrp12le",
  1764. .nb_components = 3,
  1765. .log2_chroma_w = 0,
  1766. .log2_chroma_h = 0,
  1767. .comp = {
  1768. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
  1769. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
  1770. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
  1771. },
  1772. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
  1773. },
  1774. [AV_PIX_FMT_GBRP12BE] = {
  1775. .name = "gbrp12be",
  1776. .nb_components = 3,
  1777. .log2_chroma_w = 0,
  1778. .log2_chroma_h = 0,
  1779. .comp = {
  1780. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
  1781. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
  1782. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
  1783. },
  1784. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
  1785. },
  1786. [AV_PIX_FMT_GBRP14LE] = {
  1787. .name = "gbrp14le",
  1788. .nb_components = 3,
  1789. .log2_chroma_w = 0,
  1790. .log2_chroma_h = 0,
  1791. .comp = {
  1792. { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
  1793. { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
  1794. { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
  1795. },
  1796. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
  1797. },
  1798. [AV_PIX_FMT_GBRP14BE] = {
  1799. .name = "gbrp14be",
  1800. .nb_components = 3,
  1801. .log2_chroma_w = 0,
  1802. .log2_chroma_h = 0,
  1803. .comp = {
  1804. { 2, 2, 0, 0, 14, 1, 13, 1 }, /* R */
  1805. { 0, 2, 0, 0, 14, 1, 13, 1 }, /* G */
  1806. { 1, 2, 0, 0, 14, 1, 13, 1 }, /* B */
  1807. },
  1808. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
  1809. },
  1810. [AV_PIX_FMT_GBRP16LE] = {
  1811. .name = "gbrp16le",
  1812. .nb_components = 3,
  1813. .log2_chroma_w = 0,
  1814. .log2_chroma_h = 0,
  1815. .comp = {
  1816. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
  1817. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
  1818. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
  1819. },
  1820. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
  1821. },
  1822. [AV_PIX_FMT_GBRP16BE] = {
  1823. .name = "gbrp16be",
  1824. .nb_components = 3,
  1825. .log2_chroma_w = 0,
  1826. .log2_chroma_h = 0,
  1827. .comp = {
  1828. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
  1829. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
  1830. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
  1831. },
  1832. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
  1833. },
  1834. [AV_PIX_FMT_GBRAP] = {
  1835. .name = "gbrap",
  1836. .nb_components = 4,
  1837. .log2_chroma_w = 0,
  1838. .log2_chroma_h = 0,
  1839. .comp = {
  1840. { 2, 1, 0, 0, 8, 0, 7, 1 }, /* R */
  1841. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* G */
  1842. { 1, 1, 0, 0, 8, 0, 7, 1 }, /* B */
  1843. { 3, 1, 0, 0, 8, 0, 7, 1 }, /* A */
  1844. },
  1845. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
  1846. AV_PIX_FMT_FLAG_ALPHA,
  1847. },
  1848. [AV_PIX_FMT_GBRAP16LE] = {
  1849. .name = "gbrap16le",
  1850. .nb_components = 4,
  1851. .log2_chroma_w = 0,
  1852. .log2_chroma_h = 0,
  1853. .comp = {
  1854. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
  1855. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
  1856. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
  1857. { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
  1858. },
  1859. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
  1860. AV_PIX_FMT_FLAG_ALPHA,
  1861. },
  1862. [AV_PIX_FMT_GBRAP16BE] = {
  1863. .name = "gbrap16be",
  1864. .nb_components = 4,
  1865. .log2_chroma_w = 0,
  1866. .log2_chroma_h = 0,
  1867. .comp = {
  1868. { 2, 2, 0, 0, 16, 1, 15, 1 }, /* R */
  1869. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* G */
  1870. { 1, 2, 0, 0, 16, 1, 15, 1 }, /* B */
  1871. { 3, 2, 0, 0, 16, 1, 15, 1 }, /* A */
  1872. },
  1873. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
  1874. AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
  1875. },
  1876. [AV_PIX_FMT_VDPAU] = {
  1877. .name = "vdpau",
  1878. .log2_chroma_w = 1,
  1879. .log2_chroma_h = 1,
  1880. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  1881. },
  1882. [AV_PIX_FMT_XYZ12LE] = {
  1883. .name = "xyz12le",
  1884. .nb_components = 3,
  1885. .log2_chroma_w = 0,
  1886. .log2_chroma_h = 0,
  1887. .comp = {
  1888. { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
  1889. { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
  1890. { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
  1891. },
  1892. /*.flags = -- not used*/
  1893. },
  1894. [AV_PIX_FMT_XYZ12BE] = {
  1895. .name = "xyz12be",
  1896. .nb_components = 3,
  1897. .log2_chroma_w = 0,
  1898. .log2_chroma_h = 0,
  1899. .comp = {
  1900. { 0, 6, 0, 4, 12, 5, 11, 1 }, /* X */
  1901. { 0, 6, 2, 4, 12, 5, 11, 3 }, /* Y */
  1902. { 0, 6, 4, 4, 12, 5, 11, 5 }, /* Z */
  1903. },
  1904. .flags = AV_PIX_FMT_FLAG_BE,
  1905. },
  1906. #define BAYER8_DESC_COMMON \
  1907. .nb_components= 3, \
  1908. .log2_chroma_w= 0, \
  1909. .log2_chroma_h= 0, \
  1910. .comp = { \
  1911. {0,1,0,0,2,0,1,1},\
  1912. {0,1,0,0,4,0,3,1},\
  1913. {0,1,0,0,2,0,1,1},\
  1914. }, \
  1915. #define BAYER16_DESC_COMMON \
  1916. .nb_components= 3, \
  1917. .log2_chroma_w= 0, \
  1918. .log2_chroma_h= 0, \
  1919. .comp = { \
  1920. {0,2,0,0,4,1,3,1},\
  1921. {0,2,0,0,8,1,7,1},\
  1922. {0,2,0,0,4,1,3,1},\
  1923. }, \
  1924. [AV_PIX_FMT_BAYER_BGGR8] = {
  1925. .name = "bayer_bggr8",
  1926. BAYER8_DESC_COMMON
  1927. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
  1928. },
  1929. [AV_PIX_FMT_BAYER_BGGR16LE] = {
  1930. .name = "bayer_bggr16le",
  1931. BAYER16_DESC_COMMON
  1932. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
  1933. },
  1934. [AV_PIX_FMT_BAYER_BGGR16BE] = {
  1935. .name = "bayer_bggr16be",
  1936. BAYER16_DESC_COMMON
  1937. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
  1938. },
  1939. [AV_PIX_FMT_BAYER_RGGB8] = {
  1940. .name = "bayer_rggb8",
  1941. BAYER8_DESC_COMMON
  1942. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
  1943. },
  1944. [AV_PIX_FMT_BAYER_RGGB16LE] = {
  1945. .name = "bayer_rggb16le",
  1946. BAYER16_DESC_COMMON
  1947. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
  1948. },
  1949. [AV_PIX_FMT_BAYER_RGGB16BE] = {
  1950. .name = "bayer_rggb16be",
  1951. BAYER16_DESC_COMMON
  1952. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
  1953. },
  1954. [AV_PIX_FMT_BAYER_GBRG8] = {
  1955. .name = "bayer_gbrg8",
  1956. BAYER8_DESC_COMMON
  1957. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
  1958. },
  1959. [AV_PIX_FMT_BAYER_GBRG16LE] = {
  1960. .name = "bayer_gbrg16le",
  1961. BAYER16_DESC_COMMON
  1962. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
  1963. },
  1964. [AV_PIX_FMT_BAYER_GBRG16BE] = {
  1965. .name = "bayer_gbrg16be",
  1966. BAYER16_DESC_COMMON
  1967. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
  1968. },
  1969. [AV_PIX_FMT_BAYER_GRBG8] = {
  1970. .name = "bayer_grbg8",
  1971. BAYER8_DESC_COMMON
  1972. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
  1973. },
  1974. [AV_PIX_FMT_BAYER_GRBG16LE] = {
  1975. .name = "bayer_grbg16le",
  1976. BAYER16_DESC_COMMON
  1977. .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
  1978. },
  1979. [AV_PIX_FMT_BAYER_GRBG16BE] = {
  1980. .name = "bayer_grbg16be",
  1981. BAYER16_DESC_COMMON
  1982. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
  1983. },
  1984. [AV_PIX_FMT_NV16] = {
  1985. .name = "nv16",
  1986. .nb_components = 3,
  1987. .log2_chroma_w = 1,
  1988. .log2_chroma_h = 0,
  1989. .comp = {
  1990. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  1991. { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
  1992. { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
  1993. },
  1994. .flags = AV_PIX_FMT_FLAG_PLANAR,
  1995. },
  1996. [AV_PIX_FMT_NV20LE] = {
  1997. .name = "nv20le",
  1998. .nb_components = 3,
  1999. .log2_chroma_w = 1,
  2000. .log2_chroma_h = 0,
  2001. .comp = {
  2002. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  2003. { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
  2004. { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
  2005. },
  2006. .flags = AV_PIX_FMT_FLAG_PLANAR,
  2007. },
  2008. [AV_PIX_FMT_NV20BE] = {
  2009. .name = "nv20be",
  2010. .nb_components = 3,
  2011. .log2_chroma_w = 1,
  2012. .log2_chroma_h = 0,
  2013. .comp = {
  2014. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
  2015. { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */
  2016. { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */
  2017. },
  2018. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
  2019. },
  2020. [AV_PIX_FMT_QSV] = {
  2021. .name = "qsv",
  2022. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  2023. },
  2024. [AV_PIX_FMT_MEDIACODEC] = {
  2025. .name = "mediacodec",
  2026. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  2027. },
  2028. [AV_PIX_FMT_MMAL] = {
  2029. .name = "mmal",
  2030. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  2031. },
  2032. [AV_PIX_FMT_CUDA] = {
  2033. .name = "cuda",
  2034. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  2035. },
  2036. [AV_PIX_FMT_AYUV64LE] = {
  2037. .name = "ayuv64le",
  2038. .nb_components = 4,
  2039. .log2_chroma_w = 0,
  2040. .log2_chroma_h = 0,
  2041. .comp = {
  2042. { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
  2043. { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
  2044. { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
  2045. { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
  2046. },
  2047. .flags = AV_PIX_FMT_FLAG_ALPHA,
  2048. },
  2049. [AV_PIX_FMT_AYUV64BE] = {
  2050. .name = "ayuv64be",
  2051. .nb_components = 4,
  2052. .log2_chroma_w = 0,
  2053. .log2_chroma_h = 0,
  2054. .comp = {
  2055. { 0, 8, 2, 0, 16, 7, 15, 3 }, /* Y */
  2056. { 0, 8, 4, 0, 16, 7, 15, 5 }, /* U */
  2057. { 0, 8, 6, 0, 16, 7, 15, 7 }, /* V */
  2058. { 0, 8, 0, 0, 16, 7, 15, 1 }, /* A */
  2059. },
  2060. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
  2061. },
  2062. [AV_PIX_FMT_P010LE] = {
  2063. .name = "p010le",
  2064. .nb_components = 3,
  2065. .log2_chroma_w = 1,
  2066. .log2_chroma_h = 1,
  2067. .comp = {
  2068. { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
  2069. { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
  2070. { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
  2071. },
  2072. .flags = AV_PIX_FMT_FLAG_PLANAR,
  2073. },
  2074. [AV_PIX_FMT_P010BE] = {
  2075. .name = "p010be",
  2076. .nb_components = 3,
  2077. .log2_chroma_w = 1,
  2078. .log2_chroma_h = 1,
  2079. .comp = {
  2080. { 0, 2, 0, 6, 10, 1, 9, 1 }, /* Y */
  2081. { 1, 4, 0, 6, 10, 3, 9, 1 }, /* U */
  2082. { 1, 4, 2, 6, 10, 3, 9, 3 }, /* V */
  2083. },
  2084. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
  2085. },
  2086. [AV_PIX_FMT_P016LE] = {
  2087. .name = "p016le",
  2088. .nb_components = 3,
  2089. .log2_chroma_w = 1,
  2090. .log2_chroma_h = 1,
  2091. .comp = {
  2092. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  2093. { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
  2094. { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
  2095. },
  2096. .flags = AV_PIX_FMT_FLAG_PLANAR,
  2097. },
  2098. [AV_PIX_FMT_P016BE] = {
  2099. .name = "p016be",
  2100. .nb_components = 3,
  2101. .log2_chroma_w = 1,
  2102. .log2_chroma_h = 1,
  2103. .comp = {
  2104. { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
  2105. { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
  2106. { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
  2107. },
  2108. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
  2109. },
  2110. [AV_PIX_FMT_GBRAP12LE] = {
  2111. .name = "gbrap12le",
  2112. .nb_components = 4,
  2113. .log2_chroma_w = 0,
  2114. .log2_chroma_h = 0,
  2115. .comp = {
  2116. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
  2117. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
  2118. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
  2119. { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
  2120. },
  2121. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
  2122. AV_PIX_FMT_FLAG_ALPHA,
  2123. },
  2124. [AV_PIX_FMT_GBRAP12BE] = {
  2125. .name = "gbrap12be",
  2126. .nb_components = 4,
  2127. .log2_chroma_w = 0,
  2128. .log2_chroma_h = 0,
  2129. .comp = {
  2130. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* R */
  2131. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* G */
  2132. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* B */
  2133. { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
  2134. },
  2135. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
  2136. AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
  2137. },
  2138. [AV_PIX_FMT_GBRAP10LE] = {
  2139. .name = "gbrap10le",
  2140. .nb_components = 4,
  2141. .log2_chroma_w = 0,
  2142. .log2_chroma_h = 0,
  2143. .comp = {
  2144. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
  2145. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
  2146. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
  2147. { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
  2148. },
  2149. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
  2150. AV_PIX_FMT_FLAG_ALPHA,
  2151. },
  2152. [AV_PIX_FMT_GBRAP10BE] = {
  2153. .name = "gbrap10be",
  2154. .nb_components = 4,
  2155. .log2_chroma_w = 0,
  2156. .log2_chroma_h = 0,
  2157. .comp = {
  2158. { 2, 2, 0, 0, 10, 1, 9, 1 }, /* R */
  2159. { 0, 2, 0, 0, 10, 1, 9, 1 }, /* G */
  2160. { 1, 2, 0, 0, 10, 1, 9, 1 }, /* B */
  2161. { 3, 2, 0, 0, 10, 1, 9, 1 }, /* A */
  2162. },
  2163. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
  2164. AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
  2165. },
  2166. [AV_PIX_FMT_D3D11] = {
  2167. .name = "d3d11",
  2168. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  2169. },
  2170. [AV_PIX_FMT_GBRPF32BE] = {
  2171. .name = "gbrpf32be",
  2172. .nb_components = 3,
  2173. .log2_chroma_w = 0,
  2174. .log2_chroma_h = 0,
  2175. .comp = {
  2176. { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
  2177. { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
  2178. { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
  2179. },
  2180. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
  2181. AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
  2182. },
  2183. [AV_PIX_FMT_GBRPF32LE] = {
  2184. .name = "gbrpf32le",
  2185. .nb_components = 3,
  2186. .log2_chroma_w = 0,
  2187. .log2_chroma_h = 0,
  2188. .comp = {
  2189. { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
  2190. { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
  2191. { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
  2192. },
  2193. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_RGB,
  2194. },
  2195. [AV_PIX_FMT_GBRAPF32BE] = {
  2196. .name = "gbrapf32be",
  2197. .nb_components = 4,
  2198. .log2_chroma_w = 0,
  2199. .log2_chroma_h = 0,
  2200. .comp = {
  2201. { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
  2202. { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
  2203. { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
  2204. { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
  2205. },
  2206. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
  2207. AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_RGB |
  2208. AV_PIX_FMT_FLAG_FLOAT,
  2209. },
  2210. [AV_PIX_FMT_GBRAPF32LE] = {
  2211. .name = "gbrapf32le",
  2212. .nb_components = 4,
  2213. .log2_chroma_w = 0,
  2214. .log2_chroma_h = 0,
  2215. .comp = {
  2216. { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
  2217. { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
  2218. { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
  2219. { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
  2220. },
  2221. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA |
  2222. AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
  2223. },
  2224. [AV_PIX_FMT_DRM_PRIME] = {
  2225. .name = "drm_prime",
  2226. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  2227. },
  2228. [AV_PIX_FMT_OPENCL] = {
  2229. .name = "opencl",
  2230. .flags = AV_PIX_FMT_FLAG_HWACCEL,
  2231. },
  2232. [AV_PIX_FMT_GRAYF32BE] = {
  2233. .name = "grayf32be",
  2234. .nb_components = 1,
  2235. .log2_chroma_w = 0,
  2236. .log2_chroma_h = 0,
  2237. .comp = {
  2238. { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */
  2239. },
  2240. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_FLOAT,
  2241. .alias = "yf32be",
  2242. },
  2243. [AV_PIX_FMT_GRAYF32LE] = {
  2244. .name = "grayf32le",
  2245. .nb_components = 1,
  2246. .log2_chroma_w = 0,
  2247. .log2_chroma_h = 0,
  2248. .comp = {
  2249. { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */
  2250. },
  2251. .flags = AV_PIX_FMT_FLAG_FLOAT,
  2252. .alias = "yf32le",
  2253. },
  2254. };
  2255. #if FF_API_PLUS1_MINUS1
  2256. FF_ENABLE_DEPRECATION_WARNINGS
  2257. #endif
  2258. static const char * const color_range_names[] = {
  2259. [AVCOL_RANGE_UNSPECIFIED] = "unknown",
  2260. [AVCOL_RANGE_MPEG] = "tv",
  2261. [AVCOL_RANGE_JPEG] = "pc",
  2262. };
  2263. static const char * const color_primaries_names[AVCOL_PRI_NB] = {
  2264. [AVCOL_PRI_RESERVED0] = "reserved",
  2265. [AVCOL_PRI_BT709] = "bt709",
  2266. [AVCOL_PRI_UNSPECIFIED] = "unknown",
  2267. [AVCOL_PRI_RESERVED] = "reserved",
  2268. [AVCOL_PRI_BT470M] = "bt470m",
  2269. [AVCOL_PRI_BT470BG] = "bt470bg",
  2270. [AVCOL_PRI_SMPTE170M] = "smpte170m",
  2271. [AVCOL_PRI_SMPTE240M] = "smpte240m",
  2272. [AVCOL_PRI_FILM] = "film",
  2273. [AVCOL_PRI_BT2020] = "bt2020",
  2274. [AVCOL_PRI_SMPTE428] = "smpte428",
  2275. [AVCOL_PRI_SMPTE431] = "smpte431",
  2276. [AVCOL_PRI_SMPTE432] = "smpte432",
  2277. [AVCOL_PRI_JEDEC_P22] = "jedec-p22",
  2278. };
  2279. static const char * const color_transfer_names[] = {
  2280. [AVCOL_TRC_RESERVED0] = "reserved",
  2281. [AVCOL_TRC_BT709] = "bt709",
  2282. [AVCOL_TRC_UNSPECIFIED] = "unknown",
  2283. [AVCOL_TRC_RESERVED] = "reserved",
  2284. [AVCOL_TRC_GAMMA22] = "bt470m",
  2285. [AVCOL_TRC_GAMMA28] = "bt470bg",
  2286. [AVCOL_TRC_SMPTE170M] = "smpte170m",
  2287. [AVCOL_TRC_SMPTE240M] = "smpte240m",
  2288. [AVCOL_TRC_LINEAR] = "linear",
  2289. [AVCOL_TRC_LOG] = "log100",
  2290. [AVCOL_TRC_LOG_SQRT] = "log316",
  2291. [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
  2292. [AVCOL_TRC_BT1361_ECG] = "bt1361e",
  2293. [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
  2294. [AVCOL_TRC_BT2020_10] = "bt2020-10",
  2295. [AVCOL_TRC_BT2020_12] = "bt2020-12",
  2296. [AVCOL_TRC_SMPTE2084] = "smpte2084",
  2297. [AVCOL_TRC_SMPTE428] = "smpte428",
  2298. [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
  2299. };
  2300. static const char * const color_space_names[] = {
  2301. [AVCOL_SPC_RGB] = "gbr",
  2302. [AVCOL_SPC_BT709] = "bt709",
  2303. [AVCOL_SPC_UNSPECIFIED] = "unknown",
  2304. [AVCOL_SPC_RESERVED] = "reserved",
  2305. [AVCOL_SPC_FCC] = "fcc",
  2306. [AVCOL_SPC_BT470BG] = "bt470bg",
  2307. [AVCOL_SPC_SMPTE170M] = "smpte170m",
  2308. [AVCOL_SPC_SMPTE240M] = "smpte240m",
  2309. [AVCOL_SPC_YCGCO] = "ycgco",
  2310. [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
  2311. [AVCOL_SPC_BT2020_CL] = "bt2020c",
  2312. [AVCOL_SPC_SMPTE2085] = "smpte2085",
  2313. [AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc",
  2314. [AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c",
  2315. [AVCOL_SPC_ICTCP] = "ictcp",
  2316. };
  2317. static const char * const chroma_location_names[] = {
  2318. [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
  2319. [AVCHROMA_LOC_LEFT] = "left",
  2320. [AVCHROMA_LOC_CENTER] = "center",
  2321. [AVCHROMA_LOC_TOPLEFT] = "topleft",
  2322. [AVCHROMA_LOC_TOP] = "top",
  2323. [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
  2324. [AVCHROMA_LOC_BOTTOM] = "bottom",
  2325. };
  2326. static enum AVPixelFormat get_pix_fmt_internal(const char *name)
  2327. {
  2328. enum AVPixelFormat pix_fmt;
  2329. for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
  2330. if (av_pix_fmt_descriptors[pix_fmt].name &&
  2331. (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
  2332. av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
  2333. return pix_fmt;
  2334. return AV_PIX_FMT_NONE;
  2335. }
  2336. const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
  2337. {
  2338. return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
  2339. av_pix_fmt_descriptors[pix_fmt].name : NULL;
  2340. }
  2341. #if HAVE_BIGENDIAN
  2342. # define X_NE(be, le) be
  2343. #else
  2344. # define X_NE(be, le) le
  2345. #endif
  2346. enum AVPixelFormat av_get_pix_fmt(const char *name)
  2347. {
  2348. enum AVPixelFormat pix_fmt;
  2349. if (!strcmp(name, "rgb32"))
  2350. name = X_NE("argb", "bgra");
  2351. else if (!strcmp(name, "bgr32"))
  2352. name = X_NE("abgr", "rgba");
  2353. pix_fmt = get_pix_fmt_internal(name);
  2354. if (pix_fmt == AV_PIX_FMT_NONE) {
  2355. char name2[32];
  2356. snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
  2357. pix_fmt = get_pix_fmt_internal(name2);
  2358. }
  2359. #if FF_API_VAAPI
  2360. if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
  2361. pix_fmt = AV_PIX_FMT_VAAPI;
  2362. #endif
  2363. return pix_fmt;
  2364. }
  2365. int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
  2366. {
  2367. int c, bits = 0;
  2368. int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
  2369. for (c = 0; c < pixdesc->nb_components; c++) {
  2370. int s = c == 1 || c == 2 ? 0 : log2_pixels;
  2371. bits += pixdesc->comp[c].depth << s;
  2372. }
  2373. return bits >> log2_pixels;
  2374. }
  2375. int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
  2376. {
  2377. int c, bits = 0;
  2378. int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
  2379. int steps[4] = {0};
  2380. for (c = 0; c < pixdesc->nb_components; c++) {
  2381. const AVComponentDescriptor *comp = &pixdesc->comp[c];
  2382. int s = c == 1 || c == 2 ? 0 : log2_pixels;
  2383. steps[comp->plane] = comp->step << s;
  2384. }
  2385. for (c = 0; c < 4; c++)
  2386. bits += steps[c];
  2387. if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
  2388. bits *= 8;
  2389. return bits >> log2_pixels;
  2390. }
  2391. char *av_get_pix_fmt_string(char *buf, int buf_size,
  2392. enum AVPixelFormat pix_fmt)
  2393. {
  2394. /* print header */
  2395. if (pix_fmt < 0) {
  2396. snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
  2397. } else {
  2398. const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
  2399. snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
  2400. pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
  2401. }
  2402. return buf;
  2403. }
  2404. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  2405. {
  2406. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
  2407. return NULL;
  2408. return &av_pix_fmt_descriptors[pix_fmt];
  2409. }
  2410. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
  2411. {
  2412. if (!prev)
  2413. return &av_pix_fmt_descriptors[0];
  2414. while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
  2415. prev++;
  2416. if (prev->name)
  2417. return prev;
  2418. }
  2419. return NULL;
  2420. }
  2421. enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
  2422. {
  2423. if (desc < av_pix_fmt_descriptors ||
  2424. desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
  2425. return AV_PIX_FMT_NONE;
  2426. return desc - av_pix_fmt_descriptors;
  2427. }
  2428. int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
  2429. int *h_shift, int *v_shift)
  2430. {
  2431. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
  2432. if (!desc)
  2433. return AVERROR(ENOSYS);
  2434. *h_shift = desc->log2_chroma_w;
  2435. *v_shift = desc->log2_chroma_h;
  2436. return 0;
  2437. }
  2438. int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
  2439. {
  2440. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
  2441. int i, planes[4] = { 0 }, ret = 0;
  2442. if (!desc)
  2443. return AVERROR(EINVAL);
  2444. for (i = 0; i < desc->nb_components; i++)
  2445. planes[desc->comp[i].plane] = 1;
  2446. for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
  2447. ret += planes[i];
  2448. return ret;
  2449. }
  2450. void ff_check_pixfmt_descriptors(void){
  2451. int i, j;
  2452. for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
  2453. const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
  2454. uint8_t fill[4][8+6+3] = {{0}};
  2455. uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
  2456. int linesize[4] = {0,0,0,0};
  2457. uint16_t tmp[2];
  2458. if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
  2459. continue;
  2460. // av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
  2461. av_assert0(d->log2_chroma_w <= 3);
  2462. av_assert0(d->log2_chroma_h <= 3);
  2463. av_assert0(d->nb_components <= 4);
  2464. av_assert0(d->name && d->name[0]);
  2465. av_assert2(av_get_pix_fmt(d->name) == i);
  2466. for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
  2467. const AVComponentDescriptor *c = &d->comp[j];
  2468. if(j>=d->nb_components) {
  2469. av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
  2470. continue;
  2471. }
  2472. if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
  2473. av_assert0(c->step >= c->depth);
  2474. } else {
  2475. av_assert0(8*c->step >= c->depth);
  2476. }
  2477. if (d->flags & AV_PIX_FMT_FLAG_BAYER)
  2478. continue;
  2479. av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
  2480. av_assert0(tmp[0] == 0 && tmp[1] == 0);
  2481. tmp[0] = tmp[1] = (1<<c->depth) - 1;
  2482. av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
  2483. }
  2484. }
  2485. }
  2486. enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
  2487. {
  2488. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
  2489. char name[16];
  2490. int i;
  2491. if (!desc || strlen(desc->name) < 2)
  2492. return AV_PIX_FMT_NONE;
  2493. av_strlcpy(name, desc->name, sizeof(name));
  2494. i = strlen(name) - 2;
  2495. if (strcmp(name + i, "be") && strcmp(name + i, "le"))
  2496. return AV_PIX_FMT_NONE;
  2497. name[i] ^= 'b' ^ 'l';
  2498. return get_pix_fmt_internal(name);
  2499. }
  2500. #define FF_COLOR_NA -1
  2501. #define FF_COLOR_RGB 0 /**< RGB color space */
  2502. #define FF_COLOR_GRAY 1 /**< gray color space */
  2503. #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
  2504. #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
  2505. #define FF_COLOR_XYZ 4
  2506. #define pixdesc_has_alpha(pixdesc) \
  2507. ((pixdesc)->flags & AV_PIX_FMT_FLAG_ALPHA)
  2508. static int get_color_type(const AVPixFmtDescriptor *desc) {
  2509. if (desc->flags & AV_PIX_FMT_FLAG_PAL)
  2510. return FF_COLOR_RGB;
  2511. if(desc->nb_components == 1 || desc->nb_components == 2)
  2512. return FF_COLOR_GRAY;
  2513. if(desc->name && !strncmp(desc->name, "yuvj", 4))
  2514. return FF_COLOR_YUV_JPEG;
  2515. if(desc->name && !strncmp(desc->name, "xyz", 3))
  2516. return FF_COLOR_XYZ;
  2517. if(desc->flags & AV_PIX_FMT_FLAG_RGB)
  2518. return FF_COLOR_RGB;
  2519. if(desc->nb_components == 0)
  2520. return FF_COLOR_NA;
  2521. return FF_COLOR_YUV;
  2522. }
  2523. static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
  2524. {
  2525. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
  2526. int i;
  2527. if (!desc || !desc->nb_components) {
  2528. *min = *max = 0;
  2529. return AVERROR(EINVAL);
  2530. }
  2531. *min = INT_MAX, *max = -INT_MAX;
  2532. for (i = 0; i < desc->nb_components; i++) {
  2533. *min = FFMIN(desc->comp[i].depth, *min);
  2534. *max = FFMAX(desc->comp[i].depth, *max);
  2535. }
  2536. return 0;
  2537. }
  2538. static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
  2539. enum AVPixelFormat src_pix_fmt,
  2540. unsigned *lossp, unsigned consider)
  2541. {
  2542. const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
  2543. const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
  2544. int src_color, dst_color;
  2545. int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
  2546. int ret, loss, i, nb_components;
  2547. int score = INT_MAX - 1;
  2548. if (!src_desc || !dst_desc)
  2549. return -4;
  2550. if ((src_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) ||
  2551. (dst_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
  2552. if (dst_pix_fmt == src_pix_fmt)
  2553. return -1;
  2554. else
  2555. return -2;
  2556. }
  2557. /* compute loss */
  2558. *lossp = loss = 0;
  2559. if (dst_pix_fmt == src_pix_fmt)
  2560. return INT_MAX;
  2561. if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
  2562. return -3;
  2563. if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
  2564. return -3;
  2565. src_color = get_color_type(src_desc);
  2566. dst_color = get_color_type(dst_desc);
  2567. if (dst_pix_fmt == AV_PIX_FMT_PAL8)
  2568. nb_components = FFMIN(src_desc->nb_components, 4);
  2569. else
  2570. nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
  2571. for (i = 0; i < nb_components; i++) {
  2572. int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
  2573. if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
  2574. loss |= FF_LOSS_DEPTH;
  2575. score -= 65536 >> depth_minus1;
  2576. }
  2577. }
  2578. if (consider & FF_LOSS_RESOLUTION) {
  2579. if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) {
  2580. loss |= FF_LOSS_RESOLUTION;
  2581. score -= 256 << dst_desc->log2_chroma_w;
  2582. }
  2583. if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) {
  2584. loss |= FF_LOSS_RESOLUTION;
  2585. score -= 256 << dst_desc->log2_chroma_h;
  2586. }
  2587. // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side
  2588. if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 &&
  2589. dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) {
  2590. score += 512;
  2591. }
  2592. }
  2593. if(consider & FF_LOSS_COLORSPACE)
  2594. switch(dst_color) {
  2595. case FF_COLOR_RGB:
  2596. if (src_color != FF_COLOR_RGB &&
  2597. src_color != FF_COLOR_GRAY)
  2598. loss |= FF_LOSS_COLORSPACE;
  2599. break;
  2600. case FF_COLOR_GRAY:
  2601. if (src_color != FF_COLOR_GRAY)
  2602. loss |= FF_LOSS_COLORSPACE;
  2603. break;
  2604. case FF_COLOR_YUV:
  2605. if (src_color != FF_COLOR_YUV)
  2606. loss |= FF_LOSS_COLORSPACE;
  2607. break;
  2608. case FF_COLOR_YUV_JPEG:
  2609. if (src_color != FF_COLOR_YUV_JPEG &&
  2610. src_color != FF_COLOR_YUV &&
  2611. src_color != FF_COLOR_GRAY)
  2612. loss |= FF_LOSS_COLORSPACE;
  2613. break;
  2614. default:
  2615. /* fail safe test */
  2616. if (src_color != dst_color)
  2617. loss |= FF_LOSS_COLORSPACE;
  2618. break;
  2619. }
  2620. if(loss & FF_LOSS_COLORSPACE)
  2621. score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
  2622. if (dst_color == FF_COLOR_GRAY &&
  2623. src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {
  2624. loss |= FF_LOSS_CHROMA;
  2625. score -= 2 * 65536;
  2626. }
  2627. if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
  2628. loss |= FF_LOSS_ALPHA;
  2629. score -= 65536;
  2630. }
  2631. if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
  2632. (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
  2633. loss |= FF_LOSS_COLORQUANT;
  2634. score -= 65536;
  2635. }
  2636. *lossp = loss;
  2637. return score;
  2638. }
  2639. int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
  2640. enum AVPixelFormat src_pix_fmt,
  2641. int has_alpha)
  2642. {
  2643. int loss;
  2644. int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, &loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA);
  2645. if (ret < 0)
  2646. return ret;
  2647. return loss;
  2648. }
  2649. enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
  2650. enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
  2651. {
  2652. enum AVPixelFormat dst_pix_fmt;
  2653. int loss1, loss2, loss_mask;
  2654. const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1);
  2655. const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
  2656. int score1, score2;
  2657. if (!desc1) {
  2658. dst_pix_fmt = dst_pix_fmt2;
  2659. } else if (!desc2) {
  2660. dst_pix_fmt = dst_pix_fmt1;
  2661. } else {
  2662. loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
  2663. if(!has_alpha)
  2664. loss_mask &= ~FF_LOSS_ALPHA;
  2665. score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
  2666. score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
  2667. if (score1 == score2) {
  2668. if(av_get_padded_bits_per_pixel(desc2) != av_get_padded_bits_per_pixel(desc1)) {
  2669. dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
  2670. } else {
  2671. dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
  2672. }
  2673. } else {
  2674. dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
  2675. }
  2676. }
  2677. if (loss_ptr)
  2678. *loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
  2679. return dst_pix_fmt;
  2680. }
  2681. const char *av_color_range_name(enum AVColorRange range)
  2682. {
  2683. return (unsigned) range < AVCOL_RANGE_NB ?
  2684. color_range_names[range] : NULL;
  2685. }
  2686. int av_color_range_from_name(const char *name)
  2687. {
  2688. int i;
  2689. for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
  2690. size_t len = strlen(color_range_names[i]);
  2691. if (!strncmp(color_range_names[i], name, len))
  2692. return i;
  2693. }
  2694. return AVERROR(EINVAL);
  2695. }
  2696. const char *av_color_primaries_name(enum AVColorPrimaries primaries)
  2697. {
  2698. return (unsigned) primaries < AVCOL_PRI_NB ?
  2699. color_primaries_names[primaries] : NULL;
  2700. }
  2701. int av_color_primaries_from_name(const char *name)
  2702. {
  2703. int i;
  2704. for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) {
  2705. size_t len;
  2706. if (!color_primaries_names[i])
  2707. continue;
  2708. len = strlen(color_primaries_names[i]);
  2709. if (!strncmp(color_primaries_names[i], name, len))
  2710. return i;
  2711. }
  2712. return AVERROR(EINVAL);
  2713. }
  2714. const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
  2715. {
  2716. return (unsigned) transfer < AVCOL_TRC_NB ?
  2717. color_transfer_names[transfer] : NULL;
  2718. }
  2719. int av_color_transfer_from_name(const char *name)
  2720. {
  2721. int i;
  2722. for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) {
  2723. size_t len;
  2724. if (!color_transfer_names[i])
  2725. continue;
  2726. len = strlen(color_transfer_names[i]);
  2727. if (!strncmp(color_transfer_names[i], name, len))
  2728. return i;
  2729. }
  2730. return AVERROR(EINVAL);
  2731. }
  2732. const char *av_color_space_name(enum AVColorSpace space)
  2733. {
  2734. return (unsigned) space < AVCOL_SPC_NB ?
  2735. color_space_names[space] : NULL;
  2736. }
  2737. int av_color_space_from_name(const char *name)
  2738. {
  2739. int i;
  2740. for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) {
  2741. size_t len;
  2742. if (!color_space_names[i])
  2743. continue;
  2744. len = strlen(color_space_names[i]);
  2745. if (!strncmp(color_space_names[i], name, len))
  2746. return i;
  2747. }
  2748. return AVERROR(EINVAL);
  2749. }
  2750. const char *av_chroma_location_name(enum AVChromaLocation location)
  2751. {
  2752. return (unsigned) location < AVCHROMA_LOC_NB ?
  2753. chroma_location_names[location] : NULL;
  2754. }
  2755. int av_chroma_location_from_name(const char *name)
  2756. {
  2757. int i;
  2758. for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) {
  2759. size_t len;
  2760. if (!chroma_location_names[i])
  2761. continue;
  2762. len = strlen(chroma_location_names[i]);
  2763. if (!strncmp(chroma_location_names[i], name, len))
  2764. return i;
  2765. }
  2766. return AVERROR(EINVAL);
  2767. }