Use jpegtopnm (from netpbm) instead of djpeg, it can handle RAW jpegs (whatever they are.)