Commit 31c57185 authored by Sascha Sommer's avatar Sascha Sommer
Browse files

Add some more wmapro decoder hunks

Originally committed as revision 19678 to svn://
parent 7056883b
* Wmapro compatible decoder
* Copyright (c) 2007 Baptiste Coudurier, Benjamin Larsson, Ulion
* Copyright (c) 2008 - 2009 Sascha Sommer, Benjamin Larsson
* This file is part of FFmpeg.
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* @file libavcodec/wmaprodec.c
* @brief wmapro decoder implementation
* Wmapro is an MDCT based codec comparable to wma standard or AAC.
* The decoding therefore consists of the following steps:
* - bitstream decoding
* - reconstruction of per-channel data
* - rescaling and inverse quantization
* - windowing and overlapp-add
* 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):
* || packet 0 || packet 1 || packet 2 packets
* ---------------------------------------------------
* || frame 0 || frame 1 || frame 2 || frames
* ---------------------------------------------------
* || | | || | | | || || subframes of channel 0
* ---------------------------------------------------
* || | | || | | | || || subframes of channel 1
* ---------------------------------------------------
* 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.
*@brief Uninitialize the decoder and free all resources.
*@param avctx codec context
......@@ -8,11 +96,6 @@ static av_cold int decode_end(AVCodecContext *avctx)
WMA3DecodeContext *s = avctx->priv_data;
int i;
for (i = 0 ; i < WMAPRO_BLOCK_SIZES ; i++)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment