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

Side by Side Diff: cc/test/test_gpu_memory_buffer_manager.cc

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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/test/test_gpu_memory_buffer_manager.h" 5 #include "cc/test/test_gpu_memory_buffer_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/numerics/safe_conversions.h" 8 #include "base/numerics/safe_conversions.h"
9 #include "ui/gfx/buffer_format_util.h" 9 #include "ui/gfx/buffer_format_util.h"
10 #include "ui/gfx/gpu_memory_buffer.h" 10 #include "ui/gfx/gpu_memory_buffer.h"
(...skipping 13 matching lines...) Expand all
24 case gfx::BufferFormat::RGBA_8888: 24 case gfx::BufferFormat::RGBA_8888:
25 case gfx::BufferFormat::BGRX_8888: 25 case gfx::BufferFormat::BGRX_8888:
26 case gfx::BufferFormat::BGRA_8888: 26 case gfx::BufferFormat::BGRA_8888:
27 case gfx::BufferFormat::UYVY_422: 27 case gfx::BufferFormat::UYVY_422:
28 return 1; 28 return 1;
29 case gfx::BufferFormat::YUV_420: { 29 case gfx::BufferFormat::YUV_420: {
30 static size_t factor[] = {1, 2, 2}; 30 static size_t factor[] = {1, 2, 2};
31 DCHECK_LT(static_cast<size_t>(plane), arraysize(factor)); 31 DCHECK_LT(static_cast<size_t>(plane), arraysize(factor));
32 return factor[plane]; 32 return factor[plane];
33 } 33 }
34 case gfx::BufferFormat::YUV_420_BIPLANAR: {
35 static size_t factor[] = {1, 2};
36 DCHECK_LT(static_cast<size_t>(plane), arraysize(factor));
37 return factor[plane];
38 }
34 } 39 }
35 NOTREACHED(); 40 NOTREACHED();
36 return 0; 41 return 0;
37 } 42 }
38 43
39 size_t StrideInBytes(size_t width, gfx::BufferFormat format, int plane) { 44 size_t StrideInBytes(size_t width, gfx::BufferFormat format, int plane) {
40 switch (format) { 45 switch (format) {
41 case gfx::BufferFormat::ATCIA: 46 case gfx::BufferFormat::ATCIA:
42 case gfx::BufferFormat::DXT5: 47 case gfx::BufferFormat::DXT5:
43 DCHECK_EQ(plane, 0); 48 DCHECK_EQ(plane, 0);
(...skipping 10 matching lines...) Expand all
54 case gfx::BufferFormat::UYVY_422: 59 case gfx::BufferFormat::UYVY_422:
55 DCHECK_EQ(plane, 0); 60 DCHECK_EQ(plane, 0);
56 return width * 2; 61 return width * 2;
57 case gfx::BufferFormat::RGBA_8888: 62 case gfx::BufferFormat::RGBA_8888:
58 case gfx::BufferFormat::BGRX_8888: 63 case gfx::BufferFormat::BGRX_8888:
59 case gfx::BufferFormat::BGRA_8888: 64 case gfx::BufferFormat::BGRA_8888:
60 DCHECK_EQ(plane, 0); 65 DCHECK_EQ(plane, 0);
61 return width * 4; 66 return width * 4;
62 case gfx::BufferFormat::YUV_420: 67 case gfx::BufferFormat::YUV_420:
63 return width / SubsamplingFactor(format, plane); 68 return width / SubsamplingFactor(format, plane);
69 case gfx::BufferFormat::YUV_420_BIPLANAR:
70 return width;
64 } 71 }
65 NOTREACHED(); 72 NOTREACHED();
66 return 0; 73 return 0;
67 } 74 }
68 75
69 size_t BufferSizeInBytes(const gfx::Size& size, gfx::BufferFormat format) { 76 size_t BufferSizeInBytes(const gfx::Size& size, gfx::BufferFormat format) {
70 size_t size_in_bytes = 0; 77 size_t size_in_bytes = 0;
71 int num_planes = static_cast<int>(gfx::NumberOfPlanesForBufferFormat(format)); 78 int num_planes = static_cast<int>(gfx::NumberOfPlanesForBufferFormat(format));
72 for (int i = 0; i < num_planes; ++i) { 79 for (int i = 0; i < num_planes; ++i) {
73 size_in_bytes += StrideInBytes(size.width(), format, i) * 80 size_in_bytes += StrideInBytes(size.width(), format, i) *
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 ClientBuffer buffer) { 168 ClientBuffer buffer) {
162 return reinterpret_cast<gfx::GpuMemoryBuffer*>(buffer); 169 return reinterpret_cast<gfx::GpuMemoryBuffer*>(buffer);
163 } 170 }
164 171
165 void TestGpuMemoryBufferManager::SetDestructionSyncPoint( 172 void TestGpuMemoryBufferManager::SetDestructionSyncPoint(
166 gfx::GpuMemoryBuffer* buffer, 173 gfx::GpuMemoryBuffer* buffer,
167 uint32 sync_point) { 174 uint32 sync_point) {
168 } 175 }
169 176
170 } // namespace cc 177 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/video_resource_updater.cc ('k') | components/view_manager/gles2/mojo_gpu_memory_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698