OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebM 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 #include "test/clear_system_state.h" | 10 #include "test/clear_system_state.h" |
11 #include "test/register_state_check.h" | 11 #include "test/register_state_check.h" |
12 #include "third_party/googletest/src/include/gtest/gtest.h" | 12 #include "third_party/googletest/src/include/gtest/gtest.h" |
13 #include "./vpx_config.h" | 13 #include "./vpx_config.h" |
14 #include "./vp8_rtcd.h" | 14 #include "./vp8_rtcd.h" |
15 #include "vpx/vpx_integer.h" | 15 #include "vpx/vpx_integer.h" |
16 #include "vpx_mem/vpx_mem.h" | 16 #include "vpx_mem/vpx_mem.h" |
17 | 17 |
18 typedef void (*post_proc_func_t)(unsigned char *src_ptr, | 18 typedef void (*post_proc_func_t)(unsigned char *src_ptr, |
19 unsigned char *dst_ptr, | 19 unsigned char *dst_ptr, |
20 int src_pixels_per_line, | 20 int src_pixels_per_line, |
21 int dst_pixels_per_line, | 21 int dst_pixels_per_line, |
22 int cols, | 22 int cols, |
23 unsigned char *flimit, | 23 unsigned char *flimit, |
24 int size); | 24 int size); |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 class Vp8PostProcessingFilterTest | 28 class VP8PostProcessingFilterTest |
29 : public ::testing::TestWithParam<post_proc_func_t> { | 29 : public ::testing::TestWithParam<post_proc_func_t> { |
30 public: | 30 public: |
31 virtual void TearDown() { | 31 virtual void TearDown() { |
32 libvpx_test::ClearSystemState(); | 32 libvpx_test::ClearSystemState(); |
33 } | 33 } |
34 }; | 34 }; |
35 | 35 |
36 // Test routine for the VP8 post-processing function | 36 // Test routine for the VP8 post-processing function |
37 // vp8_post_proc_down_and_across_mb_row_c. | 37 // vp8_post_proc_down_and_across_mb_row_c. |
38 | 38 |
39 TEST_P(Vp8PostProcessingFilterTest, FilterOutputCheck) { | 39 TEST_P(VP8PostProcessingFilterTest, FilterOutputCheck) { |
40 // Size of the underlying data block that will be filtered. | 40 // Size of the underlying data block that will be filtered. |
41 const int block_width = 16; | 41 const int block_width = 16; |
42 const int block_height = 16; | 42 const int block_height = 16; |
43 | 43 |
44 // 5-tap filter needs 2 padding rows above and below the block in the input. | 44 // 5-tap filter needs 2 padding rows above and below the block in the input. |
45 const int input_width = block_width; | 45 const int input_width = block_width; |
46 const int input_height = block_height + 4; | 46 const int input_height = block_height + 4; |
47 const int input_stride = input_width; | 47 const int input_stride = input_width; |
48 const int input_size = input_width * input_height; | 48 const int input_size = input_width * input_height; |
49 | 49 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 output_stride, block_width, flimits, 16)); | 84 output_stride, block_width, flimits, 16)); |
85 | 85 |
86 static const uint8_t expected_data[block_height] = { | 86 static const uint8_t expected_data[block_height] = { |
87 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4 | 87 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4 |
88 }; | 88 }; |
89 | 89 |
90 pixel_ptr = dst_image_ptr; | 90 pixel_ptr = dst_image_ptr; |
91 for (int i = 0; i < block_height; ++i) { | 91 for (int i = 0; i < block_height; ++i) { |
92 for (int j = 0; j < block_width; ++j) { | 92 for (int j = 0; j < block_width; ++j) { |
93 EXPECT_EQ(expected_data[i], pixel_ptr[j]) | 93 EXPECT_EQ(expected_data[i], pixel_ptr[j]) |
94 << "Vp8PostProcessingFilterTest failed with invalid filter output"; | 94 << "VP8PostProcessingFilterTest failed with invalid filter output"; |
95 } | 95 } |
96 pixel_ptr += output_stride; | 96 pixel_ptr += output_stride; |
97 } | 97 } |
98 | 98 |
99 vpx_free(src_image); | 99 vpx_free(src_image); |
100 vpx_free(dst_image); | 100 vpx_free(dst_image); |
101 vpx_free(flimits); | 101 vpx_free(flimits); |
102 }; | 102 }; |
103 | 103 |
104 INSTANTIATE_TEST_CASE_P(C, Vp8PostProcessingFilterTest, | 104 INSTANTIATE_TEST_CASE_P(C, VP8PostProcessingFilterTest, |
105 ::testing::Values(vp8_post_proc_down_and_across_mb_row_c)); | 105 ::testing::Values(vp8_post_proc_down_and_across_mb_row_c)); |
106 | 106 |
107 #if HAVE_SSE2 | 107 #if HAVE_SSE2 |
108 INSTANTIATE_TEST_CASE_P(SSE2, Vp8PostProcessingFilterTest, | 108 INSTANTIATE_TEST_CASE_P(SSE2, VP8PostProcessingFilterTest, |
109 ::testing::Values(vp8_post_proc_down_and_across_mb_row_sse2)); | 109 ::testing::Values(vp8_post_proc_down_and_across_mb_row_sse2)); |
110 #endif | 110 #endif |
111 | 111 |
112 } // namespace | 112 } // namespace |
OLD | NEW |