Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Compression Sessions - Temporal compression options
Q: The Compression Session API has a single quality property, but if temporal compression is enabled, how can the client influence the quality of key frames? Additionally, how does temporal compression interact with the keyframe interval and the frame reordering options?
A: Temporal Compression and Quality
The Compression Session APIs have a single compression quality property (kICMCompressionSessionOptionsPropertyID_Quality
); Modern codecs aim to have consistent quality thereby avoiding jarring effects at keyframe intervals, therefore this single setting governs both the quality of key frames and difference frames produced during a compression operation.
If temporal compression is disabled (kICMCompressionSessionOptionsPropertyID_AllowTemporalCompression
set to false
), the quality property represents spatial quality.
If temporal compression is enabled, the quality setting represents a consistent quality setting between key frames and difference frames.
Temporal Compression, Max Keyframe Interval and Frame Reordering
If the AllowTemporalCompression
property is false, only key frames will be generated -- every frame will be an I frame. MaxKeyFrameInterval
is ignored.
If AllowTemporalCompression
is true and AllowFrameReordering
is false, key frames and difference frames will be generated but frames will be encoded in display order: I and P frames may be generated. MaxKeyFrameInterval
will be honored.
If AllowTemporalCompression
is true and AllowFrameReordering
is true, key frames and difference frames will be generated, and frames may be reordered by the compressor: I, P and B frames may be generated. MaxKeyFrameInterval
will be honored.
Setting the MaxKeyFrameInterval
to 1 (indicating that every frame must be a key frame) also has the effect of disabling temporal compression, since every frame must be a key frame.
References:
kICMCompressionSessionOptionsPropertyID_Quality |
This property specifies compression quality using a CodecQ value. This value is always used to set the |
spatialQuality; if temporal compression is enabled, it is also used to set temporalQuality. The default |
quality is codecNormalQuality. |
CodecQ, Read/Write. |
kICMCompressionSessionOptionsPropertyID_AllowTemporalCompression |
This Boolean property enables temporal compression. By default, temporal compression is disabled. |
IMPORTANT: If you want temporal compression (P frames and/or B frames) you must set this to true. |
Boolean, Read/Write. |
kICMCompressionSessionOptionsPropertyID_AllowFrameReordering |
This property enables frame reordering. In order to encode B frames, a compressor must reorder frames, |
which means that the order in which they will be emitted and stored (the decode order) is different from the |
order in which they were presented to the compressor (the display order). By default, frame reordering is |
disabled. |
IMPORTANT: In order to encode using B frames, you must enable frame reordering. |
Boolean, Read/Write. |
kICMCompressionSessionOptionsPropertyID_MaxKeyFrameInterval |
This property controls the maximum interval between key frames, also known as the key frame rate. Key frames, |
also known as sync frames, reset inter-frame dependencies; decoding a key frame is sufficient to prepare a |
decompressor for correctly decoding the difference frames that follow. Compressors are allowed to generate key |
frames more frequently if this would result in more efficient compression. |
The default key frame interval is 0, which indicates that the compressor should choose where to place all key |
frames. A key frame interval of 1 indicates that every frame mus be a key frame, 2 indicates that at least |
every other frame must be a key frame and so on. |
SInt32, Read/Write. |
Document Revision History
Date | Notes |
---|---|
2006-01-12 | New document that discusses the temporal compression option as it relates to quality and other compression session options. |
Copyright © 2006 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2006-01-12