# US 2009/0262841 A1 · Method and apparatus for scaling signals to prevent amplitude clipping

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

- Number: US 2009/0262841 A1
- Document ID: US20090262841A1
- Status: Published application
- Kind: A1
- Application number: 12/412,974
- Filed: 2009-03-27
- Published: 2009-10-22
- Earliest claimed: 2008-03-27
- Assignees: Analog Devices, Inc.
- Inventors: Mohammed Chalil
- Web page: https://patentgrep.com/patent/US20090262841A1

## CPC

- H03G 7/007: {of digital or coded signals}
- H03G 11/008: {of digital or coded signals}
- H03G: CONTROL OF AMPLIFICATION

## Abstract

Systems and methods for amplitude compressing a digital signal. An input signal is divided into frames having a first and second sets of samples. The samples in the second set are also in a subsequent frame. Peak values are determined for the first and second sets. One or more slopes are calculated based on the peak values. The slopes are used to define a scale factor which is applied to the first set to produce the output signal. For example, if the first peak value exceeds an amplitude threshold, first and last samples in the first set to exceed the amplitude threshold are found. Slopes are calculated for each of three regions of the first set demarcated by the first and last samples. In each region a slope is selected. These slopes along with an initial scale factor are used to calculate the scale factor.

## Claims

### Claim 1

A method of amplitude compressing a digital signal, the method comprising acts of:
(A) dividing the digital signal into a plurality of frames, each frame comprising a first set of samples and a second set of samples, wherein for each frame having a preceding frame among the plurality of frames, the first set of samples comprises the second set of samples from said preceding frame; and
(B) for each frame,
(i) determining a first peak value from among the first set of samples;
(ii) determining a second peak value from among the second set of samples;
(iii) computing, for each sample in the first set of samples, a respective scale factor based at least in part on the first peak value and the second peak value; and
(iv) scaling the respective amplitudes of each of the samples in the first set of samples.

### Claim 2 (depends on 1)

The method of claim 1, wherein:
the first peak value is a maximum absolute value among the first set of samples; and
the second peak value is a maximum absolute value among the second set of samples.

### Claim 3 (depends on 2)

The method of claim 2, wherein the first peak value exceeds an amplitude threshold and the first set of samples is indexed according to a reproduction order, the method further comprising:
determining a lowest index of a sample in the first set of samples to exceed the amplitude threshold;
determining a highest index of a sample in the first set of samples to exceed the amplitude threshold,
wherein the act (B)(iii) comprises,
determining a first slope of the scaling factor in a first region, the first region comprising samples in the first set of samples with an index less than the lowest index;
determining a second slope of the scaling factor in a second region, the second region comprising samples in the first set of samples with an index greater than the lowest index and less than the highest index;
determining a third slope of the scaling factor in a third region, the third region comprising samples in the first set of samples with an index greater than the highest index; and
determining, for each sample in the first set of samples, the respective scale factor based on an initial scale factor and at least one of the first, second and third slope, wherein the first, second and third slope are determined based at least in part on the first and second peak value.

### Claim 4 (depends on 3)

The method of claim 3, wherein for each frame among the plurality of frames having a preceding frame among the plurality of frames, the initial scale factor is the respective scale factor of a last sample in the first set of samples for said preceding frame.

### Claim 5 (depends on 3)

The method of claim 3, wherein the act (B)(iv) comprises, for each sample in the first set of samples, multiplying a value of the sample with the respective scale factor.

### Claim 6 (depends on 1)

The method of claim 1, wherein the act of scaling produces an output set of samples, each sample in the output set of samples having a magnitude no greater than an amplitude threshold.

### Claim 7 (depends on 1)

The method of claim 1, wherein:
the digital signal is a first digital audio signal and the acts (A), (B)(i), (B)(ii) and (B)(iii) are performed for a second digital audio to be reproduced synchronously with the first digital audio signal,
the respective scale factor computed in the act (B)(iii) is a first respective scale factor for samples from the first digital audio signal and a second respective scale factor for samples from the second digital audio signal, and
the act (B)(iv) comprises for each sample to be scaled from the first digital audio signal, identifying a corresponding sample from the second digital audio signal and applying a smaller of the first respective scale factor and the second respective scale factor to both the sample to be scaled from the first digital audio signal and the corresponding sample from the second digital audio signal.

### Claim 8 (depends on 1)

