Author Topic: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView  (Read 477838 times)

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1544
  • 6d - Nightly build user
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1625 on: June 14, 2018, 04:48:57 PM »
Some little progress on the 6d, very slow and many many soft bricks.

I managed to alter the 5x zoom mode, so it has the vertical resolution of normal 1080p mode.
I got 2 MLV's, one in 2688 x 1224 at 24 fps resolution and one in 2688 x 1124 at 24 fps (YES 1:2.39 aspect ratio  :D)
Here's te proof:


But here's the thing...I can't recreate it  :P :-[ :'(

I used the excell sheet of theBilalFakhouri as starting point.
And changed these registers (Don't know exactly which mode I was in when I started altering these registers):
CMOS 7 -> 268
6014   -> 5b4
6804   -> 4e5 0 2c0
8172N -> 4e6(695NRZI)
8178N -> 4e6(695NRZI)
713c   -> 516
8000   -> 5

And after that start video mode and press magnify button 2 times so I'm in 5x zoom mode.

Will do some more research...





Danne

  • Contributor
  • Hero Member
  • *****
  • Posts: 6488
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1626 on: June 14, 2018, 05:13:58 PM »
Cool! Should make a preset like the one I got from Nikfreak so you can go right into action. :)

Danne

  • Contributor
  • Hero Member
  • *****
  • Posts: 6488
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1627 on: June 14, 2018, 05:33:12 PM »
@Levas
Here´s a adtg_gui.mo version for 6D which gets you into crop registers after selecting digic registers and then select 1:1 3K Crop mode (5D 3) setting. Or use the included adtg_gui helper lua script :). I removed the sd_uhs part...

Download
https://bitbucket.org/Dannephoto/magic-lantern/downloads/adtg_gui_6D_lua.zip

howto:
https://www.youtube.com/watch?time_continue=65&v=GE5na3c0zOQ

commit:
https://bitbucket.org/Dannephoto/magic-lantern/commits/10bc7a9c48eff9728179bdd3435233af6c5a21ef
 
Some of your registers were a bit fishy looking so the preset has some 700D or 100D starting point but you know how to alter the values.

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1544
  • 6d - Nightly build user
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1628 on: June 14, 2018, 05:43:13 PM »
Thanks Danne, this helps a lot!
Wich registers looked fishy to you?
You do know that the 6d has 25.6 mhz clock speed ?
So A and B timers will look different then 5d3 and 100d/700d.

I’m not sure but I also think 6d has other CMOS numbers usage then other cams.
CMOS 3 is for analog iso value, I know for sure.
CMOS 6 is for horizontal offset, I think ???
CMOS 7 is for vertical offset, I think  ???

Danne

  • Contributor
  • Hero Member
  • *****
  • Posts: 6488
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1629 on: June 14, 2018, 05:54:17 PM »
There's spaces in 6804? Can it be? Anyway if you know how to compile you can add your own numbers in adtg_gui.c code and compile only the specific module from my branch.
Or just send me your latest numbers and I compile it for you when you feel you're on to something :)

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1544
  • 6d - Nightly build user
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1630 on: June 14, 2018, 06:12:39 PM »
Ah the spaces, you’re right, I did that on purpose because it actually are 2 numbers for resolution splitted by the 0.
It should be without the spaces indeed 4e502c0

4e5 is the vertical resolution (4e5 -> 1253 decimal )
2c0 is the horizontal resolution x4 columns (2c0 -> 704 x4 = 2816)
2816 x 1253 minus blackborders results in 2688 x 1224 resolution.

Danne

  • Contributor
  • Hero Member
  • *****
  • Posts: 6488
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1631 on: June 14, 2018, 06:21:57 PM »
You mean there's actually logic in the registrys. I have to sit down with thi :).
Tell me if the module works or if you want any changes to be done when you can.

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1544
  • 6d - Nightly build user
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1632 on: June 14, 2018, 07:31:42 PM »
@Danne, looks like it's working.
These registers are overriden when I load Croprec 3k 5d3:


Will dig into it and see if I can get some usable combinations  for the 6d :D


Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1544
  • 6d - Nightly build user
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1633 on: June 14, 2018, 07:54:42 PM »
Looked at crop_rec.c today and found a bunch of registers which are tweaked for the 5d3.
For most of these registers I could find the 6d Values
I summed the values up in 1080-25fps mode, 5xzoom 1:1 mode and photo mode (for full res live view).
So these are the standard values for these registers in these modes.

