An image-compression system provides for high-quality guaranteed-fit image block-by-block
compression in a single pass. A baseline block-target allocator determines a baseline
target size for the compressed blocks resulting from the source-image blocks. A
block target-size accumulator determines a target block size by adding any excess
compression from the preceding block to the baseline, as indicated by a compressed-block
size reader. A mode selector performs a content analysis of the current block.
It then selects among the compression modes guaranteed to meet the target block
size one that achieves optimal image quality. A compression encoder compresses
the current block according to the selected compression mode.