LCOV - code coverage report
Current view: top level - libavutil - pixdesc.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 291 350 83.1 %
Date: 2018-05-20 11:54:08 Functions: 23 30 76.7 %

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

Generated by: LCOV version 1.13