# Patent

## Title
Agile decoder

## Abstract

A decoder arrangement (10) includes a processor (12) programmed to decode multiple streams (111-11n), including multiple streams of different formats. In terms of functionality, the decoder arrangement includes a routing stage (13) routes each streams to different decoder stages (141-14n), each capable of decoding a stream of a particular format to yield an uncompressed stream at its output. Each of plurality of buffer stages (161-16n) stores a successive frame of an uncompressed stream output by an associated decoder stage. An output stage scales and the frames stored by the buffer stages to a common size for input to a display device (22).

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
This application claims priority under 35 U.S.C. 119(e) to U.S. Provisional Patent Application Ser. No. 60/653,538, filed Feb. 16, 2005, the teachings of which are incorporated herein.
This application claims the benefit, under 35 U.S.C. §365 of International Application PCT/US2006/003520, filed Feb. 1, 2006 published in accordance with PCT Article 21(2) on Aug. 24, 2006 in English.


TECHNICAL FIELD
This invention relates to a decoder for decoding compressed streams.
BACKGROUND ART
Traditionally, video decoders have been hardware-based. In other words, typical video decoders take the form of discrete, stand-alone devices dedicated for this purpose. With hardware decoder implementations, decoding streams of different formats usually requires a different chipset for each stream type and relatively lengthy firmware downloads. Multiple chipsets can prove to be very costly and making firmware changes in real-time becomes impractical.
Thus a need exists for a decoder arrangement that overcomes the disadvantages of the prior art.
BRIEF SUMMARY OF THE INVENTION
Briefly, in accordance with a preferred embodiment of the present principles, there is provided a decoder for decoding at least first and second compressed streams. The decoder comprises first and second decoder stages, each capable of decoding a separate one of the at least first and second streams to yield first and second uncompressed streams, respectively. A routing stage routes the at least first and second streams to the at least first and second decoder stages, respectively. At least first and second buffer stages each store a separate one of the first and second uncompressed streams output by the first and second decoder stages. An output stage combines the uncompressed streams stored by the at least first and second buffer stages.
In practice, the decoder arrangement of the present principles comprises a processor programmed with software to perform the function of each of the decoder stages. Software decoders allow for a high degree of customization and afford greater flexibility and control over the decoding process. Source video material used in non-linear editors (NLEs) can come from different sources and can undergo compression in different formats, such as MPEG2, DV, JPG2K for example. The material also can have different presentation sizes, for instance, standard definition NTSC vs. high-definition 1080i. The decoder arrangement of the present principles can decode video streams regardless of their native compression format or image size by making use of decoder stages capable of decoding different formats. The decoder arrangement of the present principles can decompress frames of different formats and compose the uncompressed frames onto a common “canvas.” Further, with the availability of relatively inexpensive multiprocessor systems, the decoder arrangement of the present principles can execute on multiple parallel threads so that processing throughput can scale with the number and speed the available processors.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 depicts a block schematic diagram of a decoder arrangement in accordance with a preferred embodiment of the present principles.



