Skip to content

Commit 6f59736

Browse files
committed
Allow truncation of extreme data values during float to int32 conversion
1 parent 7d835d4 commit 6f59736

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

flacarray/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
# Set the log level
1515
logging.basicConfig(level=log_level)
1616

17-
__version__ = "0.2.2"
17+
__version__ = "0.2.3"
1818

1919
from .array import FlacArray

flacarray/libflacarray/utils.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,13 @@ int float32_to_int32(
239239
} else {
240240
// We are using a pre-defined quanta per stream.
241241
squanta = quanta[istream];
242-
if (squanta < min_quanta) {
243-
// The requested quanta is too small
244-
return ERROR_CONVERT_TYPE;
245-
}
242+
// Commented out, since there might be times when the
243+
// user wants to truncate the peaks of the data.
244+
//-----------------------------------------------------
245+
// if (squanta < min_quanta) {
246+
// // The requested quanta is too small
247+
// return ERROR_CONVERT_TYPE;
248+
// }
246249
}
247250

248251
if (squanta == 0) {
@@ -313,10 +316,13 @@ int float64_to_int32(
313316
} else {
314317
// We are using a pre-defined quanta per stream.
315318
squanta = quanta[istream];
316-
if (squanta < min_quanta) {
317-
// The requested quanta is too small
318-
return ERROR_CONVERT_TYPE;
319-
}
319+
// Commented out, since there might be times when the
320+
// user wants to truncate the peaks of the data.
321+
//-----------------------------------------------------
322+
// if (squanta < min_quanta) {
323+
// // The requested quanta is too small
324+
// return ERROR_CONVERT_TYPE;
325+
// }
320326
}
321327

322328
if (squanta == 0) {

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build-backend = "mesonpy"
99

1010
[project]
1111
name = "flacarray"
12-
version = "0.2.2"
12+
version = "0.2.3"
1313
description = "FLAC Compression of Arrays"
1414
readme = "README.md"
1515
maintainers = [

0 commit comments

Comments
 (0)