Data compression apparatus for compressing an input data unit to produce an output data unit in accordance with a desired data quantity of the output data unit, the degree of compression being determined by a compression control variable having a range of possible values. A trial encoder compresses successive sections of the input data unit in accordance with a trial group of two or more values of the compression control variable. A data quantity detector detects the trial data quantities generated by each trial encoding of the sections of the input data unit and selects a base compression control variable applicable to the input data unit on the basis of the detected trial data quantities, in order to comply with the desired data quantity. An allocator allocates a compression control variable for use in final encoding each section of the input data unit to generate the output data unit, the allocator being comparable to determine whether to use the base compression control variable or another possible value of the compression control variable for the current section.
展开▼