| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/base_paths.h" | 5 #include "base/base_paths.h" |
| 6 #include "base/cpu.h" | 6 #include "base/cpu.h" |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "media/base/djb2.h" | 10 #include "media/base/djb2.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 media::ScaleFilter scale_filter; | 168 media::ScaleFilter scale_filter; |
| 169 uint32 rgb_hash; | 169 uint32 rgb_hash; |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 class YUVScaleTest : public ::testing::TestWithParam<YUVScaleTestData> { | 172 class YUVScaleTest : public ::testing::TestWithParam<YUVScaleTestData> { |
| 173 public: | 173 public: |
| 174 YUVScaleTest() { | 174 YUVScaleTest() { |
| 175 switch (GetParam().yuv_type) { | 175 switch (GetParam().yuv_type) { |
| 176 case media::YV12: | 176 case media::YV12: |
| 177 case media::YV12J: | 177 case media::YV12J: |
| 178 case media::YV12HD: |
| 178 ReadYV12Data(&yuv_bytes_); | 179 ReadYV12Data(&yuv_bytes_); |
| 179 break; | 180 break; |
| 180 case media::YV16: | 181 case media::YV16: |
| 181 ReadYV16Data(&yuv_bytes_); | 182 ReadYV16Data(&yuv_bytes_); |
| 182 break; | 183 break; |
| 183 } | 184 } |
| 184 | 185 |
| 185 rgb_bytes_.reset(new uint8[kRGBSizeScaled]); | 186 rgb_bytes_.reset(new uint8[kRGBSizeScaled]); |
| 186 } | 187 } |
| 187 | 188 |
| 188 // Helpers for getting the proper Y, U and V plane offsets. | 189 // Helpers for getting the proper Y, U and V plane offsets. |
| 189 uint8* y_plane() { return yuv_bytes_.get(); } | 190 uint8* y_plane() { return yuv_bytes_.get(); } |
| 190 uint8* u_plane() { return yuv_bytes_.get() + kSourceYSize; } | 191 uint8* u_plane() { return yuv_bytes_.get() + kSourceYSize; } |
| 191 uint8* v_plane() { | 192 uint8* v_plane() { |
| 192 switch (GetParam().yuv_type) { | 193 switch (GetParam().yuv_type) { |
| 193 case media::YV12: | 194 case media::YV12: |
| 194 case media::YV12J: | 195 case media::YV12J: |
| 196 case media::YV12HD: |
| 195 return yuv_bytes_.get() + kSourceVOffset; | 197 return yuv_bytes_.get() + kSourceVOffset; |
| 196 case media::YV16: | 198 case media::YV16: |
| 197 return yuv_bytes_.get() + kSourceYSize * 3 / 2; | 199 return yuv_bytes_.get() + kSourceYSize * 3 / 2; |
| 198 } | 200 } |
| 199 return NULL; | 201 return NULL; |
| 200 } | 202 } |
| 201 | 203 |
| 202 scoped_ptr<uint8[]> yuv_bytes_; | 204 scoped_ptr<uint8[]> yuv_bytes_; |
| 203 scoped_ptr<uint8[]> rgb_bytes_; | 205 scoped_ptr<uint8[]> rgb_bytes_; |
| 204 }; | 206 }; |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), | 884 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), |
| 883 rgb_bytes_converted.get(), | 885 rgb_bytes_converted.get(), |
| 884 kWidth * kBpp)); | 886 kWidth * kBpp)); |
| 885 } | 887 } |
| 886 | 888 |
| 887 #endif // defined(ARCH_CPU_X86_64) | 889 #endif // defined(ARCH_CPU_X86_64) |
| 888 | 890 |
| 889 #endif // defined(ARCH_CPU_X86_FAMILY) | 891 #endif // defined(ARCH_CPU_X86_FAMILY) |
| 890 | 892 |
| 891 } // namespace media | 893 } // namespace media |
| OLD | NEW |