Author Topic: 3K/UHD 5D2 Raw development and Other Digic IV Cams  (Read 93470 times)

Ilia3101

  • Senior
  • ****
  • Posts: 454
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #500 on: January 29, 2019, 08:16:53 PM »
About to test it.

@masc you are right, leaving 5x stopped working. It did work some time ago though... used to be able to get to 10x
5D2

jpegmasterjesse

  • Freshman
  • **
  • Posts: 82
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #501 on: January 30, 2019, 01:19:37 AM »
My tests went well! I had one freeze/battery pull but it happened when I was bumping my camera around a lot getting it onto a tripod shoe so I'm not exactly sure what caused it.

I was surprised at how long I could record with my Lexar 1066x. The icon was red but it just kept going. I got to 2 minutes before eventually stopping it myself.

reddeercity

  • Hero Member
  • *****
  • Posts: 1942
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #502 on: January 30, 2019, 05:45:08 AM »
@ masc & Ilia3101 thanks , yea not too worried about safety right now , you know Bleeding Edge stuff  :D
The best way to exit crop_rec is to press the play button twice (once to enter in player mode & once to exit player mode)
this will exit to 3x3 (1:1 FHD) without any cam freeze/lockup that needs a battery pull . Then you can enter into crop_rec
again by pressing the 5x zoom .


I was surprised at how long I could record with my Lexar 1066x. ........  got to 2 minutes before eventually stopping it myself.

Will that cool ! I only tested on my slow 90MB/s Sandisk extreme pro  , just check on my 32GB Lexar 1066x card .
Holy Cow ! your right , ml is only expecting around 300 frames , I stop at 10GB 3300 frames(2:19 min) 
WOW that's continuous  :o , never thought 3008x1074 @ 23.98fps would be special when 2880x1080 was only good for 20-30 seconds .

Must be because of reducing the head timers 3 & 4 which reducers the over head .
ML reports it takes 92.3MB/s @ 3008x1074 23.98 but in the setting file I see the write speed reported was 75.8MB/s , strange .

Another bonus  - HDMI works while recording raw  in crop_rec 3k (3008x1074) , check with my HDMI Zacuto EVF .
But you need to enable "Force HDMI to VGA" so that changes the HDMI out put from 1920x1080 to 720x480.
It really very surprising that HDMI works as well as it does in 3k plus recording continuous , that just blow me away :))

Edit:
For others who may have missed it , 3008x1074 build is available now , details here

banertop

  • New to the forum
  • *
  • Posts: 48
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #503 on: January 30, 2019, 01:52:39 PM »
well done!!!

Again>

coco770108

  • New to the forum
  • *
  • Posts: 2
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #504 on: January 30, 2019, 04:53:21 PM »
That is Incredible !!!
THX @reddeercity!!!
cannot wait to try it~~

stokis

  • New to the forum
  • *
  • Posts: 2
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #505 on: January 31, 2019, 11:57:24 AM »
I tested it, filmed many clips. Strange, but when i play the clips on my pc it plays in fast motion. It looks like in reality 3008x1074 is filmed in ~17 fps, but compressed in 23.976 and plays back in fast motion.
Try it yourself. Film some animal or human, you will see it will play back not in normal pace but in fast motion.

I calculated real file size vs time, and it is ~99 MB/s. But when i film, the camera display shows me ~72 MB/s.

p.s. 2880x1080 10bit worked perfect for me, with normal motion as 23.976 supposed to work.

Bender@arsch

  • New to the forum
  • *
  • Posts: 2
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #506 on: January 31, 2019, 05:14:32 PM »
I have tried the new Preset. In the beginning i must say perfekt...

But... the record timer is to slow, maybe x0.5 -> in the postproduktion the soundline is in normal speed, but the moviespeed maybe x2.  I thing there are not 23.98 FPS, but ~ 12 FPS.

sry for bad english

reddeercity

  • Hero Member
  • *****
  • Posts: 1942
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #507 on: January 31, 2019, 09:00:08 PM »
Thank for the report
 I'll check it out and see what's going on

reddeercity

  • Hero Member
  • *****
  • Posts: 1942
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #508 on: February 01, 2019, 06:07:49 AM »
Found the problem in the Head Timers , had c0f07150(Head timer 4) below the valve( of c0f0713c (Head Timer 3)
I relaxed Head Timer c0f07150 to the same valve a c0f0713c (0x467) now everything is running at the right speed .

Here the updated build , 3008x1080 @ 23.98 fps
magiclantern-crop_rec-3k-5D2-eXperimental.2019Jan31.5D2212.zip
Updated File
magiclantern-crop_rec-3k-1080p-5D2-eXperimental.2019Feb01.5D2212.zip
Updated , see  post #512

Ran a few tests , looks ok but no more continuous write speed , sorry  :-[
that was side effect of the messed up head timers .
I'm getting around 300-400 frames right now , until I get on with cf card over clocking & lossless compression .

Everything should be the same as before with real time preview while recording raw @ 3k 24p
HDMI should also work , with hdmi forced to VGA (720x480) .

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3585
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #509 on: February 01, 2019, 05:46:17 PM »
Just stumbled onto something that might help Digic IV.

src/propvalues.c
Code: [Select]
        //#ifdef CONFIG_DIGIC_IV - fixme
        return version[0] == '4';
        //#endif

If you look at the code for any Digic V camera you'll find this in the platform/[camera]/internals.h file:

Code: [Select]
/** This camera has a DIGIC V chip */
#define CONFIG_DIGIC_V

This is not in the internals.h for Digic IV cameras. Code like this could be simplified:

src/raw.c
Code: [Select]
#if defined(CONFIG_5D2) || defined(CONFIG_50D) || defined(CONFIG_60D) || defined(CONFIG_550D) || defined(CONFIG_500D) || defined(CONFIG_600D) || defined(CONFIG_1100D) || defined(CONFIG_7D)
#define RAW_PHOTO_EDMAC 0xc0f04208
#endif

#if defined(CONFIG_5D3) || defined(CONFIG_700D) || defined(CONFIG_6D) || defined(CONFIG_EOSM2) || defined(CONFIG_EOSM) || defined(CONFIG_650D) || defined(CONFIG_70D) || defined(CONFIG_100D)
#define RAW_PHOTO_EDMAC 0xc0f04008
#endif

To this:

Code: [Select]
#ifdef CONFIG_DIGIC_IV
#define RAW_PHOTO_EDMAC 0xc0f04208
#endif

#ifdef CONFIG_DIGIC_V
#define RAW_PHOTO_EDMAC 0xc0f04008
#endif

Just a suggestion that might simplify getting other Digic IV cameras up to speed with the great work reddeercity has been doing on the 5D2.

BTW--the "fixme" comment in propvalues.c probably still applies for Digic 4+ cameras like the 1300D.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

stokis

  • New to the forum
  • *
  • Posts: 2
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #510 on: February 01, 2019, 10:43:50 PM »
I tested latest 31.jan update on 3008x1074 @ 23.98 fps.
Now the motion is ok, as 23.98 fps should be. I can record ~18 sec without dropped frames.
And mlv sound also goes one on one with picture.

I hope you can somehow make crop preset with increased vertical resolution more than 1074 :)

Thank you reddeercity for your work!
I can use my old canon 5D mkII for filming my kids in 3k now :)

jpegmasterjesse

  • Freshman
  • **
  • Posts: 82
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #511 on: February 02, 2019, 01:58:44 AM »
Curious about 30 fps in the Canon menu - why is this necessary? I tried it today with 24 and 30 and didn't notice any difference in my results.

reddeercity

  • Hero Member
  • *****
  • Posts: 1942
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #512 on: February 02, 2019, 06:35:55 AM »
New Update: 3008x1080 @ 23.98 fps
magiclantern-crop_rec-3k-1080p-5D2-eXperimental.2019Feb01.5D2212.zip

Update Notes:
Pushing the vertical without having to code CMOS[1] offset plus more user friendly preview.


I added 6 more vertical lines to 1080 from 1074 , this took some time to get right .
This is a far as I can go vertically without changing CMOS[1] offset valve .
Also you no longer need to select ML "gray scale" (B/W) preview ,
Just select "Auto Preview" and magic lantern will do the rest  :))
You still need to press half shutter for color preview  but it acts just like non crop_rec .
HDMI should be still working .

FYI on Head Timers : if you adjust both 3 & 4 head timers to the same vertical raw size + the offset
you get more fps - e.g. on 5d2 in 5x zoom (1080+52-offset =1132) =>0x46c
this is still below the default of 0x476 & 0x49C which canon uses for 1074
seem there put too much overhead in there for some reason.

@ jpegmasterjesse , I know it works either way but just for safety reasons .
It is bleeding edge . ;)
   

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3585
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #513 on: February 02, 2019, 08:10:31 AM »
@reddeercity - Could you please commit your local changes and push to the remote?

You are working on this repository, right?

https://bitbucket.org/reddeercity/magic-lantern_10-12bit_raw/commits/all
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 3171
  • 5D3 / M1 / 7D / 70D / SL1 / M2
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #514 on: February 02, 2019, 06:47:44 PM »
@reddeercity - Could you please commit your local changes and push to the remote?

Great call, @dfort!
5D3.113 • 5D3.123 • EOSM.203 • 7D.203 • 70D.112 • 100D.101 • EOSM2.*

reddeercity

  • Hero Member
  • *****
  • Posts: 1942
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #515 on: February 02, 2019, 07:51:46 PM »
I work locally only , so until I'm done .......
Read though my post and you will see all the changes

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3585
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #516 on: February 02, 2019, 11:14:14 PM »
Open source projects like these are never "done."

The last time you posted your local repository was in August and from the looks of it, you were working from a clone of my repository.



Hey, not a problem. I'm glad that you're building off some of the stuff that I pushed out there. If you want to continue working locally only, that's your choice. I'm just asking that you please reciprocate.

By the way, your binaries show the uncommitted changes in plain view. Opening your latest autoexec.bin in a text editor reveals this (I masked out your email address):

Code: [Select]
Magic Lantern crop_rec-4k-5D2-eXperimental.2019Feb01.5D2212
Camera   : 5D2
Firmware : 212
Changeset: 8bfbb0ca228e+ (crop_rec_4k_5D2) tip
Built on : 2019-02-02 04:40:34 by david@***

