libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] Subimages


From: Edward Rosten
Subject: [libcvd-members] Subimages
Date: Wed, 28 Jun 2006 15:37:39 -0600 (MDT)


OK, so I've added preliminary subimage support to libcvd, int the subimage2 branch.

The design is pretty striaghtforward, but herre's an overview:

BasicImage now derives from SubImage.

SubImage provides basic operations, like [], .size(), etc, and a new .sub_image() function. SubImages work like BasicImage, they're just unmanaged smart-ish pointers.

BasicImage provides stronger guarantees (ie contiguous data), and Image provides even more (ie SIMD aligned data).

The changes should be 100% compatible, (modulo a recompile), so most stuff (eg all the algorithms will only currently work on BasicImages).


SubImage has iterator support, so you can now copy an area of an image with std::copy, for instance.

BasicImage<T> still uses T* for iterators.


look at subimage_test.cc, for some examples. Not the use of .fastend() as well as .end(). If you compile with -O3 -funroll-loops, then fastend() has a 2x speedup over .end(), is nearly as fast as raw pointers and is faster than using a double for-loop over an area of an image.

Without -funroll-loops, fastend() is slower than end(), and they're all about 1/2 the speed as with -funroll-loops.

Unfortunately, standard algorithms don't get the benefit of fastend(), since they require the begin and end iterators to be of the same type.


The implementation is still preliminary (no const iterator support, for instance).


I've tried to make it minimally invasive, but 4 bytes have been added to the size of all BasicImage derived classes.


Comments/suggestions?

Is this reasonable?

-Ed





reply via email to

[Prev in Thread] Current Thread [Next in Thread]