28 #define MAX_FORMATS 1000 //this must be larger than the number of formats
35 #define AV_READ_TIME(x) 0
56 "Failure of %s probing code with score=%d type=%d p=%X size=%d\n",
57 fmt->
name, score, type, p, size);
74 fprintf(stderr,
"%12"PRIu64
" cycles, %12s\n",
86 ret = strtol(arg, &arg, 0);
92 int main(
int argc,
char **argv)
94 unsigned int p, i,
type,
size, retry;
98 int retry_count= 4097;
102 for (j = i = 1; i<argc; i++) {
105 }
else if (
read_int(argv[i])>0 && j == 1) {
108 }
else if (
read_int(argv[i])>0 && j == 2) {
112 fprintf(stderr,
"probetest [-f <input format>] [<retry_count> [<max_size>]]\n");
117 if (max_size > 1000000000
U/8) {
118 fprintf(stderr,
"max_size out of bounds\n");
122 if (retry_count > 1000000000
U) {
123 fprintf(stderr,
"retry_count out of bounds\n");
133 for (size = 1; size < max_size; size *= 2) {
139 fprintf(stderr,
"out of memory\n");
145 fprintf(stderr,
"testing size=%d\n", size);
147 for (retry = 0; retry < retry_count; retry +=
FFMAX(size, 32)) {
148 for (type = 0; type < 4; type++) {
149 for (p = 0; p < 4096; p++) {
154 for (i = 0; i < size * 8; i++)
158 for (i = 0; i < size * 8; i++) {
159 unsigned int p2 = hist ? p & 0x3F : (p >> 6);
160 unsigned int v = (
av_lfg_get(&state) & 0xFFFFFFFF) > p2 << 26;
166 for (i = 0; i < size * 8; i++) {
167 unsigned int p2 = (p >> (hist * 3)) & 7;
168 unsigned int v = (
av_lfg_get(&state) & 0xFFFFFFFF) > p2 << 29;
170 hist = (2 * hist +
v) & 3;
174 for (i = 0; i <
size; i++) {
178 if (c >=
'a' && c <=
'z' && (p & 1))
180 else if (c >=
'A' && c <=
'Z' && (p & 2))
182 else if (c >=
'0' && c <=
'9' && (p & 4))
184 else if (c ==
' ' && (p & 8))
186 else if (c == 0 && (p & 16))
188 else if (c == 1 && (p & 32))
195 probe(&pd, type, p, size);