http://docs.google.com/spreadsheets/d/1iapLI7UrgfCJGwPSFsyhYeKl8fSTY4RVXvDR7MiaOp4/edit?usp=sharing

For those interested in 6d.

As a bonus, already a column for overriding registers for 3K resolution, in 4.7 fps  :P


Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1544
  • 6d - Nightly build user
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1634 on: June 14, 2018, 09:58:51 PM »
@Alex,

Doing a lot of trial and error with adtg_gui on 6d.
And the camera doesn't behave consistent on same alterations each time, also getting some memory errors once in a while.
I'm using the magiclantern-crop_rec_4k.2018Mar10.6D116 build from the experiments download page.

And there's something going on with the memory dialog.
When I do a clean start and open up the 'free memory' dialog, the camera crashes immediately in error 70
Crash log file:
Code: [Select]
ASSERT: hSuite != 0
at RscMgr.c:2228, guess_mem:ff0f41ec
lv:1 mode:3

guess_mem stack: 1e3308 [1e33c8-1df3c8]
0xUNKNOWN  @ ea80:1e33c0
0x0045C240 @ 44dde8:1e3380
0x0045C120 @ 45c29c:1e3368
0xFF14A580 @ 45c140:1e3360
0x00001900 @ ff0f41e8:1e3340
0x0044C478 @ 44c4f4:1e3308

Magic Lantern version : crop_rec_4k.2018Mar10.6D116
Mercurial changeset   : 57614b3f26e4+02e5918a6ed5+ (crop_rec_4k) tip
Built on 2018-03-10 22:22:24 UTC by jenkins@nightly.
Free Memory  : 330K + 984K

Camerite

  • New to the forum
  • *
  • Posts: 6
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1635 on: June 14, 2018, 11:16:21 PM »
Downloaded latest crop rec 10 march build for 5D 123. It should have audio with mlv_snd module activated, no? Normaly then there is the option in the audio menu after activating, or is that only working for 113 build? Thanks!

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12391
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1636 on: June 15, 2018, 07:13:40 AM »
And there's something going on with the memory dialog.
When I do a clean start and open up the 'free memory' dialog, the camera crashes immediately in error 70

Best guess: raw video (with mlv_lite) enabled; on this branch, it preallocates the entire memory during standby. Try turning it off.

So these are the standard values for these registers in these modes.

http://docs.google.com/spreadsheets/d/1iapLI7UrgfCJGwPSFsyhYeKl8fSTY4RVXvDR7MiaOp4/edit?usp=sharing

Nice job documenting these. Can you do the same for all other video modes? On 5D3, there were some interesting changes between 1080p 24/25/30 (besides FPS timers). Comparing 1080p with 720p is also interesting, but on 5D3, that can only be done without DIGIC registers enabled (otherwise it locks up).

Edit: 50p no longer locks up after commenting out the patch for EngDrvOut.

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1544
  • 6d - Nightly build user
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1637 on: June 15, 2018, 06:29:02 PM »
@Alex

Updated the spreadsheet with 1080-24fps and 1080-30fps mode.
Weirdly enough, I couldn't get the 6014 register show up in adtg_gui in 1080-30fps mode ?
But I think the interesting part is in the changes in the  8179N and 82f9N registers I guess ???

http://docs.google.com/spreadsheets/d/1iapLI7UrgfCJGwPSFsyhYeKl8fSTY4RVXvDR7MiaOp4/edit?usp=sharing

At the moment I'm out of battery juice, will check 720p modes soon.

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1544
  • 6d - Nightly build user
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1638 on: June 15, 2018, 06:54:13 PM »
@Camerite -> sound recording with MLV_lite is now visible in raw video menu, at the bottom, same menu where you set raw resolution etc.

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1544
  • 6d - Nightly build user
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1639 on: June 15, 2018, 09:15:43 PM »
@Alex,

Updated the spreadsheet now with 50fps and 60fps 720p modes.
I guess all standard values are in the sheet now.
Please have a look and enlighten me on how to get the good stuff on the 6d  ;D

http://docs.google.com/spreadsheets/d/1iapLI7UrgfCJGwPSFsyhYeKl8fSTY4RVXvDR7MiaOp4/edit?usp=sharing

Interesting found, CMOS 8, not listed in "known registers" but it has another value in full resolution photo mode.
When locked in normal 1080-25fps mode, it messes with the live view, sort of a double ghost image look.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12391
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1640 on: June 15, 2018, 11:55:58 PM »
Took a closer look at these registers in 5D3 and matched them with some firmware strings:

Code: [Select]
                                    1080p24 1080p25 1080p30 1080p24->40 1080p25->40 720p50  720p60    x5      photo    full-res LV
0x8178, 0x8196 PowerSaveTiming on     1321    1321    1321     1321        1321      695     695     1383     unused     3933
0x8179, 0x8197 PowerSaveTiming off    2193    1924    1738     1418        1424      924     828     1486     unused     3945
0x82F8         ReadOutTiming          1320    1320    1320     1320        1320      694     694     1382     unused     3932
0x82F9         set to TimerB - 1      2274    1999    1819     1499        1499      999     909     1555     unused     4020
FPS timer A                            440     480     440      400         400      480     440      518        792      792
FPS timer B                           2275    2000    1820     1500        1500     1000     910     1556       3958     4094
C0F06800 - C0F06804                 [              2080 x 1319                    ] [ 2080 x 693 ] 3744x1381 5936x3949 5936x3931

The PowerSaveTiming registers, if misconfigured, are causing artifacts like this. Time units are from 0 to FPS timer B - 1; this covers a complete LiveView frame. For each timer B increment, one line is read out (well, 80D reads two lines per tick, but that's another story).

If the powersave timing registers are set to some value lower than desired vertical resolution, you will not get valid data on the lines in-between. Example: if you set the "on" register to 1320 / 2 = 660, and the "off" register to something a bit higher, e.g. 670, you'll get a thin bar of missing data somewhere in the middle of the image. Canon firmware enables powersaving after one frame was fully read out, until the next frame. That means, the "on" timing is just a bit higher than the desired vertical resolution (including black bars etc) and the "off" timing is just a bit lower than FPS timer B (aka total frame duration, one unit being timer A / MainClock, e.g. 440 / 24MHz = 18.33 microseconds).

If you set both powersave registers to 0, it seems to work just fine, although it might run a little hotter than usual.

TODO: now that we know their meaning, these registers should be set properly to reduce power consumption. In the current source, these were set by trial and error, so there is room for improvement.

Register 0x82F8 affects the image: if you set it to 660 (i.e. nrzi_encode(660) = 0x3de), the bottom half of the image will get darker, with some artifacts near highlights.

Register 0x82F9 had no obvious effect in my quick tests.

On 6D and 700D, the powersave timing registers are 8172/8178 (on), 8173/8179 (off), 82f8 (readout timing), 82f9 (unknown). On 700D, register 82B6 is set to powersave timing "on" - 2. All of them are NRZI-encoded.

Camerite

  • New to the forum
  • *
  • Posts: 6
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1641 on: June 16, 2018, 01:15:03 AM »
@Levas,
Thanks man! Found it now hidden on the bottom somewhere! Appreciate it!

theBilalFakhouri

  • Contributor
  • Senior
  • *****
  • Posts: 362
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1642 on: June 16, 2018, 03:31:38 PM »
@a1ex

I am trying to implement new resolution in crop_rec.c ,, can you please review this commit .

How I can override C0F0 registers in the same way (case & return) instead of delta things ? Can please give an example or a code for that ?

I tried this but didn't work:

Code: [Select]
static inline uint32_t reg_override_3k_700d(uint32_t reg, uint32_t old_val)
{
    switch (reg)
    {
        case 0xC0F06800:
            return 0x10010;         /* raw start line/column, from photo mode */
       
        case 0xC0F06804:            /* 1080p 0x528011B, photo 0xF6E02FE */
            return 0x5340322;
       
        case 0xC0F06824:
        case 0xC0F06828:
        case 0xC0F0682C:
        case 0xC0F06830:
            return 0x3ca;           /* from photo mode */
       
        case 0xC0F06010:            /* FPS timer A, for increasing horizontal resolution */
            return 0x37b;           /* from photo mode; lower values give black border on the right */
       
        case 0xC0F06008:
        case 0xC0F0600C:
            return 0x37b037b;

        case 0xC0F06014:
            return 0x6d7;

case 0xC0F0713c:
        return 0x555;
    }

}

Code: [Select]
static void * get_engio_reg_override_func()
{
    uint32_t (*reg_override_func)(uint32_t, uint32_t) =
      //(crop_preset == CROP_PRESET_3X)         ? reg_override_top_bar     : /* fixme: corrupted image */
        (crop_preset == CROP_PRESET_3X_TALL)    ? reg_override_3X_tall    :
        (crop_preset == CROP_PRESET_3x3_1X)     ? reg_override_3x3_tall   :
        (crop_preset == CROP_PRESET_3x3_1X_48p) ? reg_override_3x3_48p    :
        (crop_preset == CROP_PRESET_3K)         ? reg_override_3K         :
        (crop_preset == CROP_PRESET_4K_HFPS)    ? reg_override_4K_hfps    :
        (crop_preset == CROP_PRESET_UHD)        ? reg_override_UHD        :
        (crop_preset == CROP_PRESET_40_FPS)     ? reg_override_40_fps     :
        (crop_preset == CROP_PRESET_FULLRES_LV) ? reg_override_fullres_lv :
        (crop_preset == CROP_PRESET_CENTER_Z)   ? reg_override_zoom_fps   :
(crop_preset == CROP_PRESET_3K_700D)    ? reg_override_3k_700d    :
                                                  0                       ;
    return reg_override_func;
}


Should I make CENTER_Z preset for 700D ? and as I understood this preset for detecting centered live-view and making live-view centered in x5 ,, right?


Is this right to override adtg ? :
Code: [Select]
case CROP_PRESET_3K_700D:
          adtg_new[1] = (struct adtg_new) {2, 0x81B6, 0x7f4};
adtg_new[2] = (struct adtg_new) {2, 0x8172, 0x77c};
adtg_new[3] = (struct adtg_new) {2, 0x8178, 0x77c};
break;

Any tips I will be appreciated!
700D 1.1.5 | no more ISOless LV err 8

Danne

  • Contributor
  • Hero Member
  • *****
  • Posts: 6488
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1643 on: June 16, 2018, 05:35:32 PM »
+1 for above post.

Thanks for helping out @theBilalFakhouri. Think I got two really nice presets for the 100D going now, 2520x1304 24.006fps and 3096x1320 20fps :).  Hopefully we can get them into crop_rec.c soon  :P
https://www.magiclantern.fm/forum/index.php?topic=16040.msg202808#msg202808

pewpow

  • New to the forum
  • *
  • Posts: 13
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1644 on: June 18, 2018, 04:39:37 PM »
The latest crop_rec build for 5D3 1.1.3 shows me an incorrect live-view mode. After having imported the footage, they all turned out shifted lower than what I was seeing on my 5D3 screen. Also the aspect ratio crop is wrong. It says to crop it 1.67x but that shows a completely distorted image

Edit: also the exposure is way off. screen on 5D3 shows a way darker image

Kharak

  • Hero Member
  • *****
  • Posts: 943
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1645 on: June 18, 2018, 07:04:20 PM »
Edit: also the exposure is way off. screen on 5D3 shows a way darker image

Use RAW exposure aids like RAW histogram and RAW zebras to accurately measure the exposure of an image, the Liveview does its best at representing a true image, but is in fact more representive of JPEG or h264 capture; this will be evident when enabling RAW zebras for instance. Also if you have your screen brightness set to a lower value than max, that will also make it more difficult to judge accurate exposure, by the image alone.
once you go raw you never go back

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1544
  • 6d - Nightly build user
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1646 on: June 19, 2018, 10:04:34 AM »
Update for 6D.

Small step further, find out why the camera isn't consistently with overriding registers...
Yesterday I was messing with adtg_gui and had mlv_lite set on plain 14 bit raw, first thing I did worked, got 2688 x 1222 resolution back  :D
Messed some further around and seemed that raw video buffer breaks (ML framing preview) with 12 bit lossless and lower.
So it only seems to work fine in plain 14 bit mode and it seems that 14 bit lossless also works, but 12 bit lossless and lower messes with the raw image buffer  :-\
So something needs fixing...not sure, probably in MLV_lite ?
This goes for 4k crop_rec experimental build on downloadpage.

Guess this is only the case for 6d ?






Kharak

  • Hero Member
  • *****
  • Posts: 943
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1647 on: June 19, 2018, 10:08:34 AM »
Cropped modes dont work with 10/12 bit lossless on the 5d3
once you go raw you never go back

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1544
  • 6d - Nightly build user
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1648 on: June 19, 2018, 10:14:38 AM »
This is new for me, always been that way, did it never work on cropped modes ?

Danne

  • Contributor
  • Hero Member
  • *****
  • Posts: 6488
Re: crop_rec on steroids: 3K, 4K, 1080p48, full-resolution LiveView
« Reply #1649 on: June 19, 2018, 10:39:56 AM »
@Levas
Check here regarding other than 14bit-lossless:
https://www.magiclantern.fm/forum/index.php?topic=19300.msg202052#msg202052