# US 2021/0084339 A1 · Image Compression And Decompression Using Controlled Quality Loss

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0084339 A1
- Document ID: US20210084339A1
- Status: Published application
- Kind: A1
- Application number: 16/970,499
- Filed: 2019-02-15
- Published: 2021-03-18
- Earliest claimed: 2018-02-17
- Assignees: Google Inc.
- Applicants: Google LLC
- Inventors: Jyrki Alakuijala; Robert Obryk; Evgenii Kliuchnikov; Zoltan Szabadka; Jan Wassenberg; Minttu Alakuijala; Lode Vandevenne
- Web page: https://patentgrep.com/patent/US20210084339A1

## CPC

- H04N 19/65: using error resilience
- H04N 19/124: Quantisation
- H04N 19/15: by monitoring actual compressed data size at the memory before deciding storage at the transmission buffer
- H04N 19/154: Measured or subjectively estimated visual quality after decoding, e.g. measurement of distortion (use of rate-distortion criteria H04N19/147)
- H04N 19/162: User input
- H04N 19/176: the region being a block, e.g. a macroblock
- H04N 19/18: the unit being a set of transform coefficients
- H04N 19/184: the unit being bits, e.g. of the compressed video stream
- H04N 19/60: using transform coding
- H04N 19/85: using pre-processing or post-processing specially adapted for video compression
- H04N: PICTORIAL COMMUNICATION, e.g. TELEVISION

## Abstract

The loss of image quality during compression is controlled using a sequence of quality control metrics. The sequence of quality control metrics is selected for quantizing transform coefficients within an area of the image based on an error level definition. Candidate bit costs are then determined by quantizing the transform coefficients according to the error level definition or a modified error level and the sequence of quality control metrics. Where the candidate bit cost resulting from using the modified error level is lower than the candidate bit cost resulting from using the error level definition, the transform coefficients are quantized according to the modified error level and the sequence of quality control metrics. Otherwise, the transform coefficients are quantized based on the error level definition and according to the sequence of quality control metrics.

## Claims

### Claim 1

A method for compressing an image, the method comprising:
receiving an error level definition representing a maximum quantization error for compressing the image;
identifying transform coefficients to quantize within an area of the image;
selecting, based on the error level definition, a sequence of quality control metrics for controlling a quantization of the transform coefficients;
determining a first candidate bit cost by quantizing a first copy of the transform coefficients according to the error level definition and the sequence of quality control metrics;
determining a second candidate bit cost by quantizing a second copy of the transform coefficients according to a modified error level and the sequence of quality control metrics;
determining whether the second candidate bit cost is lower than the first candidate bit cost;
responsive to determining that the second candidate bit cost is lower than the first candidate bit cost, iteratively processing the transform coefficients according to the modified error level and the sequence of quality control metrics to produce quantized transform coefficients; and
producing a compressed image based on the quantized transform coefficients.

### Claim 2 (depends on 1)

The method of claim 1, wherein iteratively processing the transform coefficients according to the modified error level and the sequence of quality control metrics to produce the quantized transform coefficients comprises:
quantizing the transform coefficients using a first quality control metric of the sequence of quality control metrics, wherein quantizing the transform coefficients using the first quality control metric results in a quantization error;
determining that the quantization error exceeds a quality score calibration associated with the first quality control metric; and
responsive to determining that the quantization error exceeds the quality score calibration, further quantizing the transform coefficients using a second quality control metric of the sequence of quality control metrics.

### Claim 3 (depends on 1)

The method of claim 1, wherein the area of the image is a first area and the sequence of quality control metrics is a first sequence of quality control metrics, the method further comprising:
iteratively processing transform coefficients of a second area of the image using a second sequence of quality control metrics.

### Claim 4 (depends on 3)

The method of claim 3, wherein the modified error level is a first modified error level, wherein iteratively processing the transform coefficients of the second area of the image using the second sequence of quality control metrics comprises:
determining a candidate bit cost by quantizing the transform coefficients of the second area of the image according to a second modified error level and the second sequence of quality control metrics.

