3K/UHD 5D2 Raw development and Other Digic IV Cams

Started by reddeercity, April 06, 2017, 12:22:27 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

reddeercity


reddeercity

Quote from: IDA_ML on December 16, 2018, 07:22:36 PM
Oh yeah, can you imagine having these insane resolutions on the 7D with its 90 MB/s write speed? 
3k continuous recording at 24 fps and 10-bit lossless, no aliasing, no VAF filter,
no focus pixels, small crop factor, wonderful colors, unique filmic look - that would be a dream come true for all 7D shooters!
Just to be clear 7D dose not have focus pixels if you see any that's would be hot pixels.

reddeercity

@dfort , the redirect buffer needs to be the very first thing to be figured out , all the rest will fall in place .
Being it's a dual processor , makes it that more difficult .
I do have my eye on a 7d with a battery grip at my local canon camera store in there used/trade in's dept. for $300 cad = $224 usd
If it's still there in the new year , I may buy it to help port this but not to sure .
I'm actually looking in to a use Red Scarlet X right now , has ef mount plus everything to get to work .
I'm a big fan of the FCPX Red camera support , fit my pipeline perfectly.

dfort

Truth be known I've been shooting mostly with a Canon C300 lately, mostly with EF-S lenses that work nicely with the dual pixel autofocus. No pipeline or playback issues with these files.

It seems that one of the most important tools, adtg_gui module, doesn't work on the 7D. I just dug into it. I've got a love/hate relationship with this camera. One day I'm thinking about getting back into the Portable ROM dumper to figure out how to pry into the master processor so I can properly finish the firmware update to 2.0.6 and the next day I'm looking for someone who will take it off my hands so I can regain my sanity. Depending on my mood I might let you have it for a bottle of Canadian maple syrup.

Igor_Braun

@reddeercity, you know, I think this is my camera glitch, because it doesn't depend whether it has Magic Lantern installed or not. I will make a small phone video...

reddeercity

Quote from: dfort on December 17, 2018, 08:00:40 AM
Truth be known I've been shooting mostly with a Canon C300 lately, mostly with EF-S lenses that work nicely with the dual pixel autofocus. No pipeline or playback issues with these files.
Nice , the close one to me is 200 mile away , a real pain -- thou they will ship it to me
But they do have a c300 markii $350 day/weekend (fri-monday) or $850 a week , not too badly priced for body rental
If I was doing something serious , I'd be all over that  :)
Quote from: dfort on December 17, 2018, 08:00:40 AM
It seems that one of the most important tools, adtg_gui module, doesn't work on the 7D.
adtg_gui module was broken for d4 cam up until a few mouths ago , I discovery this when I could  made changes with digic poke and not adtg_gui module .
a1ex fixed adtg_gui here for d4 cams , as I can confirm for 5d2 , the adtg_gui.mo on the
module download page is the one I have been using of late . So it should work on 7d.

Quote from: dfort on December 17, 2018, 08:00:40 AM
I've got a love/hate relationship with this camera.
One day I'm thinking about getting back into the Portable ROM dumper to figure out how to pry into the master processor so I can properly finish the firmware update to 2.0.6 and the next day
I'm looking for someone who will take it off my hands so I can regain my sanity.
Depending on my mood I might let you have it for a bottle of Canadian maple syrup.
Sure I'll sent you 2 ,  It like water up here  :P 
which do like better  , Grade A: Light Amber, Medium Amber, Dark Amber.  ?

Danne

What branch are you using for compiling for the 5D2? Checking your autoexec.bin it says:
Magic Lantern crop_rec-4k-5D2-eXperimental.2018Oct22.5D2212
Camera   : 5D2
Firmware : 212
Changeset: 8bfbb0ca228e+ (crop_rec_4k_5D2) tip
Built on : 2018-10-23 05:49:51 by david@reddeercity


