Commit 9e8098e7 authored by Zdenek Kabelac's avatar Zdenek Kabelac

* a little bit extended dsptest also suports dsptestpic target

Originally committed as revision 569 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent ec9a41f5
...@@ -39,6 +39,8 @@ audiogen: audiogen.c ...@@ -39,6 +39,8 @@ audiogen: audiogen.c
DSPDEPS = $(SRC_PATH)/libavcodec/i386/dsputil_mmx.c \ DSPDEPS = $(SRC_PATH)/libavcodec/i386/dsputil_mmx.c \
$(SRC_PATH)/libavcodec/i386/dsputil_mmx_avg.h $(SRC_PATH)/libavcodec/i386/dsputil_mmx_avg.h
dsptestpic: dsptest.c $(DSPDEPS)
$(CC) -fPIC -DPIC -O4 -fomit-frame-pointer -DHAVE_AV_CONFIG_H -I.. -I$(SRC_PATH)/libavcodec/i386 -I$(SRC_PATH)/libavcodec/ -o $@ $<
dsptest: dsptest.c $(DSPDEPS) dsptest: dsptest.c $(DSPDEPS)
$(CC) -O4 -fomit-frame-pointer -DHAVE_AV_CONFIG_H -I.. -I$(SRC_PATH)/libavcodec/i386 -I$(SRC_PATH)/libavcodec/ -o $@ $< $(CC) -O4 -fomit-frame-pointer -DHAVE_AV_CONFIG_H -I.. -I$(SRC_PATH)/libavcodec/i386 -I$(SRC_PATH)/libavcodec/ -o $@ $<
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define TESTCPU_MAIN #define TESTCPU_MAIN
#include "dsputil.h" #include "dsputil.h"
//#include "../libavcodec/dsputil.c"
#include "../libavcodec/i386/cputest.c" #include "../libavcodec/i386/cputest.c"
#include "../libavcodec/i386/dsputil_mmx.c" #include "../libavcodec/i386/dsputil_mmx.c"
#undef TESTCPU_MAIN #undef TESTCPU_MAIN
...@@ -31,22 +32,51 @@ ...@@ -31,22 +32,51 @@
* *
* currently only for i386 - FIXME * currently only for i386 - FIXME
*/ */
#define PIX_FUNC_C(a) \
{ #a "_c", a ## _c, 0 }, \
{ #a "_mmx", a ## _mmx, MM_MMX }, \
{ #a "_mmx2", a ## _mmx2, MM_MMXEXT | PAD }
#define PIX_FUNC(a) \
{ #a "_mmx", a ## _mmx, MM_MMX }, \
{ #a "_3dnow", a ## _3dnow, MM_3DNOW }, \
{ #a "_mmx2", a ## _mmx2, MM_MMXEXT | PAD }
#define PIX_FUNC_MMX(a) \
{ #a "_mmx", a ## _mmx, MM_MMX | PAD }
/*
PIX_FUNC_C(pix_abs16x16),
PIX_FUNC_C(pix_abs16x16_x2),
PIX_FUNC_C(pix_abs16x16_y2),
PIX_FUNC_C(pix_abs16x16_xy2),
PIX_FUNC_C(pix_abs8x8),
PIX_FUNC_C(pix_abs8x8_x2),
PIX_FUNC_C(pix_abs8x8_y2),
PIX_FUNC_C(pix_abs8x8_xy2),
*/
static const struct pix_func { static const struct pix_func {
char* name; char* name;
op_pixels_func func; op_pixels_func func;
int mm_flags; int mm_flags;
} pix_func[] = { } pix_func[] = {
{ "put_pixels_x2_mmx", put_pixels_y2_mmx, MM_MMX },
{ "put_pixels_x2_3dnow", put_pixels_y2_3dnow, MM_3DNOW },
{ "put_pixels_x2_mmx2", put_pixels_y2_mmx2, MM_MMXEXT | PAD },
{ "put_no_rnd_pixels_x2_mmx", put_no_rnd_pixels_x2_mmx, MM_MMX }, PIX_FUNC_MMX(put_pixels),
{ "put_no_rnd_pixels_x2_3dnow", put_no_rnd_pixels_x2_3dnow, MM_3DNOW }, PIX_FUNC_MMX(put_pixels_x2),
{ "put_no_rnd_pixels_x2_mmx2", put_no_rnd_pixels_x2_mmx2, MM_MMXEXT | PAD }, PIX_FUNC_MMX(put_pixels_y2),
PIX_FUNC_MMX(put_pixels_xy2),
PIX_FUNC(put_no_rnd_pixels_x2),
PIX_FUNC(put_no_rnd_pixels_y2),
PIX_FUNC_MMX(put_no_rnd_pixels_xy2),
PIX_FUNC(avg_pixels),
PIX_FUNC(avg_pixels_x2),
PIX_FUNC(avg_pixels_y2),
PIX_FUNC(avg_pixels_xy2),
{ "put_pixels_y2_mmx", put_pixels_y2_mmx, MM_MMX },
{ "put_pixels_y2_3dnow", put_pixels_y2_3dnow, MM_3DNOW },
{ "put_pixels_y2_mmx2", put_pixels_y2_mmx2, MM_MMXEXT | PAD },
{ 0, 0 } { 0, 0 }
}; };
...@@ -66,6 +96,8 @@ static test_speed(int step) ...@@ -66,6 +96,8 @@ static test_speed(int step)
char empty[32768]; char empty[32768];
char* bu =(char*)(((long)empty + 32) & ~0xf); char* bu =(char*)(((long)empty + 32) & ~0xf);
int sum = 0;
while (pix->name) while (pix->name)
{ {
int i; int i;
...@@ -88,10 +120,13 @@ static test_speed(int step) ...@@ -88,10 +120,13 @@ static test_speed(int step)
te = rdtsc(); te = rdtsc();
emms(); emms();
printf("% 9d\n", (int)(te - ts)); printf("% 9d\n", (int)(te - ts));
sum += (te - ts) / 100000;
if (pix->mm_flags & PAD) if (pix->mm_flags & PAD)
puts(""); puts("");
pix++; pix++;
} }
printf("Total sum: %d\n", sum);
} }
int main(int argc, char* argv[]) int main(int argc, char* argv[])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment