Log in

View Full Version : PixelClip speed


d'Oursse
26th July 2005, 08:48
hello,

for RGB to YUV conversions, the PixelClip method is used. Is it really faster than the two tests (inlined) :

if (n<0) return 0;
if (n>255) return 255;
return n;

?

Bidoche
26th July 2005, 09:18
Out of context, I think it is.
But in the middle of avs code, generally already memory bound, it may not be.

sh0dan
26th July 2005, 14:43
I think MMX is used for all RGB to YUV, expect the rare cases where width is not MOD4, IIRC.

IanB
29th July 2005, 14:35
I did a job on Tweak using a lookup table algorith much like PixelClip and it works extremely well, it was streets faster than the original calculation in place code and even marginally faster than the existing iSSE code.

Short byte tables, less than a K, seem to work far better than expected on all platforms. I guess they lock themselves into L1 cache the rest of the work is upto the address unit.

IanB

mg262
29th July 2005, 14:46
I was looking at ways of speeding up Didée's LimitedSharpen...

http://videoprocessing.11.forumer.com/viewtopic.php?t=16

and it occurred to me that Levels would be done rather faster with a lookup table too... it could be done with YV12LUT.
____

So, if I understand you, 1-byte-indexed lookups are faster than 2-byte-indexed lookups because of cache effects?

IanB
29th July 2005, 15:26
unsigned char Answer8[1024]; works very well.

short Answer16[512]; should work just as well.

short Answer16[65536]; is probably pushing your luck, but if calculating answer is very complicated, i.e. like a trig. function then maybe it can be effective.

IanB