[Lcms-user] One More Possible Important Compiler Warning
An ICC-based CMM for color management
Brought to you by:
mm2
From: Noel C. <NCa...@Pr...> - 2017-08-09 18:34:24
|
Hi Marti, By the way, there is one more possibly important warning you should think about addressing for release 2.9, this time issued from the VS 2017 Code Analyzer: c:\dev\prodigital\trunk\libraries\littlecms\src\cmsgamma.c(1153): warning C6262: Function uses '49196' bytes of stack: exceeds /analyze:stacksize '16384'. Consider moving some data to heap. This is because of the following code, in cmsgamma.c: // Maxim number of nodes #define MAX_NODES_IN_CURVE 4097 ... // Smooths a curve sampled at regular intervals. cmsBool CMSEXPORT cmsSmoothToneCurve(cmsToneCurve* Tab, cmsFloat64Number lambda) { cmsFloat32Number w[MAX_NODES_IN_CURVE], y[MAX_NODES_IN_CURVE], z[MAX_NODES_IN_CURVE]; The w, y, and z arrays are a bit on the large size for stack variables. I did some reading on Windows stack allocations and the stack may be quite limited under some conditions. It's possible the same applies to other architectures too. I recommend considering changing the code to malloc several temporary buffers instead of allocating blocks of stack space. Here's a suggested implementation using _cmsCalloc / _cmsFree, and which is more structured and now properly reports all errors. It passes all tests and performance is good, per the testbed, though I recommend a very careful review. Both the current Github code and proposed new code blocks are in this file. Compile the new code for comparative testing by defining the symbol PRODIGITAL_OPTIMIZATIONS, which can also be used to find the changes in the source. http://Noel.ProDigitalSoftware.com/temp/cmsgamma_proposed_changes.zip Please let me know if you have questions. -Noel |