Tried downloading a 7D version from  Branch: lua_fix but it from will not work with adt_gui.mo from iso-research branch.

dfort

If you turn on the adtg_gui module on a 7D you'll see that it won't load. Take a look at adtg_gui.c you'll see that the code for the 7D is missing. I was able to find the missing pieces so the module will load but it still doesn't work. Maybe you need to poke the 7D some other place?

Danne

Forgot to mention i updated 7D with above code before loading it.
I could of course start erasing error codes but it would be the better starting point to get a branch and a blessed  :P adtg_gui module like the one for 5D2.
Then again I am maybe only opening up a can of worms...

IDA_ML

Quote from: Danne on December 18, 2018, 09:32:50 AM
Then again I am maybe only opening up a can of worms...

Ha ha, Danne, there is nothing bad opening a can of worms.  You can catch a big fish using them as a bate.  Without worms you catch nothing!

dfort

Quote from: Danne on December 18, 2018, 09:32:50 AM
I could of course start erasing error codes but it would be the better starting point to get a branch and a blessed  :P adtg_gui module like the one for 5D2.

The current iso-research branch should work on the 5D2.

Quote from: reddeercity on December 18, 2018, 05:58:05 AM
I can confirm for 5d2 , the adtg_gui.mo on the
module download page is the one I have been using of late . So it should work on 7d.

Not on the 7D without this:

modules/adtg_gui.c
    else if (is_camera("7D", "2.0.3"))
    {
        ADTG_WRITE_FUNC = 0xFF2C0944; //"[REG] @@@@@@@@@@@@ Start ADTG[CS:%lx]"
        CMOS_WRITE_FUNC = 0xFF2C0B3C; //"[REG] ############ Start CMOS"
        ENGIO_WRITE_FUNC = 0xFF1F6B20;  // from stubs
        ENG_DRV_OUT_FUNC = 0xFF1F675C;
        SEND_DATA_TO_DFE_FUNC = 0xFF32B800; //"[REG] DFE:[%#lx]"
    }


I'm pretty sure these are the missing pieces but it doesn't work. Maybe double check it?

reddeercity

Quote from: Danne on December 18, 2018, 07:04:47 AM
What branch are you using for compiling for the 5D2? Checking your autoexec.bin it says:
Magic Lantern crop_rec-4k-5D2-eXperimental.2018Oct22.5D2212
Camera   : 5D2
Firmware : 212
Changeset: 8bfbb0ca228e+ (crop_rec_4k_5D2) tip
Built on : 2018-10-23 05:49:51 by david@reddeercity

Tried downloading a 7D version from  Branch: lua_fix but it from will not work with adt_gui.mo from iso-research branch.
I was explaining to another user , the source link is here with all the bits to work with 10-12bit FHD
https://www.magiclantern.fm/forum/index.php?topic=19336.msg208026#msg208026

Have you tried "Digit Poke" ?
You manually input any reg. number & change it's parameters
https://www.magiclantern.fm/forum/index.php?topic=19336.msg205062#msg205062
Look like 7d not define , for some reason.
will needs to be fix , I can't help much with this as a 7d is needed .
when I catch up on the my coding of the crop_rec module for 5d2
then I can help more .


aprofiti

Quote from: dfort on December 16, 2018, 05:37:37 PM
The 50D might be easier to port -- @aprofiti are you following this?
Yes, I kept reading what reddeercity is posting and maybe I can jump doing some tests in the next weeks, but I need some help from you guys.

Looking at register map to have a better idea of what is going on here, but I feel the need of more documentation about...

From what I understood, first I need to figure out which registers are responsible of height and width of liveview/capture image and then figure out how much fps can be pushed on each resolution, using raw_diag to check bounds for timer values. Is this right?

I tried to poke some registers with adtg_gui in iso-reaserch branch, but no visible effects on image size...
Even changing resolution from raw video menu and log values doesn't seems to show any useful info (well no info at all...)

