pixdesc.c 95 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961
  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. [AV_PIX_FMT_YUVA422P12BE] = {
  2255. .name = "yuva422p12be",
  2256. .nb_components = 4,
  2257. .log2_chroma_w = 1,
  2258. .log2_chroma_h = 0,
  2259. .comp = {
  2260. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  2261. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
  2262. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
  2263. { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
  2264. },
  2265. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  2266. },
  2267. [AV_PIX_FMT_YUVA422P12LE] = {
  2268. .name = "yuva422p12le",
  2269. .nb_components = 4,
  2270. .log2_chroma_w = 1,
  2271. .log2_chroma_h = 0,
  2272. .comp = {
  2273. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  2274. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
  2275. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
  2276. { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
  2277. },
  2278. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  2279. },
  2280. [AV_PIX_FMT_YUVA444P12BE] = {
  2281. .name = "yuva444p12be",
  2282. .nb_components = 4,
  2283. .log2_chroma_w = 0,
  2284. .log2_chroma_h = 0,
  2285. .comp = {
  2286. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  2287. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
  2288. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
  2289. { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
  2290. },
  2291. .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  2292. },
  2293. [AV_PIX_FMT_YUVA444P12LE] = {
  2294. .name = "yuva444p12le",
  2295. .nb_components = 4,
  2296. .log2_chroma_w = 0,
  2297. .log2_chroma_h = 0,
  2298. .comp = {
  2299. { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
  2300. { 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
  2301. { 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
  2302. { 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
  2303. },
  2304. .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
  2305. },
  2306. [AV_PIX_FMT_NV24] = {
  2307. .name = "nv24",
  2308. .nb_components = 3,
  2309. .log2_chroma_w = 0,
  2310. .log2_chroma_h = 0,
  2311. .comp = {
  2312. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  2313. { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
  2314. { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
  2315. },
  2316. .flags = AV_PIX_FMT_FLAG_PLANAR,
  2317. },
  2318. [AV_PIX_FMT_NV42] = {
  2319. .name = "nv42",
  2320. .nb_components = 3,
  2321. .log2_chroma_w = 0,
  2322. .log2_chroma_h = 0,
  2323. .comp = {
  2324. { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
  2325. { 1, 2, 1, 0, 8, 1, 7, 2 }, /* U */
  2326. { 1, 2, 0, 0, 8, 1, 7, 1 }, /* V */
  2327. },
  2328. .flags = AV_PIX_FMT_FLAG_PLANAR,
  2329. },
  2330. };
  2331. #if FF_API_PLUS1_MINUS1
  2332. FF_ENABLE_DEPRECATION_WARNINGS
  2333. #endif
  2334. static const char * const color_range_names[] = {
  2335. [AVCOL_RANGE_UNSPECIFIED] = "unknown",
  2336. [AVCOL_RANGE_MPEG] = "tv",
  2337. [AVCOL_RANGE_JPEG] = "pc",
  2338. };
  2339. static const char * const color_primaries_names[AVCOL_PRI_NB] = {
  2340. [AVCOL_PRI_RESERVED0] = "reserved",
  2341. [AVCOL_PRI_BT709] = "bt709",
  2342. [AVCOL_PRI_UNSPECIFIED] = "unknown",
  2343. [AVCOL_PRI_RESERVED] = "reserved",
  2344. [AVCOL_PRI_BT470M] = "bt470m",
  2345. [AVCOL_PRI_BT470BG] = "bt470bg",
  2346. [AVCOL_PRI_SMPTE170M] = "smpte170m",
  2347. [AVCOL_PRI_SMPTE240M] = "smpte240m",
  2348. [AVCOL_PRI_FILM] = "film",
  2349. [AVCOL_PRI_BT2020] = "bt2020",
  2350. [AVCOL_PRI_SMPTE428] = "smpte428",
  2351. [AVCOL_PRI_SMPTE431] = "smpte431",
  2352. [AVCOL_PRI_SMPTE432] = "smpte432",
  2353. [AVCOL_PRI_JEDEC_P22] = "jedec-p22",
  2354. };
  2355. static const char * const color_transfer_names[] = {
  2356. [AVCOL_TRC_RESERVED0] = "reserved",
  2357. [AVCOL_TRC_BT709] = "bt709",
  2358. [AVCOL_TRC_UNSPECIFIED] = "unknown",
  2359. [AVCOL_TRC_RESERVED] = "reserved",
  2360. [AVCOL_TRC_GAMMA22] = "bt470m",
  2361. [AVCOL_TRC_GAMMA28] = "bt470bg",
  2362. [AVCOL_TRC_SMPTE170M] = "smpte170m",
  2363. [AVCOL_TRC_SMPTE240M] = "smpte240m",
  2364. [AVCOL_TRC_LINEAR] = "linear",
  2365. [AVCOL_TRC_LOG] = "log100",
  2366. [AVCOL_TRC_LOG_SQRT] = "log316",
  2367. [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
  2368. [AVCOL_TRC_BT1361_ECG] = "bt1361e",
  2369. [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
  2370. [AVCOL_TRC_BT2020_10] = "bt2020-10",
  2371. [AVCOL_TRC_BT2020_12] = "bt2020-12",
  2372. [AVCOL_TRC_SMPTE2084] = "smpte2084",
  2373. [AVCOL_TRC_SMPTE428] = "smpte428",
  2374. [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
  2375. };
  2376. static const char * const color_space_names[] = {
  2377. [AVCOL_SPC_RGB] = "gbr",
  2378. [AVCOL_SPC_BT709] = "bt709",
  2379. [AVCOL_SPC_UNSPECIFIED] = "unknown",
  2380. [AVCOL_SPC_RESERVED] = "reserved",
  2381. [AVCOL_SPC_FCC] = "fcc",
  2382. [AVCOL_SPC_BT470BG] = "bt470bg",
  2383. [AVCOL_SPC_SMPTE170M] = "smpte170m",
  2384. [AVCOL_SPC_SMPTE240M] = "smpte240m",
  2385. [AVCOL_SPC_YCGCO] = "ycgco",
  2386. [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
  2387. [AVCOL_SPC_BT2020_CL] = "bt2020c",
  2388. [AVCOL_SPC_SMPTE2085] = "smpte2085",
  2389. [AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc",
  2390. [AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c",
  2391. [AVCOL_SPC_ICTCP] = "ictcp",
  2392. };
  2393. static const char * const chroma_location_names[] = {
  2394. [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
  2395. [AVCHROMA_LOC_LEFT] = "left",
  2396. [AVCHROMA_LOC_CENTER] = "center",
  2397. [AVCHROMA_LOC_TOPLEFT] = "topleft",
  2398. [AVCHROMA_LOC_TOP] = "top",
  2399. [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
  2400. [AVCHROMA_LOC_BOTTOM] = "bottom",
  2401. };
  2402. static enum AVPixelFormat get_pix_fmt_internal(const char *name)
  2403. {
  2404. enum AVPixelFormat pix_fmt;
  2405. for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
  2406. if (av_pix_fmt_descriptors[pix_fmt].name &&
  2407. (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
  2408. av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
  2409. return pix_fmt;
  2410. return AV_PIX_FMT_NONE;
  2411. }
  2412. const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
  2413. {
  2414. return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
  2415. av_pix_fmt_descriptors[pix_fmt].name : NULL;
  2416. }
  2417. #if HAVE_BIGENDIAN
  2418. # define X_NE(be, le) be
  2419. #else
  2420. # define X_NE(be, le) le
  2421. #endif
  2422. enum AVPixelFormat av_get_pix_fmt(const char *name)
  2423. {
  2424. enum AVPixelFormat pix_fmt;
  2425. if (!strcmp(name, "rgb32"))
  2426. name = X_NE("argb", "bgra");
  2427. else if (!strcmp(name, "bgr32"))
  2428. name = X_NE("abgr", "rgba");
  2429. pix_fmt = get_pix_fmt_internal(name);
  2430. if (pix_fmt == AV_PIX_FMT_NONE) {
  2431. char name2[32];
  2432. snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
  2433. pix_fmt = get_pix_fmt_internal(name2);
  2434. }
  2435. #if FF_API_VAAPI
  2436. if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
  2437. pix_fmt = AV_PIX_FMT_VAAPI;
  2438. #endif
  2439. return pix_fmt;
  2440. }
  2441. int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
  2442. {
  2443. int c, bits = 0;
  2444. int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
  2445. for (c = 0; c < pixdesc->nb_components; c++) {
  2446. int s = c == 1 || c == 2 ? 0 : log2_pixels;
  2447. bits += pixdesc->comp[c].depth << s;
  2448. }
  2449. return bits >> log2_pixels;
  2450. }
  2451. int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
  2452. {
  2453. int c, bits = 0;
  2454. int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
  2455. int steps[4] = {0};
  2456. for (c = 0; c < pixdesc->nb_components; c++) {
  2457. const AVComponentDescriptor *comp = &pixdesc->comp[c];
  2458. int s = c == 1 || c == 2 ? 0 : log2_pixels;
  2459. steps[comp->plane] = comp->step << s;
  2460. }
  2461. for (c = 0; c < 4; c++)
  2462. bits += steps[c];
  2463. if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
  2464. bits *= 8;
  2465. return bits >> log2_pixels;
  2466. }
  2467. char *av_get_pix_fmt_string(char *buf, int buf_size,
  2468. enum AVPixelFormat pix_fmt)
  2469. {
  2470. /* print header */
  2471. if (pix_fmt < 0) {
  2472. snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
  2473. } else {
  2474. const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
  2475. snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
  2476. pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
  2477. }
  2478. return buf;
  2479. }
  2480. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  2481. {
  2482. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
  2483. return NULL;
  2484. return &av_pix_fmt_descriptors[pix_fmt];
  2485. }
  2486. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
  2487. {
  2488. if (!prev)
  2489. return &av_pix_fmt_descriptors[0];
  2490. while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
  2491. prev++;
  2492. if (prev->name)
  2493. return prev;
  2494. }
  2495. return NULL;
  2496. }
  2497. enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
  2498. {
  2499. if (desc < av_pix_fmt_descriptors ||
  2500. desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
  2501. return AV_PIX_FMT_NONE;
  2502. return desc - av_pix_fmt_descriptors;
  2503. }
  2504. int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
  2505. int *h_shift, int *v_shift)
  2506. {
  2507. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
  2508. if (!desc)
  2509. return AVERROR(ENOSYS);
  2510. *h_shift = desc->log2_chroma_w;
  2511. *v_shift = desc->log2_chroma_h;
  2512. return 0;
  2513. }
  2514. int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
  2515. {
  2516. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
  2517. int i, planes[4] = { 0 }, ret = 0;
  2518. if (!desc)
  2519. return AVERROR(EINVAL);
  2520. for (i = 0; i < desc->nb_components; i++)
  2521. planes[desc->comp[i].plane] = 1;
  2522. for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
  2523. ret += planes[i];
  2524. return ret;
  2525. }
  2526. void ff_check_pixfmt_descriptors(void){
  2527. int i, j;
  2528. for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
  2529. const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
  2530. uint8_t fill[4][8+6+3] = {{0}};
  2531. uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
  2532. int linesize[4] = {0,0,0,0};
  2533. uint16_t tmp[2];
  2534. if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
  2535. continue;
  2536. // av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
  2537. av_assert0(d->log2_chroma_w <= 3);
  2538. av_assert0(d->log2_chroma_h <= 3);
  2539. av_assert0(d->nb_components <= 4);
  2540. av_assert0(d->name && d->name[0]);
  2541. av_assert2(av_get_pix_fmt(d->name) == i);
  2542. for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
  2543. const AVComponentDescriptor *c = &d->comp[j];
  2544. if(j>=d->nb_components) {
  2545. av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
  2546. continue;
  2547. }
  2548. if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
  2549. av_assert0(c->step >= c->depth);
  2550. } else {
  2551. av_assert0(8*c->step >= c->depth);
  2552. }
  2553. if (d->flags & AV_PIX_FMT_FLAG_BAYER)
  2554. continue;
  2555. av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
  2556. av_assert0(tmp[0] == 0 && tmp[1] == 0);
  2557. tmp[0] = tmp[1] = (1<<c->depth) - 1;
  2558. av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
  2559. }
  2560. }
  2561. }
  2562. enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
  2563. {
  2564. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
  2565. char name[16];
  2566. int i;
  2567. if (!desc || strlen(desc->name) < 2)
  2568. return AV_PIX_FMT_NONE;
  2569. av_strlcpy(name, desc->name, sizeof(name));
  2570. i = strlen(name) - 2;
  2571. if (strcmp(name + i, "be") && strcmp(name + i, "le"))
  2572. return AV_PIX_FMT_NONE;
  2573. name[i] ^= 'b' ^ 'l';
  2574. return get_pix_fmt_internal(name);
  2575. }
  2576. #define FF_COLOR_NA -1
  2577. #define FF_COLOR_RGB 0 /**< RGB color space */
  2578. #define FF_COLOR_GRAY 1 /**< gray color space */
  2579. #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
  2580. #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
  2581. #define FF_COLOR_XYZ 4
  2582. #define pixdesc_has_alpha(pixdesc) \
  2583. ((pixdesc)->flags & AV_PIX_FMT_FLAG_ALPHA)
  2584. static int get_color_type(const AVPixFmtDescriptor *desc) {
  2585. if (desc->flags & AV_PIX_FMT_FLAG_PAL)
  2586. return FF_COLOR_RGB;
  2587. if(desc->nb_components == 1 || desc->nb_components == 2)
  2588. return FF_COLOR_GRAY;
  2589. if(desc->name && !strncmp(desc->name, "yuvj", 4))
  2590. return FF_COLOR_YUV_JPEG;
  2591. if(desc->name && !strncmp(desc->name, "xyz", 3))
  2592. return FF_COLOR_XYZ;
  2593. if(desc->flags & AV_PIX_FMT_FLAG_RGB)
  2594. return FF_COLOR_RGB;
  2595. if(desc->nb_components == 0)
  2596. return FF_COLOR_NA;
  2597. return FF_COLOR_YUV;
  2598. }
  2599. static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
  2600. {
  2601. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
  2602. int i;
  2603. if (!desc || !desc->nb_components) {
  2604. *min = *max = 0;
  2605. return AVERROR(EINVAL);
  2606. }
  2607. *min = INT_MAX, *max = -INT_MAX;
  2608. for (i = 0; i < desc->nb_components; i++) {
  2609. *min = FFMIN(desc->comp[i].depth, *min);
  2610. *max = FFMAX(desc->comp[i].depth, *max);
  2611. }
  2612. return 0;
  2613. }
  2614. static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
  2615. enum AVPixelFormat src_pix_fmt,
  2616. unsigned *lossp, unsigned consider)
  2617. {
  2618. const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
  2619. const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
  2620. int src_color, dst_color;
  2621. int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
  2622. int ret, loss, i, nb_components;
  2623. int score = INT_MAX - 1;
  2624. if (!src_desc || !dst_desc)
  2625. return -4;
  2626. if ((src_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) ||
  2627. (dst_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
  2628. if (dst_pix_fmt == src_pix_fmt)
  2629. return -1;
  2630. else
  2631. return -2;
  2632. }
  2633. /* compute loss */
  2634. *lossp = loss = 0;
  2635. if (dst_pix_fmt == src_pix_fmt)
  2636. return INT_MAX;
  2637. if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
  2638. return -3;
  2639. if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
  2640. return -3;
  2641. src_color = get_color_type(src_desc);
  2642. dst_color = get_color_type(dst_desc);
  2643. if (dst_pix_fmt == AV_PIX_FMT_PAL8)
  2644. nb_components = FFMIN(src_desc->nb_components, 4);
  2645. else
  2646. nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
  2647. for (i = 0; i < nb_components; i++) {
  2648. int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
  2649. if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
  2650. loss |= FF_LOSS_DEPTH;
  2651. score -= 65536 >> depth_minus1;
  2652. }
  2653. }
  2654. if (consider & FF_LOSS_RESOLUTION) {
  2655. if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) {
  2656. loss |= FF_LOSS_RESOLUTION;
  2657. score -= 256 << dst_desc->log2_chroma_w;
  2658. }
  2659. if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) {
  2660. loss |= FF_LOSS_RESOLUTION;
  2661. score -= 256 << dst_desc->log2_chroma_h;
  2662. }
  2663. // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side
  2664. if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 &&
  2665. dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) {
  2666. score += 512;
  2667. }
  2668. }
  2669. if(consider & FF_LOSS_COLORSPACE)
  2670. switch(dst_color) {
  2671. case FF_COLOR_RGB:
  2672. if (src_color != FF_COLOR_RGB &&
  2673. src_color != FF_COLOR_GRAY)
  2674. loss |= FF_LOSS_COLORSPACE;
  2675. break;
  2676. case FF_COLOR_GRAY:
  2677. if (src_color != FF_COLOR_GRAY)
  2678. loss |= FF_LOSS_COLORSPACE;
  2679. break;
  2680. case FF_COLOR_YUV:
  2681. if (src_color != FF_COLOR_YUV)
  2682. loss |= FF_LOSS_COLORSPACE;
  2683. break;
  2684. case FF_COLOR_YUV_JPEG:
  2685. if (src_color != FF_COLOR_YUV_JPEG &&
  2686. src_color != FF_COLOR_YUV &&
  2687. src_color != FF_COLOR_GRAY)
  2688. loss |= FF_LOSS_COLORSPACE;
  2689. break;
  2690. default:
  2691. /* fail safe test */
  2692. if (src_color != dst_color)
  2693. loss |= FF_LOSS_COLORSPACE;
  2694. break;
  2695. }
  2696. if(loss & FF_LOSS_COLORSPACE)
  2697. score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
  2698. if (dst_color == FF_COLOR_GRAY &&
  2699. src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {
  2700. loss |= FF_LOSS_CHROMA;
  2701. score -= 2 * 65536;
  2702. }
  2703. if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
  2704. loss |= FF_LOSS_ALPHA;
  2705. score -= 65536;
  2706. }
  2707. if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
  2708. (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
  2709. loss |= FF_LOSS_COLORQUANT;
  2710. score -= 65536;
  2711. }
  2712. *lossp = loss;
  2713. return score;
  2714. }
  2715. int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
  2716. enum AVPixelFormat src_pix_fmt,
  2717. int has_alpha)
  2718. {
  2719. int loss;
  2720. int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, &loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA);
  2721. if (ret < 0)
  2722. return ret;
  2723. return loss;
  2724. }
  2725. enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
  2726. enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
  2727. {
  2728. enum AVPixelFormat dst_pix_fmt;
  2729. int loss1, loss2, loss_mask;
  2730. const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1);
  2731. const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
  2732. int score1, score2;
  2733. if (!desc1) {
  2734. dst_pix_fmt = dst_pix_fmt2;
  2735. } else if (!desc2) {
  2736. dst_pix_fmt = dst_pix_fmt1;
  2737. } else {
  2738. loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
  2739. if(!has_alpha)
  2740. loss_mask &= ~FF_LOSS_ALPHA;
  2741. score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
  2742. score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
  2743. if (score1 == score2) {
  2744. if(av_get_padded_bits_per_pixel(desc2) != av_get_padded_bits_per_pixel(desc1)) {
  2745. dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
  2746. } else {
  2747. dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
  2748. }
  2749. } else {
  2750. dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
  2751. }
  2752. }
  2753. if (loss_ptr)
  2754. *loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
  2755. return dst_pix_fmt;
  2756. }
  2757. const char *av_color_range_name(enum AVColorRange range)
  2758. {
  2759. return (unsigned) range < AVCOL_RANGE_NB ?
  2760. color_range_names[range] : NULL;
  2761. }
  2762. int av_color_range_from_name(const char *name)
  2763. {
  2764. int i;
  2765. for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
  2766. size_t len = strlen(color_range_names[i]);
  2767. if (!strncmp(color_range_names[i], name, len))
  2768. return i;
  2769. }
  2770. return AVERROR(EINVAL);
  2771. }
  2772. const char *av_color_primaries_name(enum AVColorPrimaries primaries)
  2773. {
  2774. return (unsigned) primaries < AVCOL_PRI_NB ?
  2775. color_primaries_names[primaries] : NULL;
  2776. }
  2777. int av_color_primaries_from_name(const char *name)
  2778. {
  2779. int i;
  2780. for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) {
  2781. size_t len;
  2782. if (!color_primaries_names[i])
  2783. continue;
  2784. len = strlen(color_primaries_names[i]);
  2785. if (!strncmp(color_primaries_names[i], name, len))
  2786. return i;
  2787. }
  2788. return AVERROR(EINVAL);
  2789. }
  2790. const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
  2791. {
  2792. return (unsigned) transfer < AVCOL_TRC_NB ?
  2793. color_transfer_names[transfer] : NULL;
  2794. }
  2795. int av_color_transfer_from_name(const char *name)
  2796. {
  2797. int i;
  2798. for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) {
  2799. size_t len;
  2800. if (!color_transfer_names[i])
  2801. continue;
  2802. len = strlen(color_transfer_names[i]);
  2803. if (!strncmp(color_transfer_names[i], name, len))
  2804. return i;
  2805. }
  2806. return AVERROR(EINVAL);
  2807. }
  2808. const char *av_color_space_name(enum AVColorSpace space)
  2809. {
  2810. return (unsigned) space < AVCOL_SPC_NB ?
  2811. color_space_names[space] : NULL;
  2812. }
  2813. int av_color_space_from_name(const char *name)
  2814. {
  2815. int i;
  2816. for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) {
  2817. size_t len;
  2818. if (!color_space_names[i])
  2819. continue;
  2820. len = strlen(color_space_names[i]);
  2821. if (!strncmp(color_space_names[i], name, len))
  2822. return i;
  2823. }
  2824. return AVERROR(EINVAL);
  2825. }
  2826. const char *av_chroma_location_name(enum AVChromaLocation location)
  2827. {
  2828. return (unsigned) location < AVCHROMA_LOC_NB ?
  2829. chroma_location_names[location] : NULL;
  2830. }
  2831. int av_chroma_location_from_name(const char *name)
  2832. {
  2833. int i;
  2834. for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) {
  2835. size_t len;
  2836. if (!chroma_location_names[i])
  2837. continue;
  2838. len = strlen(chroma_location_names[i]);
  2839. if (!strncmp(chroma_location_names[i], name, len))
  2840. return i;
  2841. }
  2842. return AVERROR(EINVAL);
  2843. }