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

Generated by: LCOV version 1.13