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.
5 #include "media/base/video_types.h"
7 #include "base/logging.h"
11 std::string
VideoPixelFormatToString(VideoPixelFormat format
) {
13 case PIXEL_FORMAT_UNKNOWN
:
14 return "PIXEL_FORMAT_UNKNOWN";
15 case PIXEL_FORMAT_I420
:
16 return "PIXEL_FORMAT_I420";
17 case PIXEL_FORMAT_YV12
:
18 return "PIXEL_FORMAT_YV12";
19 case PIXEL_FORMAT_YV16
:
20 return "PIXEL_FORMAT_YV16";
21 case PIXEL_FORMAT_YV12A
:
22 return "PIXEL_FORMAT_YV12A";
23 case PIXEL_FORMAT_YV24
:
24 return "PIXEL_FORMAT_YV24";
25 case PIXEL_FORMAT_NV12
:
26 return "PIXEL_FORMAT_NV12";
27 case PIXEL_FORMAT_NV21
:
28 return "PIXEL_FORMAT_NV21";
29 case PIXEL_FORMAT_UYVY
:
30 return "PIXEL_FORMAT_UYVY";
31 case PIXEL_FORMAT_YUY2
:
32 return "PIXEL_FORMAT_YUY2";
33 case PIXEL_FORMAT_ARGB
:
34 return "PIXEL_FORMAT_ARGB";
35 case PIXEL_FORMAT_XRGB
:
36 return "PIXEL_FORMAT_XRGB";
37 case PIXEL_FORMAT_RGB24
:
38 return "PIXEL_FORMAT_RGB24";
39 case PIXEL_FORMAT_RGB32
:
40 return "PIXEL_FORMAT_RGB32";
41 case PIXEL_FORMAT_MJPEG
:
42 return "PIXEL_FORMAT_MJPEG";
43 case PIXEL_FORMAT_MT21
:
44 return "PIXEL_FORMAT_MT21";
46 NOTREACHED() << "Invalid VideoPixelFormat provided: " << format
;
50 bool IsYuvPlanar(VideoPixelFormat format
) {
52 case PIXEL_FORMAT_YV12
:
53 case PIXEL_FORMAT_I420
:
54 case PIXEL_FORMAT_YV16
:
55 case PIXEL_FORMAT_YV12A
:
56 case PIXEL_FORMAT_YV24
:
57 case PIXEL_FORMAT_NV12
:
58 case PIXEL_FORMAT_NV21
:
59 case PIXEL_FORMAT_MT21
:
62 case PIXEL_FORMAT_UNKNOWN
:
63 case PIXEL_FORMAT_UYVY
:
64 case PIXEL_FORMAT_YUY2
:
65 case PIXEL_FORMAT_ARGB
:
66 case PIXEL_FORMAT_XRGB
:
67 case PIXEL_FORMAT_RGB24
:
68 case PIXEL_FORMAT_RGB32
:
69 case PIXEL_FORMAT_MJPEG
: