libavcodec/wmalosslessdec.c File Reference

#include "libavutil/attributes.h"
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "put_bits.h"
#include "wma.h"
#include "wma_common.h"

Go to the source code of this file.

Data Structures

struct  WmallChannelCtx
 frame-specific decoder context for a single channel More...
struct  WmallDecodeCtx
 main decoder context More...

Defines

#define WMALL_MAX_CHANNELS   8
 current decoder limitations
#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 MAX_ORDER   256
#define WMALL_BLOCK_MIN_BITS   6
 log2 of min block size
#define WMALL_BLOCK_MAX_BITS   12
 log2 of max block size
#define WMALL_BLOCK_MAX_SIZE   (1 << WMALL_BLOCK_MAX_BITS)
 maximum block size
#define WMALL_BLOCK_SIZES   (WMALL_BLOCK_MAX_BITS - WMALL_BLOCK_MIN_BITS + 1)
 possible block sizes

Functions

static av_cold int decode_init (AVCodecContext *avctx)
static int decode_subframe_length (WmallDecodeCtx *s, int offset)
 Decode the subframe length.
static int decode_tilehdr (WmallDecodeCtx *s)
 Decode how the data in the frame is split into subframes.
static void decode_ac_filter (WmallDecodeCtx *s)
static void decode_mclms (WmallDecodeCtx *s)
static int decode_cdlms (WmallDecodeCtx *s)
static int decode_channel_residues (WmallDecodeCtx *s, int ch, int tile_size)
static void decode_lpc (WmallDecodeCtx *s)
static void clear_codec_buffers (WmallDecodeCtx *s)
static void reset_codec (WmallDecodeCtx *s)
 Reset filter parameters and transient area at new seekable tile.
static void mclms_update (WmallDecodeCtx *s, int icoef, int *pred)
static void mclms_predict (WmallDecodeCtx *s, int icoef, int *pred)
static void revert_mclms (WmallDecodeCtx *s, int tile_size)
static int lms_predict (WmallDecodeCtx *s, int ich, int ilms)
static void lms_update (WmallDecodeCtx *s, int ich, int ilms, int input, int residue)
static void use_high_update_speed (WmallDecodeCtx *s, int ich)
static void use_normal_update_speed (WmallDecodeCtx *s, int ich)
static void revert_cdlms (WmallDecodeCtx *s, int ch, int coef_begin, int coef_end)
static void revert_inter_ch_decorr (WmallDecodeCtx *s, int tile_size)
static void revert_acfilter (WmallDecodeCtx *s, int tile_size)
static int decode_subframe (WmallDecodeCtx *s)
static int decode_frame (WmallDecodeCtx *s)
 Decode one WMA frame.
static int remaining_bits (WmallDecodeCtx *s, GetBitContext *gb)
 Calculate remaining input buffer length.
static void save_bits (WmallDecodeCtx *s, GetBitContext *gb, int len, int append)
 Fill the bit reservoir with a (partial) frame.