diff -r 8bfbb0ca228e src/raw.c
--- a/src/raw.c Sat Sep 08 11:26:34 2018 +0200
+++ b/src/raw.c Fri Feb 01 21:40:35 2019 -0700
@@ -32,6 +32,11 @@
 #include "fps.h"
 #include "platform/state-object.h"
 
+#ifdef CONFIG_EDMAC_RAW_PATCH
+#include "patch.h"
+#include "edmac.h"
+#endif
+
 #undef RAW_DEBUG        /* define it to help with porting */
 #undef RAW_DEBUG_DUMP   /* if you want to save the raw image buffer and the DNG from here */
 #undef RAW_DEBUG_BLACK  /* for checking black level calibration */
@@ -221,7 +226,7 @@
 
 #define SHAD_GAIN_REGISTER 0xC0F08030
 
-static int lv_raw_type = PREFERRED_RAW_TYPE;
+//static int lv_raw_type = PREFERRED_RAW_TYPE;//
 static int lv_raw_gain = 0;
 
 /**
@@ -1831,6 +1836,10 @@
     #endif
 }
 
+#if defined(CONFIG_EDMAC_RAW_SLURP) || defined(CONFIG_EDMAC_RAW_PATCH)
+static int lv_raw_type = PREFERRED_RAW_TYPE;
+#endif
+
 #ifdef CONFIG_EDMAC_RAW_SLURP
 
 void FAST raw_lv_vsync()
@@ -1867,7 +1876,31 @@
     /* overriding the buffer is only valid for one frame */
     redirected_raw_buffer = 0;
 }
+#endif
 
+#ifdef CONFIG_EDMAC_RAW_PATCH
+static void raw_lv_setedmac_patch(uint32_t* regs, uint32_t* stack, uint32_t pc)
+{
+    /* R0: EDMAC channel */
+    /* R1: output buffer */
+    /* R2: EDMAC info (geometry) */
+    /* R3: flags */
+
+   int width, height;
+   int ok = raw_lv_get_resolution(&width, &height);
+   if (ok)
+   {
+      /* update EDMAC image size */
+      int pitch = width * raw_info.bits_per_pixel / 8;
+      static struct edmac_info dst_edmac_info;
+      dst_edmac_info.xb = pitch;
+      dst_edmac_info.yb = height - 1;
+      regs[2] = (uint32_t) &dst_edmac_info;
+
+     /* we can override this here */
+     EngDrvOut(RAW_TYPE_REGISTER, lv_raw_type);
+  }
+}
 /* integer gain used to fix the image darkening caused by lv_raw_gain */
 /* this gain must not (!) change the raw data */
 int _raw_lv_get_iso_post_gain()
@@ -2158,6 +2191,12 @@
 }
 
 #ifdef CONFIG_RAW_LIVEVIEW
