History

Fix scan_build warnings in idct_test.cc

BUG=webm:1575

Angie Chiang committed 7 years ago

Commit 2d672cb1 parent 0310ebd1 file · +39 −31Browse files

Unified · Split

test/idct_test.cc+39−31
@@ -72,49 +72,57 @@ TEST_P(IDCTTest, TestAllZeros) { · 71 unmodified lines
72 72
73TEST_P(IDCTTest, TestAllOnes) {73TEST_P(IDCTTest, TestAllOnes) {
74 input->Set(0);74 input->Set(0);
75 // When the first element is '4' it will fill the output buffer with '1'.75 if (input->TopLeftPixel() != NULL) {
76 input->TopLeftPixel()[0] = 4;76 // When the first element is '4' it will fill the output buffer with '1'.
77 predict->Set(0);77 input->TopLeftPixel()[0] = 4;
78 output->Set(0);78 predict->Set(0);
79 79 output->Set(0);
80 ASM_REGISTER_STATE_CHECK(UUT(input->TopLeftPixel(), predict->TopLeftPixel(),80
81 predict->stride(), output->TopLeftPixel(),81 ASM_REGISTER_STATE_CHECK(UUT(input->TopLeftPixel(), predict->TopLeftPixel(),
82 output->stride()));82 predict->stride(), output->TopLeftPixel(),
83 83 output->stride()));
84 ASSERT_TRUE(output->CheckValues(1));84
85 ASSERT_TRUE(output->CheckPadding());85 ASSERT_TRUE(output->CheckValues(1));
86 ASSERT_TRUE(output->CheckPadding());
87 } else {
88 assert(0);
89 }
86}90}
87 91
88TEST_P(IDCTTest, TestAddOne) {92TEST_P(IDCTTest, TestAddOne) {
89 // Set the transform output to '1' and make sure it gets added to the93 // Set the transform output to '1' and make sure it gets added to the
90 // prediction buffer.94 // prediction buffer.
91 input->Set(0);95 input->Set(0);
92 input->TopLeftPixel()[0] = 4;96 if (input->TopLeftPixel() != NULL) {
93 output->Set(0);97 input->TopLeftPixel()[0] = 4;
94 98 output->Set(0);
95 uint8_t *pred = predict->TopLeftPixel();99
96 for (int y = 0; y < 4; ++y) {100 uint8_t *pred = predict->TopLeftPixel();
97 for (int x = 0; x < 4; ++x) {101 for (int y = 0; y < 4; ++y) {
98 pred[y * predict->stride() + x] = y * 4 + x;102 for (int x = 0; x < 4; ++x) {
103 pred[y * predict->stride() + x] = y * 4 + x;
104 }
99 }105 }
100 }
101 106
102 ASM_REGISTER_STATE_CHECK(UUT(input->TopLeftPixel(), predict->TopLeftPixel(),107 ASM_REGISTER_STATE_CHECK(UUT(input->TopLeftPixel(), predict->TopLeftPixel(),
103 predict->stride(), output->TopLeftPixel(),108 predict->stride(), output->TopLeftPixel(),
104 output->stride()));109 output->stride()));
105 110
106 uint8_t const *out = output->TopLeftPixel();111 uint8_t const *out = output->TopLeftPixel();
107 for (int y = 0; y < 4; ++y) {112 for (int y = 0; y < 4; ++y) {
108 for (int x = 0; x < 4; ++x) {113 for (int x = 0; x < 4; ++x) {
109 EXPECT_EQ(1 + y * 4 + x, out[y * output->stride() + x]);114 EXPECT_EQ(1 + y * 4 + x, out[y * output->stride() + x]);
115 }
110 }116 }
111 }
112 117
113 if (HasFailure()) {118 if (HasFailure()) {
114 output->DumpBuffer();119 output->DumpBuffer();
115 }120 }
116 121
117 ASSERT_TRUE(output->CheckPadding());122 ASSERT_TRUE(output->CheckPadding());
123 } else {
124 assert(0);
125 }
118}126}
119 127
120TEST_P(IDCTTest, TestWithData) {128TEST_P(IDCTTest, TestWithData) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t