MLV-App icon indicating copy to clipboard operation
MLV-App copied to clipboard

Win32: caching not working

Open masc4ii opened this issue 6 years ago • 12 comments

I tested some functions on Windows with the 32bit version. When enabling caching, the app crashes or the indicator in the statusbar says "idle". :-( No such problems on OSX.

masc4ii avatar Nov 01 '17 20:11 masc4ii

Yeah... that's bad :(, I'll take a look at it.

bouncyball-git avatar Nov 02 '17 06:11 bouncyball-git

It always bails out on line 245 of frame_caching.c. There are static castings of float to uint16_t of rgb data taken from the amaze demozaic. I can not understand why it crashes because all seems ok (pix pointer seems in bounds)

bouncyball-git avatar Nov 02 '17 12:11 bouncyball-git

In latest revision it is still line 262 of frame_caching.c causing the problem:

...
pix[0] = (uint16_t)MIN(red1d[i], 65536);
...

masc4ii avatar Dec 07 '17 11:12 masc4ii

Yes in win32.

bouncyball-git avatar Dec 07 '17 12:12 bouncyball-git

Do we really need the Win32 version? Link

bouncyball-git avatar Jan 20 '18 16:01 bouncyball-git

Me not... but it is still the only Win version I can compile and debug... no idea how to compile a 64 bit version :-D The good thing with the 32bit version: you can run it on Wine -> you can run it even on OSX 10.6.8 :-D

masc4ii avatar Jan 20 '18 16:01 masc4ii

OK these are enough reasons :)

bouncyball-git avatar Jan 20 '18 17:01 bouncyball-git

I can't tell why... but caching on Win32 version does work now, at least for me. Can someone else try with latest commit? There was changed a lot in terms of debayering... who knows...

masc4ii avatar Aug 07 '18 13:08 masc4ii

Another day, another try, another crash... 😛

masc4ii avatar Aug 08 '18 08:08 masc4ii

Shit ;)

bouncyball-git avatar Aug 08 '18 08:08 bouncyball-git

Found out why it crashes:

frame_caching.c line 258

        uint16_t * out = video->rgb_raw_frames[cache_frame];
        for (uint32_t i = 0; i < pixelsize-10; i++)
        {
            uint16_t * pix = out + (i*3);
            pix[0] = (uint16_t)MIN(red1d[i], 65535);
            pix[1] = (uint16_t)MIN(green1d[i], 65535);
            pix[2] = (uint16_t)MIN(blue1d[i], 65535);
        }

The debugger tells, video->rgb_raw_frames[cache_frame] = 0, so the memory allocation seems to fail before. But if I check using breakpoints, all seems to be fine. No idea, why it is 0 here...

masc4ii avatar Aug 08 '18 13:08 masc4ii

Problem seems to come from setMlvRawCacheLimitMegaBytes(), after realloc of video->cache_memory_block, this one is zero. In the for loop after realloc, video->rgb_raw_frame is zero too. I tried to exchange realloc with free and malloc, problem persists. All other variables look not bad, only the two buffers are 0.

masc4ii avatar Aug 08 '18 14:08 masc4ii