FFmpeg
Data Structures | Macros | Functions | Variables
mpegaudioenc_template.c File Reference
#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "encode.h"
#include "internal.h"
#include "put_bits.h"
#include "mpegaudio.h"
#include "mpegaudiodsp.h"
#include "mpegaudiodata.h"
#include "mpegaudiotab.h"

Go to the source code of this file.

Data Structures

struct  MpegAudioContext
 

Macros

#define FRAC_BITS   15 /* fractional bits for sb_samples and dct */
 
#define WFRAC_BITS   14 /* fractional bits for window */
 
#define MUL(a, b)   (((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS)
 
#define SAMPLES_BUF_SIZE   4096
 
#define P   15
 
#define WSHIFT   (WFRAC_BITS + 15 - FRAC_BITS)
 
#define SB_NOTALLOCATED   0
 
#define SB_ALLOCATED   1
 
#define SB_NOMORE   2
 

Functions

static av_cold int MPA_encode_init (AVCodecContext *avctx)
 
static void idct32 (int *out, int *tab)
 
static void filter (MpegAudioContext *s, int ch, const short *samples, int incr)
 
static void compute_scale_factors (MpegAudioContext *s, unsigned char scale_code[SBLIMIT], unsigned char scale_factors[SBLIMIT][3], int sb_samples[3][12][SBLIMIT], int sblimit)
 
static void psycho_acoustic_model (MpegAudioContext *s, short smr[SBLIMIT])
 
static void compute_bit_allocation (MpegAudioContext *s, short smr1[MPA_MAX_CHANNELS][SBLIMIT], unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT], int *padding)
 
static void encode_frame (MpegAudioContext *s, unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT], int padding)
 
static int MPA_encode_frame (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
 

Variables

static const AVCodecDefault mp2_defaults []
 

Detailed Description

The simplest mpeg audio layer 2 encoder.

Definition in file mpegaudioenc_template.c.

Macro Definition Documentation

◆ FRAC_BITS

#define FRAC_BITS   15 /* fractional bits for sb_samples and dct */

Definition at line 34 of file mpegaudioenc_template.c.

◆ WFRAC_BITS

#define WFRAC_BITS   14 /* fractional bits for window */

Definition at line 35 of file mpegaudioenc_template.c.

◆ MUL

#define MUL (   a,
  b 
)    (((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS)

Definition at line 44 of file mpegaudioenc_template.c.

◆ SAMPLES_BUF_SIZE

#define SAMPLES_BUF_SIZE   4096

Definition at line 46 of file mpegaudioenc_template.c.

◆ P

#define P   15

◆ WSHIFT

#define WSHIFT   (WFRAC_BITS + 15 - FRAC_BITS)

Definition at line 322 of file mpegaudioenc_template.c.

◆ SB_NOTALLOCATED

#define SB_NOTALLOCATED   0

Definition at line 503 of file mpegaudioenc_template.c.

◆ SB_ALLOCATED

#define SB_ALLOCATED   1

Definition at line 504 of file mpegaudioenc_template.c.

◆ SB_NOMORE

#define SB_NOMORE   2

Definition at line 505 of file mpegaudioenc_template.c.

Function Documentation

◆ MPA_encode_init()

static av_cold int MPA_encode_init ( AVCodecContext avctx)
static

Definition at line 77 of file mpegaudioenc_template.c.

◆ idct32()

static void idct32 ( int out,
int tab 
)
static

Definition at line 203 of file mpegaudioenc_template.c.

Referenced by filter().

◆ filter()

static void filter ( MpegAudioContext s,
int  ch,
const short samples,
int  incr 
)
static

Definition at line 324 of file mpegaudioenc_template.c.

Referenced by MPA_encode_frame().

◆ compute_scale_factors()

static void compute_scale_factors ( MpegAudioContext s,
unsigned char  scale_code[SBLIMIT],
unsigned char  scale_factors[SBLIMIT][3],
int  sb_samples[3][12][SBLIMIT],
int  sblimit 
)
static

Definition at line 377 of file mpegaudioenc_template.c.

Referenced by MPA_encode_frame().

◆ psycho_acoustic_model()

static void psycho_acoustic_model ( MpegAudioContext s,
short  smr[SBLIMIT] 
)
static

Definition at line 493 of file mpegaudioenc_template.c.

Referenced by MPA_encode_frame().

◆ compute_bit_allocation()

static void compute_bit_allocation ( MpegAudioContext s,
short  smr1[MPA_MAX_CHANNELS][SBLIMIT],
unsigned char  bit_alloc[MPA_MAX_CHANNELS][SBLIMIT],
int padding 
)
static

Definition at line 510 of file mpegaudioenc_template.c.

Referenced by MPA_encode_frame().

◆ encode_frame()

static void encode_frame ( MpegAudioContext s,
unsigned char  bit_alloc[MPA_MAX_CHANNELS][SBLIMIT],
int  padding 
)
static

Definition at line 606 of file mpegaudioenc_template.c.

Referenced by MPA_encode_frame().

◆ MPA_encode_frame()

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

Definition at line 742 of file mpegaudioenc_template.c.

Variable Documentation

◆ mp2_defaults

const AVCodecDefault mp2_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ NULL },
}

Definition at line 782 of file mpegaudioenc_template.c.

NULL
#define NULL
Definition: coverity.c:32