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 "mathops.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 36 of file vorbisenc.c.

#define MAX_CHANNELS   2

Definition at line 131 of file vorbisenc.c.

Referenced by residue_encode().

#define MAX_CODEBOOK_DIM   8

Definition at line 132 of file vorbisenc.c.

Referenced by residue_encode().

#define MAX_FLOOR_CLASS_DIM   4

Definition at line 134 of file vorbisenc.c.

#define NUM_FLOOR_PARTITIONS   8

Definition at line 135 of file vorbisenc.c.

Referenced by create_vorbis_context().

#define MAX_FLOOR_VALUES   (MAX_FLOOR_CLASS_DIM*NUM_FLOOR_PARTITIONS+2)

Definition at line 136 of file vorbisenc.c.

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

#define RESIDUE_SIZE   1600

Definition at line 138 of file vorbisenc.c.

#define RESIDUE_PART_SIZE   32

Definition at line 139 of file vorbisenc.c.

#define NUM_RESIDUE_PARTITIONS   (RESIDUE_SIZE/RESIDUE_PART_SIZE)

Definition at line 140 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 142 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 154 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 163 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 200 of file vorbisenc.c.

Referenced by create_vorbis_context().

static int create_vorbis_context ( vorbis_enc_context venc,
AVCodecContext avctx 
)
static

Definition at line 239 of file vorbisenc.c.

Referenced by vorbis_encode_init().

static void put_float ( PutBitContext pb,
float  f 
)
static

Definition at line 440 of file vorbisenc.c.

Referenced by put_codebook_header().

static void put_codebook_header ( PutBitContext pb,
vorbis_enc_codebook cb 
)
static

Definition at line 454 of file vorbisenc.c.

Referenced by put_main_header().

static void put_floor_header ( PutBitContext pb,
vorbis_enc_floor fc 
)
static

Definition at line 519 of file vorbisenc.c.

Referenced by put_main_header().

static void put_residue_header ( PutBitContext pb,
vorbis_enc_residue rc 
)
static

Definition at line 552 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 584 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 719 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 731 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 758 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 763 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 852 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 875 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 970 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 1021 of file vorbisenc.c.

static av_cold int vorbis_encode_close ( AVCodecContext avctx)
static

Definition at line 1108 of file vorbisenc.c.

Referenced by vorbis_encode_init().

static av_cold int vorbis_encode_init ( AVCodecContext avctx)
static

Definition at line 1167 of file vorbisenc.c.

Variable Documentation

AVCodec ff_vorbis_encoder
Initial value:
= {
.name = "vorbis",
.long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
.priv_data_size = sizeof(vorbis_enc_context),
.encode2 = vorbis_encode_frame,
}
float, planar
Definition: samplefmt.h:69
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define AV_CODEC_CAP_EXPERIMENTAL
Codec is experimental and is thus avoided in favor of non experimental encoders.
Definition: avcodec.h:1049
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: avcodec.h:1019
static av_cold int vorbis_encode_close(AVCodecContext *avctx)
Definition: vorbisenc.c:1108
static av_cold int vorbis_encode_init(AVCodecContext *avctx)
Definition: vorbisenc.c:1167
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
static int vorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: vorbisenc.c:1021
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:701

Definition at line 1199 of file vorbisenc.c.