OLD | NEW |
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 <inttypes.h> | 5 #include <inttypes.h> |
6 #include <stddef.h> | 6 #include <stddef.h> |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 #ifdef ARCH_CPU_ARMEL | 159 #ifdef ARCH_CPU_ARMEL |
160 // ARM performs CPU cache management with CPU cache line granularity. We thus | 160 // ARM performs CPU cache management with CPU cache line granularity. We thus |
161 // need to ensure our buffers are CPU cache line-aligned (64 byte-aligned). | 161 // need to ensure our buffers are CPU cache line-aligned (64 byte-aligned). |
162 // Otherwise newer kernels will refuse to accept them, and on older kernels | 162 // Otherwise newer kernels will refuse to accept them, and on older kernels |
163 // we'll be treating ourselves to random corruption. | 163 // we'll be treating ourselves to random corruption. |
164 // Moreover, some hardware codecs require 128-byte alignment for physical | 164 // Moreover, some hardware codecs require 128-byte alignment for physical |
165 // buffers. | 165 // buffers. |
166 const size_t kPlatformBufferAlignment = 128; | 166 const size_t kPlatformBufferAlignment = 128; |
167 #else | 167 #else |
168 const size_t kPlatformBufferAlignment = 1; | 168 const size_t kPlatformBufferAlignment = 8; |
169 #endif | 169 #endif |
170 | 170 |
171 inline static size_t AlignToPlatformRequirements(size_t value) { | 171 inline static size_t AlignToPlatformRequirements(size_t value) { |
172 return base::bits::Align(value, kPlatformBufferAlignment); | 172 return base::bits::Align(value, kPlatformBufferAlignment); |
173 } | 173 } |
174 | 174 |
175 // An aligned STL allocator. | 175 // An aligned STL allocator. |
176 template <typename T, size_t ByteAlignment> | 176 template <typename T, size_t ByteAlignment> |
177 class AlignedAllocator : public std::allocator<T> { | 177 class AlignedAllocator : public std::allocator<T> { |
178 public: | 178 public: |
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 | 1957 |
1958 media::g_env = | 1958 media::g_env = |
1959 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( | 1959 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( |
1960 testing::AddGlobalTestEnvironment( | 1960 testing::AddGlobalTestEnvironment( |
1961 new media::VideoEncodeAcceleratorTestEnvironment( | 1961 new media::VideoEncodeAcceleratorTestEnvironment( |
1962 std::move(test_stream_data), log_path, run_at_fps, | 1962 std::move(test_stream_data), log_path, run_at_fps, |
1963 needs_encode_latency, verify_all_output))); | 1963 needs_encode_latency, verify_all_output))); |
1964 | 1964 |
1965 return RUN_ALL_TESTS(); | 1965 return RUN_ALL_TESTS(); |
1966 } | 1966 } |
OLD | NEW |