(CHDK) RAW files have no "defined" structure. It a "binary" files containing only "RAW" Data from Image Sensor.
CHDK "just" dumps the RAW Image Sensor Data (Buffer) from Camera Memory into a "RAW" file (CRW_0001.CRW for example).
I need structure of image Sensor
SD4000 Image Sensor use CFA RGGB pattern:
Note: 2x2 CFA means that your sensor have RGGB CFA (RED, GREEN, GREEN, BLUE dispose in 2x2 matrix) then:
first line is RGRGRGRGRGRG...
second line is: GBGBGBGBGBGB...
third line is: RGRGRGRG...
and so on ...
#define cam_CFAPattern 0x02010100 // Red Green Green Blue
Ok.
How to understand the meaning: cam_CFAPattern 0x02010100 ?
2 - red, 1 - green, 0 - blue?
It isn't order of color channels in raw file. For what use this value?
How many bits are used for each point in a saved file? 12-bit?
Example, three first bytes from raw file:
0xFF 0xF1 0x11 = 0xFFF 0x111 (color channels R and G)
and little endian? Is it true?
If you just want to view/edit/etc. RAW enable DNG in CHDK ("DNG format") or convert RAW files to DNG on your computer.
Most software should be able use DNG files from CHDK.
There is no software that converts the file from 300HS.
For what we use these defines?
#define CAM_ACTIVE_AREA_X1 116
#define CAM_ACTIVE_AREA_Y1 14
#define CAM_ACTIVE_AREA_X2 3788
#define CAM_ACTIVE_AREA_Y2 2766
PS
My english is very bad english with google translate. Sorry.