Patch #467 » dcmjpeg_new.patch
| dcmjpeg/libijg16/jdhuff.c | ||
|---|---|---|
|
if (l > 16) {
|
||
|
WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
|
||
|
return 0; /* fake a zero as the safest result */
|
||
|
if (l == 17)
|
||
|
return 17; /* this is the result of the buggy Cornell encoder */
|
||
|
else
|
||
|
return 0; /* fake a zero as the safest result */
|
||
|
}
|
||
|
return htbl->pub->huffval[ (int) (code + htbl->valoffset[l]) ];
|
||
| dcmjpeg/libijg16/jdlhuff.c | ||
|---|---|---|
|
/* Section H.2.2: decode the sample difference */
|
||
|
HUFF_DECODE(s, br_state, dctbl, return mcu_num, label1);
|
||
|
if (s) {
|
||
|
#if 0
|
||
|
if (s == 16) /* special case: always output 32768 */
|
||
|
s = 32768;
|
||
|
else { /* normal case: fetch subsequent bits */
|
||
|
#endif
|
||
|
if (s >= 16) { /* special case: handle "famous" Cornell bug */
|
||
|
CHECK_BIT_BUFFER(br_state, 16, return mcu_num);
|
||
|
r = GET_BITS(16);
|
||
|
s = HUFF_EXTEND(r, 16);
|
||
|
if ((s & 0xffff) != 0x8000) { /* standard case: always output 32768 */
|
||
|
s = 32768;
|
||
|
DROP_BITS(16);
|
||
|
}
|
||
|
} else { /* normal case: fetch subsequent bits */
|
||
|
CHECK_BIT_BUFFER(br_state, s, return mcu_num);
|
||
|
r = GET_BITS(s);
|
||
|
s = HUFF_EXTEND(r, s);
|
||