FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
vorbisenc.c File Reference

Native Vorbis encoder. More...

#include <float.h>
#include "avcodec.h"
#include "internal.h"
#include "fft.h"
#include "vorbis.h"
#include "vorbis_enc_data.h"
#include "put_bits.h"
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  vorbis_enc_codebook
 
struct  vorbis_enc_floor_class
 
struct  vorbis_enc_floor
 
struct  vorbis_enc_residue
 
struct  vorbis_enc_mapping
 
struct  vorbis_enc_mode
 
struct  vorbis_enc_context
 

Macros

#define BITSTREAM_WRITER_LE
 
#define MAX_CHANNELS   2
 
#define MAX_CODEBOOK_DIM   8
 
#define MAX_FLOOR_CLASS_DIM   4
 
#define NUM_FLOOR_PARTITIONS   8
 
#define MAX_FLOOR_VALUES   (MAX_FLOOR_CLASS_DIM*NUM_FLOOR_PARTITIONS+2)
 
#define RESIDUE_SIZE   1600
 
#define RESIDUE_PART_SIZE   32
 
#define NUM_RESIDUE_PARTITIONS   (RESIDUE_SIZE/RESIDUE_PART_SIZE)
 

Functions

static int put_codeword (PutBitContext *pb, vorbis_enc_codebook *cb, int entry)
 
static int cb_lookup_vals (int lookup, int dimensions, int entries)
 
static int ready_codebook (vorbis_enc_codebook *cb)
 
static int ready_residue (vorbis_enc_residue *rc, vorbis_enc_context *venc)
 
static int create_vorbis_context (vorbis_enc_context *venc, AVCodecContext *avctx)
 
static void put_float (PutBitContext *pb, float f)
 
static void put_codebook_header (PutBitContext *pb, vorbis_enc_codebook *cb)
 
static void put_floor_header (PutBitContext *pb, vorbis_enc_floor *fc)
 
static void put_residue_header (PutBitContext *pb, vorbis_enc_residue *rc)
 
static int put_main_header (vorbis_enc_context *venc, uint8_t **out)
 
static float get_floor_average (vorbis_enc_floor *fc, float *coeffs, int i)
 
static void floor_fit (vorbis_enc_context *venc, vorbis_enc_floor *fc, float *coeffs, uint16_t *posts, int samples)
 
static int render_point (int x0, int y0, int x1, int y1, int x)
 
static int floor_encode (vorbis_enc_context *venc, vorbis_enc_floor *fc, PutBitContext *pb, uint16_t *posts, float *floor, int samples)
 
static float * put_vector (vorbis_enc_codebook *book, PutBitContext *pb, float *num)
 
static int residue_encode (vorbis_enc_context *venc, vorbis_enc_residue *rc, PutBitContext *pb, float *coeffs, int samples, int real_ch)
 
static int apply_window_and_mdct (vorbis_enc_context *venc, float **audio, int samples)
 
