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

MLV App cannot deal with black level 0

Open ilia3101 opened this issue 5 years ago • 34 comments

For MLV App to support the future of MLV, it will need to support black level at 0. Cameras like Apertus, Nikon, Sony and Arri can often have 0 black level.

Currently, when the value is zero, MLV App seems to think black level is something much higher than zero, so it produces a very green/black image, and the only fix is to set black level to 1, which looks close enough, but is technically wrong.

I think MLV App uses black level being set to zero as some sort of flag for black level repair? Not sure how this part works.

A black level of zero does bring back the debayer issues we had when trying to subtract it. But this is a separate issue.

ilia3101 avatar Oct 13 '19 12:10 ilia3101

I have to search in code, but I think you are right: 0 should be some flag for some functionality, but I forgot about. In past we thought that there will never be a clip with 0 black level.

masc4ii avatar Oct 13 '19 13:10 masc4ii

isn't this black level feature from bouncyball? I guess we can wait for a bit until he is here again, as it should be easier for him to fix it than us.

ilia3101 avatar Oct 13 '19 18:10 ilia3101

We had to work together in this regard, because we had very big problems with this black level slider. In the first 15min of searching, I did not find the important part yet... have to search more...

masc4ii avatar Oct 13 '19 18:10 masc4ii

Okay... I am now ready and read all the black level related code. And I found the code parts, where I discussed so long with bouncyball and I remember. But it was related to "original black level" and "corrected black level". We save the black level from the MLV in a extra variable, and the slider overwrites the MLV header value. On doubleclick on slider, the original value is written again into MLV header value. In the GUI code the black level is initialized with "-1" as "unknown". But this should all not be the problem.

    if( receipt->rawBlack() != -1 )
    {
        ui->horizontalSliderRawBlack->setValue( receipt->rawBlack() );
    }

Could you send me such a file with blacklevel=0 for analysis?

masc4ii avatar Oct 13 '19 18:10 masc4ii

coming in 1 second!

ilia3101 avatar Oct 13 '19 19:10 ilia3101

Apple update has completely broken my compiling, so I can only provide a older, possibly glitchy 16 ish bit file, but I think it shows the issue as it has 0 black level.

D700.mlv.zip

ilia3101 avatar Oct 13 '19 19:10 ilia3101

Okay reproduced. But it should be a problem on loading the MLV. Blacklevel=0 works! Just on loading the MLV it is set to something about 5000. Enter =1 and then =0, and it works. I have to debug... I would start searching in the GUI for that.

masc4ii avatar Oct 13 '19 20:10 masc4ii

Well it works if you set to 1 and then 0, but it's still at 1 in reality. Try setting 2000 and after that 0, it clearly stays at 2000 so I assume it also stays at 1 when you do what you said. I think it is necesarry to fix 0 capabilty, as the difference between 1 and 0 may be noticable with 10 bit footage.

I remember being really confused by this bug a few months ago, don't think I had any success tracking it down.

ilia3101 avatar Oct 13 '19 20:10 ilia3101

Well it works if you set to 1 and then 0, but it's still at 1 in reality. Try setting 2000 and after that 0, it clearly stays at 2000 so I assume it also stays at 1 when you do what you said.

Sh**... you're right. That's bad. 😢

masc4ii avatar Oct 13 '19 20:10 masc4ii

😢

ilia3101 avatar Oct 13 '19 20:10 ilia3101

Found and fixed it. https://github.com/ilia3101/MLV-App/commit/e286c9154ce73b4ebdd2b6efd49dfab3d8066c26 Please try.

masc4ii avatar Oct 13 '19 20:10 masc4ii

I see another problem with your Nikon-MLV file... there are blue dots with all debayer algorithms - just AHD is fine:

AMaZE: Bildschirmfoto 2019-10-14 um 11 23 15

AHD: Bildschirmfoto 2019-10-14 um 11 23 26

masc4ii avatar Oct 14 '19 09:10 masc4ii

Yep, blue dots. Must be a MLV App specific issue, as I think rawtherapee does subtraction before debayer and has no issues with these algorithms. Strangest issue I have ever seen though.

To fix this (until a real fix is found), I think we should just raise the blacks if it is below a certain value (and then correct after debayering).

