Index: branches/sanscv/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp
===================================================================
--- branches/sanscv/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp	(revision 327)
+++ branches/sanscv/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp	(revision 328)
@@ -114,5 +114,5 @@
 }
 
-void DemoOpticalFlow::SignalEvent(Event_t event) {
+void DemoOpticalFlow::SignalEvent(Event_t event) {/*
     UavStateMachine::SignalEvent(event);
     switch(event) {
@@ -129,5 +129,5 @@
         opticalFlowRealAcceleration->SetValue(1,0,opticalFlowAcceleration->Output(1,0)*scale);
         break;
-    }
+    }*/
 }
 
Index: branches/sanscv/lib/FlairSensorActuator/src/Camera.cpp
===================================================================
--- branches/sanscv/lib/FlairSensorActuator/src/Camera.cpp	(revision 327)
+++ branches/sanscv/lib/FlairSensorActuator/src/Camera.cpp	(revision 328)
@@ -24,5 +24,5 @@
 #include <DataPlot1D.h>
 #include <Picture.h>
-#include <VisionFilter.h>
+//#include <VisionFilter.h>
 #include <fstream>
 
Index: branches/sanscv/lib/FlairSensorActuator/src/V4LCamera.cpp
===================================================================
--- branches/sanscv/lib/FlairSensorActuator/src/V4LCamera.cpp	(revision 327)
+++ branches/sanscv/lib/FlairSensorActuator/src/V4LCamera.cpp	(revision 328)
@@ -29,4 +29,5 @@
 #include <cstring>
 #include <sys/mman.h>
+#include <VisionFilter.h>
 
 #define DEFAULT_V4L_BUFFERS 4
@@ -104,4 +105,8 @@
         QueueBuffer(bufferIndex);
     }
+    
+    //alloc img buf
+    Printf("TODO: alloc bufs in cmem and uses it for v4l\n");
+    output->buffer=AllocFunction(width*height*2);
     
     // enable the streaming
