From: Elena Gvozdeva Date: Mon, 5 May 2014 12:42:47 +0000 (+0400) Subject: fixed X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~3262^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12279e26313615e16a05f10b47c06ce4395d89c8;p=platform%2Fupstream%2Fopencv.git fixed --- diff --git a/modules/core/src/dxt.cpp b/modules/core/src/dxt.cpp index 31c375c..f4e54e9 100644 --- a/modules/core/src/dxt.cpp +++ b/modules/core/src/dxt.cpp @@ -2894,21 +2894,20 @@ class DctIPPLoop_Invoker : public ParallelLoopBody { public: - DctIPPLoop_Invoker(const Mat& _src, Mat& _dst, const Dct& _ippidct, bool _inv, bool *_ok) : - ParallelLoopBody(), src(_src), dst(_dst), ippidct(_ippidct), inv(_inv), ok(_ok) + DctIPPLoop_Invoker(const Mat& _src, Mat& _dst, const Dct* _ippidct, bool _inv, bool *_ok) : + ParallelLoopBody(), src(&_src), dst(&_dst), ippidct(_ippidct), inv(_inv), ok(_ok) { *ok = true; } virtual void operator()(const Range& range) const { - IppStatus status; void* pDCTSpec; AutoBuffer buf; uchar* pBuffer = 0; int bufSize=0; - IppiSize srcRoiSize = {src.cols, 1}; + IppiSize srcRoiSize = {src->cols, 1}; CV_SUPPRESS_DEPRECATED_START @@ -2916,51 +2915,37 @@ public: ippiDCTFree ippFree = inv ? (ippiDCTFree)ippiDCTInvFree_32f : (ippiDCTFree)ippiDCTFwdFree_32f; ippiDCTGetBufSize ippGetBufSize = inv ? (ippiDCTGetBufSize)ippiDCTInvGetBufSize_32f : (ippiDCTGetBufSize)ippiDCTFwdGetBufSize_32f; - status = ippInitAlloc(&pDCTSpec, srcRoiSize, ippAlgHintNone); - - if ( status < 0 ) + if (ippInitAlloc(&pDCTSpec, srcRoiSize, ippAlgHintNone)>=0 && ippGetBufSize(pDCTSpec, &bufSize)>=0) { - ippFree(pDCTSpec); - *ok = false; - return; - } + buf.allocate( bufSize ); + pBuffer = (uchar*)buf; - status = ippGetBufSize(pDCTSpec, &bufSize); - if ( status < 0 ) - { - ippFree(pDCTSpec); - *ok = false; - return; + for( int i = range.start; i < range.end; ++i) + if(!(*ippidct)((float*)(src->data+i*src->step), (int)src->step,(float*)(dst->data+i*dst->step), (int)dst->step, pDCTSpec, (Ipp8u*)pBuffer)) + *ok = false; } + else + *ok = false; - buf.allocate( bufSize ); - pBuffer = (uchar*)buf; - - for( int i = range.start; i < range.end; ++i) - if(!ippidct((float*)(src.data+i*src.step), (int)src.step,(float*)(dst.data+i*dst.step), (int)dst.step, pDCTSpec, (Ipp8u*)pBuffer)) - { - *ok = false; - } + if (pDCTSpec) + ippFree(pDCTSpec); - ippFree( pDCTSpec); CV_SUPPRESS_DEPRECATED_END } private: - const Mat& src; - Mat& dst; - const Dct& ippidct; + const Mat* src; + Mat* dst; + const Dct* ippidct; bool inv; bool *ok; - - const DctIPPLoop_Invoker& operator= (const DctIPPLoop_Invoker&); }; template bool DctIPPLoop(const Mat& src, Mat& dst, const Dct& ippidct, bool inv) { bool ok; - parallel_for_(Range(0, src.rows), DctIPPLoop_Invoker(src, dst, ippidct, inv, &ok), src.rows/(double)(1<<4) ); + parallel_for_(Range(0, src.rows), DctIPPLoop_Invoker(src, dst, &ippidct, inv, &ok), src.rows/(double)(1<<4) ); return ok; } @@ -2981,10 +2966,7 @@ static bool ippi_DCT_32f(const Mat& src, Mat& dst, bool inv, bool row) ippiDCTFunc ippFunc = inv ? (ippiDCTFunc)ippiDCTInv_32f_C1R : (ippiDCTFunc)ippiDCTFwd_32f_C1R ; if (row) - if(DctIPPLoop(src,dst,IPPDCTFunctor(ippFunc),inv)) - return true; - else - return false; + return(DctIPPLoop(src,dst,IPPDCTFunctor(ippFunc),inv)); else { IppStatus status; @@ -3001,27 +2983,19 @@ static bool ippi_DCT_32f(const Mat& src, Mat& dst, bool inv, bool row) ippiDCTFree ippFree = inv ? (ippiDCTFree)ippiDCTInvFree_32f : (ippiDCTFree)ippiDCTFwdFree_32f; ippiDCTGetBufSize ippGetBufSize = inv ? (ippiDCTGetBufSize)ippiDCTInvGetBufSize_32f : (ippiDCTGetBufSize)ippiDCTFwdGetBufSize_32f; - status = ippInitAlloc(&pDCTSpec, srcRoiSize, ippAlgHintNone); + status = ippStsErr; - if ( status < 0 ) + if (ippInitAlloc(&pDCTSpec, srcRoiSize, ippAlgHintNone)>=0 && ippGetBufSize(pDCTSpec, &bufSize)>=0) { - ippFree(pDCTSpec); - return false; - } + buf.allocate( bufSize ); + pBuffer = (uchar*)buf; - status = ippGetBufSize(pDCTSpec, &bufSize); - if ( status < 0 ) - { - ippFree(pDCTSpec); - return false; + status = ippFunc((float*)src.data, (int)src.step, (float*)dst.data, (int)dst.step, pDCTSpec, (Ipp8u*)pBuffer); } - buf.allocate( bufSize ); - pBuffer = (uchar*)buf; - - status = ippFunc((float*)src.data, (int)src.step, (float*)dst.data, (int)dst.step, pDCTSpec, (Ipp8u*)pBuffer); + if (pDCTSpec) + ippFree(pDCTSpec); - ippFree(pDCTSpec); CV_SUPPRESS_DEPRECATED_END return status >= 0;