static int vorbis_encode_frame (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
 
static av_cold int vorbis_encode_close (AVCodecContext *avctx)
 
static av_cold int vorbis_encode_init (AVCodecContext *avctx)
 

Variables

AVCodec ff_vorbis_encoder
 

Detailed Description

Native Vorbis encoder.

Author
Oded Shimon ods15.nosp@m.@ods.nosp@m.15.dy.nosp@m.ndns.nosp@m..org

Definition in file vorbisenc.c.

Macro Definition Documentation

#define BITSTREAM_WRITER_LE

Definition at line 34 of file vorbisenc.c.

#define MAX_CHANNELS   2

Definition at line 129 of file vorbisenc.c.

Referenced by residue_encode().

#define MAX_CODEBOOK_DIM   8

Definition at line 130 of file vorbisenc.c.

Referenced by residue_encode().

#define MAX_FLOOR_CLASS_DIM   4

Definition at line 132 of file vorbisenc.c.

#define NUM_FLOOR_PARTITIONS   8

Definition at line 133 of file vorbisenc.c.

Referenced by create_vorbis_context().

#define MAX_FLOOR_VALUES   (MAX_FLOOR_CLASS_DIM*NUM_FLOOR_PARTITIONS+2)

Definition at line 134 of file vorbisenc.c.

Referenced by floor_encode(), floor_fit(), and vorbis_encode_frame().

#define RESIDUE_SIZE   1600

Definition at line 136 of file vorbisenc.c.

#define RESIDUE_PART_SIZE   32

Definition at line 137 of file vorbisenc.c.

#define NUM_RESIDUE_PARTITIONS   (RESIDUE_SIZE/RESIDUE_PART_SIZE)

Definition at line 138 of file vorbisenc.c.

Referenced by residue_encode().

Function Documentation

static int put_codeword ( PutBitContext pb,
vorbis_enc_codebook cb,
int  entry 
)
inlinestatic

Definition at line 140 of file vorbisenc.c.

Referenced by floor_encode(), put_vector(), and residue_encode().

static int cb_lookup_vals ( int  lookup,
int  dimensions,
int  entries 
)
static

Definition at line 152 of file vorbisenc.c.

Referenced by create_vorbis_context(), put_codebook_header(), and ready_codebook().

static int ready_codebook ( vorbis_enc_codebook cb)
static

Definition at line 161 of file vorbisenc.c.

Referenced by create_vorbis_context().

static int ready_residue ( vorbis_enc_residue rc,
vorbis_enc_context venc 
)
static

Definition at line 198 of file vorbisenc.c.

Referenced by create_vorbis_context().

static int create_vorbis_context ( vorbis_enc_context venc,
AVCodecContext avctx 
)
static

Definition at line 237 of file vorbisenc.c.

Referenced by vorbis_encode_init().

static void put_float ( PutBitContext pb,
float  f 
)
static

Definition at line 438 of file vorbisenc.c.

Referenced by put_codebook_header().

static void put_codebook_header ( PutBitContext pb,
vorbis_enc_codebook cb 
)
static

Definition at line 452 of file vorbisenc.c.

Referenced by put_main_header().

static void put_floor_header ( PutBitContext pb,
vorbis_enc_floor fc 
)
static

Definition at line 517 of file vorbisenc.c.

Referenced by put_main_header().

static void put_residue_header ( PutBitContext pb,
vorbis_enc_residue rc 
)
static

Definition at line 550 of file vorbisenc.c.

Referenced by put_main_header().

static int put_main_header ( vorbis_enc_context venc,
uint8_t **  out 
)
static

Definition at line 582 of file vorbisenc.c.

Referenced by vorbis_encode_init().

static float get_floor_average ( vorbis_enc_floor fc,
float *  coeffs,
int  i 
)
static

Definition at line 714 of file vorbisenc.c.

Referenced by floor_fit().

static void floor_fit ( vorbis_enc_context venc,
vorbis_enc_floor fc,
float *  coeffs,
uint16_t *  posts,
int  samples 
)
static

Definition at line 726 of file vorbisenc.c.

Referenced by vorbis_encode_frame().

static int render_point ( int  x0,
int  y0,
int  x1,
int  y1,
int  x 
)
static

Definition at line 753 of file vorbisenc.c.

Referenced by floor_encode().

static int floor_encode ( vorbis_enc_context venc,
vorbis_enc_floor fc,
PutBitContext pb,
uint16_t *  posts,
float *  floor,
int  samples 
)
static

Definition at line 758 of file vorbisenc.c.

Referenced by vorbis_encode_frame().

static float* put_vector ( vorbis_enc_codebook book,
PutBitContext pb,
float *  num 
)
static

Definition at line 847 of file vorbisenc.c.

Referenced by residue_encode().

static int residue_encode ( vorbis_enc_context venc,
vorbis_enc_residue rc,
PutBitContext pb,
float *  coeffs,
int  samples,
int  real_ch 
)
static

Definition at line 870 of file vorbisenc.c.

Referenced by vorbis_encode_frame().

static int apply_window_and_mdct ( vorbis_enc_context venc,
float **  audio,
int  samples 
)
static

Definition at line 965 of file vorbisenc.c.

Referenced by vorbis_encode_frame().

static int vorbis_encode_frame ( AVCodecContext avctx,
AVPacket avpkt,
const AVFrame frame,
int *  got_packet_ptr 
)
static

Definition at line 1016 of file vorbisenc.c.

static av_cold int vorbis_encode_close ( AVCodecContext avctx)
static

Definition at line 1102 of file vorbisenc.c.

Referenced by vorbis_encode_init().

static av_cold int vorbis_encode_init ( AVCodecContext avctx)
static

Definition at line 1161 of file vorbisenc.c.

Variable Documentation

AVCodec ff_vorbis_encoder
Initial value:
= {
.name = "vorbis",
.priv_data_size = sizeof(vorbis_enc_context),
.encode2 = vorbis_encode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
}

Definition at line 1193 of file vorbisenc.c.