Mercurial > libavcodec.hg
comparison motion-test.c @ 9199:ea0e5e9a520f libavcodec
Replace random() usage in test programs by av_lfg_*().
| author | diego |
|---|---|
| date | Fri, 20 Mar 2009 11:48:27 +0000 |
| parents | e9d9d946f213 |
| children | b225f51903af |
comparison
equal
deleted
inserted
replaced
| 9198:342e95d4784b | 9199:ea0e5e9a520f |
|---|---|
| 28 #include <string.h> | 28 #include <string.h> |
| 29 #include <sys/time.h> | 29 #include <sys/time.h> |
| 30 #include <unistd.h> | 30 #include <unistd.h> |
| 31 | 31 |
| 32 #include "dsputil.h" | 32 #include "dsputil.h" |
| 33 #include "libavutil/lfg.h" | |
| 33 | 34 |
| 34 #undef exit | 35 #undef exit |
| 35 #undef printf | 36 #undef printf |
| 36 #undef random | |
| 37 | 37 |
| 38 #define WIDTH 64 | 38 #define WIDTH 64 |
| 39 #define HEIGHT 64 | 39 #define HEIGHT 64 |
| 40 | 40 |
| 41 uint8_t img1[WIDTH * HEIGHT]; | 41 uint8_t img1[WIDTH * HEIGHT]; |
| 42 uint8_t img2[WIDTH * HEIGHT]; | 42 uint8_t img2[WIDTH * HEIGHT]; |
| 43 | 43 |
| 44 void fill_random(uint8_t *tab, int size) | 44 void fill_random(uint8_t *tab, int size) |
| 45 { | 45 { |
| 46 int i; | 46 int i; |
| 47 AVLFG prn; | |
| 48 | |
| 49 av_lfg_init(&prn, 1); | |
| 47 for(i=0;i<size;i++) { | 50 for(i=0;i<size;i++) { |
| 48 #if 1 | 51 #if 1 |
| 49 tab[i] = random() % 256; | 52 tab[i] = av_lfg_get(&prn) % 256; |
| 50 #else | 53 #else |
| 51 tab[i] = i; | 54 tab[i] = i; |
| 52 #endif | 55 #endif |
| 53 } | 56 } |
| 54 } | 57 } |
| 140 printf("ffmpeg motion test\n"); | 143 printf("ffmpeg motion test\n"); |
| 141 | 144 |
| 142 ctx = avcodec_alloc_context(); | 145 ctx = avcodec_alloc_context(); |
| 143 ctx->dsp_mask = FF_MM_FORCE; | 146 ctx->dsp_mask = FF_MM_FORCE; |
| 144 dsputil_init(&cctx, ctx); | 147 dsputil_init(&cctx, ctx); |
| 145 for (c = 0; c < 2; c++) { | 148 for (c = 0; c < 1; c++) { |
| 146 int x; | 149 int x; |
| 147 ctx->dsp_mask = FF_MM_FORCE | flags[c]; | 150 ctx->dsp_mask = FF_MM_FORCE | flags[c]; |
| 148 dsputil_init(&mmxctx, ctx); | 151 dsputil_init(&mmxctx, ctx); |
| 149 | 152 |
| 150 for (x = 0; x < 2; x++) { | 153 for (x = 0; x < 2; x++) { |
