[Jdlraw-discussion] jdlRaw/Sources jdlDcRaw.cpp, 1.17, 1.18 jdlDcRaw.h, 1.11, 1.12 jdlDcbDemosaicin
Status: Beta
Brought to you by:
jdla
|
From: Jos De L. <jd...@us...> - 2010-05-02 10:14:10
|
Update of /cvsroot/jdlraw/jdlRaw/Sources In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv28414/Sources Modified Files: jdlDcRaw.cpp jdlDcRaw.h jdlDcbDemosaicing.i Log Message: *) OMP on/off by user now on all of the interpolation algorithms. Some DCB code cleanup. Index: jdlDcRaw.h =================================================================== RCS file: /cvsroot/jdlraw/jdlRaw/Sources/jdlDcRaw.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** jdlDcRaw.h 1 May 2010 07:38:25 -0000 1.11 --- jdlDcRaw.h 2 May 2010 10:14:02 -0000 1.12 *************** *** 699,703 **** void rgb_to_lch(double (*)[3]); void lch_to_rgb(double (*)[3]); - void fbdd_green2(); void fbdd_correction(); void fbdd_correction2(double (*)[3]); --- 699,702 ---- Index: jdlDcRaw.cpp =================================================================== RCS file: /cvsroot/jdlraw/jdlRaw/Sources/jdlDcRaw.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** jdlDcRaw.cpp 1 May 2010 07:38:24 -0000 1.17 --- jdlDcRaw.cpp 2 May 2010 10:14:02 -0000 1.18 *************** *** 4467,4475 **** } - // OMP on/off via user - #ifdef _OPENMP - omp_set_num_threads(m_UserSetting_InterpolationOMP ? omp_get_max_threads():1); - #endif - // Some helping variables that are needed in OMP case. // But they are not sitting in the way for the non OMP case. --- 4467,4470 ---- *************** *** 8719,8725 **** TRACEKEYVALS("Colors","%d",m_Colors); PreInterpolate(); ! if (m_Stop) return 0; TRACEKEYVALS("Colors","%d",m_Colors); --- 8714,8731 ---- TRACEKEYVALS("Colors","%d",m_Colors); + // OMP on/off via user + #ifdef _OPENMP + omp_set_num_threads(m_UserSetting_InterpolationOMP ? omp_get_max_threads():1); + #endif + PreInterpolate(); ! if (m_Stop) { ! // 'Restore' OMP ! #ifdef _OPENMP ! omp_set_num_threads(omp_get_max_threads()); ! #endif ! return 0; ! } TRACEKEYVALS("Colors","%d",m_Colors); *************** *** 8749,8752 **** --- 8755,8763 ---- } + // 'Restore' OMP + #ifdef _OPENMP + omp_set_num_threads(omp_get_max_threads()); + #endif + if (m_Stop) return 0; Index: jdlDcbDemosaicing.i =================================================================== RCS file: /cvsroot/jdlraw/jdlRaw/Sources/jdlDcbDemosaicing.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** jdlDcbDemosaicing.i 27 Apr 2010 17:30:35 -0000 1.2 --- jdlDcbDemosaicing.i 2 May 2010 10:14:02 -0000 1.3 *************** *** 1183,1280 **** } - // fast green interpolation - void CLASS fbdd_green2() { - - const uint16_t c_DetailBorder = 6; - - #ifdef DCB_WORK_ON_COPY - const uint32_t Size = m_Width*m_Height; - // We need to work on a copy to avoid processing order dependency. - uint16_t (*TmpImage)[4]; - TmpImage = (uint16_t (*)[4]) CALLOC(Size,sizeof *TmpImage); - merror(TmpImage, __PRETTY_FUNCTION__); - memcpy(TmpImage,m_Image,Size*sizeof *m_Image); - #endif - - // We allocate with dynamic schedule as the "Detail" view can - // stop very early many of the rows/cols. So the chunks are - // very inequal in workload. - // The chunk size is introduced as to avoid too small fractions. - #ifdef DCB_ENABLE_OMP - #pragma omp parallel for default(shared) schedule(dynamic,m_Height/16) - #endif - for (uint16_t Row=4; Row < m_Height-4; Row++) { - - if (m_Stop) { - // OpenMP cannot exit, but continue will go fast now :) - continue; - } - - if (m_UserSetting_Detail && - (Row + c_DetailBorder < m_UserSetting_DetailRowStart || - Row > m_UserSetting_DetailRowEnd + c_DetailBorder) ) { - continue; - } - - uint32_t Offset = Row * m_Width; - - for (uint16_t Col=4; Col < m_Width-4; Col++) { - - if (m_UserSetting_Detail && - (Col + c_DetailBorder < m_UserSetting_DetailColStart || - Col > m_UserSetting_DetailColEnd + c_DetailBorder) ) { - continue; - } - - uint32_t Idx = Offset + Col; - - short c = fc(Row,Col); - if(c != 1) { - int32_t current = m_Image[Idx][c] - (m_Image[Idx+2*m_Width][c] + - m_Image[Idx-2*m_Width][c] + - m_Image[Idx-2][c] + - m_Image[Idx+2][c])/4; - - int32_t g2 = (m_Image[Idx+m_Width][1] + - m_Image[Idx-m_Width][1] + - m_Image[Idx-1][1] + - m_Image[Idx+1][1])/4; - int32_t g1 = (m_Image[Idx+3*m_Width][1] + - m_Image[Idx-3*m_Width][1] + - m_Image[Idx-3][1] + - m_Image[Idx+3][1])/4; - - #ifdef DCB_WORK_ON_COPY - TmpImage[Idx][1] = CLIP((g2+g1)/2.0 + current); - #else - m_Image[Idx][1] = CLIP((g2+g1)/2.0 + current); - #endif - - uint16_t min = MIN(m_Image[Idx-1][1], - MIN(m_Image[Idx+1][1], - MIN(m_Image[Idx-m_Width][1], - m_Image[Idx+m_Width][1]))); - - uint16_t max = MAX(m_Image[Idx-1][1], - MAX(m_Image[Idx+1][1], - MAX(m_Image[Idx-m_Width][1], - m_Image[Idx+m_Width][1]))); - - #ifdef DCB_WORK_ON_COPY - TmpImage[Idx][1] = ULIM(m_Image[Idx][1], max, min); - #else - m_Image[Idx][1] = ULIM(m_Image[Idx][1], max, min); - #endif - - } - } - } - #ifdef DCB_WORK_ON_COPY - // Copy back TmpImage - memcpy(m_Image,TmpImage,Size*sizeof *m_Image); - FREE(TmpImage); - #endif - } - // denoising using interpolated neighbours void CLASS fbdd_correction() { --- 1183,1186 ---- *************** *** 1784,1787 **** --- 1690,1695 ---- fbdd_correction(); } + + FREE(fImage3); } |