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

reddeercity

  • Hero Member
  • *****
  • Posts: 1610
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #175 on: April 24, 2018, 06:53:59 AM »
@Ilia3101 no not yet , but I'll give it try soon.
I'm actually trying to find out why HDMI is broken in the nightly builds (unified) no one has reported it :(
and as far as I can tell it's been broken since the "New Core" (I use the Old Core for production work I must have
HDMI for my production workflow) , so I'm undecided to which way to go . I can implement 10-12bit
and my experiments in UHD plus waza57 code in to the "Old Core" I'm starting to see too many restriction with the new core as
it must be compatible with Digic 5 Camera (5D3) and I'm not to sure about the Digic's 4 (5D2) life expectedly or support .
I know it sound discouraging , but I have to wonder if all this time & effort is really worth it after all .
I can deal with a limited 1:1 resolution but not HDMI , that the deal breaker .
So I need to recess this thread in the direction it goes .
Sorry to be off topic a bit .

reddeercity

  • Hero Member
  • *****
  • Posts: 1610
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #176 on: April 25, 2018, 07:02:22 AM »
reddeercity, Thanks for that but it seems timer B don't increase height like with other models.
I tried a lot of things but nothing works.
Perhaps ADTG [8xxx] but unfortunately I don't succeed to see it with adtg-gui module in 5D2.
An example :

effective width: 2840
effective height: 1082
Being trying to reproduce this from @waza57 but no go , I clone crop_rec_4k_5d2 branch and update to comment f73a13b -- I can load crop_crop.mo but it's disable , the mlv_lite and adtg_gui.mo didn't make .
So can you tell me how you got this please ? was this on mlv_lite or mlv_rec ? I see in the "Digic Poke" where you code is , can you share the setting in there ?
In the mean time I'll play with more , maybe by chance i can find the right setting to reproduce this  :D
Edit: your working in this right ?

Edit:2 it seem I'm still missing some code in raw.c 9a0b318 plus some comment's I missed , I thought the f73a13b comment was the consolidation of the code from waza57 , I'll continue tomorrow



reddeercity

  • Hero Member
  • *****
  • Posts: 1610
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #177 on: April 26, 2018, 08:03:18 AM »
I'm getting some error compiling now in raw.c , I'm not sure why
Code: [Select]
../../src/raw.c: In function 'raw_lv_get_resolution':
../../src/raw.c:682:5: error: invalid storage class for function 'raw_update_params_work'
 int raw_update_params_work()

Code: [Select]
int raw_update_params_work()anything to do with "invalid storage class for function 'raw_update" etc. .....
Can some one please help explain this error .
I'm working off waza57 "crop_rec_5d2"
https://bitbucket.org/waza57/magic-lantern/commits/9a0b318953a02cc12adc09e44253c5772abeb939#Lsrc/raw.cF678T678
Edit: Here my source code I'm working off I uploaded to my bitbucket downloads
https://bitbucket.org/reddeercity/magic-lantern_10-12bit/downloads/2018-4-26-crop_rec_5d2.zip

