I've just figured out how to compile chdk, after a try with this values
#define CAM_ACTIVE_AREA_X1 0
#define CAM_ACTIVE_AREA_Y1 0
#define CAM_ACTIVE_AREA_X2 4104
#define CAM_ACTIVE_AREA_Y2 3048
i got this: http://belluzz.altervista.org/forum/CRW_0480.DNG
(taken with camera rotated 90° clockwise, sorry)
jpg: http://belluzz.altervista.org/forum/0480DNG.jpg
Assuming a desired size of 4000x3000 (like original jpgs) a starting point could be an offset of
Desired size should be based on valid data, not jpeg size. Usually it's a bit larger. However, this points out another problem with the port, the jpeg size (which is used for the default DNG crop) is 3648x2736, while like your post, Canon specs say it's 4000x3000. Copy paste
So you definitely want
#define CAM_JPEG_WIDTH 4000
#define CAM_JPEG_HEIGHT 3000
You probably have to fix the active area to at least be larger than this.
I converted your "cr2" with
rawconvert -12to8 -w=4104 -h=3048 -pgm CRW_0469.CR2 CRW_0469.PGM
opening the resulting PGM in gimp, I'd say
left: 0
top: 10 (or 9)
right: 32
bottom: 8 (or 7)
The "or" would include rows that have some data that isn't at the same level as the rest of the image. I've gone back and forth over whether these should be included or not, but with just one row on top and bottom, I'd be inclined to leave it out.
In chdk defines, this would be:
#define CAM_ACTIVE_AREA_X1 0
#define CAM_ACTIVE_AREA_Y1 10
#define CAM_ACTIVE_AREA_X2 4072
#define CAM_ACTIVE_AREA_Y2 3040
If you can try a build with these settings and report back, we can fix them in svn.