static int decode_packet (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
static void flush (AVCodecContext *avctx)

Variables

AVCodec ff_wmalossless_decoder


Define Documentation

#define MAX_BANDS   29

max number of scale factor bands

Definition at line 36 of file wmalosslessdec.c.

Referenced by decode_init().

#define MAX_FRAMESIZE   32768

#define MAX_ORDER   256

Definition at line 38 of file wmalosslessdec.c.

#define MAX_SUBFRAMES   32

max number of subframes per channel

Definition at line 35 of file wmalosslessdec.c.

Referenced by decode_init(), and decode_tilehdr().

#define WMALL_BLOCK_MAX_BITS   12

log2 of max block size

Definition at line 41 of file wmalosslessdec.c.

Referenced by decode_init().

#define WMALL_BLOCK_MAX_SIZE   (1 << WMALL_BLOCK_MAX_BITS)

maximum block size

Definition at line 42 of file wmalosslessdec.c.

#define WMALL_BLOCK_MIN_BITS   6

log2 of min block size

Definition at line 40 of file wmalosslessdec.c.

#define WMALL_BLOCK_SIZES   (WMALL_BLOCK_MAX_BITS - WMALL_BLOCK_MIN_BITS + 1)

possible block sizes

Definition at line 43 of file wmalosslessdec.c.

#define WMALL_MAX_CHANNELS   8

current decoder limitations

max number of handled channels

Definition at line 34 of file wmalosslessdec.c.

Referenced by decode_init(), decode_tilehdr(), and revert_mclms().


Function Documentation

static void clear_codec_buffers ( WmallDecodeCtx s  )  [static]

Definition at line 553 of file wmalosslessdec.c.

Referenced by decode_subframe().

static void decode_ac_filter ( WmallDecodeCtx s  )  [static]

Definition at line 403 of file wmalosslessdec.c.

Referenced by decode_subframe().

static int decode_cdlms ( WmallDecodeCtx s  )  [static]

Definition at line 436 of file wmalosslessdec.c.

Referenced by decode_subframe().

static int decode_channel_residues ( WmallDecodeCtx s,
int  ch,
int  tile_size 
) [static]

Definition at line 482 of file wmalosslessdec.c.

Referenced by decode_subframe().

static int decode_frame ( WmallDecodeCtx s  )  [static]

Decode one WMA frame.

Parameters:
s codec context
Returns:
0 if the trailer bit indicates that this is the last frame, 1 if there are additional frames

Definition at line 1014 of file wmalosslessdec.c.

static av_cold int decode_init ( AVCodecContext avctx  )  [static]

Definition at line 172 of file wmalosslessdec.c.

static void decode_lpc ( WmallDecodeCtx s  )  [static]

Definition at line 541 of file wmalosslessdec.c.

Referenced by decode_subframe().

static void decode_mclms ( WmallDecodeCtx s  )  [static]

Definition at line 413 of file wmalosslessdec.c.

Referenced by decode_subframe().

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

Definition at line 1167 of file wmalosslessdec.c.

static int decode_subframe ( WmallDecodeCtx s  )  [static]

Definition at line 838 of file wmalosslessdec.c.

static int decode_subframe_length ( WmallDecodeCtx s,
int  offset 
) [static]

Decode the subframe length.

Parameters:
s context
offset sample offset in the frame
Returns:
decoded subframe length on success, < 0 in case of an error

Definition at line 276 of file wmalosslessdec.c.

Referenced by decode_tilehdr().

static int decode_tilehdr ( WmallDecodeCtx s  )  [static]

Decode how the data in the frame is split into subframes.

Every WMA frame contains the encoded data for a fixed number of samples per channel. The data for every channel might be split into several subframes. This function will reconstruct the list of subframes for every channel.

If the subframes are not evenly split, the algorithm estimates the channels with the lowest number of total samples. Afterwards, for each of these channels a bit is read from the bitstream that indicates if the channel contains a subframe with the next subframe size that is going to be read from the bitstream or not. If a channel contains such a subframe, the subframe size gets added to the channel's subframe list. The algorithm repeats these steps until the frame is properly divided between the individual channels.

Parameters:
s context
Returns:
0 on success, < 0 in case of an error

Definition at line 318 of file wmalosslessdec.c.

Referenced by decode_frame().

static void flush ( AVCodecContext avctx  )  [static]

Definition at line 1276 of file wmalosslessdec.c.

static int lms_predict ( WmallDecodeCtx s,
int  ich,
int  ilms 
) [static]

Definition at line 686 of file wmalosslessdec.c.

Referenced by revert_cdlms().

static void lms_update ( WmallDecodeCtx s,
int  ich,
int  ilms,
int  input,
int  residue 
) [static]

Definition at line 698 of file wmalosslessdec.c.

Referenced by revert_cdlms().

static void mclms_predict ( WmallDecodeCtx s,
int  icoef,
int pred 
) [static]

Definition at line 655 of file wmalosslessdec.c.

Referenced by revert_mclms().

static void mclms_update ( WmallDecodeCtx s,
int  icoef,
int pred 
) [static]

Definition at line 597 of file wmalosslessdec.c.

Referenced by revert_mclms().

static int remaining_bits ( WmallDecodeCtx s,
GetBitContext gb 
) [static]

Calculate remaining input buffer length.

Parameters:
s codec context
gb bitstream reader context
Returns:
remaining size in bits

Definition at line 1111 of file wmalosslessdec.c.

Referenced by decode_packet().

static void reset_codec ( WmallDecodeCtx s  )  [static]

Reset filter parameters and transient area at new seekable tile.

Definition at line 582 of file wmalosslessdec.c.

Referenced by decode_subframe().

static void revert_acfilter ( WmallDecodeCtx s,
int  tile_size 
) [static]

Definition at line 806 of file wmalosslessdec.c.

Referenced by decode_subframe().

static void revert_cdlms ( WmallDecodeCtx s,
int  ch,
int  coef_begin,
int  coef_end 
) [static]

Definition at line 775 of file wmalosslessdec.c.

Referenced by decode_subframe().

static void revert_inter_ch_decorr ( WmallDecodeCtx s,
int  tile_size 
) [static]

Definition at line 793 of file wmalosslessdec.c.

Referenced by decode_subframe().

static void revert_mclms ( WmallDecodeCtx s,
int  tile_size 
) [static]

Definition at line 677 of file wmalosslessdec.c.

Referenced by decode_subframe().

static void save_bits ( WmallDecodeCtx s,
GetBitContext gb,
int  len,
int  append 
) [static]

Fill the bit reservoir with a (partial) frame.

Parameters:
s codec context
gb bitstream reader context
len length of the partial frame
append decides whether to reset the buffer or not

Definition at line 1123 of file wmalosslessdec.c.

Referenced by decode_packet().

static void use_high_update_speed ( WmallDecodeCtx s,
int  ich 
) [static]

Definition at line 740 of file wmalosslessdec.c.

Referenced by decode_subframe().

static void use_normal_update_speed ( WmallDecodeCtx s,
int  ich 
) [static]

Definition at line 758 of file wmalosslessdec.c.

Referenced by decode_subframe().


Variable Documentation

Initial value:

 {
    .name           = "wmalossless",
    .type           = AVMEDIA_TYPE_AUDIO,
    .id             = AV_CODEC_ID_WMALOSSLESS,
    .priv_data_size = sizeof(WmallDecodeCtx),
    .init           = decode_init,
    .decode         = decode_packet,
    .flush          = flush,
    .capabilities   = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1 | CODEC_CAP_DELAY,
    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio Lossless"),
}

Definition at line 1289 of file wmalosslessdec.c.


Generated on Fri Oct 26 02:50:08 2012 for FFmpeg by  doxygen 1.5.8