Skip to content

DDS using generic format types - #11946

Merged
maloel merged 10 commits into
realsenseai:ddsfrom
OhadMeir:dds_formats_conversion
Jul 11, 2023
Merged

DDS using generic format types#11946
maloel merged 10 commits into
realsenseai:ddsfrom
OhadMeir:dds_formats_conversion

Conversation

@OhadMeir

@OhadMeir OhadMeir commented Jun 28, 2023

Copy link
Copy Markdown
Contributor

rs-dds-adapter sends only profiles of "generic" formats: YUYV/UYVY for color, no interleaved formats etc...

The adapter also sets default profiles that are different from the USB defaults. D400 default color format is RGB8 for USB, here using YUYV, Infrared default resolution matches depth default resolution.

Context is saving the json params it receives during construction, device is using relevant parameters without the need for context to parse the parameters

@OhadMeir
OhadMeir requested a review from maloel June 29, 2023 07:53
Comment thread src/context.h Outdated
Comment thread src/dds/rs-dds-device-proxy.cpp Outdated
Comment thread src/dds/rs-dds-device-proxy.cpp Outdated
Comment thread src/dds/rs-dds-device-proxy.h Outdated
Comment thread src/proc/formats-converter.h
Comment thread src/proc/formats-converter.cpp
Comment thread src/proc/formats-converter.cpp
Comment thread src/proc/formats-converter.cpp Outdated
Comment thread src/proc/formats-converter.cpp
Comment thread src/proc/formats-converter.cpp Outdated
Comment thread src/device.h Outdated

bool device_changed_notifications_on() const { return _device_changed_notifications; }

bool should_use_basic_formats() const;

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.

A few things: :)

  • Not sure about the name - if we stuck to the existing convention, it would be use_basic_formats_on()?
  • Should we really expose a function from the device? I'd bet the sensor pretty much knows how to get the context? If so, why not query the context directly and no go through the device? It's really not a device function, is it?

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.

The sensor uses it's device "owner" to access the context, no direct access.
Conceptually we can make this a per sensor decision, but I don't really see a case where it is not an application wide resolution. It is whether we convert at server side or host side and the CPU/bandwidth resources needed.

@maloel maloel Jul 3, 2023

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.

I would argue it's not actually per device, though. It's per context.
I think the sensor should query the context.

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.

Updated sensor to parse this parameter

Comment thread src/sensor.cpp Outdated

// Invoke processing blocks callback
const auto&& process_cb = make_callback([&, this](frame_holder f) {
const auto & process_cb = make_callback( [&, this]( frame_holder f ) {

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.

Not a ref

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

Comment thread tools/dds/dds-adapter/lrs-device-controller.cpp
Comment thread tools/dds/dds-adapter/lrs-device-controller.cpp
Comment thread tools/dds/dds-adapter/lrs-device-controller.cpp

void override_default_profiles( const std::map< std::string, realdds::dds_stream_profiles > & stream_name_to_profiles,
std::map< std::string, size_t > & stream_name_to_default_profile ) const;
size_t get_index_of_profile( const realdds::dds_stream_profiles & profiles,

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.

These two look like they don't belong in the class and can be static in the cpp

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.

I don't like creating static functions just to hide the signature. This is why they are private functions of the class. All the public interface is on the first lines of the class so users don't need to scroll down and "get to know" the private parts if it is not important for them. I considered making the parameters members of the class but decided not to, currently.

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.

But then it dirties the header and pollutes the build space when changes are made. It's implementation. If it doesn't need to be in class, it shouldn't. My opinion. Do what you think is right.

"}" );
nlohmann::json j = {
{ "dds-discovery", false },
{ "use-basic-formats", true }

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.

May want to explain

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.

Added explanation

Comment thread unit-tests/dds/d405.py Outdated
# dds.video_stream_profile( 30, dds.stream_format("RGBA"), 1280, 720 ),
# dds.video_stream_profile( 30, dds.stream_format("RGB2"), 1280, 720 ),
# dds.video_stream_profile( 30, dds.stream_format("rgb8"), 1280, 720 ),
dds.video_stream_profile( 30, dds.stream_format("rgb8"), 1280, 720 ),

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.

Why re-enable rgb8?

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.

I don't know if your question is for the colored infrared stream or general.

For the D405 color stream and also for the other modules I re-enabled rgb8 because that is what the users will see after LibRS will convert the received streams.
For the colored infrared it was more of inertia, doing the same all over the files. The stream is not broadcasted anyway.

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, as previously discussed

Comment thread unit-tests/dds/test-librs-device-properties.py
@OhadMeir OhadMeir mentioned this pull request Jul 5, 2023
@OhadMeir
OhadMeir marked this pull request as ready for review July 11, 2023 07:23
@OhadMeir
OhadMeir force-pushed the dds_formats_conversion branch from 2bcc566 to edff921 Compare July 11, 2023 07:31
@maloel
maloel merged commit ffb1375 into realsenseai:dds Jul 11, 2023
@OhadMeir
OhadMeir deleted the dds_formats_conversion branch March 14, 2024 09:52
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.

2 participants