Data Structures | Defines | Typedefs | Functions | Variables

libavcodec/sonic.c File Reference

Simple free lossless/lossy audio codec Based on Paul Francis Harrison's Bonk (http://www.logarithmic.net/pfh/bonk) Written and designed by Alex Beregszaszi. More...

#include "avcodec.h"
#include "get_bits.h"
#include "golomb.h"

Go to the source code of this file.

Data Structures

struct  SonicContext

Defines

#define MAX_CHANNELS   2
#define MID_SIDE   0
#define LEFT_SIDE   1
#define RIGHT_SIDE   2
#define LATTICE_SHIFT   10
#define SAMPLE_SHIFT   4
#define LATTICE_FACTOR   (1 << LATTICE_SHIFT)
#define SAMPLE_FACTOR   (1 << SAMPLE_SHIFT)
#define BASE_QUANT   0.6
#define RATE_VARIATION   3.0

Typedefs

typedef struct SonicContext SonicContext

Functions

static int divide (int a, int b)
static int shift (int a, int b)
static int shift_down (int a, int b)
static int intlist_write (PutBitContext *pb, int *buf, int entries, int base_2_part)
static int intlist_read (GetBitContext *gb, int *buf, int entries, int base_2_part)
static void predictor_init_state (int *k, int *state, int order)
static int predictor_calc_error (int *k, int *state, int order, int error)
static void modified_levinson_durbin (int *window, int window_entries, int *out, int out_entries, int channels, int *tap_quant)
static int code_samplerate (int samplerate)
static av_cold int sonic_encode_init (AVCodecContext *avctx)
static av_cold int sonic_encode_close (AVCodecContext *avctx)
static int sonic_encode_frame (AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data)
static av_cold int sonic_decode_init (AVCodecContext *avctx)
static av_cold int sonic_decode_close (AVCodecContext *avctx)
static int sonic_decode_frame (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)

Variables

static const int samplerate_table []
AVCodec ff_sonic_decoder
AVCodec ff_sonic_encoder
AVCodec ff_sonic_ls_encoder

Detailed Description

Simple free lossless/lossy audio codec Based on Paul Francis Harrison's Bonk (http://www.logarithmic.net/pfh/bonk) Written and designed by Alex Beregszaszi.

TODO:

Definition in file sonic.c.


Define Documentation

#define BASE_QUANT   0.6

Definition at line 74 of file sonic.c.

Referenced by sonic_encode_frame().

#define LATTICE_FACTOR   (1 << LATTICE_SHIFT)

Definition at line 71 of file sonic.c.

Referenced by modified_levinson_durbin().

#define LATTICE_SHIFT   10

Definition at line 69 of file sonic.c.

Referenced by modified_levinson_durbin(), predictor_calc_error(), and predictor_init_state().

#define LEFT_SIDE   1

Definition at line 43 of file sonic.c.

Referenced by sonic_decode_frame(), and sonic_encode_frame().

#define MAX_CHANNELS   2

Definition at line 40 of file sonic.c.

Referenced by sonic_decode_init(), and sonic_encode_init().

#define MID_SIDE   0

Definition at line 42 of file sonic.c.

Referenced by sonic_decode_frame(), and sonic_encode_frame().

#define RATE_VARIATION   3.0

Definition at line 75 of file sonic.c.

Referenced by sonic_encode_frame().

#define RIGHT_SIDE   2

Definition at line 44 of file sonic.c.

Referenced by sonic_decode_frame(), and sonic_encode_frame().

#define SAMPLE_FACTOR   (1 << SAMPLE_SHIFT)

Definition at line 72 of file sonic.c.

Referenced by predictor_calc_error(), and sonic_encode_frame().

#define SAMPLE_SHIFT   4

Definition at line 70 of file sonic.c.

Referenced by sonic_decode_frame(), sonic_encode_frame(), and sonic_encode_init().


Typedef Documentation

