Canon 6D

Started by Maqs, May 01, 2015, 09:56:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dfort

Hum -- must have missed something. I made a "fake" pull request to see what is going on. Like you said, must be something small, but what?

Danne

Add 6D in here:
     * we can identify the current video mode from 0xC0F06804 */
    for (uint32_t * buf = (uint32_t *) regs[0]; *buf != 0xFFFFFFFF; buf += 2)
    {
        uint32_t reg = *buf;
        uint32_t old = *(buf+1);
        if (reg == 0xC0F06804)
        {
   if (is_5D3)
   {
            engio_vidmode_ok = (crop_preset == CROP_PRESET_CENTER_Z)
                ? (old == 0x56601EB)                        /* x5 zoom */
                : (old == 0x528011B || old == 0x2B6011B);   /* 1080p or 720p */
   }
   if (is_100D)
   {
             engio_vidmode_ok =
             (old == 0x45802A1) /* x5 zoom */ || (old == 0x42801ed) /* x3 digital zoom */ || (old == 0x4A701D7 || old == 0x2D801D7);   /* 1080p or 720p */
           }
   if (is_EOSM)
   {
     engio_vidmode_ok =
             (old == 0x4540298) /* x5 zoom */ || (old == 0x42401e4) /* x3 digital zoom */ || (old == 0x4a601d4) /* 1080p */ || (old == 0x2d701d4 /* 720p */); 
   }
   if (is_700D)
   {
             engio_vidmode_ok =
             (old == 0x4540298) ||/* x5 zoom */ (old == 0x4a601d4 || old == 0x2d701d4);   /* 1080p or 720p */
           }
   if (is_650D)
   {
     engio_vidmode_ok =
             (old == 0x4540298) /* x5 zoom */ || (old == 0x42401e4) /* x3 digital zoom */ || (old == 0x4a601d4) /* 1080p */ || (old == 0x2d701d4 /* 720p */);
           }
        }
    }

dfort

Ok--I see what I missed. It is late here so I'll look into it in the morning. Do we know those values for the 6D?

Danne

I bet levas gets them in a jiffy otherwise.

Levas

Ok, got this one working right now, but still some stuff to fix, shutter time isn't right in 5x zoom mode.
As it is now, it looks like shutter time is right in non zoom mode, but most of the crop_presets are for 5x zoom mode.
So Danne, Dfort and I need to look into it some more before this merge into the bleeding edge branch is ready for use.

Meanwhile I 'll keep updating the presets for 6d in the other crop_rec module I'm using and when presets are tested, centered(as far as possible with CMOS registers) and working right, I can move them over to the bleeding edge branch.
Source of this crop_rec.c file can be found here:
https://bitbucket.org/Levas_EOS/magic-lantern/src/crop_rec_4k_mlv_snd_Levas6D/modules/crop_rec/crop_rec.c


Danne

Are shuuter time readings working correctly in your code in x5 mode?

Levas

Yes, but had to made a fix for it.

I Have this in my build:

