crypto_bench.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. /*
  2. * Copyright (c) 2013 Nicolas George
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public License
  8. * as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. /* Optional external libraries; can be enabled using:
  21. * make VERSUS=crypto+gcrypt+tomcrypt tools/crypto_bench */
  22. #define USE_crypto 0x01 /* OpenSSL's libcrypto */
  23. #define USE_gcrypt 0x02 /* GnuTLS's libgcrypt */
  24. #define USE_tomcrypt 0x04 /* LibTomCrypt */
  25. #include <stdlib.h>
  26. #include <math.h>
  27. #include "libavutil/avutil.h"
  28. #include "libavutil/avstring.h"
  29. #include "libavutil/crc.h"
  30. #include "libavutil/intreadwrite.h"
  31. #include "libavutil/timer.h"
  32. #ifndef AV_READ_TIME
  33. #define AV_READ_TIME(x) 0
  34. #endif
  35. #if HAVE_UNISTD_H
  36. #include <unistd.h> /* for getopt */
  37. #endif
  38. #if !HAVE_GETOPT
  39. #include "compat/getopt.c"
  40. #endif
  41. #define MAX_INPUT_SIZE 1048576
  42. #define MAX_OUTPUT_SIZE 128
  43. static const char *enabled_libs;
  44. static const char *enabled_algos;
  45. static unsigned specified_runs;
  46. static const uint8_t *hardcoded_key = "FFmpeg is the best program ever.";
  47. static void fatal_error(const char *tag)
  48. {
  49. av_log(NULL, AV_LOG_ERROR, "Fatal error: %s\n", tag);
  50. exit(1);
  51. }
  52. struct hash_impl {
  53. const char *lib;
  54. const char *name;
  55. void (*run)(uint8_t *output, const uint8_t *input, unsigned size);
  56. const char *output;
  57. };
  58. /***************************************************************************
  59. * lavu: libavutil
  60. ***************************************************************************/
  61. #include "libavutil/md5.h"
  62. #include "libavutil/sha.h"
  63. #include "libavutil/sha512.h"
  64. #include "libavutil/ripemd.h"
  65. #include "libavutil/aes.h"
  66. #include "libavutil/blowfish.h"
  67. #include "libavutil/camellia.h"
  68. #include "libavutil/cast5.h"
  69. #include "libavutil/twofish.h"
  70. #include "libavutil/rc4.h"
  71. #include "libavutil/xtea.h"
  72. #define IMPL_USE_lavu IMPL_USE
  73. static void run_lavu_md5(uint8_t *output,
  74. const uint8_t *input, unsigned size)
  75. {
  76. av_md5_sum(output, input, size);
  77. }
  78. #define DEFINE_LAVU_MD(suffix, type, namespace, hsize) \
  79. static void run_lavu_ ## suffix(uint8_t *output, \
  80. const uint8_t *input, unsigned size) \
  81. { \
  82. static struct type *h; \
  83. if (!h && !(h = av_ ## namespace ## _alloc())) \
  84. fatal_error("out of memory"); \
  85. av_ ## namespace ## _init(h, hsize); \
  86. av_ ## namespace ## _update(h, input, size); \
  87. av_ ## namespace ## _final(h, output); \
  88. }
  89. DEFINE_LAVU_MD(sha1, AVSHA, sha, 160);
  90. DEFINE_LAVU_MD(sha256, AVSHA, sha, 256);
  91. DEFINE_LAVU_MD(sha512, AVSHA512, sha512, 512);
  92. DEFINE_LAVU_MD(ripemd128, AVRIPEMD, ripemd, 128);
  93. DEFINE_LAVU_MD(ripemd160, AVRIPEMD, ripemd, 160);
  94. static void run_lavu_aes128(uint8_t *output,
  95. const uint8_t *input, unsigned size)
  96. {
  97. static struct AVAES *aes;
  98. if (!aes && !(aes = av_aes_alloc()))
  99. fatal_error("out of memory");
  100. av_aes_init(aes, hardcoded_key, 128, 0);
  101. av_aes_crypt(aes, output, input, size >> 4, NULL, 0);
  102. }
  103. static void run_lavu_blowfish(uint8_t *output,
  104. const uint8_t *input, unsigned size)
  105. {
  106. static struct AVBlowfish *blowfish;
  107. if (!blowfish && !(blowfish = av_blowfish_alloc()))
  108. fatal_error("out of memory");
  109. av_blowfish_init(blowfish, hardcoded_key, 16);
  110. av_blowfish_crypt(blowfish, output, input, size >> 3, NULL, 0);
  111. }
  112. static void run_lavu_camellia(uint8_t *output,
  113. const uint8_t *input, unsigned size)
  114. {
  115. static struct AVCAMELLIA *camellia;
  116. if (!camellia && !(camellia = av_camellia_alloc()))
  117. fatal_error("out of memory");
  118. av_camellia_init(camellia, hardcoded_key, 128);
  119. av_camellia_crypt(camellia, output, input, size >> 4, NULL, 0);
  120. }
  121. static void run_lavu_cast128(uint8_t *output,
  122. const uint8_t *input, unsigned size)
  123. {
  124. static struct AVCAST5 *cast;
  125. if (!cast && !(cast = av_cast5_alloc()))
  126. fatal_error("out of memory");
  127. av_cast5_init(cast, hardcoded_key, 128);
  128. av_cast5_crypt(cast, output, input, size >> 3, 0);
  129. }
  130. static void run_lavu_twofish(uint8_t *output,
  131. const uint8_t *input, unsigned size)
  132. {
  133. static struct AVTWOFISH *twofish;
  134. if (!twofish && !(twofish = av_twofish_alloc()))
  135. fatal_error("out of memory");
  136. av_twofish_init(twofish, hardcoded_key, 128);
  137. av_twofish_crypt(twofish, output, input, size >> 4, NULL, 0);
  138. }
  139. static void run_lavu_rc4(uint8_t *output,
  140. const uint8_t *input, unsigned size)
  141. {
  142. static struct AVRC4 *rc4;
  143. if (!rc4 && !(rc4 = av_rc4_alloc()))
  144. fatal_error("out of memory");
  145. av_rc4_init(rc4, hardcoded_key, 128, 0);
  146. av_rc4_crypt(rc4, output, input, size, NULL, 0);
  147. }
  148. static void run_lavu_xtea(uint8_t *output,
  149. const uint8_t *input, unsigned size)
  150. {
  151. static struct AVXTEA *xtea;
  152. if (!xtea && !(xtea = av_xtea_alloc()))
  153. fatal_error("out of memory");
  154. av_xtea_init(xtea, hardcoded_key);
  155. av_xtea_crypt(xtea, output, input, size >> 3, NULL, 0);
  156. }
  157. /***************************************************************************
  158. * crypto: OpenSSL's libcrypto
  159. ***************************************************************************/
  160. #if (USE_EXT_LIBS) & USE_crypto
  161. #include <openssl/md5.h>
  162. #include <openssl/sha.h>
  163. #include <openssl/ripemd.h>
  164. #include <openssl/aes.h>
  165. #include <openssl/blowfish.h>
  166. #include <openssl/camellia.h>
  167. #include <openssl/cast.h>
  168. #include <openssl/rc4.h>
  169. #define DEFINE_CRYPTO_WRAPPER(suffix, function) \
  170. static void run_crypto_ ## suffix(uint8_t *output, \
  171. const uint8_t *input, unsigned size) \
  172. { \
  173. function(input, size, output); \
  174. }
  175. DEFINE_CRYPTO_WRAPPER(md5, MD5)
  176. DEFINE_CRYPTO_WRAPPER(sha1, SHA1)
  177. DEFINE_CRYPTO_WRAPPER(sha256, SHA256)
  178. DEFINE_CRYPTO_WRAPPER(sha512, SHA512)
  179. DEFINE_CRYPTO_WRAPPER(ripemd160, RIPEMD160)
  180. static void run_crypto_aes128(uint8_t *output,
  181. const uint8_t *input, unsigned size)
  182. {
  183. AES_KEY aes;
  184. unsigned i;
  185. AES_set_encrypt_key(hardcoded_key, 128, &aes);
  186. size -= 15;
  187. for (i = 0; i < size; i += 16)
  188. AES_encrypt(input + i, output + i, &aes);
  189. }
  190. static void run_crypto_blowfish(uint8_t *output,
  191. const uint8_t *input, unsigned size)
  192. {
  193. BF_KEY blowfish;
  194. unsigned i;
  195. BF_set_key(&blowfish, 16, hardcoded_key);
  196. for (i = 0; i < size; i += 8)
  197. BF_ecb_encrypt(input + i, output + i, &blowfish, 1);
  198. }
  199. static void run_crypto_camellia(uint8_t *output,
  200. const uint8_t *input, unsigned size)
  201. {
  202. CAMELLIA_KEY camellia;
  203. unsigned i;
  204. Camellia_set_key(hardcoded_key, 128, &camellia);
  205. size -= 15;
  206. for (i = 0; i < size; i += 16)
  207. Camellia_ecb_encrypt(input + i, output + i, &camellia, 1);
  208. }
  209. static void run_crypto_cast128(uint8_t *output,
  210. const uint8_t *input, unsigned size)
  211. {
  212. CAST_KEY cast;
  213. unsigned i;
  214. CAST_set_key(&cast, 16, hardcoded_key);
  215. for (i = 0; i < size; i += 8)
  216. CAST_ecb_encrypt(input + i, output + i, &cast, 1);
  217. }
  218. static void run_crypto_rc4(uint8_t *output,
  219. const uint8_t *input, unsigned size)
  220. {
  221. RC4_KEY rc4;
  222. RC4_set_key(&rc4, 16, hardcoded_key);
  223. RC4(&rc4, size, input, output);
  224. }
  225. #define IMPL_USE_crypto(...) IMPL_USE(__VA_ARGS__)
  226. #else
  227. #define IMPL_USE_crypto(...) /* ignore */
  228. #endif
  229. /***************************************************************************
  230. * gcrypt: GnuTLS's libgcrypt
  231. ***************************************************************************/
  232. #if (USE_EXT_LIBS) & USE_gcrypt
  233. #include <gcrypt.h>
  234. #define DEFINE_GCRYPT_WRAPPER(suffix, algo) \
  235. static void run_gcrypt_ ## suffix(uint8_t *output, \
  236. const uint8_t *input, unsigned size) \
  237. { \
  238. gcry_md_hash_buffer(GCRY_MD_ ## algo, output, input, size); \
  239. }
  240. DEFINE_GCRYPT_WRAPPER(md5, MD5)
  241. DEFINE_GCRYPT_WRAPPER(sha1, SHA1)
  242. DEFINE_GCRYPT_WRAPPER(sha256, SHA256)
  243. DEFINE_GCRYPT_WRAPPER(sha512, SHA512)
  244. DEFINE_GCRYPT_WRAPPER(ripemd160, RMD160)
  245. #define DEFINE_GCRYPT_CYPHER_WRAPPER(suffix, cypher, sz) \
  246. static void run_gcrypt_ ## suffix(uint8_t *output, \
  247. const uint8_t *input, unsigned size) \
  248. { \
  249. static gcry_cipher_hd_t suffix; \
  250. if (!suffix) \
  251. gcry_cipher_open(&suffix, GCRY_CIPHER_ ## cypher, GCRY_CIPHER_MODE_ECB, 0); \
  252. gcry_cipher_setkey(suffix, hardcoded_key, sz); \
  253. gcry_cipher_encrypt(suffix, output, size, input, size); \
  254. }
  255. DEFINE_GCRYPT_CYPHER_WRAPPER(aes128, AES128, 16)
  256. DEFINE_GCRYPT_CYPHER_WRAPPER(blowfish, BLOWFISH, 16)
  257. DEFINE_GCRYPT_CYPHER_WRAPPER(camellia, CAMELLIA128, 16)
  258. DEFINE_GCRYPT_CYPHER_WRAPPER(cast128, CAST5, 16)
  259. DEFINE_GCRYPT_CYPHER_WRAPPER(twofish, TWOFISH128, 16)
  260. #define IMPL_USE_gcrypt(...) IMPL_USE(__VA_ARGS__)
  261. #else
  262. #define IMPL_USE_gcrypt(...) /* ignore */
  263. #endif
  264. /***************************************************************************
  265. * tomcrypt: LibTomCrypt
  266. ***************************************************************************/
  267. #if (USE_EXT_LIBS) & USE_tomcrypt
  268. #include <tomcrypt.h>
  269. #define DEFINE_TOMCRYPT_WRAPPER(suffix, namespace, algo) \
  270. static void run_tomcrypt_ ## suffix(uint8_t *output, \
  271. const uint8_t *input, unsigned size) \
  272. { \
  273. hash_state md; \
  274. namespace ## _init(&md); \
  275. namespace ## _process(&md, input, size); \
  276. namespace ## _done(&md, output); \
  277. }
  278. DEFINE_TOMCRYPT_WRAPPER(md5, md5, MD5)
  279. DEFINE_TOMCRYPT_WRAPPER(sha1, sha1, SHA1)
  280. DEFINE_TOMCRYPT_WRAPPER(sha256, sha256, SHA256)
  281. DEFINE_TOMCRYPT_WRAPPER(sha512, sha512, SHA512)
  282. DEFINE_TOMCRYPT_WRAPPER(ripemd128, rmd128, RIPEMD128)
  283. DEFINE_TOMCRYPT_WRAPPER(ripemd160, rmd160, RIPEMD160)
  284. static void run_tomcrypt_aes128(uint8_t *output,
  285. const uint8_t *input, unsigned size)
  286. {
  287. symmetric_key aes;
  288. unsigned i;
  289. aes_setup(hardcoded_key, 16, 0, &aes);
  290. size -= 15;
  291. for (i = 0; i < size; i += 16)
  292. aes_ecb_encrypt(input + i, output + i, &aes);
  293. }
  294. static void run_tomcrypt_blowfish(uint8_t *output,
  295. const uint8_t *input, unsigned size)
  296. {
  297. symmetric_key blowfish;
  298. unsigned i;
  299. blowfish_setup(hardcoded_key, 16, 0, &blowfish);
  300. for (i = 0; i < size; i += 8)
  301. blowfish_ecb_encrypt(input + i, output + i, &blowfish);
  302. }
  303. static void run_tomcrypt_camellia(uint8_t *output,
  304. const uint8_t *input, unsigned size)
  305. {
  306. symmetric_key camellia;
  307. unsigned i;
  308. camellia_setup(hardcoded_key, 16, 0, &camellia);
  309. size -= 15;
  310. for (i = 0; i < size; i += 16)
  311. camellia_ecb_encrypt(input + i, output + i, &camellia);
  312. }
  313. static void run_tomcrypt_cast128(uint8_t *output,
  314. const uint8_t *input, unsigned size)
  315. {
  316. symmetric_key cast;
  317. unsigned i;
  318. cast5_setup(hardcoded_key, 16, 0, &cast);
  319. for (i = 0; i < size; i += 8)
  320. cast5_ecb_encrypt(input + i, output + i, &cast);
  321. }
  322. static void run_tomcrypt_twofish(uint8_t *output,
  323. const uint8_t *input, unsigned size)
  324. {
  325. symmetric_key twofish;
  326. unsigned i;
  327. twofish_setup(hardcoded_key, 16, 0, &twofish);
  328. size -= 15;
  329. for (i = 0; i < size; i += 16)
  330. twofish_ecb_encrypt(input + i, output + i, &twofish);
  331. }
  332. static void run_tomcrypt_xtea(uint8_t *output,
  333. const uint8_t *input, unsigned size)
  334. {
  335. symmetric_key xtea;
  336. unsigned i;
  337. xtea_setup(hardcoded_key, 16, 0, &xtea);
  338. for (i = 0; i < size; i += 8)
  339. xtea_ecb_encrypt(input + i, output + i, &xtea);
  340. }
  341. #define IMPL_USE_tomcrypt(...) IMPL_USE(__VA_ARGS__)
  342. #else
  343. #define IMPL_USE_tomcrypt(...) /* ignore */
  344. #endif
  345. /***************************************************************************
  346. * Driver code
  347. ***************************************************************************/
  348. static unsigned crc32(const uint8_t *data, unsigned size)
  349. {
  350. return av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, data, size);
  351. }
  352. static void run_implementation(const uint8_t *input, uint8_t *output,
  353. struct hash_impl *impl, unsigned size)
  354. {
  355. uint64_t t0, t1;
  356. unsigned nruns = specified_runs ? specified_runs : (1 << 30) / size;
  357. unsigned outlen = 0, outcrc = 0;
  358. unsigned i, j, val;
  359. double mtime, ttime = 0, ttime2 = 0, stime;
  360. uint8_t outref[MAX_OUTPUT_SIZE];
  361. if (enabled_libs && !av_stristr(enabled_libs, impl->lib) ||
  362. enabled_algos && !av_stristr(enabled_algos, impl->name))
  363. return;
  364. if (!sscanf(impl->output, "crc:%x", &outcrc)) {
  365. outlen = strlen(impl->output) / 2;
  366. for (i = 0; i < outlen; i++) {
  367. sscanf(impl->output + i * 2, "%02x", &val);
  368. outref[i] = val;
  369. }
  370. }
  371. for (i = 0; i < 8; i++) /* heat caches */
  372. impl->run(output, input, size);
  373. for (i = 0; i < nruns; i++) {
  374. memset(output, 0, size); /* avoid leftovers from previous runs */
  375. t0 = AV_READ_TIME();
  376. impl->run(output, input, size);
  377. t1 = AV_READ_TIME();
  378. if (outlen ? memcmp(output, outref, outlen) :
  379. crc32(output, size) != outcrc) {
  380. fprintf(stderr, "Expected: ");
  381. if (outlen)
  382. for (j = 0; j < outlen; j++)
  383. fprintf(stderr, "%02x", output[j]);
  384. else
  385. fprintf(stderr, "%08x", crc32(output, size));
  386. fprintf(stderr, "\n");
  387. fatal_error("output mismatch");
  388. }
  389. mtime = (double)(t1 - t0) / size;
  390. ttime += mtime;
  391. ttime2 += mtime * mtime;
  392. }
  393. ttime /= nruns;
  394. ttime2 /= nruns;
  395. stime = sqrt(ttime2 - ttime * ttime);
  396. printf("%-10s %-12s size: %7d runs: %6d time: %8.3f +- %.3f\n",
  397. impl->lib, impl->name, size, nruns, ttime, stime);
  398. fflush(stdout);
  399. }
  400. #define IMPL_USE(lib, name, symbol, output) \
  401. { #lib, name, run_ ## lib ## _ ## symbol, output },
  402. #define IMPL(lib, ...) IMPL_USE_ ## lib(lib, __VA_ARGS__)
  403. #define IMPL_ALL(...) \
  404. IMPL(lavu, __VA_ARGS__) \
  405. IMPL(crypto, __VA_ARGS__) \
  406. IMPL(gcrypt, __VA_ARGS__) \
  407. IMPL(tomcrypt, __VA_ARGS__)
  408. struct hash_impl implementations[] = {
  409. IMPL_ALL("MD5", md5, "aa26ff5b895356bcffd9292ba9f89e66")
  410. IMPL_ALL("SHA-1", sha1, "1fd8bd1fa02f5b0fe916b0d71750726b096c5744")
  411. IMPL_ALL("SHA-256", sha256, "14028ac673b3087e51a1d407fbf0df4deeec8f217119e13b07bf2138f93db8c5")
  412. IMPL_ALL("SHA-512", sha512, "3afdd44a80d99af15c87bd724cb717243193767835ce866dd5d58c02d674bb57"
  413. "7c25b9e118c200a189fcd5a01ef106a4e200061f3e97dbf50ba065745fd46bef")
  414. IMPL(lavu, "RIPEMD-128", ripemd128, "9ab8bfba2ddccc5d99c9d4cdfb844a5f")
  415. IMPL(tomcrypt, "RIPEMD-128", ripemd128, "9ab8bfba2ddccc5d99c9d4cdfb844a5f")
  416. IMPL_ALL("RIPEMD-160", ripemd160, "62a5321e4fc8784903bb43ab7752c75f8b25af00")
  417. IMPL_ALL("AES-128", aes128, "crc:ff6bc888")
  418. IMPL_ALL("CAMELLIA", camellia, "crc:7abb59a7")
  419. IMPL_ALL("CAST-128", cast128, "crc:456aa584")
  420. IMPL_ALL("BLOWFISH", blowfish, "crc:33e8aa74")
  421. IMPL(lavu, "TWOFISH", twofish, "crc:9edbd5c1")
  422. IMPL(gcrypt, "TWOFISH", twofish, "crc:9edbd5c1")
  423. IMPL(tomcrypt, "TWOFISH", twofish, "crc:9edbd5c1")
  424. IMPL(lavu, "RC4", rc4, "crc:538d37b2")
  425. IMPL(crypto, "RC4", rc4, "crc:538d37b2")
  426. IMPL(lavu, "XTEA", xtea, "crc:931fc270")
  427. IMPL(tomcrypt, "XTEA", xtea, "crc:931fc270")
  428. };
  429. int main(int argc, char **argv)
  430. {
  431. uint8_t *input = av_malloc(MAX_INPUT_SIZE * 2);
  432. uint8_t *output = input + MAX_INPUT_SIZE;
  433. unsigned i, impl, size;
  434. int opt;
  435. while ((opt = getopt(argc, argv, "hl:a:r:")) != -1) {
  436. switch (opt) {
  437. case 'l':
  438. enabled_libs = optarg;
  439. break;
  440. case 'a':
  441. enabled_algos = optarg;
  442. break;
  443. case 'r':
  444. specified_runs = strtol(optarg, NULL, 0);
  445. break;
  446. case 'h':
  447. default:
  448. fprintf(stderr, "Usage: %s [-l libs] [-a algos] [-r runs]\n",
  449. argv[0]);
  450. if ((USE_EXT_LIBS)) {
  451. char buf[1024];
  452. snprintf(buf, sizeof(buf), "%s%s%s",
  453. ((USE_EXT_LIBS) & USE_crypto) ? "+crypto" : "",
  454. ((USE_EXT_LIBS) & USE_gcrypt) ? "+gcrypt" : "",
  455. ((USE_EXT_LIBS) & USE_tomcrypt) ? "+tomcrypt" : "");
  456. fprintf(stderr, "Built with the following external libraries:\n"
  457. "make VERSUS=%s\n", buf + 1);
  458. } else {
  459. fprintf(stderr, "Built without external libraries; use\n"
  460. "make VERSUS=crypto+gcrypt+tomcrypt tools/crypto_bench\n"
  461. "to enable them.\n");
  462. }
  463. exit(opt != 'h');
  464. }
  465. }
  466. if (!input)
  467. fatal_error("out of memory");
  468. for (i = 0; i < MAX_INPUT_SIZE; i += 4)
  469. AV_WB32(input + i, i);
  470. size = MAX_INPUT_SIZE;
  471. for (impl = 0; impl < FF_ARRAY_ELEMS(implementations); impl++)
  472. run_implementation(input, output, &implementations[impl], size);
  473. av_free(input);
  474. return 0;
  475. }