The method of claim 1, further comprising for each frame, after the act (B)(iv), reproducing the scaled first set of samples on an audio reproduction device.

### Claim 9 (depends on 1)

The method of claim 1, further comprising storing the first set of samples on a computer-storage medium.

### Claim 10

A computer-readable storage medium comprising computer executable instructions that, when executed, perform a method of amplitude compressing a digital signal, the method comprising acts of:
(A) identifying a frame of the digital signal, the frame comprising a first set of samples indexed according to a reproduction order;
(B) determining a first peak value of a peak sample among the first set of samples exceeds a threshold;
(C) determining a lowest index of a sample in the first set of samples that exceeds the threshold;
(D) determining a highest index of a sample in the first set of samples that exceeds the threshold; and
(E) scaling a respective amplitude of a plurality of samples having an index in the reproduction order between the lowest index and the highest index by at most a ratio of the threshold to the first peak value.

### Claim 11 (depends on 10)

The computer-readable storage medium of claim 10, wherein the plurality of samples comprises each sample in the first set of samples having an index in the reproduction order between the lowest index and the highest index.

### Claim 12 (depends on 11)

The computer-readable storage medium of claim 11, wherein the method further comprises acts of:
computing first scaling factors for samples in the first set of samples having an index in the reproduction order less than the lowest index, the scaling factors changing linearly between an initial value determined from a preceding frame and the ratio of the threshold to the first peak value; and
scaling the samples in the first set of samples having an index in the reproduction order less than the lowest index by the first scaling factors.

### Claim 13 (depends on 12)

The computer-readable storage medium of claim 12, wherein the frame further comprises a second set of samples, the method further comprises acts of:
determining a second peak value among the second set of samples;
computing second scaling factors for samples in the first set of samples having an index in the reproduction order greater than the highest index based at least in part on the second peak value; and
scaling the samples in the first set of samples having an index in the reproduction order greater than the highest index by the second scaling factors.

### Claim 14 (depends on 13)

The computer-readable storage medium of claim 13, wherein:
the first peak value is a maximum absolute value among the first set of samples, and
the second peak value is a maximum absolute value among the second set of samples.

### Claim 15 (depends on 13)

The computer-readable storage medium of claim 13, wherein the digital signal represents audio, and the method further comprises an act of, after the acts of scaling, outputting the first set of samples to an audio reproduction device.

### Claim 16 (depends on 10)

The computer-readable storage medium of claim 10, wherein a number of samples in the first set of samples is equal to an integer power of 2.

### Claim 17

A system for amplitude compressing a digital signal, the digital signal comprising a plurality of samples, the system comprising:
a frame identifying module to identify a plurality of frames, each frame comprising a sequence of samples among the plurality of samples, the sequence of samples comprising a first set of samples followed by a second set of samples;
a working buffer to store the sequence of samples for a current frame; and
a scaling module, to scale the first set of samples by a scale factor, the scale factor being a plurality of values, each value corresponding to a sample among the first set of samples, the scale factor determined at least in part by a first peak value among the first set of samples for the current frame and a second peak value among the second set of samples for the current frame.

### Claim 18 (depends on 17)

The system of claim 17, wherein the scaling module is configured to determine whether the first peak value is greater than a threshold and when the first peak value is greater than the threshold perform a method, the method comprising:
determining a lowest index of a sample in the first set of samples to exceed the threshold;
determining a highest index of a sample in the first set of samples to exceed the threshold;
determining a first slope of the scale factor in a first region, the first region comprising samples in the first set of samples with an index less than the lowest index;
determining a second slope of the scale factor in a second region, the second region comprising samples in the first set of samples with an index greater than the lowest index and less than the highest index;
determining a third slope of the scale factor in a third region, the third region comprising samples in the first set of samples with an index greater than the highest index;
calculating the scale factor based at least on an initial scale factor, the first slope, the second slope, and the third slope; and
applying the scale factor to the first set of samples to produce an output set of samples.

### Claim 19 (depends on 17)

The system of claim 17, wherein each sample among the output set of samples has a magnitude no greater than the threshold.

### Claim 20 (depends on 17)

The system of claim 17, wherein:
the initial scale factor is a scale factor applied to a last sample in the first set of samples for the preceding frame,
the first peak value is a maximum absolute value among the first set of samples, and
the first slope is determined to be a difference divided by the lowest index, the difference being between a ratio of the threshold to the first peak value, and the initial scale factor.
