Claims
- 1. An apparatus in a network for transcoding a digital stream of compressed frames, the apparatus comprising:
a decoder adapted to decompress a frame having content information and non-content information included therein into the run-level domain, wherein the content-information carried by the frame is represented in run-level domain; a processor adapted to determine the number of bits to shave (Ns) from the frame and adapted to process the frame in the run-level domain to reduce the compressed bit size of the frame by approximately Ns bits, wherein the content-information of the frame is changed from initial content information to final content information; and an encoder adapted to compress the frame.
- 2. The apparatus of claim 1, wherein the processor is further adapted to:
(a) determine whether to requantize at least a given portion of the frame; (b) responsive to determining to requantize at least the given portion of the frame, requantize in the run-level domain at least the given portion of the frame; (c) determine whether to threshold at least the given portion of the frame; and (d) responsive to determining to threshold at least the given portion of the frame, threshold in the run-level domain at least the given portion of the frame.
- 3. The apparatus of claim 2, wherein the 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 frame is represented by at least one set of run-level pairs.
- 4. The apparatus of claim 3, wherein the given portion of the frame is a slice of the frame, and each set of run-level pairs representing a block of the slice is processed in parallel.
- 5. The apparatus of claim 2, wherein the processor is further adapted to:
determine the number of bits to shave from the given portion of the frame (NSHAVE); determine for the given portion the initial content size (SINT) of the portion of the frame, which is defined as the number of bits representing the given portion when the initial content information of the given portion of the frame is compressed; determine a reduction threshold (RT), wherein the reduction threshold is given as RT=NSHAVE/SINT, and wherein the determination whether to requantize is based at least in part upon the reduction threshold.
- 6. The apparatus of claim 5, wherein the processor is further adapted to determine the total content size (CT) of the frame, wherein the total content size (CT) is defined as the number of bits of the content information when the 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 frame divided by total content size (CT) of the frame.
- 7. The apparatus of claim 6, wherein the processor is further adapted to:
parse the frame into a plurality of N portions, wherein the given portion of the 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 the actual bit reduction for each of the already processed portions of the 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 the final compressed content size of the previously processed portion minus the 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).
- 8. The apparatus of claim 7, wherein the processor is further adapted to:
determine for the given portion the final content size (SFNL) of the given portion of the frame, which is defined as the number of bits representing the given portion when the final content information of the given portion of the frame is compressed; 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), e=SFNL+NSHAVE−SINT, wherein the instantaneous reduction error (e) is added to the accumulated reduction error (E).
- 9. The apparatus of claim 5, 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 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 frame includes at least one set of run-level pairs.
- 10. The apparatus of claim 9, wherein the target number (NTHRESH) of levels is related to the number of levels in the given portion of the frame and the reduction parameter (RT).
- 11. The apparatus of claim 9, wherein the processor is further adapted to determine for the given portion the initial content size (SINT) of the portion of the frame, which is defined as the number of bits representing the given portion when the initial content information of the given portion of the frame is compressed, and wherein the target number (NTHRESH) of levels is related to the product of the number of levels in the given portion of the frame times the quotient of the reduction parameter (RT) divided by the initial portion content size (SINT).
- 12. The apparatus of claim 9, wherein the given portion of the 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 the 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 the 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.
- 13. The apparatus of claim 12, wherein the processor adjusts the threshold function by changing the height profile of the threshold function.
- 14. The apparatus of claim 13, wherein the height profile is increment.
- 15. The apparatus of claim 13, wherein the height profile is decrement.
- 16. The apparatus of claim 12, 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 of range of scan positions.
- 17. The apparatus of claim 16, wherein the largest scan position included in the first range of scan positions is smaller than the largest scan position included in the second range of scan positions.
- 18. The apparatus of claim 16, wherein the largest scan position included in the first range of scan positions is greater than the largest scan position included in the second range of scan positions.
- 19. The apparatus of claim 12, wherein the threshold function extends over a first range of scan positions and to adjusts 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 a second range of scan positions; (a) determine the number of levels (CNT1) beneath the 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 the 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 being with the second range of scan positions and responsive to the 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; (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; and wherein responsive to the sum of CNT1 and CNT2 being outside of the predetermined range of the target number (NTHRESH), the processor includes logic to repeat (a), (b), (c), and (d) until the sum of CNT1 and CNT2 is within the predetermined range of the target number (NTHRESH).
- 20. The apparatus of claim 2, wherein the processor is further adapted to:
determine the number of bits to shave from the given portion of the frame (NSHAVE); determine for the given portion the initial content size (SINT) of the portion of the frame, which is defined as the number of bits representing the given portion when the content information of the given portion of the frame is compressed; determine for the given portion the final content size (SFNL) of the portion of the frame, which is defined as the number of bits representing the given portion when the content information of the given portion of the frame is compressed; and determine a reduction error (e) for the given portion of the frame; wherein the reduction error (e) given as, e=SFNL+NSHAVE−SINT;; and accumulate the reduction error with reduction errors from previously processed portions of the frame, wherein the accumulated reduction error is used in processing subsequent portions of the frame.
- 21. The apparatus of claim 1, wherein to determine the number of bits to shave (NS) from the frame the processor is further adapted to:
determine 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 the difference between the total size (NT) and a desired size (ND), NS=NT−ND.
- 22. A method a transcoding a digital stream, the 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 a set of run-level pairs; decomposing the sets of run-level pairs into sets of levels and sets of runs; processing the sets of levels and the sets of runs of the frame in a domain defined by run and level to generate final content information representing the frame; and encoding the frame using the final content information, wherein the bit size of the encoded final content information is approximately given by CT1-NS.
- 23. The method of claim 22, further including the steps of:
(a) parsing the frame into a plurality of portions, each portion having at least set of run-level pairs; (b) buffering a copy of a given portion; (c) thresholding in the 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.
- 24. The method of claim 23, 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.
- 25. The method of claim 24, 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.
- 26. The method of claim 25, wherein the given portion of the frame is a first set of run-level pairs, and the scan position value of the nth element of the scan-position array is determined using the equation
- 27. The method of claim 26, wherein the new run value for the nth run of the set of runs associated with the first set of run-level pairs is calculated using the equation
- 28. The method of claim 24, wherein steps (b) through (i) are repeated for each set of 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 at 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.
- 29. The method of claim 28, wherein step (l) 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.
- 30. The method of claim 29, wherein the particular DCT-domain motion compensation matrix (G) is selected from a set of DCT-domain motion compensation matrices using a motion vector of the second frame.
- 31. The method of claim 29, 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) opportunistically 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.
- 32. The method of claim 29, wherein step (l) further includes the steps of:
(t) determining whether the second frame is a reference frame; (u) responsive to determining the second frame is a reference frame, updating a particular set of threshold differences (D).
CROSS-REFERENCE TO RELATED APPLICATION
[0001] This application is a continuation-in-part of U.S. Application serial number 10/397,658, filed Mar. 26, 2003, which claimed priority to U.S. provisional application having serial No. 60/368,068, filed Mar. 27, 2002, both of which are entirely incorporated herein by reference.
Provisional Applications (1)
|
Number |
Date |
Country |
|
60368068 |
Mar 2002 |
US |
Continuation in Parts (1)
|
Number |
Date |
Country |
Parent |
10397658 |
Mar 2003 |
US |
Child |
10635406 |
Aug 2003 |
US |