Skip to content

Commit

Permalink
Fix identation and trailing whitespaces
Browse files Browse the repository at this point in the history
Change-Id: I
Signed-off-by: Evgeni Raikhel <[email protected]>
  • Loading branch information
ev-mp committed Feb 28, 2018
1 parent b7302d0 commit ad11b4a
Show file tree
Hide file tree
Showing 28 changed files with 102 additions and 105 deletions.
4 changes: 2 additions & 2 deletions examples/example.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ struct glfw_state {
double pitch;
double last_x;
double last_y;
bool ml;
bool ml;
float offset_x;
float offset_y;
float offset_y;
texture tex;
};

Expand Down
26 changes: 13 additions & 13 deletions examples/measure/rs-measure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ float dist_2d(const pixel& a, const pixel& b);
struct toggle
{
toggle() : x(0.f), y(0.f) {}
toggle(float x, float y)
: x(std::min(std::max(x, 0.f), 1.f)),
toggle(float x, float y)
: x(std::min(std::max(x, 0.f), 1.f)),
y(std::min(std::max(y, 0.f), 1.f))
{}

Expand All @@ -54,7 +54,7 @@ struct toggle
for (auto i = 0; i <= segments; i++)
{
auto t = 2 * M_PI * float(i) / segments;
glVertex2f(x * app.width() + cos(t) * r,
glVertex2f(x * app.width() + cos(t) * r,
y * app.height() + sin(t) * r);
}
glEnd();
Expand All @@ -64,7 +64,7 @@ struct toggle

// This helper function is used to find the button
// closest to the mouse cursor
// Since we are only comparing this distance, sqrt can be safely skipped
// Since we are only comparing this distance, sqrt can be safely skipped
float dist_2d(const toggle& other) const
{
return pow(x - other.x, 2) + pow(y - other.y, 2);
Expand All @@ -91,7 +91,7 @@ void register_glfw_callbacks(window& app, state& app_state);
// Simple distance is the classic pythagorean distance between 3D points
// This distance ignores the topology of the object and can cut both through
// air and through solid
void render_simple_distance(const rs2::depth_frame& depth,
void render_simple_distance(const rs2::depth_frame& depth,
const state& s,
const window& app,
const rs2_intrinsics& intr);
Expand Down Expand Up @@ -122,7 +122,7 @@ int main(int argc, char * argv[]) try
rs2::spatial_filter spat;
// Enable hole-filling
// Hole filling is an agressive heuristic and it gets the depth wrong many times
// However, this demo is not built to handle holes
// However, this demo is not built to handle holes
// (the shortest-path will always prefer to "cut" through the holes since they have zero 3D distance)
spat.set_option(RS2_OPTION_HOLES_FILL, 5); // 5 = fill all the zero pixels
// Define temporal filter
Expand All @@ -144,7 +144,7 @@ int main(int argc, char * argv[]) try
auto profile = pipe.start(cfg);

auto sensor = profile.get_device().first<rs2::depth_sensor>();

// TODO: At the moment the SDK does not offer a closed enum for D400 visual presets
// (because they keep changing)
// As a work-around we try to find the High-Density preset by name
Expand All @@ -171,7 +171,7 @@ int main(int argc, char * argv[]) try
rs2::frame_queue postprocessed_frames;

// In addition, depth frames will also flow into this queue:
rs2::frame_queue pathfinding_queue;
rs2::frame_queue pathfinding_queue;

// Alive boolean will signal the worker threads to finish-up
std::atomic_bool alive{ true };
Expand All @@ -183,7 +183,7 @@ int main(int argc, char * argv[]) try

// Video-processing thread will fetch frames from the camera,
// apply post-processing and send the result to the main thread for rendering
// It recieves synchronized (but not spatially aligned) pairs
// It recieves synchronized (but not spatially aligned) pairs
// and outputs synchronized and aligned pairs
std::thread video_processing_thread([&]() {
// In order to generate new composite frames, we have to wrap the processing
Expand All @@ -199,7 +199,7 @@ int main(int argc, char * argv[]) try
rs2::frame depth = data.get_depth_frame();
// Decimation will reduce the resultion of the depth image,
// closing small holes and speeding-up the algorithm
depth = dec.process(depth);
depth = dec.process(depth);
// To make sure far-away objects are filtered proportionally
// we try to switch to disparity domain
depth = depth2disparity.process(depth);
Expand All @@ -220,7 +220,7 @@ int main(int argc, char * argv[]) try
// Send the composite frame for rendering
source.frame_ready(combined);
});
// Indicate that we want the results of frame_processor
// Indicate that we want the results of frame_processor
// to be pushed into postprocessed_frames queue
frame_processor >> postprocessed_frames;

Expand Down Expand Up @@ -448,7 +448,7 @@ float dist_2d(const pixel& a, const pixel& b)
return pow(a.first - b.first, 2) + pow(a.second - b.second, 2);
}

void render_simple_distance(const rs2::depth_frame& depth,
void render_simple_distance(const rs2::depth_frame& depth,
const state& s,
const window& app,
const rs2_intrinsics& intr)
Expand Down Expand Up @@ -523,7 +523,7 @@ void register_glfw_callbacks(window& app, state& app_state)
app.on_mouse_move = [&](double x, double y)
{
toggle cursor{ float(x) / app.width(), float(y) / app.height() };
std::vector<toggle*> toggles{
std::vector<toggle*> toggles{
&app_state.ruler_start,
&app_state.ruler_end };

Expand Down
6 changes: 3 additions & 3 deletions examples/post-processing/rs-post-processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ int main(int argc, char * argv[]) try
{
rs2::frameset data = pipe.wait_for_frames(); // Wait for next set of frames from the camera
rs2::frame depth_frame = data.get_depth_frame(); //Take the depth frame from the frameset
if (!depth_frame) // Should not happen but if the pipeline is configured differently
if (!depth_frame) // Should not happen but if the pipeline is configured differently
return; // it might not provide depth and we don't want to crash

rs2::frame filtered = depth_frame; // Does not copy the frame, only adds a reference
Expand Down Expand Up @@ -140,7 +140,7 @@ int main(int argc, char * argv[]) try
// Note, pushing to two different queues might cause the application to display
// original and filtered pointclouds from different depth frames
// To make sure they are synchronized you need to push them together or add some
// synchronization mechanisms
// synchronization mechanisms
filtered_data.enqueue(filtered);
original_data.enqueue(depth_frame);
}
Expand All @@ -162,7 +162,7 @@ int main(int argc, char * argv[]) try
// We'll use rotation_velocity to rotate the pointcloud for a better view of the filters effects
float rotation_velocity = 0.3f;

while (app)
while (app)
{
float w = static_cast<float>(app.width());
float h = static_cast<float>(app.height());
Expand Down
2 changes: 1 addition & 1 deletion examples/sensor-control/api_how_to.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class how_to
}
std::cout << "\n";
}

std::cout << "Variance of noise for X, Y, Z axis \n";
for (int i = 0; i < 3; i++)
std::cout << intrinsics.noise_variances[i] << " ";
Expand Down
12 changes: 6 additions & 6 deletions examples/software-device/rs-software-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <librealsense2/rs.hpp> // Include RealSense Cross Platform API
#include <librealsense2/hpp/rs_internal.hpp>
#include "example.hpp"
#include "example.hpp"
#include "example.hpp" // Include short list of convenience functions for rendering


Expand Down Expand Up @@ -119,11 +119,11 @@ int main(int argc, char * argv[]) try
glfw_state app_state;
register_glfw_callbacks(app, app_state);
rs2::colorizer color_map; // Save colorized depth for preview

rs2::pointcloud pc;
rs2::points points;
int frame_number = 0;

custom_frame_source app_data;

auto texture = app_data.get_synthetic_texture();
Expand All @@ -137,8 +137,8 @@ int main(int argc, char * argv[]) try

rs2::software_device dev; // Create software-only device

auto depth_sensor = dev.add_sensor("Depth"); // Define single sensor
auto color_sensor = dev.add_sensor("Color"); // Define single sensor
auto depth_sensor = dev.add_sensor("Depth"); // Define single sensor
auto color_sensor = dev.add_sensor("Color"); // Define single sensor

auto depth_stream = depth_sensor.add_video_stream({ RS2_STREAM_DEPTH, 0, 0,
W, H, 60, BPP,
Expand All @@ -148,7 +148,7 @@ int main(int argc, char * argv[]) try


auto color_stream = color_sensor.add_video_stream({ RS2_STREAM_COLOR, 0, 1, texture.x,
texture.y, 60, texture.bpp,
texture.y, 60, texture.bpp,
RS2_FORMAT_RGBA8, color_intrinsics });

dev.create_matcher(RS2_MATCHER_DLR_C);
Expand Down
2 changes: 1 addition & 1 deletion src/archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ namespace librealsense
{
new_frame = new T();
}

++published_frames_count;
*new_frame = std::move(*f);

Expand Down
20 changes: 10 additions & 10 deletions src/archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ struct frame_additional_data

frame_additional_data() {};

frame_additional_data(double in_timestamp,
unsigned long long in_frame_number,
double in_system_time,
uint8_t md_size,
const uint8_t* md_buf,
double backend_time,
rs2_time_t last_timestamp,
frame_additional_data(double in_timestamp,
unsigned long long in_frame_number,
double in_system_time,
uint8_t md_size,
const uint8_t* md_buf,
double backend_time,
rs2_time_t last_timestamp,
unsigned long long last_frame_number)
: timestamp(in_timestamp),
frame_number(in_frame_number),
Expand Down Expand Up @@ -262,7 +262,7 @@ namespace librealsense
_depth_units = optional_value<float>();
return video_frame::publish(new_owner);
}

void keep() override
{
if (_original) _original->keep();
Expand All @@ -289,8 +289,8 @@ namespace librealsense
return pixel * get_units();
}

float get_units() const
{
float get_units() const
{
if (!_depth_units)
_depth_units = query_units(get_sensor());
return _depth_units.value();
Expand Down
32 changes: 16 additions & 16 deletions src/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ namespace librealsense
{
std::vector<rs2_device_info> rs2_devices_info_added;
std::vector<rs2_device_info> rs2_devices_info_removed;
if(removed)
if(removed)
rs2_devices_info_removed.push_back({ shared_from_this(), removed });
if (added)
if (added)
rs2_devices_info_added.push_back({ shared_from_this(), added });
raise_devices_changed(rs2_devices_info_removed, rs2_devices_info_added);
};
Expand Down Expand Up @@ -443,17 +443,17 @@ namespace librealsense
return result;
}

// TODO: Make template
std::vector<platform::usb_device_info> filter_by_product(const std::vector<platform::usb_device_info>& devices, const std::set<uint16_t>& pid_list)
{
std::vector<platform::usb_device_info> result;
for (auto&& info : devices)
{
if (pid_list.count(info.pid))
result.push_back(info);
}
return result;
}
// TODO: Make template
std::vector<platform::usb_device_info> filter_by_product(const std::vector<platform::usb_device_info>& devices, const std::set<uint16_t>& pid_list)
{
std::vector<platform::usb_device_info> result;
for (auto&& info : devices)
{
if (pid_list.count(info.pid))
result.push_back(info);
}
return result;
}

std::vector<std::pair<std::vector<platform::uvc_device_info>, std::vector<platform::hid_device_info>>> group_devices_and_hids_by_unique_id(
const std::vector<std::vector<platform::uvc_device_info>>& devices,
Expand Down Expand Up @@ -517,9 +517,9 @@ namespace librealsense
return result;
}

// TODO: Sergey
// Make template
void trim_device_list(std::vector<platform::usb_device_info>& devices, const std::vector<platform::usb_device_info>& chosen)
// TODO: Sergey
// Make template
void trim_device_list(std::vector<platform::usb_device_info>& devices, const std::vector<platform::usb_device_info>& chosen)
{
if (chosen.empty())
return;
Expand Down
6 changes: 3 additions & 3 deletions src/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ namespace librealsense
void remove_device(const std::string& file);

private:
void on_device_changed(platform::backend_device_group old,
platform::backend_device_group curr,
const std::map<std::string, std::shared_ptr<device_info>>& old_playback_devices,
void on_device_changed(platform::backend_device_group old,
platform::backend_device_group curr,
const std::map<std::string, std::shared_ptr<device_info>>& old_playback_devices,
const std::map<std::string, std::shared_ptr<device_info>>& new_playback_devices);
void raise_devices_changed(const std::vector<rs2_device_info>& removed, const std::vector<rs2_device_info>& added);
int find_stream_profile(const stream_interface& p);
Expand Down
4 changes: 2 additions & 2 deletions src/ds5/ds5-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace librealsense
}
auto video = dynamic_cast<video_stream_profile_interface*>(p.get());

if (video->get_width() == 1280 && video->get_height() == 720 &&
if (video->get_width() == 1280 && video->get_height() == 720 &&
video->get_format() == RS2_FORMAT_Z16 && video->get_framerate() == 30)
video->make_default();

Expand Down Expand Up @@ -169,7 +169,7 @@ namespace librealsense
if (video->get_width() == 848 && video->get_height() == 480
&& video->get_framerate() == 30 && video->get_stream_index() == 0)
video->make_default();
}
}
}

return results;
Expand Down
1 change: 0 additions & 1 deletion src/ds5/ds5-factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ namespace librealsense
return matcher_factory::create(RS2_MATCHER_DLR, streams);
}
return matcher_factory::create(RS2_MATCHER_DEFAULT, streams);

}

std::shared_ptr<matcher> rs405_device::create_matcher(const frame_holder& frame) const
Expand Down
4 changes: 2 additions & 2 deletions src/ds5/ds5-motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace librealsense
{
}

rs2_motion_device_intrinsic get_motion_intrinsics(rs2_stream stream) const
rs2_motion_device_intrinsic get_motion_intrinsics(rs2_stream stream) const
{
return _owner->get_motion_intrinsics(stream);
}
Expand All @@ -84,7 +84,7 @@ namespace librealsense
//set motion intrinsics
if (p->get_stream_type() == RS2_STREAM_ACCEL || p->get_stream_type() == RS2_STREAM_GYRO)
{
auto motion = dynamic_cast<motion_stream_profile_interface*>(p.get());
auto motion = dynamic_cast<motion_stream_profile_interface*>(p.get());
assert(motion); //Expecting to succeed for motion stream (since we are under the "if")
auto st = p->get_stream_type();
motion->set_intrinsics([this, st]() { return get_motion_intrinsics(st); });
Expand Down
1 change: 0 additions & 1 deletion src/ivcam/sr300.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ namespace librealsense
{
matchers.push_back(std::make_shared<frame_number_composite_matcher>(depth_matchers));
}


auto color_matcher = std::make_shared<identity_matcher>( _color_stream->get_unique_id(), _color_stream->get_stream_type());
matchers.push_back(color_matcher);
Expand Down
1 change: 0 additions & 1 deletion src/media/playback/playback_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ void playback_sensor::open(const stream_profiles& requests)
}
m_active_streams = requests;
opened(opened_streams);

}

void playback_sensor::close()
Expand Down
4 changes: 2 additions & 2 deletions src/media/record/record_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ librealsense::record_device::~record_device()
LOG_ERROR("Error - timeout waiting for flush, possible deadlock detected");
}
(*m_write_thread)->stop();
//Just in case someone still holds a reference to the sensors,
//Just in case someone still holds a reference to the sensors,
// we make sure that they will not try to record anything
m_sensors.clear();
m_sensors.clear();
}

std::shared_ptr<context> librealsense::record_device::get_context() const
Expand Down
Loading

0 comments on commit ad11b4a

Please sign in to comment.