12-bit (and 10-bit) RAW video development discussion

Started by d, May 22, 2013, 10:58:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nikfreak

It is safe to try it out. Both settings won't brick your camera. I would try out one after another not both at the same time. For finding free channels you can compile this. Check the latest commits. a1ex has rewritten find free edmac channels. So should be no problem for you to find other unused ones.

For dmaflags I recommend doing it like seen on unified branch:
https://bitbucket.org/hudson/magic-lantern/src/4f72a0eabb16c87ace571f494e588598b467c157/src/edmac-memcpy.c?at=unified&fileviewer=file-view-default#edmac-memcpy.c-401
[size=8pt]70D.112 & 100D.101[/size]

a1ex

Near LVx1_StartMem1Edmac: channel = 0x12, flags = 0x60000000.

The meaning of this flag is not really known, but this benchmark gives some insights:
5D3 edmac_memcpy (see also transfer size from Register Map):

0x40001000 => 653 MB/s (16 bytes per transfer)
0x20001000 => 625 MB/s (8 bytes)
0x40000000 => 585 MB/s (4 bytes)
0x20000000 => 380 MB/s (2 bytes)
0x60000000 => 585 MB/s (same as 0x40000000?)
0x60001000 => 653 MB/s (same as 0x40001000?)


So, I'd expect it to work with both 0x60000000 and 0x40000000. Can you confirm?

Levas

Alex, are you asking me to try those values on the 6d ?

