|
FFmpeg
|
wmapro decoder implementation Wmapro is an MDCT based codec comparable to wma standard or AAC. More...
#include <inttypes.h>#include "libavutil/ffmath.h"#include "libavutil/float_dsp.h"#include "libavutil/intfloat.h"#include "libavutil/intreadwrite.h"#include "avcodec.h"#include "internal.h"#include "get_bits.h"#include "put_bits.h"#include "wmaprodata.h"#include "sinewin.h"#include "wma.h"#include "wma_common.h"Classes | |
| struct | WMAProChannelCtx |
| frame specific decoder context for a single channel More... | |
| struct | WMAProChannelGrp |
| channel group for channel transformations More... | |
| struct | WMAProDecodeCtx |
| main decoder context More... | |
| struct | XMADecodeCtx |
Macros | |
| #define | WMAPRO_MAX_CHANNELS 8 |
| current decoder limitations More... | |
| #define | MAX_SUBFRAMES 32 |
| max number of subframes per channel | |
| #define | MAX_BANDS 29 |
| max number of scale factor bands | |
| #define | MAX_FRAMESIZE 32768 |
| maximum compressed frame size | |
| #define | XMA_MAX_STREAMS 8 |
| #define | XMA_MAX_CHANNELS_STREAM 2 |
| #define | XMA_MAX_CHANNELS (XMA_MAX_STREAMS * XMA_MAX_CHANNELS_STREAM) |
| #define | WMAPRO_BLOCK_MIN_BITS 6 |
| log2 of min block size | |
| #define | WMAPRO_BLOCK_MAX_BITS 13 |
| log2 of max block size | |
| #define | WMAPRO_BLOCK_MIN_SIZE (1 << WMAPRO_BLOCK_MIN_BITS) |
| minimum block size | |
| #define | WMAPRO_BLOCK_MAX_SIZE (1 << WMAPRO_BLOCK_MAX_BITS) |
| maximum block size | |
| #define | WMAPRO_BLOCK_SIZES (WMAPRO_BLOCK_MAX_BITS - WMAPRO_BLOCK_MIN_BITS + 1) |
| possible block sizes | |
| #define | VLCBITS 9 |
| #define | SCALEVLCBITS 8 |
| #define | VEC4MAXDEPTH ((HUFF_VEC4_MAXBITS+VLCBITS-1)/VLCBITS) |
| #define | VEC2MAXDEPTH ((HUFF_VEC2_MAXBITS+VLCBITS-1)/VLCBITS) |
| #define | VEC1MAXDEPTH ((HUFF_VEC1_MAXBITS+VLCBITS-1)/VLCBITS) |
| #define | SCALEMAXDEPTH ((HUFF_SCALE_MAXBITS+SCALEVLCBITS-1)/SCALEVLCBITS) |
| #define | SCALERLMAXDEPTH ((HUFF_SCALE_RL_MAXBITS+VLCBITS-1)/VLCBITS) |
| #define | PRINT(a, b) av_log(s->avctx, AV_LOG_DEBUG, " %s = %d\n", a, b); |
| #define | PRINT_HEX(a, b) av_log(s->avctx, AV_LOG_DEBUG, " %s = %"PRIx32"\n", a, b); |
Typedefs | |
| typedef struct WMAProChannelCtx | WMAProChannelCtx |
| frame specific decoder context for a single channel | |
| typedef struct WMAProChannelGrp | WMAProChannelGrp |
| channel group for channel transformations | |
| typedef struct WMAProDecodeCtx | WMAProDecodeCtx |
| main decoder context | |
| typedef struct XMADecodeCtx | XMADecodeCtx |
Variables | |
| AVCodec | ff_wmapro_decoder |
| wmapro decoder More... | |
| AVCodec | ff_xma1_decoder |
| AVCodec | ff_xma2_decoder |
wmapro decoder implementation Wmapro is an MDCT based codec comparable to wma standard or AAC.
The decoding therefore consists of the following steps:
The compressed wmapro bitstream is split into individual packets. Every such packet contains one or more wma frames. The compressed frames may have a variable length and frames may cross packet boundaries. Common to all wmapro frames is the number of samples that are stored in a frame. The number of samples and a few other decode flags are stored as extradata that has to be passed to the decoder.
The wmapro frames themselves are again split into a variable number of subframes. Every subframe contains the data for 2^N time domain samples where N varies between 7 and 12.
Example wmapro bitstream (in samples):
The frame layouts for the individual channels of a wma frame does not need to be the same.
However, if the offsets and lengths of several subframes of a frame are the same, the subframes of the channels can be grouped. Every group may then use special coding techniques like M/S stereo coding to improve the compression ratio. These channel transformations do not need to be applied to a whole subframe. Instead, they can also work on individual scale factor bands (see below). The coefficients that carry the audio signal in the frequency domain are transmitted as huffman-coded vectors with 4, 2 and 1 elements. In addition to that, the encoder can switch to a runlevel coding scheme by transmitting subframe_length / 128 zero coefficients.
Before the audio signal can be converted to the time domain, the coefficients have to be rescaled and inverse quantized. A subframe is therefore split into several scale factor bands that get scaled individually. Scale factors are submitted for every frame but they might be shared between the subframes of a channel. Scale factors are initially DPCM-coded. Once scale factors are shared, the differences are transmitted as runlevel codes. Every subframe length and offset combination in the frame layout shares a common quantization factor that can be adjusted for every channel by a modifier. After the inverse quantization, the coefficients get processed by an IMDCT. The resulting values are then windowed with a sine window and the first half of the values are added to the second half of the output from the previous subframe in order to reconstruct the output samples.
| #define WMAPRO_MAX_CHANNELS 8 |
current decoder limitations
max number of handled channels
| AVCodec ff_wmapro_decoder |
wmapro decoder
| AVCodec ff_xma1_decoder |
| AVCodec ff_xma2_decoder |
1.8.12