typedef struct SonicContext SonicContext

Function Documentation

static int code_samplerate ( int  samplerate  )  [inline, static]

Definition at line 483 of file sonic.c.

Referenced by sonic_encode_init().

static int divide ( int  a,
int  b 
) [inline, static]

Definition at line 77 of file sonic.c.

Referenced by sonic_encode_frame().

static int intlist_read ( GetBitContext gb,
int *  buf,
int  entries,
int  base_2_part 
) [inline, static]

Definition at line 106 of file sonic.c.

Referenced by sonic_decode_frame().

static int intlist_write ( PutBitContext pb,
int *  buf,
int  entries,
int  base_2_part 
) [inline, static]

Definition at line 96 of file sonic.c.

Referenced by sonic_encode_frame().

static void modified_levinson_durbin ( int *  window,
int  window_entries,
int *  out,
int  out_entries,
int  channels,
int *  tap_quant 
) [static]

Definition at line 416 of file sonic.c.

Referenced by sonic_encode_frame().

static int predictor_calc_error ( int *  k,
int *  state,
int  order,
int  error 
) [static]

Definition at line 381 of file sonic.c.

Referenced by sonic_decode_frame().

static void predictor_init_state ( int *  k,
int *  state,
int  order 
) [static]

Definition at line 364 of file sonic.c.

Referenced by sonic_decode_frame().

static int shift ( int  a,
int  b 
) [inline, static]
static int shift_down ( int  a,
int  b 
) [inline, static]

Definition at line 90 of file sonic.c.

Referenced by modified_levinson_durbin(), predictor_calc_error(), and predictor_init_state().

static av_cold int sonic_decode_close ( AVCodecContext avctx  )  [static]

Definition at line 832 of file sonic.c.

static int sonic_decode_frame ( AVCodecContext avctx,
void *  data,
int *  data_size,
AVPacket avpkt 
) [static]

Definition at line 850 of file sonic.c.

static av_cold int sonic_decode_init ( AVCodecContext avctx  )  [static]

Definition at line 751 of file sonic.c.

static av_cold int sonic_encode_close ( AVCodecContext avctx  )  [static]

Definition at line 605 of file sonic.c.

static int sonic_encode_frame ( AVCodecContext avctx,
uint8_t *  buf,
int  buf_size,
void *  data 
) [static]

Definition at line 624 of file sonic.c.

static av_cold int sonic_encode_init ( AVCodecContext avctx  )  [static]

Definition at line 500 of file sonic.c.


Variable Documentation

Initial value:
 {
    "sonic",
    AVMEDIA_TYPE_AUDIO,
    CODEC_ID_SONIC,
    sizeof(SonicContext),
    sonic_decode_init,
    NULL,
    sonic_decode_close,
    sonic_decode_frame,
    .long_name = NULL_IF_CONFIG_SMALL("Sonic"),
}

Definition at line 938 of file sonic.c.

Initial value:
 {
    "sonic",
    AVMEDIA_TYPE_AUDIO,
    CODEC_ID_SONIC,
    sizeof(SonicContext),
    sonic_encode_init,
    sonic_encode_frame,
    sonic_encode_close,
    NULL,
    .long_name = NULL_IF_CONFIG_SMALL("Sonic"),
}

Definition at line 952 of file sonic.c.

Initial value:
 {
    "sonicls",
    AVMEDIA_TYPE_AUDIO,
    CODEC_ID_SONIC_LS,
    sizeof(SonicContext),
    sonic_encode_init,
    sonic_encode_frame,
    sonic_encode_close,
    NULL,
    .long_name = NULL_IF_CONFIG_SMALL("Sonic lossless"),
}

Definition at line 966 of file sonic.c.

const int samplerate_table[] [static]
Initial value:
    { 44100, 22050, 11025, 96000, 48000, 32000, 24000, 16000, 8000 }

Definition at line 748 of file sonic.c.