crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView

Started by a1ex, April 01, 2017, 11:15:41 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.



Walter Schulz



Walter Schulz

Do the following configurations work for you?
- mlv_lite, mlv_snd, crop_rec (do *not* load mlv_rec!)
- mlv_rec, mlv_snd (do *not* load mlv_lite! Do *not* load crop_rec!)


yes....I can't enable togheter CROP_REC.mod and MLV_REC.mod  or I have error when I turn ON 5d3 and I enter in ML menu'

but if I enable CROP & fine , and there is audio rec too !

what I not undestand, is ..what you can NEED MLV_REC.mod ?



Fiddling with adtg_gui on the 6d, but not much luck.

Does anybody know how I change these N type registers in ADTG_gui ?
When I select them to override, the value changes, it's not hexadecimal anymore once overriden, how do I set these values ?

I can get all type of resolutions, full sensor width, 5472 x960, also, 3072 x 960 and 2880 x 960, but I can't get normal raw data image preview, so the resulting image is a mess  :P


Quote from: jimiz on February 26, 2018, 12:03:14 PM
what I not undestand, is ..what you can NEED MLV_REC.mod ?

I believe I have seen some conversations that now that mlv_lite has sound, mlv_rec is no longer necessary. But that only happened a couple weeks ago, so give it time.


Quote from: Levas on February 26, 2018, 12:05:54 PM
Does anybody know how I change these N type registers in ADTG_gui ?

The N registers are NRZI-encoded (at least on 5D3; on other models YMMV).

This should help (same as these, but in Python):

def nrzi_decode(in_val):
    val = 0
    if in_val & 0x8000:
        val |= 0x8000;
    for num in range(31):
        old_bit = (val & 1<<(30-num+1)) >> 1;
        val |= old_bit ^ (in_val & 1<<(30-num));
    return val;

def nrzi_encode(in_val):
    out_val = 0;
    old_bit = 0;
    for num in range(31):
        bit = 1 if in_val & 1<<(30-num) else 0;
        if (bit != old_bit):
            out_val |= (1 << (30-num));
        old_bit = bit;
    return out_val;

Registers 0x805E / 0x8060 (shutter blanking = frame duration - exposure time) are NRZI on all models, and a good candidate for understanding how they work.

I can get all type of resolutions, full sensor width, 5472 x960, also, 3072 x 960 and 2880 x 960, but I can't get normal raw data image preview, so the resulting image is a mess  :P

Full width is actually great news (assuming ML "grayscale" preview and/or recorded MLVs are OK).

Yes, the real-time preview is going to be broken for anything with modified horizontal resolution. The registers to fix it are somewhere in these logs - good luck figuring out which ones :D

That's massive progress btw - two weeks ago I was completely clueless where to start looking; now I believe I've narrowed it down to a few thousand registers :D

BTW - next steps for understanding how to fix the preview (just in case anyone might want to help):
- annotating known registers in these logs (easy, see g3gg0's signature)
- plugging the register values from the above logs in QEMU (definitely not an easy coding task)
- trying to understand what they do (lots of registers, plenty of low-hanging fruit, plenty of difficult ones, very time consuming)

Walter Schulz

Quote from: jimiz on February 26, 2018, 12:03:14 PM
what I not undestand, is ..what you can NEED MLV_REC.mod ?

Keep in mind we are working within an experimental branch derived from "main" (unified) nightly build. Nightly build's mlv_lite does not support audio (yet). Killing mlv_rec in experimental has no priority and might complicate - I suppose - merging experimental build results back into "unified".


Quote from: a1ex on February 26, 2018, 12:20:33 PM
Full width is actually great news (assuming ML "grayscale" preview and/or recorded MLVs are OK).

Unfortunately, the ML preview is also a mess, as are the recorded MLV's  :P

Quote from: a1ex on February 26, 2018, 12:20:33 PM
That's massive progress btw - two weeks ago I was completely clueless where to start looking; now I believe I've narrowed it down to a few thousand registers :D

O jus a few thousand registers  to try, I'm almost there ;D



Sounds ideal, a computer that does the the moment I'm doing the 'boring' trail and error work :P

The build I'm using to test this gives memory patches, once I enable adtg_gui module:
Just wondering, is this normal ?


Right, the display could be a little nicer. Maybe it could use a built-in disassembler?


But is it normal ?
I'm using kind of Frankenstein build.
Didn't compile this myself, using the 6d 4 februari build from Dfort and a from another build from Dfort, probably a few builds before that.

Haven't find out how to compile a normal adtg_gui module myself.
When I compile a adtg_gui module from the normal Hudson magic-lantern build - updated for Crop_rec_4k, I get a very different adtg_gui than I have from Dfort ?
The one in the Hudson-Crop_rec_4K is very basic and doesn't have the advanced options ???

What do I have to clone, pull&update to be able to compile a very clean build with the latest normal adtg_gui ?


Try this one:

If you really want to modify the source, try the iso-research branch. Most modules should be interchangeable with crop_rec_4k.


Thanks for the commit, now I can get 5208x3240 and this really close of 5208x3490, I couldn't take a picture with (I could do it in 5208x2624) I was able to get one frame with mlv_lite but sometimes I got blank MLV file with size of 24mb and other one was 49mb (maybe this happen with loading other modules?) .

But still I wasn't able to get the full resolution when I adjust the register for that I got frozen live view, I think this related to the buffer? I can get the full height (with corrupted frames need to adjust something to fix it but not frozen) by decreasing horizontal resolution at same other registers settings.

Quote from: a1ex on February 22, 2018, 06:52:35 PM
You need to use a slightly smaller amount because our memory backend also has some overhead.

So should I lower the resolution to the native .cr2 5184x3456 and maybe more?

-- The camera freezes when using adtg_gui with 720p 50/60, any solution ?

These two registers have same value for shutter speed on 700D to getting high shutter speed on low fps:

Maybe it's known, but for documenting.



Quote from: nikfreak on February 22, 2018, 09:05:04 PM
indeed great news. Keep up your work.
Crossing fingers. Maybe a PR with some useful "presets" would make 700D owners happy - though it's not 1st April yet.
I hope it works fine especially for 3K at 23.976, but it seems like these small cameras are limited to get that fps in higher resolutions.
But it's still cool  8)

Quote from: reddeercity on February 22, 2018, 09:43:02 PM
Good Job  ;)
Thank you, we are waiting for 5D2  :D

