1
/*************************
2
* libdicom by Tony Voet *
3
*************************/
5
* $Id: bit.c,v 1.1 2002/10/14 22:03:47 enlf Exp $
28
void dicom_bit(void *data)
30
dicom_log(DEBUG,"dicom_bit()");
40
void dicom_8_skip(int bit)
66
void dicom_16_skip(int bit)
80
cache16=*source.u16++;
92
void dicom_32_skip(int bit)
106
cache32=*source.u32++;
118
U32 dicom_8_read(int bit)
127
result=cache8>>(8-bit);
133
result=cache8>>(8-left);
143
result|=dicom_8_read(bit);
153
U32 dicom_16_read(int bit)
162
result=cache16>>(16-bit);
168
result=cache16>>(16-left);
171
cache16=*source.u16++;
178
result|=dicom_16_read(bit);
188
U32 dicom_32_read(int bit)
197
result=cache32>>(32-bit);
203
result=cache32>>(32-left);
206
cache32=*source.u32++;
213
result|=dicom_32_read(bit);
219
/* eNlf: BEGIN - support for 12bit unpacking */
224
/* 2 pix 12bit = [0xABCDEF] */
225
/* 2 pix 16bit = [0x0ABD] + [0x0FCE] */
226
U16 mdc_dicom_12_unpack(int pix)
231
case 1: /* ABD-part (1st pix) */
234
result = ((b0 >> 4) << 8) + ((b0 & 0x0f) << 4) + (b1 & 0x0f);
235
/* A */ /* B */ /* D */
237
case 2: /* FCE-part (2nd pix) */
240
result = ((b2 & 0x0f) << 8) + ((b1 >> 4) << 4) + (b2 >> 4);
241
/* F */ /* C */ /* E */
249
/* eNlf: END - support for 12 bits unpacking */