Home Tutorial About

How to use the Decoder

In order to use the decoder all that is need a modern web browser and a CR2 file. After the file has been uploaded the file is presented to the user. On the left there will be some general information about the file, in the middle there will be a picture from the file and on the right there will be a couple radio buttons to decide what sort of decoding and processing level to use on the file. Beneath the picture there are three aditional buttons, one for downloading the JPEG, one for downloading the metadata and one for starting the decoding process. In order to start decoding, a level needs to be chosen and it needs be decided if the decoder should crop the extra sensor pixels or not and then the start button needs to be pressed. Once that has been done the decoder will do its job and decompress and process the data in the expected way. Once that whole process is done, the start button will be changed to a button to download the data as JSON file. After downloading the file it can either be turned into a picture using our software or by making your own program in pretty much any desired programming language.

Decode Levels

The decoder allows a total of 6 decode levels that all represent the data in different stages of the decoding and processing. The six levels are: Sensor, Normalized, White-Balanced, Demosaiced, sRGB and Fully processed.

Sensor is the lowest level and outputs the raw sensor data after it has only been decompressed and unsliced, except for that no other processes are used.

Normalized means that the colors of the sensor data have been normalized to the [0,1] interval and have had the black and white levels adjusted.

White-Balanced simply means that on the normalized colors a white balancing was done in order to produce balanced colors and true white pixels.

Demosaiced is only used for full Raws because they are still in a CFA which means that only a single color per pixel is saved and half the pixels are green. In order to fix that the missing values in the pixels are interpolated from the values of the same colors in the neighbouring pixels.

sRGB means that the colors have been converted from the color space of the camera which took it to the standard RGB space which is supported by most screens.

Fully means that all previous processes have been applied to the data and what is left is to adjust the brightness and the gamma of the image. The brightness is increased a bit in order to make the linear sensor data not as dark and a gamma correction is applied as the last process to adjust the gammas to make the dark values a bit more fitting.

Which one ends up being used depends on the user's choice but for the best looking image it is recommended to get the sRGB data and process it in a program that is suited for that. The functions implemented here for the last step are just our own way to get decent looking pictures but in most cases the pictures made by software like DPP are better looking.

JSON File and Creating Images

The JSON file that is the output of the whole decoding process contains a 2D JSON Array which represents the image in the correct order. For some pictures there is a special value at the beginning which describes what sort of data it is. If the value is -1 it is a CFA without normalized color, -2 means the color has been normalized but is still in a CFA and -3 is RGB created from sRaws or mRaws which also haven't been normalized yet. If there isn't a special value then the values have 3 values per pixel and have at least been normalized, if not something more. In order to create an image out of the file the arrays need to be gone through and for put every 3 values together to a pixel with the coresponding position in the image. The values for the pixels need to be divided by 10000 seeing as the file contains the actual values multiplied by 10000 in order to save space. The image creation can also be done using our java program which can be downloaded here. In order to make a picture just choose the desired JSON file and select where to save it.