/* helper to allow indexing various properties of Canon's video modes */
static inline int get_video_mode_index()
{
    return

    (crop_preset == CROP_PRESET_HD100) ? 3:
    (crop_preset == CROP_PRESET_HD75) ? 3:
    (crop_preset == CROP_PRESET_HD50) ? 3:
    (crop_preset == CROP_PRESET_2K) ? 1:
    (crop_preset == CROP_PRESET_ULTRA_HD) ? 1:
    (crop_preset == CROP_PRESET_4K) ? 0:
    (crop_preset == CROP_PRESET_5K) ? 1:
    (crop_preset == CROP_PRESET_FullRes) ? 1:
    (crop_preset == CROP_PRESET_1x3) ? 1:
    (crop_preset == CROP_PRESET_1x3_24FPS) ? 1:
    (crop_preset == CROP_PRESET_HD2) ? 3:
    (crop_preset == CROP_PRESET_3x3_1X) ? 1:
    4;


and hardcoded this:

/* from SENSOR_TIMING_TABLE (fps-engio.c) */
/* hardcoded for 6d */
const int default_timerA[] = { 0x27f, 0x2d9, 0x21f, 0x27F, 0x27f };
const int default_timerB[] = { 0x63f, 0x493, 0x61b, 0x31f, 0x334 };
const int default_fps_1k[] = { 25000, 29921, 29978, 50000, 59964 };


So I basically set the video mode for each preset in the first code part and then it uses the corresponding numbers from the table in the second code part.

Danne

Cool. Now I might have a way to fix the faulty values on my eosm. Just tried some over here.

dfort

Amazing how quickly development happens when the code is shared.

Levas

Quote from: baladev on May 02, 2019, 05:45:03 PM
Can you please add your other 1:3 presets - 1216 x 2052 and 1264 x 2144 to the same crop_rec at 25fps

@Baladev, I added the other presets, this build now has four 1x3 presets:
1256x1890 @ 25fps
1256x1890 @ 24fps
1640x2052 @ 25fps
1640x2144 @ 24 fps

Looked some more into the vertical centering and it seems that it goes in steps of 33, so if you use delta_head4, values of 33 and multiples works.
So for example, you can use -66,-33, and +33, +66 for delta_head_4 to finetune.
I have put the crop_rec.mo file on my bitbucket page, instead of google drive I used before, here's the file:
https://bitbucket.org/Levas_EOS/magic-lantern/downloads/crop_rec.mo

Source code can be found here:
https://bitbucket.org/Levas_EOS/magic-lantern/src/crop_rec_4k_mlv_snd_Levas6D/modules/crop_rec/crop_rec.c

baladev

Thank you very much my friend!

I'll try to center it and report my findings back.

Have you baked in 30 for delta_head_3 for the 1256x1890 preset?

So, delta_head_4 IS cmos7 as I suspected?

Levas

Quote from: baladev on May 06, 2019, 06:04:49 PM
Have you baked in 30 for delta_head_3 for the 1256x1890 preset?

Yes I moved the horizontal centering with value of 30 for 1256x1890.

Quote from: baladev on May 06, 2019, 06:04:49 PM
So, delta_head_4 IS cmos7 as I suspected?

Almost, but not exactly, I've set a standard value for CMOS 7 and delta_head4 is a value that is added to the standard value:


            case CROP_PRESET_PRESET_10:
                cmos_new[6] = 0x469 + delta_head3;
                cmos_new[7] = 0x327 + delta_head4; //0xd , 0x261, 0x369 and 0x3cc works
                break;

So CMOS 7 is set to value 0x327 and delta_head4 is added, so the sum of the two becomes value for CMOS 7

It's a bit of a messy tool that I use for adjusting presets  :P

baladev

@ Levas

I'll have some free time tomorrow and so am planning to work on centering the two remaining presets. However I just thought that if you are planning to convert to Danne's code for preset centering (as was discussed above if I understood correctly) maybe it's a waste of time centering these presets because Danne's presets center automatically (as I showed above) when you change resolution, so instead of 3 different presets we could have only one with the highest resolution possible and then just center it properly and we would have a winner. Or am I missing something? Please advise.

Thank you for explaining how cmos7 and delta_head4 are related. So, delta_head4 is an offset Can't understand then why the values for cmos7 I was getting though ADTG_GUI didn't work when entered into delta_head4. When I experimented with ADTG_GUI and I moved the crop area in x5 zoom mode up I got these hex values: 208/1c6/163, converted to decimal 520/454/355. The default cmos7  value is 26b(619). I tried to subtract the new values from the default (619-520=99) and entering this into delta_head4, but this didn't work. Is my logic off?

Thanks!

Danne

My code won't do anything for 6D presets so tweak away.

Levas

Quote from: baladev on May 07, 2019, 06:07:53 PM
@ Levas
Thank you for explaining how cmos7 and delta_head4 are related. So, delta_head4 is an offset Can't understand then why the values for cmos7 I was getting though ADTG_GUI didn't work when entered into delta_head4. When I experimented with ADTG_GUI and I moved the crop area in x5 zoom mode up I got these hex values: 208/1c6/163, converted to decimal 520/454/355. The default cmos7  value is 26b(619). I tried to subtract the new values from the default (619-520=99) and entering this into delta_head4, but this didn't work. Is my logic off?

Thanks!

You're logic is good, not sure why it didn't work.
Only thing I can think off that +99 was off the sensor in that build?
There aren't that many steps vertical, 99 is 3 steps, if the standard value I used was less then 3 steps away from the end off the sensor, you fell of the edge with +99  :P

baladev

@Levas

Yes, you are right, +99 did cause me to 'fall off the edge of the sensor' and I got a black preview, but then I tried the negative -99 and it didn't work either - I got corrupted live view.

In any case, this doesn't matter now any more, because in this latest crop_rec of yours delta_head4 is actually working properly and this is good news. How did you make it work - did you change something?

However delta_head3 is now semi broken and doesn't work the way it used to.  :o Before a change of 20 would give me a consistent shift by equal amount. (20 would shift right by 2cm, then 40 would shift right by another 2cm and so on - I do my measurements in Photoshop in cm - it might be odd, but it's easier for me this way :)) Now delta_head3 -20 would shift left by 2cm, -40 would shift by another 0.3cm and then values below -50 don't work - LV becomes black.