ilia3101 avatar Oct 14 '19 10:10 ilia3101

Wow you fixed it!!!

ilia3101 avatar Oct 14 '19 10:10 ilia3101

Can confirm it work! this is amazing.

Unrelated, but did you notice how much cleaner the Nikon file is than all the Canon images we normally see in MLV App? Literally zero noise ...

ilia3101 avatar Oct 14 '19 10:10 ilia3101

Noise looks not bad, yes, but I've never seen a Canon fullres picture in MLVApp. I thought most of the noise comes from lineskipping...

You can raise the blacks to 15500, then you just see the blue dots. 😄 You mean to sum with a positive offset before debayer and to subtract it afterwards? I'll try out.

masc4ii avatar Oct 14 '19 17:10 masc4ii

To fix this (until a real fix is found), I think we should just raise the blacks if it is below a certain value (and then correct after debayering).

Crazy... this really works! Edit: did the temp fix for now.

masc4ii avatar Oct 14 '19 17:10 masc4ii

Noise looks not bad, yes, but I've never seen a Canon fullres picture in MLVApp. I thought most of the noise comes from lineskipping...

Maybe. I still get a lot of noise in 1:1 crop video though. I looked at a Canon 600D picture through MLV App, it was a lot noisier than the nikon pic. I have to try with one of my 5D mark 2 pictures, I have a feeling video mode might be adding a lot of noise.

ilia3101 avatar Oct 14 '19 19:10 ilia3101

Would be interesting to compare a .cr2 with a fullres MLV, or at least with a crop - at same settings. It is possible you are right with your feeling.

masc4ii avatar Oct 14 '19 19:10 masc4ii

Did you manage to compile the raw2mlv tool included in LibMLV?

just run the ./compile bash script in raw2mlv folder then you can try it. (interesting to find out if it works for you also on OSX 10.9)

ilia3101 avatar Oct 15 '19 15:10 ilia3101

I tried, but it failed because of LibRAW. I bet I need it as well? Which version do I need and where do I install it? Do I have to compile it as well?

masc4ii avatar Oct 15 '19 15:10 masc4ii

Try running the script now, it should work now (downloads libraw for you). It doesn't install anything, just links statically.

ilia3101 avatar Oct 15 '19 16:10 ilia3101

The LibRAW download did not work in the script. I had to download and copy the file manually, and then I got it compiled. Works on 10.9.5. I converted a 5D2 cr2 picture, and it opens fine in MLVApp.

masc4ii avatar Oct 15 '19 17:10 masc4ii

Ah so it does not work on older macOS

ilia3101 avatar Oct 16 '19 16:10 ilia3101

I don't know which of the commands... manually it works. So I think there should be a way doing it by script as well.

masc4ii avatar Oct 16 '19 16:10 masc4ii

Where I can find LibMLV? Shit I've been missed so long...

@masc4ii: BTW Danne presented me the eos-m! So now I'm in the mirrorless club too. Just waiting for my batteries and EF to EF-M adapted to roll on... :)

bouncyball-git avatar Oct 16 '19 18:10 bouncyball-git

https://github.com/ilia3101/LibMLV

Haha... great! It is a nice little camera! The anamorphic modes are great! Batteries are important!

masc4ii avatar Oct 16 '19 19:10 masc4ii

Whoa! For a moment I thought Nikon was hacked to the MLV recording point! And wanted to search teh web ;)

@ilia3101: Great idea to convert any libraw supported still raw image to MLV to edit it in mlvap!!! Great project!

bouncyball-git avatar Oct 16 '19 19:10 bouncyball-git

Where I can find LibMLV? Shit I've been missed so long...

Very nice to have you back!

LibMLV is not much yet, so far I only uploaded the MLV writing part and a small converter program. The reading part is not done yet. Trying to avoid all the mistakes I made in MLV App (taking time).

Some discussion on this thread: https://www.magiclantern.fm/forum/index.php?topic=24386.0

I hope to release all my code under MIT license (or anything permissive like that). So everything needs to be original.

ilia3101 avatar Oct 16 '19 19:10 ilia3101

COOL! You even woke up g3gg0!!! hahaha

bouncyball-git avatar Oct 16 '19 19:10 bouncyball-git