Lines Matching refs:sd

97 static int LWZReadByte (gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, int *Zero…
428 LWZReadByte_(gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, int *ZeroDataBlockP) in LWZReadByte_() argument
433 sd->set_code_size = input_code_size; in LWZReadByte_()
434 sd->code_size = sd->set_code_size+1; in LWZReadByte_()
435 sd->clear_code = 1 << sd->set_code_size ; in LWZReadByte_()
436 sd->end_code = sd->clear_code + 1; in LWZReadByte_()
437 sd->max_code_size = 2*sd->clear_code; in LWZReadByte_()
438 sd->max_code = sd->clear_code+2; in LWZReadByte_()
440 GetCode(fd, &sd->scd, 0, TRUE, ZeroDataBlockP); in LWZReadByte_()
442 sd->fresh = TRUE; in LWZReadByte_()
444 for (i = 0; i < sd->clear_code; ++i) { in LWZReadByte_()
445 sd->table[0][i] = 0; in LWZReadByte_()
446 sd->table[1][i] = i; in LWZReadByte_()
449 sd->table[0][i] = sd->table[1][0] = 0; in LWZReadByte_()
451 sd->sp = sd->stack; in LWZReadByte_()
454 } else if (sd->fresh) { in LWZReadByte_()
455 sd->fresh = FALSE; in LWZReadByte_()
457 sd->firstcode = sd->oldcode = in LWZReadByte_()
458 GetCode(fd, &sd->scd, sd->code_size, FALSE, ZeroDataBlockP); in LWZReadByte_()
459 } while (sd->firstcode == sd->clear_code); in LWZReadByte_()
460 return sd->firstcode; in LWZReadByte_()
463 if (sd->sp > sd->stack) in LWZReadByte_()
464 return *--sd->sp; in LWZReadByte_()
466 while ((code = GetCode(fd, &sd->scd, sd->code_size, FALSE, ZeroDataBlockP)) >= 0) { in LWZReadByte_()
467 if (code == sd->clear_code) { in LWZReadByte_()
468 for (i = 0; i < sd->clear_code; ++i) { in LWZReadByte_()
469 sd->table[0][i] = 0; in LWZReadByte_()
470 sd->table[1][i] = i; in LWZReadByte_()
473 sd->table[0][i] = sd->table[1][i] = 0; in LWZReadByte_()
474 sd->code_size = sd->set_code_size+1; in LWZReadByte_()
475 sd->max_code_size = 2*sd->clear_code; in LWZReadByte_()
476 sd->max_code = sd->clear_code+2; in LWZReadByte_()
477 sd->sp = sd->stack; in LWZReadByte_()
478 sd->firstcode = sd->oldcode = in LWZReadByte_()
479 GetCode(fd, &sd->scd, sd->code_size, FALSE, ZeroDataBlockP); in LWZReadByte_()
480 return sd->firstcode; in LWZReadByte_()
481 } else if (code == sd->end_code) { in LWZReadByte_()
497 if (sd->sp == (sd->stack + STACK_SIZE)) { in LWZReadByte_()
502 if (code >= sd->max_code) { in LWZReadByte_()
503 *sd->sp++ = sd->firstcode; in LWZReadByte_()
504 code = sd->oldcode; in LWZReadByte_()
507 while (code >= sd->clear_code) { in LWZReadByte_()
508 if (sd->sp == (sd->stack + STACK_SIZE)) { in LWZReadByte_()
512 *sd->sp++ = sd->table[1][code]; in LWZReadByte_()
513 if (code == sd->table[0][code]) { in LWZReadByte_()
516 code = sd->table[0][code]; in LWZReadByte_()
519 *sd->sp++ = sd->firstcode = sd->table[1][code]; in LWZReadByte_()
521 if ((code = sd->max_code) <(1<<MAX_LWZ_BITS)) { in LWZReadByte_()
522 sd->table[0][code] = sd->oldcode; in LWZReadByte_()
523 sd->table[1][code] = sd->firstcode; in LWZReadByte_()
524 ++sd->max_code; in LWZReadByte_()
525 if ((sd->max_code >= sd->max_code_size) && in LWZReadByte_()
526 (sd->max_code_size < (1<<MAX_LWZ_BITS))) { in LWZReadByte_()
527 sd->max_code_size *= 2; in LWZReadByte_()
528 ++sd->code_size; in LWZReadByte_()
532 sd->oldcode = incode; in LWZReadByte_()
534 if (sd->sp > sd->stack) in LWZReadByte_()
535 return *--sd->sp; in LWZReadByte_()
542 LWZReadByte(gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, int *ZeroDataBlockP) in LWZReadByte() argument
546 rv = LWZReadByte_(fd, sd, flag, input_code_size, ZeroDataBlockP); in LWZReadByte()
559 LZW_STATIC_DATA sd; in ReadImage() local
582 if (LWZReadByte(fd, &sd, TRUE, c, ZeroDataBlockP) < 0) { in ReadImage()
596 while ((v = LWZReadByte(fd, &sd, FALSE, c, ZeroDataBlockP)) >= 0) { in ReadImage()
641 if (LWZReadByte(fd, &sd, FALSE, c, ZeroDataBlockP) >=0) { in ReadImage()