From d4fb0bb63b03224f3f395100631400719ac64041 Mon Sep 17 00:00:00 2001 From: Georges Berenger Date: Mon, 20 Nov 2023 16:50:17 -0800 Subject: [PATCH] Add helper method to set decimation Summary: Simple time base decimation is too complex to set. This helper will help... Reviewed By: kiminoue7 Differential Revision: D51460326 fbshipit-source-id: d9fa723b7c0f729c8f8a093bcb27e935ed9c1255 --- vrs/utils/FilteredFileReader.cpp | 6 ++++++ vrs/utils/FilteredFileReader.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/vrs/utils/FilteredFileReader.cpp b/vrs/utils/FilteredFileReader.cpp index 8cad3836..0ad65943 100644 --- a/vrs/utils/FilteredFileReader.cpp +++ b/vrs/utils/FilteredFileReader.cpp @@ -276,6 +276,12 @@ void FilteredFileReader::constrainTimeRange(double& inOutStartTimestamp, double& } } +void FilteredFileReader::decimateByInterval(double minIntervalSec) { + utils::DecimationParams params; + params.bucketInterval = minIntervalSec; + decimator_ = make_unique(*this, params); +} + void FilteredFileReader::getConstrainedTimeRange( double& outStartTimestamp, double& outEndTimestamp) { diff --git a/vrs/utils/FilteredFileReader.h b/vrs/utils/FilteredFileReader.h index 9e882917..a97055d9 100644 --- a/vrs/utils/FilteredFileReader.h +++ b/vrs/utils/FilteredFileReader.h @@ -173,6 +173,9 @@ struct FilteredFileReader { // Constrain the given time range to the current filter's time constraints void constrainTimeRange(double& inOutStartTimestamp, double& inOutEndTimestamp) const; + // Decimate data record with a minimum time interval + void decimateByInterval(double minIntervalSec); + // Apply filters, which can only be done after the file was opened already void applyFilters(const RecordFilterParams& filters); void applyRecordableFilters(const vector& filter);