# US 2008/0304563 A1 · Hybrid Rate Control in a Digital Stream Transcoder

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

- Number: US 2008/0304563 A1
- Document ID: US20080304563A1
- Status: Published application
- Kind: A1
- Application number: 11/927,759
- Filed: 2007-10-30
- Published: 2008-12-11
- Earliest claimed: 2002-03-27
- Assignees: Scientific-Atlanta, Inc.
- Inventors: Joel W. Schoenblum
- Web page: https://patentgrep.com/patent/US20080304563A1

## CPC

- H04N 19/90: using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
- H04N 19/115: Selection of the code volume for a coding unit prior to coding
- H04N 19/124: Quantisation
- H04N 19/147: according to rate distortion criteria (rate-distortion as a criterion for motion estimation H04N19/567)
- H04N 19/157: Assigned coding mode, i.e. the coding mode being predefined or preselected to be further used for selection of another element or parameter
- H04N 19/172: the region being a picture, frame or field
- H04N 19/174: the region being a slice, e.g. a line of blocks or a group of blocks
- H04N 19/40: using video transcoding, i.e. partial or full decoding of a coded input stream followed by re-encoding of the decoded output stream
- H04N 19/48: using compressed domain processing techniques other than decoding, e.g. modification of transform coefficients, variable length coding [VLC] data or run-length data (motion estimation in a transform domain H04N19/547; processing of decoded motion vectors H04N19/513)
- H04N 19/51: Motion estimation or motion compensation
- H04N 19/547: Motion estimation performed in a transform domain
- H04N 19/61: in combination with predictive coding
- H04N 19/91: Entropy coding, e.g. variable length coding [VLC] or arithmetic coding
- H04N: PICTORIAL COMMUNICATION, e.g. TELEVISION

## Abstract

A rate controller in run-level domain transcoder, which receives a stream of compressed frames carried in a bit stream, selectively determines whether to quantize and/or threshold portions of a frame carried in the stream of frames. The rate controller determines the input size of the frame and based at least in part upon at least a desired size, requantizes and/or thresholds the frame such that the output size of the frame is approximately the desired size.

## Claims

### Claim 1

An apparatus comprising:
a processor adapted to
receive a quantized frame;
determine the number of bits to shave from a given portion of the quantized frame (NSHAVE);
determine for the given portion an initial content size (SINT), which is defined as the number of bits representing the given portion when initial content information of the given portion of the quantized frame is compressed;
determine a reduction threshold (RT), wherein the reduction threshold is given as RT=NSHAVE/SINT;
determine whether to requantize the given portion of the quantized frame based at least in part upon the reduction threshold; and
responsive to determining to requantize the given portion of the quantized frame, requantize in the run-level domain the given portion of the quantized frame.

### Claim 2 (depends on 1)

The apparatus of claim 1, wherein the received quantized frame is made up of multiple blocks arranged in a sequence, and each block is represented by at least one set of run-level pairs, and the given portion of the quantized frame is represented by the at least one set of run-level pairs.

### Claim 3 (depends on 2)

The apparatus of claim 2, wherein the given portion of the quantized frame is a slice of the quantized frame, and the at least one set of run-level pairs representing a block of the slice is processed in parallel.

### Claim 4

The apparatus of claim, 1 wherein the processor is further adapted to determine a total content size (CT) of the quantized frame, wherein the total content size (CT) is defined as the number of bits of the initial content information when the initial content information is compressed, and wherein the number of bits to shave (NSHAVE) from the given portion is related to the product of the initial content size (SINT) times the quotient of number of bits to shave (NS) from the quantized frame divided by the total content size (CT) of the quantized frame.

### Claim 5 (depends on 4)

The apparatus of claim 4, wherein the processor is further adapted to:
parse the quantized frame into a plurality of N portions, wherein the given portion of the quantized frame is the kth portion of the frame to be processed; and
determine an accumulated reduction error (E), wherein the accumulated reduction error is defined as the sum of the difference between a desired bit reduction and an actual bit reduction for each already processed portion of the quantized frame, wherein the desired bit reduction for each previously processed portion is defined as the number of bits to shave (NSHAVE) from the previously processed portion, and wherein the actual bit reduction for each previously processed portion is defined as the difference between a final compressed content size of the previously processed portion minus an initial compressed content size of the previously processed portion, and wherein the number of bits to shave (NSHAVE) from the given portion is given by the equation NSHAVE=(SINT×NS/CT)+E/(N+1−k).

