Author Topic: Canon 40D  (Read 463395 times)

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 8848
Re: Canon 40D
« Reply #600 on: July 05, 2021, 08:49:52 PM »
Thanks, looks fine!
Heder told he would be busy with other things for quite some time. You may have to wait for thread confirmation by a mod or you want to join ML's discord channel to get some support. ATM Heder is the only one working on this port.

heder

  • Developer
  • Member
  • *****
  • Posts: 171
  • No time for caution
Re: Canon 40D
« Reply #601 on: July 06, 2021, 07:20:54 PM »
I Guess I need to do a better install video next week, currently im om Mallorca  ;D

... some text here ..

imme

  • New to the forum
  • *
  • Posts: 31
Re: Canon 40D
« Reply #602 on: November 19, 2021, 06:42:58 AM »
Heder

We are waiting for more updates....... :) :)

kitor

  • Developer
  • Senior
  • *****
  • Posts: 460
Re: Canon 40D
« Reply #603 on: November 19, 2021, 12:11:44 PM »
Do not use plural form to express your own expectations.

https://mikemcquaid.com/2018/03/19/open-source-maintainers-owe-you-nothing/

Also, nice work @heder!

Too many Canon cameras.
If you have a dead R/RP mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

heder

  • Developer
  • Member
  • *****
  • Posts: 171
  • No time for caution
Re: Canon 40D
« Reply #604 on: January 03, 2022, 11:06:43 AM »
Happy new year !

I fought in 2021 Q3/Q4 with Ant123's jpeg motion video module, spend days on getting it to run, but could'nt resolve a bug causing drops, but now it's running in a prototype version. Current capabilities on 40D is 1024x680@max 30 fps, here a teaser at 1024x680@24fps:

SD (rubbish) resolution youtube video:



I will work toward a minor release with this module, ETA somehere in 2022@Q1. There still alot todo, stay tuned ..



... some text here ..

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7740
Re: Canon 40D
« Reply #605 on: January 03, 2022, 03:00:29 PM »
What a beautiful, clean image. Bravo.

heder

  • Developer
  • Member
  • *****
  • Posts: 171
  • No time for caution
Re: Canon 40D
« Reply #606 on: March 06, 2022, 07:39:01 PM »
Hi.

Some interessing info regarding the process on mjpeg recording.

After alot of testing, I have finally completed a proof of concept that I can change the HD image (YUV Path) and 40D's internal JPEG path in such away that we can get proper MJPEG video recording at a bitrate of approx 12-14 MB/s.  The previous video (see posts above) was using standard HD images 1024 x 680 in x1 mode (binning x3), but by changing the YUV path into it's real original size I now have a format of 1288 x 820 (non-stretched). I known this is'nt going to make any real different, but the real goal is'nt x1 mode, the real goal is zoom mode where we don't have any binning (x5,x10) and where we can read the sensor pixel by pixel. On top of that, zoom mode x5 and x10 have by default set into 1944x806 mode, that FULL HD 1:2.39. The only thing I have not been able to test/control yet is the jpeg quality, which is really important when I reach FULL HD quality. Currently the quality on the HD image is really too high (lossless ?) and I need learn to lower it, inorder to get enought recording time at 1944x806.

To get 1288 x 820 I changed the following registers (including hijacking YUV buffers pointer and EDMAC's):

0xc0f1154c  // HD stretch register format (xxxx | yyyy), when xxxx=yyyy, ratio => 1.00
0xc0f1150c  // HD stretch register format (xxxx | yyyy), when xxxx=yyyy, ratio => 1.00
0xc0f11518  // HD width = 1288-1
0xc0f1155c  // 850 | HD width
   
I will work towards a release with 1288 x 820 MJPEG recording capabilities and after that I will go for 1920x806.

Here is a 1288 x 820 luminance test image, the image has some artifacts, but I was using singlebuffering and the save function was really slow, but still proof of concept 8), click on the image to expand to full size.

... some text here ..

kidkoala83

  • New to the forum
  • *
  • Posts: 11
Re: Canon 40D
« Reply #607 on: March 08, 2022, 12:25:50 PM »
Hi heder! :)

I finally got ballsy and went beyond qemu to test your 40d port in my camera, it works and I am able to play Arkanoid and mess a bit with the intervalometer.

Been trying the raw video but don't understand very well how it works, it seems to stop automatically after short periods, and also then after I don't know what to do with those files, how to play those raw vid files, looking at my CF card I think the are the ones with .mlv extension..
If someone knows how to play them that be great.

Those mjpeg new features are looking great, wish I could help somehow.

Is great to see that finally unfold as we knew the 40d might be able to record video since 2008!

Thanks a lot and a big hooray to heder!!!

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 8848
Re: Canon 40D
« Reply #608 on: March 08, 2022, 12:29:05 PM »
Been trying the raw video but don't understand very well how it works, it seems to stop automatically after short periods, and also then after I don't know what to do with those files, how to play those raw vid files, looking at my CF card I think the are the ones with .mlv extension..

https://www.magiclantern.fm/forum/index.php?topic=20025.0

Stopping: Mostly because write rate is too low to keep up with sensor's data stream. You get a mere 12.5 (give or take) MByte/s with 40D's card interface.

kidkoala83

  • New to the forum
  • *
  • Posts: 11
Re: Canon 40D
« Reply #609 on: March 08, 2022, 12:36:39 PM »
Ok, MLV app is working like a charm, thanks! :)
My vids are quiet buggy though, in the other hand they were my first try with raw video..
Contrast seems really hight, sometimes the screen just fades to black..
Still amazing to have been able to record some vid with the 40D! :)
Looking forward to mjpeg.

Why does my image fade to black when recording raw video? Could that be bad for my CMOS sensor or something? Should I stop the vid when that happens?

heder

  • Developer
  • Member
  • *****
  • Posts: 171
  • No time for caution
Re: Canon 40D
« Reply #610 on: March 09, 2022, 09:08:17 AM »
Ok, MLV app is working like a charm, thanks! :)
My vids are quiet buggy though, in the other hand they were my first try with raw video..
Contrast seems really hight, sometimes the screen just fades to black.
Still amazing to have been able to record some vid with the 40D! :)
Looking forward to mjpeg.

Why does my image fade to black when recording raw video? Could that be bad for my CMOS sensor or something? Should I stop the vid when that happens?

Hi kidkoala83.

I did a quick one minute mlv_lite recording test using 1.0.6, format 924x388@24 fps, and did not see any issues. Im shooting in mode "M". Try to record a video with and without "small hacks" option to see if this changes anything.
... some text here ..

kidkoala83

  • New to the forum
  • *
  • Posts: 11
Re: Canon 40D
« Reply #611 on: March 09, 2022, 10:33:46 PM »
If I go as low as 640x160 and 5:1 or 4:1 aspect ratio i get continous mode in green letters, that seems good..
Under heavier loads i get blueish cold temperature screen, or snow, or splat screen half-half mirror effect..
How do you get those non standard resolutions of 924x388?
Do you use fps overrride to set the 24 fps?
What do "Use SRM job memory" and "Small hacks" do? How can I load the mlv_play module for playback?
I am enjoying very much testing the video on the 40d. :)

heder

  • Developer
  • Member
  • *****
  • Posts: 171
  • No time for caution
Re: Canon 40D
« Reply #612 on: March 10, 2022, 10:14:34 AM »
If I go as low as 640x160 and 5:1 or 4:1 aspect ratio i get continous mode in green letters, that seems good..
Under heavier loads i get blueish cold temperature screen, or snow, or splat screen half-half mirror effect..
How do you get those non standard resolutions of 924x388?
Do you use fps overrride to set the 24 fps?
What do "Use SRM job memory" and "Small hacks" do? How can I load the mlv_play module for playback?
I am enjoying very much testing the video on the 40d. :)

Hi.

Small hacks = disable white balance, disable auto exposure, tweak CF card.
Use SRM job memory = use photo memory for capturing (without SRM you are limited to 40MB buffers, with SRM > 200 MB)
mlv_play = bugged, does'nt work yet, use MLVapp.

Yes I shoot at 24 fps, I can shoot any size that the camera allows without issues.

What happens if you recording zoom mode (x5,x10).
What CF card are you using ? (old or new?)
Does the blueish cold temperature screen or snow, some slowly while recording, or does it appear when you start LiveView ?
Does the blueish cold temperature screen or snow disapeer if you close and re-open LiveView ?

Blueish cold temperature screen or snow, is a typical indication that the video timing becomes screwed.
... some text here ..

kidkoala83

  • New to the forum
  • *
  • Posts: 11
