Lines Matching refs:sd
98 static int LWZReadByte (gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, int *Zero…
432 LWZReadByte_(gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, int *ZeroDataBlockP) in LWZReadByte_() argument
437 sd->set_code_size = input_code_size; in LWZReadByte_()
438 sd->code_size = sd->set_code_size+1; in LWZReadByte_()
439 sd->clear_code = 1 << sd->set_code_size ; in LWZReadByte_()
440 sd->end_code = sd->clear_code + 1; in LWZReadByte_()
441 sd->max_code_size = 2*sd->clear_code; in LWZReadByte_()
442 sd->max_code = sd->clear_code+2; in LWZReadByte_()
444 GetCode(fd, &sd->scd, 0, TRUE, ZeroDataBlockP); in LWZReadByte_()
446 sd->fresh = TRUE; in LWZReadByte_()
448 for (i = 0; i < sd->clear_code; ++i) { in LWZReadByte_()
449 sd->table[0][i] = 0; in LWZReadByte_()
450 sd->table[1][i] = i; in LWZReadByte_()
453 sd->table[0][i] = sd->table[1][0] = 0; in LWZReadByte_()
455 sd->sp = sd->stack; in LWZReadByte_()
458 } else if (sd->fresh) { in LWZReadByte_()
459 sd->fresh = FALSE; in LWZReadByte_()
461 sd->firstcode = sd->oldcode = in LWZReadByte_()
462 GetCode(fd, &sd->scd, sd->code_size, FALSE, ZeroDataBlockP); in LWZReadByte_()
463 } while (sd->firstcode == sd->clear_code); in LWZReadByte_()
464 return sd->firstcode; in LWZReadByte_()
467 if (sd->sp > sd->stack) in LWZReadByte_()
468 return *--sd->sp; in LWZReadByte_()
470 while ((code = GetCode(fd, &sd->scd, sd->code_size, FALSE, ZeroDataBlockP)) >= 0) { in LWZReadByte_()
471 if (code == sd->clear_code) { in LWZReadByte_()
472 for (i = 0; i < sd->clear_code; ++i) { in LWZReadByte_()
473 sd->table[0][i] = 0; in LWZReadByte_()
474 sd->table[1][i] = i; in LWZReadByte_()
477 sd->table[0][i] = sd->table[1][i] = 0; in LWZReadByte_()
478 sd->code_size = sd->set_code_size+1; in LWZReadByte_()
479 sd->max_code_size = 2*sd->clear_code; in LWZReadByte_()
480 sd->max_code = sd->clear_code+2; in LWZReadByte_()
481 sd->sp = sd->stack; in LWZReadByte_()
482 sd->firstcode = sd->oldcode = in LWZReadByte_()
483 GetCode(fd, &sd->scd, sd->code_size, FALSE, ZeroDataBlockP); in LWZReadByte_()
484 return sd->firstcode; in LWZReadByte_()
485 } else if (code == sd->end_code) { in LWZReadByte_()
501 if (sd->sp == (sd->stack + STACK_SIZE)) { in LWZReadByte_()
506 if (code >= sd->max_code) { in LWZReadByte_()
507 *sd->sp++ = sd->firstcode; in LWZReadByte_()
508 code = sd->oldcode; in LWZReadByte_()
511 while (code >= sd->clear_code) { in LWZReadByte_()
512 if (sd->sp == (sd->stack + STACK_SIZE)) { in LWZReadByte_()
516 *sd->sp++ = sd->table[1][code]; in LWZReadByte_()
517 if (code == sd->table[0][code]) { in LWZReadByte_()
520 code = sd->table[0][code]; in LWZReadByte_()
523 *sd->sp++ = sd->firstcode = sd->table[1][code]; in LWZReadByte_()
525 if ((code = sd->max_code) <(1<<MAX_LWZ_BITS)) { in LWZReadByte_()
526 sd->table[0][code] = sd->oldcode; in LWZReadByte_()
527 sd->table[1][code] = sd->firstcode; in LWZReadByte_()
528 ++sd->max_code; in LWZReadByte_()
529 if ((sd->max_code >= sd->max_code_size) && in LWZReadByte_()
530 (sd->max_code_size < (1<<MAX_LWZ_BITS))) { in LWZReadByte_()
531 sd->max_code_size *= 2; in LWZReadByte_()
532 ++sd->code_size; in LWZReadByte_()
536 sd->oldcode = incode; in LWZReadByte_()
538 if (sd->sp > sd->stack) in LWZReadByte_()
539 return *--sd->sp; in LWZReadByte_()
546 LWZReadByte(gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, int *ZeroDataBlockP) in LWZReadByte() argument
550 rv = LWZReadByte_(fd, sd, flag, input_code_size, ZeroDataBlockP); in LWZReadByte()
563 LZW_STATIC_DATA sd; in ReadImage() local
586 if (LWZReadByte(fd, &sd, TRUE, c, ZeroDataBlockP) < 0) { in ReadImage()
600 while ((v = LWZReadByte(fd, &sd, FALSE, c, ZeroDataBlockP)) >= 0) { in ReadImage()
645 if (LWZReadByte(fd, &sd, FALSE, c, ZeroDataBlockP) >=0) { in ReadImage()