The file size of a frame after LZW encoding could be reduced further by using so-called clear codes.
A clear code resets the LZW dictionary. Afterwards, the encoding is continued with a fresh LZW dictionary and the initial minimum code size.
As of now, cgif always issues a clear code once the dictionary is full (4096 entries). However, it can be beneficial regarding the file size to reset it earlier or later.
This is an optimization problem. We would need to find an adequate heuristic to find an approximate optimum here.
The file size of a frame after LZW encoding could be reduced further by using so-called clear codes.
A clear code resets the LZW dictionary. Afterwards, the encoding is continued with a fresh LZW dictionary and the initial minimum code size.
As of now, cgif always issues a clear code once the dictionary is full (4096 entries). However, it can be beneficial regarding the file size to reset it earlier or later.
This is an optimization problem. We would need to find an adequate heuristic to find an approximate optimum here.