So, this is my summary of different 1:3 anamorphic presets in the current build:

1120 x 1890 - Perfectly centered now horizontally and vertically

1216 x 2052 - Vertically centered. Best horizontal centering should be achieved by delta_head3 set to -60 or -70 (if it worked like in previous builds, can't test this in current build)

1264 x 2144 - To center vertically set delta_head4 to -33. Best horizontal centering should be achieved by delta_head3 set to -40 or -50 (if it worked like in previous builds, can't test this in current build)

One last thing - could you please set the  x2144 preset to 25fps (or create a copy of it with 25fps). I film a lot in artificial light, which here in Oz produces a lot of flickering at 24fps.

All in all, we are very close!

Thank you!

Levas

Will take a look at it.

There is some development going on on the merge with Danne's crop_rec.
At the moment we got lower bit depth lossless recording working for 6d.
And I got working Canon liveview on most presets, (not correct framing), but at least the scrambled liveview is gone.
So ideal for focussing, since you're seeing realtime 5x zoom Canon liveview, and for framing you can use half shutter press so ML preview shows up.

Unfortunately, the high FPS presets and 1x3 presets don't work in this build  :-\ , so we hope to  figure out why that is, so we can use 12 bit or 10 bit lossless on the 1x3 presets and high FPS presets.



 

Danne

Presets not working. Not the code at me. Did you add 6D in code part here?
https://www.magiclantern.fm/forum/index.php?topic=15088.msg216000#msg216000

Levas

Yep that part is in there for 6d.

It's some safety stuff, it doesn't do preset when you're in the wrong video mode, but how does it know for which video mode the preset is made ?

At the moment all 1:1 pixel read out modes work in 5x zoom mode and are disabled in normal non zoom mode.
So the code finds these presets only suitable for 5x zoom mode, why ?
You can perfectly do 1:1 pixel readout, while in Canon 1080p mode...
So it's a question of when is something the wrong video mode, according to the code.

But I need some sleep now...will be continued.



Danne

Hm, so maybe the reason I never managed to do 1:1 readout in mv1080p mode. Interesting.

baladev

QuoteAt the moment we got lower bit depth lossless recording working for 6d.
And I got working Canon liveview on most presets, (not correct framing), but at least the scrambled liveview is gone.

This sounds awesome! Good luck.

Levas

Ok, busy weekend over here, but since some presets work and lossless with lower bit depths works, here is something to play with until other presets are added and working.

Here's a link to a full build (can't just only upload crop_rec module, since this makes use of some stuff Danne made for Eos-m which makes use of some changes in other ML files.
https://bitbucket.org/Levas_EOS/magic-lantern/downloads/magiclantern-Nightly.2019May11.6D116.zip

Edit: new build coming up

Some notes,
Somehow, the first time crop_rec module is activated and started, it starts with preset 6 (which doesn't exist actually for 6d ???, so a bit weird and buggy).
So probably best to start up in photo mode the first time you have activated the module and change it in ML menu to an existing preset.

I have started the camera in video mode with preset 6 and it doesn't do harm, looks like an empty preset or something.
But better to change it to one of the 3 existing presets.

This build contains 3 crop_rec presets:

2480x1396 at 25fps
2688x1296 at 25 fps
2880x1200 at 25 fps

All are for use in 5x zoom mode and have working Canon live view in 5x zoom mode (not correct framing though, so you can use half shutter press to see ML preview for framing)
Bit depth is set to 12 bit by default and can be changed in the sub menu of crop_rec (go to crop_rec in ML menu and press "Q" button on camera)
There is a lot more in the sub menu, but most is doing nothing for 6d I guess, haven't test it yet.

This build also contains the SD_UHS module which activates the high speed writing settings for 6d SD card interface at startup.
If your SD card is suitable for these settings, you'll get higher writing speeds (about 60MB/s in video mode)
If you experience slower writing speeds or no extra speed (20MB/s to 40MB/s) it's probably better to disable this module in module tab.

I'm really impressed by the recording times with SD_UHS module combined with lower bit depth like 10bit for resolutions like 2880 x 1200 and 2480 x 1396.

Have fun playing and see this build as something to play and test with until we Danne, Dfort and I get other 6D presets working in this fantastic build.

Danne

COOL!

Fast checking. You could probably erase this since powertiming regs already happens a bit below:
Test to erase this:
    if (is_6D)
    {

        switch (crop_preset)
        {
            case CROP_PRESET_HD100_6D:
            case CROP_PRESET_HD75_6D:
            case CROP_PRESET_HD50_6D:
            case CROP_PRESET_2K_6D:
            case CROP_PRESET_ULTRA_HD_6D:
            case CROP_PRESET_4K_6D:
            case CROP_PRESET_5K_6D:
            case CROP_PRESET_FullRes_6D:
            case CROP_PRESET_HD2_6D:
            case CROP_PRESET_1x3_6D:
            case CROP_PRESET_1x3_24FPS_6D:
            case CROP_PRESET_3x3_1X_6D:
        /* all modes may want to override shutter speed */
        /* ADTG[0x8061]: shutter blanking for 3x3 mode  */
        /* ADTG[0x805F]: shutter blanking for zoom mode  */
            adtg_new[0] = (struct adtg_new) {6, 0x8061, shutter_blanking};
            adtg_new[1] = (struct adtg_new) {6, 0x805F, shutter_blanking};
                /* adjust analog gain NOT WORKING PINK HIGHLIGHTS WHITE LEVEL NOT PROPER*/
                /*adtg_new[13] = (struct adtg_new) {6, 0x8882, 108};*/
                /*adtg_new[14] = (struct adtg_new) {6, 0x8884, 108};*/
                /*adtg_new[15] = (struct adtg_new) {6, 0x8886, 108};*/
                /*adtg_new[16] = (struct adtg_new) {6, 0x8888, 108};*/
                /*adtg_new[17] = (struct adtg_new) {6, 0x8030, 400};*/
        /* adjust vertical resolution */
        /* assuming FPS timer B was overridden before this */
                int fps_timer_b = (shamem_read(0xC0F06014) & 0xFFFF) + 1;
                int readout_end = shamem_read(0xC0F06804) >> 16;    /* fixme: D5 only */

                /* PowerSaveTiming registers */
                /* after readout is finished, we can turn off the sensor until the next frame */
                /* we could also set these to 0; it will work, but the sensor will run a bit hotter */
                /* to be tested to find out exactly how much */
                adtg_new[2]  = (struct adtg_new) {6, 0x8172, nrzi_encode(readout_end + 5) }; /* PowerSaveTiming ON (6D/700D) */
                adtg_new[3]  = (struct adtg_new) {6, 0x8178, nrzi_encode(readout_end + 5) }; /* PowerSaveTiming ON (5D3/6D/700D) */
                adtg_new[4]  = (struct adtg_new) {6, 0x8196, nrzi_encode(readout_end + 5) }; /* PowerSaveTiming ON (5D3) */

                adtg_new[5]  = (struct adtg_new) {6, 0x8173, nrzi_encode(fps_timer_b - 5) }; /* PowerSaveTiming OFF (6D/700D) */
                adtg_new[6]  = (struct adtg_new) {6, 0x8179, nrzi_encode(fps_timer_b - 5) }; /* PowerSaveTiming OFF (5D3/6D/700D) */
                adtg_new[7]  = (struct adtg_new) {6, 0x8197, nrzi_encode(fps_timer_b - 5) }; /* PowerSaveTiming OFF (5D3) */

                adtg_new[8] = (struct adtg_new) {6, 0x82B6, nrzi_encode(readout_end - 5) }; /* PowerSaveTiming ON? (700D); 2 units below the "ON" timing from above */

                /* ReadOutTiming registers */
                /* these shouldn't be 0, as they affect the image */
                adtg_new[9] = (struct adtg_new) {6, 0x82F8, nrzi_encode(readout_end + 5) }; /* ReadOutTiming */
                adtg_new[10] = (struct adtg_new) {6, 0x82F9, nrzi_encode(fps_timer_b - 5) }; /* ReadOutTiming end? */
            break;

        }


Regarding not working presets. For 1x3 presets you use the adtg slots:
            adtg_new[11] = (struct adtg_new) {6, 0x8000, 6};
            adtg_new[12] = (struct adtg_new) {6, 0x800C, 0};


Now check in powertime regs:
        adtg_new[11] = (struct adtg_new) {6, 0x82F8, nrzi_encode(readout_end + 1 + reg_timing4) }; /* ReadOutTiming */
        adtg_new[12] = (struct adtg_new) {6, 0x82F9, nrzi_encode(fps_timer_b - 1 + reg_timing4) }; /* ReadOutTiming end? */

adtg_new[11] and adtg_new[12] are overwritten.

Expand this from:
    /* expand this as required */
    struct adtg_new adtg_new[22] = {{0}};

to maybe:
    /* expand this as required */
    struct adtg_new adtg_new[32] = {{0}};

To get free adtg slots. Wouldn´t hurt if you check your other presets for doubles.

Levas

Nice find!
Those double used adtg slots sure don't help :P
Will fix them when I have some time, will be continued...

Levas

Ok 6d owners, posted a new build, some new progress in the merged crop_rec build.

Now 1x3 presets are working too and 50 fps for Canon 720p mode works(non stretched, square pixels).
Unfortunately I haven't been able to fix Canon live view in 1x3 modes (probably because it's so weird, horizontal binning and full vertical line readout)

Modes available are:
    "2480x1396 25fps for 5x zoom mode"
    "2688x1296 25fps for 5x zoom mode"
    "2880x1200 25fps for 5x zoom mode"
    "1216x2052 1x3 25fps for 5x zoom mode",
    "1640x2144 1x3 24fps for 5x zoom mode",
    "1824x818 50fps for 720p mode"

Low bit depth option in copy_rec sub menu (Q button on crop_rec option in ML menu)

Here's the full ML build for 6d:
https://bitbucket.org/Levas_EOS/magic-lantern/downloads/magiclantern-Nightly.2019May13.6D116.zip