So instead of:
uint32_t dmaFlags = 0x20000000;
Try out:
uint32_t dmaFlags = 0x60000000; (or  uint32_t dmaFlags = 0x40000000;

@NikFreak
QuoteIt is safe to try it out. Both settings won't brick your camera.
That's all I need to know  :D

nikfreak

Nice code insights. Whats the synonym for LVx1_StartMem1Edmac on 7D.203? Something around FF27E924 with dmaflag 0x40000000?
[size=8pt]70D.112 & 100D.101[/size]

a1ex

StartPass_x1 CrawAddr : %lx / KindOfCraw : %d.

Old models appear to require some more changes though...

Surin Dmitriy

18 dec 113 build first tests:

mlv 10 bit 39 fps - wrong black level
mlv 10 bit 24 fps - ok
raw rec 10 bit 39 fps - ok

crop mode (5x zoom) lv doesnt work

the last build whithin the crop_rec module doesnt have issues whith lv, but had another problems such as bad first frame and mlv_rec corrupt frames
5D3

Surin Dmitriy

Quote from: Surin Dmitriy on December 22, 2016, 11:48:57 AM
18 dec 113 build first tests:

mlv 10 bit 39 fps - wrong black level
mlv 10 bit 24 fps - ok
raw rec 10 bit 39 fps - ok

crop mode (5x zoom) lv doesnt work

the last build whithin the crop_rec module doesnt have issues whith lv, but had another problems such as bad first frame and mlv_rec corrupt frames

After restarting, removing the card, 5x crop mode lv start to work..?
5D3

dfort

Quote from: LevasI'm not an expert in this, but I'm wondering why some camera addresses are written as 0xXX and for other camera's like the 5d3 for example as a plain normal number:

The address can be in either hex or decimal. Near the top of raw.c look for this line:

#undef RAW_DEBUG_TYPE   /* this lets you select the raw type (for PREFERRED_RAW_TYPE) from menu */


and change it to #define and you'll be able to try different addresses (in hex) from the Debug menu. Read the comments on this merged pull request for more information:

https://bitbucket.org/hudson/magic-lantern/pull-requests/780/increase-raw_debug_type-limit/diff

Levas

I wanted to do some testing, but can't get it to work.

I've downloaded the latest magic lantern 'raw_video_10bit_12bit' branch from https://bitbucket.org/hudson/magic-lantern
And I've got an altered 'raw.c' file and an altered 'edmac-memcpy.c' file from eNnvi, which I put in the latest version of raw_video_10_12bit branch, I overwrite the original raw.c and edmac-memcpy.c files.

Then I go to platforms and make a new build for the 6d.
But when I test this new build, live view freezes... (Although the recorded 10bit MLV files give good frames)
While eNnvi got me some builds where live view doesn't freeze ?
Am I doing something wrong here, as far as I understand the only two files altered for using RAW SLURP are the raw.c and the edmac-memcpy.c files ?

dfort

You also need internals.h for the 6D to define the slurp thing--away from computer at the moment.


Sent from my iPhone using Tapatalk

Levas

Thanks, that was the missing piece. Compiled a build with working live view myself.
Now it's time to do some testing  8)

Levas

@Alex
I can conform that using
uint32_t dmaFlags = 0x40000000

gives the same results as
uint32_t dmaFlags = 0x20000000

pink garbage frames  :P

Levas

@dfort

I did the #define thing on RAW_DEBUG_TYPE
But I get this error with compiling
../../src/raw.c:2113:18: error: 'lv_raw_type' undeclared here (not in a function)
         .priv = &lv_raw_type,
                  ^
make: *** [raw.o] Error 1


Tried some different edmac channels, changing the edmac-memcpy.c, but so far, no luck.
Got one black live view and one really slow live view, like 5 fps or something.
Would be a lot quicker if you can define it in the debug menu.

budafilms

@Walter Schulz

I want to take de risk. I can test in the real world. I have a film production company and we work everyday with Canon (5D, 7D, 6D), Sony and Black Magic.

I don't have skills and time to compile. But time to test when I film (not trees and cats, of course ;)).

If you or other dev can share the compile, I will test.

dfort

You need to give it a starting value. Any value will do because you can change it. Look at the 60D as an example.


Sent from my iPhone using Tapatalk

nikfreak

Quote from: Levas on December 22, 2016, 09:22:22 PM
...
pink garbage frames  :P

Then try 0x60000000.

Quote from: a1ex on December 22, 2016, 11:18:03 AM
StartPass_x1 CrawAddr : %lx / KindOfCraw : %d.

Old models appear to require some more changes though...
Finding DEFAULT_RAW_BUFFER for 7D causes some headaches. Cannot find anything EVF related in the 7D ROM though other DIGIC IV like 60D/600D are no problem regarding that. can you help in finding DEFAULT_RAW_BUFFER for 7D?
[size=8pt]70D.112 & 100D.101[/size]

a1ex

Sure, reply #754. I already tried, without success.

dfort

@Levas did you get it to compile with "#define RAW_DEBUG_TYPE" ?

What I was trying to tell you on my cell phone is to look for this:

raw.c
#ifdef CONFIG_60D
#define PREFERRED_RAW_TYPE 5
#endif


And do the same for the 6D. Then go to the Debug menu to try different values:



Start with 0x1 and go up from there. After a while you'll get repeating results. You might want to look at the playback in camera with mlv_play and also load raw_twk if you're using 10/12 bit options.

Levas

Thanks @Dfort
I already got the debug option working, but ran out off battery...

It's a new day and got a fully loaded battery 8)

Levas

Ok, I tested a lot today and allmost  all I saw were frames that could be described as a pink mess  :P
There is one setting which gives me scrambled pink frames, so still a mess, but you can recognize some stuff in it.
Free edmac channel
uint32_t raw_write_chan = 0x12;
and dma flag
  uint32_t dmaFlags = 0x20000000;

But I also find some resolution settings furtheron in the raw.c file.
Could it be that the scrambled picture is caused by faulty settings in this part of raw.c

#ifdef CONFIG_EDMAC_RAW_SLURP

    /* params useful for hardcoding buffer sizes, according to video mode */
    int mv = is_movie_mode();
    int mv720 = mv && video_mode_resolution == 1;
    int mv1080 = mv && video_mode_resolution == 0;
    int mv640 = mv && video_mode_resolution == 2;
    int mv1080crop = mv && video_mode_resolution == 0 && video_mode_crop;
    int mv640crop = mv && video_mode_resolution == 2 && video_mode_crop;
   
    /* note: 6D reports 129 = 0x81 for zoom x1, and it behaves just like plain (unzoomed) LiveView) */
    int zoom = (lv_dispsize & 0xF) > 1;

    /* silence warnings; not all cameras have all these modes */
    (void)mv640; (void)mv720; (void)mv1080; (void)mv640; (void)mv1080crop; (void)mv640crop; (void)zoom;

    #ifdef CONFIG_5D3
    /* don't know how to get the resolution without relying on Canon's lv_save_raw */
    *width  = zoom ? 3744 : mv720 ? 2080 : 2080;
    *height = zoom ? 1380 : mv720 ?  692 : 1318;    /* height must be exact! copy it from Debug->EDMAC */
    return 1;
    #endif

    #ifdef CONFIG_60D
    *width  = zoom ? 2520 : mv640crop ? 920 : mv720 || mv640 ? 1888 : 1888;
    *height = zoom ? 1106 : mv640crop ? 624 : mv720 || mv640 ?  720 : 1182;
    return 1;
    #endif

    #ifdef CONFIG_600D
    *width  = zoom ? 2520 : mv1080crop ? 1952 : mv720  ? 1888 : 1888;
    *height = zoom ? 1106 : mv1080crop ? 1048 : mv720  ?  720 : 1182;
    return 1;
    #endif
   
    #if defined(CONFIG_650D) || defined(CONFIG_700D)
    *width  = zoom ? 2592 : mv1080crop ? 1872 : mv720  ? 1808 : 1808;
    *height = zoom ? 1108 : mv1080crop ? 1060 : mv720  ?  720 : 1190;
    return 1;
    #endif

    #ifdef CONFIG_EOSM
    *width  = video_mode_crop ? 1872 : 1808;
    *height = video_mode_crop ? 1060 : 727;
    return 1;
    #endif

    #ifdef CONFIG_6D
    *width  = zoom ? 2768 : mv720 ? 1920 : 1920;
    *height = zoom ?  634 : mv720 ?  720 : 1208;    /* find correct mv720 height -- must be exact! */   
    return 1;
    #endif
/ silent picture in 1080 mode = 1830 x 1224 /
/ silent picture in 720 mode = 1830 x 634 /
/ silent picture in zoom mode = 2688 x 960 /
/ image buffers 1080 mode (in debug menu) shows 720 x 480, 1808 x 1206 /
/ Some EDMAC channels show 3360 x 1207 or 3616 x 1205 /
/ image buffers 720 mode (in debug menu) shows 720 x 480, 1280 x 720 /
/ Some EDMAC channels show 2560 x 720 or 2560 x 719 or 3360 x 719 /
/ image buffers in 1080 zoom are 720x480, 1104x736 /
/ Some EDMAC channels show 2208 x 736 or 2208 x 735 or 4844 x 633 /
   
   #ifdef CONFIG_7D
    *width  = zoom ? 2520 : mv1080crop ? 1952 : mv720  ? 1888 : 1888;
    *height = zoom ? 1106 : mv1080crop ? 1048 : mv720  ?  720 : 1182;
    return 1;
    #endif

    /* unknown camera? */
    return 0;


For 6d I tried some different settings, but I'm not sure which resolutions to put where, so I added some text in the file which shows resolutions of silent pics and image buffers and edmac channels.
Does somebody have an idea which numbers to use ?

    #ifdef CONFIG_6D
    *width  = zoom ? 2768 : mv720 ? 1920 : 1920;
    *height = zoom ?  634 : mv720 ?  720 : 1208;    /* find correct mv720 height -- must be exact! */   
    return 1;
    #endif
/ silent picture in 1080 mode = 1830 x 1224 /
/ silent picture in 720 mode = 1830 x 634 /
/ silent picture in zoom mode = 2688 x 960 /
/ image buffers 1080 mode (in debug menu) shows 720 x 480, 1808 x 1206 /
/ Some EDMAC channels show 3360 x 1207 or 3616 x 1205 /
/ image buffers 720 mode (in debug menu) shows 720 x 480, 1280 x 720 /
/ Some EDMAC channels show 2560 x 720 or 2560 x 719 or 3360 x 719 /
/ image buffers in 1080 zoom are 720x480, 1104x736 /
/ Some EDMAC channels show 2208 x 736 or 2208 x 735 or 4844 x 633 /

nikfreak

So envvi guided you and gave you some code snippets? Where did you guys get


#ifdef CONFIG_6D
    *width  = zoom ? 2768 : mv720 ? 1920 : 1920;
    *height = zoom ?  634 : mv720 ?  720 : 1208;    /* find correct mv720 height -- must be exact! */   
    return 1;
    #endif


from? You need to call lv_save_raw to read the values from "Show EDMAC". The value for width shown there must be undertaken a math. the formula is:

shown width * 8 / 14


You can replace this in debug.c


static void run_test()
{
call("lv_save_raw", 1);
}


and just call it afterwards from "Don't click me" for all video / zoom modes. the shown height in edmac needs to be added +1. For e.g. if it shows 1205 then it is 1206. Height values isn't alowed to be odd. It needs to be an even value.
[size=8pt]70D.112 & 100D.101[/size]

Levas

Thanks Nikfreak, I'll try the debug.c and dont click me method.

eNnvi tried to make soms builds for the 6d.
Only they didn't work perfect.
I asked eNnvi for the raw.c and edmac-memcpy.c file so I could test some stuff.
eNnvi doesn't have a 6d, but seems to know somebody else with a 6d who also tested the builds.

eNnvi

Sorry giusto been really busy at work these data, this evening i'll try to get the help of levas and find the right width and height buffer pointers.

I got those data looking at the 6d edmac while recordman and the width from the silent pic.

Now i realize that was not the best way to do that. Levas i'll text you via PM when i'll be back home

nikfreak

probably the values are ok for mv720 and 1x zoom but definitely wrong height for the zoom mode. I would recheck all of them in all modes as explained above.
[size=8pt]70D.112 & 100D.101[/size]

Levas

Original values in the file from eNnvi were
*width  = zoom ? 2768 : mv720 ? 1920 : 1920;
*height = zoom ?  736 : mv720 ?  720 : 1208;

Don't know if I did it right, cause changing the debug.c and pushing the don't click me didn't change the values in the show edmac screens  :-\
But these values I did found in one edmac channel:

zoom
4844 x 987 which translates too (2768 x 988)

1080mode
3360 x 1251  which translates too  (1920 x 1252)

720mode
3360 x 662  which translates too  (1920 x 662)

So my raw.c file is now like this (which still gives scrambled frames, but could be due other issues like free edmac channel etc.)
#ifdef CONFIG_6D
    *width  = zoom ? 2768 : mv720 ? 1920 : 1920;
    *height = zoom ? 988 : mv720 ?  662 : 1252;    /* find correct mv720 height -- must be exact! */   
    return 1;
#endif