DETAILED DESCRIPTION
FIG. 1 depicts a block schematic drawing of a decoder arrangement 10 in accordance with a preferred embodiment of the present principles for uncompressing a plurality of compressed video streams 111-11n, where n is an integer greater than zero. In practice, one or more of the video streams 111-11n can have a different format from the others. For example, one of the streams can take the form of an MPEG 2 stream, while another stream could take the form of a DV25 or DV50 stream. The particular format of each stream remains unimportant, as long as the particular format of the stream is known a priori.
In practice the decoder 10 of the present principles comprises a programmed processor 12, such as a microprocessor, microcomputer or the like, which operates in stages as described in greater detail below. When programmed to operate as a software decoder, the processor 12 will possess an input routing stage 13 that routes the compressed video streams 111-11n to an appropriate one of a plurality of decoder stages 141-14n depending of the compression format of the incoming stream. Each of decoder stages 141-14n operates to de-compress an incoming of a particular format. Typical compression formats include MPEG 2, DV25, and DV50 for standard definition (SD) video, and MPEG 2, H.264-MPE4 AVC and D 100 for high definition video. Thus, depending on the composition of the compressed video streams 111-11n, one or more of the decoder stages 141-14n will have the capability of de-compressing video in one of the MPEG 2, DV25, and DV50 SD formats or in one of the MPEG 2, H.264-MPE4 AVC and DV 100 HD formats.
Upon receipt of an incoming one of the streams 111-11n of a specific compression format, a decoder stage associated with that format will decode the stream to yield successive uncompressed frames. Each uncompressed frame output by a decoder stage undergoes storage in a corresponding one of presentation buffer stages 181-18n, respectively, sized to receive the uncompressed frame. In practice, each of the presentation buffer stages 181-18n holds a frame of a particular size which depends on the decompression format of its associated decoding stage. Typically, each of the presentation buffer stages 181-18n will have one of the following standard sizes:
NTSC (720×480)
PAL (720×576)
1080i (1920×1080)
720p (1280×720)
Uncompressed SD frames will typically conform to either the NTSC or PAL format. Uncompressed HD frames, depending on their size, will undergo storage in a buffer stage capable of accommodating 1080i or 720p HD frames. If a decoded frame image does not conform to size of a presentation buffer stage, as can occur with some MPEG 2 video frames, the frame undergoes a clipping or cropping operation. For example, a 720×512 MPEG 2 frame will have 32 lines clipped before placed in presentation buffer stage.
A scaler 20 scales the frames read from each of the presentation buffer stages 181-18n and also performs the required color space conversion associated with a video display renderer 22. For example, if the video display renderer 22 has an input frame size of 1920×1080 pixels associated with 1080i HD frames, the scaler 20 will scale all frames to that size. Any frames smaller than 1920×1080 pixels will undergo up-conversion by the scaler 20. Conversely, if the video display renderer 22 has an input frame size of 720×480 pixels, then the scaler 20 will down-convert larger size frames.
The decoder arrangement 10 of FIG. 1 improves efficiency by affording temporal parallelism. With software-based decoder arrangements, reading the compressed video stream can involve time spent with disk access. Additionally, writing frames of the uncompressed output stream typically will involve time spent performing bus transfers to display hardware. Waiting for to complete such input/output (I/O) tasks to occur does not constitute an efficient use of processing cycles. The decoder arrangement 10 of the present principles makes use of the presentation buffers 181-18n to decouple the decoding stages 141-14n from the scaler 20 that performs the scaling and color space conversion. After a frame (N) undergoes decoding and storage in a presentation buffer, a decoder stage can decode the next frame (N+1) as the scaler 20 formats the now uncompressed frame (N) for output. A lock semaphore protects each presentation buffer stage to prevent one thread from overrunning the other.
As discussed above, the decoder arrangement 10 makes use of a processor 12 for executing a software based program for decoding a plurality of streams 111-11n, typically, although not necessarily in serial fashion. Although FIG. 1 depicts the processor 12 as being dedicated to the decoding task, the processor could perform other operations in addition to decoding. Although not explicitly depicted in FIG. 1, the processor 12, when networked with other processors in a large system, could detect the number of other of processors available. If another processor besides processor 12 becomes available, then spatial parallelism becomes automatically enabled. Most video compression algorithms process an individual frame using a series of smaller sub-picture areas called macroblocks. The total number of macroblocks blocks can be divided among the available processors by creating multiple threads of execution. If the number of blocks for each processor remains less than the total number of blocks requiring decoding, then the time required to decode each frame is less. When using this method, each thread of execution is synchronized at the end of each frame to prevent image tearing.
The software-based decoding arrangement 10 affords several advantages are compared to stand-alone hardware decoders. For example, the decoder arrangement 10 can expand easily to support new compression standards as they become available since all that becomes necessary is a software update. In addition, individual 3rd-party CODEC components can be replaced if faster or better substitutes are found. Further, the decoder arrangement 10 can switch compression types on a video frame boundary, typically every 33 ms at NTSC rates and 40 ms at PAL rates to provide seamless decoding operations for all supported compression formats.
The foregoing describes a decoder arrangement for decoding video streams of different formats.

## Claims

1. A decoder for decoding at least first and second streams, comprising:
at least first and second decoder stages, each simultaneously decoding a separate one of the at least first and second streams to yield at least first and second uncompressed streams, wherein each of the at least first and second streams are encoded first and second formats, which format is known before decoding commences, and wherein each of the at least first and second decoder stages have first and second decoding formats, each matching the first and second formats of the at least first and second streams;
a routing stage for routing a separate one of the at least first and second streams to the at least first and second decoding stages, respectively;
at least first and second buffer stages each storing a frame of a separate one of the first and second uncompressed streams, respectively; and
a scaler for scaling the frames from the first and second buffer stages to a common size, wherein frames smaller than the common size are upconverted and frames larger than the common size are downconverted and further wherein a lock semaphore prevents each of the at least one or the first and second buffer stages from overrunning the other buffer stage.

2. The decoder of claim 1 wherein the first encoding format comprises one of the MPEG 2, DV25, and DV50 for standard definition (SD) video, and MPEG 2, H.264-MPE4 AVC and DV 100 for high definition video.

3. The decoder of claim 1 wherein the second encoding format comprises one of the MPEG 2, DV25, and DV50 for standard definition (SD) video, and MPEG 2, H.264-MPE4 AVC and DV 100 for high definition video.

4. The decoder of claim 1 wherein the at least first and second presentation buffer stages have different sizes.

5. The decoder of claim 4 wherein the first and second presentation buffer stages have a size of one of 720×480 pixels, 720×576 pixels, 1920×1080 pixels or 1280×720 pixels.

6. A decoder for decoding at least first and second streams, comprising:
at least first and second decoder stages, each simultaneously decoding a separate one of the at least first and second streams to yield at least first and second uncompressed streams, wherein each of the at least first and second streams are encoded first and second formats, which format is known before decoding commences, and wherein each of the at least first and second decoder stages have first and second decoding formats, each matching the first and second formats of the at least first and second streams;
a routing stage for routing a separate one of the at least first and second streams to the at least first and second decoding stages, respectively;
at least first and second buffer stages each storing a frame of a separate one of the first and second uncompressed streams, respectively; and
a scaler for scaling the frames from the first and second buffer stages to a common size, wherein a lock semaphore prevents each of the at least one of the first and second presentation buffer stages from overrunning the other buffer stage.

7. The decoder of claim 1 wherein each of the at least first and second presentation buffer stages decouples an associated one of the at least first and second decoder stages from the scaler to permit each decoder stage to decode independently to operation in temporal parallelism.

8. The decoder of claim 1 wherein the scaler performs color space conversion.

9. A method for decoding at least first and second streams, comprising:
routing a separate one of the at least first and second streams for decoding;
decoding simultaneously a separate one of the at least first and second streams to yield at least first and second uncompressed streams, respectively, wherein each of the at least first and second streams are encoded first and second formats known before decoding commences and the decoding step further comprises decoding the at least first and second streams using the first and second decoding formats;
storing a frame of a separate one of the at least first and second uncompressed streams; and
scaling the stored frames of the first and second uncompressed streams to a common size, wherein frames smaller than the common size are upconverted and frames larger than the common size are downconverted and further wherein a lock semaphore prevents each of the at least one or the first and second buffer stages from overrunning the other buffer stage.

10. The method according to claim 9 wherein the first encoding format comprises one of the MPEG 2, DV25, and DV50 encoding formats for standard definition (SD) video, and MPEG 2, H.264-MPE4 AVC and DV 100 encoding formats for high definition video.

11. The method according arrangement of claim 1 wherein the second encoding format comprises one of the MPEG 2, DV25, and DV50 encoding formats for standard definition (SD) video, and MPEG 2, H.264-MPE4 AVC and DVI00 encoding formats for high definition video.

12. The method according to claim 9 further comprising the step of decoupling encoding of the at least first and second streams from scaling of the stored streams.

13. The method according to claim 9 further comprising the step of performing color conversion on the stored frames.

14. The method according to claim 9 further comprising the step of decoding multiple streams in spatial parallelism.