Magic Lantern Forum

Developing Magic Lantern => General Development => Topic started by: a.sintes on August 23, 2023, 05:10:58 PM

Title: Ultrafast framed preview (5D3)
Post by: a.sintes on August 23, 2023, 05:10:58 PM
UPDATED on 2023-09-28 to summarize the whole discussion thread :-)


After some time spent tweaking Danne's crop_rec codebase for the 5D3 (https://bitbucket.org/Dannephoto/magic-lantern_dannephoto_git/src/master/), I finally got some interesting results around the framed preview, with visible performance increases, leading to an ultrafast framed preview feature.


Latest feature overview video:


warning: the "Framed preview" menus seen in this video are not the latest ones, please read below for the updated version.


Technical details:

The purpose of this ultrafast feature is to reduce as much as possible the computation time required to perform the framed RAW preview rendering in LiveView in order to save CPU time to do other tasks (e.g.: recording RAW data).

This is achieved by precomputing everything possible, notably the RAW & LV buffers offsets and the RGB gamma transformations, so the drawing itself may consist in the lightest possible loop doing linear accesses to data thanks to simple pointer dereferencing.

The latest version of this feature only requires a 675KB memory allocation to work, even when dealing with half resolution, which must be sustainable by most cameras.

By doing this in colored and grayscale previews, we instantly get a smoother preview (both previewing & during recording), allowing us to potentially reduce the sleep times defined to leave enough headroom for the CPU to record the RAW data.

The cache precomputation is managed by simply computing a determinant value that may change when selecting a new RAW video resolution, so it's quite transparent code-wise.


Ultrafast feature menu current organisation (following @Grognard recommandations):

Framed preview
    Engine: legacy | ultrafast
    Comportment
        Idle
            Style: colored | grayscaled
            Resolution: half | quarter
        Recording
            Style: colored | grayscaled
            Resolution: half | quarter
    Timing: legacy | tempered | agressive
    Statistics: off | on

about Comportment:
We can now choose both style & resolution based over the raw_recording_state of the camera (idle or recording), which is more natural for the user (adaptive raw preview).
Anyway, we can also continue to call the raw preview routine by forcing RAW_PREVIEW_COLOR_HALFRES or RAW_PREVIEW_GRAY_ULTRA_FAST (legacy comportment), meaning we can again switch between half resolution colored and quarter resolution grayscale during mlv_play replay (was broken before) with both the legacy or ultrafast framed preview engine.
Adaptive mode also helps to avoid the colored/grayscale switch during recording when dealing with "LV freeze" framing, which is more confortable.

about Timing:
- legacy relies on the current sleep statements as in Danne's repository
- tempered only tries to speed-up things when idling (or replaying via mlv_play), which is a good compromise (faster before / safe during recording)
- agressive tries to also reduce the sleep values when recording to speed-up the display a bit (need to be tested more: may lead to unexpected recording stop depending of the write buffer saturation)


Performance increases:

We can find below the current benchmark statistics dumped on my 5D3, the values being averaged on 1000 display loops:

Quote
style
Quote
engine
Quote
hz. res.
Quote
timing
Quote
draw(ms)
Quote
gain
Quote
fps
Quote
gain
colorlegacyhalflegacy180.211ref.4.451ref.
colorultrafasthalflegacy78.703x2.298.200x1.84
colorultrafasthalfultrafast78.230x2.309.360x2.10
colorultrafastquarterlegacy51.162x3.52(*1)10.429x2.34(*1)
colorultrafastquarterultrafast53.157x3.39(*1)12.602x2.83(*1)

Quote
style
Quote
engine
Quote
hz. res.
Quote
timing
Quote
draw(ms)
Quote
gain
Quote
fps
Quote
gain
grayscalelegacyquarterlegacy46.452ref.10.840ref.
grayscaleultrafasthalflegacy33.810x1.37(*2)12.639x1.17(*2)
grayscaleultrafasthalfultrafast31.939x1.45(*2)17.840x1.65(*2)
grayscaleultrafastquarterlegacy22.598x2.0615.184x1.40
grayscaleultrafastquarterultrafast18.137x2.5623.475x2.17

(*1): no legacy reference
(*2): no legacy reference, but we got performance gain even when compared to legacy quarter resolution!

As we can see, we generally get a preview drawing routine which is between 2 and 2.5 times faster than before using this look-up table technique, leading to a global increase of performances (display frame rate) around 2 times faster: the good news about this is we can start to have a very usable quarter-resolution colored preview (~13fps) and above all an almost "realtime" (24fps) grayscale preview, even when recording.


Source code and Pull Request:

