# US 7,409,097 B2 · Video encoding using variable bit rates

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

- Number: US 7,409,097 B2
- Document ID: US7409097B2
- Status: Granted
- Kind: B2
- Application number: 10/714,501
- Filed: 2003-11-14
- Published: 2005-05-19
- Granted: 2008-08-05
- Earliest claimed: 2003-11-14
- Assignees: Vweb Corporation
- Inventors: Dengzhi Zhang; Sho Long Chen; Stanley H. Siu
- Web page: https://patentgrep.com/patent/US7409097B2

## CPC

- H04N 19/198: {including smoothing of a sequence of encoding parameters, e.g. by averaging, by choice of the maximum, minimum or median value}
- H04N 19/115: Selection of the code volume for a coding unit prior to coding
- H04N 19/124: Quantisation
- H04N 19/14: Coding unit complexity, e.g. amount of activity or edge presence estimation (H04N19/146 takes precedence)
- H04N 19/159: Prediction type, e.g. intra-frame, inter-frame or bidirectional frame prediction
- H04N 19/172: the region being a picture, frame or field
- H04N 19/176: the region being a block, e.g. a macroblock
- H04N 19/196: being specially adapted for the computation of encoding parameters, e.g. by averaging previously computed encoding parameters (processing of motion vectors H04N19/513)
- H04N 19/197: {including determination of the initial value of an encoding parameter (H04N19/56 takes precedence)}
- H04N 19/61: in combination with predictive coding
- H04N: PICTORIAL COMMUNICATION, e.g. TELEVISION

## Abstract

A system and method is provided for variable bit rate encoding using a complexity ratio. Quantization parameter is calculated using a complexity ratio, which is equal to a local complexity divided by a global complexity. Complex pictures are allocated a larger bit budget relative to simple pictures. With the larger bit budget the quality of complex pictures can be maintained while reducing the overall size of the encoded video stream.

## Claims

### Claim 1

A method of generating a frame quantization parameter for encoding a current frame of an incoming video stream having a plurality of frames, the method comprising:
calculating a complexity ratio of the current frame, wherein the calculating a complexity ratio of the current frame comprises:
calculating a local complexity of the current frame; wherein the calculating a local complexity of the current frame comprises:
calculating a new average local complexity; and
calculating a new value for the local complexity as a weighted average of a current value of the local complexity and the new average local complexity;
calculating a global complexity of a plurality of frames; and
setting the complexity ratio to equal the local complexity divided by the global complexity; complexity ratio of the current frame;
calculating the frame quantization parameter based on the current frame bit rate.

### Claim 2 (depends on 1)

The method of claim 1, wherein the new average local complexity is equal to a weighted average of a plurality of frame complexities weighted by a plurality of frame types.

### Claim 3

A method of generating a frame quantization parameter for encoding a current frame of an incoming video stream having a plurality of frames, the method comprising:
calculating a complexity ratio of the current frame, wherein the calculating a complexity ratio of the current frame comprises:
calculating a local complexity of the current frame;
calculating a global complexity of a plurality of frames, wherein a new value for global complexity is equal to a global complexity coefficient times the local complexity plus a current value of the global complexity times one minus the global complexity coefficient; and
setting the complexity ratio to equal the local complexity divided by the global complexity;
calculating a current frame bit rate using the complexity ratio of the current frame;
calculating the frame quantization parameter based on the current frame bit rate.

### Claim 4

A method of generating a frame quantization parameter for encoding a current frame of an incoming video stream having a plurality of frames, the method comprising:
calculating a complexity ratio of the current frame;
calculating a current frame bit rate using the complexity ratio of the current frame;
calculating the frame quantization parameter based on the current frame bit rate; and
calculating a bit balance adjustment factor that is used in the calculating a current frame bit rate using the complexity ratio, wherein calculating a bit balance adjustment factor comprises:
tracking a bit balance of a plurality of previously processed frames; and
dividing the bit balance by a duration to generate the bit balance adjustment factor.

### Claim 5

A method of generating a frame quantization parameter for encoding a current frame of an incoming video stream having a plurality of frames, the method comprising:
calculating a complexity ratio of the current frame;
calculating a current frame bit rate using the complexity ratio of the current frame;
calculating the frame quantization parameter based on the current frame bit rate; and
calculating a bit balance adjustment factor that is used in the calculating a current frame bit rate using the complexity ratio, wherein the current frame bit rate is equal to the bit balance adjustment value plus a rate control parameter multiplied by the complexity ratio multiplied by a frame target rate plus the frame target rate multiplied by the difference between one and the rate control parameter.

### Claim 6

A method of generating a frame quantization parameter for encoding a current frame of an incoming video stream having a plurality of frames, the method comprising:
calculating a complexity ratio of the current frame;
calculating a current frame bit rate using the complexity ratio of the current frame;
calculating a frame coding efficiency factor; and
calculating the frame quantization parameter based on the current frame bit rate, wherein the calculating the frame quantization parameter based on the current frame bit rate comprises:
calculating a bit budget for the current frame using the current frame bit rate;
calculating an average macroblock quantization factor of a previous frame, wherein the previous frame and the current frame have a same frame type; and
calculating the frame quantization parameter using the bit budget; the average macroblock quantization factor of the previous frame, and a bit usage of the previous frame; and
wherein the frame quantization parameter is equal to one fourth of the average macroblock quantization factor multiplied by the sum of three plus the bit usage divided by the bit budget.

### Claim 7

A method of generating a frame quantization parameter for encoding a current frame of an incoming video stream having a plurality of frames, the method comprising:
calculating a complexity ratio of the current frame;
calculating a current frame bit rate using the complexity ratio of the current frame;
calculating the frame quantization parameter based on the current frame bit rate; and
calculating an underflow quantization parameter for each macroblock of the current frame; wherein the comprising calculating an underflow quantization parameter for each macroblock of the current frame comprises:
calculating a maximum macroblock bit budget;
tracking a total bit usage for the current frame;
tracking a count of a number of processed macroblocks; and
calculating the underflow quantization parameter using the maximum macroblock bit budget, the total bit usage, and the count, wherein a new value of the underflow quantization parameter is equal to a current value of underflow quantization parameter multiplied by one plus the total bit usage minus a product of the count and the maximum macroblock bit budget divided by the maximum macroblock bit budget.

### Claim 8 (depends on 7)

The method of claim 7, further comprising applying activity masking to generate a macroblock quantization parameter using the underflow quantization parameter.

### Claim 9

A method of creating macroblock quantization parameters for a current frame using a frame quantization parameter, the method comprising:
setting an initial value of the macroblock quantization value to be equal to the frame quantization parameter;
calculating a maximum macroblock bit budget;
tracking a total bit usage for the current frame;
tracking a count of a number of processed macroblocks;
calculating the underflow quantization parameter using the maximum macroblock bit budget, the total bit usage, and the count, wherein a new value of the underflow quantization parameter is equal to a current value of underflow quantization parameter multiplied by one plus the total bit usage minus a product of the count and the maximum macroblock bit budget divided by the maximum macroblock bit budget.

### Claim 10 (depends on 9)

The method of claim 9, further comprising applying activity masking to each macroblock.

### Claim 11 (depends on 9)

The method of claim 9, further comprising calculating the frame quantization parameter.

### Claim 12 (depends on 11)

The method of claim 11, wherein the calculating the frame quantization parameter comprises:
calculating a complexity ratio;
calculating a current frame bit rate using the complexity ratio factor; and
calculating the frame quantization parameter based on the current frame bit rate.

### Claim 13

A system for generating a frame quantization parameter for encoding a current frame of an incoming video stream having a plurality of frames, the system comprising:
means for calculating a complexity ratio of the current frame;
means for calculating a current frame bit rate, using the complexity ratio of the current frame; and
means for calculating the frame quantization parameter based on the current frame bit rate; and
wherein the means for calculating a complexity ratio comprises:
means for calculating a local complexity of the current frame;
means for calculating a global complexity of a plurality of frames; and
means for setting the complexity ratio to equal the local complexity divided by the global complexity; and
wherein the means for calculating a local complexity comprises:
means for calculating a new average local complexity; and
means for calculating a new value for the local complexity as a weighted average of a current value of the local complexity and the new average local complexity.

### Claim 14

A system for generating a frame quantization parameter for encoding a current frame of an incoming video stream having a plurality of frames, the system comprising:
means for calculating a complexity ratio of the current frame;
means for calculating a current frame bit rate using the complexity ratio of the current frame;
means for calculating the frame quantization parameter based on the current frame bit rate; and
means for calculating a bit balance adjustment factor that is used by the means for calculating a current frame bit rate using the complexity ratio factor;
wherein the means for calculating a bit balance adjustment factor comprises:
means for tracking a bit balance of a plurality of previously processed frames;
means for dividing the bit balance by a duration to generate the bit balance adjustment factor.

### Claim 15 (depends on 13)

The system of claim 13, further means for comprising calculating a frame coding efficiency factor.

### Claim 16 (depends on 15)

The system of claim 15, wherein the means for calculating the frame quantization parameter based on the current frame bit rate comprises:
means for calculating a bit budget for the current frame using the current frame bit rate;
means for calculating an average macroblock quantization factor of a previous frame, wherein the previous frame and the current frame have a same frame type;
means for calculating the frame quantization parameter using the bit budget; the average macroblock quantization factor of the previous frame, and a bit usage of the previous frame.

### Claim 17 (depends on 13)

The system of claim 13, further comprising means for calculating an underflow quantization parameter for each macroblock of the current frame.

### Claim 18

A system for creating macroblock quantization parameters for a current frame using a frame quantization parameter, the system comprising:
means for setting an initial value of the macroblock quantization value to be equal to the frame quantization parameter;
means for calculating a maximum macroblock bit budget;
means for tracking a total bit usage for the current frame;
means for tracking a count of a number of processed macroblocks;
means for calculating the underflow quantization parameter using the maximum macroblock bit budget, the total bit usage, and the count; wherein a new value of the underflow quantization parameter is equal to a current value of underflow quantization parameter multiplied by one plus the total bit usage minus a product of the count and the maximum macroblock bit budget divided by the maximum macroblock bit budget.

### Claim 19 (depends on 18)

The method of claim 18, further comprising means for applying activity masking to each macroblock.

### Claim 20 (depends on 18)

The system of claim 18, further comprising means for calculating the frame quantization parameter.

### Claim 21 (depends on 20)

The system of claim 20, wherein the means for calculating the frame quantization parameter comprises:
means for calculating a complexity ratio;
means for calculating a current frame bit rate using the complexity ratio factor; and
means for calculating the frame quantization parameter based on the current frame bit rate.
