Commit 6348daff authored by Jakob Bornecrantz's avatar Jakob Bornecrantz
Browse files

d/mt: Some warning fixes

parent ffd1b373
......@@ -90,6 +90,7 @@ fs_frame_size_in_bytes(struct fs_frame* f)
case FS_FORMAT_JPG:
// this is a maximum (assuming YUV444)
frame_bytes = f->width * f->height * 3;
break;
case FS_FORMAT_RAW:
case FS_FORMAT_NONE:
default: printf("cannot compute frame size for this format\n");
......
......@@ -36,12 +36,14 @@ enum fs_frame_format
FS_FORMAT_YUV420_UINT8,
FS_FORMAT_JPG
};
enum fs_stereo_format
{
FS_STEREO_NONE,
FS_STEREO_SBS,
FS_STEREO_OAU
};
enum fs_plane
{
FS_PLANE_NONE,
......@@ -52,17 +54,20 @@ enum fs_plane
FS_PLANE_U,
FS_PLANE_V
};
enum fs_chroma_sampling
{
FS_CHROMA_SAMP_NONE,
FS_CHROMA_SAMP_444,
FS_CHROMA_SAMP_422,
FS_CHROMA_SAMP_411
};
}
;
enum fs_plane_layout
{
FS_PLANE_LAYOUT_COMPOSITE,
FS_PLANE_LAYOUT_SEPARATE
};
enum fs_sampling
{
......
......@@ -80,8 +80,8 @@ v4l2_frameserver_enumerate_sources(struct frameserver* inst,
// struct v4l2_frameserver* internal = v4l2_frameserver(inst);
struct v4l2_source_descriptor* sources =
(struct v4l2_source_descriptor*)sources_generic;
char device_files[64][256]; // max of 64 video4linux devices supported
// TODO: maybe 256 too small
char device_files[64][512]; // max of 64 video4linux devices supported
// TODO: maybe 512 too small
char* base_path =
"/dev/v4l/by-id"; // TODO: does this path work everywhere?
DIR* dir;
......@@ -97,9 +97,9 @@ v4l2_frameserver_enumerate_sources(struct frameserver* inst,
while ((dentry = readdir(dir)) != NULL) {
if (strcmp(dentry->d_name, ".") != 0 &&
strcmp(dentry->d_name, "..") != 0) {
snprintf(device_files[device_count], 256, "%s/%s",
snprintf(device_files[device_count], 512, "%s/%s",
base_path,
dentry->d_name); // TODO: hardcoded 256
dentry->d_name); // TODO: hardcoded 512
device_count++;
}
}
......@@ -325,7 +325,7 @@ v4l2_frameserver_stream_run(void* ptr)
// Silence valgrind.
memset(mem[i], 0, v_buf.length);
v_buf.m.userptr = mem[i];
v_buf.m.userptr = (intptr_t)mem[i];
} else {
mem[i] = mmap(0, v_buf.length, PROT_READ, MAP_SHARED,
fd, v_buf.m.offset);
......@@ -348,8 +348,8 @@ v4l2_frameserver_stream_run(void* ptr)
}
uint8_t* cropped_buffer = NULL;
struct fs_frame f =
{}; // we dequeue buffers into this frame in our main loop
struct fs_frame f = {0};
// we dequeue buffers into this frame in our main loop
if (internal->source_descriptor.crop_scanline_bytes_start > 0) {
uint32_t alloc_size = internal->source_descriptor.crop_width *
internal->source_descriptor.height *
......@@ -646,7 +646,7 @@ v4l2_frameserver_get_source_descriptors(struct v4l2_source_descriptor** sds,
uint32_t sd_count = 0;
struct v4l2_capability cap;
struct v4l2_format fmt;
// struct v4l2_format fmt;
// open the device, and check if is a video source
int fd = open(v4l2_device, O_RDWR, 0);
......@@ -891,16 +891,16 @@ source_descriptor_from_v4l2(struct v4l2_source_descriptor* descriptor,
strncpy(descriptor->device_path, v4l2_device,
256); // TODO: hardcoded 256
descriptor->device_path[255] = 0x0; // TODO: hardcoded 256
strncpy(descriptor->name, cap->driver, 32);
strncpy(descriptor->name, (char*)cap->driver, 32);
descriptor->name[127] = 0x0;
strncpy(descriptor->model, cap->card, 32);
strncpy(descriptor->model, (char*)cap->card, 32);
descriptor->model[127] = 0x0;
descriptor->stream_format = desc->pixelformat;
descriptor->crop_scanline_bytes_start = 0;
// special-case the PS4 Eye camera - need to crop the main stereo image
// out of the composite (header+audio + main + interlaced) frame the
// driver produces
if (strcmp(cap->card, "USB Camera-OV580: USB Camera-OV") == 0) {
if (strcmp((char*)cap->card, "USB Camera-OV580: USB Camera-OV") == 0) {
descriptor->crop_scanline_bytes_start = 96;
descriptor->crop_width = 2560; // assume highest res
if (descriptor->width < 900) {
......
......@@ -7,8 +7,8 @@
#define NUM_LEDS 9
static const char* LED_LABELS[] = {"LU", "RU", "C", "LL", "RL",
"LS", "RS", "LB", "RB"};
static XRT_MAYBE_UNUSED const char* LED_LABELS[] = {
"LU", "RU", "C", "LL", "RL", "LS", "RS", "LB", "RB"};
#ifdef __cplusplus
extern "C" {
......
......@@ -188,6 +188,8 @@ tracker3D_sphere_mono_track(tracker_instance_t* inst)
internal->sbd->detect(internal->frame_gray, internal->keypoints,
internal->mask_gray);
bool ret = cv::imwrite("/tmp/out.jpg", internal->frame_gray);
(void)ret;
// ret = cv::imwrite("/tmp/mask.jpg",internal->mask_gray);
cv::KeyPoint blob;
......@@ -263,6 +265,7 @@ tracker3D_sphere_mono_calibrate(tracker_instance_t* inst)
internal->frame_gray.rows);
bool ret = cv::imwrite("/tmp/out.jpg", internal->frame_gray);
(void)ret;
// TODO: use multiple env vars? - centralise this
......@@ -308,7 +311,7 @@ tracker3D_sphere_mono_calibrate(tracker_instance_t* inst)
cv::Size board_size(8, 6);
std::vector<cv::Point3f> chessboard_model;
for (uint32_t i = 0; i < board_size.width * board_size.height; i++) {
for (int i = 0; i < board_size.width * board_size.height; i++) {
cv::Point3f p(i / board_size.width, i % board_size.width, 0.0f);
chessboard_model.push_back(p);
}
......@@ -355,6 +358,7 @@ tracker3D_sphere_mono_calibrate(tracker_instance_t* inst)
internal->chessboards_measured, image_size,
internal->intrinsics, internal->distortion, rvecs,
tvecs);
(void)rp_error;
cv::initUndistortRectifyMap(
internal->intrinsics, internal->distortion,
......@@ -403,7 +407,7 @@ tracker3D_sphere_mono_calibrate(tracker_instance_t* inst)
internal->event_target_instance, e);
} else {
snprintf(message, 128, "COLLECTING SAMPLE: %d/%d",
internal->chessboards_measured.size() + 1,
(uint32_t)internal->chessboards_measured.size() + 1,
MAX_CALIBRATION_SAMPLES);
}
}
......@@ -450,10 +454,11 @@ tracker3D_sphere_mono_new_poses(tracker_instance_t* inst)
return internal->poses_consumed;
}
bool
extern "C" bool
tracker3D_sphere_mono_configure(tracker_instance_t* inst,
tracker_mono_configuration_t* config)
tracker_configuration_ptr void_config)
{
auto config = (tracker_mono_configuration_t*)void_config;
tracker3D_sphere_mono_instance_t* internal =
(tracker3D_sphere_mono_instance_t*)inst->internal_instance;
// return false if we cannot handle this config
......
......@@ -39,7 +39,7 @@ bool
tracker3D_sphere_mono_new_poses(tracker_instance_t* inst);
bool
tracker3D_sphere_mono_configure(tracker_instance_t* inst,
tracker_mono_configuration_t* config);
tracker_configuration_ptr config);
void
tracker3D_sphere_mono_register_measurement_callback(
tracker_instance_t* inst,
......
......@@ -391,11 +391,11 @@ tracker3D_sphere_stereo_track(tracker_instance_t* inst)
// internal->background_subtractor->apply(internal->l_frame_gray,internal->l_mask_gray);
// internal->background_subtractor->apply(internal->r_frame_gray,internal->r_mask_gray);
xrt_vec2 lastPos = internal->l_tracked_blob.center;
float offset = ROI_OFFSET;
if (internal->l_tracked_blob.diameter > ROI_OFFSET) {
offset = internal->l_tracked_blob.diameter;
}
// xrt_vec2 lastPos = internal->l_tracked_blob.center;
// float offset = ROI_OFFSET;
// if (internal->l_tracked_blob.diameter > ROI_OFFSET) {
// offset = internal->l_tracked_blob.diameter;
// }
// cv::rectangle(internal->l_mask_gray,
// cv::Point2f(lastPos.x-offset,lastPos.y-offset),cv::Point2f(lastPos.x+offset,lastPos.y+offset),cv::Scalar(
......@@ -559,10 +559,10 @@ tracker3D_sphere_stereo_calibrate(tracker_instance_t* inst)
(tracker3D_sphere_stereo_instance_t*)inst->internal_instance;
char path_string[256]; // TODO: 256 maybe not enough
char path_string[512]; // TODO: 256 maybe not enough
// TODO: use multiple env vars?
char* config_path = secure_getenv("HOME");
snprintf(path_string, 256, "%s/.config/monado/%s.calibration",
snprintf(path_string, 512, "%s/.config/monado/%s.calibration",
config_path,
internal->configuration
.configuration_filename); // TODO: hardcoded 256
......@@ -631,7 +631,7 @@ tracker3D_sphere_stereo_calibrate(tracker_instance_t* inst)
cv::Size board_size(8, 6);
std::vector<cv::Point3f> chessboard_model;
for (uint32_t i = 0; i < board_size.width * board_size.height; i++) {
for (int i = 0; i < board_size.width * board_size.height; i++) {
cv::Point3f p(i / board_size.width, i % board_size.width, 0.0f);
chessboard_model.push_back(p);
}
......@@ -829,7 +829,7 @@ tracker3D_sphere_stereo_calibrate(tracker_instance_t* inst)
}
snprintf(message, 128, "COLLECTING SAMPLE: %d/%d",
internal->l_chessboards_measured.size() + 1,
(uint32_t)internal->l_chessboards_measured.size() + 1,
MAX_CALIBRATION_SAMPLES);
}
......@@ -888,10 +888,11 @@ tracker3D_sphere_stereo_new_poses(tracker_instance_t* inst)
return internal->poses_consumed;
}
bool
extern "C" bool
tracker3D_sphere_stereo_configure(tracker_instance_t* inst,
tracker_stereo_configuration_t* config)
tracker_configuration_ptr void_config)
{
auto config = (tracker_stereo_configuration_t*)void_config;
tracker3D_sphere_stereo_instance_t* internal =
(tracker3D_sphere_stereo_instance_t*)inst->internal_instance;
// return false if we cannot handle this config
......
......@@ -41,7 +41,7 @@ bool
tracker3D_sphere_stereo_new_poses(tracker_instance_t* inst);
bool
tracker3D_sphere_stereo_configure(tracker_instance_t* inst,
tracker_stereo_configuration_t* config);
tracker_configuration_ptr config);
void
tracker3D_sphere_stereo_register_measurement_callback(
tracker_instance_t* inst,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment