# US 2010/0138225 A1 · Optimization of mp3 encoding with complete decoder compatibility

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

- Number: US 2010/0138225 A1
- Document ID: US20100138225A1
- Status: Published application
- Kind: A1
- Application number: 12/325,409
- Filed: 2008-12-01
- Published: 2010-06-03
- Earliest claimed: 2008-12-01
- Assignees: Research In Motion Limited
- Inventors: Guixing Wu; En-hui Yang
- Web page: https://patentgrep.com/patent/US20100138225A1

## CPC

- G10L 19/032: Quantisation or dequantisation of spectral components
- G10L: SPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING

## Abstract

An iterative rate-distortion optimization algorithm for MPEG I/II Layer-3 (MP3) encoding based on the method of Lagrangian multipliers. Generally, an iterative method is performed such that a global quantization step size is determined while scale factors are fixed, and thereafter the scale factors are determined while the global quantization step size is fixed. This is repeated until a calculated rate-distortion cost is within a predetermined threshold. The methods are demonstrated to be computationally efficient and the resulting bit stream is fully standard compatible.

## Claims

### Claim 1

A method for optimizing audio encoding of a source sequence, the encoding being dependent on quantization factors, the quantization factors including a global quantization step size and scale factors, the method comprising:
defining a cost function of the encoding of the source sequence, the cost function being dependent on the quantization factors;
initializing fixed values of the scale factors; and
determining values of the quantization factors which minimize the cost function by iteratively performing:
determining, for the fixed values of the scale factors, a value of the global quantization step size which minimizes the cost function,
fixing the determined value of the global quantization step size and determining values of scale factors which minimize the cost function, and fixing the determined values of the scale factors, and
determining whether the cost function is below a predetermined threshold, and if so ending the iteratively performing.

### Claim 2 (depends on 1)

The method claimed in claim 1, wherein the cost function is based on a distortion of the encoding of the source sequence.

### Claim 3 (depends on 2)

The method claimed in claim 2, wherein the cost function is further based on a rate, said rate being a transmission bit rate of the encoding of the source sequence.

### Claim 4 (depends on 3)

The method claimed in claim 3, wherein the cost function is further based on a tradeoff function that represents a tradeoff of the rate for distortion.

### Claim 5 (depends on 4)

The method claimed in claim 4, wherein, in the step of fixing the determined value of the global quantization step size and determining values of scale factors which minimize the cost function, the distortion is obtained from a pre-generated table.

### Claim 6 (depends on 4)

The method claimed in claim 4, wherein the tradeoff function includes λ, the method further comprising:
calculating λ as:
λ
final
R
=
c
1

ln


10
10


M
×
10
(
c
2

PE
-
c
3

R
)
/
M
,
wherein PE is Perceptual Entropy of an encoded frame, R is the rate, M is a number of audio samples to be encoded, and c1, c2 and c3 are constants; and
calculating the cost function using λ.

### Claim 7 (depends on 1)

The method claimed in claim 1, wherein the step of determining the value of the global quantization step size includes differentially calculating the cost function with respect to global quantization step size to determine the global quantization step size which minimizes the cost function.

### Claim 8 (depends on 1)

The method claimed in claim 1, wherein the determining of the value of global quantization step size includes calculating:
4
log
10

2

log
10

∑
sb
=
1
N

b

[
sb
]
∑
sb
=
1
N

a

[
sb
]
+
210
wherein
b

[
sb
]
=
2
-
scale_factor

[
sb
]
/
4
·
w

[
sb
]
·
∑
i
=
l

[
sb
]
l

[
sb
+
1
]
-
1

xr
i
·
y
i
4
/
3
and
a

[
sb
]
=
2
-
scale_factor

[
sb
]
/
2
·
w

[
sb
]
·
∑
i
=
l

[
sb
]
l

[
sb
+
1
]
-
1

y
i
4
/
3
wherein xri is the source sequence, scale_factor[sb] is a quantization step size for scale factor band sb, l[sb] and l[sb+1]−1 are start and end positions for scale factor band sb respectively, w[sb] is an inverse of the masking threshold for scale factor band sb, and yi is a quantized spectral coefficient of the source sequence.

### Claim 9 (depends on 1)

The method claimed in claim 1, further comprising constraining the scale factors to within a bit length.

### Claim 10 (depends on 9)

The method claimed in claim 9, wherein the bit length is a first bit length for a first group of scale factor bands and the bit length is a second bit length for a second group of scale factor bands.

### Claim 11 (depends on 1)

The method claimed in claim 1, wherein the scale factors include a parameter scalefac being a scale factor for a particular scale factor band, the method further comprising constraining scalefac to within a bit length.

### Claim 12 (depends on 11)

The method claimed in claim 11, wherein the bit length is a first bit length for a first group of scale factor bands and the bit length is a second bit length for a second group of scale factor bands.

### Claim 13 (depends on 1)

The method claimed in claim 1, wherein the scale factors include a parameter scalefac being a scale factor for a particular scale factor band, the method further comprising:
calculating a value of scalefac which minimizes the cost function; and
determining whether the calculated value of scalefac exceeds encoding within a bit length, and if so constraining scalefac to within the bit length.

### Claim 14 (depends on 13)

The method claimed in claim 13, wherein the step of calculating the value of scalefac includes differentially calculating the cost function with respect to scalefac to determine the value of scalefac which minimizes the cost function.

### Claim 15 (depends on 13)

The method claimed in claim 13, wherein the step of calculating the value of scalefac includes calculating:
4
log
10

2

log
10

∑
i
=
l

[
sb
]
l

[
sb
+
1
]
-
1

xr
i
·
y
i
4
/
3
∑
i
=
l

[
sb
]
l

[
sb
+
1
]
-
1

y
i
8
/
3
wherein xr is the source sequence, l[sb] and l[sb+1]−1 are start and end positions for scale factor band sb respectively and yi is a quantized spectral coefficient of the source sequence.

### Claim 16 (depends on 13)

The method claimed in claim 13, further comprising:
calculating the cost function for scalefac=0 for a scale factor band; and
storing in a memory the calculated cost function for scalefac=0 for subsequent retrieval.

### Claim 17 (depends on 1)

The method claimed in claim 1, wherein the scale factors include a high frequency amplification parameter.

### Claim 18 (depends on 1)

The method claimed in claim 1, wherein the audio encoding is MPEG I/II Layer-3 encoding.

### Claim 19 (depends on 1)

The method claimed in claim 1, wherein the encoding is further dependent on quantized spectral coefficients, Huffman codebooks, and Huffman coding region partition, the method further including minimizing the cost function with respect to the quantized spectral coefficients, the Huffman codebooks, and the Huffman coding region partition.

### Claim 20

An encoder for optimizing audio encoding of a source sequence, the audio encoding being dependent on quantization factors, the quantization factors including a global quantization step size and scale factors, the encoder comprising:
a controller;
a memory accessible by the controller, a cost function of the encoding of the source sequence stored in memory, the cost function being dependent on the quantization factors; and
a predetermined threshold of the cost function stored in the memory,
wherein the controller is configured to:
access the cost function and predetermined threshold from memory,
initialize fixed values of the scale factors, and
determine values of the quantization factors which minimize the cost function by iteratively performing:
determining, for the fixed values of the scale factors, a value of the global quantization step size which minimizes the cost function,
fixing the determined value of the global quantization step size and determining values of scale factors which minimize the cost function, and fixing the determined values of the scale factors, and
determining whether the cost function is below the predetermined threshold, and if so ending the iteratively performing.