reddeercity

  • Hero Member
  • *****
  • Posts: 1610
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #178 on: May 03, 2018, 07:53:47 AM »
I put aside "waza57 crop_rec_5d2" code on hold and when back my code and my some improvements (It's gets better)  :)
in raw.c I added
Code: [Select]
#ifdef CONFIG_5D2
#define RAW_LV_BUFFER_ALLOC_SIZE (SRM_BUFFER_SIZE - 0xF000)
#end
In adtg_gui.c I changed 0x6800 -->0x6084/8
Code: [Select]
static int res3k_reg(int reg)
{
    if (regs[reg].dst == 0xC0F0)
    {
        switch (regs[reg].reg)
        {
            case 0x6084/8:                /* C0F06084/8 - raw resolution */
                return 0x52801AB;       /* from 0x528011B -> 3072px in raw_rec */
        }
    }
and added in mlv_lite.c the extended resolutions
Code: [Select]
3840, 4096




 


I was able to extend the horizontal to1076 from 1044 , not much but a start  :)
I did dump the image buffer this what I'm getting , (please remember I did not do any timer adjustment yet)
The HD Dump

The LV Dump

The second HD Dump after trying to move the image down to center

Playing around with liveview preview

Screen shot -- I didn't do any timer adjustment yet


Here the build I compiled (the latest updated source + ISO Research)
Code: [Select]
# Magic Lantern Nightly.2018May03.5D2212 (f683753bc4e3+ (iso-research))
# Built on 2018-05-03 03:54:46 UTC by [email protected]
# Configuration saved on 2018/05/02 22:40:24
beta.warn = 2
menu.first = -4
movie.log = 1
rec.notify = 0
enable-liveview = 2
fps.preset = 1
fps.override.idx = 32
fps.override = 1
battery.drain.rate.rev = 59
hist.log = 0
spotmeter.draw = 0
clear.preview = 4
zebra.draw = 0
disp.mode.x = 149

So What I did was load the adtg_gui.mo ,  mlv_lite.mo  &  Crop_Rec.mo with crop_rec I put the cam in to 1:1 3x mode so every pixel & line (by pass line skipping)
then loaded the 3k 5d3 preset but I changed the regs as noted above .
It changed CMOS[1]0xc00 --> 0x2cb & CMOS[2] 0x40e --> 0x10e
I'm able to switch between all res's up to 4096 (I added 3840 & 4096) yes I can set it to 3520 also , before I was lock to just 3584 and thou the cmos[2]
I was able to change the  horizontal by 32 lines , (not much but a start)

I really just simplified the code after learning what I read in the 10-12bit thread  ;D
I think this is the right path , though the registers just like the 5d3 only make sense being there's so closely related -- brother from a different mother  :D
more to come , next is to clean the raw image up and start recording a image only if for a few second until the buffer is full then I need to finish the lossless compressed raw
code in silent .c
The last thing is the content of MENUS.CFG
Code: [Select]
0 3F77F0FE 3D41FF14 Overlay\Zebras
0 3F783078 3D556563 Overlay\Spotmeter
0 409A2D5E 3E935DBF Movie\FPS override
0 3FF3E2C6 3CA1335E Movie\Crop mode
0 409BA922 3F3448D6 Movie\RAW video
0 3F711935 3B573CCE Movie\Movie Tweaks
0 3FFA4E97 3E70270A Display\Clear overlays
0 407B0F0F 3F208C48 Display\Anamorphic
0 3FFB325A 3EF96A01 Debug\Memory patches
0 3FF8BDA4 3EF33695 Debug\Show console
0 409C1067 3F4B1C91 Debug\ADTG Registers
0 3F7308B9 3BE6B0C1 Debug\Lens info
0 40BC1075 40007E74 Debug\Screenshot - 10s
0 3FFA92E5 3EDB7170 Debug\Dump image buffers
0 3F7346F1 3BFDC26F Debug\Don't click me!
0 3F7E7825 3F10815C Debug\Free Memory
0 3F7156EE 3B6CC2E3 Movie Tweaks\Movie Logging
0 3F7194B7 3B8237FD Movie Tweaks\REC/STBY notify
0 3F71D290 3B8F3D97 Movie Tweaks\Force LiveView
0 3F72CA91 3BD1B7F5 FPS override\Desired FPS
0 3F728C79 3BBEA73B FPS override\Optimize for
0 3F787002 3D6ABC54 Histogram\Scaling
0 3F75B891 3CA48BF9 Advanced\DIGIC Registers
0 3F78EF46 3D8E03DC Advanced\Log Registers Now
0 3FF9750E 3EAE7395 Advanced\1:1 3K crop mode (5D3)
0 4079DAD8 3FA5BBBF RAW video\Resolution
0 3FF5D867 3D364505 RAW video\Aspect ratio
0 3FFF9DD2 3FDE2613 RAW video\Preview
0 3F747EF9 3C4C5756 RAW video\Advanced...
0 3F7EB94A 3F1EF4B2 Free Memory\Allocated RAM

reddeercity

  • Hero Member
  • *****
  • Posts: 1610
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #179 on: May 04, 2018, 08:12:50 AM »
some progress cleaning up Lv @ 4096x1044

Image dump of Liveview in "framing preview"

adjustments CMOS[1]  with ADTG, 0x106E, Shutter blanking for LiveView 1x

Screen capture Liveview


Even thou it in 4096x1044 It seem it retaining the 1856 buffer & just mirroring  it
maybe my size is not right but with SRM buffer my understanding there should enough 32mb per frame , right ?
 
Code: [Select]
RAW_LV_BUFFER_ALLOC_SIZE (SRM_BUFFER_SIZE - 0xF000)I thing this what keeping me from saving a DNG on dumps , it does export a DNG but it's empty
I'll continue tomorrow .

reddeercity

  • Hero Member
  • *****
  • Posts: 1610
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #180 on: May 05, 2018, 06:00:11 AM »
Still haven't got the raw image right yet but I can increase the vertical to 1250 , so that's 4096x1250 .
It's was a matter of just changing Aspect Ratio to 1:1 or 3:2 .

Image dump


Edit: Gave a go at 3x crop mode to see if I could get something there got a interesting result

Just played around with c0f0 0x6084 & c0f0 0x6088 reg's and when to the change the res in the raw video menu .
I don't think there any there yet but interesting

Edit:2 I thing I have to rework the buffer or I need to fully implement raw_slurp  with SRM memory
I can easily put the sensor in to 1:1 without the 3k preset in adtg_gui.mo
Code: [Select]
cmos[1] 0xc00 --> 0xbc0  (height)
cmos[2] 0x40e --> 0x10e (width)
With that I choose up to 4096x1250 , I got that by just switching in to 3x crop_mode and reading what the reg's at cmos 1&2  are.
plus I think I found the reg's for c0f0 0x6084 & 0x6088 in 3x crop_mode
Code: [Select]
c0f0 0x6084 --> 0x10036 (1:1 FHD)
c0f0 0x6084 --> 0x30036 (3x crop_mode)
c0f0 0x6088 --> 0x4f40432 (1:1 FHD)
c0f0 0x6088 --> 0x46a04ba (3x crop_mode)

reddeercity

  • Hero Member
  • *****
  • Posts: 1610
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #181 on: May 06, 2018, 06:26:27 AM »
Having some trouble get the custom buffer to compile for the higher res redirect using srm memory  as per a1ex  talks said here  I found the comment  crop_rec_4k#Lsrc/raw.cT149  and I finished implmenting the rest of raw_slurp for srm memory as per what a1ex has done for the 5d3 for 4k . So my error is this
src/raw.c:578:39: error: 'DEFAULT_RAW_BUFFER'...........
see below -- from the terminal window
Code: [Select]
../../src/raw.c:161:0: warning: "RAW_LV_BUFFER_ALLOC_SIZE" redefined [enabled by default]
 #define RAW_LV_BUFFER_ALLOC_SIZE (SRM_BUFFER_SIZE - 0x1000)
 ^
../../src/raw.c:147:0: note: this is the location of the previous definition
 #define RAW_LV_BUFFER_ALLOC_SIZE (SRM_BUFFER_SIZE - 0xF000)
 ^
../../src/raw.c: In function 'raw_lv_realloc_buffer':
../../src/raw.c:578:39: error: 'DEFAULT_RAW_BUFFER' undeclared (first use in this function)
         if (raw_lv_buffer != (void *) DEFAULT_RAW_BUFFER)
                                       ^
../../src/raw.c:578:39: note: each undeclared identifier is reported only once for each function it appears in
make: *** [raw.o] Error 1
if you have trouble following what posted from the raw.c I uploaded the whole file to my bitbucket downloads folder
https://bitbucket.org/reddeercity/magic-lantern_10-12bit/downloads/adtg_gui_4k_raw_slurp_redierct_buffer-raw.c
here  part of the code, I hope someone can help me understand the problem
I added more code then needed  so everyone can get the idea of with happening

 
Code: [Select]
71- /*********************** Camera-specific constants ****************************/
 72-
 73- #ifdef CONFIG_EDMAC_RAW_SLURP
 74- /* undefine so we don't use it by mistake */
 75- #undef RAW_LV_EDMAC
 76-
 77- /* hardcode Canon's raw buffer directly */
 78- /* you can find it from lv_raw_dump, arg1 passed to dump_file:
 79-  *
  80- * raw_buffer = get_raw_buffer()
  81- * sprintf_maybe(filename, '%08lx.mm1', raw_buffer)
  82-  * ...
  83-  * dump_file(filename, raw_buffer, 7*something...)
  84- */
 ..................
146- #ifdef CONFIG_5D2
147- #define RAW_LV_BUFFER_ALLOC_SIZE (SRM_BUFFER_SIZE - 0xF000)
148- #define DEFAULT_RAW_BUFFER_SIZE (9*1024*1024)     (I added this as I thought it be big enough , not too sure thou -- is this my problem  not sure how to find it out )
149- #endif
150-
151- #ifndef DEFAULT_RAW_BUFFER_SIZE
152- /* todo: figure out how much Canon code allocates for their LV RAW buffer - how? */
153- #warning FIXME: using dummy DEFAULT_RAW_BUFFER_SIZE
154- #define DEFAULT_RAW_BUFFER_SIZE (9*1024*1024)
155- #endif
156-
157- /* for higher resolutions we'll allocate a new buffer, as needed */
158- /* all cameras using CONFIG_EDMAC_RAW_SLURP should be able to handle this */
159- /* SRM_BUFFER_SIZE matches the full-res image size, as 14-bit uncompressed (actually a bit larger, but not much) */
160- #define CONFIG_ALLOCATE_RAW_LV_BUFFER
161- #define RAW_LV_BUFFER_ALLOC_SIZE (SRM_BUFFER_SIZE - 0x1000)
..........................

 549- #ifdef CONFIG_EDMAC_RAW_SLURP
 550-
 551- /* requires raw_sem */
 552- static void raw_lv_free_buffer()
 553- {
 554-   printf("Freeing LV raw buffer %x.\n", raw_lv_buffer);
 555-   if(raw_allocated_lv_buffer) {
 556-        free(raw_allocated_lv_buffer);
 557-        raw_allocated_lv_buffer = 0;
 558-   }
 559-   raw_lv_buffer = 0;
 560-   raw_lv_buffer_size = 0;
 561- }
 562-
 563- /* requires raw_sem */
 564- static void raw_lv_realloc_buffer()
 565- {
 566-   int width, height;
 567-  int ok = raw_lv_get_resolution(&width, &height);
 568-  if (!ok)
 569-  {
 570-      ASSERT(0);
  571-     return;
 572-   }
 573-
 574-    int required_size = width * height * 14/8;
 575-    if (DEFAULT_RAW_BUFFER_SIZE >= required_size)
 576-   {
 577-      /* no need for a larger buffer */
 578-      if (raw_lv_buffer != (void *) DEFAULT_RAW_BUFFER)     ----- (this where the error is  not sure to resolve it )
 579-      {
 580-          printf("Default raw buffer OK for %dx%d (%s)", width, height, format_memory_size(required_size));
 581-
 582-          if (raw_lv_buffer && raw_lv_buffer == raw_allocated_lv_buffer)
 583-          {
 584-             printf(" - back to default.\n");
  585-            raw_lv_free_buffer();
  586-         }
  587-         else if (raw_lv_buffer)
  588-         {
  589-               printf(": %x -> %x\n", raw_lv_buffer, DEFAULT_RAW_BUFFER);
   590-        }
  591-         else
  592-         {
  593-              printf(".\n");
  594-           }
   595-       }
   596-
   597-      raw_lv_buffer = (void *) DEFAULT_RAW_BUFFER;
   598-      raw_lv_buffer_size = DEFAULT_RAW_BUFFER_SIZE;
   599-      return;
   600-   }
   601-
   602-    if (raw_lv_buffer_size >= required_size)
   603-    {
   604-          /* no need for a larger buffer */
    605-       return;
    606-    }
    607-
    608-   printf("Default raw buffer too small (%s", format_memory_size(raw_lv_buffer_size));
    609-   printf(", need %dx%d %s) - reallocating.\n", width, height, format_memory_size(required_size));
    610-
    611-   if (raw_lv_buffer && raw_lv_buffer != (void *) DEFAULT_RAW_BUFFER)
    612-   {
    613-       ASSERT(0);
    614-        return;
     615-   }
    616-
    617- #ifdef CONFIG_ALLOCATE_RAW_LV_BUFFER
    618-         raw_allocated_lv_buffer = fio_malloc(RAW_LV_BUFFER_ALLOC_SIZE);
    619-         raw_lv_buffer = raw_allocated_lv_buffer;
    620-         raw_lv_buffer_size = RAW_LV_BUFFER_ALLOC_SIZE;
    621-         return;
622- #endif /* CONFIG_ALLOCATE_RAW_LV_BUFFER */
623-
624-          /* you should enable CONFIG_ALLOCATE_RAW_LV_BUFFER
625-           * or find some other way to reserve memory for the RAW LV buffer */
626-          ASSERT(0);
627- }
628-
629- #endif  /* CONFIG_EDMAC_RAW_SLURP */
630- #endif /* CONFIG_RAW_LIVEVIEW */
631-

reddeercity

  • Hero Member
  • *****
  • Posts: 1610
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #182 on: May 09, 2018, 01:00:11 AM »
It look like I have problems with the redirect buffer
crop_rec_4k#Lsrc/raw.c-614
Code: [Select]
if (raw_lv_buffer != (void *) DEFAULT_RAW_BUFFER)I added
Code: [Select]
#ifdef CONFIG_5D2
#define RAW_LV_BUFFER_ALLOC_SIZE (SRM_BUFFER_SIZE - 0x1000)
#define DEFAULT_RAW_BUFFER_SIZE (9*1024*1024).
#endif
Is there a way to find the "DEFAULT_RAW_BUFFER_SIZE" ?
 I just copy the default values from
crop_rec_4k#Lsrc/raw.cT146
Code: [Select]
#define DEFAULT_RAW_BUFFER_SIZE (9*1024*1024)
#endif
but if I'm using "SRM_Buffer" do I really need the "Default_Raw_Buffer_Size"
this is confusing me , I did find the "working buffer size" in one of my logs but seem too small
Code: [Select]
1726C> GuiMainTas:ffa4522c:18:03: (PUB) SetImageWorkMemory 1:0x40d00000, 2:0x41700000
172A7> GuiMainTas:ffa45274:18:03: (PUB) SetImageWorkMaxPixel W:2200,H:1872,0x5e4340

as it for 2200x1872 pixels.


reddeercity

  • Hero Member
  • *****
  • Posts: 1610
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #183 on: May 10, 2018, 06:31:43 AM »
Will every think works as far as getting in to 1:1 pixel mode in FHD and ml can select any resolution from 1856 to 4096 up to 1:1 Aspect Ratio 
and it will be able (theoretical specking) to capture up full width 5634 . Very clever software , Magic Lantern !
I starting to see the genius of the code -- the whole infrastructure is very flexible , once I followed a1ex's comments , it's all very clear now :))  ,
the 5d2 works so very close to 5d3 but with I small difference really , e.g. , c0f0 0x6800 0x6804 (d5/5d3) c0f0 0x6088 0x6084 (d4/5d2)
Indeed the 5d3's has the same cmos [2] reg's (0x10E) ,  is the same as the 5d2 cmos[2] reg's (0x10E) for 1:1 pixel FHD and the vertical offset cmos[1]  is a little different
but close enough to get started on cleaning up the offset .
The height limitations is equal to the height of the image buffer , in my case it's still using either the full HD buffer (1880x1250) in 1:1 or 3x crop 2144x1076 and that's the new kettle of fish Has to be solved .
I reproduce every thing in 3xcrop_mode and can get up to 4096x1076 , but the height is lock to the 3x buffer , that why I can get 1250 vertical in 1:1 because the image buffer size ,
the default full raw buffer size need to be found so the redirect buffer code infrastructure can be used with SRM Memory like all the rest of the cam or almost all .
If that can't work then a custom redirect image buffer for d4 cam will need to be written , maybe similar to what I was working on  before raw_slurp
Code: [Select]
#ifdef CONFIG_5D2
#define RAW_LV_BUFFER_ALLOC_SIZE (2040*1267)
#endif
that's equal to the full image buffer full image buffer on 5d2 .

