Magic Lantern Forum

Developing Magic Lantern => General Development => Topic started by: a1ex on July 15, 2014, 03:46:27 PM

Title: Rolling shutter measurements
Post by: a1ex on July 15, 2014, 03:46:27 PM
When doing some timing analysis from the full-res silent picture thread (http://www.magiclantern.fm/forum/index.php?topic=12523.msg121962#msg121962), I think I've found the formula for measuring the rolling shutter in video mode.

https://bitbucket.org/hudson/magic-lantern/commits/5d0db9024bab25649bfcbde58e0849e0817ab902

Since the formula is based on FPS timers (VerticalRawResolution * TimerA / MainClock), I've added a menu entry for displaying it in the FPS override submenu. I chose to display it in microseconds per line, so it's up to you to know your vertical resolution and find the total distortion per frame. ML tries to do some guessing, which should be a good starting point (it guesses the captured resolution for a 16:9 frame in H.264 1080p - which is slightly lower - but fails at 720p because it doesn't know the exact stretching factor).

Results from 5D3, at Canon default FPS:


24p, 30p : 18.3 µs/line  => 19.6ms in H.264 (1904x1070 captured pixels)
25p      : 20.0 µs/line  => 21.4ms in H.264
50p      : 20.0 µs/line  => 13.4ms in RAW at max res (672 vertically); the menu gets it wrong in H.264
60p      : 18.3 µs/line  => 12.3ms in RAW


Samuel H measured 20.5 ms for 5D3 (http://www.dvxuser.com/V6/showthread.php?303559-Measuring-rolling-shutter-put-a-number-on-this-issue), but he didn't specify the setting. Either way, the numbers are close.

Decreasing timer A will decrease the rolling shutter. There isn't a mode for minimizing timer A in newer cameras, but in many cases, exact FPS will chose a very low value for it. You can also fine-tune timer A manually (push it to the left until it stops decreasing), and with these settings, the "overcranked" rolling shutter values are:


24p,25p,30p : 16.6 µs/line  => 17.7ms in H.264
50p, 60p    : 17.1 µs/line  => 11.5ms in RAW


This feature will be in nightly builds starting from tomorrow. It's just a display thing - the behavior was not changed. Please post screenshots.
Title: Re: Rolling shutter measurements
Post by: jimmyD30 on July 15, 2014, 04:21:01 PM
WOW!

Being able to emulate a Global Shutter on CMOS sensor is MAD INSANE 8)

Just imagine shooting RAW with 'global shutter' on a non-CCD DSLR, I'm literally speechless (well, apart my aforementioned speech anyway ;)
Title: Re: Rolling shutter measurements
Post by: a1ex on July 15, 2014, 04:25:13 PM
I highly doubt I'll be able to achieve that (overcranking this timer doesn't go too far). There seems to be a global shutter for starting the exposure, but a rolling one for stopping it. It's visible on the motion blur shape from the full-res silent pictures, which matches the graphs from the other thread.

LiveView uses rolling shutter for both start and stop (unlike photo mode). That's one of the next challenges - figure out how to switch between the two modes.
Title: Re: Rolling shutter measurements
Post by: dubarry on July 15, 2014, 04:27:41 PM
RIDICULOUS!!!

Between rolling shutter adjustments and SRM it's like Christmas again. :'(

Once this is in the nightly will we be able to use it on the 60D?
I only ask because of this previous comment "RAW_PHOTO_EDMAC needs to be changed on all cameras (see these comments in raw.c)"
Title: Re: Rolling shutter measurements
Post by: a1ex on July 15, 2014, 04:38:10 PM
Again, it's just a display thing. The feature has been there for years.
Title: Re: Rolling shutter measurements
Post by: dubarry on July 15, 2014, 04:51:07 PM
Ahh.  Well this is interesting I'm going to have to check it out when it comes down the pipe.  If only I had known this feature existed previously dang it!

I see now... I got turned around I was referring to the full res silent pictures development.
referencing this: "RAW_PHOTO_EDMAC needs to be changed on all cameras (see these comments in raw.c)"

I'll repost accordingly.
Title: Re: Rolling shutter measurements
Post by: budafilms on July 16, 2014, 09:58:13 AM
Trying to translate in my world ;)

A fake global shutter means... hybrid shutter is  referred to as a "global shutter," but strictly speaking, these are still standard rotary shutters that have been adapted for digital use. Rolling shutter artifacts are still possible—especially at higher frame rates and shutter speeds—since the shutter still sweeps across the sensor.

So

shutter is simply a spinning disc between the rear of a lens and the film strip. It has an opening that lets in light once per revolution for each exposure. When the light is obstructed, the film advances to the next frame and the process repeats. For these reasons it's also often referred to as a mechanical or a rotary shutter.

then

In that case, fast-moving subjects can appear angled or sheared, and rapid camera movements are more likely to appear as a wobble. Effects are most pronounced with whip pans, fast subjects, high shutter speeds or run and gun type shots. Strobes can also partially illuminate the frame if they go off when the full sensor area isn't collecting light.

Source: http://www.red.com/learn/red-101/global-rolling-shutter
Title: Re: Rolling shutter measurements
Post by: chmee on July 16, 2014, 11:33:43 AM
dont get me wrong.. isnt it just a measurement, the tuning of timers gives some optimizing but is far from being a rolling-shutter-neutralization?!

on 60fps one frame needs 1/120s (on 180°shutter) = 8ms per frame
on 25fps its 1/50s -> 20ms

by now it was optimized by
17.7ms/21.4ms (in H.264) =~18%
(and thats not bad of course)
Title: Re: Rolling shutter measurements
Post by: budafilms on July 24, 2014, 10:10:08 AM
@A1ex and Devs, maybe it's interesting for the research:

http://www.cinema5d.com/rolling-shutter-sony-a7s-vs-arri-amira-canon-c300-5d-mark-iii-1dc-panasonic-gh4/
Title: Re: Rolling shutter measurements
Post by: a1ex on July 24, 2014, 10:20:29 AM
Yep, their results are pretty close.

BTW, the feature was in the nightly builds for one week, and nobody posted a single screenshot. Guess it's a good candidate for the next cleanup session.
Title: Re: Rolling shutter measurements
Post by: mk11174 on July 24, 2014, 12:18:30 PM
Quote from: a1ex on July 24, 2014, 10:20:29 AM
Yep, their results are pretty close.

BTW, the feature was in the nightly builds for one week, and nobody posted a single screenshot. Guess it's a good candidate for the next cleanup session.
actually,  I tried to get you a screen shot I used the latest tool,  and it did show fps menu, but did not show me any results after I took the pictures, the script took the 2 pictures fine,  but the tool did not give me any info to capture, I went back into the menu of the tool and it still showed the same thing it should before I took the pictures?
Title: Re: Rolling shutter measurements
Post by: a1ex on July 24, 2014, 12:20:33 PM
What pictures? This thread is about rolling shutter in video mode.

You only need some screenshots of the FPS override submenu, or just write down the numbers.
Title: Re: Rolling shutter measurements
Post by: mk11174 on July 24, 2014, 01:31:52 PM
Quote from: a1ex on July 24, 2014, 12:20:33 PM
What pictures? This thread is about rolling shutter in video mode.

You only need some screenshots of the FPS override submenu, or just write down the numbers.
I thought you wanted a silent picture and a cr2 with a screenshot of the fps menu?
Title: Re: Rolling shutter measurements
Post by: a1ex on July 24, 2014, 01:49:20 PM
That's another test, from another thread.
Title: Re: Rolling shutter measurements
Post by: mk11174 on July 24, 2014, 02:37:25 PM
Quote from: a1ex on July 24, 2014, 01:49:20 PM
That's another test, from another thread.
Gotcha, I started with the fullres thread then you broke off into this one, I thought it was the same test needed, but then cool, will post results then if that is all that is needed.

1920x1080@30fps
(http://s16.postimg.org/kqs576vn9/1920x1080.jpg)

1920x1080crop
(http://s9.postimg.org/dz04eb5lr/1920x1080crop.jpg)

1280x720@60fps
11.4ms at 1280x689

For RAW I can pretty much only do [email protected] while in 1920x1080@24 Canon Mode
(http://s13.postimg.org/5ze64g3on/raw.jpg)
Title: Re: Rolling shutter measurements
Post by: budafilms on July 24, 2014, 09:50:28 PM
A1ex, this thread are not very promoted, for example it's not in Facebook, where ML have 61.000 people!
I think it's misunderstanding the way we get the the new info of ML - I'm a FAN -  this is important:

a) most people go ONLY to the Home folder and check @Autoexec twitter - twitter is not a good place to contact today. If the first line is about ML with Leds - like right now - people go there and downloads.
b) other people check " Show new reply to your post" in FORUM - if they have a problem - and stay weeks around a couple of threads.
c) very few go to "unread post since last visit".

A couple of mont ago, other sites promote a lot the activity of ML, because have 5D or Canon products. But it's strong the other brands advertising and have buy this sites with products or banners, I don't know - I'm not judging. But it's a fact that ML have less present in other sites and "public figures".

I think one solution is re-edit (no aesthetic redesign) the front page, I mean only the HOME with the LAST investigations or research to stay up to date with all the ML work.


This is my test:

FPS OVERRIDE (RAW 1280X720)

DESIRED FPS 24 (FROM 25)
OPTIMIZED FOR EXACT FPS
FPS TIMER A: 400 (-80)
CTUAL FPS 24.000
ROLLING SHUTTER 16.7

Rolling Shutter: 21.4ms at 1932 x 1290

FPS OVERRIDE (H264 1920X1080)

DESIRED FPS 24 (FROM 25)
OPTIMIZED FOR EXACT FPS
FPS TIMER A: 398 (FT-2)
ACTUAL FPS 24.005
ROLLING SHUTTER 16.6

Rolling Shuter: 17.7ms at 1904x 1070

Title: Re: Rolling shutter measurements
Post by: escho on July 24, 2014, 11:20:54 PM
600D h264

How can I see the resolution? I only see the instruction: "Start recording to find out the vertical resolution". To be able to start a record, I have to exit this menue. Reenabling the menue after starting the record is not possible. I only can acces the ML main menue, Q on fps-override does not work then. So, no clue, how to help...

Edgar
Title: Re: Rolling shutter measurements
Post by: a1ex on July 24, 2014, 11:23:17 PM
The important number is displayed without starting to record.

When Q doesn't work, you can press INFO. Probably this should be printed somewhere on the interface (it used to be, long before the menu facelifts).
Title: Re: Rolling shutter measurements
Post by: escho on July 24, 2014, 11:34:53 PM
The info button did the trick. Thanks
Title: Re: Rolling shutter measurements
Post by: dpjpandone on July 25, 2014, 04:12:37 AM
Alex,

here are all the different fps modes on 7D with canon Q set to 24p and 30p then override to 23.976

http://www.filedropper.com/vram0

Title: Re: Rolling shutter measurements
Post by: a1ex on July 25, 2014, 07:10:50 AM
Hm, I expected the 7D sensor to be a little faster.

21.7 microseconds in 24p/30p default, 20.8 overclocked. Multiply these by your vertical resolution to get milliseconds.
Title: Re: Rolling shutter measurements
Post by: 2blackbar on July 25, 2014, 08:57:25 AM
canon EOS M reports 20.6 and 16.4 on exact fps , alex can you enable sound when fps override is 23.976 anyway? I guess sound wont be out of sync but its always disabled when you use fps override even with default canon speeds.
Title: Re: Rolling shutter measurements
Post by: a1ex on July 25, 2014, 09:09:48 AM
Yep, makes sense.

However, the EOS-M has a quirk: in standby, its LiveView is in 50/60 fps mode IIRC. Can you double-check the numbers while recording H.264?
Title: Re: Rolling shutter measurements
Post by: dpjpandone on July 25, 2014, 04:13:40 PM
Quote from: a1ex on July 25, 2014, 07:10:50 AM
Hm, I expected the 7D sensor to be a little faster.

21.7 microseconds in 24p/30p default, 20.8 overclocked. Multiply these by your vertical resolution to get milliseconds.

Can you comment on my findings that recorded image is torn when canon Q set to 24p, but tearing is not present when Q is set to 30p and fps override is used to get 24p? (this only happens when hdmi monitor is connected) One percent eliminated this problem, but he can't seem to pinpoint how. He suggested that it may be due to using faster edmacs....
Title: Re: Rolling shutter measurements
Post by: a1ex on July 25, 2014, 04:34:49 PM
Nope, that's beyond my current level of understanding Canon code.
Title: Re: Rolling shutter measurements
Post by: dpjpandone on July 25, 2014, 04:51:00 PM
Ok. BTW please do not remove this feature for code cleanup, I think it is incredibly useful to display rolling shutter info.
Title: Re: Rolling shutter measurements
Post by: glubber on July 25, 2014, 07:48:21 PM
EOS 550D

1080-25p
(https://dl.dropboxusercontent.com/u/90483500/550D-RS-1080-25p.png)

720-50p
(https://dl.dropboxusercontent.com/u/90483500/550D-RS-720-50p.png)
Title: Re: Rolling shutter measurements
Post by: ItsMeLenny on July 26, 2014, 09:42:28 AM
On a somewhat related note, I've always questioned which is better:
24 fps exact from 25 fps canon
or
24 fps exact from 23.976 fps canon
Title: Re: Rolling shutter measurements
Post by: escho on July 26, 2014, 05:16:39 PM
The test-results for my 600D:

1920/24 normal: 18,8µs/line --> 17,8ms at 1680x944  A: 542(-4)   B:2214(+14)
1928/24 3xzoom: 20,6µs/line --> 20,0ms at 1728x972  A:(592(+20)  B:2027(-73)

1920/25 normal: 19,8µs/line --> 18,7ms at 1680x944  A:570(-6)    B:2021(+71)
1920/25 3xzoom: 19,8µs/line --> 19,2ms at 1728x972  A:570(-6)    B:2021(+71)

1280/50 normal: 20,0µs/line --> 11,4ms at 1280x568  A:576(+0)    B:1000(+0)

640/25 normal:  19,8µs/line --> 9,5ms at  640x480   A:570(-6)    B:2021(+21)


All test h264 and exact fps (Canon default)

More needed? Please tell me.

Edgar
Title: Re: Rolling shutter measurements
Post by: dmilligan on July 26, 2014, 09:56:51 PM
check this out, 60D 640x480 crop mode (the Canon crop mode):
(https://bitbucket.org/dmilligan/magic-lantern/downloads/60D_480p60crop.png)

1080p30 5x Zoom (Photo LV 5x is the same)
(https://bitbucket.org/dmilligan/magic-lantern/downloads/60D_1080p30_5xZoom.png)

1080p30 (Photo LV is the same)
(https://bitbucket.org/dmilligan/magic-lantern/downloads/60D_1080p30.png)

How does it read the sensor faster in 640x480 crop mode?
Title: Re: Rolling shutter measurements
Post by: Greg on July 26, 2014, 11:17:14 PM
Quote from: dmilligan on July 26, 2014, 09:56:51 PM
How does it read the sensor faster in 640x480 crop mode?

Sensor probably read less number of lines.
Title: Re: Rolling shutter measurements
Post by: a1ex on July 26, 2014, 11:20:42 PM
Interesting.

I believe timer A is roughly proportional to horizontal resolution. On 60D, in 5x and 30p, raw resolutions are 2520 and 1888, and timer A values are 734 and 546 (ratio around 3.45). In 640 crop, if this theory is true, we should be able to push timer A down to around 270 (but it doesn't seem to be that simple). FYI, the raw resolution in this crop mode is 920x624.

I've checked the safe timer A values for 60D again, and they are: 536 for full-width modes, 732 for 5x, and 398 for 640 crop. So, the current timer A values from fps-engio.c are correct (with a tiny safety margin); only timer B probably can be pushed a little more in high FPS modes.

In crop mode, the captured area is not centered (it touches either the left or the right edge). Maybe that's an important restriction. If this is true, reading 920 raw pixels from center should be as expensive as reading 1888/2 + 920/2 = 1404 pixels from one edge (well, not very exact, because I didn't consider the black borders - you know, Pi is about 3). But 1404 / 3.45 is too close to 400 to be just a coincidence.

edit: myth debunked - the 60D has 3 horizontal positions for the 5x zoom window...
Title: Re: Rolling shutter measurements
Post by: ayshih on July 27, 2014, 12:48:54 AM
50D rolling shutter time is 24–26 ms, with only a small room for improvement by minimizing timer A.

Default timer A (zoom on right):
(https://www.dropbox.com/s/trdgxlkuc29g22m/rolling-50D-normal-default.png?dl=1)(https://www.dropbox.com/s/sch7dekhjr6ou95/rolling-50D-crop-default.png?dl=1)

Minimized timer A (zoom on right):
(https://www.dropbox.com/s/0tqc375usv93ltx/rolling-50D-normal-minimum.png?dl=1)(https://www.dropbox.com/s/aanxtp1jhwpn537/rolling-50D-crop-minimum.png?dl=1)
Title: Re: Rolling shutter measurements
Post by: budafilms on July 27, 2014, 06:22:29 AM
Quote from: ItsMeLenny on July 26, 2014, 09:42:28 AM
On a somewhat related note, I've always questioned which is better:
24 fps exact from 25 fps canon
or
24 fps exact from 23.976 fps canon

24/25 from Canon Menu.
Title: Re: Rolling shutter measurements
Post by: escho on July 27, 2014, 07:02:59 AM
added timers to my 600D-table
Title: Re: Rolling shutter measurements
Post by: jimmyD30 on July 28, 2014, 01:49:46 AM
Came across these articles, they mention Canon 5D Mark III and Panasonic GH4 as well as others.

Rolling Shutter Comparison: http://www.cinema5d.com/rolling-shutter-sony-a7s-vs-arri-amira-canon-c300-5d-mark-iii-1dc-panasonic-gh4/

And here: http://nofilmschool.com/2014/07/rolling-shutter-how-does-sony-a7s-compare/
Title: Re: Rolling shutter measurements
Post by: 2blackbar on July 28, 2014, 05:03:08 PM
Quote from: a1ex on July 25, 2014, 09:09:48 AM
Yep, makes sense.

However, the EOS-M has a quirk: in standby, its LiveView is in 50/60 fps mode IIRC. Can you double-check the numbers while recording H.264?
I checked during recording in 23.976 override and it said 15.9 ms in 1728x972, lowest i could get by modifying A timer was 15.8 then i checked crop mode and its also the same values, just resolution is 971 instead of 972.
It would be nice to use  improved rolling shutter settings in 23.976 and most canon default framerates with and sound enabled during h.264 recording.