[FFmpeg-devel] [PATCH 2/3] xtea: add benchmarking code

Michael Niedermayer michaelni at gmx.at
Tue Sep 11 05:20:47 CEST 2012


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavutil/xtea.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavutil/xtea.c b/libavutil/xtea.c
index 6301b18..beaa687 100644
--- a/libavutil/xtea.c
+++ b/libavutil/xtea.c
@@ -145,7 +145,7 @@ int main(void)
 {
     AVXTEA ctx;
     uint8_t buf[8];
-    int i;
+    int i, j;
 
     for (i = 0; i < XTEA_NUM_TESTS; i++) {
         av_xtea_init(&ctx, xtea_test_key[i]);
@@ -161,6 +161,12 @@ int main(void)
             printf("Test decryption failed.\n");
             return 1;
         }
+        for (j = 0; j< 11000; j++) {
+            START_TIMER
+            av_xtea_crypt(&ctx, buf, xtea_test_pt[i], 1, NULL, 0);
+            av_xtea_crypt(&ctx, buf, xtea_test_ct[i], 1, NULL, 1);
+            STOP_TIMER("XTEA");
+        }
     }
     printf("Test encryption/decryption success.\n");
 
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list