The Definitive [Xiaomi Yi RAW] Guide

Pol Leke

New Member
Joined
Nov 18, 2015
Messages
1
Likes
0
Location
Steenbergen
Country
Netherlands
Dash Cam
Xiaomi Yi (SN: Z22L)
#82
I am totaly stuck on this.
I can make RAW photos with my Yi, but i can't convert them to DNG files.
Every time i get the ERROR: unsupported format. :mad:
What am i doing wrong? :(
I'm using the Ximode scripts from XS-Sol site.

EDIT: oct 29............... nobody?????????
 
Last edited:

am777

New Member
Joined
Jan 18, 2017
Messages
1
Likes
0
Country
Germany
#83
I am totaly stuck on this.
I can make RAW photos with my Yi, but i can't convert them to DNG files.
Every time i get the ERROR: unsupported format. :mad:
What am i doing wrong? :(
I'm using the Ximode scripts from XS-Sol site.

EDIT: oct 29............... nobody?????????
I had the same "unsupported format" error when converting with raw2dng . A factory reset of the cam via Xiaomi App solved this. Afterwards the script produces 30 MB raw files instead of 13 MB raws and convertig is working again.
 

plre

New Member
Joined
Aug 15, 2016
Messages
4
Likes
1
Country
Russian Federation
#84
I tried to decompress 13M RAW files with DPCM 8-10, DPCM 8-12, RLE and A-Law... no go :(
I'm struck because of some oddities I'm noticing. The IMX206 sensors send RAW10 or RAW12 (or DPCM 10-8) datas to the A7LS. So is the compression done by the image processing DSP and not by the sensor? And why in the TXT of pictures took with "t cal -raw" I can read "system.raw_resolution 14"? Why 14? And why a row lenght of 3904? (moreover, I suspect that the last 20 bytes of every line contains some information and not RGGB values). The compression is surely row by row.
Have you tried DPCM 12-7-12 scheme as defined by the MIPI CSI-2 draft? The spec states that it provides about 42% percent bit rate reduction (so it should provide about the same reduction in file size IMO).

After inspecting compressed and uncompressed RAWs more closely, it is easy to notice one peculiar detail: compressed RAWs are 43.51% smaller in size, than an uncompressed RAW would be, if it would store 12 bits per pixel in a tightly packed manner (and not sparse 16 bits).

The math behind this is really simple:
Each image has 15925248 pixels.
The spec for the IMX206 sensor states, that max data output is 12bit, so raw data (really raw, straight from the DAC, or just stored in packed format) would be 15925248 * 12 / 8, or 23887872 bytes.
And compressed RAW files have the size of 13492224 bytes, which is 43% lower.

This might be a long shot, but it's worth a try. I'll try to verify this, but no promises.
 
Last edited:

plre

New Member
Joined
Aug 15, 2016
Messages
4
Likes
1
Country
Russian Federation
#85
No luck so far.

Assuming that the encoding is done line by line, the length of each encoded line should be 3904 bytes. However, for 7-byte encoding, it must be 4032 bytes. 3904-byte length gives 6.78 bits per pixel, so
- either this is not DPCM
- there is an additional compression step

I've also has been able to find evidence, that the camera firmware uses only following DPCM modes:
- 12-8-12
- 10-8-12
 

plre

New Member
Joined
Aug 15, 2016
Messages
4
Likes
1
Country
Russian Federation
#86
No actual success, just thought I'd share the (likely final) update. The compression seems to be 6.75 bits per pixel, which (most likely) corresponds to a Huffman shift coding with dictionary size of 16. Without either analyzing the source code or reverse-engineering the firmware, trying to guess the data structure inside that 13M binary blob doesn't seem like a promising prospect.
 

Similar threads