Modified Cmos[1] and Cmos[2] but nothing changed, leaving these register: C0F06008, C0F06084, C0F06088... after figured out how to increase resolution

Do I need to switch to crop before make anything?
If I remember right I need to push the "zoom" button to switch to 5x, but it doesn't do anything. I think I'm forgetting something about....

Started to read again from the beginning of this thread and I would like to know if is still needed to find/adapt buffer to accommodate larger image size.

reddeercity

Experimenting with line skipping & pixel binding (1:1 FHD) with 1x3 to reduce moire and aliasing

Un-stretch 1856x416

1856x416_1x3.png

Here the stretch version 1856x1248

M20-1741_000000.png
M20-1741_000000.dng

setting


Short 2Mb h264 clip - M20-1741.mp4

I don't really see this to be too useful , as it's too narrow (416 h) , if the vertical was 2400 etc.. then maybe , but record time would only be 1-2 seconds
if your lucky , so unless something changes , I won't be continuing with this 1x3 .

reddeercity

@aprofiti I'll try explain the basics here ,
1st: need to have a redirect raw buffer , You are in luck  :) because 50D along with the 5D2 now have CONFIG_EDMAC_RAW_SLURP/CONFIG_EDMAC_RAW_PATCH
Why is this important , it all starts with extending the EDmac to have a large raw buffer e.g. =>full res . (10-12bit doesn't hurt either)
read me
The import reg's are:
CMOS[1] = Sensor Vertical (vertical start/stop)
CMOS[2] = Sensor Horizontal (horizontal pos & binning mode)
C0f06008 = FPS timer A (1 unit = 4 pixels horizontally)
C0f06014 = FPS timer B (1 unit = 1 pixel vertically)
C0F06084 = start row/column
C0F06088 = stop row/column (column: 1 unit = 2 pixels)


Rule of thumb , slow down timer "A" to increase horizontally resolution (start around 8-12fps)
All extended resolutions are in 3x Crop_mode (5x zoom) that the staring point
Then increase Timer "B" to bring back frame rate to 24 etc. ....
c0f06088 adjusts the raw image size , here a hex to decimal converter is real handy .

5d2 FHD default raw size
4f40432

first 3 number "4f4"= vertical resolution
last 3 number "432"=horizontal resolution x2

CMOS[2] 0x10e (for 5d2 crop_mode) horizontal offset up to 3520 .
0xe => up to full width.

Now how do get this to work & extend the resolution ,
Start with the 10-12bit build on the experimental page 50D.109/magiclantern-raw_video_10bit_12bit.2018Oct10.50D109.zip
then go to modules  download page and get adtg_gui/adtg_gui.mo  , That's the one I being using of late .

Once you got it all loaded up , you need to activate the ENGIO registers in the advanced tab of adtg_gui ,
then you need to refresh the reg's in adtg to bring up the hidden ones , I usually go to liveview and play a h264  .mov for a few seconds
then brings up the other 900 other registers . Please note this is all experiences from my 5d2 so 50d may have some differences .
Be ready for hundreds of battery pulls  :P
I hope I didn't confuse you , or send you down any rabbit holes .
Make sure you pay attention to any a1ex's post on this thread , actually anything that a1ex posts is all realavent to all cams , though there may be small
little differences , but in the big picture (no pun in tented) all the camera work the same .

reddeercity

@aprofiti , Have try it this yet ? I'm courous to see it this work with the 10-12bit build from experimental download page .
If not let me know and I can build it on my 4k 5d2 d4 branch , you may need some of the code from there.
I locally updated waza57 source to include the new raw_slurp patch & redirect  buffer.
You can also download my source code Crop_Rec-4k-5d2-magic-lantern_redercit_buffer_a1ex-code-10-22-2018 ,
but you need to add the 50d raw_slurp & redirect buffer code I haven't updated it yet for 50d.

reddeercity

Looking like I got a usable 48fps @ 1888x704 (1888x1174)
The black level is off 10bit (127-1013) usually it's (112-1013) but I can clean it up in MLV App 1.3v windows
Have a little issue with MLV App 1.3v -- Hi-Lights ,when pushed turn pinkish
If I set the black level to 78-80 , clean up really nice , I would say almost perfect , I may have too
code in a black level fix , but still a little more work -- need to adjust preview reg's to un-freeze liveview while record raw .





Frame grab from the h264 from MLV App 1.3v win.

Short h264 clip from mlv app 1.3v win
1888x1174_48fps-M23-2150.mp4
1880x704_48fps-M23-2150_000000.dng

If any one wants to play with this 48 fps raw clip I loaded it on my google drive , 487 MB
shot @ 800 ISO , shutter 1/59th of second
1880x704_48fps_M23-2150.MLV
Best to use MLV App , set black level to around 78-80
:)

