24 #include <libopenraw/consts.h> 33 using namespace Debug;
35 Unpack::Unpack(uint32_t w, uint32_t t)
41 size_t Unpack::block_size()
44 if(m_type == IFD::COMPRESS_NIKON_PACK) {
45 bs = (m_w / 2 * 3) + (m_w / 10);
58 or_error Unpack::unpack_be12to16(uint8_t *dest,
size_t destsize,
const uint8_t *src,
59 size_t size,
size_t & out)
61 or_error err = OR_ERROR_NONE;
62 uint16_t *dest16 =
reinterpret_cast<uint16_t *
>(dest);
63 size_t pad = (m_type == IFD::COMPRESS_NIKON_PACK) ? 1 : 0;
64 size_t n = size / (15 + pad);
65 size_t rest = size % (15 + pad);
66 size_t ret = n * 20 + rest / 3 * 4;
71 assert (size % 16 == 0);
73 assert (rest % 3 == 0);
75 for (
size_t i = 0; i < n + 1; i++) {
76 size_t m = (i == n) ? rest / 3 : 5;
77 if((reinterpret_cast<uint8_t *>(dest16) - dest) + (m * 4) > destsize) {
78 err = OR_ERROR_DECOMPRESSION;
79 LOGERR(
"overflow !\n");
82 for(
size_t j = 0; j < m; j++) {
91 *dest16 = (t & (0xfff << 12)) >> 12;
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard. I guess it failed.