I have a request from any d4 cam users (50d ,550d etc. ..) but I prefer 50d or 7d , I'm interested in if we can put others d4 cams in to 1:1 FHD 4k mode
you need ADTG_GUI.mo from the ISO-Research branch , the best way is to compile with the latest source +the iso-research branch .
some small mod's to adtg_gui.c  adtg_gui.c-1127 change 0x6804 to 0x6084/8 & C0F06804 to C0F06084/8
and in mlv_lite.c add 3840 & 4096 to the list of resolutions that sure do it. If you can't compile of has a problem let me know here and I can provide a build.
What I'm looking for is the cmos[1] , cmos[2] & c0f0 0x6084 & c0f0 0x6088 you'll need to enable digic reg's and put the cam in to 3x crop_mode and record the setting at those reg's
c0f0 0x6084 should be something like 0x30036 in 3x crop mode & 0x10036 in 1:1 mode at least that what the 5d2 says & cmos[2] should be 0x10e in 3x crop 1:1 is 0x40e same thing
that the 5d2 info so if other cam report the same then we can port UHD or at least a true crop record of the sensor in 1:1 maybe 2.5k so who knows.
 

reddeercity

  • Hero Member
  • *****
  • Posts: 1610
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #184 on: May 14, 2018, 06:13:55 AM »
Will I got the redirect buffer to compile in raw.c -- stupid mistake in the "#ifdef CONFIG_5D2" forgot to close the #ifdef with "#endif" :(
any how as I said before I implemented "raw_slurp" for "srm memory" for the redirect buffer . link to the raw.c file below if any one wants to follow along closer
redirect_buffer_4k_res_iso-research_branch_raw.c
added
Code: [Select]
#ifdef CONFIG_5D2
/* for higher resolutions we'll allocate a new buffer, as needed */
#define RAW_LV_BUFFER_ALLOC_SIZE (SRM_BUFFER_SIZE - 0x1000)
#define DEFAULT_RAW_BUFFER (4096*4096)
#endif