+
+#ifdef CONFIG_EDMAC_RAW_PATCH
+extern thunk StartImagePass_x1_SetEDmac;
+extern thunk StartImagePass_x5_SetEDmac;
+#endif
+
 static void raw_lv_enable()
 {
     /* make sure LiveView is fully started before enabling the raw flag */
@@ -2168,6 +2207,10 @@
 
 #ifndef CONFIG_EDMAC_RAW_SLURP
     call("lv_save_raw", 1);
+#ifdef CONFIG_EDMAC_RAW_PATCH
+   patch_hook_function((uint32_t) &StartImagePass_x1_SetEDmac, 0xE3A03202, raw_lv_setedmac_patch, "RAW LV x1");
+   patch_hook_function((uint32_t) &StartImagePass_x5_SetEDmac, 0xE3A03202, raw_lv_setedmac_patch, "RAW LV x5");
+#endif
 #endif
 
 #ifdef DEFAULT_RAW_BUFFER
@@ -2210,6 +2253,10 @@
 
 #ifndef CONFIG_EDMAC_RAW_SLURP
     call("lv_save_raw", 0);
+#ifdef CONFIG_EDMAC_RAW_PATCH
+   unpatch_memory((uint32_t) &StartImagePass_x1_SetEDmac);
+   unpatch_memory((uint32_t) &StartImagePass_x5_SetEDmac);
+#endif
 #endif
 
 #ifdef CONFIG_ALLOCATE_RAW_LV_BUFFER
diff -r 8bfbb0ca228e platform/5D2.212/internals.h
--- a/platform/5D2.212/internals.h Sat Sep 08 11:26:34 2018 +0200
+++ b/platform/5D2.212/internals.h Fri Feb 01 21:40:35 2019 -0700
@@ -131,6 +131,9 @@
 #define CONFIG_RAW_DISABLE_IN_10X_ZOOM
 #define CONFIG_RAW_DISABLE_IN_10X_ZOOM_WEAK
 
+/** experimental - patch raw buffer parameters in Canon code */
+#define CONFIG_EDMAC_RAW_PATCH
+
 /** Use joystick for one-finger menu navigation */
 #define CONFIG_LONG_PRESS_JOYSTICK_MENU
 
diff -r 8bfbb0ca228e platform/5D2.212/stubs.S
--- a/platform/5D2.212/stubs.S Sat Sep 08 11:26:34 2018 +0200
+++ b/platform/5D2.212/stubs.S Fri Feb 01 21:40:35 2019 -0700
@@ -222,6 +222,10 @@
 NSTUB(0xFF9D8250,  DispSensorStart)
 NSTUB(0xFF9B1BE0,  LightMeasure_n_Callback_r0)
 
+/** LiveView RAW patches **/
+NSTUB(0xFFA08008, StartImagePass_x1_SetEDmac)               /* right before the SetEDmac call from StartImagePass_x1/x5 CrawAddr / KindOfCraw */
+NSTUB(0xFFA08B24, StartImagePass_x5_SetEDmac)               /* FIXME: why it fails when the hook is placed on the BL instruction?! */
+
 /** Making the card bootable **/
 NSTUB(   0x20890,  cf_device)
 NSTUB(   0x208D8,  sd_device)

Running the module_hginfo_dump.sh script on your compiled modules also show your uncommitted changes:

Code: [Select]
./module_hginfo_dump.sh /Users/rosiefort/Downloads/magiclantern-crop_rec-3k-1080p-5D2-eXperimental.2019Feb01.5D2212/ML/modules/crop_rec.mo
Name        : Crop mode recording
Author      : a1ex
License     : GPL
Summary     : Turn the 1080p and 720p video modes into 1:1 sensor crop modes
Description : This alters the 1080p and 720p video modes, transforming them
              into 3x (1:1) crop modes, by tweaking the sensor registers.
               [...]
Last update : 8bfbb0c on 2018-09-08 09:26:34 UTC by waza57:
              now we can change the ISO settings in crop x5
Build date  : 2019-01-27 21:31:15 UTC
Build user  : david@***

modules/crop_rec/Makefile
modules/crop_rec/README.rst
modules/crop_rec/crop_rec.c
diff -r 8bfbb0ca228e modules/crop_rec/crop_rec.c
--- a/modules/crop_rec/crop_rec.c
+++ b/modules/crop_rec/crop_rec.c
@@ -187,10 +187,10 @@
 static uint32_t MEM_ADTG_WRITE  = 0;
 static uint32_t ENGIO_WRITE     = 0;
 static uint32_t MEM_ENGIO_WRITE = 0;
-static uint32_t RAWROMHEIGHT_WRITE = 0;
-static uint32_t RAWROMWIDTH_WRITE = 0;
-static uint32_t MEM_RAWROMHEIGHT = 0;
-static uint32_t MEM_RAWROMWIDTH = 0;         
+//static uint32_t RAWROMHEIGHT_WRITE = 0;
+//static uint32_t RAWROMWIDTH_WRITE = 0;
+//static uint32_t MEM_RAWROMHEIGHT = 0;
+//static uint32_t MEM_RAWROMWIDTH = 0;         
 
 /* from SENSOR_TIMING_TABLE (fps-engio.c) or FPS override submenu */
 static int fps_main_clock = 0;
@@ -343,10 +343,10 @@
         case CROP_PRESET_CENTER_Z:
               if (is_5D2)                       
             {
-              skip_left       = 264;    //265 269bad value create "black meean too..." and bug in hack suite
-              skip_right      = 44;
-              skip_top        = 54;      // waza57 pourquoi 54 pour avoir une image correcte alors que dmspy que 2
-              skip_bottom     = 66;        //52
+              skip_left       = 160;    //265 269bad value create "black meean too..." and bug in hack suite
+              skip_right      = 0;
+              skip_top        = 52;      // waza57 pourquoi 54 pour avoir une image correcte alors que dmspy que 2
+              skip_bottom     = 0;        //52
             }
             
            break;
@@ -591,7 +591,7 @@
                 }
                 if (is_5D2)
                 {
-                cmos_new[1] = PACK12(42,57);//0xBB3;    /* pink highlights without this */
+                cmos_new[1] = PACK12(42,57);  //0xBB3; /* pink highlights without this */
                 cmos_new[2] = 0x10E;    /* read every column, centered crop */     //waza57 cmos 6
                 break;
                 }
@@ -685,10 +685,10 @@
             /* raw buffer centered in zoom mode */
             case CROP_PRESET_CENTER_Z:
                 cmos_new[1] = (!is_5D2)
-                  ? PACK12(9+2,42+1) /* vertical (first|last) */
+                  ?  PACK12(9+2,42+1) /* vertical (first|last) */
                   : -1;
                 cmos_new[2] = (!is_5D2)
-                ? 0x09E            /* horizontal offset (mask 0xFF0) */
+                ? 0x9E            /* horizontal offset (mask 0xFF0) */
                 : -1;
                 break;
         }
