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

Side by Side Diff: media/base/simd/convert_rgb_to_yuv_unittest.cc

Issue 139783016: Do not use assembly implementations of YUV conversions in MSan builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test name Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/base/yuv_convert.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 (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/cpu.h" 5 #include "base/cpu.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "media/base/simd/convert_rgb_to_yuv.h" 7 #include "media/base/simd/convert_rgb_to_yuv.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace { 10 namespace {
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 int ConvertRGBToV(const uint8* rgb, int size) { 25 int ConvertRGBToV(const uint8* rgb, int size) {
26 int v = -18 * rgb[0] - 94 * rgb[1] + 112 * rgb[2]; 26 int v = -18 * rgb[0] - 94 * rgb[1] + 112 * rgb[2];
27 v = ((v + 128) >> 8) + 128; 27 v = ((v + 128) >> 8) + 128;
28 return std::max(0, std::min(255, v)); 28 return std::max(0, std::min(255, v));
29 } 29 }
30 30
31 } // namespace 31 } // namespace
32 32
33 // Assembly code confuses MemorySanitizer. Do not run it in MSan builds.
34 #if defined(MEMORY_SANITIZER)
35 #define MAYBE_SideBySideRGB DISABLED_SideBySideRGB
36 #else
37 #define MAYBE_SideBySideRGB SideBySideRGB
38 #endif
39
33 // A side-by-side test that verifies our ASM functions that convert RGB pixels 40 // A side-by-side test that verifies our ASM functions that convert RGB pixels
34 // to YUV pixels can output the expected results. This test converts RGB pixels 41 // to YUV pixels can output the expected results. This test converts RGB pixels
35 // to YUV pixels with our ASM functions (which use SSE, SSE2, SSE3, and SSSE3) 42 // to YUV pixels with our ASM functions (which use SSE, SSE2, SSE3, and SSSE3)
36 // and compare the output YUV pixels with the ones calculated with out reference 43 // and compare the output YUV pixels with the ones calculated with out reference
37 // functions implemented in C++. 44 // functions implemented in C++.
38 TEST(YUVConvertTest, SideBySideRGB) { 45 TEST(YUVConvertTest, MAYBE_SideBySideRGB) {
39 // We skip this test on PCs which does not support SSE3 because this test 46 // We skip this test on PCs which does not support SSE3 because this test
40 // needs it. 47 // needs it.
41 base::CPU cpu; 48 base::CPU cpu;
42 if (!cpu.has_ssse3()) 49 if (!cpu.has_ssse3())
43 return; 50 return;
44 51
45 // This test checks a subset of all RGB values so this test does not take so 52 // This test checks a subset of all RGB values so this test does not take so
46 // long time. 53 // long time.
47 const int kStep = 8; 54 const int kStep = 8;
48 const int kWidth = 256 / kStep; 55 const int kWidth = 256 / kStep;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 const uint8* p = &rgb[i * 2 * size]; 105 const uint8* p = &rgb[i * 2 * size];
99 int error = ConvertRGBToV(p, size) - v[i]; 106 int error = ConvertRGBToV(p, size) - v[i];
100 total_error += error > 0 ? error : -error; 107 total_error += error > 0 ? error : -error;
101 } 108 }
102 } 109 }
103 } 110 }
104 111
105 EXPECT_EQ(0, total_error); 112 EXPECT_EQ(0, total_error);
106 } 113 }
107 } 114 }
OLDNEW
« no previous file with comments | « no previous file | media/base/yuv_convert.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698