[Ffmpeg-devel] [PATCH] watermark.c optimizations for single-frameinput (previous patch included)

Mihail Stoyanov screamer
Fri Oct 20 17:07:59 CEST 2006


----- Original Message ----- 
From: "Michael Niedermayer" <michaelni at gmx.at>
To: "FFmpeg development discussions and patches" <ffmpeg-devel at mplayerhq.hu>
Sent: Friday, October 20, 2006 5:20 PM
Subject: Re: [Ffmpeg-devel] [PATCH] watermark.c optimizations for 
single-frameinput (previous patch included)


> Hi
>
> [cut]
>
> great
>

thanks

>
> [...]
>
> [cut]
>
> INT_MAX
>

thanks 2

>
> [...]
>>      }
>> +    if (ci->do_optimize) {
>> + start_x = ci->x1;
>> + start_y = ci->y1;
>> + end_x = ci->x2;
>> + end_y = ci->y2;
>> +    }
>
> tabs are not allowed in ffmpeg (they tend cause a big mess as not everyone
> uses 8space tabs)
>

i will

>
> [...]
>> +     if (thrR == (int)((pixelm >> 16) & 0xff) &&
>> + thrG == (int)((pixelm >> 8) & 0xff) &&
>> + thrB == (int)((pixelm >> 0) & 0xff)) {
>
> precalculate thr= thrB + (thrG<<8) + (thrR<<16)
> and then use if(thr == pixelm)
> or
> if(thr == (pixelm & 0xFFFFFF))
> or something like that
>

sorry, i won't.
it works faster my way. it has 33% chance of probability to fallback to 
"else" when checking the first argument (red). and 66% when checking the 
second (green).
precalculation is even more cpu intensive. additionally you can't use "if 
(thr == pixelm)" but "if(thr == (pixelm & 0xFFFFFF))" since you need just 3 
bytes of the int
if you don't believe me - try it yourself. get a bigger source so you can 
make more accurate test


test times
my way -> Convert time: 00:18
your way -> Convert time: 00:19

>
> [...]
>
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> In the past you could go to a library and read, borrow or copy any book
> Today you'd get arrested for mere telling someone where the library is
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.408 / Virus Database: 268.13.7/488 - Release Date: 19.10.2006 
> ?.
>
> 





More information about the ffmpeg-devel mailing list