[FFmpeg-devel] PATCH libswscale yuv2rgbtst infastructure

Michael Niedermayer michaelni
Tue May 1 14:59:31 CEST 2007


Hi

On Tue, May 01, 2007 at 06:31:32AM -0400, Marc Hoffman wrote:
Content-Description: message body text
> 
> yuv to rgb color space converter test, debug and performance
> infastructure.
> 

[...]

> +#include "swscale_internal.h"

this is not needed for testing


> +#include "rgb2rgb.h"
> +
> +#define ACCL (SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN)

hmm


> +#define NITERS 10
> +
> +
> +#if defined(__MINGW32__) || defined(CONFIG_OS2)
> +static int64_t getutime(void)
> +{
> +    return av_gettime();
> +}
> +#else
> +static int64_t getutime(void)
> +{
> +    struct rusage rusage;
> +
> +    getrusage(RUSAGE_SELF, &rusage);
> +    return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
> +}
> +#endif

by how much does variance decrease if rusage.ru_utime is used?
if you dont know or its not much then please remove this


[...]
> +    SwsFunc csc_accl = 0;
> +    SwsFunc csc_c    = 0;

why are they set to 0? they are not read


> +    int sws_flags    = 0;

useless

[...]
> +    st0 = getutime ();
> +    for (i=0;i<NITERS;i++) {
> +        csc_accl (sws, src, strides, 0, h   , dst, dstrides);
> +    }
> +
> +    st1 = getutime ();
> +    for (i=0;i<NITERS;i++) {
> +        csc_c (sws, src, strides, 0, h   , ref, dstrides);
> +    }
> +    st2 = getutime();

try:

csc_accl(sws, src, strides, 0, h   , dst, dstrides);
csc_c   (sws, src, strides, 0, h   , ref, dstrides);
for (i=0;i<NITERS;i++) {
    for(j=0; j<2; j++){
        st0 = getutime ();
        if(j==0) csc_accl(sws, src, strides, 0, h   , dst, dstrides);
        else     csc_c   (sws, src, strides, 0, h   , ref, dstrides);
        st1 = getutime ();
        mean[j]+= st1 - st0;
        var[j] +=(st1 - st0)*(st1 - st0);
    }
}

1. this runs the code once before benchmaring to ensure its in the code cache
2. it interleaves the tests so systematic errors (cron jobs, ...) are reduced
3. it calculated mean & variance


[...]
> +    if (argc < 3) {
> +        fprintf (stderr, "expecting the following arguments fname width height\n");

fname? you mean filename


> +        exit (-1);

return -1

[...]

> +    dst[1] = 0;
> +    dst[2] = 0;

uint8_t *dst[3]={0};

[...]

> +    free (dst[0]);
> +    free (ref[0]);
> +    free (src[0]);

free immedeatly before exit /return from main is useless


> +
> +    exit (0);

return 0

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070501/50f1df7e/attachment.pgp>



More information about the ffmpeg-devel mailing list