Changeset 403 in flair-src


Ignore:
Timestamp:
Mar 23, 2021, 9:40:41 AM (4 years ago)
Author:
Sanahuja Guillaume
Message:

select user memory pointer (v4l) if using custom alloc function in images (ie if initdsp was called)

Location:
trunk/lib
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/Image.cpp

    r401 r403  
    8080}
    8181
     82bool Image::IsUsingDefaultAllocAndFree(void) {
     83    return (allocFunction==DefaultAllocFunction);
     84}
     85
    8286char* Image::DefaultAllocFunction(ssize_t size){
    8387  return (char*)malloc(size);
  • trunk/lib/FlairCore/src/Image.h

    r401 r403  
    111111  static void RegisterAllocFunction(char*(*func)(ssize_t size));
    112112  static void RegisterFreeFunction(void(*func)(char* buffer));
     113  static bool IsUsingDefaultAllocAndFree(void);
    113114  static char* AllocFunction(ssize_t size);
    114115  static void FreeFunction(char* buffer);
  • trunk/lib/FlairMeta/src/HdsX8.cpp

    r268 r403  
    5353                          Gx3_25_imu::AccelerationAngularRateAndOrientationMatrix, 70));
    5454  SetBatteryMonitor(((BlCtrlV2 *)GetBldc())->GetBatteryMonitor());
    55   SetVerticalCamera(new Ps3Eye("camv", 0, 50));
     55 
     56  if(Image::IsUsingDefaultAllocAndFree()) {
     57    SetVerticalCamera(new Ps3Eye("camv", 0, false,50));//no cmem and no dsp
     58  } else {
     59    SetVerticalCamera(new Ps3Eye("camv", 0, true,50));//cmem and dsp
     60  }
    5661 
    5762  string useGps=FindArgument(options,"use_gps=",false);
  • trunk/lib/FlairMeta/src/XAir.cpp

    r268 r403  
    5656  SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
    5757  GetBatteryMonitor()->SetBatteryValue(12);
    58   SetVerticalCamera(new Ps3Eye("camv", 0, 50));
     58 
     59  if(Image::IsUsingDefaultAllocAndFree()) {
     60    SetVerticalCamera(new Ps3Eye("camv", 0, false,50));//no cmem and no dsp
     61  } else {
     62    SetVerticalCamera(new Ps3Eye("camv", 0, true,50));//cmem and dsp
     63  }
    5964}
    6065
  • trunk/lib/FlairSensorActuator/src/Ps3Eye.cpp

    r338 r403  
    2525namespace sensor {
    2626
    27 Ps3Eye::Ps3Eye(string name, int camera_index,
     27Ps3Eye::Ps3Eye(string name, int camera_index,bool useMemoryUsrPtr,
    2828               uint8_t priority)
    2929    : V4LCamera( name, camera_index, 320, 240,
    30                 Image::Type::Format::YUYV, priority) {
     30                Image::Type::Format::YUYV, useMemoryUsrPtr,priority) {
    3131  SetIsReady(true);                 
    3232}
  • trunk/lib/FlairSensorActuator/src/Ps3Eye.h

    r137 r403  
    3333  * \param name name
    3434  * \param camera_index index of the camera, ie /dev/videox
     35  * \param useMemoryUsrPtr true to use memory user pointer (ex with cmem on omap3730), false to use mmap
    3536  * \param priority priority of the Thread
    3637  */
    3738  Ps3Eye(std::string name,
    38          int camera_index, uint8_t priority);
     39         int camera_index, bool useMemoryUsrPtr,uint8_t priority);
    3940
    4041  /*!
  • trunk/lib/FlairSensorActuator/src/V4LCamera.cpp

    r353 r403  
    2828 
    2929V4LCamera::V4LCamera(string name,uint8_t camera_index, uint16_t width, uint16_t height,
    30                      Image::Type::Format format, uint8_t priority)
     30                     Image::Type::Format format, bool useMemoryUsrPtr,uint8_t priority)
    3131    : Thread(getFrameworkManager(), name, priority),
    3232      Camera(name, width, height, format) {
    3333 
    34   pimpl_=new V4LCamera_impl(this,name,camera_index,width,height,format);
     34  pimpl_=new V4LCamera_impl(this,name,camera_index,width,height,format,useMemoryUsrPtr);
    3535}
    3636
  • trunk/lib/FlairSensorActuator/src/V4LCamera.h

    r352 r403  
    4545  * \param height height
    4646  * \param format image format
     47  * \param useMemoryUsrPtr true to use memory user pointer (ex with cmem on omap3730), false to use mmap
    4748  * \param priority priority of the Thread
    4849  */
    4950  V4LCamera(std::string name,
    5051            uint8_t camera_index, uint16_t width, uint16_t height,
    51             core::Image::Type::Format format, uint8_t priority);
     52            core::Image::Type::Format format, bool useMemoryUsrPtr,uint8_t priority);
    5253
    5354  /*!
  • trunk/lib/FlairSensorActuator/src/V4LCamera_impl.cpp

    r401 r403  
    3737 
    3838V4LCamera_impl::V4LCamera_impl(V4LCamera *self,string name,uint8_t camera_index, uint16_t width, uint16_t height,
    39                      Image::Type::Format format) {
     39                     Image::Type::Format format,bool useMemoryUsrPtr) {
    4040  this->self=self;
    4141 
     
    6060  }
    6161 
    62   //todo: better handling of detection, only neeeded for omap/dm
    63   //also in run, copy from v4l to cmem is not necessary if not using cmem...
    64 #ifdef ARMV7A
    65   useMemoryUsrPtr=true;
    66 #else
    67   useMemoryUsrPtr=false;
    68 #endif
     62  //todo: in run, copy from v4l to cmem is not necessary if not using cmem. (!useMemoryUsrPtr)
     63  this->useMemoryUsrPtr=useMemoryUsrPtr;
     64
    6965  if(useMemoryUsrPtr) {
    7066    AllocUserBuffers();
  • trunk/lib/FlairSensorActuator/src/unexported/V4LCamera_impl.h

    r352 r403  
    4848  * \param height height
    4949  * \param format image format
     50  * \param useMemoryUsrPtr true to use memory user pointer (ex with cmem on omap3730), false to use mmap
    5051  */
    5152  V4LCamera_impl(flair::sensor::V4LCamera *self,std::string name,
    5253            uint8_t camera_index, uint16_t width, uint16_t height,
    53             flair::core::Image::Type::Format format);
     54            flair::core::Image::Type::Format format,bool useMemoryUsrPtr);
    5455
    5556  /*!
Note: See TracChangeset for help on using the changeset viewer.