Danne's crop_rec_4k experiments for EOS M

Started by Danne, December 03, 2018, 06:10:17 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Danne

Yes, tested.
It is not evident what to look for to me. But general tests on static scenes I cannot see anything significant and judging from that we can get different results from same builds and commits it suggests it´s a problem somewhere else.

Why isn´t compiler.app working? Can you try double clicking the main.command inside Compiler.app/Contents/?

You might wanna give the command admin rights:
chmod u=rwx main.command

masc

Brew isn't supported on OSX 10.9 (or the packages needed). So no chance for your app. It won't install anything.
5D3.113 | EOSM.202

Danne

Ok, reproduced. Wtf! Some alignment issue:


82, 0


-4, +4



82, 0


-4, +4



Brew for 10.9?
https://coolestguidesontheplanet.com/setting-up-os-x-mavericks-and-homebrew/


EDIT:
Tested again and cannot reproduce it now. Crazy. Can´t make sense of it.

masc

Yes, that looks like what I see here. Best use a wideangle lens where a lot is in focus. Then search trees and hard contrast edges at 45°. Very easy to reproduce this way.
5D3.113 | EOSM.202

Danne

I did a slight change and it seemed to be enough. Is this version working for your wide angle lens?
https://bitbucket.org/Dannephoto/magic-lantern/downloads/crop_rec_4k_mlv_snd_isogain_1x3_presets_2019Feb17.EOSM202.zip

        skip_top = 81;
        skip_right = 60;
    skip_bottom = 3;

DeafEyeJedi

Tying to reproduce this w both 10mm 2.8 & 11-20mm 2.8 lenses to no avail. I don't blame you guys for this strangeness though. I'm pointing at a white wall w a fan (to show /aliasing/moire effects) and will try again w the latest build from 50 mins ago.
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

masc

I think, first of all, we need a simple strategy to reproduce. I loaded the ISO 12233 test chart, printed with a laser printer... not perfect, but should be enough. I took EF-M 18-55 STM @ 55mm, fully open. And now you might see which picture is which setting:


I think the pics look very different... see the focus pixels and the amount of moiree.
5D3.113 | EOSM.202

Danne


a1ex

Best guess: this must be 3x3 readout with line *and* column skipping!

Here's a test on the resolution chart (roughly this, but updated for movie crop mode, where IIRC you can't just toggle between x1 and x5 zoom freely). This test will take 2 images, one in the tested video mode and another in x5 zoom, with no absolutely camera or subject motion between them. That will reveal the exact pixel binning mode. Tested on 5D3 (iso-research branch, but should work on any recent experimental build).


-- Pixel binning test
-- Save this file as bintest.lua or similar.

--[[
Requirements:
- lua.mo (of course)
- silent.mo
- test subject: resolution chart, perfectly focused and with good light
- camera standing still (important) on a flat surface
- absolutely NO camera or subject movement during the test (important!)
--]]

menu.close()
sleep(1)
display.notify_box("Preparing...")
sleep(1)
assert(camera.mode == MODE.MOVIE)
assert(lv.running)
menu.set("Silent Picture", "Silent Mode", "Simple")
menu.set("Shoot", "Silent Picture", "Simple, DNG")
menu.set("Movie", "RAW video", "OFF")       -- just in case (no need to load mlv_rec or mlv_lite)
menu.set("Movie", "RAW video (MLV)", "OFF") -- but if you do, let's turn them off
sleep(5)