aprofiti

Quote from: reddeercity on December 24, 2018, 12:33:00 AM
@aprofiti , Have try it this yet ? I'm courous to see it this work with the 10-12bit build from experimental download page .
If not let me know and I can build it on my 4k 5d2 d4 branch , you may need some of the code from there.
No, not exactly... I tried only to load your linked adtg_gui on top of 10-12bit build, but wasn't working due to linker unable to reference function; probably it's because wasn't compiled for that branch, so I have to retry when I have some spare time.

Crop_rec_4k build could be useful to work with, let me know if you add support for 50D

Edit: Downloaded your source code and applied CONFIG_EDMAC_RAW_PATCH support for 50D. Put in 5x mode and trying to understand what regs are related to resolution.
If I change timer A, image will be altered as expected, but if check resolution from movie tab it doesn't change, even by modifing CMOS regs

ilia3101

Quote from: reddeercity on December 24, 2018, 06:01:26 AM

Frame grab from the h264 from MLV App 1.3v win.

Short h264 clip from mlv app 1.3v win
1888x1174_48fps-M23-2150.mp4
1880x704_48fps-M23-2150_000000.dng


Wow that's a lot of pink moire!!! do you get less with MLVProducer?

What happens if you choose a debayer algorithm other than AMaZE?

reddeercity

Quote from: Ilia3101 on December 24, 2018, 07:42:32 PM
Wow that's a lot of pink moire!!!
Yea thought so , but remember it's vertically compressed & 5d2 as you know have pixel binding & line skipping
and by compressing it I bet is making the pixel binding worse , I good case for you guys over on the MLVApp1.4 thread
to analyzes and make better algorithm .
Quote from: Ilia3101 on December 24, 2018, 07:42:32 PM
What happens if you choose a debayer algorithm other than AMaZE?
It's worse , AMaZE give the best image
Quote from: Ilia3101 on December 24, 2018, 07:42:32 PM
do you get less with MLVProducer??
I did a test to see , there a Alias Filter & False Color Filter .
I let the false color filter enabled and toggled off and on the alias filter , mlvproducer has his own
debayer algorithm "MLVPDM" .

MLVProducer-Alias-Filter & False-Colors-Filter enabled


mlvprod_alias+falsecolor filter_1888x1174_48fps.png
h264 clip -- mlvprod_alias+falsecolor filter_1888x1174_48fps.mov

MLVProducer-No Alias Filter & Yes False Colors Filter


mlvprod_no_alias_filter_yes_false_color_filter.png
h264 clip mlvprod_no_alias_filter_yes_false_color_filter_1888x1174_48fps.mov

Don't judge by the small images I posted , there down sized to 16% of the original
I think the it better , what do you guy think ?
Maybe mlvapp 1.4v is better with this , didn't try it yet .

Merry Xmas every one  :D

reddeercity