not sure if it working yet , just start to experimenting  , I don't think the "default_raw_buffer" is correct I just pick the biggest one there was I saw
in the EDMAC 4096*4096 . I did try 3574*1268 but when I enable raw vide(mlv_lite) all there was "0" or 0x0 for size so I changed to 4096*4096 and raw vide work again at
least before I enabled the adtg_gui.mo . Needed to be reworked more , I wanted at least at this point to be able too compile and it does so fine tuning  buffer sizes
and or finding the correct size is next .

the redirect buffer
Code: [Select]
/* requires raw_sem */
static void raw_lv_realloc_buffer()
{
    int width, height;
    int ok = raw_lv_get_resolution(&width, &height);
    if (!ok)
    {
        ASSERT(0);
        return;
    }

    int required_size = width * height * 14/8;
    if (DEFAULT_RAW_BUFFER_SIZE >= required_size)
    {
        /* no need for a larger buffer */
        if (raw_lv_buffer != (void *) DEFAULT_RAW_BUFFER)
        {
            printf("Default raw buffer OK for %dx%d (%s)", width, height, format_memory_size(required_size));

            if (raw_lv_buffer && raw_lv_buffer == raw_allocated_lv_buffer)
            {
                printf(" - back to default.\n");
                raw_lv_free_buffer();
            }
            else if (raw_lv_buffer)
            {
                printf(": %x -> %x\n", raw_lv_buffer, DEFAULT_RAW_BUFFER);
            }
            else
            {
                printf(".\n");
            }
        }

        raw_lv_buffer = (void *) DEFAULT_RAW_BUFFER;
        raw_lv_buffer_size = DEFAULT_RAW_BUFFER_SIZE;
        return;
    }

    if (raw_lv_buffer_size >= required_size)
    {
        /* no need for a larger buffer */
        return;
    }

    printf("Default raw buffer too small (%s", format_memory_size(raw_lv_buffer_size));
    printf(", need %dx%d %s) - reallocating.\n", width, height, format_memory_size(required_size));

    if (raw_lv_buffer && raw_lv_buffer != (void *) DEFAULT_RAW_BUFFER)
    {
        ASSERT(0);
        return;
    }

#ifdef CONFIG_ALLOCATE_RAW_LV_BUFFER
    raw_allocated_lv_buffer = fio_malloc(RAW_LV_BUFFER_ALLOC_SIZE);
    raw_lv_buffer = raw_allocated_lv_buffer;
    raw_lv_buffer_size = RAW_LV_BUFFER_ALLOC_SIZE;
    return;
#endif /* CONFIG_ALLOCATE_RAW_LV_BUFFER */

    /* you should enable CONFIG_ALLOCATE_RAW_LV_BUFFER
     * or find some other way to reserve memory for the RAW LV buffer */
    ASSERT(0);
}

