History

[UT] Allow for different output depending on downsample average order

Avoid X86_ASM ifdef. Ideally, we may want to update all routines to average vertically first, which would make this unnecessary. In the interim, this enables the tests to run successfully on x86 without SSSE3 support again.

Sindre Aamås committed 10 years ago

Commit f14fb2c1 parent 2e6c9f73 files · +49 −48Browse files

Unified · Split

3 files
  1. test/api/decode_api_test.cpp +7 −13
  2. test/api/encoder_test.cpp +22 −30
  3. test/utils/HashFunctions.h +20 −5
test/api/decode_api_test.cpp+7−13
@@ -758,18 +758,12 @@ const uint32_t kiWidth = 160; //DO NOT CHANGE! · 757 unmodified lines
758const uint32_t kiHeight = 96; //DO NOT CHANGE!758const uint32_t kiHeight = 96; //DO NOT CHANGE!
759const uint32_t kiFrameRate = 12; //DO NOT CHANGE!759const uint32_t kiFrameRate = 12; //DO NOT CHANGE!
760const uint32_t kiFrameNum = 100; //DO NOT CHANGE!760const uint32_t kiFrameNum = 100; //DO NOT CHANGE!
761const char* pHashStr[] = { //DO NOT CHANGE!761const char* const pHashStr[][2] = { //DO NOT CHANGE!
762// X86_ASM downsampling routines average vertically first, as opposed to762 // Allow for different output depending on whether averaging is done
763// horizontally first, which results in different output.763 // vertically or horizontally first when downsampling.
764#ifdef X86_ASM764 { "244eebcb51f4c2a56e83fc5da3373cad9ec0e1e5", "9c4e6146b29bac5d5d4be3c5bbab9c072dcb3f3f" },
765 "244eebcb51f4c2a56e83fc5da3373cad9ec0e1e5",765 { "bbad99ef99e37b34bcb4f09a7ec4d144375f6be7", "f350001c333902029800bd291fbed915a4bdf19a" },
766 "bbad99ef99e37b34bcb4f09a7ec4d144375f6be7",766 { "809f97e836650624d92f0b8e200a6ab25f810d6f", "eb9d853b7daec03052c4850027ac94adc84c3a7e" }
767 "809f97e836650624d92f0b8e200a6ab25f810d6f"
768#else
769 "9c4e6146b29bac5d5d4be3c5bbab9c072dcb3f3f",
770 "f350001c333902029800bd291fbed915a4bdf19a",
771 "eb9d853b7daec03052c4850027ac94adc84c3a7e"
772#endif
773};767};
774 768
775class DecodeParseAPI : public ::testing::TestWithParam<EncodeDecodeFileParamBase>, public EncodeDecodeTestBase {769class DecodeParseAPI : public ::testing::TestWithParam<EncodeDecodeFileParamBase>, public EncodeDecodeTestBase {
@@ -905,7 +899,7 @@ TEST_F (DecodeParseAPI, ParseOnly_General) { · 129 unmodified lines
905 unsigned char digest[SHA_DIGEST_LENGTH];899 unsigned char digest[SHA_DIGEST_LENGTH];
906 SHA1Result (&ctx_, digest);900 SHA1Result (&ctx_, digest);
907 if (!HasFatalFailure()) {901 if (!HasFatalFailure()) {
908 CompareHash (digest, pHashStr[uiTargetLayerId]);902 CompareHashAnyOf (digest, pHashStr[uiTargetLayerId], sizeof *pHashStr / sizeof **pHashStr);
909 }903 }
910 } //while904 } //while
911#ifdef DEBUG_FILE_SAVE905#ifdef DEBUG_FILE_SAVE
test/api/encoder_test.cpp+22−30
@@ -28,7 +28,7 @@ TEST_F (EncoderInitTest, JustInit) {} · 27 unmodified lines
28 28
29struct EncodeFileParam {29struct EncodeFileParam {
30 const char* pkcFileName;30 const char* pkcFileName;
31 const char* pkcHashStr;31 const char* pkcHashStr[2];
32 EUsageType eUsageType;32 EUsageType eUsageType;
33 int iWidth;33 int iWidth;
34 int iHeight;34 int iHeight;
@@ -97,89 +97,81 @@ TEST_P (EncoderOutputTest, CompareOutput) { · 62 unmodified lines
97 unsigned char digest[SHA_DIGEST_LENGTH];97 unsigned char digest[SHA_DIGEST_LENGTH];
98 SHA1Result (&ctx_, digest);98 SHA1Result (&ctx_, digest);
99 if (!HasFatalFailure()) {99 if (!HasFatalFailure()) {
100 CompareHash (digest, p.pkcHashStr);100 CompareHashAnyOf (digest, p.pkcHashStr, sizeof p.pkcHashStr / sizeof *p.pkcHashStr);
101 }101 }
102}102}
103static const EncodeFileParam kFileParamArray[] = {103static const EncodeFileParam kFileParamArray[] = {
104 {104 {
105 "res/CiscoVT2people_320x192_12fps.yuv",105 "res/CiscoVT2people_320x192_12fps.yuv",
106 "ee97bab09041362fbe8aed16f69a55f16b106f92", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false106 {"ee97bab09041362fbe8aed16f69a55f16b106f92"}, CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false
107 },107 },
108 {108 {
109 "res/CiscoVT2people_160x96_6fps.yuv",109 "res/CiscoVT2people_160x96_6fps.yuv",
110 "37b4f5b7b77b362dee9a74ac4b2bc043537f2dd0", CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false110 {"37b4f5b7b77b362dee9a74ac4b2bc043537f2dd0"}, CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
111 },111 },
112 {112 {
113 "res/Static_152_100.yuv",113 "res/Static_152_100.yuv",
114 "b220be0163974e36fbd6662236d4e05566a21546", CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false114 {"b220be0163974e36fbd6662236d4e05566a21546"}, CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
115 },115 },
116 {116 {
117 "res/CiscoVT2people_320x192_12fps.yuv",117 "res/CiscoVT2people_320x192_12fps.yuv",
118 "21dbfaaf4f09af735298434c1f97cf95a464165b", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_RASTER_SLICE, false, 1, false, false, false // One slice per MB row118 {"21dbfaaf4f09af735298434c1f97cf95a464165b"}, CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_RASTER_SLICE, false, 1, false, false, false // One slice per MB row
119 },119 },
120 {120 {
121 "res/CiscoVT2people_320x192_12fps.yuv",121 "res/CiscoVT2people_320x192_12fps.yuv",
122 "409ced068a5a313cad7c654d27ab7a2edaed4630", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 1, false, false, false122 {"409ced068a5a313cad7c654d27ab7a2edaed4630"}, CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 1, false, false, false
123 },123 },
124 {124 {
125 "res/CiscoVT2people_320x192_12fps.yuv",125 "res/CiscoVT2people_320x192_12fps.yuv",
126// X86_ASM downsampling routines average vertically first, as opposed to126 // Allow for different output depending on whether averaging is done
127// horizontally first, which results in different output.127 // vertically or horizontally first when downsampling.
128#ifdef X86_ASM128 { "a5341d588b769809c1f1d983e5a0fcef7362f3ad", "73156dfc1dc45924349b5b79f8debcac13d7231d" },
129 "a5341d588b769809c1f1d983e5a0fcef7362f3ad",
130#else
131 "73156dfc1dc45924349b5b79f8debcac13d7231d",
132#endif
133 CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2, false, false, false129 CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2, false, false, false
134 },130 },
135 {131 {
136 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",132 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
137 "8bc8813ee262b356e53eec6dbdc3c88d7d2b7b5c", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, false133 {"8bc8813ee262b356e53eec6dbdc3c88d7d2b7b5c"}, CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, false
138 },134 },
139 {135 {
140 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",136 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
141// X86_ASM downsampling routines average vertically first, as opposed to137 // Allow for different output depending on whether averaging is done
142// horizontally first, which results in different output.138 // vertically or horizontally first when downsampling.
143#ifdef X86_ASM139 { "ec9d776a7d92cf0f6640065aee8af2450af0e993", "3943145545a2bd27a642b2045d4e3dbae55c6870" },
144 "ec9d776a7d92cf0f6640065aee8af2450af0e993",
145#else
146 "3943145545a2bd27a642b2045d4e3dbae55c6870",
147#endif
148 CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SINGLE_SLICE, false, 4, false, false, false140 CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SINGLE_SLICE, false, 4, false, false, false
149 },141 },
150 // the following values may be adjusted for times since we start tuning the strategy142 // the following values may be adjusted for times since we start tuning the strategy
151 {143 {
152 "res/CiscoVT2people_320x192_12fps.yuv",144 "res/CiscoVT2people_320x192_12fps.yuv",
153 "c384a0dafc46573d02a38d8323304c5e1309d9d0", SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false145 {"c384a0dafc46573d02a38d8323304c5e1309d9d0"}, SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false
154 },146 },
155 {147 {
156 "res/CiscoVT2people_160x96_6fps.yuv",148 "res/CiscoVT2people_160x96_6fps.yuv",
157 "637d50652f9bb8750359c4b418f30a039908d56d", SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false149 {"637d50652f9bb8750359c4b418f30a039908d56d"}, SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
158 },150 },
159 {151 {
160 "res/Static_152_100.yuv",152 "res/Static_152_100.yuv",
161 "77a140c6bd80a6479ee13aecd2a8dac0a17cf03d", SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false153 {"77a140c6bd80a6479ee13aecd2a8dac0a17cf03d"}, SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
162 },154 },
163 {155 {
164 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",156 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
165 "9e35aac6ee12b4516fbee114bc532faae23df76d", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, false157 {"9e35aac6ee12b4516fbee114bc532faae23df76d"}, SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, false
166 },158 },
167 //for different strategy159 //for different strategy
168 {160 {
169 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",161 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
170 "1a6dc4f84cada651c4c8b24f879c858e35c2e813", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, true, true, false162 {"1a6dc4f84cada651c4c8b24f879c858e35c2e813"}, SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, true, true, false
171 },163 },
172 {164 {
173 "res/CiscoVT2people_320x192_12fps.yuv",165 "res/CiscoVT2people_320x192_12fps.yuv",
174 "04ad01bb3872f7dae055c1ec661218f41a020dac", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, true //turn on cabac166 {"04ad01bb3872f7dae055c1ec661218f41a020dac"}, CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, true //turn on cabac
175 },167 },
176 {168 {
177 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",169 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
178 "f5a92b7a0c00691e04bf1306c8251a74f989e4e2", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, true170 {"f5a92b7a0c00691e04bf1306c8251a74f989e4e2"}, CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, true
179 },171 },
180 {172 {
181 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",173 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
182 "a27539982433279faa9975c96eaec28df770223e", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_FIXEDSLCNUM_SLICE, false, 1, false, false, true174 {"a27539982433279faa9975c96eaec28df770223e"}, CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_FIXEDSLCNUM_SLICE, false, 1, false, false, true
183 },175 },
184};176};
185 177
test/utils/HashFunctions.h+20−5
@@ -6,13 +6,28 @@ · 5 unmodified lines
6#include <gtest/gtest.h>6#include <gtest/gtest.h>
7#include "../sha1.h"7#include "../sha1.h"
8 8
9static void CompareHash (const unsigned char* digest, const char* hashStr) {9static void ToHashStr (char* dst, const unsigned char* src, size_t src_len) {
10 char hashStrCmp[SHA_DIGEST_LENGTH * 2 + 1];10 for (size_t i = 0; i < src_len; ++i) {
11 for (int i = 0; i < SHA_DIGEST_LENGTH; ++i) {11 sprintf (&dst[i * 2], "%.2x", src[i]);
12 sprintf (&hashStrCmp[i * 2], "%.2x", digest[i]);
13 }12 }
14 hashStrCmp[SHA_DIGEST_LENGTH * 2] = '\0';13 dst[src_len * 2] = '\0';
14}
15
16inline void CompareHash (const unsigned char* digest, const char* hashStr) {
17 char hashStrCmp[SHA_DIGEST_LENGTH * 2 + 1];
18 ToHashStr (hashStrCmp, digest, SHA_DIGEST_LENGTH);
15 EXPECT_STREQ (hashStr, hashStrCmp);19 EXPECT_STREQ (hashStr, hashStrCmp);
16}20}
17 21
22inline void CompareHashAnyOf (const unsigned char* digest, const char* const hashStr[], size_t nHashStr) {
23 char hashStrCmp[SHA_DIGEST_LENGTH * 2 + 1];
24 ToHashStr (hashStrCmp, digest, SHA_DIGEST_LENGTH);
25 for (size_t i = 0; i < nHashStr && hashStr[i]; ++i) {
26 if (0 == strcmp (hashStr[i], hashStrCmp))
27 return;
28 }
29 // No match found. Compare to first hash so as to produce a grepable failure.
30 EXPECT_STREQ (hashStr[0], hashStrCmp);
31}
32
18#endif //__HASHFUNCTIONS_H__33#endif //__HASHFUNCTIONS_H__

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