Re: Canon 40D
« Reply #613 on: March 10, 2022, 11:39:59 AM »
The closest I get to 924x388 is 928x388 at 2.39:1 .. What aspect ratio are you using? Or it might have been a typo..

The Blueish cold temperature screen, snow, or half-half screen effect shows on liveview, it does disappear if you turn it off and on again, at least temporarily.

Haven't tried the x5, x10 zoom yet.. Should I be recording with zoom on?

I am using an old 2Gb CF card for testint Magic Lantern, from the year 2008 or so..

Btw, what is binning? What does the SRM acronym stand for?

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 8848

heder

  • Developer
  • Member
  • *****
  • Posts: 171
  • No time for caution
Re: Canon 40D
« Reply #615 on: March 10, 2022, 01:09:20 PM »
Hi

Quote
What does the SRM acronym stand for?
No idea, but the "SRM_" name originates from the firmware itself.


Quote
The closest I get to 924x388 is 928x388 at 2.39:1 .. What aspect ratio are you using? Or it might have been a typo..
The 924x388 is properly just a typo, my mistake.

Quote
The Blueish cold temperature screen, snow, or half-half screen effect shows on liveview, it does disappear if you turn it off and on again, at least temporarily.
Do you get these effect in LiveView even without recording ?

Quote
Haven't tried the x5, x10 zoom yet.. Should I be recording with zoom on?
When you go into zoom mode, mlv_lite is not recording in "zoom mode", but rather the raw sensor (not binning mode), mlv_lite for 40D can currently recording around 1920(?) x 806(?), but the crop mode is high and aspect ratio around 2.39

1. try to disable Small hacks
2. try to recording in zoom mode.





... some text here ..

kitor

  • Developer
  • Senior
  • *****
  • Posts: 460
Re: Canon 40D
« Reply #616 on: March 10, 2022, 01:14:25 PM »
Quote
No idea, but the "SRM_" name originates from the firmware itself.

System (Static?) Resource Manager, on newer models you find a lot of RscMgr.c references. It manages most of memory space, "regular" malloc / AllocateMemory are a very limited pool.

SRM_AllocateMemoryResourceFor1stJob is just a nasty hack that uses SRM Factory mode to allocate a lot of memory. There's a ton of other allocators, they behave differently per camera mode.

https://www.magiclantern.fm/forum/index.php?topic=12528.0
Too many Canon cameras.
If you have a dead R/RP mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

kidkoala83

  • New to the forum
  • *
  • Posts: 11
Re: Canon 40D
« Reply #617 on: March 10, 2022, 08:39:22 PM »
I will do further testing when I can, the blueish/snow/half mirror was happening in high resolutions and aspect ratios in liveview but not even recording yet if I recall right, in fact those might had not even been set yet.. Just liveview no recording, quiet sure..
Once more, thanks a lot heder! :)

kidkoala83

  • New to the forum
  • *
  • Posts: 11
Re: Canon 40D
« Reply #618 on: March 23, 2022, 09:01:12 PM »
Ok, Ive checked. The weird effects happen in live view, not recording, without fps override enabled (OFF), turning  live view on and off seems to fix it momentarily.
If Im not mistaken it only happens in fps above 24, 29.9 for instance, setting fps override (ON) at 24 fps seems to fix it.

heder

  • Developer
  • Member
  • *****
  • Posts: 171
  • No time for caution
Re: Canon 40D
« Reply #619 on: March 25, 2022, 09:55:57 PM »
Hi Kidkoala83, thanks for testing the build!.

I have seen the blueish/snow/half mirror snow effect from time to time on my camera, and it's surely my ML build that does it. I also see these issues on test builds where I mess around with timing. I don't see it currently, but it might just be that I have coded the build to fix perfectly to my camera but not yours. Its timing related becuase I have hijacked all driver functions that writes to the peripherals (sensor, cf, display ... ect). I don't have another build currently, but the next build I will optimize and change the code and hopefully the issues will go away.

Currently I'm stuck for the 2-3 weeks, due to the war in Ukraine, my office is occupied by a grow up daugther of one of our friends from Ukraine. I have the YUV path running correctly and "just" need the jpeg path hacked and then the camera can do 1288 x 820 recording.
... some text here ..

imme

  • New to the forum
  • *
  • Posts: 31
Re: Canon 40D
« Reply #620 on: August 06, 2022, 07:54:38 AM »
hey guys

any update

heder

  • Developer
  • Member
  • *****
  • Posts: 171
  • No time for caution
