[Paraview] image bufferin ParaviewWeb

Sebastien Jourdain sebastien.jourdain at kitware.com
Thu Apr 28 10:46:47 EDT 2011


Hi Luigi,

the bug you are facing was a bug inside VTK that I fixed maybe just
after 3.10.0.
But you can patch your VTK, as it's a really small fix.

Seb

PS: I've paste the fix bellow

commit e938db39c2bbd730a060cb0cf95fec52e15d281a
Author: Sebastien Jourdain <sebastien.jourdain at kitware.com>
Date:   Mon Jun 28 13:15:10 2010 -0400

    BUG: Fix JPEG writer when writing in memory

diff --git a/IO/vtkJPEGWriter.cxx b/IO/vtkJPEGWriter.cxx
index 04fd1d9..dd933ec 100644
--- a/IO/vtkJPEGWriter.cxx
+++ b/IO/vtkJPEGWriter.cxx
@@ -129,7 +129,7 @@ void vtkJPEGWriter::Write()
   this->InternalFileName = NULL;
 }

-// these three routines are for wqriting into memory
+// these three routines are for writing into memory
 extern "C"
 {
   void vtkJPEGWriteToMemoryInit(j_compress_ptr cinfo)
@@ -157,16 +157,20 @@ extern "C"
 {
   boolean vtkJPEGWriteToMemoryEmpty(j_compress_ptr cinfo)
   {
+    // Even if (cinfo->dest->free_in_buffer != 0) we still need to write on the
+    // new array and not at (arraySize - nbFree)
     vtkJPEGWriter *self = vtkJPEGWriter::SafeDownCast(
       static_cast<vtkObject *>(cinfo->client_data));
     if (self)
       {
       vtkUnsignedCharArray *uc = self->GetResult();
-      // we must grow the array, we grow by 50% each time
+      // we must grow the array
       int oldSize = uc->GetSize();
-      uc->Resize(oldSize + oldSize/2);
+      uc->Resize(oldSize*1.5);
+      // Resize do grow the array but it is not the size we expect
+      int newSize = uc->GetSize();
       cinfo->dest->next_output_byte = uc->GetPointer(oldSize);
-      cinfo->dest->free_in_buffer = oldSize/2;
+      cinfo->dest->free_in_buffer = newSize - oldSize;
       }
     return TRUE;
   }
@@ -182,8 +186,8 @@ extern "C"
       {
       vtkUnsignedCharArray *uc = self->GetResult();
       // we must close the array
-      vtkIdType oldSize = uc->GetSize();
-      uc->SetNumberOfTuples(oldSize -
static_cast<vtkIdType>(cinfo->dest->free_in_buffer));
+      int realSize = uc->GetSize() - cinfo->dest->free_in_buffer;
+      uc->SetNumberOfTuples(realSize);
       }
   }
 }



On Thu, Apr 28, 2011 at 10:18 AM, Luigi Calori <l.calori at cineca.it> wrote:
> Hi everybody,
> I recently somehow suceeded in compiling and installing paraview+paraviewweb
> components.
> It was just after  3.10, so I used 3.10.0 and had some problems...
> expecially as the suggested dep ActiveMQ is just available
> in release 3.2.5 and the suggested 3.1.x seems unavailable.
> I' m currently experiencing problems of image corruprion when the frame
> buffer size is somehow greater than 200x200
> with the Space shuttle demo the image is ok while interactively moving the
> viewpoint and go bad when he interaction stops and the res goes up.
> (the corruption seems happen in the middle of the image, as if some extra
> stuff get somehow inserted in between
>
> Any suggestion on what to search and how to debug really welcome.
>
> In the meantime, I' ll proceed to a new re-build of the whole beast, hints
> and successful recipes equally really welcome
>
> Thanks in advance and compliments for the sw
>
> Regards
>                Luigi
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list