On Fri, May 18, 2012 at 06:24:19PM +0200, LE PETITCORPS Yann wrote:
> I see that the sort_u8() func into schrofilter.c  use a basic bubble 
> sort scheme
> => is it volontary ?
> 
> I have make a benchmark between this sort_u8() routine and the standard 
> qsort() C func and  found that the qsort() routine have betters 
> performances whis big data arrays  but lowers performances when it is 
> used very frequently with very littles arrays to sort
> 
> On another side, I have implemented a bubblesort2() func that is 
> relatively similar to sort_u8() but that seem more performant than 
> qsort() and sort_u8() when it is very frequently used with a data array  
> on the range of 32 to 1024 bytes


This is only used in the center-weighted median code, which must
be specifically enabled.  CWM is particularly bad at filtering out
noise in video, especially the kind of noise that make video encoders
less efficient.

Sorting neighboring pixel values is a particularly dumb method of
doing a CWM filter (when all you want is the median), so fixing the
dumb method of sorting is not really going to make the code good.
The correct way to do CWM is roughly min(max(center,min(neighbors),
max(neighbors)), at least for weight=4.  (IIRC, this is from memory)

I'm only going to apply patches to this code to a) remove it, or b)
rewrite it in Orc.  The latter clearly requires using something
SIMDable for median filtering.  Interestingly, bubble sort can be
implemented in SIMD, which may provide insight into why it was
originally chosen.  (But my guess is that the reason why it was
chosen is that it took <5 minutes to implement.)



David


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Schrodinger-devel mailing list
Schrodinger-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/schrodinger-devel

Reply via email to