libavcodec/wmadec.c File Reference

WMA compatible decoder. More...

#include "avcodec.h"
#include "wma.h"
#include <assert.h>

Go to the source code of this file.

Defines

#define EXPVLCBITS   8
#define EXPMAX   ((19+EXPVLCBITS-1)/EXPVLCBITS)
#define HGAINVLCBITS   9
#define HGAINMAX   ((13+HGAINVLCBITS-1)/HGAINVLCBITS)

Functions

static void wma_lsp_to_curve_init (WMACodecContext *s, int frame_len)
static int wma_decode_init (AVCodecContext *avctx)
static float pow_m1_4 (WMACodecContext *s, float x)
 compute x^-0.25 with an exponent and mantissa table.
static void wma_lsp_to_curve (WMACodecContext *s, float *out, float *val_max_ptr, int n, float *lsp)
 NOTE: We use the same code as Vorbis here.
static void decode_exp_lsp (WMACodecContext *s, int ch)
 decode exponents coded with LSP coefficients (same idea as Vorbis)
static int decode_exp_vlc (WMACodecContext *s, int ch)
 decode exponents coded with VLC codes
static void wma_window (WMACodecContext *s, float *out)
 Apply MDCT window and add into output.
static int wma_decode_block (WMACodecContext *s)
static int wma_decode_frame (WMACodecContext *s, int16_t *samples)
static int wma_decode_superframe (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
static av_cold void flush (AVCodecContext *avctx)

Variables

static const float pow_tab []
 pow(10, i / 16.0) for i in -60.
AVCodec ff_wmav1_decoder
AVCodec ff_wmav2_decoder


Detailed Description

WMA compatible decoder.

This decoder handles Microsoft Windows Media Audio data, versions 1 & 2. WMA v1 is identified by audio format 0x160 in Microsoft media files (ASF/AVI/WAV). WMA v2 is identified by audio format 0x161.

To use this decoder, a calling application must supply the extra data bytes provided with the WMA data. These are the extra, codec-specific bytes at the end of a WAVEFORMATEX data structure. Transmit these bytes to the decoder using the extradata[_size] fields in AVCodecContext. There should be 4 extra bytes for v1 data and 6 extra bytes for v2 data.

Definition in file wmadec.c.


Define Documentation

#define EXPMAX   ((19+EXPVLCBITS-1)/EXPVLCBITS)

Definition at line 43 of file wmadec.c.

Referenced by decode_exp_vlc().

#define EXPVLCBITS   8

Definition at line 42 of file wmadec.c.

Referenced by decode_exp_vlc(), and wma_decode_init().

#define HGAINMAX   ((13+HGAINVLCBITS-1)/HGAINVLCBITS)

Definition at line 46 of file wmadec.c.

Referenced by wma_decode_block().

#define HGAINVLCBITS   9

Definition at line 45 of file wmadec.c.

Referenced by wma_decode_block(), and wma_decode_init().


Function Documentation

static void decode_exp_lsp ( WMACodecContext s,
int  ch 
) [static]

decode exponents coded with LSP coefficients (same idea as Vorbis)

Definition at line 233 of file wmadec.c.

Referenced by wma_decode_block().

static int decode_exp_vlc ( WMACodecContext s,
int  ch 
) [static]

decode exponents coded with VLC codes

Definition at line 335 of file wmadec.c.

Referenced by wma_decode_block().

static av_cold void flush ( AVCodecContext avctx  )  [static]

Definition at line 949 of file wmadec.c.

static float pow_m1_4 ( WMACodecContext s,
float  x 
) [inline, static]

compute x^-0.25 with an exponent and mantissa table.

We use linear interpolation to reduce the mantissa table size at a small speed expense (linear interpolation approximately doubles the number of bits of precision).

Definition at line 152 of file wmadec.c.

Referenced by wma_lsp_to_curve().

static int wma_decode_block ( WMACodecContext s  )  [static]

Returns:
0 if OK. 1 if last block of frame. return -1 if unrecorrable error.

Definition at line 451 of file wmadec.c.

Referenced by wma_decode_frame().

static int wma_decode_frame ( WMACodecContext s,
int16_t samples 
) [static]

Definition at line 784 of file wmadec.c.

Referenced by wma_decode_superframe().

static int wma_decode_init ( AVCodecContext avctx  )  [static]

Definition at line 82 of file wmadec.c.

static int wma_decode_superframe ( AVCodecContext avctx,
void *  data,
int *  got_frame_ptr,
AVPacket avpkt 
) [static]

Definition at line 821 of file wmadec.c.

static void wma_lsp_to_curve ( WMACodecContext s,
float *  out,
float *  val_max_ptr,
int  n,
float *  lsp 
) [static]

NOTE: We use the same code as Vorbis here.

Todo:
optimize it further with SSE/3Dnow

Definition at line 203 of file wmadec.c.

Referenced by decode_exp_lsp().

static void wma_lsp_to_curve_init ( WMACodecContext s,
int  frame_len 
) [static]

Definition at line 171 of file wmadec.c.

Referenced by wma_decode_init().

static void wma_window ( WMACodecContext s,
float *  out 
) [static]

Apply MDCT window and add into output.

We ensure that when the windows overlap their squared sum is always 1 (MDCT reconstruction rule).

Definition at line 399 of file wmadec.c.

Referenced by wma_decode_block().


Variable Documentation

Initial value:

 {
    .name           = "wmav1",
    .type           = AVMEDIA_TYPE_AUDIO,
    .id             = CODEC_ID_WMAV1,
    .priv_data_size = sizeof(WMACodecContext),
    .init           = wma_decode_init,
    .close          = ff_wma_end,
    .decode         = wma_decode_superframe,
    .flush          = flush,
    .capabilities   = CODEC_CAP_DR1,
    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
}

Definition at line 957 of file wmadec.c.

Initial value:

 {
    .name           = "wmav2",
    .type           = AVMEDIA_TYPE_AUDIO,
    .id             = CODEC_ID_WMAV2,
    .priv_data_size = sizeof(WMACodecContext),
    .init           = wma_decode_init,
    .close          = ff_wma_end,
    .decode         = wma_decode_superframe,
    .flush          = flush,
    .capabilities   = CODEC_CAP_DR1,
    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
}

Definition at line 970 of file wmadec.c.

const float pow_tab[] [static]

pow(10, i / 16.0) for i in -60.

.95

Definition at line 251 of file wmadec.c.


Generated on Fri Oct 26 02:46:11 2012 for FFmpeg by  doxygen 1.5.8