Skip to content

Commit

Permalink
[video_thread] simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter committed Sep 3, 2015
1 parent 16bbf7d commit acffa67
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 38 deletions.
20 changes: 9 additions & 11 deletions sw/airborne/modules/computer_vision/cv.c
Expand Up @@ -20,7 +20,7 @@
*/

/**
* @file modules/computer_vision/cv.h
* @file modules/computer_vision/cv.c
*
* Computer vision framework for onboard processing
*/
Expand All @@ -34,17 +34,15 @@ cvFunction cv_func[MAX_CV_FUNC];

void cv_add(cvFunction func)
{
if (cv_func_cnt < (MAX_CV_FUNC-1))
{
cv_func[cv_func_cnt] = func;
cv_func_cnt++;
}
if (cv_func_cnt < (MAX_CV_FUNC - 1)) {
cv_func[cv_func_cnt] = func;
cv_func_cnt++;
}
}

void cv_run(struct image_t* img)
void cv_run(struct image_t *img)
{
for (int i=0;i<cv_func_cnt;i++)
{
cv_func[i](img);
}
for (int i = 0; i < cv_func_cnt; i++) {
cv_func[i](img);
}
}
4 changes: 2 additions & 2 deletions sw/airborne/modules/computer_vision/cv.h
Expand Up @@ -32,9 +32,9 @@
#include "std.h"
#include "lib/vision/image.h"

typedef bool_t (*cvFunction)(struct image_t* img);
typedef bool_t (*cvFunction)(struct image_t *img);

extern void cv_add(cvFunction func);
extern void cv_run(struct image_t* img);
extern void cv_run(struct image_t *img);

#endif /* CV_H_ */
40 changes: 20 additions & 20 deletions sw/airborne/modules/computer_vision/video_thread.c
@@ -1,23 +1,23 @@
/*
* Copyright (C) 2015
*
* This file is part of Paparazzi.
*
* Paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
/*
* Copyright (C) 2015
*
* This file is part of Paparazzi.
*
* Paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/

/**
* @file modules/computer_vision/video_thread.c
Expand Down
10 changes: 5 additions & 5 deletions sw/airborne/modules/computer_vision/viewvideo.c
Expand Up @@ -99,8 +99,8 @@ struct viewvideo_t viewvideo = {
* This is a sepereate thread, so it needs to be thread safe!
*/
struct UdpSocket video_sock;
bool_t viewvideo_function(struct image_t* img);
bool_t viewvideo_function(struct image_t* img)
bool_t viewvideo_function(struct image_t *img);
bool_t viewvideo_function(struct image_t *img)
{
// Resize image if needed
struct image_t img_small;
Expand Down Expand Up @@ -187,13 +187,13 @@ bool_t viewvideo_function(struct image_t* img)
*/
void viewvideo_init(void)
{
char save_name[512];
char save_name[512];
// struct UdpSocket video_sock;
udp_socket_create(&video_sock, STRINGIFY(VIEWVIDEO_HOST), VIEWVIDEO_PORT_OUT, -1, VIEWVIDEO_BROADCAST);

cv_add(viewvideo_function);
cv_add(viewvideo_function);

viewvideo.is_streaming = TRUE;
viewvideo.is_streaming = TRUE;

#if VIEWVIDEO_USE_NETCAT
// Create an Netcat receiver file for the streaming
Expand Down

0 comments on commit acffa67

Please sign in to comment.