Skip to content
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

remove recommended_processing_blocks_base #12378

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ target_sources(${LRS_TARGET}
"${CMAKE_CURRENT_LIST_DIR}/processing.h"
"${CMAKE_CURRENT_LIST_DIR}/processing-block-interface.h"
"${CMAKE_CURRENT_LIST_DIR}/recommended-proccesing-blocks-interface.h"
"${CMAKE_CURRENT_LIST_DIR}/recommended-proccesing-blocks-base.h"
"${CMAKE_CURRENT_LIST_DIR}/sensor-interface.h"
"${CMAKE_CURRENT_LIST_DIR}/serialization.h"
"${CMAKE_CURRENT_LIST_DIR}/stream-interface.h"
Expand Down
32 changes: 0 additions & 32 deletions src/core/recommended-proccesing-blocks-base.h

This file was deleted.

36 changes: 13 additions & 23 deletions src/dds/rs-dds-sensor-proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,18 +547,7 @@ void dds_sensor_proxy::add_option( std::shared_ptr< realdds::dds_option > option
}


void dds_sensor_proxy::add_processing_block( std::string filter_name )
{
auto & current_filters = get_software_recommended_proccesing_blocks();

if( processing_block_exists( current_filters.get_recommended_processing_blocks(), filter_name ) )
return; // Already created by another stream of this sensor

create_processing_block( filter_name );
}


bool dds_sensor_proxy::processing_block_exists( processing_blocks const & blocks, std::string const & block_name ) const
static bool processing_block_exists( processing_blocks const & blocks, std::string const & block_name )
{
for( auto & block : blocks )
if( block_name.compare( block->get_info( RS2_CAMERA_INFO_NAME ) ) == 0 )
Expand All @@ -568,30 +557,31 @@ bool dds_sensor_proxy::processing_block_exists( processing_blocks const & blocks
}


void dds_sensor_proxy::create_processing_block( std::string & filter_name )
void dds_sensor_proxy::add_processing_block( std::string const & filter_name )
{
auto & current_filters = get_software_recommended_proccesing_blocks();
if( processing_block_exists( get_recommended_processing_blocks(), filter_name ) )
return; // Already created by another stream of this sensor

if( filter_name.compare( "Decimation Filter" ) == 0 )
// sensor.cpp sets format option based on sensor type, but the filter does not use it and selects the
// appropriate decimation algorithm based on processed frame profile format.
current_filters.add_processing_block( std::make_shared< decimation_filter >() );
super::add_processing_block( std::make_shared< decimation_filter >() );
else if( filter_name.compare( "HDR Merge" ) == 0 )
current_filters.add_processing_block( std::make_shared< hdr_merge >() );
super::add_processing_block( std::make_shared< hdr_merge >() );
else if( filter_name.compare( "Filter By Sequence id" ) == 0 )
current_filters.add_processing_block( std::make_shared< sequence_id_filter >() );
super::add_processing_block( std::make_shared< sequence_id_filter >() );
else if( filter_name.compare( "Threshold Filter" ) == 0 )
current_filters.add_processing_block( std::make_shared< threshold >() );
super::add_processing_block( std::make_shared< threshold >() );
else if( filter_name.compare( "Depth to Disparity" ) == 0 )
current_filters.add_processing_block( std::make_shared< disparity_transform >( true ) );
super::add_processing_block( std::make_shared< disparity_transform >( true ) );
else if( filter_name.compare( "Disparity to Depth" ) == 0 )
current_filters.add_processing_block( std::make_shared< disparity_transform >( false ) );
super::add_processing_block( std::make_shared< disparity_transform >( false ) );
else if( filter_name.compare( "Spatial Filter" ) == 0 )
current_filters.add_processing_block( std::make_shared< spatial_filter >() );
super::add_processing_block( std::make_shared< spatial_filter >() );
else if( filter_name.compare( "Temporal Filter" ) == 0 )
current_filters.add_processing_block( std::make_shared< temporal_filter >() );
super::add_processing_block( std::make_shared< temporal_filter >() );
else if( filter_name.compare( "Hole Filling Filter" ) == 0 )
current_filters.add_processing_block( std::make_shared< hole_filling_filter >() );
super::add_processing_block( std::make_shared< hole_filling_filter >() );
else
throw std::runtime_error( "Unsupported processing block '" + filter_name + "' received" );
}
Expand Down
6 changes: 3 additions & 3 deletions src/dds/rs-dds-sensor-proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class dds_device_proxy;

class dds_sensor_proxy : public software_sensor
{
using super = software_sensor;

std::shared_ptr< realdds::dds_device > const _dev;
std::string const _name;
bool const _md_enabled;
Expand Down Expand Up @@ -71,9 +73,7 @@ class dds_sensor_proxy : public software_sensor

void add_option( std::shared_ptr< realdds::dds_option > option );

void add_processing_block( std::string filter_name );
bool processing_block_exists( processing_blocks const & blocks, std::string const & block_name ) const;
void create_processing_block( std::string & filter_name );
void add_processing_block( std::string const & filter_name );

const std::map< sid_index, std::shared_ptr< realdds::dds_stream > > & streams() const { return _streams; }

Expand Down
2 changes: 1 addition & 1 deletion src/hid-sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ hid_sensor::hid_sensor(
const std::map< rs2_stream, std::map< unsigned, unsigned > > & fps_and_sampling_frequency_per_rs2_stream,
const std::vector< std::pair< std::string, stream_profile > > & sensor_name_and_hid_profiles,
device * dev )
: super( "Raw Motion Module", dev, (recommended_proccesing_blocks_interface *)this )
: super( "Raw Motion Module", dev )
, _sensor_name_and_hid_profiles( sensor_name_and_hid_profiles )
, _fps_and_sampling_frequency_per_rs2_stream( fps_and_sampling_frequency_per_rs2_stream )
, _hid_device( hid_device )
Expand Down
7 changes: 3 additions & 4 deletions src/sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ void log_callback_end( uint32_t fps,
/////////////////// Sensor Base //////////////////////
//////////////////////////////////////////////////////

sensor_base::sensor_base( std::string const & name, device * dev, recommended_proccesing_blocks_interface * owner )
: recommended_proccesing_blocks_base( owner )
, _is_streaming( false )
sensor_base::sensor_base( std::string const & name, device * dev )
: _is_streaming( false )
, _is_opened( false )
, _notifications_processor( std::make_shared< notifications_processor >() )
, _on_open( nullptr )
Expand Down Expand Up @@ -398,7 +397,7 @@ void log_callback_end( uint32_t fps,
device * device,
const std::map< uint32_t, rs2_format > & fourcc_to_rs2_format_map,
const std::map< uint32_t, rs2_stream > & fourcc_to_rs2_stream_map )
: sensor_base( name, device, (recommended_proccesing_blocks_interface *)this )
: sensor_base( name, device )
, _raw_sensor( raw_sensor )
{
// synthetic sensor and its raw sensor will share the formats and streams mapping
Expand Down
11 changes: 3 additions & 8 deletions src/sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "core/sensor-interface.h"

#include "core/recommended-proccesing-blocks-base.h"
#include "source.h"
#include "core/extension.h"
#include "proc/formats-converter.h"
Expand Down Expand Up @@ -52,12 +51,9 @@ namespace librealsense
, public virtual sensor_interface
, public options_container
, public virtual info_container
, public recommended_proccesing_blocks_base
{
public:
explicit sensor_base( std::string const & name,
device * device,
recommended_proccesing_blocks_interface * owner );
explicit sensor_base( std::string const & name, device * device );
virtual ~sensor_base() override { _source.flush(); }

void set_source_owner(sensor_base* owner); // will direct the source to the top in the source hierarchy.
Expand Down Expand Up @@ -168,9 +164,8 @@ namespace librealsense

protected:
explicit raw_sensor_base( std::string const & name,
device * device,
recommended_proccesing_blocks_interface * owner )
: super( name, device, owner )
device * device )
: super( name, device )
{
}

Expand Down
7 changes: 3 additions & 4 deletions src/software-sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class software_sensor::stereo_extension : public depth_stereo_sensor


software_sensor::software_sensor( std::string const & name, software_device * owner )
: sensor_base( name, owner, &_pbs )
: sensor_base( name, owner )
, _stereo_extension( [this]() { return stereo_extension( this ); } )
, _metadata_map{} // to all 0's
{
Expand Down Expand Up @@ -363,13 +363,12 @@ void software_sensor::add_option( rs2_option option, option_range range, bool is
}


void software_recommended_proccesing_blocks::add_processing_block(
std::shared_ptr< processing_block_interface > const & block )
void software_sensor::add_processing_block( std::shared_ptr< processing_block_interface > const & block )
{
if( ! block )
throw invalid_value_exception( "trying to add an empty software processing block" );

_blocks.push_back( block );
_pbs.push_back( block );
}


Expand Down
22 changes: 3 additions & 19 deletions src/software-sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@
namespace librealsense {


class software_recommended_proccesing_blocks : public recommended_proccesing_blocks_interface
{
public:
processing_blocks get_recommended_processing_blocks() const override { return _blocks; }

void add_processing_block( std::shared_ptr< processing_block_interface > const & block );

private:
processing_blocks _blocks;
};


class software_device;
class stream_profile_interface;
class video_stream_profile_interface;
Expand Down Expand Up @@ -72,12 +60,8 @@ class software_sensor

metadata_array _metadata_map;

processing_blocks get_recommended_processing_blocks() const override
{
return _pbs.get_recommended_processing_blocks();
}

software_recommended_proccesing_blocks & get_software_recommended_proccesing_blocks() { return _pbs; }
processing_blocks get_recommended_processing_blocks() const override { return _pbs; }
void add_processing_block( std::shared_ptr< processing_block_interface > const & );

// We build profiles using add_video_stream(), etc., and feed those into init_stream_profiles() which could in
// theory change them: so these are our "raw" profiles before initialization...
Expand All @@ -89,7 +73,7 @@ class software_sensor
class stereo_extension;
rsutils::lazy< stereo_extension > _stereo_extension;

software_recommended_proccesing_blocks _pbs;
processing_blocks _pbs;
};

MAP_EXTENSION( RS2_EXTENSION_SOFTWARE_SENSOR, software_sensor );
Expand Down
2 changes: 1 addition & 1 deletion src/uvc-sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ uvc_sensor::uvc_sensor( std::string const & name,
std::shared_ptr< platform::uvc_device > uvc_device,
std::unique_ptr< frame_timestamp_reader > timestamp_reader,
device * dev )
: super( name, dev, (recommended_proccesing_blocks_interface *)this )
: super( name, dev )
, _device( std::move( uvc_device ) )
, _user_count( 0 )
, _timestamp_reader( std::move( timestamp_reader ) )
Expand Down
Loading