Skip to content

Commit 05e3701

Browse files
committed
Refactor: applied named constants (MSE, SSIM, FLOW thresholds) in constructor init
1 parent 49c3a0d commit 05e3701

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/deepstream/probes/frame_comparison/gpu/frame_change_detector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const double OPTICAL_FLOW_ACTIVE_THRESH = 0.5;
1313
std::unique_ptr<GPUFrameChangeDetector> GPUFrameChangeDetector::instance = nullptr;
1414

1515
GPUFrameChangeDetector::GPUFrameChangeDetector()
16-
: mse_thresh(500.0), ssim_thresh(0.99), flow_thresh(2.0), initialized(true) {}
16+
: mse_thresh(MSE_THRESH), ssim_thresh(SSIM_THRESH), flow_thresh(FLOW_THRESH), initialized(true) {}
1717

1818
GPUFrameChangeDetector* GPUFrameChangeDetector::getInstance() {
1919
if (!instance) {
@@ -121,7 +121,7 @@ GPUFrameChangeDetector::should_process_gpu_direct(const cv::cuda::GpuMat& gpu_fr
121121
double ssim_val = simple_ssim_gpu(prev_frame_gpu, processed_curr);
122122
double flow_val = optical_flow_gpu(prev_frame_gpu, processed_curr);
123123

124-
bool is_static = (mse_val < MSE_THRESH && ssim_val > SSIM_THRESH && flow_val < FLOW_THRESH);
124+
bool is_static = (mse_val < mse_thresh && ssim_val > ssim_thresh && flow_val < flow_thresh);
125125

126126
prev_frame_gpu = processed_curr;
127127

Binary file not shown.

0 commit comments

Comments
 (0)