LCOV - code coverage report
Current view: top level - src/libavutil - pixdesc.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 279 307 90.9 %
Date: 2017-01-21 09:32:20 Functions: 23 25 92.0 %

          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      578625 : 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      578625 :     AVComponentDescriptor comp = desc->comp[c];
      41      578625 :     int plane = comp.plane;
      42      578625 :     int depth = comp.depth;
      43      578625 :     int mask  = (1 << depth) - 1;
      44      578625 :     int shift = comp.shift;
      45      578625 :     int step  = comp.step;
      46      578625 :     int flags = desc->flags;
      47             : 
      48      578625 :     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     1727211 :         const uint8_t *p = data[plane] + y * linesize[plane] +
      64     1151474 :                            x * step + comp.offset;
      65      575737 :         int is_8bit = shift + depth <= 8;
      66             : 
      67      575737 :         if (is_8bit)
      68      195271 :             p += !!(flags & AV_PIX_FMT_FLAG_BE);
      69             : 
      70   184959748 :         while (w--) {
      71   304953206 :             int val = is_8bit ? *p :
      72   121144932 :                 flags & AV_PIX_FMT_FLAG_BE ? AV_RB16(p) : AV_RL16(p);
      73   183808274 :             val = (val >> shift) & mask;
      74   183808274 :             if (read_pal_component)
      75           0 :                 val = data[1][4 * val + c];
      76   183808274 :             p += step;
      77   183808274 :             *dst++ = val;
      78             :         }
      79             :     }
      80      578625 : }
      81             : 
      82      578625 : 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      578625 :     AVComponentDescriptor comp = desc->comp[c];
      88      578625 :     int plane = comp.plane;
      89      578625 :     int depth = comp.depth;
      90      578625 :     int step  = comp.step;
      91      578625 :     int flags = desc->flags;
      92             : 
      93      578625 :     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      575737 :         int shift = comp.shift;
     106     1727211 :         uint8_t *p = data[plane] + y * linesize[plane] +
     107     1151474 :                      x * step + comp.offset;
     108             : 
     109      575737 :         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   121905864 :             while (w--) {
     117   121144932 :                 if (flags & AV_PIX_FMT_FLAG_BE) {
     118    59558706 :                     uint16_t val = AV_RB16(p) | (*src++ << shift);
     119    59558706 :                     AV_WB16(p, val);
     120             :                 } else {
     121    61586226 :                     uint16_t val = AV_RL16(p) | (*src++ << shift);
     122    61586226 :                     AV_WL16(p, val);
     123             :                 }
     124   121144932 :                 p += step;
     125             :             }
     126             :         }
     127             :     }
     128      578625 : }
     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_GRAY10BE] = {
     564             :         .name = "gray10be",
     565             :         .nb_components = 1,
     566             :         .log2_chroma_w = 0,
     567             :         .log2_chroma_h = 0,
     568             :         .comp = {
     569             :             { 0, 2, 0, 0, 10, 1, 9, 1 },       /* Y */
     570             :         },
     571             :         .flags = AV_PIX_FMT_FLAG_BE,
     572             :         .alias = "y10be",
     573             :     },
     574             :     [AV_PIX_FMT_GRAY10LE] = {
     575             :         .name = "gray10le",
     576             :         .nb_components = 1,
     577             :         .log2_chroma_w = 0,
     578             :         .log2_chroma_h = 0,
     579             :         .comp = {
     580             :             { 0, 2, 0, 0, 10, 1, 9, 1 },       /* Y */
     581             :         },
     582             :         .alias = "y10le",
     583             :     },
     584             :     [AV_PIX_FMT_GRAY12BE] = {
     585             :         .name = "gray12be",
     586             :         .nb_components = 1,
     587             :         .log2_chroma_w = 0,
     588             :         .log2_chroma_h = 0,
     589             :         .comp = {
     590             :             { 0, 2, 0, 0, 12, 1, 11, 1 },       /* Y */
     591             :         },
     592             :         .flags = AV_PIX_FMT_FLAG_BE,
     593             :         .alias = "y12be",
     594             :     },
     595             :     [AV_PIX_FMT_GRAY12LE] = {
     596             :         .name = "gray12le",
     597             :         .nb_components = 1,
     598             :         .log2_chroma_w = 0,
     599             :         .log2_chroma_h = 0,
     600             :         .comp = {
     601             :             { 0, 2, 0, 0, 12, 1, 11, 1 },       /* Y */
     602             :         },
     603             :         .alias = "y12le",
     604             :     },
     605             :     [AV_PIX_FMT_GRAY16BE] = {
     606             :         .name = "gray16be",
     607             :         .nb_components = 1,
     608             :         .log2_chroma_w = 0,
     609             :         .log2_chroma_h = 0,
     610             :         .comp = {
     611             :             { 0, 2, 0, 0, 16, 1, 15, 1 },       /* Y */
     612             :         },
     613             :         .flags = AV_PIX_FMT_FLAG_BE,
     614             :         .alias = "y16be",
     615             :     },
     616             :     [AV_PIX_FMT_GRAY16LE] = {
     617             :         .name = "gray16le",
     618             :         .nb_components = 1,
     619             :         .log2_chroma_w = 0,
     620             :         .log2_chroma_h = 0,
     621             :         .comp = {
     622             :             { 0, 2, 0, 0, 16, 1, 15, 1 },       /* Y */
     623             :         },
     624             :         .alias = "y16le",
     625             :     },
     626             :     [AV_PIX_FMT_YUV440P] = {
     627             :         .name = "yuv440p",
     628             :         .nb_components = 3,
     629             :         .log2_chroma_w = 0,
     630             :         .log2_chroma_h = 1,
     631             :         .comp = {
     632             :             { 0, 1, 0, 0, 8, 0, 7, 1 },        /* Y */
     633             :             { 1, 1, 0, 0, 8, 0, 7, 1 },        /* U */
     634             :             { 2, 1, 0, 0, 8, 0, 7, 1 },        /* V */
     635             :         },
     636             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
     637             :     },
     638             :     [AV_PIX_FMT_YUVJ440P] = {
     639             :         .name = "yuvj440p",
     640             :         .nb_components = 3,
     641             :         .log2_chroma_w = 0,
     642             :         .log2_chroma_h = 1,
     643             :         .comp = {
     644             :             { 0, 1, 0, 0, 8, 0, 7, 1 },        /* Y */
     645             :             { 1, 1, 0, 0, 8, 0, 7, 1 },        /* U */
     646             :             { 2, 1, 0, 0, 8, 0, 7, 1 },        /* V */
     647             :         },
     648             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
     649             :     },
     650             :     [AV_PIX_FMT_YUV440P10LE] = {
     651             :         .name = "yuv440p10le",
     652             :         .nb_components = 3,
     653             :         .log2_chroma_w = 0,
     654             :         .log2_chroma_h = 1,
     655             :         .comp = {
     656             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
     657             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
     658             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
     659             :         },
     660             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
     661             :     },
     662             :     [AV_PIX_FMT_YUV440P10BE] = {
     663             :         .name = "yuv440p10be",
     664             :         .nb_components = 3,
     665             :         .log2_chroma_w = 0,
     666             :         .log2_chroma_h = 1,
     667             :         .comp = {
     668             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
     669             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
     670             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
     671             :         },
     672             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
     673             :     },
     674             :     [AV_PIX_FMT_YUV440P12LE] = {
     675             :         .name = "yuv440p12le",
     676             :         .nb_components = 3,
     677             :         .log2_chroma_w = 0,
     678             :         .log2_chroma_h = 1,
     679             :         .comp = {
     680             :             { 0, 2, 0, 0, 12, 1, 11, 1 },        /* Y */
     681             :             { 1, 2, 0, 0, 12, 1, 11, 1 },        /* U */
     682             :             { 2, 2, 0, 0, 12, 1, 11, 1 },        /* V */
     683             :         },
     684             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
     685             :     },
     686             :     [AV_PIX_FMT_YUV440P12BE] = {
     687             :         .name = "yuv440p12be",
     688             :         .nb_components = 3,
     689             :         .log2_chroma_w = 0,
     690             :         .log2_chroma_h = 1,
     691             :         .comp = {
     692             :             { 0, 2, 0, 0, 12, 1, 11, 1 },        /* Y */
     693             :             { 1, 2, 0, 0, 12, 1, 11, 1 },        /* U */
     694             :             { 2, 2, 0, 0, 12, 1, 11, 1 },        /* V */
     695             :         },
     696             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
     697             :     },
     698             :     [AV_PIX_FMT_YUVA420P] = {
     699             :         .name = "yuva420p",
     700             :         .nb_components = 4,
     701             :         .log2_chroma_w = 1,
     702             :         .log2_chroma_h = 1,
     703             :         .comp = {
     704             :             { 0, 1, 0, 0, 8, 0, 7, 1 },        /* Y */
     705             :             { 1, 1, 0, 0, 8, 0, 7, 1 },        /* U */
     706             :             { 2, 1, 0, 0, 8, 0, 7, 1 },        /* V */
     707             :             { 3, 1, 0, 0, 8, 0, 7, 1 },        /* A */
     708             :         },
     709             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     710             :     },
     711             :     [AV_PIX_FMT_YUVA422P] = {
     712             :         .name = "yuva422p",
     713             :         .nb_components = 4,
     714             :         .log2_chroma_w = 1,
     715             :         .log2_chroma_h = 0,
     716             :         .comp = {
     717             :             { 0, 1, 0, 0, 8, 0, 7, 1 },        /* Y */
     718             :             { 1, 1, 0, 0, 8, 0, 7, 1 },        /* U */
     719             :             { 2, 1, 0, 0, 8, 0, 7, 1 },        /* V */
     720             :             { 3, 1, 0, 0, 8, 0, 7, 1 },        /* A */
     721             :         },
     722             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     723             :     },
     724             :     [AV_PIX_FMT_YUVA444P] = {
     725             :         .name = "yuva444p",
     726             :         .nb_components = 4,
     727             :         .log2_chroma_w = 0,
     728             :         .log2_chroma_h = 0,
     729             :         .comp = {
     730             :             { 0, 1, 0, 0, 8, 0, 7, 1 },        /* Y */
     731             :             { 1, 1, 0, 0, 8, 0, 7, 1 },        /* U */
     732             :             { 2, 1, 0, 0, 8, 0, 7, 1 },        /* V */
     733             :             { 3, 1, 0, 0, 8, 0, 7, 1 },        /* A */
     734             :         },
     735             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     736             :     },
     737             :     [AV_PIX_FMT_YUVA420P9BE] = {
     738             :         .name = "yuva420p9be",
     739             :         .nb_components = 4,
     740             :         .log2_chroma_w = 1,
     741             :         .log2_chroma_h = 1,
     742             :         .comp = {
     743             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* Y */
     744             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* U */
     745             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* V */
     746             :             { 3, 2, 0, 0, 9, 1, 8, 1 },        /* A */
     747             :         },
     748             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     749             :     },
     750             :     [AV_PIX_FMT_YUVA420P9LE] = {
     751             :         .name = "yuva420p9le",
     752             :         .nb_components = 4,
     753             :         .log2_chroma_w = 1,
     754             :         .log2_chroma_h = 1,
     755             :         .comp = {
     756             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* Y */
     757             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* U */
     758             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* V */
     759             :             { 3, 2, 0, 0, 9, 1, 8, 1 },        /* A */
     760             :         },
     761             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     762             :     },
     763             :     [AV_PIX_FMT_YUVA422P9BE] = {
     764             :         .name = "yuva422p9be",
     765             :         .nb_components = 4,
     766             :         .log2_chroma_w = 1,
     767             :         .log2_chroma_h = 0,
     768             :         .comp = {
     769             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* Y */
     770             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* U */
     771             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* V */
     772             :             { 3, 2, 0, 0, 9, 1, 8, 1 },        /* A */
     773             :         },
     774             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     775             :     },
     776             :     [AV_PIX_FMT_YUVA422P9LE] = {
     777             :         .name = "yuva422p9le",
     778             :         .nb_components = 4,
     779             :         .log2_chroma_w = 1,
     780             :         .log2_chroma_h = 0,
     781             :         .comp = {
     782             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* Y */
     783             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* U */
     784             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* V */
     785             :             { 3, 2, 0, 0, 9, 1, 8, 1 },        /* A */
     786             :         },
     787             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     788             :     },
     789             :     [AV_PIX_FMT_YUVA444P9BE] = {
     790             :         .name = "yuva444p9be",
     791             :         .nb_components = 4,
     792             :         .log2_chroma_w = 0,
     793             :         .log2_chroma_h = 0,
     794             :         .comp = {
     795             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* Y */
     796             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* U */
     797             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* V */
     798             :             { 3, 2, 0, 0, 9, 1, 8, 1 },        /* A */
     799             :         },
     800             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     801             :     },
     802             :     [AV_PIX_FMT_YUVA444P9LE] = {
     803             :         .name = "yuva444p9le",
     804             :         .nb_components = 4,
     805             :         .log2_chroma_w = 0,
     806             :         .log2_chroma_h = 0,
     807             :         .comp = {
     808             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* Y */
     809             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* U */
     810             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* V */
     811             :             { 3, 2, 0, 0, 9, 1, 8, 1 },        /* A */
     812             :         },
     813             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     814             :     },
     815             :     [AV_PIX_FMT_YUVA420P10BE] = {
     816             :         .name = "yuva420p10be",
     817             :         .nb_components = 4,
     818             :         .log2_chroma_w = 1,
     819             :         .log2_chroma_h = 1,
     820             :         .comp = {
     821             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
     822             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
     823             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
     824             :             { 3, 2, 0, 0, 10, 1, 9, 1 },        /* A */
     825             :         },
     826             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     827             :     },
     828             :     [AV_PIX_FMT_YUVA420P10LE] = {
     829             :         .name = "yuva420p10le",
     830             :         .nb_components = 4,
     831             :         .log2_chroma_w = 1,
     832             :         .log2_chroma_h = 1,
     833             :         .comp = {
     834             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
     835             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
     836             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
     837             :             { 3, 2, 0, 0, 10, 1, 9, 1 },        /* A */
     838             :         },
     839             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     840             :     },
     841             :     [AV_PIX_FMT_YUVA422P10BE] = {
     842             :         .name = "yuva422p10be",
     843             :         .nb_components = 4,
     844             :         .log2_chroma_w = 1,
     845             :         .log2_chroma_h = 0,
     846             :         .comp = {
     847             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
     848             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
     849             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
     850             :             { 3, 2, 0, 0, 10, 1, 9, 1 },        /* A */
     851             :         },
     852             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     853             :     },
     854             :     [AV_PIX_FMT_YUVA422P10LE] = {
     855             :         .name = "yuva422p10le",
     856             :         .nb_components = 4,
     857             :         .log2_chroma_w = 1,
     858             :         .log2_chroma_h = 0,
     859             :         .comp = {
     860             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
     861             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
     862             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
     863             :             { 3, 2, 0, 0, 10, 1, 9, 1 },        /* A */
     864             :         },
     865             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     866             :     },
     867             :     [AV_PIX_FMT_YUVA444P10BE] = {
     868             :         .name = "yuva444p10be",
     869             :         .nb_components = 4,
     870             :         .log2_chroma_w = 0,
     871             :         .log2_chroma_h = 0,
     872             :         .comp = {
     873             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
     874             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
     875             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
     876             :             { 3, 2, 0, 0, 10, 1, 9, 1 },        /* A */
     877             :         },
     878             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     879             :     },
     880             :     [AV_PIX_FMT_YUVA444P10LE] = {
     881             :         .name = "yuva444p10le",
     882             :         .nb_components = 4,
     883             :         .log2_chroma_w = 0,
     884             :         .log2_chroma_h = 0,
     885             :         .comp = {
     886             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
     887             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
     888             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
     889             :             { 3, 2, 0, 0, 10, 1, 9, 1 },        /* A */
     890             :         },
     891             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     892             :     },
     893             :     [AV_PIX_FMT_YUVA420P16BE] = {
     894             :         .name = "yuva420p16be",
     895             :         .nb_components = 4,
     896             :         .log2_chroma_w = 1,
     897             :         .log2_chroma_h = 1,
     898             :         .comp = {
     899             :             { 0, 2, 0, 0, 16, 1, 15, 1 },        /* Y */
     900             :             { 1, 2, 0, 0, 16, 1, 15, 1 },        /* U */
     901             :             { 2, 2, 0, 0, 16, 1, 15, 1 },        /* V */
     902             :             { 3, 2, 0, 0, 16, 1, 15, 1 },        /* A */
     903             :         },
     904             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     905             :     },
     906             :     [AV_PIX_FMT_YUVA420P16LE] = {
     907             :         .name = "yuva420p16le",
     908             :         .nb_components = 4,
     909             :         .log2_chroma_w = 1,
     910             :         .log2_chroma_h = 1,
     911             :         .comp = {
     912             :             { 0, 2, 0, 0, 16, 1, 15, 1 },        /* Y */
     913             :             { 1, 2, 0, 0, 16, 1, 15, 1 },        /* U */
     914             :             { 2, 2, 0, 0, 16, 1, 15, 1 },        /* V */
     915             :             { 3, 2, 0, 0, 16, 1, 15, 1 },        /* A */
     916             :         },
     917             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     918             :     },
     919             :     [AV_PIX_FMT_YUVA422P16BE] = {
     920             :         .name = "yuva422p16be",
     921             :         .nb_components = 4,
     922             :         .log2_chroma_w = 1,
     923             :         .log2_chroma_h = 0,
     924             :         .comp = {
     925             :             { 0, 2, 0, 0, 16, 1, 15, 1 },        /* Y */
     926             :             { 1, 2, 0, 0, 16, 1, 15, 1 },        /* U */
     927             :             { 2, 2, 0, 0, 16, 1, 15, 1 },        /* V */
     928             :             { 3, 2, 0, 0, 16, 1, 15, 1 },        /* A */
     929             :         },
     930             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     931             :     },
     932             :     [AV_PIX_FMT_YUVA422P16LE] = {
     933             :         .name = "yuva422p16le",
     934             :         .nb_components = 4,
     935             :         .log2_chroma_w = 1,
     936             :         .log2_chroma_h = 0,
     937             :         .comp = {
     938             :             { 0, 2, 0, 0, 16, 1, 15, 1 },        /* Y */
     939             :             { 1, 2, 0, 0, 16, 1, 15, 1 },        /* U */
     940             :             { 2, 2, 0, 0, 16, 1, 15, 1 },        /* V */
     941             :             { 3, 2, 0, 0, 16, 1, 15, 1 },        /* A */
     942             :         },
     943             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     944             :     },
     945             :     [AV_PIX_FMT_YUVA444P16BE] = {
     946             :         .name = "yuva444p16be",
     947             :         .nb_components = 4,
     948             :         .log2_chroma_w = 0,
     949             :         .log2_chroma_h = 0,
     950             :         .comp = {
     951             :             { 0, 2, 0, 0, 16, 1, 15, 1 },        /* Y */
     952             :             { 1, 2, 0, 0, 16, 1, 15, 1 },        /* U */
     953             :             { 2, 2, 0, 0, 16, 1, 15, 1 },        /* V */
     954             :             { 3, 2, 0, 0, 16, 1, 15, 1 },        /* A */
     955             :         },
     956             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     957             :     },
     958             :     [AV_PIX_FMT_YUVA444P16LE] = {
     959             :         .name = "yuva444p16le",
     960             :         .nb_components = 4,
     961             :         .log2_chroma_w = 0,
     962             :         .log2_chroma_h = 0,
     963             :         .comp = {
     964             :             { 0, 2, 0, 0, 16, 1, 15, 1 },        /* Y */
     965             :             { 1, 2, 0, 0, 16, 1, 15, 1 },        /* U */
     966             :             { 2, 2, 0, 0, 16, 1, 15, 1 },        /* V */
     967             :             { 3, 2, 0, 0, 16, 1, 15, 1 },        /* A */
     968             :         },
     969             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
     970             :     },
     971             : #if FF_API_VDPAU
     972             :     [AV_PIX_FMT_VDPAU_H264] = {
     973             :         .name = "vdpau_h264",
     974             :         .log2_chroma_w = 1,
     975             :         .log2_chroma_h = 1,
     976             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
     977             :     },
     978             :     [AV_PIX_FMT_VDPAU_MPEG1] = {
     979             :         .name = "vdpau_mpeg1",
     980             :         .log2_chroma_w = 1,
     981             :         .log2_chroma_h = 1,
     982             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
     983             :     },
     984             :     [AV_PIX_FMT_VDPAU_MPEG2] = {
     985             :         .name = "vdpau_mpeg2",
     986             :         .log2_chroma_w = 1,
     987             :         .log2_chroma_h = 1,
     988             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
     989             :     },
     990             :     [AV_PIX_FMT_VDPAU_WMV3] = {
     991             :         .name = "vdpau_wmv3",
     992             :         .log2_chroma_w = 1,
     993             :         .log2_chroma_h = 1,
     994             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
     995             :     },
     996             :     [AV_PIX_FMT_VDPAU_VC1] = {
     997             :         .name = "vdpau_vc1",
     998             :         .log2_chroma_w = 1,
     999             :         .log2_chroma_h = 1,
    1000             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    1001             :     },
    1002             :     [AV_PIX_FMT_VDPAU_MPEG4] = {
    1003             :         .name = "vdpau_mpeg4",
    1004             :         .log2_chroma_w = 1,
    1005             :         .log2_chroma_h = 1,
    1006             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    1007             :     },
    1008             : #endif
    1009             :     [AV_PIX_FMT_RGB48BE] = {
    1010             :         .name = "rgb48be",
    1011             :         .nb_components = 3,
    1012             :         .log2_chroma_w = 0,
    1013             :         .log2_chroma_h = 0,
    1014             :         .comp = {
    1015             :             { 0, 6, 0, 0, 16, 5, 15, 1 },       /* R */
    1016             :             { 0, 6, 2, 0, 16, 5, 15, 3 },       /* G */
    1017             :             { 0, 6, 4, 0, 16, 5, 15, 5 },       /* B */
    1018             :         },
    1019             :         .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
    1020             :     },
    1021             :     [AV_PIX_FMT_RGB48LE] = {
    1022             :         .name = "rgb48le",
    1023             :         .nb_components = 3,
    1024             :         .log2_chroma_w = 0,
    1025             :         .log2_chroma_h = 0,
    1026             :         .comp = {
    1027             :             { 0, 6, 0, 0, 16, 5, 15, 1 },       /* R */
    1028             :             { 0, 6, 2, 0, 16, 5, 15, 3 },       /* G */
    1029             :             { 0, 6, 4, 0, 16, 5, 15, 5 },       /* B */
    1030             :         },
    1031             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1032             :     },
    1033             :     [AV_PIX_FMT_RGBA64BE] = {
    1034             :         .name = "rgba64be",
    1035             :         .nb_components = 4,
    1036             :         .log2_chroma_w = 0,
    1037             :         .log2_chroma_h = 0,
    1038             :         .comp = {
    1039             :             { 0, 8, 0, 0, 16, 7, 15, 1 },       /* R */
    1040             :             { 0, 8, 2, 0, 16, 7, 15, 3 },       /* G */
    1041             :             { 0, 8, 4, 0, 16, 7, 15, 5 },       /* B */
    1042             :             { 0, 8, 6, 0, 16, 7, 15, 7 },       /* A */
    1043             :         },
    1044             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
    1045             :     },
    1046             :     [AV_PIX_FMT_RGBA64LE] = {
    1047             :         .name = "rgba64le",
    1048             :         .nb_components = 4,
    1049             :         .log2_chroma_w = 0,
    1050             :         .log2_chroma_h = 0,
    1051             :         .comp = {
    1052             :             { 0, 8, 0, 0, 16, 7, 15, 1 },       /* R */
    1053             :             { 0, 8, 2, 0, 16, 7, 15, 3 },       /* G */
    1054             :             { 0, 8, 4, 0, 16, 7, 15, 5 },       /* B */
    1055             :             { 0, 8, 6, 0, 16, 7, 15, 7 },       /* A */
    1056             :         },
    1057             :         .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
    1058             :     },
    1059             :     [AV_PIX_FMT_RGB565BE] = {
    1060             :         .name = "rgb565be",
    1061             :         .nb_components = 3,
    1062             :         .log2_chroma_w = 0,
    1063             :         .log2_chroma_h = 0,
    1064             :         .comp = {
    1065             :             { 0, 2, -1, 3, 5, 1, 4, 0 },        /* R */
    1066             :             { 0, 2,  0, 5, 6, 1, 5, 1 },        /* G */
    1067             :             { 0, 2,  0, 0, 5, 1, 4, 1 },        /* B */
    1068             :         },
    1069             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
    1070             :     },
    1071             :     [AV_PIX_FMT_RGB565LE] = {
    1072             :         .name = "rgb565le",
    1073             :         .nb_components = 3,
    1074             :         .log2_chroma_w = 0,
    1075             :         .log2_chroma_h = 0,
    1076             :         .comp = {
    1077             :             { 0, 2, 1, 3, 5, 1, 4, 2 },        /* R */
    1078             :             { 0, 2, 0, 5, 6, 1, 5, 1 },        /* G */
    1079             :             { 0, 2, 0, 0, 5, 1, 4, 1 },        /* B */
    1080             :         },
    1081             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1082             :     },
    1083             :     [AV_PIX_FMT_RGB555BE] = {
    1084             :         .name = "rgb555be",
    1085             :         .nb_components = 3,
    1086             :         .log2_chroma_w = 0,
    1087             :         .log2_chroma_h = 0,
    1088             :         .comp = {
    1089             :             { 0, 2, -1, 2, 5, 1, 4, 0 },        /* R */
    1090             :             { 0, 2,  0, 5, 5, 1, 4, 1 },        /* G */
    1091             :             { 0, 2,  0, 0, 5, 1, 4, 1 },        /* B */
    1092             :         },
    1093             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
    1094             :     },
    1095             :     [AV_PIX_FMT_RGB555LE] = {
    1096             :         .name = "rgb555le",
    1097             :         .nb_components = 3,
    1098             :         .log2_chroma_w = 0,
    1099             :         .log2_chroma_h = 0,
    1100             :         .comp = {
    1101             :             { 0, 2, 1, 2, 5, 1, 4, 2 },        /* R */
    1102             :             { 0, 2, 0, 5, 5, 1, 4, 1 },        /* G */
    1103             :             { 0, 2, 0, 0, 5, 1, 4, 1 },        /* B */
    1104             :         },
    1105             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1106             :     },
    1107             :     [AV_PIX_FMT_RGB444BE] = {
    1108             :         .name = "rgb444be",
    1109             :         .nb_components = 3,
    1110             :         .log2_chroma_w = 0,
    1111             :         .log2_chroma_h = 0,
    1112             :         .comp = {
    1113             :             { 0, 2, -1, 0, 4, 1, 3, 0 },        /* R */
    1114             :             { 0, 2,  0, 4, 4, 1, 3, 1 },        /* G */
    1115             :             { 0, 2,  0, 0, 4, 1, 3, 1 },        /* B */
    1116             :         },
    1117             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
    1118             :     },
    1119             :     [AV_PIX_FMT_RGB444LE] = {
    1120             :         .name = "rgb444le",
    1121             :         .nb_components = 3,
    1122             :         .log2_chroma_w = 0,
    1123             :         .log2_chroma_h = 0,
    1124             :         .comp = {
    1125             :             { 0, 2, 1, 0, 4, 1, 3, 2 },        /* R */
    1126             :             { 0, 2, 0, 4, 4, 1, 3, 1 },        /* G */
    1127             :             { 0, 2, 0, 0, 4, 1, 3, 1 },        /* B */
    1128             :         },
    1129             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1130             :     },
    1131             :     [AV_PIX_FMT_BGR48BE] = {
    1132             :         .name = "bgr48be",
    1133             :         .nb_components = 3,
    1134             :         .log2_chroma_w = 0,
    1135             :         .log2_chroma_h = 0,
    1136             :         .comp = {
    1137             :             { 0, 6, 4, 0, 16, 5, 15, 5 },       /* R */
    1138             :             { 0, 6, 2, 0, 16, 5, 15, 3 },       /* G */
    1139             :             { 0, 6, 0, 0, 16, 5, 15, 1 },       /* B */
    1140             :         },
    1141             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
    1142             :     },
    1143             :     [AV_PIX_FMT_BGR48LE] = {
    1144             :         .name = "bgr48le",
    1145             :         .nb_components = 3,
    1146             :         .log2_chroma_w = 0,
    1147             :         .log2_chroma_h = 0,
    1148             :         .comp = {
    1149             :             { 0, 6, 4, 0, 16, 5, 15, 5 },       /* R */
    1150             :             { 0, 6, 2, 0, 16, 5, 15, 3 },       /* G */
    1151             :             { 0, 6, 0, 0, 16, 5, 15, 1 },       /* B */
    1152             :         },
    1153             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1154             :     },
    1155             :     [AV_PIX_FMT_BGRA64BE] = {
    1156             :         .name = "bgra64be",
    1157             :         .nb_components = 4,
    1158             :         .log2_chroma_w = 0,
    1159             :         .log2_chroma_h = 0,
    1160             :         .comp = {
    1161             :             { 0, 8, 4, 0, 16, 7, 15, 5 },       /* R */
    1162             :             { 0, 8, 2, 0, 16, 7, 15, 3 },       /* G */
    1163             :             { 0, 8, 0, 0, 16, 7, 15, 1 },       /* B */
    1164             :             { 0, 8, 6, 0, 16, 7, 15, 7 },       /* A */
    1165             :         },
    1166             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
    1167             :     },
    1168             :     [AV_PIX_FMT_BGRA64LE] = {
    1169             :         .name = "bgra64le",
    1170             :         .nb_components = 4,
    1171             :         .log2_chroma_w = 0,
    1172             :         .log2_chroma_h = 0,
    1173             :         .comp = {
    1174             :             { 0, 8, 4, 0, 16, 7, 15, 5 },       /* R */
    1175             :             { 0, 8, 2, 0, 16, 7, 15, 3 },       /* G */
    1176             :             { 0, 8, 0, 0, 16, 7, 15, 1 },       /* B */
    1177             :             { 0, 8, 6, 0, 16, 7, 15, 7 },       /* A */
    1178             :         },
    1179             :         .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
    1180             :     },
    1181             :     [AV_PIX_FMT_BGR565BE] = {
    1182             :         .name = "bgr565be",
    1183             :         .nb_components = 3,
    1184             :         .log2_chroma_w = 0,
    1185             :         .log2_chroma_h = 0,
    1186             :         .comp = {
    1187             :             { 0, 2,  0, 0, 5, 1, 4, 1 },        /* R */
    1188             :             { 0, 2,  0, 5, 6, 1, 5, 1 },        /* G */
    1189             :             { 0, 2, -1, 3, 5, 1, 4, 0 },        /* B */
    1190             :         },
    1191             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
    1192             :     },
    1193             :     [AV_PIX_FMT_BGR565LE] = {
    1194             :         .name = "bgr565le",
    1195             :         .nb_components = 3,
    1196             :         .log2_chroma_w = 0,
    1197             :         .log2_chroma_h = 0,
    1198             :         .comp = {
    1199             :             { 0, 2, 0, 0, 5, 1, 4, 1 },        /* R */
    1200             :             { 0, 2, 0, 5, 6, 1, 5, 1 },        /* G */
    1201             :             { 0, 2, 1, 3, 5, 1, 4, 2 },        /* B */
    1202             :         },
    1203             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1204             :     },
    1205             :     [AV_PIX_FMT_BGR555BE] = {
    1206             :         .name = "bgr555be",
    1207             :         .nb_components = 3,
    1208             :         .log2_chroma_w = 0,
    1209             :         .log2_chroma_h = 0,
    1210             :         .comp = {
    1211             :             { 0, 2,  0, 0, 5, 1, 4, 1 },       /* R */
    1212             :             { 0, 2,  0, 5, 5, 1, 4, 1 },       /* G */
    1213             :             { 0, 2, -1, 2, 5, 1, 4, 0 },       /* B */
    1214             :         },
    1215             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
    1216             :      },
    1217             :     [AV_PIX_FMT_BGR555LE] = {
    1218             :         .name = "bgr555le",
    1219             :         .nb_components = 3,
    1220             :         .log2_chroma_w = 0,
    1221             :         .log2_chroma_h = 0,
    1222             :         .comp = {
    1223             :             { 0, 2, 0, 0, 5, 1, 4, 1 },        /* R */
    1224             :             { 0, 2, 0, 5, 5, 1, 4, 1 },        /* G */
    1225             :             { 0, 2, 1, 2, 5, 1, 4, 2 },        /* B */
    1226             :         },
    1227             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1228             :     },
    1229             :     [AV_PIX_FMT_BGR444BE] = {
    1230             :         .name = "bgr444be",
    1231             :         .nb_components = 3,
    1232             :         .log2_chroma_w = 0,
    1233             :         .log2_chroma_h = 0,
    1234             :         .comp = {
    1235             :             { 0, 2,  0, 0, 4, 1, 3, 1 },       /* R */
    1236             :             { 0, 2,  0, 4, 4, 1, 3, 1 },       /* G */
    1237             :             { 0, 2, -1, 0, 4, 1, 3, 0 },       /* B */
    1238             :         },
    1239             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
    1240             :      },
    1241             :     [AV_PIX_FMT_BGR444LE] = {
    1242             :         .name = "bgr444le",
    1243             :         .nb_components = 3,
    1244             :         .log2_chroma_w = 0,
    1245             :         .log2_chroma_h = 0,
    1246             :         .comp = {
    1247             :             { 0, 2, 0, 0, 4, 1, 3, 1 },        /* R */
    1248             :             { 0, 2, 0, 4, 4, 1, 3, 1 },        /* G */
    1249             :             { 0, 2, 1, 0, 4, 1, 3, 2 },        /* B */
    1250             :         },
    1251             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1252             :     },
    1253             : #if FF_API_VAAPI
    1254             :     [AV_PIX_FMT_VAAPI_MOCO] = {
    1255             :         .name = "vaapi_moco",
    1256             :         .log2_chroma_w = 1,
    1257             :         .log2_chroma_h = 1,
    1258             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    1259             :     },
    1260             :     [AV_PIX_FMT_VAAPI_IDCT] = {
    1261             :         .name = "vaapi_idct",
    1262             :         .log2_chroma_w = 1,
    1263             :         .log2_chroma_h = 1,
    1264             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    1265             :     },
    1266             :     [AV_PIX_FMT_VAAPI_VLD] = {
    1267             :         .name = "vaapi_vld",
    1268             :         .log2_chroma_w = 1,
    1269             :         .log2_chroma_h = 1,
    1270             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    1271             :     },
    1272             : #else
    1273             :     [AV_PIX_FMT_VAAPI] = {
    1274             :         .name = "vaapi",
    1275             :         .log2_chroma_w = 1,
    1276             :         .log2_chroma_h = 1,
    1277             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    1278             :     },
    1279             : #endif
    1280             :     [AV_PIX_FMT_YUV420P9LE] = {
    1281             :         .name = "yuv420p9le",
    1282             :         .nb_components = 3,
    1283             :         .log2_chroma_w = 1,
    1284             :         .log2_chroma_h = 1,
    1285             :         .comp = {
    1286             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* Y */
    1287             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* U */
    1288             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* V */
    1289             :         },
    1290             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1291             :     },
    1292             :     [AV_PIX_FMT_YUV420P9BE] = {
    1293             :         .name = "yuv420p9be",
    1294             :         .nb_components = 3,
    1295             :         .log2_chroma_w = 1,
    1296             :         .log2_chroma_h = 1,
    1297             :         .comp = {
    1298             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* Y */
    1299             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* U */
    1300             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* V */
    1301             :         },
    1302             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1303             :     },
    1304             :     [AV_PIX_FMT_YUV420P10LE] = {
    1305             :         .name = "yuv420p10le",
    1306             :         .nb_components = 3,
    1307             :         .log2_chroma_w = 1,
    1308             :         .log2_chroma_h = 1,
    1309             :         .comp = {
    1310             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
    1311             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
    1312             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
    1313             :         },
    1314             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1315             :     },
    1316             :     [AV_PIX_FMT_YUV420P10BE] = {
    1317             :         .name = "yuv420p10be",
    1318             :         .nb_components = 3,
    1319             :         .log2_chroma_w = 1,
    1320             :         .log2_chroma_h = 1,
    1321             :         .comp = {
    1322             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
    1323             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
    1324             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
    1325             :         },
    1326             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1327             :     },
    1328             :     [AV_PIX_FMT_YUV420P12LE] = {
    1329             :         .name = "yuv420p12le",
    1330             :         .nb_components = 3,
    1331             :         .log2_chroma_w = 1,
    1332             :         .log2_chroma_h = 1,
    1333             :         .comp = {
    1334             :             { 0, 2, 0, 0, 12, 1, 11, 1 },        /* Y */
    1335             :             { 1, 2, 0, 0, 12, 1, 11, 1 },        /* U */
    1336             :             { 2, 2, 0, 0, 12, 1, 11, 1 },        /* V */
    1337             :         },
    1338             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1339             :     },
    1340             :     [AV_PIX_FMT_YUV420P12BE] = {
    1341             :         .name = "yuv420p12be",
    1342             :         .nb_components = 3,
    1343             :         .log2_chroma_w = 1,
    1344             :         .log2_chroma_h = 1,
    1345             :         .comp = {
    1346             :             { 0, 2, 0, 0, 12, 1, 11, 1 },        /* Y */
    1347             :             { 1, 2, 0, 0, 12, 1, 11, 1 },        /* U */
    1348             :             { 2, 2, 0, 0, 12, 1, 11, 1 },        /* V */
    1349             :         },
    1350             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1351             :     },
    1352             :     [AV_PIX_FMT_YUV420P14LE] = {
    1353             :         .name = "yuv420p14le",
    1354             :         .nb_components = 3,
    1355             :         .log2_chroma_w = 1,
    1356             :         .log2_chroma_h = 1,
    1357             :         .comp = {
    1358             :             { 0, 2, 0, 0, 14, 1, 13, 1 },        /* Y */
    1359             :             { 1, 2, 0, 0, 14, 1, 13, 1 },        /* U */
    1360             :             { 2, 2, 0, 0, 14, 1, 13, 1 },        /* V */
    1361             :         },
    1362             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1363             :     },
    1364             :     [AV_PIX_FMT_YUV420P14BE] = {
    1365             :         .name = "yuv420p14be",
    1366             :         .nb_components = 3,
    1367             :         .log2_chroma_w = 1,
    1368             :         .log2_chroma_h = 1,
    1369             :         .comp = {
    1370             :             { 0, 2, 0, 0, 14, 1, 13, 1 },        /* Y */
    1371             :             { 1, 2, 0, 0, 14, 1, 13, 1 },        /* U */
    1372             :             { 2, 2, 0, 0, 14, 1, 13, 1 },        /* V */
    1373             :         },
    1374             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1375             :     },
    1376             :     [AV_PIX_FMT_YUV420P16LE] = {
    1377             :         .name = "yuv420p16le",
    1378             :         .nb_components = 3,
    1379             :         .log2_chroma_w = 1,
    1380             :         .log2_chroma_h = 1,
    1381             :         .comp = {
    1382             :             { 0, 2, 0, 0, 16, 1, 15, 1 },        /* Y */
    1383             :             { 1, 2, 0, 0, 16, 1, 15, 1 },        /* U */
    1384             :             { 2, 2, 0, 0, 16, 1, 15, 1 },        /* V */
    1385             :         },
    1386             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1387             :     },
    1388             :     [AV_PIX_FMT_YUV420P16BE] = {
    1389             :         .name = "yuv420p16be",
    1390             :         .nb_components = 3,
    1391             :         .log2_chroma_w = 1,
    1392             :         .log2_chroma_h = 1,
    1393             :         .comp = {
    1394             :             { 0, 2, 0, 0, 16, 1, 15, 1 },        /* Y */
    1395             :             { 1, 2, 0, 0, 16, 1, 15, 1 },        /* U */
    1396             :             { 2, 2, 0, 0, 16, 1, 15, 1 },        /* V */
    1397             :         },
    1398             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1399             :     },
    1400             :     [AV_PIX_FMT_YUV422P9LE] = {
    1401             :         .name = "yuv422p9le",
    1402             :         .nb_components = 3,
    1403             :         .log2_chroma_w = 1,
    1404             :         .log2_chroma_h = 0,
    1405             :         .comp = {
    1406             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* Y */
    1407             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* U */
    1408             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* V */
    1409             :         },
    1410             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1411             :     },
    1412             :     [AV_PIX_FMT_YUV422P9BE] = {
    1413             :         .name = "yuv422p9be",
    1414             :         .nb_components = 3,
    1415             :         .log2_chroma_w = 1,
    1416             :         .log2_chroma_h = 0,
    1417             :         .comp = {
    1418             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* Y */
    1419             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* U */
    1420             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* V */
    1421             :         },
    1422             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1423             :     },
    1424             :     [AV_PIX_FMT_YUV422P10LE] = {
    1425             :         .name = "yuv422p10le",
    1426             :         .nb_components = 3,
    1427             :         .log2_chroma_w = 1,
    1428             :         .log2_chroma_h = 0,
    1429             :         .comp = {
    1430             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
    1431             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
    1432             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
    1433             :         },
    1434             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1435             :     },
    1436             :     [AV_PIX_FMT_YUV422P10BE] = {
    1437             :         .name = "yuv422p10be",
    1438             :         .nb_components = 3,
    1439             :         .log2_chroma_w = 1,
    1440             :         .log2_chroma_h = 0,
    1441             :         .comp = {
    1442             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
    1443             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
    1444             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
    1445             :         },
    1446             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1447             :     },
    1448             :     [AV_PIX_FMT_YUV422P12LE] = {
    1449             :         .name = "yuv422p12le",
    1450             :         .nb_components = 3,
    1451             :         .log2_chroma_w = 1,
    1452             :         .log2_chroma_h = 0,
    1453             :         .comp = {
    1454             :             { 0, 2, 0, 0, 12, 1, 11, 1 },        /* Y */
    1455             :             { 1, 2, 0, 0, 12, 1, 11, 1 },        /* U */
    1456             :             { 2, 2, 0, 0, 12, 1, 11, 1 },        /* V */
    1457             :         },
    1458             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1459             :     },
    1460             :     [AV_PIX_FMT_YUV422P12BE] = {
    1461             :         .name = "yuv422p12be",
    1462             :         .nb_components = 3,
    1463             :         .log2_chroma_w = 1,
    1464             :         .log2_chroma_h = 0,
    1465             :         .comp = {
    1466             :             { 0, 2, 0, 0, 12, 1, 11, 1 },        /* Y */
    1467             :             { 1, 2, 0, 0, 12, 1, 11, 1 },        /* U */
    1468             :             { 2, 2, 0, 0, 12, 1, 11, 1 },        /* V */
    1469             :         },
    1470             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1471             :     },
    1472             :     [AV_PIX_FMT_YUV422P14LE] = {
    1473             :         .name = "yuv422p14le",
    1474             :         .nb_components = 3,
    1475             :         .log2_chroma_w = 1,
    1476             :         .log2_chroma_h = 0,
    1477             :         .comp = {
    1478             :             { 0, 2, 0, 0, 14, 1, 13, 1 },        /* Y */
    1479             :             { 1, 2, 0, 0, 14, 1, 13, 1 },        /* U */
    1480             :             { 2, 2, 0, 0, 14, 1, 13, 1 },        /* V */
    1481             :         },
    1482             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1483             :     },
    1484             :     [AV_PIX_FMT_YUV422P14BE] = {
    1485             :         .name = "yuv422p14be",
    1486             :         .nb_components = 3,
    1487             :         .log2_chroma_w = 1,
    1488             :         .log2_chroma_h = 0,
    1489             :         .comp = {
    1490             :             { 0, 2, 0, 0, 14, 1, 13, 1 },        /* Y */
    1491             :             { 1, 2, 0, 0, 14, 1, 13, 1 },        /* U */
    1492             :             { 2, 2, 0, 0, 14, 1, 13, 1 },        /* V */
    1493             :         },
    1494             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1495             :     },
    1496             :     [AV_PIX_FMT_YUV422P16LE] = {
    1497             :         .name = "yuv422p16le",
    1498             :         .nb_components = 3,
    1499             :         .log2_chroma_w = 1,
    1500             :         .log2_chroma_h = 0,
    1501             :         .comp = {
    1502             :             { 0, 2, 0, 0, 16, 1, 15, 1 },        /* Y */
    1503             :             { 1, 2, 0, 0, 16, 1, 15, 1 },        /* U */
    1504             :             { 2, 2, 0, 0, 16, 1, 15, 1 },        /* V */
    1505             :         },
    1506             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1507             :     },
    1508             :     [AV_PIX_FMT_YUV422P16BE] = {
    1509             :         .name = "yuv422p16be",
    1510             :         .nb_components = 3,
    1511             :         .log2_chroma_w = 1,
    1512             :         .log2_chroma_h = 0,
    1513             :         .comp = {
    1514             :             { 0, 2, 0, 0, 16, 1, 15, 1 },        /* Y */
    1515             :             { 1, 2, 0, 0, 16, 1, 15, 1 },        /* U */
    1516             :             { 2, 2, 0, 0, 16, 1, 15, 1 },        /* V */
    1517             :         },
    1518             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1519             :     },
    1520             :     [AV_PIX_FMT_YUV444P16LE] = {
    1521             :         .name = "yuv444p16le",
    1522             :         .nb_components = 3,
    1523             :         .log2_chroma_w = 0,
    1524             :         .log2_chroma_h = 0,
    1525             :         .comp = {
    1526             :             { 0, 2, 0, 0, 16, 1, 15, 1 },        /* Y */
    1527             :             { 1, 2, 0, 0, 16, 1, 15, 1 },        /* U */
    1528             :             { 2, 2, 0, 0, 16, 1, 15, 1 },        /* V */
    1529             :         },
    1530             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1531             :     },
    1532             :     [AV_PIX_FMT_YUV444P16BE] = {
    1533             :         .name = "yuv444p16be",
    1534             :         .nb_components = 3,
    1535             :         .log2_chroma_w = 0,
    1536             :         .log2_chroma_h = 0,
    1537             :         .comp = {
    1538             :             { 0, 2, 0, 0, 16, 1, 15, 1 },        /* Y */
    1539             :             { 1, 2, 0, 0, 16, 1, 15, 1 },        /* U */
    1540             :             { 2, 2, 0, 0, 16, 1, 15, 1 },        /* V */
    1541             :         },
    1542             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1543             :     },
    1544             :     [AV_PIX_FMT_YUV444P10LE] = {
    1545             :         .name = "yuv444p10le",
    1546             :         .nb_components = 3,
    1547             :         .log2_chroma_w = 0,
    1548             :         .log2_chroma_h = 0,
    1549             :         .comp = {
    1550             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
    1551             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
    1552             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
    1553             :         },
    1554             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1555             :     },
    1556             :     [AV_PIX_FMT_YUV444P10BE] = {
    1557             :         .name = "yuv444p10be",
    1558             :         .nb_components = 3,
    1559             :         .log2_chroma_w = 0,
    1560             :         .log2_chroma_h = 0,
    1561             :         .comp = {
    1562             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
    1563             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* U */
    1564             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* V */
    1565             :         },
    1566             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1567             :     },
    1568             :     [AV_PIX_FMT_YUV444P9LE] = {
    1569             :         .name = "yuv444p9le",
    1570             :         .nb_components = 3,
    1571             :         .log2_chroma_w = 0,
    1572             :         .log2_chroma_h = 0,
    1573             :         .comp = {
    1574             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* Y */
    1575             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* U */
    1576             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* V */
    1577             :         },
    1578             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1579             :     },
    1580             :     [AV_PIX_FMT_YUV444P9BE] = {
    1581             :         .name = "yuv444p9be",
    1582             :         .nb_components = 3,
    1583             :         .log2_chroma_w = 0,
    1584             :         .log2_chroma_h = 0,
    1585             :         .comp = {
    1586             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* Y */
    1587             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* U */
    1588             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* V */
    1589             :         },
    1590             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1591             :     },
    1592             :     [AV_PIX_FMT_YUV444P12LE] = {
    1593             :         .name = "yuv444p12le",
    1594             :         .nb_components = 3,
    1595             :         .log2_chroma_w = 0,
    1596             :         .log2_chroma_h = 0,
    1597             :         .comp = {
    1598             :             { 0, 2, 0, 0, 12, 1, 11, 1 },        /* Y */
    1599             :             { 1, 2, 0, 0, 12, 1, 11, 1 },        /* U */
    1600             :             { 2, 2, 0, 0, 12, 1, 11, 1 },        /* V */
    1601             :         },
    1602             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1603             :     },
    1604             :     [AV_PIX_FMT_YUV444P12BE] = {
    1605             :         .name = "yuv444p12be",
    1606             :         .nb_components = 3,
    1607             :         .log2_chroma_w = 0,
    1608             :         .log2_chroma_h = 0,
    1609             :         .comp = {
    1610             :             { 0, 2, 0, 0, 12, 1, 11, 1 },        /* Y */
    1611             :             { 1, 2, 0, 0, 12, 1, 11, 1 },        /* U */
    1612             :             { 2, 2, 0, 0, 12, 1, 11, 1 },        /* V */
    1613             :         },
    1614             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1615             :     },
    1616             :     [AV_PIX_FMT_YUV444P14LE] = {
    1617             :         .name = "yuv444p14le",
    1618             :         .nb_components = 3,
    1619             :         .log2_chroma_w = 0,
    1620             :         .log2_chroma_h = 0,
    1621             :         .comp = {
    1622             :             { 0, 2, 0, 0, 14, 1, 13, 1 },        /* Y */
    1623             :             { 1, 2, 0, 0, 14, 1, 13, 1 },        /* U */
    1624             :             { 2, 2, 0, 0, 14, 1, 13, 1 },        /* V */
    1625             :         },
    1626             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1627             :     },
    1628             :     [AV_PIX_FMT_YUV444P14BE] = {
    1629             :         .name = "yuv444p14be",
    1630             :         .nb_components = 3,
    1631             :         .log2_chroma_w = 0,
    1632             :         .log2_chroma_h = 0,
    1633             :         .comp = {
    1634             :             { 0, 2, 0, 0, 14, 1, 13, 1 },        /* Y */
    1635             :             { 1, 2, 0, 0, 14, 1, 13, 1 },        /* U */
    1636             :             { 2, 2, 0, 0, 14, 1, 13, 1 },        /* V */
    1637             :         },
    1638             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
    1639             :     },
    1640             :     [AV_PIX_FMT_D3D11VA_VLD] = {
    1641             :         .name = "d3d11va_vld",
    1642             :         .log2_chroma_w = 1,
    1643             :         .log2_chroma_h = 1,
    1644             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    1645             :     },
    1646             :     [AV_PIX_FMT_DXVA2_VLD] = {
    1647             :         .name = "dxva2_vld",
    1648             :         .log2_chroma_w = 1,
    1649             :         .log2_chroma_h = 1,
    1650             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    1651             :     },
    1652             :     [AV_PIX_FMT_VDA_VLD] = {
    1653             :         .name = "vda_vld",
    1654             :         .log2_chroma_w = 1,
    1655             :         .log2_chroma_h = 1,
    1656             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    1657             :     },
    1658             :     [AV_PIX_FMT_YA8] = {
    1659             :         .name = "ya8",
    1660             :         .nb_components = 2,
    1661             :         .comp = {
    1662             :             { 0, 2, 0, 0, 8, 1, 7, 1 },        /* Y */
    1663             :             { 0, 2, 1, 0, 8, 1, 7, 2 },        /* A */
    1664             :         },
    1665             :         .flags = AV_PIX_FMT_FLAG_ALPHA,
    1666             :         .alias = "gray8a",
    1667             :     },
    1668             :     [AV_PIX_FMT_YA16LE] = {
    1669             :         .name = "ya16le",
    1670             :         .nb_components = 2,
    1671             :         .comp = {
    1672             :             { 0, 4, 0, 0, 16, 3, 15, 1 },        /* Y */
    1673             :             { 0, 4, 2, 0, 16, 3, 15, 3 },        /* A */
    1674             :         },
    1675             :         .flags = AV_PIX_FMT_FLAG_ALPHA,
    1676             :     },
    1677             :     [AV_PIX_FMT_YA16BE] = {
    1678             :         .name = "ya16be",
    1679             :         .nb_components = 2,
    1680             :         .comp = {
    1681             :             { 0, 4, 0, 0, 16, 3, 15, 1 },        /* Y */
    1682             :             { 0, 4, 2, 0, 16, 3, 15, 3 },        /* A */
    1683             :         },
    1684             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
    1685             :     },
    1686             :     [AV_PIX_FMT_VIDEOTOOLBOX] = {
    1687             :         .name = "videotoolbox_vld",
    1688             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    1689             :     },
    1690             :     [AV_PIX_FMT_GBRP] = {
    1691             :         .name = "gbrp",
    1692             :         .nb_components = 3,
    1693             :         .log2_chroma_w = 0,
    1694             :         .log2_chroma_h = 0,
    1695             :         .comp = {
    1696             :             { 2, 1, 0, 0, 8, 0, 7, 1 },        /* R */
    1697             :             { 0, 1, 0, 0, 8, 0, 7, 1 },        /* G */
    1698             :             { 1, 1, 0, 0, 8, 0, 7, 1 },        /* B */
    1699             :         },
    1700             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
    1701             :     },
    1702             :     [AV_PIX_FMT_GBRP9LE] = {
    1703             :         .name = "gbrp9le",
    1704             :         .nb_components = 3,
    1705             :         .log2_chroma_w = 0,
    1706             :         .log2_chroma_h = 0,
    1707             :         .comp = {
    1708             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* R */
    1709             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* G */
    1710             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* B */
    1711             :         },
    1712             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
    1713             :     },
    1714             :     [AV_PIX_FMT_GBRP9BE] = {
    1715             :         .name = "gbrp9be",
    1716             :         .nb_components = 3,
    1717             :         .log2_chroma_w = 0,
    1718             :         .log2_chroma_h = 0,
    1719             :         .comp = {
    1720             :             { 2, 2, 0, 0, 9, 1, 8, 1 },        /* R */
    1721             :             { 0, 2, 0, 0, 9, 1, 8, 1 },        /* G */
    1722             :             { 1, 2, 0, 0, 9, 1, 8, 1 },        /* B */
    1723             :         },
    1724             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
    1725             :     },
    1726             :     [AV_PIX_FMT_GBRP10LE] = {
    1727             :         .name = "gbrp10le",
    1728             :         .nb_components = 3,
    1729             :         .log2_chroma_w = 0,
    1730             :         .log2_chroma_h = 0,
    1731             :         .comp = {
    1732             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* R */
    1733             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* G */
    1734             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* B */
    1735             :         },
    1736             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
    1737             :     },
    1738             :     [AV_PIX_FMT_GBRP10BE] = {
    1739             :         .name = "gbrp10be",
    1740             :         .nb_components = 3,
    1741             :         .log2_chroma_w = 0,
    1742             :         .log2_chroma_h = 0,
    1743             :         .comp = {
    1744             :             { 2, 2, 0, 0, 10, 1, 9, 1 },        /* R */
    1745             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* G */
    1746             :             { 1, 2, 0, 0, 10, 1, 9, 1 },        /* B */
    1747             :         },
    1748             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
    1749             :     },
    1750             :     [AV_PIX_FMT_GBRP12LE] = {
    1751             :         .name = "gbrp12le",
    1752             :         .nb_components = 3,
    1753             :         .log2_chroma_w = 0,
    1754             :         .log2_chroma_h = 0,
    1755             :         .comp = {
    1756             :             { 2, 2, 0, 0, 12, 1, 11, 1 },        /* R */
    1757             :             { 0, 2, 0, 0, 12, 1, 11, 1 },        /* G */
    1758             :             { 1, 2, 0, 0, 12, 1, 11, 1 },        /* B */
    1759             :         },
    1760             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
    1761             :     },
    1762             :     [AV_PIX_FMT_GBRP12BE] = {
    1763             :         .name = "gbrp12be",
    1764             :         .nb_components = 3,
    1765             :         .log2_chroma_w = 0,
    1766             :         .log2_chroma_h = 0,
    1767             :         .comp = {
    1768             :             { 2, 2, 0, 0, 12, 1, 11, 1 },        /* R */
    1769             :             { 0, 2, 0, 0, 12, 1, 11, 1 },        /* G */
    1770             :             { 1, 2, 0, 0, 12, 1, 11, 1 },        /* B */
    1771             :         },
    1772             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
    1773             :     },
    1774             :     [AV_PIX_FMT_GBRP14LE] = {
    1775             :         .name = "gbrp14le",
    1776             :         .nb_components = 3,
    1777             :         .log2_chroma_w = 0,
    1778             :         .log2_chroma_h = 0,
    1779             :         .comp = {
    1780             :             { 2, 2, 0, 0, 14, 1, 13, 1 },        /* R */
    1781             :             { 0, 2, 0, 0, 14, 1, 13, 1 },        /* G */
    1782             :             { 1, 2, 0, 0, 14, 1, 13, 1 },        /* B */
    1783             :         },
    1784             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
    1785             :     },
    1786             :     [AV_PIX_FMT_GBRP14BE] = {
    1787             :         .name = "gbrp14be",
    1788             :         .nb_components = 3,
    1789             :         .log2_chroma_w = 0,
    1790             :         .log2_chroma_h = 0,
    1791             :         .comp = {
    1792             :             { 2, 2, 0, 0, 14, 1, 13, 1 },        /* R */
    1793             :             { 0, 2, 0, 0, 14, 1, 13, 1 },        /* G */
    1794             :             { 1, 2, 0, 0, 14, 1, 13, 1 },        /* B */
    1795             :         },
    1796             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
    1797             :     },
    1798             :     [AV_PIX_FMT_GBRP16LE] = {
    1799             :         .name = "gbrp16le",
    1800             :         .nb_components = 3,
    1801             :         .log2_chroma_w = 0,
    1802             :         .log2_chroma_h = 0,
    1803             :         .comp = {
    1804             :             { 2, 2, 0, 0, 16, 1, 15, 1 },       /* R */
    1805             :             { 0, 2, 0, 0, 16, 1, 15, 1 },       /* G */
    1806             :             { 1, 2, 0, 0, 16, 1, 15, 1 },       /* B */
    1807             :         },
    1808             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
    1809             :     },
    1810             :     [AV_PIX_FMT_GBRP16BE] = {
    1811             :         .name = "gbrp16be",
    1812             :         .nb_components = 3,
    1813             :         .log2_chroma_w = 0,
    1814             :         .log2_chroma_h = 0,
    1815             :         .comp = {
    1816             :             { 2, 2, 0, 0, 16, 1, 15, 1 },       /* R */
    1817             :             { 0, 2, 0, 0, 16, 1, 15, 1 },       /* G */
    1818             :             { 1, 2, 0, 0, 16, 1, 15, 1 },       /* B */
    1819             :         },
    1820             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
    1821             :     },
    1822             :     [AV_PIX_FMT_GBRAP] = {
    1823             :         .name = "gbrap",
    1824             :         .nb_components = 4,
    1825             :         .log2_chroma_w = 0,
    1826             :         .log2_chroma_h = 0,
    1827             :         .comp = {
    1828             :             { 2, 1, 0, 0, 8, 0, 7, 1 },        /* R */
    1829             :             { 0, 1, 0, 0, 8, 0, 7, 1 },        /* G */
    1830             :             { 1, 1, 0, 0, 8, 0, 7, 1 },        /* B */
    1831             :             { 3, 1, 0, 0, 8, 0, 7, 1 },        /* A */
    1832             :         },
    1833             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
    1834             :                  AV_PIX_FMT_FLAG_ALPHA,
    1835             :     },
    1836             :     [AV_PIX_FMT_GBRAP16LE] = {
    1837             :         .name = "gbrap16le",
    1838             :         .nb_components = 4,
    1839             :         .log2_chroma_w = 0,
    1840             :         .log2_chroma_h = 0,
    1841             :         .comp = {
    1842             :             { 2, 2, 0, 0, 16, 1, 15, 1 },       /* R */
    1843             :             { 0, 2, 0, 0, 16, 1, 15, 1 },       /* G */
    1844             :             { 1, 2, 0, 0, 16, 1, 15, 1 },       /* B */
    1845             :             { 3, 2, 0, 0, 16, 1, 15, 1 },       /* A */
    1846             :         },
    1847             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
    1848             :                  AV_PIX_FMT_FLAG_ALPHA,
    1849             :     },
    1850             :     [AV_PIX_FMT_GBRAP16BE] = {
    1851             :         .name = "gbrap16be",
    1852             :         .nb_components = 4,
    1853             :         .log2_chroma_w = 0,
    1854             :         .log2_chroma_h = 0,
    1855             :         .comp = {
    1856             :             { 2, 2, 0, 0, 16, 1, 15, 1 },       /* R */
    1857             :             { 0, 2, 0, 0, 16, 1, 15, 1 },       /* G */
    1858             :             { 1, 2, 0, 0, 16, 1, 15, 1 },       /* B */
    1859             :             { 3, 2, 0, 0, 16, 1, 15, 1 },       /* A */
    1860             :         },
    1861             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
    1862             :                  AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
    1863             :     },
    1864             :     [AV_PIX_FMT_VDPAU] = {
    1865             :         .name = "vdpau",
    1866             :         .log2_chroma_w = 1,
    1867             :         .log2_chroma_h = 1,
    1868             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    1869             :     },
    1870             :     [AV_PIX_FMT_XYZ12LE] = {
    1871             :         .name = "xyz12le",
    1872             :         .nb_components = 3,
    1873             :         .log2_chroma_w = 0,
    1874             :         .log2_chroma_h = 0,
    1875             :         .comp = {
    1876             :             { 0, 6, 0, 4, 12, 5, 11, 1 },       /* X */
    1877             :             { 0, 6, 2, 4, 12, 5, 11, 3 },       /* Y */
    1878             :             { 0, 6, 4, 4, 12, 5, 11, 5 },       /* Z */
    1879             :       },
    1880             :       /*.flags = -- not used*/
    1881             :     },
    1882             :     [AV_PIX_FMT_XYZ12BE] = {
    1883             :         .name = "xyz12be",
    1884             :         .nb_components = 3,
    1885             :         .log2_chroma_w = 0,
    1886             :         .log2_chroma_h = 0,
    1887             :         .comp = {
    1888             :             { 0, 6, 0, 4, 12, 5, 11, 1 },       /* X */
    1889             :             { 0, 6, 2, 4, 12, 5, 11, 3 },       /* Y */
    1890             :             { 0, 6, 4, 4, 12, 5, 11, 5 },       /* Z */
    1891             :        },
    1892             :         .flags = AV_PIX_FMT_FLAG_BE,
    1893             :     },
    1894             : 
    1895             : #define BAYER8_DESC_COMMON \
    1896             :         .nb_components= 3, \
    1897             :         .log2_chroma_w= 0, \
    1898             :         .log2_chroma_h= 0, \
    1899             :         .comp = {          \
    1900             :             {0,1,0,0,2,0,1,1},\
    1901             :             {0,1,0,0,4,0,3,1},\
    1902             :             {0,1,0,0,2,0,1,1},\
    1903             :         },                 \
    1904             : 
    1905             : #define BAYER16_DESC_COMMON \
    1906             :         .nb_components= 3, \
    1907             :         .log2_chroma_w= 0, \
    1908             :         .log2_chroma_h= 0, \
    1909             :         .comp = {          \
    1910             :             {0,2,0,0,4,1,3,1},\
    1911             :             {0,2,0,0,8,1,7,1},\
    1912             :             {0,2,0,0,4,1,3,1},\
    1913             :         },                 \
    1914             : 
    1915             :     [AV_PIX_FMT_BAYER_BGGR8] = {
    1916             :         .name = "bayer_bggr8",
    1917             :         BAYER8_DESC_COMMON
    1918             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1919             :     },
    1920             :     [AV_PIX_FMT_BAYER_BGGR16LE] = {
    1921             :         .name = "bayer_bggr16le",
    1922             :         BAYER16_DESC_COMMON
    1923             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1924             :     },
    1925             :     [AV_PIX_FMT_BAYER_BGGR16BE] = {
    1926             :         .name = "bayer_bggr16be",
    1927             :         BAYER16_DESC_COMMON
    1928             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
    1929             :     },
    1930             :     [AV_PIX_FMT_BAYER_RGGB8] = {
    1931             :         .name = "bayer_rggb8",
    1932             :         BAYER8_DESC_COMMON
    1933             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1934             :     },
    1935             :     [AV_PIX_FMT_BAYER_RGGB16LE] = {
    1936             :         .name = "bayer_rggb16le",
    1937             :         BAYER16_DESC_COMMON
    1938             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1939             :     },
    1940             :     [AV_PIX_FMT_BAYER_RGGB16BE] = {
    1941             :         .name = "bayer_rggb16be",
    1942             :         BAYER16_DESC_COMMON
    1943             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
    1944             :     },
    1945             :     [AV_PIX_FMT_BAYER_GBRG8] = {
    1946             :         .name = "bayer_gbrg8",
    1947             :         BAYER8_DESC_COMMON
    1948             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1949             :     },
    1950             :     [AV_PIX_FMT_BAYER_GBRG16LE] = {
    1951             :         .name = "bayer_gbrg16le",
    1952             :         BAYER16_DESC_COMMON
    1953             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1954             :     },
    1955             :     [AV_PIX_FMT_BAYER_GBRG16BE] = {
    1956             :         .name = "bayer_gbrg16be",
    1957             :         BAYER16_DESC_COMMON
    1958             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
    1959             :     },
    1960             :     [AV_PIX_FMT_BAYER_GRBG8] = {
    1961             :         .name = "bayer_grbg8",
    1962             :         BAYER8_DESC_COMMON
    1963             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1964             :     },
    1965             :     [AV_PIX_FMT_BAYER_GRBG16LE] = {
    1966             :         .name = "bayer_grbg16le",
    1967             :         BAYER16_DESC_COMMON
    1968             :         .flags = AV_PIX_FMT_FLAG_RGB,
    1969             :     },
    1970             :     [AV_PIX_FMT_BAYER_GRBG16BE] = {
    1971             :         .name = "bayer_grbg16be",
    1972             :         BAYER16_DESC_COMMON
    1973             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
    1974             :     },
    1975             :     [AV_PIX_FMT_NV16] = {
    1976             :         .name = "nv16",
    1977             :         .nb_components = 3,
    1978             :         .log2_chroma_w = 1,
    1979             :         .log2_chroma_h = 0,
    1980             :         .comp = {
    1981             :             { 0, 1, 0, 0, 8, 0, 7, 1 },        /* Y */
    1982             :             { 1, 2, 0, 0, 8, 1, 7, 1 },        /* U */
    1983             :             { 1, 2, 1, 0, 8, 1, 7, 2 },        /* V */
    1984             :         },
    1985             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1986             :     },
    1987             :     [AV_PIX_FMT_NV20LE] = {
    1988             :         .name = "nv20le",
    1989             :         .nb_components = 3,
    1990             :         .log2_chroma_w = 1,
    1991             :         .log2_chroma_h = 0,
    1992             :         .comp = {
    1993             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
    1994             :             { 1, 4, 0, 0, 10, 3, 9, 1 },        /* U */
    1995             :             { 1, 4, 2, 0, 10, 3, 9, 3 },        /* V */
    1996             :         },
    1997             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    1998             :     },
    1999             :     [AV_PIX_FMT_NV20BE] = {
    2000             :         .name = "nv20be",
    2001             :         .nb_components = 3,
    2002             :         .log2_chroma_w = 1,
    2003             :         .log2_chroma_h = 0,
    2004             :         .comp = {
    2005             :             { 0, 2, 0, 0, 10, 1, 9, 1 },        /* Y */
    2006             :             { 1, 4, 0, 0, 10, 3, 9, 1 },        /* U */
    2007             :             { 1, 4, 2, 0, 10, 3, 9, 3 },        /* V */
    2008             :         },
    2009             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
    2010             :     },
    2011             :     [AV_PIX_FMT_VDA] = {
    2012             :         .name = "vda",
    2013             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    2014             :     },
    2015             :     [AV_PIX_FMT_QSV] = {
    2016             :         .name = "qsv",
    2017             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    2018             :     },
    2019             :     [AV_PIX_FMT_MEDIACODEC] = {
    2020             :         .name = "mediacodec",
    2021             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    2022             :     },
    2023             :     [AV_PIX_FMT_MMAL] = {
    2024             :         .name = "mmal",
    2025             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    2026             :     },
    2027             :     [AV_PIX_FMT_CUDA] = {
    2028             :         .name = "cuda",
    2029             :         .flags = AV_PIX_FMT_FLAG_HWACCEL,
    2030             :     },
    2031             :     [AV_PIX_FMT_AYUV64LE] = {
    2032             :         .name = "ayuv64le",
    2033             :         .nb_components = 4,
    2034             :         .log2_chroma_w = 0,
    2035             :         .log2_chroma_h = 0,
    2036             :         .comp = {
    2037             :             { 0, 8, 2, 0, 16, 7, 15, 3 },        /* Y */
    2038             :             { 0, 8, 4, 0, 16, 7, 15, 5 },        /* U */
    2039             :             { 0, 8, 6, 0, 16, 7, 15, 7 },        /* V */
    2040             :             { 0, 8, 0, 0, 16, 7, 15, 1 },        /* A */
    2041             :         },
    2042             :         .flags = AV_PIX_FMT_FLAG_ALPHA,
    2043             :     },
    2044             :     [AV_PIX_FMT_AYUV64BE] = {
    2045             :         .name = "ayuv64be",
    2046             :         .nb_components = 4,
    2047             :         .log2_chroma_w = 0,
    2048             :         .log2_chroma_h = 0,
    2049             :         .comp = {
    2050             :             { 0, 8, 2, 0, 16, 7, 15, 3 },        /* Y */
    2051             :             { 0, 8, 4, 0, 16, 7, 15, 5 },        /* U */
    2052             :             { 0, 8, 6, 0, 16, 7, 15, 7 },        /* V */
    2053             :             { 0, 8, 0, 0, 16, 7, 15, 1 },        /* A */
    2054             :         },
    2055             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
    2056             :     },
    2057             :     [AV_PIX_FMT_P010LE] = {
    2058             :         .name = "p010le",
    2059             :         .nb_components = 3,
    2060             :         .log2_chroma_w = 1,
    2061             :         .log2_chroma_h = 1,
    2062             :         .comp = {
    2063             :             { 0, 2, 0, 6, 10, 1, 9, 1 },        /* Y */
    2064             :             { 1, 4, 0, 6, 10, 3, 9, 1 },        /* U */
    2065             :             { 1, 4, 2, 6, 10, 3, 9, 3 },        /* V */
    2066             :         },
    2067             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    2068             :     },
    2069             :     [AV_PIX_FMT_P010BE] = {
    2070             :         .name = "p010be",
    2071             :         .nb_components = 3,
    2072             :         .log2_chroma_w = 1,
    2073             :         .log2_chroma_h = 1,
    2074             :         .comp = {
    2075             :             { 0, 2, 0, 6, 10, 1, 9, 1 },        /* Y */
    2076             :             { 1, 4, 0, 6, 10, 3, 9, 1 },        /* U */
    2077             :             { 1, 4, 2, 6, 10, 3, 9, 3 },        /* V */
    2078             :         },
    2079             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
    2080             :     },
    2081             :     [AV_PIX_FMT_P016LE] = {
    2082             :         .name = "p016le",
    2083             :         .nb_components = 3,
    2084             :         .log2_chroma_w = 1,
    2085             :         .log2_chroma_h = 1,
    2086             :         .comp = {
    2087             :             { 0, 2, 0, 0, 16, 1, 15, 1 },       /* Y */
    2088             :             { 1, 4, 0, 0, 16, 3, 15, 1 },       /* U */
    2089             :             { 1, 4, 2, 0, 16, 3, 15, 3 },       /* V */
    2090             :         },
    2091             :         .flags = AV_PIX_FMT_FLAG_PLANAR,
    2092             :     },
    2093             :     [AV_PIX_FMT_P016BE] = {
    2094             :         .name = "p016be",
    2095             :         .nb_components = 3,
    2096             :         .log2_chroma_w = 1,
    2097             :         .log2_chroma_h = 1,
    2098             :         .comp = {
    2099             :             { 0, 2, 0, 0, 16, 1, 15, 1 },       /* Y */
    2100             :             { 1, 4, 0, 0, 16, 3, 15, 1 },       /* U */
    2101             :             { 1, 4, 2, 0, 16, 3, 15, 3 },       /* V */
    2102             :         },
    2103             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
    2104             :     },
    2105             :     [AV_PIX_FMT_GBRAP12LE] = {
    2106             :         .name = "gbrap12le",
    2107             :         .nb_components = 4,
    2108             :         .log2_chroma_w = 0,
    2109             :         .log2_chroma_h = 0,
    2110             :         .comp = {
    2111             :             { 2, 2, 0, 0, 12, 1, 11, 1 },       /* R */
    2112             :             { 0, 2, 0, 0, 12, 1, 11, 1 },       /* G */
    2113             :             { 1, 2, 0, 0, 12, 1, 11, 1 },       /* B */
    2114             :             { 3, 2, 0, 0, 12, 1, 11, 1 },       /* A */
    2115             :         },
    2116             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
    2117             :                  AV_PIX_FMT_FLAG_ALPHA,
    2118             :     },
    2119             :     [AV_PIX_FMT_GBRAP12BE] = {
    2120             :         .name = "gbrap12be",
    2121             :         .nb_components = 4,
    2122             :         .log2_chroma_w = 0,
    2123             :         .log2_chroma_h = 0,
    2124             :         .comp = {
    2125             :             { 2, 2, 0, 0, 12, 1, 11, 1 },       /* R */
    2126             :             { 0, 2, 0, 0, 12, 1, 11, 1 },       /* G */
    2127             :             { 1, 2, 0, 0, 12, 1, 11, 1 },       /* B */
    2128             :             { 3, 2, 0, 0, 12, 1, 11, 1 },       /* A */
    2129             :         },
    2130             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
    2131             :                  AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
    2132             :     },
    2133             :     [AV_PIX_FMT_GBRAP10LE] = {
    2134             :         .name = "gbrap10le",
    2135             :         .nb_components = 4,
    2136             :         .log2_chroma_w = 0,
    2137             :         .log2_chroma_h = 0,
    2138             :         .comp = {
    2139             :             { 2, 2, 0, 0, 10, 1, 9, 1 },       /* R */
    2140             :             { 0, 2, 0, 0, 10, 1, 9, 1 },       /* G */
    2141             :             { 1, 2, 0, 0, 10, 1, 9, 1 },       /* B */
    2142             :             { 3, 2, 0, 0, 10, 1, 9, 1 },       /* A */
    2143             :         },
    2144             :         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
    2145             :                  AV_PIX_FMT_FLAG_ALPHA,
    2146             :     },
    2147             :     [AV_PIX_FMT_GBRAP10BE] = {
    2148             :         .name = "gbrap10be",
    2149             :         .nb_components = 4,
    2150             :         .log2_chroma_w = 0,
    2151             :         .log2_chroma_h = 0,
    2152             :         .comp = {
    2153             :             { 2, 2, 0, 0, 10, 1, 9, 1 },       /* R */
    2154             :             { 0, 2, 0, 0, 10, 1, 9, 1 },       /* G */
    2155             :             { 1, 2, 0, 0, 10, 1, 9, 1 },       /* B */
    2156             :             { 3, 2, 0, 0, 10, 1, 9, 1 },       /* A */
    2157             :         },
    2158             :         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
    2159             :                  AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
    2160             :     },
    2161             : };
    2162             : #if FF_API_PLUS1_MINUS1
    2163             : FF_ENABLE_DEPRECATION_WARNINGS
    2164             : #endif
    2165             : 
    2166             : static const char *color_range_names[] = {
    2167             :     [AVCOL_RANGE_UNSPECIFIED] = "unknown",
    2168             :     [AVCOL_RANGE_MPEG] = "tv",
    2169             :     [AVCOL_RANGE_JPEG] = "pc",
    2170             : };
    2171             : 
    2172             : static const char *color_primaries_names[AVCOL_PRI_NB] = {
    2173             :     [AVCOL_PRI_RESERVED0] = "reserved",
    2174             :     [AVCOL_PRI_BT709] = "bt709",
    2175             :     [AVCOL_PRI_UNSPECIFIED] = "unknown",
    2176             :     [AVCOL_PRI_RESERVED] = "reserved",
    2177             :     [AVCOL_PRI_BT470M] = "bt470m",
    2178             :     [AVCOL_PRI_BT470BG] = "bt470bg",
    2179             :     [AVCOL_PRI_SMPTE170M] = "smpte170m",
    2180             :     [AVCOL_PRI_SMPTE240M] = "smpte240m",
    2181             :     [AVCOL_PRI_FILM] = "film",
    2182             :     [AVCOL_PRI_BT2020] = "bt2020",
    2183             :     [AVCOL_PRI_SMPTE428] = "smpte428",
    2184             :     [AVCOL_PRI_SMPTE431] = "smpte431",
    2185             :     [AVCOL_PRI_SMPTE432] = "smpte432",
    2186             : };
    2187             : 
    2188             : static const char *color_transfer_names[] = {
    2189             :     [AVCOL_TRC_RESERVED0] = "reserved",
    2190             :     [AVCOL_TRC_BT709] = "bt709",
    2191             :     [AVCOL_TRC_UNSPECIFIED] = "unknown",
    2192             :     [AVCOL_TRC_RESERVED] = "reserved",
    2193             :     [AVCOL_TRC_GAMMA22] = "bt470m",
    2194             :     [AVCOL_TRC_GAMMA28] = "bt470bg",
    2195             :     [AVCOL_TRC_SMPTE170M] = "smpte170m",
    2196             :     [AVCOL_TRC_SMPTE240M] = "smpte240m",
    2197             :     [AVCOL_TRC_LINEAR] = "linear",
    2198             :     [AVCOL_TRC_LOG] = "log100",
    2199             :     [AVCOL_TRC_LOG_SQRT] = "log316",
    2200             :     [AVCOL_TRC_IEC61966_2_4] = "iec61966-2-4",
    2201             :     [AVCOL_TRC_BT1361_ECG] = "bt1361e",
    2202             :     [AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
    2203             :     [AVCOL_TRC_BT2020_10] = "bt2020-10",
    2204             :     [AVCOL_TRC_BT2020_12] = "bt2020-12",
    2205             :     [AVCOL_TRC_SMPTE2084] = "smpte2084",
    2206             :     [AVCOL_TRC_SMPTE428] = "smpte428",
    2207             :     [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
    2208             : };
    2209             : 
    2210             : static const char *color_space_names[] = {
    2211             :     [AVCOL_SPC_RGB] = "gbr",
    2212             :     [AVCOL_SPC_BT709] = "bt709",
    2213             :     [AVCOL_SPC_UNSPECIFIED] = "unknown",
    2214             :     [AVCOL_SPC_RESERVED] = "reserved",
    2215             :     [AVCOL_SPC_FCC] = "fcc",
    2216             :     [AVCOL_SPC_BT470BG] = "bt470bg",
    2217             :     [AVCOL_SPC_SMPTE170M] = "smpte170m",
    2218             :     [AVCOL_SPC_SMPTE240M] = "smpte240m",
    2219             :     [AVCOL_SPC_YCOCG] = "ycgco",
    2220             :     [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
    2221             :     [AVCOL_SPC_BT2020_CL] = "bt2020c",
    2222             :     [AVCOL_SPC_SMPTE2085] = "smpte2085",
    2223             : };
    2224             : 
    2225             : static const char *chroma_location_names[] = {
    2226             :     [AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
    2227             :     [AVCHROMA_LOC_LEFT] = "left",
    2228             :     [AVCHROMA_LOC_CENTER] = "center",
    2229             :     [AVCHROMA_LOC_TOPLEFT] = "topleft",
    2230             :     [AVCHROMA_LOC_TOP] = "top",
    2231             :     [AVCHROMA_LOC_BOTTOMLEFT] = "bottomleft",
    2232             :     [AVCHROMA_LOC_BOTTOM] = "bottom",
    2233             : };
    2234             : 
    2235       24767 : static enum AVPixelFormat get_pix_fmt_internal(const char *name)
    2236             : {
    2237             :     enum AVPixelFormat pix_fmt;
    2238             : 
    2239     6405782 :     for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
    2240     9870454 :         if (av_pix_fmt_descriptors[pix_fmt].name &&
    2241     6953312 :             (!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name) ||
    2242     3472395 :              av_match_name(name, av_pix_fmt_descriptors[pix_fmt].alias)))
    2243        8522 :             return pix_fmt;
    2244             : 
    2245       16245 :     return AV_PIX_FMT_NONE;
    2246             : }
    2247             : 
    2248       53569 : const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
    2249             : {
    2250       53569 :     return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
    2251       53569 :         av_pix_fmt_descriptors[pix_fmt].name : NULL;
    2252             : }
    2253             : 
    2254             : #if HAVE_BIGENDIAN
    2255             : #   define X_NE(be, le) be
    2256             : #else
    2257             : #   define X_NE(be, le) le
    2258             : #endif
    2259             : 
    2260       16621 : enum AVPixelFormat av_get_pix_fmt(const char *name)
    2261             : {
    2262             :     enum AVPixelFormat pix_fmt;
    2263             : 
    2264       16621 :     if (!strcmp(name, "rgb32"))
    2265           2 :         name = X_NE("argb", "bgra");
    2266       16619 :     else if (!strcmp(name, "bgr32"))
    2267           4 :         name = X_NE("abgr", "rgba");
    2268             : 
    2269       16621 :     pix_fmt = get_pix_fmt_internal(name);
    2270       16621 :     if (pix_fmt == AV_PIX_FMT_NONE) {
    2271             :         char name2[32];
    2272             : 
    2273        8145 :         snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
    2274        8145 :         pix_fmt = get_pix_fmt_internal(name2);
    2275             :     }
    2276             : 
    2277             : #if FF_API_VAAPI
    2278       16621 :     if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
    2279           0 :         pix_fmt = AV_PIX_FMT_VAAPI;
    2280             : #endif
    2281       16621 :     return pix_fmt;
    2282             : }
    2283             : 
    2284      105801 : int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
    2285             : {
    2286      105801 :     int c, bits = 0;
    2287      105801 :     int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
    2288             : 
    2289      419433 :     for (c = 0; c < pixdesc->nb_components; c++) {
    2290      313632 :         int s = c == 1 || c == 2 ? 0 : log2_pixels;
    2291      313632 :         bits += pixdesc->comp[c].depth << s;
    2292             :     }
    2293             : 
    2294      105801 :     return bits >> log2_pixels;
    2295             : }
    2296             : 
    2297        1546 : int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
    2298             : {
    2299        1546 :     int c, bits = 0;
    2300        1546 :     int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
    2301        1546 :     int steps[4] = {0};
    2302             : 
    2303        6516 :     for (c = 0; c < pixdesc->nb_components; c++) {
    2304        4970 :         const AVComponentDescriptor *comp = &pixdesc->comp[c];
    2305        4970 :         int s = c == 1 || c == 2 ? 0 : log2_pixels;
    2306        4970 :         steps[comp->plane] = comp->step << s;
    2307             :     }
    2308        7730 :     for (c = 0; c < 4; c++)
    2309        6184 :         bits += steps[c];
    2310             : 
    2311        1546 :     if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
    2312        1546 :         bits *= 8;
    2313             : 
    2314        1546 :     return bits >> log2_pixels;
    2315             : }
    2316             : 
    2317           0 : char *av_get_pix_fmt_string(char *buf, int buf_size,
    2318             :                             enum AVPixelFormat pix_fmt)
    2319             : {
    2320             :     /* print header */
    2321           0 :     if (pix_fmt < 0) {
    2322           0 :        snprintf (buf, buf_size, "name" " nb_components" " nb_bits");
    2323             :     } else {
    2324           0 :         const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
    2325           0 :         snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name,
    2326           0 :                  pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
    2327             :     }
    2328             : 
    2329           0 :     return buf;
    2330             : }
    2331             : 
    2332   423630311 : const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
    2333             : {
    2334   423630311 :     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
    2335      744413 :         return NULL;
    2336   422885898 :     return &av_pix_fmt_descriptors[pix_fmt];
    2337             : }
    2338             : 
    2339     5468296 : const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
    2340             : {
    2341     5468296 :     if (!prev)
    2342       29719 :         return &av_pix_fmt_descriptors[0];
    2343    15780789 :     while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) {
    2344    10312493 :         prev++;
    2345    10312493 :         if (prev->name)
    2346     5408858 :             return prev;
    2347             :     }
    2348       29719 :     return NULL;
    2349             : }
    2350             : 
    2351     5438577 : enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
    2352             : {
    2353    10877154 :     if (desc < av_pix_fmt_descriptors ||
    2354     5438577 :         desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
    2355           0 :         return AV_PIX_FMT_NONE;
    2356             : 
    2357     5438577 :     return desc - av_pix_fmt_descriptors;
    2358             : }
    2359             : 
    2360       16379 : int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
    2361             :                                      int *h_shift, int *v_shift)
    2362             : {
    2363       16379 :     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
    2364       16379 :     if (!desc)
    2365           0 :         return AVERROR(ENOSYS);
    2366       16379 :     *h_shift = desc->log2_chroma_w;
    2367       16379 :     *v_shift = desc->log2_chroma_h;
    2368             : 
    2369       16379 :     return 0;
    2370             : }
    2371             : 
    2372       89176 : int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
    2373             : {
    2374       89176 :     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
    2375       89176 :     int i, planes[4] = { 0 }, ret = 0;
    2376             : 
    2377       89176 :     if (!desc)
    2378           0 :         return AVERROR(EINVAL);
    2379             : 
    2380      352845 :     for (i = 0; i < desc->nb_components; i++)
    2381      263669 :         planes[desc->comp[i].plane] = 1;
    2382      445880 :     for (i = 0; i < FF_ARRAY_ELEMS(planes); i++)
    2383      356704 :         ret += planes[i];
    2384       89176 :     return ret;
    2385             : }
    2386             : 
    2387           1 : void ff_check_pixfmt_descriptors(void){
    2388             :     int i, j;
    2389             : 
    2390         349 :     for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
    2391         348 :         const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
    2392         348 :         uint8_t fill[4][8+6+3] = {{0}};
    2393         348 :         uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
    2394         348 :         int linesize[4] = {0,0,0,0};
    2395             :         uint16_t tmp[2];
    2396             : 
    2397         348 :         if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
    2398         165 :             continue;
    2399             : //         av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
    2400         183 :         av_assert0(d->log2_chroma_w <= 3);
    2401         183 :         av_assert0(d->log2_chroma_h <= 3);
    2402         183 :         av_assert0(d->nb_components <= 4);
    2403         183 :         av_assert0(d->name && d->name[0]);
    2404         183 :         av_assert0((d->nb_components==4 || d->nb_components==2) == !!(d->flags & AV_PIX_FMT_FLAG_ALPHA));
    2405             :         av_assert2(av_get_pix_fmt(d->name) == i);
    2406             : 
    2407         915 :         for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
    2408         732 :             const AVComponentDescriptor *c = &d->comp[j];
    2409         732 :             if(j>=d->nb_components) {
    2410         231 :                 av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth);
    2411         231 :                 continue;
    2412             :             }
    2413         501 :             if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
    2414           8 :                 av_assert0(c->step >= c->depth);
    2415             :             } else {
    2416         493 :                 av_assert0(8*c->step >= c->depth);
    2417             :             }
    2418         501 :             if (!strncmp(d->name, "bayer_", 6))
    2419          36 :                 continue;
    2420         465 :             av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
    2421         465 :             av_assert0(tmp[0] == 0 && tmp[1] == 0);
    2422         465 :             tmp[0] = tmp[1] = (1<<c->depth) - 1;
    2423         465 :             av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
    2424             :         }
    2425             :     }
    2426           1 : }
    2427             : 
    2428             : 
    2429           1 : enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
    2430             : {
    2431           1 :     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
    2432             :     char name[16];
    2433             :     int i;
    2434             : 
    2435           1 :     if (!desc || strlen(desc->name) < 2)
    2436           0 :         return AV_PIX_FMT_NONE;
    2437           1 :     av_strlcpy(name, desc->name, sizeof(name));
    2438           1 :     i = strlen(name) - 2;
    2439           1 :     if (strcmp(name + i, "be") && strcmp(name + i, "le"))
    2440           0 :         return AV_PIX_FMT_NONE;
    2441             : 
    2442           1 :     name[i] ^= 'b' ^ 'l';
    2443             : 
    2444           1 :     return get_pix_fmt_internal(name);
    2445             : }
    2446             : 
    2447             : #define FF_COLOR_NA      -1
    2448             : #define FF_COLOR_RGB      0 /**< RGB color space */
    2449             : #define FF_COLOR_GRAY     1 /**< gray color space */
    2450             : #define FF_COLOR_YUV      2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
    2451             : #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
    2452             : #define FF_COLOR_XYZ      4
    2453             : 
    2454             : #define pixdesc_has_alpha(pixdesc) \
    2455             :     ((pixdesc)->nb_components == 2 || (pixdesc)->nb_components == 4 || (pixdesc)->flags & AV_PIX_FMT_FLAG_PAL)
    2456             : 
    2457             : 
    2458        5436 : static int get_color_type(const AVPixFmtDescriptor *desc) {
    2459        5436 :     if (desc->flags & AV_PIX_FMT_FLAG_PAL)
    2460          27 :         return FF_COLOR_RGB;
    2461             : 
    2462        5409 :     if(desc->nb_components == 1 || desc->nb_components == 2)
    2463         313 :         return FF_COLOR_GRAY;
    2464             : 
    2465        5096 :     if(desc->name && !strncmp(desc->name, "yuvj", 4))
    2466          64 :         return FF_COLOR_YUV_JPEG;
    2467             : 
    2468        5032 :     if(desc->name && !strncmp(desc->name, "xyz", 3))
    2469           2 :         return FF_COLOR_XYZ;
    2470             : 
    2471        5030 :     if(desc->flags & AV_PIX_FMT_FLAG_RGB)
    2472        1776 :         return  FF_COLOR_RGB;
    2473             : 
    2474        3254 :     if(desc->nb_components == 0)
    2475           0 :         return FF_COLOR_NA;
    2476             : 
    2477        3254 :     return FF_COLOR_YUV;
    2478             : }
    2479             : 
    2480        5436 : static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt)
    2481             : {
    2482        5436 :     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
    2483             :     int i;
    2484             : 
    2485        5436 :     if (!desc || !desc->nb_components) {
    2486           0 :         *min = *max = 0;
    2487           0 :         return AVERROR(EINVAL);
    2488             :     }
    2489             : 
    2490        5436 :     *min = INT_MAX, *max = -INT_MAX;
    2491       21499 :     for (i = 0; i < desc->nb_components; i++) {
    2492       16063 :         *min = FFMIN(desc->comp[i].depth, *min);
    2493       16063 :         *max = FFMAX(desc->comp[i].depth, *max);
    2494             :     }
    2495        5436 :     return 0;
    2496             : }
    2497             : 
    2498        3232 : static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
    2499             :                               enum AVPixelFormat src_pix_fmt,
    2500             :                               unsigned *lossp, unsigned consider)
    2501             : {
    2502        3232 :     const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
    2503        3232 :     const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
    2504             :     int src_color, dst_color;
    2505             :     int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth;
    2506             :     int ret, loss, i, nb_components;
    2507        3232 :     int score = INT_MAX - 1;
    2508             : 
    2509        3232 :     if (dst_pix_fmt >= AV_PIX_FMT_NB || dst_pix_fmt <= AV_PIX_FMT_NONE)
    2510         296 :         return ~0;
    2511             : 
    2512             :     /* compute loss */
    2513        2936 :     *lossp = loss = 0;
    2514             : 
    2515        2936 :     if (dst_pix_fmt == src_pix_fmt)
    2516         218 :         return INT_MAX;
    2517             : 
    2518        2718 :     if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
    2519           0 :         return ret;
    2520        2718 :     if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
    2521           0 :         return ret;
    2522             : 
    2523        2718 :     src_color = get_color_type(src_desc);
    2524        2718 :     dst_color = get_color_type(dst_desc);
    2525        2718 :     if (dst_pix_fmt == AV_PIX_FMT_PAL8)
    2526          17 :         nb_components = FFMIN(src_desc->nb_components, 4);
    2527             :     else
    2528        2701 :         nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components);
    2529             : 
    2530       10291 :     for (i = 0; i < nb_components; i++) {
    2531        7573 :         int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1);
    2532        7573 :         if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) {
    2533        3350 :             loss |= FF_LOSS_DEPTH;
    2534        3350 :             score -= 65536 >> depth_minus1;
    2535             :         }
    2536             :     }
    2537             : 
    2538        2718 :     if (consider & FF_LOSS_RESOLUTION) {
    2539        2718 :         if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) {
    2540         406 :             loss |= FF_LOSS_RESOLUTION;
    2541         406 :             score -= 256 << dst_desc->log2_chroma_w;
    2542             :         }
    2543        2718 :         if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) {
    2544         383 :             loss |= FF_LOSS_RESOLUTION;
    2545         383 :             score -= 256 << dst_desc->log2_chroma_h;
    2546             :         }
    2547             :         // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side
    2548        3060 :         if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 &&
    2549         558 :             dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) {
    2550         216 :             score += 512;
    2551             :         }
    2552             :     }
    2553             : 
    2554        2718 :     if(consider & FF_LOSS_COLORSPACE)
    2555        2718 :     switch(dst_color) {
    2556             :     case FF_COLOR_RGB:
    2557        1121 :         if (src_color != FF_COLOR_RGB &&
    2558             :             src_color != FF_COLOR_GRAY)
    2559         704 :             loss |= FF_LOSS_COLORSPACE;
    2560        1121 :         break;
    2561             :     case FF_COLOR_GRAY:
    2562         159 :         if (src_color != FF_COLOR_GRAY)
    2563         146 :             loss |= FF_LOSS_COLORSPACE;
    2564         159 :         break;
    2565             :     case FF_COLOR_YUV:
    2566        1399 :         if (src_color != FF_COLOR_YUV)
    2567         364 :             loss |= FF_LOSS_COLORSPACE;
    2568        1399 :         break;
    2569             :     case FF_COLOR_YUV_JPEG:
    2570          37 :         if (src_color != FF_COLOR_YUV_JPEG &&
    2571           0 :             src_color != FF_COLOR_YUV &&
    2572             :             src_color != FF_COLOR_GRAY)
    2573           0 :             loss |= FF_LOSS_COLORSPACE;
    2574          37 :         break;
    2575             :     default:
    2576             :         /* fail safe test */
    2577           2 :         if (src_color != dst_color)
    2578           2 :             loss |= FF_LOSS_COLORSPACE;
    2579           2 :         break;
    2580             :     }
    2581        2718 :     if(loss & FF_LOSS_COLORSPACE)
    2582        1216 :         score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1);
    2583             : 
    2584        2718 :     if (dst_color == FF_COLOR_GRAY &&
    2585         146 :         src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) {
    2586         146 :         loss |= FF_LOSS_CHROMA;
    2587         146 :         score -= 2 * 65536;
    2588             :     }
    2589        2718 :     if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
    2590          32 :         loss |= FF_LOSS_ALPHA;
    2591          32 :         score -= 65536;
    2592             :     }
    2593        2718 :     if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
    2594          17 :         (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
    2595          11 :         loss |= FF_LOSS_COLORQUANT;
    2596          11 :         score -= 65536;
    2597             :     }
    2598             : 
    2599        2718 :     *lossp = loss;
    2600        2718 :     return score;
    2601             : }
    2602             : 
    2603           0 : int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
    2604             :                             enum AVPixelFormat src_pix_fmt,
    2605             :                             int has_alpha)
    2606             : {
    2607             :     int loss;
    2608           0 :     int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, &loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA);
    2609           0 :     if (ret < 0)
    2610           0 :         return ret;
    2611           0 :     return loss;
    2612             : }
    2613             : 
    2614        1616 : enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
    2615             :                                              enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
    2616             : {
    2617             :     enum AVPixelFormat dst_pix_fmt;
    2618             :     int loss1, loss2, loss_mask;
    2619        1616 :     const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1);
    2620        1616 :     const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
    2621             :     int score1, score2;
    2622             : 
    2623        1616 :     loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
    2624        1616 :     if(!has_alpha)
    2625        1585 :         loss_mask &= ~FF_LOSS_ALPHA;
    2626             : 
    2627        1616 :     score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
    2628        1616 :     score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
    2629             : 
    2630        1616 :     if (score1 == score2) {
    2631         441 :         if(av_get_padded_bits_per_pixel(desc2) != av_get_padded_bits_per_pixel(desc1)) {
    2632         320 :             dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
    2633             :         } else {
    2634         121 :             dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
    2635             :         }
    2636             :     } else {
    2637        1175 :         dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
    2638             :     }
    2639             : 
    2640        1616 :     if (loss_ptr)
    2641           0 :         *loss_ptr = av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
    2642        1616 :     return dst_pix_fmt;
    2643             : }
    2644             : 
    2645         713 : const char *av_color_range_name(enum AVColorRange range)
    2646             : {
    2647             :     return (unsigned) range < AVCOL_RANGE_NB ?
    2648         713 :         color_range_names[range] : NULL;
    2649             : }
    2650             : 
    2651         187 : const char *av_color_primaries_name(enum AVColorPrimaries primaries)
    2652             : {
    2653             :     return (unsigned) primaries < AVCOL_PRI_NB ?
    2654         187 :         color_primaries_names[primaries] : NULL;
    2655             : }
    2656             : 
    2657         187 : const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
    2658             : {
    2659             :     return (unsigned) transfer < AVCOL_TRC_NB ?
    2660         187 :         color_transfer_names[transfer] : NULL;
    2661             : }
    2662             : 
    2663         161 : const char *av_color_space_name(enum AVColorSpace space)
    2664             : {
    2665             :     return (unsigned) space < AVCOL_SPC_NB ?
    2666         161 :         color_space_names[space] : NULL;
    2667             : }
    2668             : 
    2669          26 : const char *av_chroma_location_name(enum AVChromaLocation location)
    2670             : {
    2671             :     return (unsigned) location < AVCHROMA_LOC_NB ?
    2672          26 :         chroma_location_names[location] : NULL;
    2673             : }

Generated by: LCOV version 1.12