lossless-1080-qemu-5D3-vs-6D.html
lossless-1080-qemu-5D3-vs-70D.html
Hi there. There's some progress on a lossless RAW compression on 70D. Not as far, as I'd wish but still.
The starting point was a recent revision of crop_rec_4k_mlv_snd, where the stubs and two image size registers were already set. However, the compressed image shown heavy deviations from a reference non-compressed one. It was similar to the initial distortions seen on 6D and 650D.
Uncompressed FRSP vs. compressed FRSP:

I've found two solutions leading to a working losslessly compressed FRSP ("Full-res" option in Silent Picture sub-menu) and losslessly compressed LV buffer ("Simple" option).
1. Overriding register 0xC0F373B4
Whetever it really does, a value of 0 in register 0xC0F373B4 results in a valid compressed DNG.
EngDrvOut(0xC0F373B4, 0);
Interesting fact: originally the camera sets this register to 0x11. A similar change of another register, also from a value 0x11 to 0 is needed for 6D and 650D.
if (is_camera("6D", "*") ||
is_camera("650D", "*"))
{
/* not sure what exactly these do, but they seem to be required to get correct image
* taken from register log diffs: http://www.magiclantern.fm/forum/index.php?topic=18443.msg197987#msg197987 */
EngDrvOut(0xC0F37610, 0); /* 0x11 on 650D, 0 on all other D5 (not sure if needed) */
2. Second, independent solution is an overriding of register 0xC0F373F4
This one is really interesting.
Original log from the 70D:
[0xC0F373F4] <- 0x7FFF7FFF: ???
[0xC0F373F8] <- 0x1111BBBB: ???
The first register contains two 16-bit words, which seem to define horizontal and vertical boundaries of a slice, which should get somehow processed.
By lowering the least significant word ([0xC0F373F4] <- 0x7FFF1111) we get such a picture:

By lowering also the most significant word ([0xC0F373F4] <- 0x01000A00) it looks like this:

What it really is used for, I've no idea.
Changing any (or both) of the words to 0x0000 will give us a nice, valid, losslessly compressed DNG. E.g:
EngDrvOut(0xC0F373F4, 0x7FFF0000);
I wasn't able to find the meaning of the second mentioned register. There was no visible difference when changing it. Maybe it refers to another processing mode of the compressor module or maybe to a different write channel?
Interesting fact: similar values can be seen other cameras; here 5D3:
177 [0xC0F375B8] <- 0x7FFF7FFF: ???
178 [0xC0F375BC] <- 0x7FFF7FFF: ???
179 [0xC0F375C0] <- 0x7FFF7FFF: ???
180 [0xC0F375C4] <- 0x7FFF7FFF: ???
181 [0xC0F375C8] <- 0x7FFF7FFF: ???
182 [0xC0F375CC] <- 0x7FFF7FFF: ???
183 [0xC0F375D0] <- 0x7FFF0000: ???
184 [0xC0F375D4] <- 0x7FFF0000: ???
185 [0xC0F375D8] <- 0x7FFF7FFF: ???
186 [0xC0F375DC] <- 0x7FFF7FFF: ???
187 [0xC0F375E0] <- 0x7FFF7FFF: ???
The miniature picture embedded in DNG is unfortunately all black in the compressed files (despite being fine on the uncompressed FRSP). But I don't see it as an issue now, as it's same on 700D.
Now the sad part. Despite silent pictures are working very well with these changes, the compressed MLV still doesn't. The symptoms are still like in the past:
#dfort tried installing your latest crop rec4k for 70D. after installing i turn On crop rec and mlv lite. restart my camera. no buttons would work after that. i tried reinstalling your build 2 times but no luck
with your latest build i get this FRSP https://files.fm/u/3kc5sbt if i activate mlv lite, recording button nad trast button dont response
Describing it a bit more detailed:
If mlv_lite is activated and configured to 14-bit uncompressed, the camera will normally record MLV.
If being already in the movie mode, opening ML menu, changing bit-depth to 14-bit lossless: the ML menu will freeze immediately just after highlighting this option (without clicking SET button). No reaction to menu navigation, ML menu can't be closed. However, the cam still works, it can be switched to photo mode and will work normally showing "Raw detect error" for a while.
When being in photo mode, you can select 14-bit lossless in RAW video menu. Apparently there is no initialization of buffers/compressor executed at that point. When switching the camera to movie mode the buttons themself are working properly. ML console shows even "REC key pressed" (when pressed) and "Starting raw recording..." but the recording doesn't start. You can enter ML menu but it will freeze as soon as you change the tab to Movie. To unfreeze the menu: change mode to photo.
I have a feeling it will unfortunately not be enough to play with some more registers in lossless.c to fix the RAW video. I've "simulated the 650D" behaviour with wrongly configured compressor by applying wrong values on 700D.

Result: silent picuteres had distorted colors but the lossless MLV were still working (with distorted colors as well).
Could it rather be related to some buffer allocation, conflicting resources or waiting for flags/semaphores? How can it be further debugged?
1. What is exactly executed as soon as the 14bit lossless option is only highlighted in the ML menu when being in the video mode?
2. What and how to debug? I have already compiled with #define RAW_DEBUG but I don't know how to store the content of the console to a file O_o
3. How does compression differ in photo mode ("simple" option should be the LV buffer?) from movie mode?
4. Can these be conflicticting/wrong EDMAC resources in video mode? I am reluctant to play around with it on my own, as I have no idea how it works but it's clear for me, that a wrong change might results in "random" writes into any memory area.
5. Any other ideas...?