LCOV - code coverage report
Current view: top level - libavutil - pixdesc.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 292 351 83.2 %
Date: 2017-12-15 02:19:58 Functions: 23 30 76.7 %

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

Generated by: LCOV version 1.13