### Claim 5 (depends on 1)

The method of claim 1, wherein selecting the sequence of quality control metrics for controlling the quantization of the transform coefficients comprises:
querying a lookup table based on the error level definition.

### Claim 6 (depends on 5)

The method of claim 5, wherein the lookup table includes records associated with multiple quality control metrics, wherein selecting the sequence of quality control metrics for controlling the quantization of the transform coefficients comprises:
determining that a subset of the multiple quality control metrics is associated with error levels exceeding the error level definition; and
excluding one or more quality control metrics of the subset of the multiple quality control metrics from the sequence of quality control metrics.

### Claim 7 (depends on 1)

The method of any of claim 1, further comprising:
responsive to determining that the second bit cost is not lower than the first bit cost, iteratively processing the transform coefficients according to the error level definition and the sequence of quality control metrics to produce the quantized transform coefficients.

### Claim 8 (depends on 1)

The method of claim 1, wherein a quantization error represented by the modified error level is larger than the maximum quantization error.

### Claim 9

An apparatus for compressing an image, the apparatus comprising:
a memory; and
a processor, wherein the processor is configured to execute instructions stored in the memory to:
receive an error level definition representing a maximum quantization error for compressing the image;
select, based on the error level definition, a sequence of quality control metrics for controlling a quantization of transform coefficients of the image;
compress the image according to the error level definition and the sequence of quality control metrics, wherein the instructions to compress the image according to the error level definition and the sequence of quality control metrics include instructions to:
quantize the transform coefficients using a first quality control metric of the sequence of quality control metrics;
determine that a quantization error resulting from quantizing the transform coefficients using the first quality control metric exceeds a quality score calibration associated with the first quality control metric;
responsive to a determination that the quantization error exceeds the quality score calibration, further quantize the transform coefficients using a second quality control metric of the sequence of quality control metrics to produce quantized transform coefficients; and
produce a compressed image based on the quantized transform coefficients; and
output the compressed image for storage or display.

### Claim 10 (depends on 9)

The apparatus of claim 9, wherein the instructions include instructions to:
determine a first candidate bit cost by quantizing a first copy of the transform coefficients according to the error level definition and the sequence of quality control metrics;
determine a second candidate bit cost by quantizing a second copy of the transform coefficients according to a modified error level and the sequence of quality control metrics; and
determine, based on the first candidate bit and the second candidate bit cost, to compress the image according to one of the error level definition or the modified error level.

### Claim 11 (depends on 10)

The apparatus of claim 10, wherein the instructions to determine to compress the image according to one of the error level definition or the modified error level include instructions to determine whether the second candidate bit cost is lower than the first candidate bit cost, and wherein the instructions include instructions to:
responsive to a determination that the second candidate bit cost is lower than the first candidate bit cost, compress the image according to the modified error level and the sequence of quality control metrics, and
responsive to a determination that the second candidate bit cost is not lower than the first candidate bit cost, compress the image according to the error level definition and the sequence of quality control metrics.

### Claim 12 (depends on 11)

The apparatus of claim 11, wherein the quantized transform coefficients are first quantized transform coefficients and the quantization error is a first quantization error, wherein the modified error level corresponds to an area of the image, wherein the instructions to compress the image according to the modified error level and the sequence of quality control metrics include instructions to:
quantize a subset of the transform coefficients using the first quality control metric of the sequence of quality control metrics, wherein the subset of the transform coefficients is located within an area of the image;
determine that a second quantization error resulting from quantizing the subset of the transform coefficients using the first quality control metric exceeds the quality score calibration associated with the first quality control metric;
responsive to a determination that the second quantization error exceeds the quality score calibration, further quantize the transform coefficients using the second quality control metric of the sequence of quality control metrics to produce second quantized transform coefficients; and
produce a compressed image based on the second quantized transform coefficients.

