Author: post
Date: 2009-07-07 17:52:57 +0200 (Tue, 07 Jul 2009)
New Revision: 2572

Modified:
   trunk/plugins/denoise/fftdenoiseryuv.cpp
   trunk/plugins/denoise/floatplanarimage.cpp
   trunk/plugins/denoise/jobqueue.cpp
Log:
Denoise: Check if pixelsize != 4 in YUV to RGB, and fall back to C-routine. 
(Avoids crashing)

Modified: trunk/plugins/denoise/fftdenoiseryuv.cpp
===================================================================
--- trunk/plugins/denoise/fftdenoiseryuv.cpp    2009-07-07 14:42:24 UTC (rev 
2571)
+++ trunk/plugins/denoise/fftdenoiseryuv.cpp    2009-07-07 15:52:57 UTC (rev 
2572)
@@ -40,7 +40,7 @@
   if ((image->w < FFT_BLOCK_SIZE) || (image->h < FFT_BLOCK_SIZE))
      return;   // Image too small to denoise
 
-  if (image->channels != 3 && image->filters==0)
+  if (image->channels != 3 || image->filters!=0)
      return;   // No conversion possible with this image
 
   waitForJobs(img.getUnpackInterleavedYUVJobs(image));

Modified: trunk/plugins/denoise/floatplanarimage.cpp
===================================================================
--- trunk/plugins/denoise/floatplanarimage.cpp  2009-07-07 14:42:24 UTC (rev 
2571)
+++ trunk/plugins/denoise/floatplanarimage.cpp  2009-07-07 15:52:57 UTC (rev 
2572)
@@ -24,7 +24,7 @@
 FloatPlanarImage::FloatPlanarImage(void) {
   p = 0;
   redCorrection = blueCorrection = 1.0f;
-
+  nPlanes = 0;
 }
 
 FloatPlanarImage::FloatPlanarImage( const FloatPlanarImage &img )
@@ -53,6 +53,8 @@
     delete[] p;
     p = 0;
   }
+  p = 0;
+  nPlanes = 0;
 }
 
 void FloatPlanarImage::allocate_planes() {
@@ -215,14 +217,14 @@
   RS_IMAGE16* image = j->rs;
   guint cpu = rs_detect_cpu_features();
 #if defined (__x86_64__)
-  if (cpu & RS_CPU_FLAG_SSE4_1)  {
+  if ((image->pixelsize == 4) && (cpu & RS_CPU_FLAG_SSE4_1))  {
     // TODO: Test on SSE4 capable machine before enabling.
 //    packInterleavedYUV_SSE4(j);
 //    return;
   }
 #endif
 #if defined (__i386__) || defined (__x86_64__)
-  if (cpu & RS_CPU_FLAG_SSE2)  {
+  if ((image->pixelsize == 4) && (cpu & RS_CPU_FLAG_SSE2))  {
     packInterleavedYUV_SSE2(j);
     return;
   }

Modified: trunk/plugins/denoise/jobqueue.cpp
===================================================================
--- trunk/plugins/denoise/jobqueue.cpp  2009-07-07 14:42:24 UTC (rev 2571)
+++ trunk/plugins/denoise/jobqueue.cpp  2009-07-07 15:52:57 UTC (rev 2572)
@@ -76,6 +76,7 @@
     pthread_mutex_unlock(&job_mutex);
     return j;
   }
+  // Ensure that we get at least 1 job, otherwise respect percentage
   int n = MAX(1, percent * jobs.size() / 100);
   for (int i = 0; i < n; i++) {
     j.push_back(jobs[0]);


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to