@@ -1510,8 +1510,8 @@
     /* attempt to reconfigure the x5 zoom at the FPS selected in Canon menu */
     if (is_5D2)
     {
-     int timerA = 804 ;         //waza57 good values for 23.976: 804- 1245  and 807 - 1237
-     int timerB = 1245 ;     
+     int timerA = 834 ;         //waza57 good values for 23.976: 804- 1245  and 807 - 1237
+     int timerB = 1200 ;     
      int a = reg_override_fps_nocheck(reg, timerA, timerB, old_val);
         if (a) return a;
            switch (reg)
@@ -1520,11 +1520,32 @@
                 /* X: (3072+140)/8 + 0x17, adjusted for 3072 in raw_rec */
                 
                  case 0xC0F06084:
-                    return (old_val & 0x0000000)  ;
+                    return (old_val & 0x0000000)  + 0x30036 ;
                 
                 case 0xC0F06088:
                     //return (old_val & 0xFFFF0000) + 0x630 ;
-                    return (old_val & 0x00000000) + 0x4b0063c;   //0x4b00648 or origin value chang nothing               
+                    return (old_val & 0x00000000) + 0x46F066A;   //0x4b00648 or origin value chang nothing
+
+                   /* HEAD3 timer */
+                   /* 467 in 30p */
+                case 0xc0f0713c:
+                   return 0x46C ; 
+
+                   /* HEAD4 timer */
+                   /* 49C in 30p */
+                case 0xC0F07150:
+                   return 0x46C ;
+
+                case 0xC0F08184:
+                   return 0x46C ;
+
+                case 0xC0F08188:
+                   return 0xC67 ;
+
+                case 0xC0F08518:
+                   return 0x46C0C67 ;
+
+
             }
     }
     else
@@ -1640,25 +1661,25 @@
 
 static int patch_active = 0;
 static int lv_dirty = 1; //waza57 changes to effective update for 5d2
-static void update_patch(int ROMhack) 
+static void update_patch() 
 {
     if (CROP_PRESET_MENU && !patch_active)
     {
         /* update preset */
         crop_preset = CROP_PRESET_MENU;
-        if (is_5D2 && crop_preset == CROP_PRESET_CENTER_Z )       // need to patch ROM for increase height for 5D2
-        {
-            patch_memory(RAWROMWIDTH_WRITE, MEM_RAWROMWIDTH, 0x00001C70, "crop_rec: rawromwidth hook");                                                                                                                   
-            patch_memory(RAWROMHEIGHT_WRITE, MEM_RAWROMHEIGHT, 0x00000767, "crop_rec: rawromwidth hook");             
-            if (ROMhack)
-              {
-                 patch_active = 1;
-                 return;                                                                                     
-              }
-        }                                                                               
+        //if (is_5D2 && crop_preset == CROP_PRESET_CENTER_Z )       // need to patch ROM for increase height for 5D2
+       // {
+            //patch_memory(RAWROMWIDTH_WRITE, MEM_RAWROMWIDTH, 0x00001C70, "crop_rec: rawromwidth hook");                                                                                                                   
+            //patch_memory(RAWROMHEIGHT_WRITE, MEM_RAWROMHEIGHT, 0x00000767, "crop_rec: rawromwidth hook");             
+            //if (ROMhack)
+              //{
+                 //patch_active = 1;
+                 //return;                                                                                     
+              //}
+        //}                                                                               
         /* install our hooks, if we haven't already do so */
-      //  if (!patch_active)   waza57 changes to effective update for 5d2
-      //  {
+         if (!patch_active)   //waza57 changes to effective update for 5d2
+        {
             patch_hook_function(CMOS_WRITE, MEM_CMOS_WRITE, &cmos_hook, "crop_rec: CMOS[1,2,6] parameters hook");
             patch_hook_function(ADTG_WRITE, MEM_ADTG_WRITE, &adtg_hook, "crop_rec: ADTG[8000,8806] parameters hook");
             if (ENGIO_WRITE)
@@ -1666,8 +1687,8 @@
                 patch_hook_function(ENGIO_WRITE, MEM_ENGIO_WRITE, engio_write_hook, "crop_rec: video timers hook");
             }
             patch_active = 1;
-            //return ; //waza57 present in my version not in  standard
-      //  }
+            return ; //waza57 present in my version not in  standard
+        }
       
     }
     else
@@ -1675,16 +1696,16 @@
         /* undo active patches, if any */
         if (patch_active)
         {
-           if (is_5D2 && crop_preset == CROP_PRESET_CENTER_Z)
-            {
-              unpatch_memory(RAWROMHEIGHT_WRITE);           
-              unpatch_memory (RAWROMWIDTH_WRITE);
-              if (ROMhack)
-              {   
-                  patch_active = 0;
-                  return;
-              }
-            }
+           //if (is_5D2 && crop_preset == CROP_PRESET_CENTER_Z)
+            //{
+              //unpatch_memory(RAWROMHEIGHT_WRITE);           
+              //unpatch_memory (RAWROMWIDTH_WRITE);
+              //if (ROMhack)
+              //{   
+                  //patch_active = 0;
+                  //return;
+              //}
+            //}
             unpatch_memory(CMOS_WRITE);
             unpatch_memory(ADTG_WRITE);
             if (ENGIO_WRITE)
@@ -2310,11 +2331,11 @@
         ENGIO_WRITE = 0xFF9A5618;
         MEM_ENGIO_WRITE = 0xE92D407C;
         
-        RAWROMHEIGHT_WRITE = 0xFFCAA1F4;
-        MEM_RAWROMHEIGHT = 0x00000467;
+       // RAWROMHEIGHT_WRITE = 0xFFCAA1F4;
+        //MEM_RAWROMHEIGHT = 0x00000467;
         
-        RAWROMWIDTH_WRITE = 0xFFCAA1EC;   // waza57 patch ROM for more height
-        MEM_RAWROMWIDTH = 0x00000FCE;
+        //RAWROMWIDTH_WRITE = 0xFFCAA1EC;   // waza57 patch ROM for more height
+        //MEM_RAWROMWIDTH = 0x00000FCE;
         is_5D2 = 1;
         
         crop_presets                = crop_presets_5d2;

Hum--looks like you are working off of the repository that waza57 updated back in September. So using the tools built into ML we can reverse engineer your local repository--or you can do us a big favor and:

hg commit
hg push


You are doing some great work that will benefit all Digic IV ML users. Keep it up!
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

Ilia3101

  • Senior
  • ****
  • Posts: 454
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #517 on: February 02, 2019, 11:54:12 PM »
dfort is right

I was also going to say you should make the source code easily accessible. So we don't have to add changes by looking trough your posts. What you're doing may also be breaking the GPL license, it states that you should give someone the code if you give them the software. But it's not the end of the world yet.

At least upload the source in a zip! if you really don't want to mess around with installing mercurial, which is very easy btw. Would make us all a lot happier and I don't mean this to sound mean with this post :)
5D2