@@ -133,4 +138,5 @@
 
 V4LCamera::~V4LCamera() {
+    FreeFunction(output->buffer);
     SafeStop();
     Join();
@@ -139,5 +145,4 @@
 void V4LCamera::Run(void) {
   Time cam_time, new_time, fpsNow, fpsPrev;
-  char* buffer; // raw image
   int fpsCounter = 0;
 
@@ -215,7 +220,7 @@
       hasProblems=true;
     }
-Printf("todo allocate 1 frame and copy here\n");
+//Printf("todo allocate 1 frame and copy here\n");
     output->GetMutex();
-    output->buffer = buffer;
+    memcpy(output->buffer,buffers[bufferIndex].start,buffers[bufferIndex].length);
     output->ReleaseMutex();
 
@@ -280,5 +285,5 @@
         //Printf("%lld ioctl\n",GetTimeMS());
         if (xioctl (device, VIDIOC_DQBUF, &buf)==-1) {
-           // Printf("iter %i err %i\n",i,errno);
+            //Printf("iter %i err %i\n",i,errno);
             if (errno==EAGAIN) {
                 //Printf("exit buf %i\n",buf.index);
@@ -362,5 +367,5 @@
                MAP_SHARED /* recommended */,
                device, buf.m.offset);
-Printf("buffer %i start %x length %i\n",n_buffers,buffers[n_buffers].start,buffers[n_buffers].length);
+//Printf("buffer %i start %x length %i\n",n_buffers,buffers[n_buffers].start,buffers[n_buffers].length);
        if (MAP_FAILED == buffers[n_buffers].start) {
            Thread::Err("mmap\n");
@@ -369,5 +374,5 @@
    }
    nbBuffers=requestbuffers.count;
-Printf("allocated %i buffers\n",nbBuffers);
+//Printf("allocated %i buffers\n",nbBuffers);
    return 1;
 };
Index: branches/sanscv/lib/FlairVisionFilter/src/CvtColor.cpp
===================================================================
--- branches/sanscv/lib/FlairVisionFilter/src/CvtColor.cpp	(revision 327)
+++ branches/sanscv/lib/FlairVisionFilter/src/CvtColor.cpp	(revision 328)
@@ -55,4 +55,5 @@
             inIplImage->height=img->GetDataType().GetHeight();
             inIplImage->imageData=img->buffer;
+            inIplImage->imageSize=img->GetDataType().GetSize();
             */
             output->GetMutex();/*
@@ -60,4 +61,5 @@
             outIplImage->height=output->GetDataType().GetHeight();
             outIplImage->imageData=output->buffer;
+            outIplImage->imageSize=output->GetDataType().GetSize();
 */
             switch(conversion) {
Index: branches/sanscv/lib/FlairVisionFilter/src/HoughLines.cpp
===================================================================
--- branches/sanscv/lib/FlairVisionFilter/src/HoughLines.cpp	(revision 327)
+++ branches/sanscv/lib/FlairVisionFilter/src/HoughLines.cpp	(revision 328)
@@ -20,5 +20,5 @@
 #include <GroupBox.h>
 #include <SpinBox.h>
-#include <DoubleSpinBox.h>>
+#include <DoubleSpinBox.h>
 #include <typeinfo>
 #include <math.h>
@@ -88,4 +88,5 @@
         gimg->height=img->GetDataType().GetHeight();
         gimg->imageData=img->buffer;
+        gimg->imageSize=img->GetDataType().GetSize();
     
         size_t nbLines;
Index: branches/sanscv/lib/FlairVisionFilter/src/ImgThreshold.cpp
===================================================================
--- branches/sanscv/lib/FlairVisionFilter/src/ImgThreshold.cpp	(revision 327)
+++ branches/sanscv/lib/FlairVisionFilter/src/ImgThreshold.cpp	(revision 328)
@@ -61,4 +61,5 @@
         inIplImage->height=img->GetDataType().GetHeight();
         inIplImage->imageData=img->buffer;
+        inIplImage->imageSize=img->GetDataType().GetSize();
         
         output->GetMutex();
@@ -66,4 +67,5 @@
         outIplImage->height=output->GetDataType().GetHeight();
         outIplImage->imageData=output->buffer;
+        outIplImage->imageSize=output->GetDataType().GetSize();
                 
         dspThreshold(inIplImage,outIplImage, threshold->Value(), 255, CV_THRESH_BINARY);
Index: branches/sanscv/lib/FlairVisionFilter/src/OpticalFlow.cpp
===================================================================
--- branches/sanscv/lib/FlairVisionFilter/src/OpticalFlow.cpp	(revision 327)
+++ branches/sanscv/lib/FlairVisionFilter/src/OpticalFlow.cpp	(revision 328)
@@ -58,6 +58,13 @@
             iplpyr->width=imageType.GetWidth();
             iplpyr->height=imageType.GetHeight();
+            iplpyr->imageSize=imageType.GetSize();
             iplpyr_old->width=imageType.GetWidth();
             iplpyr_old->height=imageType.GetHeight();
+            iplpyr_old->imageSize=imageType.GetSize();
+            
+            iplgimg->roi=NULL;
+            iplgimg_old->roi=NULL;
+            iplpyr->roi=NULL;
+            iplpyr_old->roi=NULL;
 */  
       } catch(std::bad_cast& bc) {
@@ -89,8 +96,10 @@
         iplgimg->height=img->GetDataType().GetHeight();
         iplgimg->imageData=img->buffer;
+        iplgimg->imageSize=img->GetDataType().GetSize();
         
         iplgimg_old->width=img_old->GetDataType().GetWidth();
         iplgimg_old->height=img_old->GetDataType().GetHeight();
         iplgimg_old->imageData=img_old->buffer;
+        iplgimg_old->imageSize=img_old->GetDataType().GetSize();
         
         iplpyr->imageData=pyr->buffer;
Index: branches/sanscv/lib/FlairVisionFilter/src/Sobel.cpp
===================================================================
--- branches/sanscv/lib/FlairVisionFilter/src/Sobel.cpp	(revision 327)
+++ branches/sanscv/lib/FlairVisionFilter/src/Sobel.cpp	(revision 328)
@@ -62,4 +62,5 @@
         inIplImage->height=image->GetDataType().GetHeight();
         inIplImage->imageData=image->buffer;
+        inIplImage->imageSize=image->GetDataType().GetSize();
         
         output->GetMutex();
@@ -67,4 +68,5 @@
         outIplImage->height=output->GetDataType().GetHeight();
         outIplImage->imageData=output->buffer;
+        outIplImage->imageSize=output->GetDataType().GetSize();
                 
         dspSobel(inIplImage,outIplImage,dx->Value(),dy->Value());
Index: branches/sanscv/lib/FlairVisionFilter/src/VisionFilter.cpp
===================================================================
--- branches/sanscv/lib/FlairVisionFilter/src/VisionFilter.cpp	(revision 327)
+++ branches/sanscv/lib/FlairVisionFilter/src/VisionFilter.cpp	(revision 328)
@@ -21,2 +21,10 @@
   
 }
+
+char* AllocFunction(ssize_t size) {
+    return (char*)malloc(size);
+}
+
+void FreeFunction(char* buffer) {
+    free(buffer);
+}
Index: branches/sanscv/lib/FlairVisionFilter/src/VisionFilter.h
===================================================================
--- branches/sanscv/lib/FlairVisionFilter/src/VisionFilter.h	(revision 327)
+++ branches/sanscv/lib/FlairVisionFilter/src/VisionFilter.h	(revision 328)
@@ -26,2 +26,6 @@
 								
 void saveToJpeg(flair::core::Image* src_img,std::string filename,PictureFormat_t input_format,PictureFormat_t output_format,unsigned char compression_level=95);
+
+//for amrv7a, these functions use CMEM
+char* AllocFunction(ssize_t size);
+void FreeFunction(char* buffer);
