Revision ec9a41f5 libavcodec/i386/dsputil_mmx.c

View differences:

libavcodec/i386/dsputil_mmx.c
1082 1082
    }
1083 1083
}
1084 1084

  
1085
#else // TESTCPU_MAIN
1086
/*
1087
 * for testing speed of various routine - should be probably extended
1088
 * for a general purpose regression test later
1089
 *
1090
 * for now use it this way:
1091
 *
1092
 * gcc -O4 -fomit-frame-pointer -DHAVE_AV_CONFIG_H -DTESTCPU_MAIN  -I../.. -o test dsputil_mmx.c
1093
 *
1094
 * in libavcodec/i386 directory - then run ./test
1095
 */
1096
static inline long long rdtsc()
1097
{
1098
    long long l;
1099
    asm volatile(   "rdtsc\n\t"
1100
		    : "=A" (l)
1101
		);
1102
    return l;
1103
}
1104

  
1105
int main(int argc, char* argv[])
1106
{
1107
    volatile int v;
1108
    int i;
1109
    const int linesize = 720;
1110
    char empty[32768];
1111
    uint64_t te, ts = rdtsc();
1112
    char* im, *bu = empty;
1113
    op_pixels_func fc = put_pixels_y2_mmx2;
1114
    bu += 32;
1115
    bu =(char*)(((long)bu) & ~0xf); // 16 bytes alignment
1116
    im = bu;
1117
    for(i=0; i<1000000; i++){
1118
	fc(im, im + 1000, linesize, 16);
1119
	im += 4; //
1120
	if (im > bu + 10000)
1121
            im = bu;
1122
    }
1123
    te = rdtsc();
1124
    printf("CPU Ticks: %7d\n", (int)(te - ts));
1125
}
1126 1085
#endif

Also available in: Unified diff