11 #define CATCH_CONFIG_MAIN 13 #include "../unit-tests-common.h" 16 #ifdef BUILD_SHARED_LIBS 26 TEST_CASE(
"HDR Config - default config",
"[hdr][live]")
32 size_t device_count = devices_list.
size();
33 if (devices_list.
size() != 0)
63 std::cout <<
"No device was found - skipping test" << std::endl;
68 TEST_CASE(
"HDR Config - custom config",
"[hdr][live]")
75 size_t device_count = devices_list.
size();
76 if (devices_list.
size() != 0)
109 std::cout <<
"No device was found - skipping test" << std::endl;
115 TEST_CASE(
"HDR Streaming - default config",
"[hdr][live][using_pipeline]")
121 size_t device_count = devices_list.
size();
122 if (devices_list.
size() != 0)
141 while (++iteration < 100)
158 REQUIRE(frame_exposure == exposure_range.def - 1000.f);
159 REQUIRE(frame_gain == gain_range.def);
163 REQUIRE(frame_exposure == exposure_range.min);
164 REQUIRE(frame_gain == gain_range.min);
172 std::cout <<
"No device was found - skipping test" << std::endl;
177 TEST_CASE(
"HDR Streaming - custom config",
"[hdr][live][using_pipeline]")
183 size_t device_count = devices_list.
size();
184 if (devices_list.
size() != 0)
193 auto first_exposure = 120.f;
194 auto first_gain = 90.f;
203 auto second_exposure = 1200.f;
204 auto second_gain = 20.f;
222 while (++iteration < 100)
239 REQUIRE(frame_exposure == first_exposure);
240 REQUIRE(frame_gain == first_gain);
244 REQUIRE(frame_exposure == second_exposure);
245 REQUIRE(frame_gain == second_gain);
253 std::cout <<
"No device was found - skipping test" << std::endl;
259 TEST_CASE(
"HDR Config while Streaming",
"[hdr][live][using_pipeline]")
265 size_t device_count = devices_list.
size();
266 if (devices_list.
size() != 0)
284 auto required_exposure = exposure_range.def - 1000;
285 auto required_gain = gain_range.def;
286 auto changed_exposure = 33000.f;
287 auto changed_gain = 150.f;
290 while (++iteration < 100)
296 if (iteration < 3 || (iteration > 30 && iteration < 36))
307 required_exposure = changed_exposure;
308 required_gain = changed_gain;
321 REQUIRE(frame_exposure == required_exposure);
322 REQUIRE(frame_gain == required_gain);
326 REQUIRE(frame_exposure == exposure_range.min);
327 REQUIRE(frame_gain == gain_range.min);
335 std::cout <<
"No device was found - skipping test" << std::endl;
341 TEST_CASE(
"HDR Running - restart hdr at restream",
"[hdr][live][using_pipeline]")
347 size_t device_count = devices_list.
size();
348 if (devices_list.
size() != 0)
362 for (
int i = 0;
i < 10; ++
i)
377 std::cout <<
"No device was found - skipping test" << std::endl;
383 TEST_CASE(
"HDR Streaming - checking sequence id",
"[hdr][live][using_pipeline]")
389 size_t device_count = devices_list.
size();
390 if (devices_list.
size() != 0)
406 int sequence_id = -1;
407 int iterations_for_preparation = 6;
408 while (++iteration < 50)
413 if (iteration < iterations_for_preparation)
422 if (iteration == iterations_for_preparation)
424 REQUIRE(depth_seq_id == ir_seq_id);
425 sequence_id = depth_seq_id;
429 sequence_id = (sequence_id == 0) ? 1 : 0;
430 REQUIRE(sequence_id == depth_seq_id);
431 REQUIRE(sequence_id == ir_seq_id);
440 std::cout <<
"No device was found - skipping test" << std::endl;
445 TEST_CASE(
"Emitter on/off - checking sequence id",
"[hdr][live][using_pipeline]")
451 size_t device_count = devices_list.
size();
452 if (devices_list.
size() != 0)
468 int sequence_id = -1;
469 int iterations_for_preparation = 6;
470 while (++iteration < 50)
475 if (iteration < iterations_for_preparation)
486 if (iteration == iterations_for_preparation)
488 REQUIRE(depth_seq_id == ir_seq_id);
489 sequence_id = depth_seq_id;
493 sequence_id = (sequence_id == 0) ? 1 : 0;
494 REQUIRE(sequence_id == depth_seq_id);
495 REQUIRE(sequence_id == ir_seq_id);
504 std::cout <<
"No device was found - skipping test" << std::endl;
510 TEST_CASE(
"HDR Merge - discard merged frame",
"[hdr][live][using_pipeline]") {
516 size_t device_count = devices_list.
size();
517 if (devices_list.
size() != 0)
534 int num_of_iterations_in_serie = 10;
535 int first_series_last_merged_ts = -1;
536 for (
int i = 0;
i < num_of_iterations_in_serie; ++
i)
545 auto merged_frameset = merging_filter.
process(data);
546 auto merged_depth_frame = merged_frameset.
as<
rs2::frameset>().get_depth_frame();
550 if (
i == (num_of_iterations_in_serie - 1))
551 first_series_last_merged_ts = frame_ts;
554 REQUIRE(first_series_last_merged_ts != -1);
562 for (
int i = 0;
i < 10; ++
i)
571 auto merged_frameset = merging_filter.
process(data);
572 auto merged_depth_frame = merged_frameset.
as<
rs2::frameset>().get_depth_frame();
575 REQUIRE(frame_ts > first_series_last_merged_ts);
583 std::cout <<
"No device was found - skipping test" << std::endl;
589 TEST_CASE(
"HDR Start Stop - recover manual exposure and gain",
"[HDR]")
595 size_t device_count = devices_list.
size();
596 if (devices_list.
size() != 0)
602 float gain_before_hdr = 50.f;
606 float exposure_before_hdr = 5000.f;
619 int iteration_for_disable = 50;
620 int iteration_to_check_after_disable = iteration_for_disable + 2;
621 while (++iteration < 70)
633 if (iteration > iteration_for_disable && iteration < iteration_to_check_after_disable)
636 if (iteration == iteration_for_disable)
641 else if (iteration >= iteration_to_check_after_disable)
643 REQUIRE(frame_gain == gain_before_hdr);
644 REQUIRE(frame_exposure == exposure_before_hdr);
652 std::cout <<
"No device was found - skipping test" << std::endl;
658 TEST_CASE(
"HDR Active - set locked options",
"[hdr][live]") {
663 size_t device_count = devices_list.
size();
664 if (devices_list.
size() != 0)
674 std::this_thread::sleep_for((std::chrono::milliseconds)(1500));
695 std::cout <<
"No device was found - skipping test" << std::endl;
701 TEST_CASE(
"HDR Streaming - set locked options",
"[hdr][live][using_pipeline]") {
706 size_t device_count = devices_list.
size();
707 if (devices_list.
size() != 0)
717 std::this_thread::sleep_for((std::chrono::milliseconds)(1500));
728 while (++iteration < 50)
753 std::cout <<
"No device was found - skipping test" << std::endl;
frameset wait_for_frames(unsigned int timeout_ms=RS2_DEFAULT_TIMEOUT) const
rs2_metadata_type get_frame_metadata(rs2_frame_metadata_value frame_metadata) const
device_list query_devices() const
bool supports_frame_metadata(rs2_frame_metadata_value frame_metadata) const
depth_frame get_depth_frame() const
rs2::frame process(rs2::frame frame) const override
#define INITIALIZE_EASYLOGGINGPP
#define SECTION_FROM_TEST_NAME
GLenum GLenum GLsizei const GLuint GLboolean enabled
rs2::depth_sensor restart_first_device_and_return_depth_sensor(const rs2::context &ctx, const rs2::device_list &devices_list)
bool supports(rs2_camera_info info) const
void enable_stream(rs2_stream stream_type, int stream_index, int width, int height, rs2_format format=RS2_FORMAT_ANY, int framerate=0)
bool make_context(const char *id, rs2::context *ctx, std::string min_api_version="0.0.0")
TEST_CASE("HDR Config - default config","[hdr][live]")
REQUIRE_NOTHROW(rs2_log(RS2_LOG_SEVERITY_INFO,"Log message using rs2_log()", nullptr))
video_frame get_infrared_frame(const size_t index=0) const
option_range get_option_range(rs2_option option) const
void set_option(rs2_option option, float value) const
float get_option(rs2_option option) const