OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2114 | 2114 |
2115 for (i = 0; i < y_plane_size; ++i) { | 2115 for (i = 0; i < y_plane_size; ++i) { |
2116 EXPECT_EQ(dst_c[i], dst_opt[i]); | 2116 EXPECT_EQ(dst_c[i], dst_opt[i]); |
2117 } | 2117 } |
2118 | 2118 |
2119 free_aligned_buffer_page_end(orig_y); | 2119 free_aligned_buffer_page_end(orig_y); |
2120 free_aligned_buffer_page_end(dst_c); | 2120 free_aligned_buffer_page_end(dst_c); |
2121 free_aligned_buffer_page_end(dst_opt); | 2121 free_aligned_buffer_page_end(dst_opt); |
2122 } | 2122 } |
2123 | 2123 |
2124 // 5 bit exponent with bias of 15 will underflow to a denormal if scale causes | |
2125 // exponent to be less than 0. 15 - log2(65536) = -1/ This shouldnt normally | |
2126 // happen sicne scale is 1/(1<<bits) where bits is 9, 10 or 12. | |
hubbe
2016/10/18 22:40:42
s/sicne/since/
Also, some people at intel are wor
| |
2127 TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_denormal) { | |
2128 int i, j; | |
2129 const int y_plane_size = benchmark_width_ * benchmark_height_ * 2; | |
2130 | |
2131 align_buffer_page_end(orig_y, y_plane_size); | |
2132 align_buffer_page_end(dst_c, y_plane_size); | |
2133 align_buffer_page_end(dst_opt, y_plane_size); | |
2134 MemRandomize(orig_y, y_plane_size); | |
2135 memset(dst_c, 0, y_plane_size); | |
2136 memset(dst_opt, 1, y_plane_size); | |
2137 | |
2138 // Disable all optimizations. | |
2139 MaskCpuFlags(disable_cpu_flags_); | |
2140 double c_time = get_time(); | |
2141 for (j = 0; j < benchmark_iterations_; j++) { | |
2142 HalfFloatPlane((uint16*)orig_y, benchmark_width_ * 2, | |
2143 (uint16*)dst_c, benchmark_width_ * 2, | |
2144 1.0f / 65536.0f, benchmark_width_, benchmark_height_); | |
2145 } | |
2146 c_time = (get_time() - c_time) / benchmark_iterations_; | |
2147 | |
2148 // Enable optimizations. | |
2149 MaskCpuFlags(benchmark_cpu_info_); | |
2150 double opt_time = get_time(); | |
2151 for (j = 0; j < benchmark_iterations_; j++) { | |
2152 HalfFloatPlane((uint16*)orig_y, benchmark_width_ * 2, | |
2153 (uint16*)dst_opt, benchmark_width_ * 2, | |
2154 1.0f / 65536.0f, benchmark_width_, benchmark_height_); | |
2155 } | |
2156 opt_time = (get_time() - opt_time) / benchmark_iterations_; | |
2157 | |
2158 for (i = 0; i < y_plane_size; ++i) { | |
2159 EXPECT_EQ(dst_c[i], dst_opt[i]); | |
2160 } | |
2161 | |
2162 free_aligned_buffer_page_end(orig_y); | |
2163 free_aligned_buffer_page_end(dst_c); | |
2164 free_aligned_buffer_page_end(dst_opt); | |
2165 } | |
2166 | |
2124 TEST_F(LibYUVPlanarTest, TestARGBLumaColorTable) { | 2167 TEST_F(LibYUVPlanarTest, TestARGBLumaColorTable) { |
2125 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 2168 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
2126 SIMD_ALIGNED(uint8 dst_pixels_opt[1280][4]); | 2169 SIMD_ALIGNED(uint8 dst_pixels_opt[1280][4]); |
2127 SIMD_ALIGNED(uint8 dst_pixels_c[1280][4]); | 2170 SIMD_ALIGNED(uint8 dst_pixels_c[1280][4]); |
2128 memset(orig_pixels, 0, sizeof(orig_pixels)); | 2171 memset(orig_pixels, 0, sizeof(orig_pixels)); |
2129 | 2172 |
2130 align_buffer_page_end(lumacolortable, 32768); | 2173 align_buffer_page_end(lumacolortable, 32768); |
2131 int v = 0; | 2174 int v = 0; |
2132 for (int i = 0; i < 32768; ++i) { | 2175 for (int i = 0; i < 32768; ++i) { |
2133 lumacolortable[i] = v; | 2176 lumacolortable[i] = v; |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2487 } | 2530 } |
2488 | 2531 |
2489 free_aligned_buffer_page_end(src_pixels); | 2532 free_aligned_buffer_page_end(src_pixels); |
2490 free_aligned_buffer_page_end(tmp_pixels_u); | 2533 free_aligned_buffer_page_end(tmp_pixels_u); |
2491 free_aligned_buffer_page_end(tmp_pixels_v); | 2534 free_aligned_buffer_page_end(tmp_pixels_v); |
2492 free_aligned_buffer_page_end(dst_pixels_opt); | 2535 free_aligned_buffer_page_end(dst_pixels_opt); |
2493 free_aligned_buffer_page_end(dst_pixels_c); | 2536 free_aligned_buffer_page_end(dst_pixels_c); |
2494 } | 2537 } |
2495 | 2538 |
2496 } // namespace libyuv | 2539 } // namespace libyuv |
OLD | NEW |