Hi Joris,
> I'm trying to get the camshiftdemo optimized for the PS3.
> I found out cvInRangeS takes a lot of time. Cvcell has optimized this
> function, but cvcell is not using the optimized cvInRangeS, because of this:
> in cxcmp.cpp (ppu source folder, line 379):
> if( ( spenum > 0 ) && CHECK_ARY_SPU( src1 ) &&
> CHECK_ARY_SPU( src2 ) && CHECK_ARY_SPU( src3 ) && CHECK_ARY_SPU( dst )
> &&
> (CV_MAT_CN(src1->type) == 1) )
> {
> cvInRange_spu(src1, src2, src3, dst);
> return;
> }
>
> I used the debugger and found out that CV_MAT_CN(src1->type)==3, so it will
> not use the spu's.
> Is there someone that could tell me what that is and how I could get this
> function to work on de spu's?
cvInRange on SPU for 3 channel matrix is not yet implemented.
cvInRange for 3 channel matrix and cvInRange for
a single channel matrix are differed.
Result of cvInRange for 3 channel matrix is one that is bit AND-ed
result of cvInRange of each channel.
So, current implementation of cvInRange can't
apply to 3 channel matrix.
If you need that API, you need implement that.
(Sorry, I want to implement it, but I'm busy...)
Implementing cvInRange on SPU for three channels will be
achieved by follow instructions:
- Split your matrix using cvSplit.
- Apply cvInRangeS to each channel of the matrix.
- Apply cvAnd to result of cvInRangeS.
The follow is the pseudocode of outline of that instructions:
========================================
CvMat tmp_b;
CvMat tmp_c[3];
cvSplit(src1, tmp_c[0], tmp_c[1], tmp_c[2]);
cvInRange(tmp_c[0], lower, upper, dst);
cvInRange(tmp_c[1], lower, upper, tmp_b);
cvAnd(dst, tmp_b, dst);
cvInRange(tmp_c[2], lower, upper, tmp_b);
cvAnd(dst, tmp_b, dst);
========================================
But, this implementation is not efficient, because
that instructions need overhead of invoking cvAnd and cvSplit.
If you need more performance of cvInRange,
try implementation cvInRange_spu for three channel matrix.
Thanks,
Takashi
--
Takashi Nakamura<nak...@fi...>
|