CarVac / librtprocess

A project to make RawTherapee's processing algorithms more readily available.
Other
53 stars 24 forks source link

IGV crash (non-SSE2) #68

Closed masc4ii closed 2 years ago

masc4ii commented 2 years ago

In line 506 of igv.cc I always get a crash when trying to run the function. This line is code of the non-SS2 IGV version. I compiled on ARM which has no SS2. When changing line 44 to make use of this version on Intel CPUs, the same crash happens.

Line 503-507: for (int row = 0; row < height - 0; row++) for (int col = 0, indx = row * width + col; col < width - 0; col++, indx++) { int c = fc(cfarray, row, col); rgb[c][indx] = CLIP(rawData[row][col]); //rawData = RT datas }

On crash, the debugger tells for my test: c = 2 indx = 484417 row = 0 col = 1 width = 1856 height = 1044

For me it looks like indx is wrong - but why?! I would expect indx = 1 at this time. Any idea?

masc4ii commented 2 years ago

When stepping through the lines with my debugger, indx is correct until 2nd call of fc(...). cfarray should be unsigned cfa[2][2] = { { 0, 1 }, { 1, 2 } }; but debugger tells it is kind of unsigned cfa[2] = { 0, 1 }; Should be the reason... but why this happens?!

masc4ii commented 2 years ago

All parameters const unsigned cfa[2][2] are interpreted as 1D array of size 2, my debugger tells - also for other debayer algorithms. Only IGV is crashing.

masc4ii commented 2 years ago

I compared the code to another older igv implementation and got it working now. See my fix here:

https://github.com/ilia3101/MLV-App/commit/b1dfc6b610f4ba75358cfe1902061ae056d86d93

Feel free to commit in your repos...

heckflosse commented 2 years ago

@masc4ii Can you please make a PR with your changes?

masc4ii commented 2 years ago

Here you are: https://github.com/CarVac/librtprocess/pull/70

I tested this in MLVApp on Apple M1 natively.