In the edmac-memcpy.c -- added for raw_slurp (I just took the code from the here
Code: [Select]
/** this method bypasses Canon's lv_save_raw and slurps the raw data directly from connection #0 */
#ifdef CONFIG_EDMAC_RAW_SLURP
   ......
#elif defined(EVF_STATE)
uint32_t raw_write_chan = 0x12; /* 60D and newer, including all DIGIC V */
#elif defined(CONFIG_5D2)
uint32_t raw_write_chan = 0x02; /* testing 0x01 and 0x02 */
#endif

Code: [Select]
platform/5D2.212/consts.h
#define SRM_BUFFER_SIZE 0x25D0000   /* print it from srm_malloc_cbr */
Code: [Select]
platform/5D2.212/internals.h
/** this method bypasses Canon's lv_save_raw and slurps the raw data directly from connection #0 */
#define CONFIG_EDMAC_RAW_SLURP
#define CONFIG_ALLOCATE_RAW_LV_BUFFER
adtg_gui.c I changed c0f0 0x6804 to 6084/8
Code: [Select]
static int res3k_reg(int reg)
{
    if (regs[reg].dst == 0xC0F0)
    {
        switch (regs[reg].reg)
        {
            case 0x6084/8:                /* C0F06084/8 - raw resolution */
                return 0x52801AB;       /* from 0x528011B -> 3072px in raw_rec */
        }
    }

    return 0;
}

reddeercity

  • Hero Member
  • *****
  • Posts: 1610
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #185 on: May 17, 2018, 01:50:19 AM »
another piece of the puzzle of the redirect buffer
I just added
Code: [Select]
/* for higher resolutions we'll allocate a new buffer, as needed */
/* all cameras using CONFIG_EDMAC_RAW_SLURP should be able to handle this */
/* SRM_BUFFER_SIZE matches the full-res image size, as 14-bit uncompressed (actually a bit larger, but not much) */
#define CONFIG_ALLOCATE_RAW_LV_BUFFER
#define RAW_LV_BUFFER_ALLOC_SIZE (SRM_BUFFER_SIZE - 0x1000)
I updated the raw.c and it's on my bitbucket downloads I renamed it to adtg_gui_redirect_4k_buffer_raw.c for those who are following my progress .

I also found out how to find the "default_raw_buffer" -- compile the allocate-raw-lv-buffer branch with these comments from a1ex e799e89
Quote
Raw backend -- attempt to autodetect Canon's raw buffer size
Usage:
- compile with CONFIG_MARK_UNUSED_MEMORY_AT_STARTUP (config-defines.h)
- open the console (Debug menu) and enable something that uses LiveView RAW features (raw video, raw histogram etc)
- test by starting the camera in all video modes (photo, 1080p, 720p, crop, x5 etc)
- take a screenshot or write down the console messages

This something all Digic 4 cam user can do easily and would help with other features beside 4k/UHD
It you do please just post result on this thread .
looking for :
5D2 -- (I should be able to get this one , but it won't hurt to post other results)
50D
7D
550d
600d (? maybe )
did I miss any ? for digic4
 

reddeercity

  • Hero Member
  • *****
  • Posts: 1610
Re: 3K/UHD 5D2 Raw development and Other Digic IV Cams
« Reply #186 on: May 18, 2018, 08:20:22 AM »
some progress in 3x crop_mode , did a image dump LV-005.422 LV-004.422 , starting to get the image to move to the left and push out the ghost image .
you can see the black border shrinking , tried to export the 422 image but the "YUV 422 Convertor" didn't recognizes the resolution but it could be view in the app.
most notable things I'm adjusting is the "A" &"B" Timers & the 3x shutter blanking & cmos[4]
screen shots of app with 422 dumps



yea some how I enabled dual iso with cmos [4]
And one last thing the A & B timers make it more stable , seems timer "B" with higher numbers (greater then 1910<) keeps the image in extended resolutions
so it's not only totally depended on just cmos's reg's , timers have a great deal to do with it also .