This good news to 6d!
Maybe the 6d will be more similar to 5D3 (look into crop_rec.c) , but I wrote a small guide for my little experiment on this for anyone need to try:

I am talking about 700D for getting custom resolutions, the other cameras have DIGIC 5 will be similar too (not in everything you should discover somethings):

You have 30fps in the box, you will pay fps for more resolution (vice versa) and the higher resolution you already have in x5 mode (2520x1080 on 700D \ 3584x1320 on 5D3 without crop_rec) the more resolution you will get at 23.976 fps without corrupted frames for example.

Some informations:

Basic informations must read.

Any register has 3 parts  (and more), 0x this is not a part.
e.g. In 1080p at 25fps Timer B C0F06014 = 0x7cf

If you change:
The left part you will get Large step changing in the register          Ex: 7 to 6 the fps will be 28.669
The middle part you will get Medium step changing in the register  Ex: c to d the fps will be 25.201
The right part you will get Small step changing in the register        Ex: f to e the fps will be 25.012

Some registers have two Main parts and every part is for controlling specific thing EX:

C0F06804 = 0x4540298         454 = Vertical resolution         298 = Horizontal resolution (There are a math for calculate the actual frame size I didn't know it).

Increasing Timer A  (Lowering the fps via timer A) is very important for increasing Horizontal resolution.
Increasing Timer B  (Lowering the fps via timer B) is very important for increasing Vertical resolution.

I usually start with x5 mode.

For increasing Horizontal resolution:

First of all you should increase FPS Timer A (lowering the fps) and increase the registers related to it (C0F0600c - C0F06010):

On x5 mode  C0F06008 = 0x2cb02cb
Now increase one Large step :
C0F06008 = 0x3cb03cb  You will notice the lowering in fps in live view (Press magnification button multiple time to see the update).

In C0F06804 :
Change C0F06804 = 0x4540298 to C0F06804 = 0x4540328 and make update (Magnification button) you will see the broken live view and frames, and the resolution will not increase because of the registers related to it didn't change yet which are:

C0F06824 = 0x2ca
C0F06828 = 0x2ca
C0F0682c = 0x2ca
C0F06830 = 0x2ca

All of these registers has the same value and if you missed one of them you probably will have frozen live view. Now increase them one large step
to 0x3ca

Make update and see the increase in resolution, safe frames with broken live view!

Okay if you had black bar in the left of the image you must now correct the offset via CMOS 5 for vertical offset.
Try decreasing/increasing it to get the correct value (trial and error).

Now for increasing Vertical resolution:

1-Lower the fps via Timer B.
2-Increase the registers related to it which are:

ADTG[8172] N = 0x67c   One large step   0x77c
ADTG[8178] N = 0x67c   One large step   0x77c

C0F0713c = 0x455  One large step  0x555  (If you increase/decrease this too much you will have frozen live view and corupted frames, try to increase all of the registers as needed only maybe 0x500 rather than 0x555 will be enough, this will help for getting safe frames and good fps.

C0F06804 = 0x4540298  five Meduim steps 0x4a40298 make update (it's better to make update from PLAY mode in some registers) and check the resolution.

If you see a white-black bar in the bottom you should adjust CMOS 7 (trial and error).

Now if you have distorting in vertical you should adjust  ADTG2[82b6] =  0x67f  One Large step  0x77f .

Somethings I have noticed:
Vertical resolution needs more fps than horizontal resolution to increase it?
Disappearing Timer B in 1080p 23.976 (@a1ex this is a issue?).
Vertical stripes when adjusting small steps for both timers (you need to be careful).
CMOS registers updating directly when tweaking them you don't need to press PLAY mode or magnification button.
Sometimes you feel the camera froze, switch to photo mode and press trash button twice and you will get back.

Helpful tips:
Document the important registers for each mode and try to study them.
Write the resolutions you want to get and write each register for it.
Use "Modified from now on" it will help you a lot.
Turning off adtg_gui when adjusting settings is a lot faster. 
Keep learning and trying every day about these registers so your mind will analysis everything for you and you will feel the problems, it's about training.

(I still editing this maybe it will take more time but this what you will need).

Now I got the following resolutions on 700D:

  • Very close to Full-resolution LiveView 5208x3240 at 6.5 fps
  • 3K 2.35:1 3072x1306            at 20 fps
  • 3.5K 3540x1080 Very Wide    at Edit: 23.85 fps
  • 4K 4096x2560                      at 9.5 fps
  • UHD 3840x2160                   at 12 fps
  • 2520x1386 16:9                   at 23.976 fps
  • 1920x1920                           at 23.976 fps (corrupted frames not working yet)

This the latest updates, yeah it's needs more working to get most of them at 23.976, this is all the registers for each mode Here

Maybe I will not to able to continue now for exams, feel free to play with them!


You've got 2 limits here:
- total captured size (including optical black bars) - always larger than the one displayed in the Raw Video menu - must be less than  SRM_BUFFER_SIZE - 0x1000
- lossless encoder limit (apparently H <= 3528 on 700D) - only applies when saving a lossless DNG (does not apply to uncompressed DNG)

In your case:

         5208x3490 W
C0F06800 0x30010
C0F06804 0xccc0538

the total resolution would be: ((0x538 - 0x10) * 4) x (0xccc - 3) = 5280 x 3273 (was that a typo when copying the register values?)

Assuming this value was for 5208x3240, that would give a left bar size of 72 (matches raw.c) and a top bar size of 33 (raw.c uses 28 for LiveView and 52 for photo mode).

On a CR2 file from 650D, "dcraw -i -v" shows "Full size: 5280 x 3528". This image would take 5280 * 3528 * 14/8 = 0x1f16ac0 bytes uncompressed (SRM_BUFFER_SIZE 0x1F24000) and matches the encoder limit exactly. (BTW, that limit might be actually a register we have to change in order to solve the puzzle for 650D / 70D / possibly also 6D).

Anyway - if the resolution given by C0F06800 and C0F06804 does not exceed SRM_BUFFER_SIZE - 0x1000, it should be fine (although I doubt you will be able to capture more pixels than in a CR2). What could happen is that the top optical black bar would end up larger than usual (so the active area stays the same, but the black area ends up larger). In this case, increase the upper half of C0F06800 to trim the black bar.

Photo mode: 0x30010, 0xdcc0538 -> 5280 x 3529 -> 0x1f18ed8.


Sorry guys, but wasting my time trying to get this (* 3072x1920 @ 24p (1:1 crop)) to work. Is not working for me. Any advice. Using 5D mark III!


Sorry forgot to say using build (magiclantern-crop_rec_4k.2018Feb24.5D3123)


Prokopios, I don't think it will shoot that aspect ratio. I think you can shoot 3072 x 1320.


@Prokopios make sure you enable MLV_Lite module, Crop_rec module & if you want sound mlv_snd from the 9th tab in the magic lantern than restart your camera.  Enter magic lantern menu after restart switch liveview on than go to the 4th tab and enable crop mode / raw video options & lastly hit the zoom button to go into 5X mode.  That"s it you should be good to go after that.  Let me know if that works.  Also here is a video breaking it down


Guys, he's asking about 3072x1920 @ 24p (see first post), not about 3072x1320 in x5 zoom mode... -> record time about 5 seconds.


R8 | Canon 16-35 4.0L | Canon 50 1.4 | Canon 100mm 2.8 macro
Ronin-S | Feelworld F6 PLUS


This calculator is giving different results from these
* 3072x1920 @ 24p (1:1 crop)
* 3840x1536 @ 24p (1:1 crop) (corrupted frames at 1600)
* 4096x2560 @ 12.5p (1:1 crop) - continuous*) at 8 FPS
* 4096x1440 @ 25p (1:1 crop)
The 4K half frames is just an example 4096 X 1440, but the calculator says 3584x1320 when you choose 4096 resolution. Maybe i am missing something??


Hi folks!

Anyone willing to share the limits of 600d and which version they're using? And also which version they think is the "most stable". I am mostly interested in 24fps, 16:9 and even 2.35:1.
Canon 5D Mark IIIs | Ronin-M | Zeiss 50mm 1.4 planar | Zeiss 35mm 1.4 distagon  | Zeiss 24mm f2 distagon | Zeiss 85mm f1.4 planar
Dual sound system: Tascam DR-60d MKII | Audio Technica AT899 | Sennheiser MKE 600