Re: Canon 40D
« Reply #621 on: August 07, 2022, 08:47:31 PM »
I have been working on getting the mjpeg video recording running at 1336x872 (non crop mode) or similar but it partly fails. The original size 1024x780 is'nt interessing due to the small size. I actually have the YUV conversion path running (sensor->YUV conversion), see post from 6 of March 2022, but the YUV->JPEG path partly fails. I do get a correctly sized image with good pixels, but I also have a green pattern all over the place. I have failed to fix this so far. No one have documented to JPEG engine and registers so it's a black box.

Here is my pattern problem:



I'll give it another month, and If I fails, I'll try to x5 zoom mode. x5 zoom mode is harder to work on, because I need to change much more registers, but I properly have a slightly higher properbility of success with the YUV->JPEG path as the 40D can save JPEG photo images in 1936x1288 format (small size), and I can utilize this to find the correct registers for a 1936x1288. Max format in crop more (x5,x10) is 1944x806 (full HD 1:2.39)
... some text here ..

theBilalFakhouri

  • Developer
  • Hero Member
  • *****
  • Posts: 1346
  • UHS-I
Re: Canon 40D
« Reply #622 on: August 07, 2022, 10:05:46 PM »
General note: from own preview experiments on 700D/5D3, LiveView seems to have multiple layers, if one of the layers didn't match horizontal resolution of e.g. YUV path, some artifact would show (similar to your image). But no idea if it the same thing in your case.

Try to compare registers among none crop mode vs x5 mode, tweak registers you found and see if one of the registers causes these kind of artifacts. We usually do this by adtg_gui module on DIGIC 4/5.



If x5 mode works for JPEG recording and you prefer none-crop mode, You can patch 1:1 (x5) mode back to 3x3 (none crop) mode without touching preview registers, see this. This can be done using CMOS and ADTG registers and it's very simple. We also can do this by adtg_gui module, and it's very simple to do it. Unfortunately no idea how to do it on 40D.

heder

  • Developer
  • Member
  • *****
  • Posts: 171
  • No time for caution
Re: Canon 40D
« Reply #623 on: August 08, 2022, 10:20:17 AM »
General note: from own preview experiments on 700D/5D3, LiveView seems to have multiple layers, if one of the layers didn't match horizontal resolution of e.g. YUV path, some artifact would show (similar to your image). But no idea if it the same thing in your case.

Try to compare registers among none crop mode vs x5 mode, tweak registers you found and see if one of the registers causes these kind of artifacts. We usually do this by adtg_gui module on DIGIC 4/5.



If x5 mode works for JPEG recording and you prefer none-crop mode, You can patch 1:1 (x5) mode back to 3x3 (none crop) mode without touching preview registers, see this. This can be done using CMOS and ADTG registers and it's very simple. We also can do this by adtg_gui module, and it's very simple to do it. Unfortunately no idea how to do it on 40D.

Thanks for input.

The YUV Path runs correctly. I don't have any artefacts, and the registers are quite similar to the one you descripted. The image from 6 March is a image from the updated YUV path. (greyscale image, converted from YUV).  It's the JPEG "path" compressions that run incorrectly, but the JPEG engine is largely undocumented. The YUV is transferred in macro 8x8 blocks into the JPEG engine in a specific pattern, properly due to JPEG engine ram or similar (and another EDMAC is configured to readout on the fly, this works fine). I had compute re-compute the EDMAC value in order to get image transferred. By looking at the different video/photo modes I was capable of re-computing the new EDMAC values. This works for some image width (1024,1088,1280), but I get those artefacts.  I did compare x1 versus x5/x10 inorder to get a feeling for that needs to be updated, EDMAC and JPEG registers.

Basically I'm hijacking the 40D JPEG Path "main" call and changing the image size, and JPEG engine get correctly configured, but the EDMAC value for transferring into the JPEG engine is hardcoded and those is changed on the fly. Also some JPEG related registers needs to be corrected for the entire path to run.

My current assumption is 

1. Either I'm missing at update some JPEG related registers
2. or EDMAC is configured incorrectly.


... some text here ..

Ant123

  • Contributor
  • Member
  • *****
  • Posts: 182
Re: Canon 40D
« Reply #624 on: August 08, 2022, 11:18:21 AM »
No one have documented to JPEG engine and registers so it's a black box.

Have you tried to logging MMIO traffic through JPCore?