### Claim 6 (depends on 5)

The apparatus of claim 5, wherein the processor is further adapted to:
determine a final content size (SFNL) of the given portion of the quantized frame, which is defined as the number of bits representing the given portion when the final content information of the given portion of the quantized frame is compressed; and
determine an instantaneous reduction error (e), wherein the instantaneous reduction error is defined as the sum of the final content size (SFNL) plus the number of bits to shave (NSHAVE) from the given portion minus the initial content size (SINT), such that e=SFNL+NSHAVE−SINT.

### Claim 7 (depends on 1)

The apparatus of claim 1, wherein the processor is further adapted to determine a target number (NTHRESH) of levels to set to zero by thresholding levels of the given portion, wherein the quantized frame is made up of multiple blocks arranged in a sequence, and each block is represented by at least one set of run-level pairs, and the given portion of the quantized frame includes the at least one set of run-level pairs.

### Claim 8 (depends on 7)

The apparatus of claim 7, wherein the target number (NTHRESH) of levels is related to the product of the number of levels in the given portion of the quantized frame times the quotient of the reduction threshold (RT) divided by the initial content size (SINT).

### Claim 9 (depends on 7)

The apparatus of claim 7, wherein the given portion of the quantized frame includes multiple sets of run-level pairs, and wherein the processor is further adapted to:
associate a scan position with each level in the given portion;
determine a number of levels (CNT) beneath a threshold function having a predetermined width and height profile, wherein a particular level is beneath the threshold function responsive to the scan position of the particular level being greater than a specific scan position and responsive to a magnitude of the particular level being less than a particular height;
responsive to the number of levels (CNT) beneath the threshold function being within a predetermined range of the target number (NTHRESH), set the magnitude of the levels beneath the threshold function to zero; and
responsive to the number of levels (CNT) beneath the threshold function being outside of the predetermined range of the target number (NTHRESH), adjust the threshold function by changing the height profile of the threshold function.

### Claim 10 (depends on 9)

The apparatus of claim 9, wherein the threshold function extends over a first range of scan positions and the processor adjusts the threshold function by shifting the relative location of the threshold function such that the threshold function extends over a second range of scan positions.

### Claim 11 (depends on 9)

The apparatus of claim 9, wherein the threshold function extends over a first range of scan positions and to adjust the threshold function the processor is adapted to:
partition the levels of the given portion into a first group and a second group of levels;
associate a second threshold function with the second group of levels, wherein the second threshold function extends over the second range of scan positions;
(a) determine the number of levels (CNT1) beneath a first threshold function, wherein a first particular level is beneath the first threshold function responsive to the scan position of the first particular level being with the first range of scan positions and responsive to a magnitude of the first particular level being less than a first specific height;
(b) determine the number of levels (CNT2) beneath the second threshold function, wherein a second particular level is beneath the second threshold function responsive to the scan position of the second particular level associated with the second range of scan positions and responsive to a magnitude of the second particular level being less than a second specific height;
(c) responsive to the sum of CNT1 and CNT2 being within the predetermined range of the target number (NTHRESH), set the magnitude of the levels beneath the first and second threshold functions to zero; and
(d) responsive to the sum of CNT1 and CNT2 being outside of the predetermined range of the target number (NTHRESH), transfer a predetermined number of levels from the first group to the second group,
wherein the processor includes logic, which, responsive to the sum of CNT1 and CNT2 being outside of the predetermined range of the target number (NTHRESH), is adapted to repeat (a), (b), (c), and (d) until the sum of CNT1 and CNT2 is within the predetermined range of the target number (NTHRESH).

### Claim 12

An apparatus comprising:
a processor adapted to:
receive a decompressed frame;
determine the number of bits to shave from the frame (NSHAVE);
determine an initial content size (SINT) of the frame, which is defined as a number of bits in the frame before the content information of the frame is compressed;
determine a final content size (SFNL) of the frame, which is defined as the number of bits in the frame when the content information of the frame is compressed;
determine a reduction error (e) for the frame, wherein the reduction error comprises (e)=SFNL+NSHAVE−SINT; and
accumulate the reduction error with reduction errors from previously processed frames, wherein the accumulated reduction error is used in processing subsequent frames.

### Claim 13 (depends on 12)

The apparatus of claim 12, wherein to determine the number of bits to shave (NS) from the frame the processor is further adapted to:
determine a total size (NT) of the frame, wherein the total size (NT) is number of bits of the frame when the frame is compressed, and wherein number of bits to shave (NS) is defined as a difference between the total size (NT) and a desired size (ND), such that NS=NT−ND.

### Claim 14

A method comprising the steps of:
receiving in a first bit stream a compressed frame having compressed content information and non-content information therein, the compressed frame having a first bit size (NT1), and the compressed content information having a first bit size (CT1);
determining an approximate number of bits to shave (NS) from the compressed frame;
decoding the compressed frame such that the frame is represented by initial content information formatted in sets of run-level pairs, wherein each set of run-level pairs is defined by a set of levels and an associated set of runs;
associating a scan position with a level in one of the sets of run-level pairs;
decomposing the sets of run-level pairs into sets of levels and sets of runs;
generating content information from the sets of levels and sets of runs; and
encoding the frame using the content information.

### Claim 15 (depends on 14)

The method of claim 14, further including the steps of:
(a) parsing the frame into a plurality of portions, each portion having at least one set of run-level pairs;
(b) buffering a copy of a given portion;
(c) thresholding in a run-level domain the levels in the given portion of the frame; and
(d) calculating new run values for the runs in the thresholded given portion.

### Claim 16 (depends on 15)

The method of claim 15, wherein the step of processing further includes the steps of:
(e) determining a set of threshold differences (D) by subtracting the levels in the thresholded given portion from the levels in the buffered copy of the given portion;
(f) buffering the set of threshold differences;
(g) determining for each level of the given portion the scan position thereof;
(h) associating a scan-position array with the set of threshold differences (D), wherein the elements of the scan-position array include the determined scan positions; and
(i) buffering the scan-position array.

### Claim 17 (depends on 16)

The method of claim 16, wherein the step of processing further includes the steps of:
(j) determining the number of levels, which have the value of zero and which precede the first non-zero level, in the thresholded given portion of the frame; and
(k) determining the number of levels, which have the value of zero and which interpose non-zero levels, in the thresholded given portion of the frame.

### Claim 18 (depends on 16)

The method of claim 16, wherein steps (b) through (i) are repeated for each portion of the frame, and further including the steps of:
(j) determining a second approximate number of bits to shave (NS2) from a second compressed frame;
(k) decoding the second compressed frame such that the second frame is represented by initial content information formatted in sets of run-level pairs, wherein each set of run-level pairs is defined by a set of levels and an associated set of runs, and wherein the compressed size of the content information is CT2;
(l) applying motion compensation to the sets of run-level pairs of the second frame using the sets of threshold differences (D) to produce therefrom motion compensated content information;
(m) thresholding the motion compensated content information of the second frame to produce therefrom final content information for the second frame; and
(n) encoding the final content information for the second frame, wherein the size of the encoded final content information for the second frame is approximately given by CT2−NS2.

### Claim 19 (depends on 18)

The method of claim 18, wherein step (1) further includes the steps of:
(o) extracting a particular set of threshold differences from the buffer using header information of the second frame;
(p) matrix multiplying the particular set of threshold differences with a particular DCT-domain motion compensation matrix (G) to produce therefrom a set of motion compensated threshold differences (T);
(q) adding the set of motion compensated threshold differences (T) to levels of the second frame;
(r) thresholding in the run-level domain the levels in a second given portion of the second frame; and
(s) calculating new run values for levels in the second portion.

### Claim 20 (depends on 19)

The method of claim 19, wherein each element of the set of motion compensated thresholded differences (T) is associated with a scan position, and wherein step (q) further includes the step of:
(t) determining for each level of the second given portion the scan position thereof; and
(u) adding the elements of the set of motion compensated threshold differences (T) to the levels of the second given portion, wherein only when the scan position that is associated with a particular element of the set of motion compensated threshold differences (T) matches the scan position of a particular level is the particular element of the set of motion compensated threshold differences (T) added to the particular level.