Quote from: aprofiti on December 24, 2018, 10:48:06 AM
No, not exactly...
Edit: Downloaded your source code and applied CONFIG_EDMAC_RAW_PATCH support for 50D.
Put in 5x mode and trying to understand what regs are related to resolution.
If I change timer A, image will be altered as expected,
but if check resolution from movie tab it doesn't change, even by modifing CMOS regs
Sorry I may have forgot to mention that c0f06088
Is the number 1 reg you need to be concern about mostly , it's what set the Raw Resolution
the rest reg's adjust image , e.g. cmos[1] centers the image etc. ...

Can you post a screen shot of the 50d's "capturing Reg's in agtd_gui ?
I'm mostly interested in c0f06088 values , let start there .

Just as a refresher ,
this is what I'm looking for (in the show capture reg's)
but with the 50D valves as this from my 5D2 in default FHD 1:1 29.97fps




If there are not showing up ,
make sure you enable "ENGIO Registers" in the advanced tab
refresh liveview ( play a h264 .mov) should see  around 900 reg's


And when this successful you should see Memory Patches like this , I have 7


does this help ?

aprofiti

Yesterday I tried to understand what happen if I poke some regs, this is what I get in 5x mode with default settings:



Let's compare behaviour of 50d with 5d2:

If I increase Timer A it will lower FPS, if I decrease value I get more FPS, similar behaviour with TIMER B.

If I try to change image size using c0f06088, it allow me to increase by 1 (value => 0x4530452) and get 1080 vertical but it get upper bounded; tried to lower FPS value (10.572) changing TIMER A => 0x27b070b but no increase in resolution.
Instead if I try to change horizontal resolution (increasing or decreasing) I get distorted pink images...

I saw you modified also other regs (ADTG12[100c], c0f07XXX...) from the one you listed a couple of post above.
How did you find they were necessary? Did you randomly tried register or did you observed what register were changed by canon firmware using adtg_gui?

reddeercity

Thanks for the screen shots , but something when wrong I was looking for just the capture size reg's




You should see the same list of reg's I posted not just cmos reg's  , that tells me either
didn't enabled the "ENGIO Reg's" in the advanced tab of adtg_gui.mo or you didn't refresh liveview
e.g. load a h264 of review a photo , this a must or nothing will work and you will not get access to the hidden reg's .

There over 900 reg's you can see when it right but if not there only around 16 or 18 reg's visible


The other think that help's with development is the dump_image_buffer


This help to analyze the raw image for true raw size before cropping with exiftool

There was 3 reg's that I saw that where useful
c0f06088
c0f06008
c0f06014

First let understand what going on here
let look at reg c0f06088 =>0x4520452
What does this tell us ?
Will for starter , this is the raw resolution and we read this in decimal , so let spilt the number up .
452=>1106 that the vertical res & the back half is horizontal 452=> 1106x2 =>2212 -160 (crop off boarders) =>2052
that should close to the Image dump .

Next Timer A =>c0f06008 & Timer B =>c0f06014
So timer A =>0x27b27b , we only use the last 3 (27b) ,
Let do some math , 27b hex = 635 decimal x4 => 2540
So this tell us that the max horizontal resolution that Timer"A" can do , including black boarder crop off area offset etc. ...
On the 5d2 raw image dump exiftool tell me the crop off area or offset  e.g. 52 /160 (52=vertical  & 160=horizontal) in crop_mode

Timer B =>c0f06014=>0x5e5 =1509 ,  max vertical resolution
So a Image dump in crop_mode would be very useful right now to see the offset , not sure if it's the same as 5d2

So if I was you , I would start with a small horizontal increase , from 1920 -- theoretically you shouldn't have to mess with timers
unless you exceed 2540 H , thou the very first thing I would do is slow timers A & B to get 23.976fps of very close to that (24).

This what I do on 5D2 , start @ 29.97fps -- reduce timer A by only a few units (0x2270227=>0x227027b) Increase timer B (0x4ff=>0x59f)=>23.976fps
then increase vertical to 1200 (my case) then increase horizontal in very small increments to 2400 H stopping between changes to check liveview .

