Skip to content

optimize RS-Viewer loading time - #13985

Merged
OhadMeir merged 3 commits into
realsenseai:developmentfrom
gilpazintel:reduce_RS_viewer_loading_time_LRS_1254
May 11, 2025
Merged

optimize RS-Viewer loading time#13985
OhadMeir merged 3 commits into
realsenseai:developmentfrom
gilpazintel:reduce_RS_viewer_loading_time_LRS_1254

Conversation

@gilpazintel

@gilpazintel gilpazintel commented May 6, 2025

Copy link
Copy Markdown
Contributor

allow late initialization for platform camera in order not to hold realsense logo on startup.

tracked by LRS-1254

as the try-catch mechanism is very time consuming, and as platform camera is in high probability w/o these controls, we want to try and add them in parallel to the viewer execution and avoid adding them from the main thread (which will stuck the logo for several seconds)

…alsense logo on startup.

as the try-catch mechanism is very time consuming, and as platform camera is in high probability w/o these controls, we want to try and add them in parallel to the viewer execution and avoid adding them from the main thread (which will stuck the logo for several seconds)
@sysrsbuild

Copy link
Copy Markdown
Contributor

Can one of the admins verify this patch?

@Nir-Az
Nir-Az requested a review from OhadMeir May 6, 2025 17:39
Comment thread src/core/device-interface.h Outdated

virtual bool contradicts( const stream_profile_interface * a,
const std::vector< stream_profile > & others ) const = 0;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OhadMeir any idea how this added an API w/o adding it to the include headers?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

realsense-viewer.cpp added an include to api.h which, despite the name, is actually under src folder. This bypass the API mechanism.

@Nir-Az

Nir-Az commented May 6, 2025

Copy link
Copy Markdown
Collaborator

What happened to the title and description with the ...

image

@gilpazintel gilpazintel changed the title allow late initialization for platform camera in order not to hold re… optimize RS-Viewer loading time May 6, 2025
auto dev_itr = begin(future_initialization_devices);
while (dev_itr != end(future_initialization_devices))
{
auto dev = *dev_itr;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copies the object. Can use auto &?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread tools/realsense-viewer/realsense-viewer.cpp Outdated
Comment thread src/core/device-interface.h Outdated
virtual bool contradicts( const stream_profile_interface * a,
const std::vector< stream_profile > & others ) const = 0;

virtual void add_controls() = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming initialize. Adding controls is specific initialization for a device type.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@gilpazintel gilpazintel closed this May 7, 2025
@gilpazintel gilpazintel reopened this May 7, 2025
@gilpazintel gilpazintel closed this May 7, 2025
@gilpazintel gilpazintel reopened this May 7, 2025
#include <mutex>
#include <set>
#include <regex>
#include <api.h>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files under src folder should not be included by user application, only from include folder.
If a function needs to be exposed to users it should be done via the C API.

I am still not sure we need a new API for this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed that

Comment thread src/platform-camera.cpp Outdated
color_ep->try_register_pu( RS2_OPTION_WHITE_BALANCE );
color_ep->try_register_pu( RS2_OPTION_ENABLE_AUTO_EXPOSURE );
color_ep->try_register_pu( RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE );
void platform_camera::initialize()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently initialize is added to device-interface but is relevant only here. Can we just open a thread in platform-device constructor that will do the initialization (maybe even after some sleep time)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (allow_future_initialization)
{
auto dev_itr = begin(future_initialization_devices);
while (dev_itr != end(future_initialization_devices))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style only - I would discard the flag and use the vector as indication if a job is needed.

while( ! future_initialization_devices.empty() )
{
//Handle a device
//Erase that device from the list
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@OhadMeir
OhadMeir merged commit 1577f1c into realsenseai:development May 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants