Magic Lantern Forum

Developing Magic Lantern => Reverse Engineering => Topic started by: a1ex on May 21, 2014, 01:03:47 PM

Title: ADTG registers related to FPS
Post by: a1ex on May 21, 2014, 01:03:47 PM
5D3: found 3 interesting ADTG registers by comparing 1080 24p vs 30p in ADTG GUI (http://www.magiclantern.fm/forum/index.php?topic=6751.msg71720;topicseen#msg71720).


          24p    25p    30p    50p    60p
ADTG2[8179] = ADTG4[8197]      0x891  0x784  0x6CA  0x39c  0x33c
ADTG2[82F9]                    0x8E2  0x7CF  0x71B  0x3e7  0x38D


Right now, if you remove the safety limits in FPS override, lock timer A at default value (440) and try to get 25 fps from 24 using only timer B, you will get a black screen. If you first copy the values of ADTG2[8179] and ADTG4[8197] from 30p, then FPS override will all the way to 31 (from 24 just as well as from 30, which is a small breakthrough). If you decrease this value a little more, FPS override will go to 32 (before, the max value on 5D3 was 31). If you decrease it even more, FPS override will not go beyond 32, but you will get a cropped image.

The second register has no obvious effects (I don't know what it does), but seems correlated to the first one.

With ADTG2[8179/8197] = 0x535 (from 0x6CA), I could keep timerA at 398, pushed timerB at 1490, and got 40.470 fps, in 1080p (at least printed on the screen, with LiveView still working).

Of course, trying to record that crashed right away :D

To research this, I recommend using ADTG GUI from the iso-research (https://bitbucket.org/hudson/magic-lantern/branch/iso-research) branch, and use FPS override to slowdown LiveView. Make sure you understand the existing code (fps-engio.c) and read g3gg0's notes from http://magiclantern.wikia.com/wiki/Register_Map and http://magiclantern.wikia.com/wiki/VideoTimer .

Have fun and take care, don't fry your sensor!
Title: Re: ADTG registers related to FPS
Post by: Audionut on May 21, 2014, 04:45:51 PM
Excellent.  Our cameras may be Sony cameras (http://www.magiclantern.fm/faq.html#q41), after all.  :P
Title: Re: ADTG registers related to FPS
Post by: a1ex on May 21, 2014, 05:01:34 PM
I believe the register I've adjusted is the "off" parameter from this message:


PowerSaveTiming On:%d, Off:%d H:%d Frame:%d
Title: Re: ADTG registers related to FPS
Post by: g3gg0 on May 21, 2014, 08:10:15 PM
veeeeery nice findings :)


          24p    25p    30p    50p    60p
ADTG2[8179] = ADTG4[8197]      0x891  0x784  0x6CA  0x39c  0x33c
ADTG2[82F9]                    0x8E2  0x7CF  0x71B  0x3e7  0x38D    <<<<<< see table below
==================================================================
delta                          0x051  0x04B  0x051  0x04B  0x051


from our timer value spreadsheet (https://docs.google.com/spreadsheet/ccc?key=0AgQ2MOkAZTFHdFFIcFp1d0R5TzVPTVJXOEVyUndteGc&usp=drive_web#gid=3):


              vvvvvv
1080 24p 0x01B7 0x08E2
1080 25p 0x01DF 0x07CF
1080 30p 0x01B7 0x071B
720 50p      0x01DF 0x03E7
720 60p      0x01B7 0x038D



so these are the exposure start / stop timer values that are depending on exact exposure times (NTSC/PAL)?
i guess you modified the On register?

the exposure will for sure end just right before the data from CMOS is read out.
last year it depicted like that:
at timer value 0 the CMOS sensels will get discharged until reaching timer value (t_rate - t_exposure) where the exposure starts.
after the timer reached its maximum (t_rate), sensel charge is latched into a readout buffer and sensels are discharged again.
Title: Re: ADTG registers related to FPS
Post by: a1ex on May 21, 2014, 08:53:59 PM
Cool, so ADTG2[82F9] is exactly timerB - 1.

From strings, 8197 and 8179 are named pTgRegister->dwSrFstAdtg2[3] and [5]. They are paired with [2] and [4], and the last two are related to image height.

These numbers are computed in str:TG_LvTgDriver.c_PowerSaveTiming, and the "on" values seem to be mapped to [2] and [4], while the "off" values are for [3] and [5]... if I didn't mess up the offsets.
Title: Re: ADTG registers related to FPS
Post by: a1ex on May 22, 2014, 09:54:01 PM
The NEW_FPS_METHOD (which patches the sensor timing table) actually lets Canon code optimize the powersave timers (and other parameters).

So, I've enabled it for 5D3 and I've got 40fps in 1080p raw, 38fps in 1080p H.264, and 67fps in 720p, both raw and H.264.
Title: Re: ADTG registers related to FPS
Post by: Oswald on May 23, 2014, 05:55:57 AM
48fps in 1080p would be so good. :) Good job keep it going!
Title: Re: ADTG registers related to FPS
Post by: chmee on May 23, 2014, 10:47:20 AM
thumbs-up.  :) (in h264 as well, thats great news) could this readout-time-changes help lowering rollingshutter-effects?
Title: Re: ADTG registers related to FPS
Post by: a1ex on May 23, 2014, 11:43:35 AM
Yes, if you increase timer A, you will get more rolling shutter efects (jello).

Best viewed at around 2 fps with a fast shutter speed.
Title: Re: ADTG registers related to FPS
Post by: hjfilmspeed on June 11, 2014, 08:49:09 AM
This might have been reported or its a known issue but im on 5d3 113 magiclantern-Nightly.2014Jun11.5D3113 ML card is sd sandisk sdhc class 10m 45MB/s and CF card is komputerbay 64GB 1000x
I have the raw rec, deflicker, dual iso, and file manager modules enabled. I have raw set to 1920x818 2:35:1 and canon is set to 23.976.
I had raw zebras highlight and shadow clipping on, preferred card CF, 10x zoom off, and in canons menu i have the set button changed to iso.
When i enable fps over ride and raise it over 23.976, the picture style menu flashes almost every time i raise the fps up.
Is this just a side effect of the new fps changes, or did I miss something or screw it up.
I pulled batt just in case and everything seems fine. Anyone else see this or should i send this to the bugs thread.
sorry if this was discussed i have not seen it yet. Thank you
Title: Re: ADTG registers related to FPS
Post by: a1ex on June 11, 2014, 08:50:36 AM
Yes, this method of changing FPS requires a video mode change (and ML does it in background). You can see it if you press the LiveView button to see what happens behind the menu.
Title: Re: ADTG registers related to FPS
Post by: hjfilmspeed on June 11, 2014, 05:32:58 PM
@A1ex I see. So its totally normal and I once again wasted forum space for my noob questions ha ha. Sorry A1ex thank you for your speedy response!!! Cant wait to go play now!!!