reddeercity

  • Hero Member
  • *****
  • Posts: 1942
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #518 on: February 03, 2019, 03:06:43 AM »
If any of you would look at my downloads page you will see the source code I use , It been there from the start !
https://bitbucket.org/reddeercity/magic-lantern_10-12bit/downloads/Crop_Rec-4k-5d2-50d-magic-lantern_1-9-2019.zip
I use waza57 source (and in my posts I state this , if anyone would have cared to read a few)
I have stated many times I work locally and don't work online as I don't know anything about bitbucket , of which I stated
many times also , sorry my work method are unconventional but that's the way I work & is the most comfortable for me .

So if it makes people feel better , I won't post code until I'm done all the presets in a working crop_rec module
Open source projects like these are never "done."
Well for me I'm almost "done" , after cf card over clocking & lossless I have no more goals .

Edit: updated first Post with the new 3008x1080 23.98fps build & details

70MM13

  • Member
  • ***
  • Posts: 219
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #519 on: February 03, 2019, 03:19:04 AM »
after you're done with the cf overclocking and lossless, it's time to grab a 5d4!!!

please!! :)

reddeercity

  • Hero Member
  • *****
  • Posts: 1942
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #520 on: February 03, 2019, 06:15:01 AM »
Fix the black level problem with 48fps in 3x3 1.67 squeezes (1856x688->1856x1146)
needed to add cmos[5] 0x5 & frame blanking adtg1[1061]0x1
now it on my list to add to the crop_rec

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3585
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #521 on: February 03, 2019, 08:55:58 AM »
...time to grab a 5d4!!!

And a beer! I'd suggest a strong Canadian brew like Unibroue La Fin du Monde.

So if it makes people feel better , I won't post code until I'm done all the presets in a working crop_rec module Well for me I'm almost "done" , after cf card over clocking & lossless I have no more goals .

Doesn't make me feel any better and having no more goals only happens when you're dead.

In any case, keep at it in whatever way works best for you. Just for fun, I downloaded that repository that you said was there from the start and it has uncommitted changes. Yep, you cloned the waza57 repository and made these changes on the crop_rec_4k_5D2 branch:

Code: [Select]
diff --git a/Makefile.user.default b/Makefile.user.default
--- a/Makefile.user.default
+++ b/Makefile.user.default
@@ -202,7 +202,7 @@
 # magiclantern-0.2.0.rc1.550d.fw109.zip
 #~ VERSION=0.2.0.rc1.550d.fw109
 BUILDVER=$(shell whoami).$(shell hg id -i -r .)
-VERSION = $(call eval_once,VERSION,Nightly.$(shell LC_TIME=EN date +'%Y%b%d').$(MODEL)$(FW_VERSION))
+VERSION = $(call eval_once,VERSION,crop_rec-4k-5D2-eXperimental.$(shell LC_TIME=EN date +'%Y%b%d').$(MODEL)$(FW_VERSION))
 
 # Build configuration - untested and debug stuff handy for devs
 # these can be specified either in Makefile.user, or in the command line:
diff --git a/modules/Makefile.modules.default b/modules/Makefile.modules.default
--- a/modules/Makefile.modules.default
+++ b/modules/Makefile.modules.default
@@ -19,4 +19,6 @@
  adv_int \
  crop_rec \
  edmac \

\ No newline at end of file
+        adtg_gui \
+        cf_acc \

diff --git a/modules/mlv_rec/mlv_rec.c b/modules/mlv_rec/mlv_rec.c
--- a/modules/mlv_rec/mlv_rec.c
+++ b/modules/mlv_rec/mlv_rec.c
@@ -133,8 +133,8 @@
  * => if my math is not broken, this traslates to resolution being multiple of 32 pixels horizontally
  * use roughly 10% increments
  **/
-static uint32_t resolution_presets_x[] = {  640,  960,  1280,  1600,  1920,  2240,  2560,  2880,  3200,  3520 };
-#define  RESOLUTION_CHOICES_X CHOICES(     "640","960","1280","1600","1920","2240","2560","2880","3200","3520")
+static uint32_t resolution_presets_x[] = {  640,  960,  1280,  1600,  1920,  2240,  2560,  2880,  3008,  3200,  3520,  3840,  4096,  5632 };
+#define  RESOLUTION_CHOICES_X CHOICES(     "640","960","1280","1600","1920","2240","2560","2880","3008","3200","3520","3840","4096","5632")
 
 static uint32_t aspect_ratio_presets_num[]      = {   5,    4,    3,       8,      25,     239,     235,      22,    2,     185,     16,    5,    3,    4,    12,    1175,    1,    1 };
 static uint32_t aspect_ratio_presets_den[]      = {   1,    1,    1,       3,      10,     100,     100,      10,    1,     100,      9,    3,    2,    3,    10,    1000,    1,    2 };
