From 8bfa9943abe90c58c178bc0843060fc72d2c02bd Mon Sep 17 00:00:00 2001 From: Ankit Sinha Date: Mon, 30 Sep 2024 14:16:36 +1000 Subject: [PATCH] feat(raw): raw reader - exposing max_raw_memory_mb (#4454) PR is to address https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/3881 feature request. The reported wanted to expose `imgdata.rawparams.max_raw_memory_mb` as `raw:max_raw_memory_mb` --------- Signed-off-by: Ankit Sinha --- src/doc/builtinplugins.rst | 5 +++++ src/raw.imageio/rawinput.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/doc/builtinplugins.rst b/src/doc/builtinplugins.rst index 8bc3f7e93f..907fba6dab 100644 --- a/src/doc/builtinplugins.rst +++ b/src/doc/builtinplugins.rst @@ -2179,6 +2179,11 @@ options are supported: 0 - do not use FBDD noise reduction, 1 - light FBDD reduction, 2 (and more) - full FBDD reduction (Default: 0) + * - ``raw:max_raw_memory_mb`` + - int + - Maximum memory allocation for processing of raw images. Stop processing if + raw buffer size grows larger than that value (in megabytes). + (Default: 2048) | diff --git a/src/raw.imageio/rawinput.cpp b/src/raw.imageio/rawinput.cpp index 40e1d8c922..610110448b 100644 --- a/src/raw.imageio/rawinput.cpp +++ b/src/raw.imageio/rawinput.cpp @@ -453,6 +453,11 @@ RawInput::open_raw(bool unpack, const std::string& name, // Output 16 bit images m_processor->imgdata.params.output_bps = 16; + // Exposing max_raw_memory_mb setting. Default max is 2048. + m_processor->imgdata.rawparams.max_raw_memory_mb + = config.get_int_attribute("raw:max_raw_memory_mb", 2048); + + // Disable exposure correction (unless config "raw:auto_bright" == 1) m_processor->imgdata.params.no_auto_bright = !config.get_int_attribute("raw:auto_bright", 0);