Skip to content

Commit

Permalink
Merge branch 'bugfix/snr_free' into 'master'
Browse files Browse the repository at this point in the history
Bugfix for SNR function to free the calculation array.

See merge request idf/esp-dsp!127
  • Loading branch information
dmitry1945 committed Nov 4, 2024
2 parents 037701e + e2c4d11 commit a1786c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Changed
- Bugfix for SNR calculation: free array in case of error
- Bugfix for determinant calculation in mat.cpp

### Added
Expand Down
2 changes: 1 addition & 1 deletion modules/support/snr/float/dsps_snr_f32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ float dsps_snr_f32(const float *input, int32_t len, uint8_t use_dc)
}
}

delete[] temp_array;
noise_power += std::numeric_limits<float>::min();
if (noise_power < max * 0.00000000001) {
return 192;
}
delete[] temp_array;
float snr = max / noise_power;
float result = 10 * log10(max / noise_power) - 2; // 2 - window correction
ESP_LOGI(TAG, "SNR = %f, result=%f dB", snr, result);
Expand Down

0 comments on commit a1786c8

Please sign in to comment.