-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable rotate frames for RGB camera #13733
base: development
Are you sure you want to change the base?
Enable rotate frames for RGB camera #13733
Conversation
Please check CI failures |
src/proc/rotation-filter.cpp
Outdated
auto src = f.as< rs2::video_frame >(); | ||
rs2::stream_profile profile = f.get_profile(); | ||
auto format = f.get_profile().format(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have the profile from 1 line above, you can do profile.format()
here right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/proc/rotation-filter.cpp
Outdated
if( ! frame || frame.is< rs2::frameset >() ) | ||
return false; | ||
auto type = frame.get_profile().stream_type(); | ||
/// change extrinsics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this comment for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
return false; | ||
auto type = frame.get_profile().stream_type(); | ||
/// change extrinsics | ||
for( auto & stream_type : _streams_to_rotate ){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for { }
for one line if/for
. Where you are using, {
should be placed on a new line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -52,32 +53,51 @@ namespace librealsense { | |||
register_option( RS2_OPTION_ROTATION, rotation_control ); | |||
} | |||
|
|||
rotation_filter::rotation_filter( std::vector< rs2_stream > streams_to_rotate ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code duplication. Is default constructor needed? If so have it call the other constructor with an empty vector {}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/proc/rotation-filter.cpp
Outdated
if( ! strong_rotation_control ) | ||
return; | ||
|
||
std::lock_guard< std::mutex > lock( _mutex ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lock after validating if valid value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/proc/rotation-filter.cpp
Outdated
|
||
register_option( RS2_OPTION_ROTATION, rotation_control ); | ||
} | ||
|
||
rs2::frame rotation_filter::process_frame(const rs2::frame_source& source, const rs2::frame& f) | ||
{ | ||
if( _value == rotation_default_val ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should lock _mutex
or place _value
in a local variable and use it all over this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for update_output_profile
and rotate_frame
.
src/proc/rotation-filter.cpp
Outdated
{ | ||
if( _value == 90 || _value == -90 ) | ||
{ | ||
LOG_ERROR( "Rotating YUYV format is disabled for 90 or -90 degrees" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we intend to support this at a future PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No support for 90 and 270 degrees rotation for YUYV format
src/proc/rotation-filter.cpp
Outdated
@@ -220,6 +279,38 @@ namespace librealsense { | |||
} | |||
} | |||
} | |||
|
|||
|
|||
void rotation_filter::rotate_YUYV_frame(uint8_t* const out, const uint8_t* source, int width, int height) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use formatter. Spaces, {
at new line, etc...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/proc/rotation-filter.cpp
Outdated
break; | ||
} | ||
case 3: { | ||
rotate_frame< 3 >( static_cast< uint8_t * >( const_cast< void * >( tgt.get_data() ) ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that using bpp as a normal function parameter instead of template will reduce code duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Tracked on RSDSO-19999