### Claim 13 (depends on 12)

The apparatus of claim 12, wherein a quantization error represented by the modified error level is larger than the maximum quantization error.

### Claim 14 (depends on 10)

The apparatus of claim 10, wherein the modified error level is a first modified error level, wherein the second copy of the transform coefficients corresponds to a first subset of the transform coefficients located within a first area of the image, wherein the instructions include instructions to:
determine a third candidate bit cost by quantizing a second subset of the transform coefficients located within a second area of the image according to a second modified error level and the sequence of quality control metrics,
wherein the instructions to compress the image according to the error level definition and the sequence of quality control metrics include instructions to:
compress the first subset of the transform coefficients according to the first modified error level; and
compress the second subset of the transform coefficients according to the second modified error level.

### Claim 15 (depends on 9)

The apparatus of claim 9, wherein the instructions to select the sequence of quality control metrics for controlling the quantization of the transform coefficients of the image include instructions to:
determine that a subset of quality control metrics available for compressing the image is associated with error levels exceeding the error level definition; and
exclude one or more quality control metrics of the subset of the quality control metrics from the sequence of quality control metrics.

### Claim 16

A non-transitory computer-readable storage medium, comprising processor-executable routines that, when executed by a processor, facilitate a performance of operations for compressing an image, the operations comprising:
selecting a sequence of quality control metrics for controlling a quantization of transform coefficients of the image;
iteratively processing a first subset of the transform coefficients located within a first area of the image according to an error level definition and the sequence of quality control metrics to produce first quantized transform coefficients;
iteratively processing a second subset of the transform coefficients located within a second area of the image according to a modified error level and the sequence of quality control metrics to produce second quantized transform coefficients; and
producing a compressed image based on the first quantized transform coefficients and the second quantized transform coefficients.

### Claim 17 (depends on 16)

The non-transitory computer-readable storage medium of claim 16, wherein the sequence of quality control metrics defines an order for applying one or more quality control metrics to iteratively quantize some or all of the transform coefficients of the image.

### Claim 18 (depends on 16)

The non-transitory computer-readable storage medium of claim 16, wherein the error level definition represents a maximum error level for compressing the image, wherein the operations for selecting the sequence of quality control metrics for controlling the quantization of the transform coefficients of the image comprise:
determining that a subset of quality control metrics available for compressing the image is associated with error levels exceeding the error level definition; and
excluding one or more quality control metrics of the subset of the quality control metrics from the sequence of quality control metrics.

### Claim 19 (depends on 16)

The non-transitory computer-readable storage medium of claim 16, wherein the operations for iteratively processing the first subset of the transform coefficients located within the first area of the image according to the error level definition and the sequence of quality control metrics to produce the first quantized transform coefficients comprise:
quantizing the first subset of the transform coefficients using a first quality control metric of the sequence of quality control metrics, wherein quantizing the first subset of the transform coefficients using the first quality control metric results in a quantization error;
determining that the quantization error exceeds a quality score calibration associated with the first quality control metric; and
responsive to determining that the quantization error exceeds the quality score calibration, further quantizing the first subset of the transform coefficients using a second quality control metric of the sequence of quality control metrics.

### Claim 20 (depends on 16)

The non-transitory computer-readable storage medium of claim 16, wherein the operations for iteratively processing the first subset of the transform coefficients located within the first area of the image according to the error level definition and the sequence of quality control metrics to produce the first quantized transform coefficients comprise:
iteratively processing the second subset of the transform coefficients located within the second area of the image according to the error level definition and the sequence of quality control metrics to produce third quantized transform coefficients;
determining whether a bit cost for the second quantized transform coefficients is lower than a bit cost for the third quantized coefficients; and
responsive to determining that the bit cost for the second quantized transform coefficients is not lower than the bit cost for the third quantized coefficients, using the third quantized coefficients to produce the compressed image instead of the second quantized coefficients.