diff --git a/platform/50D.109/internals.h b/platform/50D.109/internals.h
--- a/platform/50D.109/internals.h
+++ b/platform/50D.109/internals.h
@@ -138,6 +138,9 @@
 #define CONFIG_RAW_DISABLE_IN_10X_ZOOM
 #define CONFIG_RAW_DISABLE_IN_10X_ZOOM_WEAK
 
+/** experimental - patch raw buffer parameters in Canon code */
+#define CONFIG_EDMAC_RAW_PATCH
+
 /** Use joystick for one-finger menu navigation */
 #define CONFIG_LONG_PRESS_JOYSTICK_MENU
 
diff --git a/platform/50D.109/stubs.S b/platform/50D.109/stubs.S
--- a/platform/50D.109/stubs.S
+++ b/platform/50D.109/stubs.S
@@ -231,6 +231,10 @@
 NSTUB(0xFF9ADD28,  DispSensorStart)                         // d
 // NSTUB(    ???,  LightMeasure_n_Callback_r0)              /* present on 7D.203, 5D2.212 */
 
+/** LiveView RAW patches **/
+NSTUB(0xff9db254, StartImagePass_x1_SetEDmac)               /* right before the SetEDmac call from StartImagePass_x1/x5 CrawAddr / KindOfCraw */
+NSTUB(0xff9dbce8, StartImagePass_x5_SetEDmac)               /* FIXME: why it fails when the hook is placed on the BL instruction?! */
+
 /** Making the card bootable **/
 NSTUB(   0x1D6FC,  cf_device)                               // in cfReadBlk
 NSTUB(   0x1D744,  sd_device)                               // in sdReadBlk
diff --git a/platform/5D2.212/internals.h b/platform/5D2.212/internals.h
--- a/platform/5D2.212/internals.h
+++ b/platform/5D2.212/internals.h
@@ -131,6 +131,9 @@
 #define CONFIG_RAW_DISABLE_IN_10X_ZOOM
 #define CONFIG_RAW_DISABLE_IN_10X_ZOOM_WEAK
 
+/** experimental - patch raw buffer parameters in Canon code */
+#define CONFIG_EDMAC_RAW_PATCH
+
 /** Use joystick for one-finger menu navigation */
 #define CONFIG_LONG_PRESS_JOYSTICK_MENU
 
diff --git a/platform/5D2.212/stubs.S b/platform/5D2.212/stubs.S
--- a/platform/5D2.212/stubs.S
+++ b/platform/5D2.212/stubs.S
@@ -222,6 +222,10 @@
 NSTUB(0xFF9D8250,  DispSensorStart)
 NSTUB(0xFF9B1BE0,  LightMeasure_n_Callback_r0)
 
+/** LiveView RAW patches **/
+NSTUB(0xFFA08008, StartImagePass_x1_SetEDmac)               /* right before the SetEDmac call from StartImagePass_x1/x5 CrawAddr / KindOfCraw */
+NSTUB(0xFFA08B24, StartImagePass_x5_SetEDmac)               /* FIXME: why it fails when the hook is placed on the BL instruction?! */
+
 /** Making the card bootable **/
 NSTUB(   0x20890,  cf_device)
 NSTUB(   0x208D8,  sd_device)
diff --git a/src/backtrace.c b/src/backtrace.c
--- a/src/backtrace.c
+++ b/src/backtrace.c
@@ -12,7 +12,7 @@
 #include "tasks.h"
 #include "backtrace.h"
 
-#define qemu_log_mask(...)
+#define qemu_log_mask(level, fmt, ...) { qprintf(fmt, ## __VA_ARGS__); }
 #define qemu_loglevel_mask(x) 0
 #define EOSState void
 
diff --git a/src/raw.c b/src/raw.c
--- a/src/raw.c
+++ b/src/raw.c
@@ -32,6 +32,11 @@
 #include "fps.h"
 #include "platform/state-object.h"
 
+#ifdef CONFIG_EDMAC_RAW_PATCH
+#include "patch.h"
+#include "edmac.h"
+#endif
+
 #undef RAW_DEBUG        /* define it to help with porting */
 #undef RAW_DEBUG_DUMP   /* if you want to save the raw image buffer and the DNG from here */
 #undef RAW_DEBUG_BLACK  /* for checking black level calibration */
@@ -221,7 +226,7 @@
 
 #define SHAD_GAIN_REGISTER 0xC0F08030
 
-static int lv_raw_type = PREFERRED_RAW_TYPE;
+//static int lv_raw_type = PREFERRED_RAW_TYPE;//
 static int lv_raw_gain = 0;
 
 /**
@@ -1831,6 +1836,10 @@
     #endif
 }
 
+#if defined(CONFIG_EDMAC_RAW_SLURP) || defined(CONFIG_EDMAC_RAW_PATCH)
+static int lv_raw_type = PREFERRED_RAW_TYPE;
+#endif
+
 #ifdef CONFIG_EDMAC_RAW_SLURP
 
 void FAST raw_lv_vsync()
@@ -1867,7 +1876,31 @@
     /* overriding the buffer is only valid for one frame */
     redirected_raw_buffer = 0;
 }
