Updated [obsolete] FilterBenchmark (rest)

wm4 2014-09-12 01:45:51 -07:00
parent 22b7c6c3f1
commit 37f226a7a8
1 changed files with 157 additions and 157 deletions

@ -1,158 +1,158 @@
Warning: obviously outdated, and uses some things that were never part of mainline mpv.
Using the video from http://mirror.bigbuckbunny.de/peach/bigbuckbunny_movies/big_buck_bunny_1080p_stereo.ogg (shortened mirror: http://ompldr.org/vZmZmeQ/big_buck_bunny_1080p_stereo-61s.ogg)::
F=big_buck_bunny_1080p_stereo.ogg
D=60
test_f_1()
{
/usr/bin/time -p mplayer "$F" -endpos "$D" -quiet -untimed -no-audio -vo null "$@" 2>&1 >/dev/null | tail -n 3 | head -n 1 | cut -d ' ' -f 2
}
test_f()
{
f=$1
echo -n "$f: "
shift
case "$f" in
geq) test_f_1 "$@" ;;
*) a=; for t in 1 2 3 4 5; do r=`test_f_1 "$@"`; echo -n "$r "; a="$a $r"; done; echo -n "-> "; echo "$a" | xargs -n 1 echo | sort -n | head -n 3 | tail -n 1 ;;
esac
}
test_f "No filter"
test_f "eq2" -vf eq2=1:-1
test_f "lua-pxy" -vf lua=fn_l='1-p(x\,y)'
test_f "lua-c" -vf lua=fn_l='1-c'
test_f "lua-lut" -vf lua=lut_l='1-c'
test_f "dlopen" -vf dlopen=./invert_y.so
test_f "geq" -vf geq='255-p(X\,Y)':'p(X\,Y)':'p(X\,Y)'
Results (by divVerent, running LuaJIT 2.0.0-beta10 on AMD Athlon(tm) II X4 620 Processor @ 2.6GHz)::
No filter: 7.09 7.09 7.11 7.11 7.16 -> 7.11
eq2: 7.67 7.63 7.67 7.64 7.66 -> 7.66
lua-pxy: 40.92 40.92 40.90 40.89 40.90 -> 40.90
lua-c: 16.52 16.51 16.51 16.52 16.51 -> 16.51
lua-lut: 7.74 7.78 7.75 7.80 7.76 -> 7.76
dlopen: 7.09 7.10 7.10 7.07 7.06 -> 7.09
geq: 333.80
Results (by divVerent, running LuaJIT 2.0.0-beta10 on Intel(R) Core(TM)2 Duo CPU P8700 @ 2.53GHz)::
No filter: 12.10 12.08 12.09 12.08 12.07 -> 12.08
eq2: 13.00 12.88 12.84 13.47 12.80 -> 12.88
lua-pxy: 19.56 19.74 19.78 19.75 19.83 -> 19.75
lua-c: 15.64 15.85 15.65 15.63 15.75 -> 15.65
lua-lut: 13.43 13.41 13.48 13.33 13.38 -> 13.41
dlopen: 12.06 12.06 12.08 12.05 12.09 -> 12.06
geq: 293.17
Results (by divVerent, running LuaJIT 2.0.0-beta10 on Intel(R) Celeron(R) M processor 900MHz @ 630MHz)::
No filter: 102.07 101.95 101.89 102.02 101.56 -> 101.95
eq2: 111.80 112.17 111.51 111.65 111.75 -> 111.75
lua-pxy: 192.28 192.23 192.23 192.60 192.86 -> 192.28
lua-c: 154.77 154.69 154.81 154.92 154.78 -> 154.78
lua-lut: 111.37 112.14 111.87 111.69 111.49 -> 111.69
dlopen: 103.17 103.11 103.04 103.63 102.78 -> 103.11
geq: 2830.33
Results (by wm4, running LuaJIT 2.0.0-beta9 on Intel(R) Core(TM)2 Duo CPU E6550 @ 2.33GHz)::
No filter: 14.32 14.44 14.54 14.43 14.51 -> 14.44
eq2: 15.24 15.29 15.21 15.24 15.27 -> 15.24
lua-pxy: 23.04 23.10 23.14 23.30 22.93 -> 23.10
dlopen: 16.44 16.30 16.24 16.20 16.03 -> 16.24
geq: 555.20
Results (by wm4, same as above)::
No filter: 15.49 14.25 14.53 14.42 14.41 -> 14.42
eq2: 16.09 15.39 15.29 15.38 15.70 -> 15.39
lua-pxy: 23.04 23.01 25.07 23.50 23.18 -> 23.18
lua-c: 20.20 18.90 19.16 19.01 18.98 -> 19.01
lua-lut: 16.19 15.93 16.14 16.18 16.07 -> 16.14
dlopen: 14.37 14.50 14.62 14.35 15.44 -> 14.50
geq: 402.70
invert_y.c::
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vf_dlopen.h"
#include "filterutils.h"
/*
* luma inverter
*
* usage: -vf dlopen=./invert_y.so
*
* inverts the luma plane. Duh.
*/
static void invert_plane(
unsigned char *dest, unsigned dest_stride,
const unsigned char *src, unsigned src_stride,
unsigned length,
unsigned rows
)
{
unsigned i, j;
assert(dest_stride >= length);
assert(src_stride >= length);
for (i = 0; i < rows; ++i)
{
const unsigned char *s = &src[src_stride * i];
unsigned char *d = &dest[dest_stride * i];
for (j = 0; j < length; ++j)
*d++ = *s++ ^ 0xFF;
}
}
static int iy_put_image(struct vf_dlopen_context *ctx)
{
unsigned int p;
assert(ctx->inpic.planes == ctx->outpic->planes);
for (p = 0; p < ctx->outpic->planes; ++p) {
assert(ctx->inpic.planewidth[p] == ctx->outpic->planewidth[p]);
assert(ctx->inpic.planeheight[p] == ctx->outpic->planeheight[p]);
}
invert_plane(
ctx->outpic->plane[0], ctx->outpic->planestride[0],
ctx->inpic.plane[0], ctx->inpic.planestride[0],
ctx->inpic.planewidth[0], ctx->inpic.planeheight[0]
);
for (p = 1; p < ctx->outpic->planes; ++p) {
copy_plane(
ctx->outpic->plane[p], ctx->outpic->planestride[p],
ctx->inpic.plane[p], ctx->inpic.planestride[p],
ctx->inpic.planewidth[p], ctx->inpic.planeheight[p]
);
}
ctx->outpic->pts = ctx->inpic.pts;
return 1;
}
int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
{
VF_DLOPEN_CHECK_VERSION(ctx);
(void) argc;
(void) argv;
static struct vf_dlopen_formatpair map[] = {
{ "yv12", "yv12" },
{ NULL, NULL }
};
ctx->format_mapping = map;
ctx->put_image = iy_put_image;
return 1;
}
Warning: obviously outdated, and uses some things that were never part of mainline mpv.
Using the video from http://mirror.bigbuckbunny.de/peach/bigbuckbunny_movies/big_buck_bunny_1080p_stereo.ogg (shortened mirror: http://ompldr.org/vZmZmeQ/big_buck_bunny_1080p_stereo-61s.ogg)::
F=big_buck_bunny_1080p_stereo.ogg
D=60
test_f_1()
{
/usr/bin/time -p mplayer "$F" -endpos "$D" -quiet -untimed -no-audio -vo null "$@" 2>&1 >/dev/null | tail -n 3 | head -n 1 | cut -d ' ' -f 2
}
test_f()
{
f=$1
echo -n "$f: "
shift
case "$f" in
geq) test_f_1 "$@" ;;
*) a=; for t in 1 2 3 4 5; do r=`test_f_1 "$@"`; echo -n "$r "; a="$a $r"; done; echo -n "-> "; echo "$a" | xargs -n 1 echo | sort -n | head -n 3 | tail -n 1 ;;
esac
}
test_f "No filter"
test_f "eq2" -vf eq2=1:-1
test_f "lua-pxy" -vf lua=fn_l='1-p(x\,y)'
test_f "lua-c" -vf lua=fn_l='1-c'
test_f "lua-lut" -vf lua=lut_l='1-c'
test_f "dlopen" -vf dlopen=./invert_y.so
test_f "geq" -vf geq='255-p(X\,Y)':'p(X\,Y)':'p(X\,Y)'
Results (by divVerent, running LuaJIT 2.0.0-beta10 on AMD Athlon(tm) II X4 620 Processor @ 2.6GHz)::
No filter: 7.09 7.09 7.11 7.11 7.16 -> 7.11
eq2: 7.67 7.63 7.67 7.64 7.66 -> 7.66
lua-pxy: 40.92 40.92 40.90 40.89 40.90 -> 40.90
lua-c: 16.52 16.51 16.51 16.52 16.51 -> 16.51
lua-lut: 7.74 7.78 7.75 7.80 7.76 -> 7.76
dlopen: 7.09 7.10 7.10 7.07 7.06 -> 7.09
geq: 333.80
Results (by divVerent, running LuaJIT 2.0.0-beta10 on Intel(R) Core(TM)2 Duo CPU P8700 @ 2.53GHz)::
No filter: 12.10 12.08 12.09 12.08 12.07 -> 12.08
eq2: 13.00 12.88 12.84 13.47 12.80 -> 12.88
lua-pxy: 19.56 19.74 19.78 19.75 19.83 -> 19.75
lua-c: 15.64 15.85 15.65 15.63 15.75 -> 15.65
lua-lut: 13.43 13.41 13.48 13.33 13.38 -> 13.41
dlopen: 12.06 12.06 12.08 12.05 12.09 -> 12.06
geq: 293.17
Results (by divVerent, running LuaJIT 2.0.0-beta10 on Intel(R) Celeron(R) M processor 900MHz @ 630MHz)::
No filter: 102.07 101.95 101.89 102.02 101.56 -> 101.95
eq2: 111.80 112.17 111.51 111.65 111.75 -> 111.75
lua-pxy: 192.28 192.23 192.23 192.60 192.86 -> 192.28
lua-c: 154.77 154.69 154.81 154.92 154.78 -> 154.78
lua-lut: 111.37 112.14 111.87 111.69 111.49 -> 111.69
dlopen: 103.17 103.11 103.04 103.63 102.78 -> 103.11
geq: 2830.33
Results (by wm4, running LuaJIT 2.0.0-beta9 on Intel(R) Core(TM)2 Duo CPU E6550 @ 2.33GHz)::
No filter: 14.32 14.44 14.54 14.43 14.51 -> 14.44
eq2: 15.24 15.29 15.21 15.24 15.27 -> 15.24
lua-pxy: 23.04 23.10 23.14 23.30 22.93 -> 23.10
dlopen: 16.44 16.30 16.24 16.20 16.03 -> 16.24
geq: 555.20
Results (by wm4, same as above)::
No filter: 15.49 14.25 14.53 14.42 14.41 -> 14.42
eq2: 16.09 15.39 15.29 15.38 15.70 -> 15.39
lua-pxy: 23.04 23.01 25.07 23.50 23.18 -> 23.18
lua-c: 20.20 18.90 19.16 19.01 18.98 -> 19.01
lua-lut: 16.19 15.93 16.14 16.18 16.07 -> 16.14
dlopen: 14.37 14.50 14.62 14.35 15.44 -> 14.50
geq: 402.70
invert_y.c::
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vf_dlopen.h"
#include "filterutils.h"
/*
* luma inverter
*
* usage: -vf dlopen=./invert_y.so
*
* inverts the luma plane. Duh.
*/
static void invert_plane(
unsigned char *dest, unsigned dest_stride,
const unsigned char *src, unsigned src_stride,
unsigned length,
unsigned rows
)
{
unsigned i, j;
assert(dest_stride >= length);
assert(src_stride >= length);
for (i = 0; i < rows; ++i)
{
const unsigned char *s = &src[src_stride * i];
unsigned char *d = &dest[dest_stride * i];
for (j = 0; j < length; ++j)
*d++ = *s++ ^ 0xFF;
}
}
static int iy_put_image(struct vf_dlopen_context *ctx)
{
unsigned int p;
assert(ctx->inpic.planes == ctx->outpic->planes);
for (p = 0; p < ctx->outpic->planes; ++p) {
assert(ctx->inpic.planewidth[p] == ctx->outpic->planewidth[p]);
assert(ctx->inpic.planeheight[p] == ctx->outpic->planeheight[p]);
}
invert_plane(
ctx->outpic->plane[0], ctx->outpic->planestride[0],
ctx->inpic.plane[0], ctx->inpic.planestride[0],
ctx->inpic.planewidth[0], ctx->inpic.planeheight[0]
);
for (p = 1; p < ctx->outpic->planes; ++p) {
copy_plane(
ctx->outpic->plane[p], ctx->outpic->planestride[p],
ctx->inpic.plane[p], ctx->inpic.planestride[p],
ctx->inpic.planewidth[p], ctx->inpic.planeheight[p]
);
}
ctx->outpic->pts = ctx->inpic.pts;
return 1;
}
int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
{
VF_DLOPEN_CHECK_VERSION(ctx);
(void) argc;
(void) argv;
static struct vf_dlopen_formatpair map[] = {
{ "yv12", "yv12" },
{ NULL, NULL }
};
ctx->format_mapping = map;
ctx->put_image = iy_put_image;
return 1;
}
To compile this filter, put it in TOOLS/vf_dlopen/invert_y.c and edit the Makefile so that FILTERS includes invert_y, then run make.