The best way to approach this in my opinion , is to understand what each reg does in relation to raw size & preview size.

Also Liveview will messed up or freeze something pink , that canon liveview everything has to done with ML B/W (Gray) Preview.
A half shutter button press should give clean preview plus that how I refresh liveview between resolution changes .

Sorry for the long post and If this seem too simplistic , I'm writing this not only for you @aprofiti  but for everyone else , so it can be understood by all
and get more people to develop .

Quote from: aprofiti on December 26, 2018, 10:26:21 PM
I saw you modified also other regs (ADTG12[100c], c0f07XXX...) from the one you listed a couple of post above.
How did you find they were necessary?
That was found or discovered by a1ex from what I understand
ADTG12[100c] squeezes the image vertically , that's the 720p 50/60p mode on other cams ,
yes that right 5d2 can do 720p 50/60 all the way up to 72fps (that's where I stop don't push it any more but there was still room to go)
The how I got 1888x704 @ 48fps -- unsqueezed (1.66) I get 1888x1174 @48fps .
c0f0713c & c0f007150 open up the vertical window , it a must .
Explained here , I do belive I posted this before for you to read -- It's a1ex explaining every thing you what to know .

masc

Quote from: reddeercity on December 25, 2018, 05:29:53 AM
Yea thought so , but remember it's vertically compressed & 5d2 as you know have pixel binding & line skipping
and by compressing it I bet is making the pixel binding worse , I good case for you guys over on the MLVApp1.4 thread
to analyzes and make better algorithm .It's worse , AMaZE give the best imageI did a test to see , there a Alias Filter & False Color Filter .
I let the false color filter enabled and toggled off and on the alias filter , ...

I think the it better , what do you guy think ?
Maybe mlvapp 1.4v is better with this , didn't try it yet .

Great progress @reddeercity! 48fps on a 5D2 is great!
With MLVApp v1.4 we introduced "Hue vs. Saturation" elements. That means not, that moiree will get any better, but maybe you can make it a bit more invisible by desaturating "a small pink peak". Sure - if you have much (real) pink in the clip you're lost... ;)

Edit: whoa... not only a peak... nearly all pink tones... and still not great.
5D3.113 | EOSM.202

reddeercity

Not too bad , The 1.4v looking good , I gave it a try and compared it to MLVProducer & After Effect -- though I corrected black level
and un-squeezed in MLVApp 1.4v then exported as a Uncompressed Cdng for After Effects .

So from left to right:  After Effect CS6 , MLVProducer , MLVApp 1.4v

A.E.-MLVPro-MLVApp1.4v.png

Here are all 3 PNG's from the above image screen shot
MLVProducer
AfterEffects_CS6
MLVApp1.4v

Here's the h264 from though 3 App's
MLVProducer_h264
MLVApp1.4v_h264
After.Effects.CS6_h264
A.E. rendered out the file as 50fps where the other 2 keep the correct frame rate of 48fps

I tried to grade it as a flat film/log like image across all 3 App's
A.E. seem to be the worst on the test image (lost must of the detail in the center plus data missing/holes)
but the rest of the image is killer thou .
MLVProducer seemed to retain all the detail with very good motion blur , but with pink hi-lights in the almost blowout
hi-lights  , the rest of the image looks similar to A.E. in quality , clean shadows (no noise)
MLVApp 1.4v , I used the Smooth Aliasing filter set to "Last Resort"
Lost detail in the center of the test photo image , has less pink moiré then mlvproducer but more then A.E.
but didn't loose as much detail as A.E. with better motion then A.E. but not as good as mlvproducer , thou it very close.

So I would really be happy with either MLVApp 1.4v Or MLVProducer with a small lean towards mlvProducer .
As far as A.E. is concerned , It was the least desirable image with aliasing & moiré patterns .