]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/motion-test.c
rv40: don't always do the full prev_type search
[ffmpeg] / libavcodec / motion-test.c
index e24c7de6d2d3ff52dcf07ca77c0cee15e112d4d3..a22cb1eec533c3945fb427a91913e2f427bac5c5 100644 (file)
@@ -1,25 +1,25 @@
 /*
  * (c) 2001 Fabrice Bellard
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
- * @file libavcodec/motion-test.c
+ * @file
  * motion test.
  */
 
 #include <sys/time.h>
 #include <unistd.h>
 
+#include "config.h"
 #include "dsputil.h"
 #include "libavutil/lfg.h"
 
-#undef exit
 #undef printf
 
 #define WIDTH 64
 #define HEIGHT 64
 
-uint8_t img1[WIDTH * HEIGHT];
-uint8_t img2[WIDTH * HEIGHT];
+static uint8_t img1[WIDTH * HEIGHT];
+static uint8_t img2[WIDTH * HEIGHT];
 
 static void fill_random(uint8_t *tab, int size)
 {
     int i;
-    AVLFG prn;
+    AVLFG prng;
 
-    av_lfg_init(&prn, 1);
+    av_lfg_init(&prng, 1);
     for(i=0;i<size;i++) {
 #if 1
-        tab[i] = av_lfg_get(&prn) % 256;
+        tab[i] = av_lfg_get(&prng) % 256;
 #else
         tab[i] = i;
 #endif
@@ -60,7 +60,6 @@ static void help(void)
 {
     printf("motion-test [-h]\n"
            "test motion implementations\n");
-    exit(1);
 }
 
 static int64_t gettime(void)
@@ -127,7 +126,8 @@ int main(int argc, char **argv)
     AVCodecContext *ctx;
     int c;
     DSPContext cctx, mmxctx;
-    int flags[2] = { FF_MM_MMX, FF_MM_MMX2 };
+    int flags[2] = { AV_CPU_FLAG_MMX, AV_CPU_FLAG_MMX2 };
+    int flags_size = HAVE_MMX2 ? 2 : 1;
 
     for(;;) {
         c = getopt(argc, argv, "h");
@@ -136,19 +136,19 @@ int main(int argc, char **argv)
         switch(c) {
         case 'h':
             help();
-            break;
+            return 1;
         }
     }
 
-    printf("ffmpeg motion test\n");
+    printf("Libav motion test\n");
 
-    ctx = avcodec_alloc_context();
-    ctx->dsp_mask = FF_MM_FORCE;
-    dsputil_init(&cctx, ctx);
-    for (c = 0; c < 1; c++) {
+    ctx = avcodec_alloc_context3(NULL);
+    ctx->dsp_mask = AV_CPU_FLAG_FORCE;
+    ff_dsputil_init(&cctx, ctx);
+    for (c = 0; c < flags_size; c++) {
         int x;
-        ctx->dsp_mask = FF_MM_FORCE | flags[c];
-        dsputil_init(&mmxctx, ctx);
+        ctx->dsp_mask = AV_CPU_FLAG_FORCE | flags[c];
+        ff_dsputil_init(&mmxctx, ctx);
 
         for (x = 0; x < 2; x++) {
             printf("%s for %dx%d pixels\n", c ? "mmx2" : "mmx",