+#endif
 
+#ifdef CONFIG_EDMAC_RAW_PATCH
+static void raw_lv_setedmac_patch(uint32_t* regs, uint32_t* stack, uint32_t pc)
+{
+    /* R0: EDMAC channel */
+    /* R1: output buffer */
+    /* R2: EDMAC info (geometry) */
+    /* R3: flags */
+
+   int width, height;
+   int ok = raw_lv_get_resolution(&width, &height);
+   if (ok)
+   {
+      /* update EDMAC image size */
+      int pitch = width * raw_info.bits_per_pixel / 8;
+      static struct edmac_info dst_edmac_info;
+      dst_edmac_info.xb = pitch;
+      dst_edmac_info.yb = height - 1;
+      regs[2] = (uint32_t) &dst_edmac_info;
+
+     /* we can override this here */
+     EngDrvOut(RAW_TYPE_REGISTER, lv_raw_type);
+  }
+}
 /* integer gain used to fix the image darkening caused by lv_raw_gain */
 /* this gain must not (!) change the raw data */
 int _raw_lv_get_iso_post_gain()
@@ -2158,6 +2191,12 @@
 }
 
 #ifdef CONFIG_RAW_LIVEVIEW
+
+#ifdef CONFIG_EDMAC_RAW_PATCH
+extern thunk StartImagePass_x1_SetEDmac;
+extern thunk StartImagePass_x5_SetEDmac;
+#endif
+
 static void raw_lv_enable()
 {
     /* make sure LiveView is fully started before enabling the raw flag */
@@ -2168,6 +2207,10 @@
 
 #ifndef CONFIG_EDMAC_RAW_SLURP
     call("lv_save_raw", 1);
+#ifdef CONFIG_EDMAC_RAW_PATCH
+   patch_hook_function((uint32_t) &StartImagePass_x1_SetEDmac, 0xE3A03202, raw_lv_setedmac_patch, "RAW LV x1");
+   patch_hook_function((uint32_t) &StartImagePass_x5_SetEDmac, 0xE3A03202, raw_lv_setedmac_patch, "RAW LV x5");
+#endif
 #endif
 
 #ifdef DEFAULT_RAW_BUFFER
@@ -2210,6 +2253,10 @@
 
 #ifndef CONFIG_EDMAC_RAW_SLURP
     call("lv_save_raw", 0);
+#ifdef CONFIG_EDMAC_RAW_PATCH
+   unpatch_memory((uint32_t) &StartImagePass_x1_SetEDmac);
+   unpatch_memory((uint32_t) &StartImagePass_x5_SetEDmac);
+#endif
 #endif
 
 #ifdef CONFIG_ALLOCATE_RAW_LV_BUFFER

BTW--I'm just sharing what I discovered about some tools included in the ML source code to look into ML binaries. I think it is possible to reconstruct your local repository provided you keep working the way you're working--and keep publishing test builds. Eventually you really should create a fork and make a pull request so you can get credit for your work.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

Danne

  • Hero Member
  • *****
  • Posts: 5117
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #522 on: February 03, 2019, 09:03:58 AM »
haha, dfort  :-*
Anyway. The code ought to be continuously published, gpl is all about collaboration.

Audionut

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3543
  • Blunt and to the point
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #523 on: February 03, 2019, 10:52:37 AM »
This project looks to be dangerously close to tragic lantern.

Is there any sort of commit history?

A dump of all of your code changes into a single commit, is likely to never ever be checked or pushed into the mainline.

Ilia3101

  • Senior
  • ****
  • Posts: 454
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #524 on: February 03, 2019, 08:45:06 PM »
If any of you would look at my downloads page you will see the source code I use , It been there from the start !
https://bitbucket.org/reddeercity/magic-lantern_10-12bit/downloads/Crop_Rec-4k-5d2-50d-magic-lantern_1-9-2019.zip
I use waza57 source (and in my posts I state this , if anyone would have cared to read a few)
I have stated many times I work locally and don't work online as I don't know anything about bitbucket , of which I stated
many times also , sorry my work method are unconventional but that's the way I work & is the most comfortable for me .

This is good! But I downloaded the source you have uploaded(https://bitbucket.org/reddeercity/magic-lantern_10-12bit/downloads/Crop_Rec-4k-5d2-50d-magic-lantern_1-9-2019.zip) and compiled it, it is only the 2880x1080 version. For any compiled version you release, you should also release the code specific to it. Could you upload a zip of the current 3008x1080 build's code please?

So if it makes people feel better , I won't post code until I'm done all the presets in a working crop_rec module Well for me I'm almost "done" , after cf card over clocking & lossless I have no more goals .

Definitely keep posting code, especially if you are uploading a compiled build. If you really don't want to use mercurial (hg), please just upload a zip file of your code every now and then. It will really make the ML developers a lot happier.

Ok , can you post your code please
I need to look at the code first before I try it ,
Don't what to brick my camera .

This
5D2