lzw_decoder_new (guint8 code_size)
{
        LZWDecoder *self;
        int i;

        self = g_object_new (lzw_decoder_get_type (), NULL);

        self->min_code_size = code_size;
        self->code_size = code_size;

        /* Add special clear and end of information codes */
        self->clear_code = 1 << (code_size - 1);
        self->eoi_code = self->clear_code + 1;

        for (i = 0; i <= self->eoi_code; i++) {
                self->code_table[i].index = i;
                self->code_table[i].extends = self->eoi_code;
                self->code_table_size++;
        }

        /* Start with an empty codeword following an implicit clear codeword */
        self->code = 0;
        self->last_code = self->clear_code;

        return self;
}
lzw_decoder_new (guint8 code_size)
{
        LZWDecoder *self;
        int i;

        self = g_object_new (lzw_decoder_get_type (), NULL);

        self->min_code_size = code_size;
        self->code_size = code_size;

         
        self->clear_code = 1 << (code_size - 1);
        self->eoi_code = self->clear_code + 1;

        for (i = 0; i <= self->eoi_code; i++) {
                self->code_table[i].index = i;
                self->code_table[i].extends = self->eoi_code;
                self->code_table_size++;
        }

         
        self->code = 0;
        self->last_code = self->clear_code;

        return self;
}