5D Mark IV - Dual Pixel RAW from LiveView

                                                        -- a1ex, september-november 2018

By default, the 5D Mark IV saves an unusual kind of Bayer data from LiveView - smaller size and with many artifacts. A closer look reveals what they actually are - Dual Pixel RAW frames from LiveView!

Let's decode them.

Background:

lv_raw_dump (after lv_save_raw) saves a file named 46201988.RAW.

In [1]:
%%shell
wget -c -q https://a1ex.magiclantern.fm/bleeding-edge/5D4/dual-pixel/kichetof/46201988.RAW
wget -c -q https://a1ex.magiclantern.fm/bleeding-edge/5D4/dual-pixel/kichetof/DEBUGMSG.LOG
In [2]:
%%shell
xxd -l 128 46201988.RAW; xxd -o 0x100000 -l 128 46201988.RAW
00000000: 0010 1010 1010 e80f 1010 1010 f80f 0010  ................
00000010: 0010 d80f d80f 2010 1010 0010 e80f f00f  ...... .........
00000020: d80f d80f 2010 e80f 1010 0010 d80f e80f  .... ...........
00000030: 1010 f00f e80f f80f 0010 f80f f80f f00f  ................
00000040: 0010 1010 e80f e80f 0010 2010 d80f 0010  .......... .....
00000050: e00f e80f f80f 0010 f00f f00f f00f 1010  ................
00000060: f00f 0010 0810 0010 0010 f80f d80f 0010  ................
00000070: c80f 0010 0810 1010 f00f 1010 0810 e80f  ................
00100000: 0010 1010 1010 e80f 1010 1010 f80f 0010  ................
00100010: 0010 d80f d80f 2010 1010 0010 e80f f00f  ...... .........
00100020: d80f d80f 2010 e80f 1010 0010 d80f e80f  .... ...........
00100030: 1010 f00f e80f f80f 0010 f80f f80f f00f  ................
00100040: 0010 1010 e80f e80f 0010 2010 d80f 0010  .......... .....
00100050: e00f e80f f80f 0010 f00f f00f f00f 1010  ................
00100060: f00f 0010 0810 0010 0010 f80f d80f 0010  ................
00100070: c80f 0010 0810 1010 f00f 1010 0810 e80f  ................

Smells like 16-bit data.

Let's fire up Octave (4.x with 16-bit image support) to have a closer look.

In [3]:
f = fopen("46201988.RAW");
x = fread(f, "uint16");
fclose(f);
size(x)
ans =

   1411776         1

From the log file, we'll look for the output of this code snippet, to find out the image size:

#ifdef CONFIG_5D4   /* 1.0.4 */
DryosDebugMsg(0, 15, "Raw buffer size: %d x %d", MEM(0x133FC), MEM(0x13400));
DryosDebugMsg(0, 15, "FPS timer B: %d", MEM(0x12D10));
#endif
In [4]:
%%shell
cat DEBUGMSG.LOG | grep "Raw buffer size" -C 1
006AD96C>        Evf:fe0fd965:a7:03: MEM1::0x46201988
006AF12D>       dump:001cd77c:00:0f: Raw buffer size: 1824 x 774
006AF149>       dump:001cd794:00:0f: FPS timer B: 1379
In [5]:
x = reshape(x, [1824 774])';
imshow(x, []);