What's New in QuickTime 5
| Previous | Chapter Contents | Chapter Top | Next |
QuickTime 5 provides support for accelerating video compression and decompression on multiprocessor computers, such as the Power Mac G4 MP.
Image compressor and decompressor components must be revised to take advantage of MP. There are two ways to approach this. If the component is modified to split a single compression or decompression operation into several MP tasks, this will improve performance for all applications. Some algorithms are not easily divided into independent units of work, however, so this is not always feasible. Alternatively, components may be modified so that they are able to work asynchronously and permit the application to continue working in the blue task (the MP task on Mac OS 9) while work is in progress.
If the codec is not written to take advantage of MP, then processing work will run in the application's task, as illustrated in Figure 35 . (On Mac OS 9, this MP task is called the blue task.)
Figure 35 If your codec doesn't take advantage of MP, processing work runs in the application's task.
This diagram is intended as a conceptual aid only. In reality, all tasks, including the blue task, may migrate between processors as necessary.
Now suppose the codec is modified to create a number of MP tasks and split each compression or decompression operation between them. This is illustrated in Figure 36 . Assuming no other MP tasks are running, the total time taken for the operation could be decreased by a factor of up to the number of processors -- for example, on a two-processor machine, the time taken could be halved.
Figure 36 A codec that splits its work into multiple processes
The client application does not need to have been modified to take advantage of such an accelerated component. As on a single-processor computer, the compression or decompression request does not return until after it is complete.
In QuickTime 5, the DV compressor and decompressor components have been modified to divide their work between a number of processors in this manner.
Some compression or decompression algorithms do not lend themselves to such division. Often there may be major data dependencies between sub-stages that mean that one step cannot be started until the previous one is complete.
In such a case, the codec can often still be modified to support multiprocessor computers by performing its work in a single MP task while the application continues to execute in its own task. Rather than accelerating a single operation, this increases the number of operations that may be performed at once. In order to see an overall performance improvement, the application must call asynchronous versions of the compression or decompression APIs. This is illustrated in Figure 37 .
Figure 37 A codec revised to support asynchronous mode of work
When the operation is complete, the application's asynchronous completion routine is called. Completion routines are often called at deferred task time, so they must be written with care not to make any calls that might move or purge memory. (See Technote 1104, "Interrupt-Safe Routines," at http://developer.apple.com/technotes/tn/tn1104.html for more information on this topic.)
What's New in QuickTime 5
| Previous | Chapter Contents | Chapter Top | Next |