-- first test image in 1080p 3x3 (derived from Canon's crop mode)
display.notify_box("First test image...")
menu.set("Movie", "Movie crop mode", "ON")
menu.set("Movie", "Crop mode", "mv1080p MCM rewire 16:9")
sleep(1)

-- refresh LiveView
camera.gui.menu = true
sleep(1)
assert(not lv.running)
camera.gui.menu = false
sleep(1)
assert(lv.running)
sleep(2)

-- take a silent picture
key.press(KEY.HALFSHUTTER)
sleep(1)
key.press(KEY.UNPRESS_HALFSHUTTER)
sleep(5)

-- now turn off crop mode and enter x5 zoom
display.notify_box("Second test image...")
menu.set("Movie", "Crop mode", "OFF")
menu.set("Movie", "Movie crop mode", "OFF")
sleep(1)

-- refresh LiveView once again, just in case
camera.gui.menu = true
sleep(1)
assert(not lv.running)
camera.gui.menu = false
sleep(1)
assert(lv.running)


lv.zoom = 5
sleep(20) -- large delay to "fix" vertical stripes

key.press(KEY.HALFSHUTTER)
sleep(1)
key.press(KEY.UNPRESS_HALFSHUTTER)
sleep(5)

-- cleanup
menu.set("Shoot", "Silent Picture", "OFF")
lv.zoom = 1
display.notify_box("Finished.")


edit: after writing and testing this script, I've just realized it would be enough to take one test picture with our crop mode enabled (i.e. 1080p 3x3 derived from it), and another one with our crop mode disabled (i.e. 1:1 readout). In both cases, Canon's movie crop mode would be active.

BTW - if my hypothesis is true, the fix is somewhere in the CMOS registers. You are lucky - the search space is very small :D

Tweaking skip offsets will do absolutely nothing to fix the image aliasing. These offsets will specify how to interpret the raw data in post (i.e. how many border pixels to throw away). The effect of that would be only in the alignment of focus pixel maps, but that won't help with the aliasing issue in any way.

masc

Quote from: Danne on February 17, 2019, 06:31:39 PM
How does the last build perform?
I would say even worse... the moiree is so extreme, that you can see it in liveview already.
5D3.113 | EOSM.202

masc

@ a1ex: I tried running your script... I saw the outputs "preparing, 1st, 2nd, finished...", but where do I find the pictures? Can't find anything on my card...  :o

Edit: halfshutter for taking a silentpic? Is that correct?
5D3.113 | EOSM.202

a1ex

They should be in the usual place (DCIM directory). If they don't appear, there might be some memory allocation issue. Any relevant message in the Debug tab or on the console?

If you take the pictures manually, with the silent picture module, does that work? Yes, with half-shutter.

Sorry, unable to test the script on the M. It did work on 5D3 (including the pictures).

masc

Sorry... found it... too stupid. I have to load silent.mo! Will test again now.
5D3.113 | EOSM.202

Danne

Ok, could you check into a1ex findings masc? Running out of time here.(Cool, saw masc already tested)

The two cmos regs I can make use of is cmos 5 and cmos 7. Both available for tweaking in Crop mode menu. They are now set to:
cmos 5 0x20
cmos 7 0x800


It is not clear to me where and how to securely reproduce this issue. Just testing now it seemed when I was first starting my cam the aliasing seemed worse but after first recording seemingly som regs settled and the next recording was better. This has to be taken with a grain of salt. No tripod used.

Any other recommended cmos regs to be used are very welcome.
Also curious on a personal note how to add these regs won´t bite in crop_rec.c:
case 0xc0f383d4: return 0x4f0010;
case 0xc0f383dc: return 0x42401c6;

masc

Hm... still have problems with the script. Again no picture. Then I setup silent shoot manually - no prob - working with halfshutter and DNG availlable.
5D3.113 | EOSM.202

a1ex

Any relevant messages on the console (while running the script), or in the Debug menu (afterwards) ?

edit: also tested on 60D, no issues.

masc

Got it. I enabled silent picture mode manually, run the script -> bingo.
Here are the files: https://www.dropbox.com/s/o3sohi4i88xhwe3/binningtest.zip?dl=0

The setup tested should be:

        skip_top = 82;
        skip_right = 60;
    skip_bottom = 2;

->the yesterdays setup "with stairs"
5D3.113 | EOSM.202

a1ex

OK, tested it in QEMU directly on Danne's build. The menu.set calls for the silent picture menu failed, but all others appear to have worked. One of them was my typo.

I wonder what's up with the vertical lines in the x5 mode. This is *after* crop_rec was turned off, and LiveView refreshed by going into Canon menu and back. Maybe it still has some hooks running? I've edited the script with a minor change that should give Canon firmware sufficient time to reduce these stripes.

Mind running the test again, with the lights turned on? The images are quite underexposed.

Edit: is it just me, or was this test done in "regular" 1080p, i.e. not the one derived from Movie Crop Mode? I don't see the "horizontal" aliasing in this picture (the extreme moire just isn't there). I've assumed the right configuration for the "buggy" 1080p was with "Movie crop mode" set to "ON" and "Crop mode" set to "mv1080p MCM rewire 16:9". If this is not the case, just edit the script. Both options appear to work fine in QEMU (menu.set changes them successfully).