The (5D3) source code is actually available on my GitHub repository (https://github.com/arnaud-sintes/magiclantern_asintes), which is basically a fork of Danne's BitBucket one in which I continue to play (currently working on lens.c modifications and a reliable focus sequencing module).

Developpers, please help the ML community by reviewing the ultrafast framed preview Pull Request (https://github.com/reticulatedpines/magiclantern_simplified/pull/114) opened on the "magiclantern_simplified" repository, so it may be profitable for non-5D3 users.


Download links:
5D3 (1.1.3 & 1.2.3 firwmares) download links are now available directly here (https://github.com/arnaud-sintes/magiclantern_asintes/releases/tag/crop_rec_4k_mlv_snd_isogain_1x3_presets_ultrafast_2023Sep01).

These packages are a complete replacement of Danne's ones, the code being up to date with his latest code changes (February), including all the ML modules plus the Cinematographer-mode (https://github.com/arnaud-sintes/Cinematographer-mode) one: you'd better then do a fresh install to use it properly.


Final words:

Thanks a lot to names_are_hard, WalterSchulz, Danne and every testers out there!
Title: Re: Ultrafast framed preview (5D3)
Post by: Walter Schulz on August 23, 2023, 05:44:12 PM
Huh? Helping with programming steps? Me?
LOL!
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 23, 2023, 06:00:25 PM
or maybe it was just names_are_hard then? :)
Title: Re: Ultrafast framed preview (5D3)
Post by: names_are_hard on August 23, 2023, 06:23:16 PM
Walter regularly helps me with programming, otherwise how would I know how features should work, or what cams have them?

Fast preview looks good!  Haven't looked at the code but it doesn't sound like it should be too hard to integrate into any other repo, or make it work on more than the 5d3.  You might be able to get around the large single alloc problem by segmenting it.  Try say, 6 x 256kB allocs.  You'd need to segment the LUT too, and do perhaps some bitmasking ops to quickly determine which segment to use.  Only benchmarks can tell if this is worthwhile :)

Re my opinion on "where", see my recent post: https://www.magiclantern.fm/forum/index.php?topic=26814.msg244762;topicseen#msg244762

My repo now has crop_rec_4k_mlv_snd code (and, unlike other crop_rec_4k_mlv_snd forks, has all the *other* code, too).  I'd like to start bringing in code from other popular repos, so we can have a single place to work from again.  I've fixed a significant number of bugs (especially in the module system) and improved build time performance greatly.  It builds easily on modern systems, with modern compilers etc (this makes the ML binary smaller as an additional bonus).

I can't make people use it, but I think most people would like to have a single repo that's useful for everyone, and I'm willing to put in the work to merge code.
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 24, 2023, 08:15:04 AM
Yep I've seen your posts about the ML unified Git codebase you're working on and I can only be happy with this initiative: just cloned the repository this morning to check and yes, I confirm it will be very easy to integrate this preview code in it as the framed preview mechanism is basically the exact same as the one I'm currently working on.

What I propose for now is to continue to upgrade and test this ultrafast code using Danne's codebase for a while and once stabilized and validated by the community I'll open a merge request on both magiclantern_simplified and magic-lantern_dannephoto_git repositories (may be helpful for 5D3 users until your codebase properly covers 100% of Danne's features - if not already the case).

Regarding the allocation segmentation, I'll try first a slightly different drawing technique that may allow me to be able to do full-resolution colored preview using the same current buffer size, by only building a look-up-table around the RAW data pointers and doing a simple linear pointer increment in the LV buffer: must be straightforward enough in most of the cases (horizontal layout) - and potentially slightly faster also - but I need to find a way to "skip" some pixels to feed left & right black bars when dealing with some vertical aspect ratios, without having to rely on stride and column skipping techniques that are less performants.
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 26, 2023, 06:58:38 PM
Hi,

Finally got time to update the previous code and reduce by two the amount of memory required for the look-up-table, meaning I've finally managed to make it work for both colored & grayscaled preview in half and/or quarter horizontal resolution.

I've recording an extensive presentation of this experimental feature, so please refer to the following video first:



New menus are added in the mlv_lite module ("RAW video" menu), providing the following options:
(http://silentbreed.com/ML/menu1.jpg)

"Framed preview": gives access to the framed preview configuration and ultrafast modes:
(http://silentbreed.com/ML/menu2.jpg)
"Engine: allows to switch between legacy ("no cache") and experimental "ultrafast" framed preview engine
"Style": allows to stick to current style comportment (colored preview at rest/when possible in LV freeze, grayscaled when recording/in need for speed), or force the display to be always colored or grayscaled
"Timing": allows to switch between legacy or experimental "ultrafast" agressive time tweaking, consisting in reducing (or even removing) sleep statements to increase the display performances, thanks to the fastest drawing routine
"Statistics": (de)activate statistics dump in the ML console, displaying something like "[Framed preview] 18.137ms 23.475fps" every 100 displayed frames, showing the averaged computation time consumed by the framed preview drawing routine and the global refresh framerate as perceived by the user

"Resolution": [works only with "ultrafast" engine] allows to individually select the horizontal resolution of both colored and grayscaled preview, with a "half" (better quality but slower) or "quarter" (faster) resolution (note: using legacy, the colored preview is using half resolution and the grayscaled preview is always quarter resolution by design)
(http://silentbreed.com/ML/menu3.jpg)


We can find below the current benchmark statistics dumped on my 5D3, the values being averaged on 1000 display loops:

Quote
style
Quote
engine
Quote
hz. res.
Quote
timing
Quote
draw(ms)
Quote
gain
Quote
fps
Quote
gain
colorlegacyhalflegacy180.211ref.4.451ref.
colorultrafasthalflegacy78.703x2.298.200x1.84
colorultrafasthalfultrafast78.230x2.309.360x2.10
colorultrafastquarterlegacy51.162x3.52(*1)10.429x2.34(*1)
colorultrafastquarterultrafast53.157x3.39(*1)12.602x2.83(*1)

Quote
style
Quote
engine
Quote
hz. res.
Quote
timing
Quote
draw(ms)
Quote
gain
Quote
fps
Quote
gain
grayscalelegacyquarterlegacy46.452ref.10.840ref.
grayscaleultrafasthalflegacy33.810x1.37(*2)12.639x1.17(*2)
grayscaleultrafasthalfultrafast31.939x1.45(*2)17.840x1.65(*2)
grayscaleultrafastquarterlegacy22.598x2.0615.184x1.40
grayscaleultrafastquarterultrafast18.137x2.5623.475x2.17

(*1): no legacy reference
(*2): no legacy reference, but we got performance gain even when compared to legacy quarter resolution!

As we can see, we generally get a preview drawing routine which is between 2 and 2.5 times faster than before using this look-up table technique, leading to a global increase of performances (display frame rate) around 2 times faster: the good news about this is we can start to have a very usable quarter-resolution colored preview (~13fps) and above all an almost "realtime" (24fps) grayscale preview, even when recording.

This new version only requires a 675KB memory allocation to work, even when dealing with half resolution, which must be sustainable by most cameras.

As far as I tested, it works for every selected resolutions and aspect ratios - even on anamorphic modes - with globally the same performance increase (the LV feeding process is always quite the same) and I've encountered no specific issue (I've fixed the previous one around the black-bars).

This archive (http://silentbreed.com/ML/ML_5D3_preview_ultrafast.zip) provides the latest version of the code (to be applied on Danne's repository (https://bitbucket.org/Dannephoto/magic-lantern_dannephoto_git/src/master/)), including the following changes:
- src/raw.h [117-148] framed preview configuration management
- src/raw.c [2209-2590] additional ultrafast drawing routines ("templated" C code)
- src/raw.c [2591-2702] alteration of the existing raw_preview_fast_ex function for ultrafast
- modules/mlv_lite/mlv_lite.c [184-189], [1317-1345], [4076-4141], [4716-4722] & [4761-4766] framed preview menu & configuration management
- modules/mlv_lite/mlv_lite.c [4600-4615] alteration of the existing raw_rec_update_preview function for ultrafast time tweaking
- modules/mlv_play/mlv_play.c [1511-1512] alteration of the existing mlv_play_render_task function for ultrafast time tweaking


If you want to test it without a local repository build, you can use the two following links:
precompiled 5D3.113 build (http://silentbreed.com/ML/ML_build_5D3.113_preview_ultrafast.zip)
precompiled 5D3.123 build (http://silentbreed.com/ML/ML_build_5D3.123_preview_ultrafast.zip)

Enjoy and have a nice week-end!
Title: Re: Ultrafast framed preview (5D3)
Post by: andy kh on August 27, 2023, 01:49:02 PM
im not able to download. the link is not working
edit: downloaded thanks
Title: Re: Ultrafast framed preview (5D3)
Post by: Mattia on August 27, 2023, 01:55:10 PM
Hi Sintes! Thanks for your great work! I've installed your latest build on my 5d3 but it seems some parts of the menu are missing, specifically all the presets are empty, so I can't select one. Am I doing something wrong?
Title: Re: Ultrafast framed preview (5D3)
Post by: andy kh on August 27, 2023, 02:08:06 PM
Quote from: Walter Schulz on August 27, 2023, 02:06:29 PM
Link is valid and working for me.
Try different browser and/or VPN.
tried different browser and it works thanks
Title: Re: Ultrafast framed preview (5D3)
Post by: Mattia on August 27, 2023, 02:15:35 PM
Did you install it on top of another ML installation (overwriting the files) or did you format your sd card before?
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 27, 2023, 02:34:41 PM
Yep, currently you need to install it on top of latest Danne's build:
1. install Danne build (https://bitbucket.org/Dannephoto/magic-lantern_dannephoto_git/downloads/)
2. download the ultrafast archive & extract it
3. overwrite Danne's ML with archive content (all files)

No better shot for now as it's not integrated in any repository.
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 27, 2023, 02:38:29 PM
for the archive download link, I suppose it's because the files are hosted on my non-HTTPs website
Title: Re: Ultrafast framed preview (5D3)
Post by: Danne on August 27, 2023, 02:47:52 PM
Quote from: a.sintes on August 27, 2023, 02:34:41 PM
Yep, currently you need to install it on top of latest Danne's build:
1. install Danne build (https://bitbucket.org/Dannephoto/magic-lantern_dannephoto_git/downloads/)
2. download the ultrafast archive & extract it
3. overwrite Danne's ML with archive content (all files)

No better shot for now as it's not integrated in any repository.

Feel free to post full builds. Great work 👍
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 27, 2023, 04:53:05 PM
Thanks!

Links to full builds (based over Danne's repository 2023-02-03 source code (https://bitbucket.org/Dannephoto/magic-lantern_dannephoto_git/src/master/) including all modules & Lua scripts + ultrafast preview modifications + additional cinematographer (https://github.com/arnaud-sintes/Cinematographer-mode) module):
- crop_rec_4k_mlv_snd_isogain_1x3_presets_ultrafast_2023Aug27.5D3113 (http://silentbreed.com/ML/crop_rec_4k_mlv_snd_isogain_1x3_presets_ultrafast_2023Aug27.5D3113.zip)
- crop_rec_4k_mlv_snd_isogain_1x3_presets_ultrafast_2023Aug27.5D3123 (http://silentbreed.com/ML/crop_rec_4k_mlv_snd_isogain_1x3_presets_ultrafast_2023Aug27.5D3123.zip)

Some warnings may occur during the download operation due to a non-HTTPs web-hosting (you can safely bypass).
Title: Re: Ultrafast framed preview (5D3)
Post by: Skinny on August 27, 2023, 05:52:33 PM
Very nice progress! Really, especially mlv_play speed increase could be very useful! Will it be ever ported to other cameras? Like 5D2..
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 27, 2023, 06:34:23 PM
As discussed before with names_are_hard, the modifications are done mainly in the raw.c source code which seems to be quite common for all the camera models in ML, so yes I've good hope it will be available for all compatible camera! (at least the ultrafast framed preview itself, need to check for the timing tweak which is more related to mlv_lite & mlv_play modules).

I'm waiting for some users' feedback on the 5D3 to ensure it works as expected, then I'll open a merge request on both magiclantern_simplified and magic-lantern_dannephoto_git repositories.
Don't know if the 5D2 is currently covered by the simplified repo.?
Title: Re: Ultrafast framed preview (5D3)
Post by: Bruno Moly on August 27, 2023, 10:28:33 PM
I would love to record 2:35:1 in 5.7K with 5d3.
Would fast framed preview work? Would prefer filming in full frame. I mean with "RATIO" turned off.
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 28, 2023, 07:58:18 AM
don't exactly get what you're trying to achieve but anyway if the preview was ok before, yes, it will work: I've not changed the way Danne's ML works on the 5D3 (resolution, aspect ratio, presets etc.), I've just increased the software performances of the "framed preview" :)
Title: Re: Ultrafast framed preview (5D3)
Post by: Mattia on August 28, 2023, 08:23:51 AM
Quote from: a.sintes on August 27, 2023, 06:34:23 PM
I'm waiting for some users' feedback on the 5D3 to ensure it works as expected, then I'll open a merge request on both magiclantern_simplified and magic-lantern_dannephoto_git repositories.
Don't know if the 5D2 is currently covered by the simplified repo.?

I tried it yesterday and it works as expected but only when I set things so I can have continuous shooting. Then it's all perfect. If I exagerate in resolution or bit depth and the camera stops recording after few frames I don't have a fast preview there, but I guess this is the normal functioning..
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 28, 2023, 08:55:33 AM
yes, of course it doesn't change the limitations of the writting process on the camera (in UHD I personally continue to use "LV freeze", that also benefit of the ultrafast mode in a way), anyway maybe you can avoid some recording drops by just activating the ultrafast engine without selecting the timing tweak so it will leave some extra CPU resources that may be useful to avoid buffer saturation, helping to run a longer recording distance than before.

We need to keep in mind that most of time when the display is freezing, it's because the write buffer starts to be saturated so we need to try to stop everything else on the camera except the RAW writting process to have a chance to keep the recording alive...
Title: Re: Ultrafast framed preview (5D3)
Post by: Mattia on August 28, 2023, 10:02:57 AM
Anyway, yes, it works very well and the preview is much more fluid and responsive than before! Thanks for this great hack! :)
Title: Re: Ultrafast framed preview (5D3)
Post by: Bender@arsch on August 28, 2023, 10:43:03 AM
I've tested it and it works very well, good job.
It's nice to see that things keep progressing.

But with some side effects/ problems:

- If i use grayscale preview, i can't switch back from crop preview if i press half shutter or star button for focusing for example

- (Raw)Zebras don't hide while record now (I set hide while record, but it has no effect) -> i need to disable it manually everytime

- write speed with ultrafast grayscale is lower now i think-> is it possible to set the colored preview only without changing grayscale while recording?

I don't testing Play preview or have the raw data checked for errors....
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 28, 2023, 01:29:50 PM
Thanks a lot for the testing & feedback!

- I don't reproduce your first issue, I can press half shutter to auto-focus then it's going back properly to the preview when released.
Anyway please note I can see then some bad side effect to this back-and-forth, with the black bars being not properly cleared when going back (need to find where to add the piece of code to clear the screen so it will always work well, thought it was solved...), but it doesn't affect the preview rectangle itself

- Just checked and the zebras are properly hidden with the "hide while record" option set here, anyway I've got some strange results to my eyes with zebra displays... need to check if it was looking the same before with the original Danne's repository, I'll keep you in touch: as I've rebuilt the whole thing with a more recent compiler, maybe it adds some unexpected side effects

- this is a potential side-effect of the "timing tweak" option: can you please try to disable it (keeping the "ultrafast" engine on) and check if it's the same as before in terms of writing speed?
As explained this option is quite experimental as I don't know exactly if the initial magic numbers set in the recording code were wisely chosen or not, so maybe I've reduced them too much :-)
For the second part: yes you can now get the colored preview during recording, just switch to "all colored" in the "style" sub-menu, you can also downscale its horizontal resolution to "quarter" to be faster (actually: quarter colored preview is now faster than previous quarter grayscaled, so it's worth it).
Title: Re: Ultrafast framed preview (5D3)
Post by: Bender@arsch on August 28, 2023, 02:17:57 PM
Thanks for reply. I tested it again and all problems are gone 🤔... Only 2 times i hang in crop preview (from maybe 20 times), and i can't also reproduce it. But after refreshing live view, all works again (double press menu).

I think i need more testing 😅
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 28, 2023, 02:40:20 PM
Encountered this also from time to time (specifically with UHD preset, less with 3.5K - particularly when playing too much with preset/resolution changes), but it was already there for as long as I've been using regular Danne's builds on my 5D3 :-)
As you guess, going back-and-forth in the ML menus generally solve it, sometimes we need just to restart the camera.
Title: Re: Ultrafast framed preview (5D3)
Post by: Grognard on August 30, 2023, 10:22:28 AM
Great new features.

It works pretty well. But I also have one side effects If I use grayscale preview, I can't switch back from crop preview if I press half shutter.
It's linked with timing tweak.

Maybe you can add a other option to change resolution between idle and recording. It would be Nice to have half colour resolution before and quarter colour resolution when recording.

Thank you!
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 30, 2023, 07:44:15 PM
Thanks for the feedback!

Cannot reproduce the switch back issue after a half shutter press, need to dig it as you're not the only one it seems...
If it's linked to the "timing tweak" option I think I'll add a third timing option that only removes the sleep when idling, leaving the old values when recording for testing purpose.

And yes, I completely agree with your proposal: I'll change the menu organisation so we can independently choose both "style" and "resolution" for two "idle" and "recording" modes, may also change a bit the way the current "LV freeze" behave (potentially alterning colored & grayscale), which is not very confortable for now.
Title: Re: Ultrafast framed preview (5D3)
Post by: ShittyWebsite on August 31, 2023, 02:55:10 PM
Helo, looking good!
(since we are talking about preview i feel like this might help)
I'm having problems, I guess is not ultrafast but half-shutter behavior , is there any setting or anything to do to avoid half-shutter to zoom? (perhaps somewhere codded)

Sometimes i use ("RAW video", "Rec trigger", "Half-shutter: start/pause") and i get stuck cropped preview, (3.3k/3.5k stuck cropped preview,anamorphic stuck cropped distorted preview,Full-res/UHD/4k stuck with no preview at all)



While playback:
Is it possible to disable automatically for a while?








Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on August 31, 2023, 04:00:04 PM
This half-shutter action in ML seems to be a simple relay to Canon native comportment (autofocus) and if I understood well the code doing the translation in ML is (at least on Danne's repository) in the src/module.c source file(around line 916), so yes, I suppose it's possible to bypass it by adding a new dedicated menu option setting a boolean variable to do so (but it will require a whole ML build/update as it's outside the modules boundaries).

Anyway I won't mix this one with a potential ultrafast feature commit, as it's completely unrelated :-)
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on September 01, 2023, 08:50:48 AM
Just dropped a new version with independent menus to setup preview when idling or recording (as suggested by Grognard) but also updated timing options to continue the testing.

new menu organisation:
Framed preview
    Engine: legacy | ultrafast
    Comportment
        Idle
            Style: colored | grayscaled
            Resolution: half | quarter
        Recording
            Style: colored | grayscaled
            Resolution: half | quarter
    Timing: legacy | tempered | agressive
    Statistics: off | on

About Comportment:
We can now choose both style & resolution based over the raw_recording_state of the camera (idle or recording), which is more natural for the user (adaptive raw preview).
Anyway, we can also continue to call the raw preview routine by forcing RAW_PREVIEW_COLOR_HALFRES or RAW_PREVIEW_GRAY_ULTRA_FAST (legacy comportment), meaning we can again switch between half resolution colored and quarter resolution grayscale during mlv_play replay (was broken before) with both the legacy or ultrafast framed preview engine.
Adaptive mode also helps to avoid the colored/grayscale switch during recording when dealing with "LV freeze" framing, which is more confortable.

About Timing:
- legacy relies on the current sleep statements as in Danne's repository
- tempered only tries to speed-up things when idling (or replaying via mlv_play), which is a good compromise (faster before / safe during recording)
- agressive tries to also reduce the sleep values when recording to speed-up the display a bit (need to be tested more: may lead to unexpected recording stop depending of the write buffer saturation)

Updated code is available here:
crop_rec_4k_mlv_snd_isogain_1x3_presets_ultrafast_2023Sep01_patch (http://silentbreed.com/ML/crop_rec_4k_mlv_snd_isogain_1x3_presets_ultrafast_2023Sep01_patch.zip)

5D3 pre-builds are available here:
crop_rec_4k_mlv_snd_isogain_1x3_presets_ultrafast_2023Sep01.5D3113 (http://silentbreed.com/ML/crop_rec_4k_mlv_snd_isogain_1x3_presets_ultrafast_2023Sep01.5D3113.zip)
crop_rec_4k_mlv_snd_isogain_1x3_presets_ultrafast_2023Sep01.5D3123 (http://silentbreed.com/ML/crop_rec_4k_mlv_snd_isogain_1x3_presets_ultrafast_2023Sep01.5D3123.zip)
Title: Re: Ultrafast framed preview (5D3)
Post by: ShittyWebsite on September 01, 2023, 12:59:29 PM
Great build!

Everything working perfectly, did a bunch of tests, the idle/recording trick fixed all half-shutter problems

What's impressive is that with "Rec trigger: Start/Pause" while recording but paused (waiting half-shutter to start) the previews stays "idle" only changing when actually recording

That's great, pretty much real-time BW while recording
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on September 01, 2023, 01:24:01 PM
Thanks a lot, it's a very good news for the half-shutter issue!

For the "rec trigger" thing, it's because I used the raw_recording_state flag in the opposite direction, switching to recording preview state only when actually set to RAW_RECORDING, leaving all the other potential states (IDLE, PREPARING, PRE_RECORDING & FINISHING) sticked to the idle category: happy to see it's a good decision :-)
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on September 05, 2023, 02:02:09 PM
FYI, two pull requests are currently opened around this feature on both Danne's 5D3 specific repository and name_are_hard ML simplified repository:
- https://github.com/reticulatedpines/magiclantern_simplified/pull/114 (https://github.com/reticulatedpines/magiclantern_simplified/pull/114)
- https://bitbucket.org/Dannephoto/magic-lantern_dannephoto_git/pull-requests/2 (https://bitbucket.org/Dannephoto/magic-lantern_dannephoto_git/pull-requests/2)
Title: Re: Ultrafast framed preview (5D3)
Post by: kpn on September 06, 2023, 01:27:27 AM
Amazing! Appreciate the effort
Title: Re: Ultrafast framed preview (5D3)
Post by: Bruno Moly on September 06, 2023, 02:12:40 PM
I don't want to be disappointed. I think it is a great idea. I recently just wanted to see if it is worth it for me. And I had both settings side by side and I've got two 5D3s and I prefer to press the info button and switch between magic zoom and the other preview. That was tested with the anomorphic mode.
Is there any better rolling shutter or some other kind of better quality, if I use this magic lantern version?
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on September 06, 2023, 03:24:03 PM
Sorry, I don't understand your comment: did you test it yourself? did you compare before & after on two different 5D3 camera? are you disappointed? :-/
Don't see also the point about the magic zoom feature, which is completely something else.

About your last question: it doesn't change anything else than the "framed preview" display performances in LV as stated by the feature name itself, so don't expect any other magic side effects :-)
Title: Re: Ultrafast framed preview (5D3)
Post by: Bruno Moly on September 06, 2023, 08:11:32 PM
Yes, I tested myself. Should I make a proof video? :)
Difficult for me to ask for something. A great step with the Canon EOS 5D Mark III...
would be... I would wish for the aspect 2:35:1. {full frame | 1.00 /\ 1808x2300 | 1.06}    I think the most of my favorite movies are filmed in that aspect ratio. It will make the camera, more like all the other cameras and I think compared to the modern mirrorless cameras, it has a better film grain. The whole picture detail, with being not so very sharp, makes it a comparable cinema camera.
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on September 06, 2023, 08:22:35 PM
Unrelated, but you can already get 2.35:1 or 2.39:1 aspect ratios when recording RAW, no matter the resolution (Movie/RAW video/Aspect ratio or Movie/Ratio if using anamorphic presets)
Title: Re: Ultrafast framed preview (5D3)
Post by: andy kh on September 13, 2023, 07:38:07 PM
i get pink frames with this build. Is anyone also getting pink frames?

edit: its my cf card that gives me pink frames. i tried with another cf card and there is no pink frames
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on September 14, 2023, 05:58:21 AM
good to know, thanks!
Title: Re: Ultrafast framed preview (5D3)
Post by: koopg on September 27, 2023, 09:14:29 PM
great news, but reading this thread got me a bit confused.

should I install this on top of danne pre installed build ?

thanks

Sent from my SM-N975F using Tapatalk

Title: Re: Ultrafast framed preview (5D3)
Post by: Walter Schulz on September 27, 2023, 09:29:10 PM
@a.sintes: Confusion is understandable.
It's proper practice around here to update initial posts with latest info and links.
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on September 28, 2023, 07:14:27 AM
@Walter Schulz: you're totally right, I'll do the change today.

Update done, do not hesitate if not clear enough now!
Title: Re: Ultrafast framed preview (5D3)
Post by: koopg on September 28, 2023, 03:35:34 PM
OK, I have manged to test it, it works.
many thanks for your work.

is there a way to use this while recording?
I have the croped real time when recirding, I couldnt find a way to change it to this new mode.

Sent from my SM-N975F using Tapatalk

Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on September 28, 2023, 03:51:52 PM
Yes, in the "movie/RAW Video" tab you need to:
- set "crop rec preview" to "OFF" (not "auto mode")
- set "Preview" to "Framing" or "Frozen LV" (not "auto" nor "real-time")
- ensures "Kill global draw" is "OFF"
Title: Re: Ultrafast framed preview (5D3)
Post by: koopg on September 28, 2023, 04:29:44 PM
not working

https://youtu.be/KOF-apjtOsI?si=msNPNHMMce05zO15

Sent from my SM-N975F using Tapatalk

Title: Re: Ultrafast framed preview (5D3)
Post by: Bender@arsch on September 28, 2023, 05:06:23 PM
Quote from: koopg on September 28, 2023, 04:29:44 PM
not working

Sent from my SM-N975F using Tapatalk



Change "Kill global draw" to off
Title: Re: Ultrafast framed preview (5D3)
Post by: koopg on September 28, 2023, 08:00:38 PM
Quote from: Bender@arsch on September 28, 2023, 05:06:23 PM
Change "Kill global draw" to off
great it works, thanks.

OK now when I am all set, between
what I can do
and
what is most comfterble to use..

what is your goto witg this new settings

p.s
when "kill global drraw" is set to "off" the status of cards recording is gone, and I have no idea if card spanning is working without problem(some time I see only one card working and I need to restart)
if you have a workaround?..


Sent from my SM-N975F using Tapatalk
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on September 29, 2023, 03:40:53 PM
"comfortable" really depends from a person to another... I personally always set "Preview" to "Framing" unless recording in 4K, where I need to switch it to "Frozen LV" in order to allow continuous recording, then my framed preview configuration is always set to quarter resolution/grayscale no matter if idle or record as I prefer to check the scenery lighting/colors with my own eyes but the framing with the camera.

mmm never checked the status of the card spanning while recording (I mean: if it works once, it will work unless you change your configuration), I'm just putting attention to the global record buffer state when it's becoming red, generally meaning the scene is slightly overexposed and the camera it's struggling to encode/record the RAW data.
Title: Re: Ultrafast framed preview (5D3)
Post by: koopg on September 29, 2023, 06:42:48 PM
off topic
why do you use tge 4k?
how can you work without preview?
isnt better to shoot the amazing 3.5k  ?

Sent from my SM-N975F using Tapatalk

Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on September 29, 2023, 08:52:44 PM
Using "Frozen LV" you can actually record 4K WITH proper framed preview, it's just less smooth and you increase the risk to encounter record buffer saturation.
But with all the hacks activated, card spanning, SD overclock etc. it's quite usable and most of the time it's ok for continuous recording, specifically when targeting RAW 12bits instead of 14bits (which is enough even with extreme color grading post-process, honestly).

But yes, I also prefer the 3.5K 14bits x5 preset experience, which is almost flawless on the 5D3 (recorded myself a whole shooting day without any trouble for a music video project).

The advantage of 4K being the "native" 4K timeline, avoiding an additional upscaling stage to be applied over your 3.5K footages before typical YT uploads.
Title: Re: Ultrafast framed preview (5D3)
Post by: Mattia on September 29, 2023, 11:09:55 PM
Quote from: a.sintes on September 29, 2023, 08:52:44 PM
specifically when targeting RAW 12bits instead of 14bits (which is enough even with extreme color grading post-process, honestly).

When you say 12bits and 14bits, you mean 14bit and 12bit lossless? On my 5d3, with all the hacks active, sd overclock, audio off, etc I can't record more than few seconds if I use a non lossless bit depth. Am I doing something wrong?
Title: Re: Ultrafast framed preview (5D3)
Post by: Walter Schulz on September 29, 2023, 11:15:57 PM
Yes
Run benchmark in photo mode and share results.
Title: Re: Ultrafast framed preview (5D3)
Post by: Mattia on September 29, 2023, 11:45:34 PM
Samsung Pro Plus 256Gb
(https://i.ibb.co/K0QZWjR/IMG-20230929-233511.jpg) (https://ibb.co/FxfvzbN)

Samsung Pro Plus 256Gb + Lexar Professional 1066x 64Gb
(https://i.ibb.co/WtY6FVd/IMG-20230929-233631.jpg) (https://ibb.co/8cS02YR)

Buffer R/W
(https://i.ibb.co/9YXLDwv/IMG-20230929-234255.jpg) (https://ibb.co/JkL41xd)

Title: Re: Ultrafast framed preview (5D3)
Post by: Walter Schulz on September 30, 2023, 12:01:29 AM
Looks perfect.
Cam limit for combined write is 145 MByte/s for continuous recording.
Check data rates for your settings.
Title: Re: Ultrafast framed preview (5D3)
Post by: Bender@arsch on September 30, 2023, 12:22:07 AM
Quote from: Mattia on September 29, 2023, 11:09:55 PM
When you say 12bits and 14bits, you mean 14bit and 12bit lossless? On my 5d3, with all the hacks active, sd overclock, audio off, etc I can't record more than few seconds if I use a non lossless bit depth. Am I doing something wrong?

Yes, he means 12 and 14bit lossless 😉
Just use the bitdepth in the Movie Tab - it is all lossless and a tweaking from the 14bit lossless. Just let the data format in raw video at 14bit lossless.
Title: Re: Ultrafast framed preview (5D3)
Post by: Mattia on September 30, 2023, 12:55:44 AM
Once again, I've experienced how after running the benchmarks my cards perform much better. This is something that should be investigated, it doesn't seem a casual occurrence. Before running the benchmarks I could record only one or two seconds at 10bit or 12bit (not lossless), after running the benchmarks my 5d3 seemed capable of continuous shooting at the same bit depths. However, before I could have a (choppy) preview, after I couldn't, no matter if I selected "framing" or "live view" or any other option available for the preview, it remained always frozen.
Title: Re: Ultrafast framed preview (5D3)
Post by: Walter Schulz on September 30, 2023, 01:19:24 AM
Willing to bet no small amount it is completely unrelated.
Title: Re: Ultrafast framed preview (5D3)
Post by: dxotic on September 30, 2023, 09:11:52 AM
 I am stumped. I have successfully shot 1808x 2268 anamorphic continuous with my EX Fat Formatted Extreme Pro SD and CF spanned cards but as you can see I cant even get it going now , not sure what I've done wrong.. and I can't run the benchmarks as the modules aren't loading any help with workflow for my setup with anamorphic would be greatly appreciated.
Title: Re: Ultrafast framed preview (5D3)
Post by: Walter Schulz on September 30, 2023, 09:19:48 AM
Rename ML dir, rename autoexec.bin and ML-SETUP.FIR.
Download latest build and copy extracted build content to card.
Retry (including benchmark) and report back.
Title: Re: Ultrafast framed preview (5D3)
Post by: Danne on September 30, 2023, 09:25:50 AM
Looks like it maybe records to SD card. Try removing the SD card for testing purposes.
It is also not advices to change resolution from RAW video section but stick to preset in main movie tab.
Title: Re: Ultrafast framed preview (5D3)
Post by: Mattia on September 30, 2023, 12:30:09 PM
Is it a normal behaviour when selecting 10 or 12 bit (non lossless) the preview become frozen? Regardless of the preview option chosen in the menu..
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on September 30, 2023, 12:45:31 PM
Yes, it's expected: RAW uncompressed requieres too much recording bandwidth, which is unsustainable for the camera buffer, when compressed (but lossless) RAW reduces in ~half the amount of data to be flushed on the cards, leaving the record buffer free enough to allow continuous recording.

As explained before: let the default 14bits lossless setting as it is and just switch the bit depth to 10/12bits in the Movie menu.
Title: Re: Ultrafast framed preview (5D3)
Post by: Mattia on September 30, 2023, 01:11:35 PM
Quote from: a.sintes on September 30, 2023, 12:45:31 PM
As explained before: let the default 14bits lossless setting as it is and just switch the bit depth to 10/12bits in the Movie menu.

In what would it result? Will it record in 14bits lossless in the end? I usually turn off bit depth in the movie menu and select 14 bits lossless in the raw video sub menu.
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on September 30, 2023, 01:32:26 PM
With 14bits lossless selected in RAW:
When bit depth turned off=14bits lossless
When bit depth set to 12bits=12bits lossless
When bit depth set to 10bits=10bits lossless
etc.

Yes, too many menus with almost the same options doesn't help...
Title: Re: Ultrafast framed preview (5D3)
Post by: Mattia on September 30, 2023, 02:11:31 PM
Quote from: a.sintes on September 30, 2023, 01:32:26 PM
With 14bits lossless selected in RAW:
When bit depth turned off=14bits lossless
When bit depth set to 12bits=12bits lossless
When bit depth set to 10bits=10bits lossless
etc.

Yes, too much menus with almost the same options doesn't help...

I didn't know that, thanks!
Title: Re: Ultrafast framed preview (5D3)
Post by: dxotic on September 30, 2023, 03:26:07 PM
I have no idea why it isn't writing to the SD card even though i have card spanning on. Im sure it use to. I have formatted the card on the PC and also cleared the settings on the camera, I have found that some of these settings seems to "stick" even if it gets formatted.

I can get continuous recording if I turn the bit depth to 10 bit. 

But how do i get the anamorphic ratio correction?

I turned on the cinemato.mo on and it fails to load... Is it my SD card , I have two and they seem to be both the same result.
Do I turn it on or will it autoload when Im in anamorphic mode


(https://i.ibb.co/N60bYQx/IMG-5777.jpg) (https://ibb.co/N60bYQx) (https://i.ibb.co/0BQzNQk/IMG-5775.jpg) (https://ibb.co/0BQzNQk) (https://i.ibb.co/H4PNQ43/IMG-5774.jpg) (https://ibb.co/H4PNQ43)
Title: Re: Ultrafast framed preview (5D3)
Post by: Walter Schulz on September 30, 2023, 03:33:16 PM
Which card is used to run ML?
If it is your CF there is no use reformatting SD because ML settings are stored in CF's ML/SETTINGS directory and those could be swiped by using "Restore ML defaults" in Prefs -> Config files/options.
Title: Re: Ultrafast framed preview (5D3)
Post by: dxotic on September 30, 2023, 04:35:31 PM
I have  ML on the SD card and I checked the CF and there was nothing on it besides a .log file and the MLVs I have now formatted it EXFAT on the PC
Title: Re: Ultrafast framed preview (5D3)
Post by: dxotic on September 30, 2023, 04:37:30 PM
I've also restored to default as You've suggested but it doesn't seem to have wiped it and I didn't have to reconfigure it, it seems
Title: Re: Ultrafast framed preview (5D3)
Post by: Walter Schulz on September 30, 2023, 04:58:01 PM
Clarification: Both camera defaults.and ML defaults?
In former post you wrote camera defaults.
Title: Re: Ultrafast framed preview (5D3)
Post by: dxotic on September 30, 2023, 05:40:59 PM
This is what I am faced with:

I slow reformatted both cards. and defaulted both the camera as well as the ML as pointed out by Walter and then turned on bench.mo , restarted and did the bench and the SD worked then i turned on the card spanning and the 240 speed up of the SD card and did the bench again and the SD didnt benchmarked.

(https://i.ibb.co/pL4d3WJ/IMG-5780.jpg) (https://ibb.co/pL4d3WJ)  (https://i.ibb.co/WkQwrT0/IMG-5782.jpg) (https://ibb.co/WkQwrT0) (https://i.ibb.co/0X87btd/IMG-5781.jpg) (https://ibb.co/0X87btd) (https://i.ibb.co/HNQzcYD/IMG-5783.jpg) (https://ibb.co/HNQzcYD)
Title: Re: Ultrafast framed preview (5D3)
Post by: Walter Schulz on September 30, 2023, 05:51:11 PM
Try lower oc frequencies and test both Access modes (oc sub menu: SDR104, SDR50)
Title: Re: Ultrafast framed preview (5D3)
Post by: dxotic on October 01, 2023, 05:54:41 AM
Good News!

I once again cleared both the camera and ML back to default config and re-entered the needed information for Raw shooting at 1880x2268 Anamorphic Preset 12 Bit and the SD card spanning and SD card OC at 192 and both cards were being written to.

Cards are SanDisk Extreme Pro  SDXC 64Gb  and  Sandisk Extreme Pro Extreme Pro CF 64Gb 90MB/s
(https://i.ibb.co/QMsvnKG/IMG-5784.jpg) (https://ibb.co/QMsvnKG)

here is the result with 12 Bit Raw 1880x2268 continuous recording

(https://i.ibb.co/Gc9G44q/IMG-5785.jpg) (https://ibb.co/Gc9G44q)


my next enquiry is what is the purpose of the cinemato.mo
before I enable it. and how do I get the Anamorphic correction in Live view as the Anamorphic in  Display doesnt exactly correct  the  2:1 ratio as intended.

any other tweaks you can recommend will be greatly appreciated
:D
Thanks for all your help
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on October 01, 2023, 07:08:08 AM
cinemato.mo is a focus sequencing module (https://github.com/arnaud-sintes/Cinematographer-mode), its only purpose is to replace the embedded two-points limited focus rack feature by allowing the preparation of multiple focus points to be replayed later (during recording).

Please note I'm currently working on a complete rewrite of it, relying over a preliminary lens calibration process that will allow to easily setup the focus sequence by using the auto-focus; sadly, it will require not just an additional module this time but also a different version of ML code (around lens.c) to be reliable, so I'll push it directly on my repository in the future.
Title: Re: Ultrafast framed preview (5D3)
Post by: koopg on October 27, 2023, 01:40:53 PM
thia is NOT a rant !!
I apritiate any effort being done for ML and 5D3

yesterday was uaing your build for the first time in a real world scenario

I had a problem with whic I cant define yet so will leave it for a diffrent post
but I couldnt get to see the full frame even in idle

how ever !
I shot a 20 min interview, which when coming back home was 1:20

I was one shooting this(one 20M REC)
but in the end some thing was wrong
and I got no indication for.

camera kept looking like all ia good and recording.

few post back on this thread I was concering
the lack of the widget wich show you both card are working

this is what I was reffering to.

yes, it could have been me not "knowing my gear/ML version" and by that I mean, maybe there was indication of somthing worng and I just didnt know to look for it.
or not even related to the changes you have made
only to the way data is presnted.
I sould have done my home work better and practice this changea.


again, *thank you for bringing new  idea/versions
for our 5D3, dont stop*
but if you find a way to present card data like in legacy mode
I would be happy



Sent from my SM-N975F using Tapatalk
Title: Re: Ultrafast framed preview (5D3)
Post by: a.sintes on October 27, 2023, 02:14:20 PM
Sorry, have really hard time to understand your issue/question...

At least, for the last one "but if you find a way to present card data like in legacy mode", is it related to this other change? (https://www.magiclantern.fm/forum/index.php?topic=27049)