• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef VIDEO_PIXEL_FORMAT_H_
6 #define VIDEO_PIXEL_FORMAT_H_
7 
8 namespace media {
9 
10 // Pixel formats roughly based on FOURCC labels, see:
11 // http://www.fourcc.org/rgb.php and http://www.fourcc.org/yuv.php
12 // Logged to UMA, so never reuse values. Leave gaps if necessary.
13 // Ordered as planar, semi-planar, YUV-packed, and RGB formats.
14 enum VideoPixelFormat {
15   PIXEL_FORMAT_UNKNOWN = 0,  // Unknown or unspecified format value.
16   PIXEL_FORMAT_I420 =
17       1,  // 12bpp YUV planar 1x1 Y, 2x2 UV samples, a.k.a. YU12.
18   PIXEL_FORMAT_YV12 = 2,   // 12bpp YVU planar 1x1 Y, 2x2 VU samples.
19   PIXEL_FORMAT_YV16 = 3,   // 16bpp YVU planar 1x1 Y, 2x1 VU samples.
20   PIXEL_FORMAT_YV12A = 4,  // 20bpp YUVA planar 1x1 Y, 2x2 VU, 1x1 A samples.
21   PIXEL_FORMAT_YV24 = 5,   // 24bpp YUV planar, no subsampling.
22   PIXEL_FORMAT_NV12 =
23       6,  // 12bpp with Y plane followed by a 2x2 interleaved UV plane.
24   PIXEL_FORMAT_NV21 =
25       7,  // 12bpp with Y plane followed by a 2x2 interleaved VU plane.
26   PIXEL_FORMAT_UYVY =
27       8,  // 16bpp interleaved 2x1 U, 1x1 Y, 2x1 V, 1x1 Y samples.
28   PIXEL_FORMAT_YUY2 =
29       9,  // 16bpp interleaved 1x1 Y, 2x1 U, 1x1 Y, 2x1 V samples.
30   PIXEL_FORMAT_ARGB = 10,   // 32bpp ARGB, 1 plane.
31   PIXEL_FORMAT_XRGB = 11,   // 24bpp XRGB, 1 plane.
32   PIXEL_FORMAT_RGB24 = 12,  // 24bpp BGR, 1 plane.
33   PIXEL_FORMAT_RGB32 = 13,  // 32bpp BGRA, 1 plane.
34   PIXEL_FORMAT_MJPEG = 14,  // MJPEG compressed.
35   // MediaTek proprietary format. MT21 is similar to NV21 except the memory
36   // layout and pixel layout (swizzles). 12bpp with Y plane followed by a 2x2
37   // interleaved VU plane. Each image contains two buffers -- Y plane and VU
38   // plane. Two planes can be non-contiguous in memory. The starting addresses
39   // of Y plane and VU plane are 4KB alignment.
40   // Suppose image dimension is (width, height). For both Y plane and VU plane:
41   // Row pitch = ((width+15)/16) * 16.
42   // Plane size = Row pitch * (((height+31)/32)*32)
43   PIXEL_FORMAT_MT21 = 15,
44 
45   PIXEL_FORMAT_YUV420P9 = 16,
46   PIXEL_FORMAT_YUV420P10 = 17,
47   PIXEL_FORMAT_YUV422P9 = 18,
48   PIXEL_FORMAT_YUV422P10 = 19,
49   PIXEL_FORMAT_YUV444P9 = 20,
50   PIXEL_FORMAT_YUV444P10 = 21,
51 
52   PIXEL_FORMAT_YUV420P12 = 22,
53   PIXEL_FORMAT_YUV422P12 = 23,
54   PIXEL_FORMAT_YUV444P12 = 24,
55 
56   PIXEL_FORMAT_Y8 = 25,   // single 8bpp plane.
57   PIXEL_FORMAT_Y16 = 26,  // single 16bpp plane.
58 
59   PIXEL_FORMAT_I422 =
60       27,  // 16bpp YUV planar 1x1 Y, 2x1 UV samples, a.k.a. YU16.
61 
62   // Please update UMA histogram enumeration when adding new formats here.
63   PIXEL_FORMAT_MAX =
64       PIXEL_FORMAT_I422,  // Must always be equal to largest entry logged.
65 };
66 
67 }  // namespace media
68 
69 #endif  // VIDEO_PIXEL_FORMAT_H_
70