g726.c File Reference
#include <limits.h>
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "put_bits.h"
Include dependency graph for g726.c:

Go to the source code of this file.

Data Structures

struct  Float11
 G.726 11bit float. More...
 
struct  G726Tables
 
struct  G726Context
 

Typedefs

typedef struct Float11 Float11
 G.726 11bit float. More...
 
typedef struct G726Tables G726Tables
 
typedef struct G726Context G726Context
 

Functions

static Float11i2f (int i, Float11 *f)
 
static int16_t mult (Float11 *f1, Float11 *f2)
 
static int sgn (int value)
 
static uint8_t quant (G726Context *c, int d)
 Para 4.2.2 page 18: Adaptive quantizer. More...
 
static int16_t inverse_quant (G726Context *c, int i)
 Para 4.2.3 page 22: Inverse adaptive quantizer. More...
 
static int16_t g726_decode (G726Context *c, int I)
 
static av_cold int g726_reset (G726Context *c)
 

Variables

static const int quant_tbl16 []
 16kbit/s 2bits per sample More...
 
static const int16_t iquant_tbl16 []
 
static const int16_t W_tbl16 []
 
static const uint8_t F_tbl16 []
 
static const int quant_tbl24 []
 24kbit/s 3bits per sample More...
 
static const int16_t iquant_tbl24 []
 
static const int16_t W_tbl24 []
 
static const uint8_t F_tbl24 []
 
static const int quant_tbl32 []
 32kbit/s 4bits per sample More...
 
static const int16_t iquant_tbl32 []
 
static const int16_t W_tbl32 []
 
static const uint8_t F_tbl32 []
 
static const int quant_tbl40 []
 40kbit/s 5bits per sample More...
 
static const int16_t iquant_tbl40 []
 
static const int16_t W_tbl40 []
 
static const uint8_t F_tbl40 []
 
static const G726Tables G726Tables_pool []
 

Typedef Documentation

typedef struct Float11 Float11

G.726 11bit float.

G.726 Standard uses rather odd 11bit floating point arithmentic for numerous occasions. It's a mystery to me why they did it this way instead of simply using 32bit integer arithmetic.

typedef struct G726Context G726Context
typedef struct G726Tables G726Tables

Function Documentation

static int16_t g726_decode ( G726Context c,
int  I 
)
static

Definition at line 193 of file g726.c.

Referenced by g726_reset().

static av_cold int g726_reset ( G726Context c)
static

Definition at line 275 of file g726.c.

static Float11* i2f ( int  i,
Float11 f 
)
inlinestatic

Definition at line 46 of file g726.c.

Referenced by g726_decode().

static int16_t inverse_quant ( G726Context c,
int  i 
)
inlinestatic

Para 4.2.3 page 22: Inverse adaptive quantizer.

Definition at line 183 of file g726.c.

Referenced by g726_decode().

static int16_t mult ( Float11 f1,
Float11 f2 
)
inlinestatic

Definition at line 56 of file g726.c.

Referenced by encode_block(), encode_frame(), g726_decode(), select_palette(), and wma_decode_block().

static uint8_t quant ( G726Context c,
int  d 
)
inlinestatic

Para 4.2.2 page 18: Adaptive quantizer.

Definition at line 157 of file g726.c.

Referenced by g726_reset().

static int sgn ( int  value)
inlinestatic

Definition at line 66 of file g726.c.

Referenced by g726_decode().

Variable Documentation

const uint8_t F_tbl16[]
static
Initial value:
=
{ 0, 7, 7, 0 }

Definition at line 107 of file g726.c.

const uint8_t F_tbl24[]
static
Initial value:
=
{ 0, 1, 2, 7, 7, 2, 1, 0 }

Definition at line 116 of file g726.c.

const uint8_t F_tbl32[]
static
Initial value:
=
{ 0, 0, 0, 1, 1, 1, 3, 7, 7, 3, 1, 1, 1, 0, 0, 0 }

Definition at line 127 of file g726.c.

const uint8_t F_tbl40[]
static
Initial value:
=
{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6,
6, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }

Definition at line 143 of file g726.c.

const G726Tables G726Tables_pool[]
static
Initial value:
=
static const int16_t iquant_tbl32[]
Definition: g726.c:121
static const uint8_t F_tbl32[]
Definition: g726.c:127
static const int quant_tbl40[]
40kbit/s 5bits per sample
Definition: g726.c:130
static const int quant_tbl16[]
16kbit/s 2bits per sample
Definition: g726.c:101
static const uint8_t F_tbl24[]
Definition: g726.c:116
static const int16_t W_tbl32[]
Definition: g726.c:124
static const int quant_tbl24[]
24kbit/s 3bits per sample
Definition: g726.c:110
static const int16_t iquant_tbl16[]
Definition: g726.c:103
static const int16_t W_tbl24[]
Definition: g726.c:114
static const int16_t W_tbl40[]
Definition: g726.c:138
static const int16_t iquant_tbl24[]
Definition: g726.c:112
static const int16_t W_tbl16[]
Definition: g726.c:105
static const uint8_t F_tbl16[]
Definition: g726.c:107
static const int16_t iquant_tbl40[]
Definition: g726.c:133
static const uint8_t F_tbl40[]
Definition: g726.c:143
static const int quant_tbl32[]
32kbit/s 4bits per sample
Definition: g726.c:119

Definition at line 147 of file g726.c.

const int16_t iquant_tbl16[]
static
Initial value:
=
{ 116, 365, 365, 116 }

Definition at line 103 of file g726.c.

const int16_t iquant_tbl24[]
static
Initial value:
=
{ INT16_MIN, 135, 273, 373, 373, 273, 135, INT16_MIN }

Definition at line 112 of file g726.c.

const int16_t iquant_tbl32[]
static
Initial value:
=
{ INT16_MIN, 4, 135, 213, 273, 323, 373, 425,
425, 373, 323, 273, 213, 135, 4, INT16_MIN }

Definition at line 121 of file g726.c.

const int16_t iquant_tbl40[]
static
Initial value:
=
{ INT16_MIN, -66, 28, 104, 169, 224, 274, 318,
358, 395, 429, 459, 488, 514, 539, 566,
566, 539, 514, 488, 459, 429, 395, 358,
318, 274, 224, 169, 104, 28, -66, INT16_MIN }

Definition at line 133 of file g726.c.

const int quant_tbl16[]
static
Initial value:
=
{ 260, INT_MAX }

16kbit/s 2bits per sample

Definition at line 101 of file g726.c.

const int quant_tbl24[]
static
Initial value:
=
{ 7, 217, 330, INT_MAX }

24kbit/s 3bits per sample

Definition at line 110 of file g726.c.

const int quant_tbl32[]
static
Initial value:
=
{ -125, 79, 177, 245, 299, 348, 399, INT_MAX }

32kbit/s 4bits per sample

Definition at line 119 of file g726.c.

const int quant_tbl40[]
static
Initial value:
=
{ -122, -16, 67, 138, 197, 249, 297, 338,
377, 412, 444, 474, 501, 527, 552, INT_MAX }

40kbit/s 5bits per sample

Definition at line 130 of file g726.c.

const int16_t W_tbl16[]
static
Initial value:
=
{ -22, 439, 439, -22 }

Definition at line 105 of file g726.c.

const int16_t W_tbl24[]
static
Initial value:
=
{ -4, 30, 137, 582, 582, 137, 30, -4 }

Definition at line 114 of file g726.c.

const int16_t W_tbl32[]
static
Initial value:
=
{ -12, 18, 41, 64, 112, 198, 355, 1122,
1122, 355, 198, 112, 64, 41, 18, -12}

Definition at line 124 of file g726.c.

const int16_t W_tbl40[]
static
Initial value:
=
{ 14, 14, 24, 39, 40, 41, 58, 100,
141, 179, 219, 280, 358, 440, 529, 696,
696, 529, 440, 358, 280, 219, 179, 141,
100, 58, 41, 40, 39, 24, 14, 14 }

Definition at line 138 of file g726.c.