Commit Graph

13 Commits

Author SHA1 Message Date
mirkix 9e1345453f AP_HAL_Linux: BBBmini remove onboard OpticalFlow 2017-03-07 22:48:48 -08:00
Lucas De Marchi 490841a814 AP_HAL_Linux: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
mirkix 5b8de06beb AP_HAL_Linux: Enable optical flow onboard for BBBMINI 2016-02-08 08:52:10 -02:00
Ricardo de Almeida Gonzaga 4c60dd5e44 AP_HAL_Linux: improve yuyv_to_grey() performance
Based on gbenchmark metrics.

Before:
Benchmark             Time(ns)    CPU(ns) Iterations
----------------------------------------------------
BM_YuyvToGrey/4k          3109       3114     233334
BM_YuyvToGrey/75k        55777      55857      12353
BM_YuyvToGrey/300k      231829     232227       3043

After:
Benchmark             Time(ns)    CPU(ns) Iterations
----------------------------------------------------
BM_YuyvToGrey/4k          1713       1716     411765
BM_YuyvToGrey/75k        32124      32152      21875
BM_YuyvToGrey/300k      128530     128753       5385
2016-01-15 16:43:52 -02:00
Ricardo de Almeida Gonzaga 3748760ead AP_HAL_Linux: improve crop_8bpp() performance
Based on gbenchmark metrics.

Before:
Benchmark             Time(ns)    CPU(ns) Iterations
----------------------------------------------------
BM_Crop8bpp/64/64         3206       3197     198113
BM_Crop8bpp/240/240      38166      38181      18421
BM_Crop8bpp/640/480     193589     193317       3621

After:
Benchmark             Time(ns)    CPU(ns) Iterations
----------------------------------------------------
BM_Crop8bpp/64/64         2652       2657     232103
BM_Crop8bpp/240/240      33532      33506      20792
BM_Crop8bpp/640/480     187848     188201       3684
2016-01-15 16:43:52 -02:00
Ricardo de Almeida Gonzaga 553d36c860 AP_HAL_Linux: add shrink_8bpp() to VideoIn
This function shrinks a selected area on a 8bpp image.

The focus in this function was the performance, so this may not be the
clearer or the most understandable way to write it. The performance
was measured using GoogleBenchmark[1].

[1] - https://github.com/google/benchmark.git
2016-01-15 16:05:47 -02:00
Ricardo de Almeida Gonzaga 7adbccac9a AP_HAL_Linux: add support for OpticalFlow to MinnowBoardMax
This commit adds support for OpticalFlow to MinnowBoardMax trying to
leave the OpticalFlow implementation as generic as it already is.

We had to add some format conversion and software crop to the cameras that
do not have this features.
2016-01-11 15:31:27 -02:00
Ricardo de Almeida Gonzaga 8aded390e7 AP_HAL_Linux: add yuyv_to_grey() and crop_8bpp() to VideoIn
Most cameras do not support NV12 or GREY formats, we are adding in this commit
a conversion from YUYV format, that seems pretty common in cameras, to GREY
format (since we do not use Cb and Cr data on OpticalFlow).

Also we are adding a software crop for 8bpp images, such as GREY format. For
the same reason, most cameras do not have support for overlaying (crop, resize
and so on).

These functions are being added in order to be used in the next commits,
where we will add support for OpticalFlow on MinnowBoardMax.
2016-01-11 15:31:27 -02:00
Ricardo de Almeida Gonzaga 27f909319e AP_HAL_Linux: add get_pixel_formats() to VideoIn
This function is being added in order to be used in the next commits,
where we will add support for OpticalFlow on MinnowBoardMax.
2016-01-11 15:31:26 -02:00
Lucas De Marchi 2a953c4e35 AP_HAL_Linux: add missing casts
These errors were all over the VideoIn.cpp file:

libraries/AP_HAL_Linux/VideoIn.cpp: In member function 'bool Linux::VideoIn::allocate_buffers(uint32_t)':
libraries/AP_HAL_Linux/VideoIn.cpp:107:15: error: invalid conversion from 'uint32_t {aka unsigned int}' to 'v4l2_memory' [-fpermissive]
     rb.memory = _memtype;
               ^
libraries/AP_HAL_Linux/VideoIn.cpp: In member function 'bool Linux::VideoIn::set_format(uint32_t*, uint32_t*, uint32_t*, uint32_t*, uint32_t*)':
libraries/AP_HAL_Linux/VideoIn.cpp:169:14: error: invalid conversion from 'int' to 'v4l2_buf_type' [-fpermissive]
     fmt.type = V4L2_CAP_VIDEO_CAPTURE;
              ^

Add proper casts to fix the compilation.
2015-12-18 17:56:06 +11:00
Lucas De Marchi c75704bde3 AP_HAL_Linux: VideoIn: follow coding style and minor fixes
- No need to if/else if just returning
 - Sort includes
 - Fix missing space in log message
 - When closing the fd, set it to -1. It's better to later fail the
   operation than to operate on another random file descriptor
 - Add some spaces to improve readability
 - Use pragma once
 - Do not initialize members to zero, it's already the behavior for our
   custom allocator
2015-12-18 17:56:05 +11:00
Julien BERAUD 25df4d03ff AP_HAL_Linux: Add support for Video Input
VideoIn class is created that allows to setup a v4l2 interface
and capture buffers. I is based on yavta utility by Laurent Pinchart
and has been tested only on the bebop, though yavta works on any linux
platform.
2015-12-18 17:56:04 +11:00