Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: ui/gl/gl_image_io_surface.mm

Issue 1316493004: Add support for converting I420 software frames into NV12 hardware frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snapshot
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/buffer_types.h ('k') | ui/gl/gl_image_memory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_image_io_surface.h" 5 #include "ui/gl/gl_image_io_surface.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 19 matching lines...) Expand all
30 default: 30 default:
31 return false; 31 return false;
32 } 32 }
33 } 33 }
34 34
35 bool ValidFormat(BufferFormat format) { 35 bool ValidFormat(BufferFormat format) {
36 switch (format) { 36 switch (format) {
37 case BufferFormat::R_8: 37 case BufferFormat::R_8:
38 case BufferFormat::BGRA_8888: 38 case BufferFormat::BGRA_8888:
39 case BufferFormat::UYVY_422: 39 case BufferFormat::UYVY_422:
40 case BufferFormat::YUV_420_BIPLANAR:
40 return true; 41 return true;
41 case BufferFormat::ATC: 42 case BufferFormat::ATC:
42 case BufferFormat::ATCIA: 43 case BufferFormat::ATCIA:
43 case BufferFormat::DXT1: 44 case BufferFormat::DXT1:
44 case BufferFormat::DXT5: 45 case BufferFormat::DXT5:
45 case BufferFormat::ETC1: 46 case BufferFormat::ETC1:
46 case BufferFormat::RGBA_4444: 47 case BufferFormat::RGBA_4444:
47 case BufferFormat::RGBA_8888: 48 case BufferFormat::RGBA_8888:
48 case BufferFormat::BGRX_8888: 49 case BufferFormat::BGRX_8888:
49 case BufferFormat::YUV_420: 50 case BufferFormat::YUV_420:
50 return false; 51 return false;
51 } 52 }
52 53
53 NOTREACHED(); 54 NOTREACHED();
54 return false; 55 return false;
55 } 56 }
56 57
57 GLenum TextureFormat(BufferFormat format) { 58 GLenum TextureFormat(BufferFormat format) {
58 switch (format) { 59 switch (format) {
59 case BufferFormat::R_8: 60 case BufferFormat::R_8:
61 case BufferFormat::YUV_420_BIPLANAR:
60 return GL_RED; 62 return GL_RED;
61 case BufferFormat::BGRA_8888: 63 case BufferFormat::BGRA_8888:
62 return GL_RGBA; 64 return GL_RGBA;
63 case BufferFormat::UYVY_422: 65 case BufferFormat::UYVY_422:
64 return GL_RGB; 66 return GL_RGB;
65 case BufferFormat::ATC: 67 case BufferFormat::ATC:
66 case BufferFormat::ATCIA: 68 case BufferFormat::ATCIA:
67 case BufferFormat::DXT1: 69 case BufferFormat::DXT1:
68 case BufferFormat::DXT5: 70 case BufferFormat::DXT5:
69 case BufferFormat::ETC1: 71 case BufferFormat::ETC1:
70 case BufferFormat::RGBA_4444: 72 case BufferFormat::RGBA_4444:
71 case BufferFormat::RGBA_8888: 73 case BufferFormat::RGBA_8888:
72 case BufferFormat::BGRX_8888: 74 case BufferFormat::BGRX_8888:
73 case BufferFormat::YUV_420: 75 case BufferFormat::YUV_420:
74 NOTREACHED(); 76 NOTREACHED();
75 return 0; 77 return 0;
76 } 78 }
77 79
78 NOTREACHED(); 80 NOTREACHED();
79 return 0; 81 return 0;
80 } 82 }
81 83
82 GLenum DataFormat(BufferFormat format) { 84 GLenum DataFormat(BufferFormat format) {
83 switch (format) { 85 switch (format) {
84 case BufferFormat::R_8: 86 case BufferFormat::R_8:
87 case BufferFormat::YUV_420_BIPLANAR:
85 return GL_RED; 88 return GL_RED;
86 case BufferFormat::BGRA_8888: 89 case BufferFormat::BGRA_8888:
87 return GL_BGRA; 90 return GL_BGRA;
88 case BufferFormat::UYVY_422: 91 case BufferFormat::UYVY_422:
89 return GL_YCBCR_422_APPLE; 92 return GL_YCBCR_422_APPLE;
90 break; 93 break;
91 case BufferFormat::ATC: 94 case BufferFormat::ATC:
92 case BufferFormat::ATCIA: 95 case BufferFormat::ATCIA:
93 case BufferFormat::DXT1: 96 case BufferFormat::DXT1:
94 case BufferFormat::DXT5: 97 case BufferFormat::DXT5:
95 case BufferFormat::ETC1: 98 case BufferFormat::ETC1:
96 case BufferFormat::RGBA_4444: 99 case BufferFormat::RGBA_4444:
97 case BufferFormat::RGBA_8888: 100 case BufferFormat::RGBA_8888:
98 case BufferFormat::BGRX_8888: 101 case BufferFormat::BGRX_8888:
99 case BufferFormat::YUV_420: 102 case BufferFormat::YUV_420:
100 NOTREACHED(); 103 NOTREACHED();
101 return 0; 104 return 0;
102 } 105 }
103 106
104 NOTREACHED(); 107 NOTREACHED();
105 return 0; 108 return 0;
106 } 109 }
107 110
108 GLenum DataType(BufferFormat format) { 111 GLenum DataType(BufferFormat format) {
109 switch (format) { 112 switch (format) {
110 case BufferFormat::R_8: 113 case BufferFormat::R_8:
114 case BufferFormat::YUV_420_BIPLANAR:
111 return GL_UNSIGNED_BYTE; 115 return GL_UNSIGNED_BYTE;
112 case BufferFormat::BGRA_8888: 116 case BufferFormat::BGRA_8888:
113 return GL_UNSIGNED_INT_8_8_8_8_REV; 117 return GL_UNSIGNED_INT_8_8_8_8_REV;
114 case BufferFormat::UYVY_422: 118 case BufferFormat::UYVY_422:
115 return GL_UNSIGNED_SHORT_8_8_APPLE; 119 return GL_UNSIGNED_SHORT_8_8_APPLE;
116 break; 120 break;
117 case BufferFormat::ATC: 121 case BufferFormat::ATC:
118 case BufferFormat::ATCIA: 122 case BufferFormat::ATCIA:
119 case BufferFormat::DXT1: 123 case BufferFormat::DXT1:
120 case BufferFormat::DXT5: 124 case BufferFormat::DXT5:
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // static 245 // static
242 void GLImageIOSurface::SetLayerForWidget( 246 void GLImageIOSurface::SetLayerForWidget(
243 gfx::AcceleratedWidget widget, CALayer* layer) { 247 gfx::AcceleratedWidget widget, CALayer* layer) {
244 if (layer) 248 if (layer)
245 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer)); 249 g_widget_to_layer_map.Pointer()->insert(std::make_pair(widget, layer));
246 else 250 else
247 g_widget_to_layer_map.Pointer()->erase(widget); 251 g_widget_to_layer_map.Pointer()->erase(widget);
248 } 252 }
249 253
250 } // namespace gfx 254 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/buffer_types.h ('k') | ui/gl/gl_image_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698