xref: /aosp_15_r20/external/intel-media-driver/media_common/agnostic/common/os/media_fourcc.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2017, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file      media_fourcc.h
24 //! \brief     FourCC color format definitions.
25 //!
26 #ifndef _MEDIA_FOURCC_H
27 #define _MEDIA_FOURCC_H
28 
29 #ifndef MAKEFOURCC
30 #define MAKEFOURCC(ch0, ch1, ch2, ch3)  \
31                   ((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) |  \
32                   ((uint32_t)(uint8_t)(ch2) << 16) | ((uint32_t)(uint8_t)(ch3) << 24 ))
33 #endif // MAKEFOURCC
34 
35 // Use the above Equation to get the Fourcc Values
36 
37 #define FOURCC_YUY2   0x32595559   // Normal YUV 4:2:2 format YUYV..
38 #define FOURCC_UYVY   0x59565955   // YUV 4:2:2 format Y Swapped UYVY..
39 #define FOURCC_VBID   0x44494256
40 #define FOURCC_YVYU   0x55595659   // YUV 4:2:2 format UV Swapped YVYU
41 #define FOURCC_I420   0x30323449   // YUV 4:2:0 format planner
42 #define FOURCC_IYUV   0x56555949   // YUV 4:2:0 format Same as I420
43 #define FOURCC_YV12   0x32315659   // Planner YUV 4:2:0 format UV Swapped
44 #define FOURCC_AI44   0x34344941   // Fourcc for the Motion Comp Alpha Blend Surface
45 #define FOURCC_IA44   0x34344149   // same as AI44
46 #define FOURCC_IF09   0x39304649   // Planar 4:1:0
47 #define FOURCC_YVU9   0x39555659   // Planar 4:1:0
48 #define FOURCC_VYUY   0x59555956   // YUV 4:2:2 format Y and UV Swapped YUYV
49 #define FOURCC_2YUY   0x59555932   // Swizzle format of YUY2
50 #define FOURCC_Y41P   0x50313459   // YUV 4:1:1 format packed
51 #define FOURCC_IMC1   0x31434D49   // as YV12, except the same UV stride as Y
52 #define FOURCC_IMC2   0x32434D49   // as IMC1, except UV lines are interleaved at half-stride boundaries
53 #define FOURCC_IMC3   0x33434D49   // as IMC1, except the UV are swaped
54 #define FOURCC_IMC4   0x34434D49   // as IMC2, except UV are swaped
55 #define FOURCC_422P   0x50323234   // YUV 4:2:2 planar, internal use only.
56 #define FOURCC_NV12   0x3231564e   // YUV 4:2:0 planar, for media
57 #define FOURCC_NV11   0x3131564e   // YUV 4:1:1 planar, for media
58 #define FOURCC_NV21   0x3132564e   // as NV12 with U and V reversed in the interleaved plane
59 #define FOURCC_P016   0x36313050   // YUV 4:2:0 planar, for media
60 #define FOURCC_P010   0x30313050   // YUV 4:2:0 planar, for media
61 #define FOURCC_P208   0x38303250   // YUV 4:2:2 planar, for media
62 #define FOURCC_AYUV   0x56555941   // Format packed for HD media
63 #define FOURCC_VXUY   0x59555856   // Swizzle format of AYUV
64 #define FOURCC_Y210   0x30313259   // YUV 4:2:2 packed, similar to Y216 but with 10 bits per channel
65 #define FOURCC_Y216   0x36313259   // YUV 4:2:2 packed, similar to YUYV but with 16 bits per channel
66 #define FOURCC_Y410   0x30313459   // YUV 4:4:4 packed, simple UYVA with 10 bits per channel and 2 for alpha
67 #define FOURCC_Y416   0x36313459   // YUV 4:4:4 packed, simple UYVA with 16 bits for all channels
68 
69 // nullptr format indicates that the driver should not allocate any video memory
70 #define FOURCC_NULL   MAKEFOURCC( 'N', 'U', 'L', 'L' )
71 
72 // Formats used for JPEG decode
73 #define FOURCC_422H    MAKEFOURCC('4','2','2','H')
74 #define FOURCC_422V    MAKEFOURCC('4','2','2','V')
75 #define FOURCC_411P    MAKEFOURCC('4','1','1','P')
76 #define FOURCC_411R    MAKEFOURCC('4','1','1','R')
77 #define FOURCC_444P    MAKEFOURCC('4','4','4','P')
78 #define FOURCC_RGBP    MAKEFOURCC('R','G','B','P')
79 #define FOURCC_BGRP    MAKEFOURCC('B','G','R','P')
80 #define FOURCC_400P    MAKEFOURCC('4','0','0','P')
81 #define FOURCC_420O    MAKEFOURCC('4','2','0','O')
82 
83 // Bayer Pattern
84 #define FOURCC_IRW0    MAKEFOURCC('I','R','W','0')  // BGGR 10/12 bit depth [16bit aligned]
85 #define FOURCC_IRW1    MAKEFOURCC('I','R','W','1')  // RGGB 10/12 bit depth [16bit aligned]
86 #define FOURCC_IRW2    MAKEFOURCC('I','R','W','2')  // GRBG 10/12 bit depth [16bit aligned]
87 #define FOURCC_IRW3    MAKEFOURCC('I','R','W','3')  // GBRG 10/12 bit depth [16bit aligned]
88 #define FOURCC_IRW4    MAKEFOURCC('I','R','W','4')  // BGGR 8 bit depth
89 #define FOURCC_IRW5    MAKEFOURCC('I','R','W','5')  // RGGB 8 bit depth
90 #define FOURCC_IRW6    MAKEFOURCC('I','R','W','6')  // GRBG 8 bit depth
91 #define FOURCC_IRW7    MAKEFOURCC('I','R','W','7')  // GBRG 8 bit depth
92 
93 #endif //_MEDIA_FOURCC_H
94