Or maybe you need to enter Canon menu and go back to LiveView more than once, or other kind of trickery? What exactly are you doing to enable this mode manually, without a script?

Danne

Correct about Movie crop mode on and then the mcm preset.
I did an exception raw.c:
/* work in progress */
        #ifdef CONFIG_EOSM
if (mv1080crop)
{
        skip_top = 84;
        skip_right = 60;
}
        #endif

Wanted it to match 1736x976(16:9).
Maybe clean out the exceptions and run clean Movie crop mode?
Will do some more checking when I have more time...

masc

Updated the script and run again. https://www.dropbox.com/s/oi5y5ebntdh2rnp/binningtest2.zip?dl=0
Sorry... we're very poor here... all 4 lights were on. :D But I raised ISO, so it should look better now. Vertical stripes are still there.

One more finding: I was able to see the aliasing with magic zoom function in liveview. I then pressed somehow 2x canon menu button, enter, leave. After that all the aliasing stairs were away - using the "bad" mode. Recorded another MLV and it looked like the one with -4+4 skipping at top and bottom. Maaaaagic.

How do I enabling the mode:
- switch on camera
- activate crop_rec setup "... rewire ..."
- crop_mode = ON
- leave ML menu
- record

-> when pressing 2x menu button before recording, all is fine.
-> maybe this is why Danne was not able to reproduce?!
5D3.113 | EOSM.202

a1ex

@masc: looks better, but... where's the extreme moire?!

@Danne: No need to change anything in the core code or crop_rec; I want to test the current configuration. I'm looking for a way to switch, from a Lua script, between 1080p (derived from movie crop mode) and some sort of 1:1 crop mode (either x5 zoom, or plain movie crop mode - any of these will do).

The last test images were taken in "regular" 1080p (not the one with extreme moire), and x5. Maybe you can help debugging that script? I need one image in the "extreme moire" 1080p mode, and another in some sort of 1:1 crop mode (x5 or plain movie crop mode).

masc

@a1ex: when running the script, canon menu pops up before taking a picture. Maybe after that, moiree is away? Doing that manually it looks like that:

1. just configured
2. pressed 2x menu button (enter&leave canon menu)
5D3.113 | EOSM.202

a1ex

A-ha!

So, once you enter and leave Canon menu (which you should do anyway, according to the help, so... that's what I did in the script), it's fixed?

It probably means some of the CMOS registers are not updated until you refresh the LiveView. One of these must control the column binning mode somehow (i.e. whether column skipping or binning is used). As a side note, this "feature" could be used together with IS (to shift the lens in some uncontrolled way) and used for super-resolution experiments - there, you actually *want* aliased data.

OK, then just for my own curiosity about line/column skipping - comment out the menu enter/leave stuff from the script, before the first picture, and it should take the extreme moire version.

Danne

Cool findings.
It´s not possible to enter x5 zoom when the preset is reconfigured. The camera thinks it´s in digital zoom but maybe it´s affected positive "trying" to get into x5. Anyway. Pretty sure some toggling back and forth from canon menu/ml men back and forth should settle the regs.
Will try to find time tomorrow to check scripts and findings.
Thanks again...

masc

Deleted the lines for the menu in the script. First picture has "wonderful moiree", but camera won't record a second picture. Instead doing so, screen turns 9/10 white. When pressing menu 2x between the 2 shots, I get a picture... but I will "shake" the camera with that. So... I delete only the 1st menu open/close? Or wouldn't help that?
5D3.113 | EOSM.202