so, if im going to read it in C, should i block them as 10-bits? 12 bits or 16-bits?
R G R G R GG B G B G BR G R G R GG B G B G B
R(0,0)G(0,1)R(0,2)G(0,3)...G(0,c-1)G(1,0)B(1,1)G(1,2)B(1,3)...B(1,c-1)R(2,0),G(2,1),R(2,2)...B(r-1,c-1)
// returns color of pixelconst int pattern = 0x94949494;inline int FC(unsigned int row, unsigned int col){ return (pattern >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3);}inline unsigned short swap_bytes_uint16(unsigned short src){ unsigned char upper = ((src & 0xff00) >> 8); unsigned char lower = (src & 0x00ff); return ((lower << 8) | upper);} unsigned char data_bytes[number_of_bytes]; unsigned short data_pixs[number_of_pixels]; const unsigned short* dp = data_bytes; for(j = 0; j < number_of_pixels; j++) { #if qDNGBigEndian // target platform endianness (0 for intel/x86, 1 for macos, ?? for arm) if (vbits < 10) buf = (vbits += 16, (buf << 16) + swap_bytes_uint16(*dp++)); #else if (vbits < 10) buf = (vbits += 16, (buf << 16) + *dp++); #endif data_pixs[j] = buf >> (vbits -= 10) & 0x3ff; }
now i got a new problem. it seems (to me) that crw is written in utf-16. is it possible to convert it to integer values?
row[i+0]+=((0x3fc&(((unsigned short)rawrow[src+1])<<2)) | (rawrow[src+0] >> 6)); row[i+1]+=((0x3f0&(((unsigned short)rawrow[src+0])<<4)) | (rawrow[src+3] >> 4)); row[i+2]+=((0x3c0&(((unsigned short)rawrow[src+3])<<6)) | (rawrow[src+2] >> 2)); row[i+3]+=((0x300&(((unsigned short)rawrow[src+2])<<8)) | (rawrow[src+5])); row[i+4]+=((0x3fc&(((unsigned short)rawrow[src+4])<<2)) | (rawrow[src+7] >> 6)); row[i+5]+=((0x3f0&(((unsigned short)rawrow[src+7])<<4)) | (rawrow[src+6] >> 4)); row[i+6]+=((0x3c0&(((unsigned short)rawrow[src+6])<<6)) | (rawrow[src+9] >> 2)); row[i+7]+=((0x300&(((unsigned short)rawrow[src+9])<<8)) | (rawrow[src+8]));
Started by LukeSkaff RAW Shooting and Processing
Started by SvobodaT RAW Shooting and Processing
Started by carl1864 General Help and Assistance on using CHDK stable releases
Started by neronix General Help and Assistance on using CHDK stable releases
Started by sf RAW Shooting and Processing