Home | History | Annotate | Download | only in vda
      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 // Note: ported from Chromium commit head: 006301b
      5 // Note: only necessary functions are ported from video_types.h
      6 
      7 #ifndef VIDEO_PIXEL_FORMAT_H_
      8 #define VIDEO_PIXEL_FORMAT_H_
      9 
     10 namespace media {
     11 
     12 // Pixel formats roughly based on FOURCC labels, see:
     13 // http://www.fourcc.org/rgb.php and http://www.fourcc.org/yuv.php
     14 // Logged to UMA, so never reuse values. Leave gaps if necessary.
     15 // Ordered as planar, semi-planar, YUV-packed, and RGB formats.
     16 enum VideoPixelFormat {
     17   PIXEL_FORMAT_UNKNOWN = 0,  // Unknown or unspecified format value.
     18   PIXEL_FORMAT_I420 =
     19       1,  // 12bpp YUV planar 1x1 Y, 2x2 UV samples, a.k.a. YU12.
     20 
     21   // Note: Chrome does not actually support YVU compositing, so you probably
     22   // don't actually want to use this. See http://crbug.com/784627.
     23   PIXEL_FORMAT_YV12 = 2,  // 12bpp YVU planar 1x1 Y, 2x2 VU samples.
     24 
     25   PIXEL_FORMAT_I422 = 3,   // 16bpp YUV planar 1x1 Y, 2x1 UV samples.
     26   PIXEL_FORMAT_I420A = 4,  // 20bpp YUVA planar 1x1 Y, 2x2 UV, 1x1 A samples.
     27   PIXEL_FORMAT_I444 = 5,   // 24bpp YUV planar, no subsampling.
     28   PIXEL_FORMAT_NV12 =
     29       6,  // 12bpp with Y plane followed by a 2x2 interleaved UV plane.
     30   PIXEL_FORMAT_NV21 =
     31       7,  // 12bpp with Y plane followed by a 2x2 interleaved VU plane.
     32   PIXEL_FORMAT_UYVY =
     33       8,  // 16bpp interleaved 2x1 U, 1x1 Y, 2x1 V, 1x1 Y samples.
     34   PIXEL_FORMAT_YUY2 =
     35       9,  // 16bpp interleaved 1x1 Y, 2x1 U, 1x1 Y, 2x1 V samples.
     36   PIXEL_FORMAT_ARGB = 10,   // 32bpp ARGB, 1 plane.
     37   PIXEL_FORMAT_XRGB = 11,   // 24bpp XRGB, 1 plane.
     38   PIXEL_FORMAT_RGB24 = 12,  // 24bpp BGR, 1 plane.
     39   PIXEL_FORMAT_RGB32 = 13,  // 32bpp BGRA, 1 plane.
     40   PIXEL_FORMAT_MJPEG = 14,  // MJPEG compressed.
     41   // MediaTek proprietary format. MT21 is similar to NV21 except the memory
     42   // layout and pixel layout (swizzles). 12bpp with Y plane followed by a 2x2
     43   // interleaved VU plane. Each image contains two buffers -- Y plane and VU
     44   // plane. Two planes can be non-contiguous in memory. The starting addresses
     45   // of Y plane and VU plane are 4KB alignment.
     46   // Suppose image dimension is (width, height). For both Y plane and VU plane:
     47   // Row pitch = ((width+15)/16) * 16.
     48   // Plane size = Row pitch * (((height+31)/32)*32)
     49   PIXEL_FORMAT_MT21 = 15,
     50 
     51   // The P* in the formats below designates the number of bits per pixel. I.e.
     52   // P9 is 9-bits per pixel, P10 is 10-bits per pixel, etc.
     53   PIXEL_FORMAT_YUV420P9 = 16,
     54   PIXEL_FORMAT_YUV420P10 = 17,
     55   PIXEL_FORMAT_YUV422P9 = 18,
     56   PIXEL_FORMAT_YUV422P10 = 19,
     57   PIXEL_FORMAT_YUV444P9 = 20,
     58   PIXEL_FORMAT_YUV444P10 = 21,
     59 
     60   PIXEL_FORMAT_YUV420P12 = 22,
     61   PIXEL_FORMAT_YUV422P12 = 23,
     62   PIXEL_FORMAT_YUV444P12 = 24,
     63 
     64   /* PIXEL_FORMAT_Y8 = 25, Deprecated */
     65   PIXEL_FORMAT_Y16 = 26,  // single 16bpp plane.
     66 
     67   // Please update UMA histogram enumeration when adding new formats here.
     68   PIXEL_FORMAT_MAX =
     69       PIXEL_FORMAT_Y16,  // Must always be equal to largest entry logged.
     70 };
     71 
     72 }  // namespace media
     73 
     74 #endif  // VIDEO_PIXEL_FORMAT_H_
     75