From 60394990ae5c30e90da74d1dce76994c3696db02 Mon Sep 17 00:00:00 2001 From: Nicolas Martin Date: Thu, 7 Apr 2022 16:53:20 +0200 Subject: [PATCH] [2.3.2] Import c6f4e8a3c4f --- CMakeLists.txt | 2 +- README.md | 4 +- .../add_library_version_header.cmake | 4 +- cmake/custom_functions/lfs_download.cmake | 10 +- .../custom_targets/README_metavision_open.md | 4 +- .../metavision_platform_info.cpp | 2 +- .../metavision_hal_viewer.cpp | 24 +-- .../include/common/raw_evt3_decoder.h | 28 ++-- .../metavision_player/src/camera_view.cpp | 17 ++- sdk/modules/core/python/tests/CMakeLists.txt | 2 +- .../metavision_evt3_raw_file_decoder.cpp | 143 ++++++++---------- 11 files changed, 110 insertions(+), 130 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b0be41d8..fcafc5bc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.5) -project(metavision VERSION 2.3.1) +project(metavision VERSION 2.3.2) set(PROJECT_VERSION_SUFFIX "") if(PROJECT_VERSION_SUFFIX STREQUAL "") diff --git a/README.md b/README.md index 0897ce80f..eeb1e2a13 100644 --- a/README.md +++ b/README.md @@ -230,14 +230,14 @@ To do so, configure the target folder (`OPENEB_INSTALL_DIR`) with `CMAKE_INSTALL (default value is `C:\Program Files\Prophesee`) when generating the makefiles in step 2: ```bash -cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DCMAKE_INSTALL_PREFIX= -DBUILD_TESTING=OFF .. +cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DCMAKE_INSTALL_PREFIX= -DBUILD_TESTING=OFF ``` You can also configure the directory where the Python packages will be deployed using the `PYTHON3_SITE_PACKAGES` variable (note that in that case, you will also need to edit your environment variable `PYTHONPATH` and append the `` path): ```bash -cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DCMAKE_INSTALL_PREFIX= -DPYTHON3_SITE_PACKAGES= -DBUILD_TESTING=OFF .. +cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DCMAKE_INSTALL_PREFIX= -DPYTHON3_SITE_PACKAGES= -DBUILD_TESTING=OFF ``` Once you performed this configuration, you can launch the actual installation of the OpenEB files: diff --git a/cmake/custom_functions/add_library_version_header.cmake b/cmake/custom_functions/add_library_version_header.cmake index 69ad4e689..c358a4a9f 100644 --- a/cmake/custom_functions/add_library_version_header.cmake +++ b/cmake/custom_functions/add_library_version_header.cmake @@ -8,8 +8,8 @@ # See the License for the specific language governing permissions and limitations under the License. set(GIT_BRANCH "main") -set(GIT_COMMIT_ID "a8766f02ffea11e97676a5d4b1709b8555298c6d") -set(GIT_COMMIT_DATE "2022-02-07 18:51:39 +0100") +set(GIT_COMMIT_ID "c6f4e8a3c4fa56f8954b23643c0c60174997930b") +set(GIT_COMMIT_DATE "2022-04-05 18:40:34 +0200") # If git information are not provided in command line when running cmake, try to automatically determine them if(NOT GIT_BRANCH OR NOT GIT_COMMIT_ID OR NOT GIT_COMMIT_DATE) diff --git a/cmake/custom_functions/lfs_download.cmake b/cmake/custom_functions/lfs_download.cmake index 469d9e67a..e3afb8b00 100644 --- a/cmake/custom_functions/lfs_download.cmake +++ b/cmake/custom_functions/lfs_download.cmake @@ -16,13 +16,7 @@ set(GIT_LFS_NOT_AVAILABLE True) function(lfs_download) if (${ARGC} GREATER 0) string(REPLACE ";" ", " file_or_dir_to_download_comma_separated "${ARGN}") - if (GIT_LFS_NOT_AVAILABLE) - foreach(file_or_dir_to_download ${ARGN}) - if(NOT EXISTS "${PROJECT_SOURCE_DIR}/${file_or_dir_to_download}") - message("Git LFS is not available, skipping download of ${file_or_dir_to_download}") - endif() - endforeach(file_or_dir_to_download) - else() + if (NOT GIT_LFS_NOT_AVAILABLE) foreach(file_or_dir_to_download ${ARGN}) if(NOT EXISTS "${PROJECT_SOURCE_DIR}/${file_or_dir_to_download}") message(FATAL_ERROR "${PROJECT_SOURCE_DIR}/${file_or_dir_to_download} does not exist") @@ -39,6 +33,6 @@ function(lfs_download) if (RESULT AND NOT RESULT EQUAL 0) message(FATAL_ERROR "lfs_download error : ${ERROR} output : ${OUTPUT}") endif () - endif(GIT_LFS_NOT_AVAILABLE) + endif (NOT GIT_LFS_NOT_AVAILABLE) endif () endfunction() diff --git a/cmake/custom_targets/README_metavision_open.md b/cmake/custom_targets/README_metavision_open.md index 0897ce80f..eeb1e2a13 100644 --- a/cmake/custom_targets/README_metavision_open.md +++ b/cmake/custom_targets/README_metavision_open.md @@ -230,14 +230,14 @@ To do so, configure the target folder (`OPENEB_INSTALL_DIR`) with `CMAKE_INSTALL (default value is `C:\Program Files\Prophesee`) when generating the makefiles in step 2: ```bash -cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DCMAKE_INSTALL_PREFIX= -DBUILD_TESTING=OFF .. +cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DCMAKE_INSTALL_PREFIX= -DBUILD_TESTING=OFF ``` You can also configure the directory where the Python packages will be deployed using the `PYTHON3_SITE_PACKAGES` variable (note that in that case, you will also need to edit your environment variable `PYTHONPATH` and append the `` path): ```bash -cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DCMAKE_INSTALL_PREFIX= -DPYTHON3_SITE_PACKAGES= -DBUILD_TESTING=OFF .. +cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DCMAKE_INSTALL_PREFIX= -DPYTHON3_SITE_PACKAGES= -DBUILD_TESTING=OFF ``` Once you performed this configuration, you can launch the actual installation of the OpenEB files: diff --git a/hal/cpp/apps/metavision_platform_info/metavision_platform_info.cpp b/hal/cpp/apps/metavision_platform_info/metavision_platform_info.cpp index aa7ba0fa9..2271577a4 100644 --- a/hal/cpp/apps/metavision_platform_info/metavision_platform_info.cpp +++ b/hal/cpp/apps/metavision_platform_info/metavision_platform_info.cpp @@ -296,7 +296,7 @@ void do_systems_diagnosis() { if (do_usb_port_analysis) { print_section("SYSTEM'S USB PORTS"); - std::vector vendor_and_product_ids = {"04b4:00f4", "03fd:5832"}; + std::vector vendor_and_product_ids = {"04b4:00f4", "04b4:00f5", "03fd:5832"}; bool usb2_found = false; int nr_usb_port_found = 0; diff --git a/hal/cpp/samples/metavision_hal_viewer/metavision_hal_viewer.cpp b/hal/cpp/samples/metavision_hal_viewer/metavision_hal_viewer.cpp index b460c9376..67dc297ab 100644 --- a/hal/cpp/samples/metavision_hal_viewer/metavision_hal_viewer.cpp +++ b/hal/cpp/samples/metavision_hal_viewer/metavision_hal_viewer.cpp @@ -173,21 +173,21 @@ int main(int argc, char *argv[]) { /// [RawfileCreation] /// [triggers] - // We enable Trigger Out and duplicate the signal on Trigger In using the loopback channel + // On camera providing Trigger Out, we enable it and duplicate the signal on Trigger In using the loopback channel + // On the other cameras, we enable Trigger In, but we will need to plug a signal generator to create trigger events + // and we also set the camera as Master so that we can test the Sync Out signal if needed. Metavision::I_TriggerOut *i_trigger_out = device->get_facility(); Metavision::I_TriggerIn *i_trigger_in = device->get_facility(); - if (i_trigger_in && i_trigger_out) { - i_trigger_out->set_period(100000); - i_trigger_out->set_duty_cycle(0.5); - i_trigger_out->enable(); - i_trigger_in->enable(trigger_in_channels[plugin_name].loopback_channel); - } - - if (system_id == 0x30 || system_id == 0x31) { - // Evk3 Gen41 system - if (i_trigger_in && i_device_control) { - i_device_control->set_mode_master(); + if (i_trigger_in) { + if (i_trigger_out) { + i_trigger_out->set_period(100000); + i_trigger_out->set_duty_cycle(0.5); + i_trigger_out->enable(); + i_trigger_in->enable(trigger_in_channels[plugin_name].loopback_channel); + } else if (i_device_control) { + std::cout << "Could not get Trigger Out facility" << std::endl; i_trigger_in->enable(0); + i_device_control->set_mode_master(); } } /// [triggers] diff --git a/hal_openeb_plugins/include/common/raw_evt3_decoder.h b/hal_openeb_plugins/include/common/raw_evt3_decoder.h index 3680795f1..8e9b93aa1 100644 --- a/hal_openeb_plugins/include/common/raw_evt3_decoder.h +++ b/hal_openeb_plugins/include/common/raw_evt3_decoder.h @@ -69,9 +69,9 @@ struct EventTime { }; enum class TypesEnum : EventTypesUnderlying_t { - TD_Y = 0x0, - X_POS = 0x2, - X_BASE = 0x3, + EVT_ADDR_Y = 0x0, + EVT_ADDR_X = 0x2, + VECT_BASE_X = 0x3, VECT_12 = 0x4, VECT_8 = 0x5, TIME_LOW = 0x6, @@ -169,10 +169,10 @@ class Decoder : public Metavision::I_Decoder { auto &trigger_forwarder = trigger_event_forwarder(); for (; cur_raw_ev != raw_ev_end;) { const uint16_t type = cur_raw_ev->type; - if (type == static_cast(TypesEnum::X_POS)) { + if (type == static_cast(TypesEnum::EVT_ADDR_X)) { if (is_valid) { EventPosX *ev_posx = reinterpret_cast(cur_raw_ev); - cd_forwarder.forward(static_cast(ev_posx->x), state[(int)TypesEnum::TD_Y], + cd_forwarder.forward(static_cast(ev_posx->x), state[(int)TypesEnum::EVT_ADDR_Y], static_cast(ev_posx->pol), last_timestamp()); } ++cur_raw_ev; @@ -200,29 +200,29 @@ class Decoder : public Metavision::I_Decoder { uint32_t valid = m.valid; - uint16_t last_x = state[(int)TypesEnum::X_BASE] & NOT_POLARITY_MASK; + uint16_t last_x = state[(int)TypesEnum::VECT_BASE_X] & NOT_POLARITY_MASK; uint16_t nb_bits = 32; #if defined(__x86_64__) || defined(__aarch64__) uint16_t off = 0; while (valid) { off = __builtin_ctz(valid); valid &= ~(1 << off); - cd_forwarder.forward_unsafe(last_x + off, state[(int)TypesEnum::TD_Y], - (bool)(state[(int)TypesEnum::X_BASE] & POLARITY_MASK), + cd_forwarder.forward_unsafe(last_x + off, state[(int)TypesEnum::EVT_ADDR_Y], + (bool)(state[(int)TypesEnum::VECT_BASE_X] & POLARITY_MASK), last_timestamp()); } #else uint16_t end = last_x + nb_bits; for (uint16_t i = last_x; i != end; ++i) { if (valid & 0x1) { - cd_forwarder.forward_unsafe(i, state[(int)TypesEnum::TD_Y], - (bool)(state[(int)TypesEnum::X_BASE] & POLARITY_MASK), + cd_forwarder.forward_unsafe(i, state[(int)TypesEnum::EVT_ADDR_Y], + (bool)(state[(int)TypesEnum::VECT_BASE_X] & POLARITY_MASK), last_timestamp()); } valid >>= 1; } #endif - state[(int)TypesEnum::X_BASE] += nb_bits; + state[(int)TypesEnum::VECT_BASE_X] += nb_bits; cur_raw_ev += vect12_size; } else if (type == static_cast(TypesEnum::TIME_HIGH)) { @@ -239,11 +239,11 @@ class Decoder : public Metavision::I_Decoder { ++cur_raw_ev; } else { // The objective is to reduce the number of possible cases - // The content of each type is store into a state because the encoding is statefull + // The content of each type is store into a state because the encoding is stateful state[type] = cur_raw_ev->content; // Some event outside of the sensor may occur, to limit the number of test the check is done - // every TD_Y - is_valid = state[(int)TypesEnum::TD_Y] < height_; + // every EVT_ADDR_Y + is_valid = state[(int)TypesEnum::EVT_ADDR_Y] < height_; last_timestamp_.bitfield_time.low = type != static_cast(TypesEnum::TIME_LOW) ? last_timestamp_.bitfield_time.low : diff --git a/sdk/modules/core/cpp/apps/metavision_player/src/camera_view.cpp b/sdk/modules/core/cpp/apps/metavision_player/src/camera_view.cpp index 3319f6d9e..32389d570 100644 --- a/sdk/modules/core/cpp/apps/metavision_player/src/camera_view.cpp +++ b/sdk/modules/core/cpp/apps/metavision_player/src/camera_view.cpp @@ -128,13 +128,16 @@ CameraView::~CameraView() { if (live_) { // Update values of current biases - auto &cam = camera(); - try { - auto *bias = cam.biases().get_facility(); - for (auto p : biasLabelToName) { - current_biases[p.first] = bias->get(p.second); - } - } catch (...) {} + auto &cam = camera(); + const auto ¶ms = parameters(); + if (params.show_biases) { + try { + auto *bias = cam.biases().get_facility(); + for (auto p : biasLabelToName) { + current_biases[p.first] = bias->get(p.second); + } + } catch (...) {} + } } } diff --git a/sdk/modules/core/python/tests/CMakeLists.txt b/sdk/modules/core/python/tests/CMakeLists.txt index 993d7ebeb..5061e97b6 100644 --- a/sdk/modules/core/python/tests/CMakeLists.txt +++ b/sdk/modules/core/python/tests/CMakeLists.txt @@ -7,6 +7,6 @@ # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and limitations under the License. -lfs_download("datasets/metavision_core/csv_zip_eth") +lfs_download("datasets/openeb/core/event_io/csv_zip_eth") add_sdk_python_module_test(core) diff --git a/standalone_samples/metavision_evt3_raw_file_decoder/metavision_evt3_raw_file_decoder.cpp b/standalone_samples/metavision_evt3_raw_file_decoder/metavision_evt3_raw_file_decoder.cpp index 4b51971ef..98a5f5ca0 100644 --- a/standalone_samples/metavision_evt3_raw_file_decoder/metavision_evt3_raw_file_decoder.cpp +++ b/standalone_samples/metavision_evt3_raw_file_decoder/metavision_evt3_raw_file_decoder.cpp @@ -22,23 +22,22 @@ namespace Evt3 { // necessity and vector event data support. // This EVT3.0 event format avoids transmitting redundant event data for the time, y and x values. enum class EventTypes : uint8_t { - CD_Y = 0x0, // Identifies a CD event and its y coordinate - EM_Y = 0x1, // Identifies a EM event and its y coordinate - X_POS = 0x2, // Marks a valid single event and identifies its polarity and X coordinate. The event's type and - // timestamp are considered to be the last ones sent - X_BASE = 0x3, // Transmits the base address for a subsequent vector event and identifies its polarity and base X - // coordinate. This event does not represent a TD/EM sensor event in itself and should not be - // processed as such, it only sets the base x value for following VECT_12 and VECT_8 events. + EVT_ADDR_Y = 0x0, // Identifies a CD event and its y coordinate + EVT_ADDR_X = 0x2, // Marks a valid single event and identifies its polarity and X coordinate. The event's type and + // timestamp are considered to be the last ones sent + VECT_BASE_X = 0x3, // Transmits the base address for a subsequent vector event and identifies its polarity and base + // X coordinate. This event does not represent a CD sensor event in itself and should not be + // processed as such, it only sets the base x value for following VECT_12 and VECT_8 events. VECT_12 = 0x4, // Vector event with 12 valid bits. This event encodes the validity bits for events of the same type, // timestamp and y coordinate as previously sent events, while consecutive in x coordinate with - // respect to the last sent X_BASE event. After processing this event, the X position value + // respect to the last sent VECT_BASE_X event. After processing this event, the X position value // on the receiver side should be incremented by 12 with respect to the X position when the event was - // received, so that the X_BASE is updated like follows: X_BASE.x = X_BASE.x + 12 + // received, so that the VECT_BASE_X is updated like follows: VECT_BASE_X.x = VECT_BASE_X.x + 12 VECT_8 = 0x5, // Vector event with 8 valid bits. This event encodes the validity bits for events of the same type, // timestamp and y coordinate as previously sent events, while consecutive in x coordinate with - // respect to the last sent X_BASE event. After processing this event, the X position value + // respect to the last sent VECT_BASE_X event. After processing this event, the X position value // on the receiver side should be incremented by 8 with respect to the X position when the event was - // received, so that the X_BASE is updated like follows: X_BASE.x = X_BASE.x + 8 + // received, so that the VECT_BASE_X is updated like follows: VECT_BASE_X.x = VECT_BASE_X.x + 8 EVT_TIME_LOW = 0x6, // Encodes the lower 12b of the timebase range (range 11 to 0). Note that the TIME_LOW value is // only monotonic for a same event source, but can be non-monotonic when multiple event sources // are considered. They should however refer to the same TIME_HIGH value. As the time low has @@ -63,19 +62,19 @@ struct RawEventTime { uint16_t type : 4; // Event type : EventTypes::EVT_TIME_LOW OR EventTypes::EVT_TIME_HIGH }; -struct RawEventXPos { +struct RawEventXAddr { uint16_t x : 11; // Pixel X coordinate uint16_t pol : 1; // Event polarity: // '0': decrease in illumination // '1': increase in illumination - uint16_t type : 4; // Event type : EventTypes::X_POS + uint16_t type : 4; // Event type : EventTypes::EVT_ADDR_X }; struct RawEventVect12 { uint16_t valid : 12; // Encodes the validity of the events in the vector : // foreach i in 0 to 11 // if valid[i] is '1' - // valid event at X = X_BASE.x + i + // valid event at X = VECT_BASE_X.x + i uint16_t type : 4; // Event type : EventTypes::VECT_12 }; @@ -83,7 +82,7 @@ struct RawEventVect8 { uint16_t valid : 8; // Encodes the validity of the events in the vector : // foreach i in 0 to 7 // if valid[i] is '1' - // valid event at X = X_BASE.x + i + // valid event at X = VECT_BASE_X.x + i uint16_t unused : 4; uint16_t type : 4; // Event type : EventTypes::VECT_8 }; @@ -93,7 +92,7 @@ struct RawEventY { uint16_t orig : 1; // Identifies the System Type: // '0': Master Camera (Left Camera in Stereo Systems) // '1': Slave Camera (Right Camera in Stereo Systems) - uint16_t type : 4; // Event type : EventTypes::CD_Y OR EventTypes::EM_Y + uint16_t type : 4; // Event type : EventTypes::EVT_ADDR_Y }; struct RawEventXBase { @@ -101,7 +100,7 @@ struct RawEventXBase { uint16_t pol : 1; // Event polarity: // '0': decrease in illumination // '1': increase in illumination - uint16_t type : 4; // Event type : EventTypes::X_BASE + uint16_t type : 4; // Event type : EventTypes::VECT_BASE_X }; struct RawEventExtTrigger { @@ -172,14 +171,12 @@ int main(int argc, char *argv[]) { std::vector buffer_read(WORDS_TO_READ); // State variables needed for decoding - enum class EvType { CD, EM }; // To keep track of the current event type, event if we just decode CD in this example - EvType current_type = EvType::CD; bool first_time_base_set = false; Metavision::Evt3::timestamp_t current_time_base = 0; // time high bits Metavision::Evt3::timestamp_t current_time_low = 0; Metavision::Evt3::timestamp_t current_time = 0; - uint16_t current_cd_y = 0; - uint16_t current_x_base = 0; + uint16_t current_ev_addr_y = 0; + uint16_t current_base_x = 0; uint16_t current_polarity = 0; unsigned int n_time_high_loop = 0; // Counter of the time high loops @@ -208,84 +205,70 @@ int main(int argc, char *argv[]) { for (; current_word != last_word; ++current_word) { Metavision::Evt3::EventTypes type = static_cast(current_word->type); switch (type) { - case Metavision::Evt3::EventTypes::X_POS: { - Metavision::Evt3::RawEventXPos *ev_cd_posx = - reinterpret_cast(current_word); - if (current_type == EvType::CD) { - // We have a new Event CD with - // x = ev_cd_posx->x - // y = current_cd_y - // polarity = ev_cd_posx->pol - // time = current_time (in us) - cd_str += std::to_string(ev_cd_posx->x) + "," + std::to_string(current_cd_y) + "," + - std::to_string(ev_cd_posx->pol) + "," + std::to_string(current_time) + "\n"; - } + case Metavision::Evt3::EventTypes::EVT_ADDR_X: { + Metavision::Evt3::RawEventXAddr *ev_addr_x = + reinterpret_cast(current_word); + // We have a new Event CD with + // x = ev_addr_x->x + // y = current_ev_addr_y + // polarity = ev_addr_x->pol + // time = current_time (in us) + cd_str += std::to_string(ev_addr_x->x) + "," + std::to_string(current_ev_addr_y) + "," + + std::to_string(ev_addr_x->pol) + "," + std::to_string(current_time) + "\n"; break; } case Metavision::Evt3::EventTypes::VECT_12: { - uint16_t end = current_x_base + 12; + uint16_t end = current_base_x + 12; - if (current_type == EvType::CD) { - Metavision::Evt3::RawEventVect12 *ev_vec_12 = - reinterpret_cast(current_word); - uint32_t valid = ev_vec_12->valid; - for (uint16_t i = current_x_base; i != end; ++i) { - if (valid & 0x1) { - // We have a new Event CD with - // x = i - // y = current_cd_y - // polarity = current_polarity - // time = current_time (in us) - cd_str += std::to_string(i) + "," + std::to_string(current_cd_y) + "," + - std::to_string(current_polarity) + "," + std::to_string(current_time) + "\n"; - } - valid >>= 1; + Metavision::Evt3::RawEventVect12 *ev_vec_12 = + reinterpret_cast(current_word); + uint32_t valid = ev_vec_12->valid; + for (uint16_t i = current_base_x; i != end; ++i) { + if (valid & 0x1) { + // We have a new Event CD with + // x = i + // y = current_ev_addr_y + // polarity = current_polarity + // time = current_time (in us) + cd_str += std::to_string(i) + "," + std::to_string(current_ev_addr_y) + "," + + std::to_string(current_polarity) + "," + std::to_string(current_time) + "\n"; } + valid >>= 1; } - current_x_base = end; + current_base_x = end; break; } case Metavision::Evt3::EventTypes::VECT_8: { - uint16_t end = current_x_base + 8; + uint16_t end = current_base_x + 8; - if (current_type == EvType::CD) { - Metavision::Evt3::RawEventVect8 *ev_vec_8 = - reinterpret_cast(current_word); - uint32_t valid = ev_vec_8->valid; - for (uint16_t i = current_x_base; i != end; ++i) { - if (valid & 0x1) { - // We have a new Event CD with - // x = i - // y = current_cd_y - // polarity = current_polarity - // time = current_time (in us) - cd_str += std::to_string(i) + "," + std::to_string(current_cd_y) + "," + - std::to_string(current_polarity) + "," + std::to_string(current_time) + "\n"; - } - valid >>= 1; + Metavision::Evt3::RawEventVect8 *ev_vec_8 = + reinterpret_cast(current_word); + uint32_t valid = ev_vec_8->valid; + for (uint16_t i = current_base_x; i != end; ++i) { + if (valid & 0x1) { + // We have a new Event CD with + // x = i + // y = current_ev_addr_y + // polarity = current_polarity + // time = current_time (in us) + cd_str += std::to_string(i) + "," + std::to_string(current_ev_addr_y) + "," + + std::to_string(current_polarity) + "," + std::to_string(current_time) + "\n"; } + valid >>= 1; } - current_x_base = end; - break; - } - case Metavision::Evt3::EventTypes::CD_Y: { - current_type = EvType::CD; - - Metavision::Evt3::RawEventY *ev_cd_y = reinterpret_cast(current_word); - current_cd_y = ev_cd_y->y; + current_base_x = end; break; } - case Metavision::Evt3::EventTypes::EM_Y: { - current_type = EvType::EM; - // Even if we are not decoding EM, we still need to update this state variable, so that we know if the - // current state refers to CD or EM + case Metavision::Evt3::EventTypes::EVT_ADDR_Y: { + Metavision::Evt3::RawEventY *ev_addr_y = reinterpret_cast(current_word); + current_ev_addr_y = ev_addr_y->y; break; } - case Metavision::Evt3::EventTypes::X_BASE: { + case Metavision::Evt3::EventTypes::VECT_BASE_X: { Metavision::Evt3::RawEventXBase *ev_xbase = reinterpret_cast(current_word); current_polarity = ev_xbase->pol; - current_x_base = ev_xbase->x; + current_base_x = ev_xbase->x; break; } case Metavision::Evt3::EventTypes::EVT_TIME_HIGH: {