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

The simplest mpeg audio layer 2 encoder. More...

#include "libavutil/channel_layout.h"
#include "avcodec.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

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

Definition at line 33 of file mpegaudioenc_template.c.

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

Definition at line 34 of file mpegaudioenc_template.c.

Referenced by MPA_encode_init().

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

Definition at line 43 of file mpegaudioenc_template.c.

Referenced by idct32().

#define SAMPLES_BUF_SIZE   4096

Definition at line 45 of file mpegaudioenc_template.c.

Referenced by filter().

#define P   15
#define WSHIFT   (WFRAC_BITS + 15 - FRAC_BITS)

Definition at line 321 of file mpegaudioenc_template.c.

Referenced by filter().

#define SB_NOTALLOCATED   0

Definition at line 502 of file mpegaudioenc_template.c.

Referenced by compute_bit_allocation().

#define SB_ALLOCATED   1

Definition at line 503 of file mpegaudioenc_template.c.

Referenced by compute_bit_allocation().

#define SB_NOMORE   2

Definition at line 504 of file mpegaudioenc_template.c.

Referenced by compute_bit_allocation().

Function Documentation

static av_cold int MPA_encode_init ( AVCodecContext avctx)
static

Definition at line 76 of file mpegaudioenc_template.c.

static void idct32 ( int *  out,
int *  tab 
)
static

Definition at line 202 of file mpegaudioenc_template.c.

Referenced by filter().

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

Definition at line 323 of file mpegaudioenc_template.c.

Referenced by apply_ir_filter(), av_resample(), avfilter_graph_dump_to_buf(), avfilter_graph_parse2(), avfilter_graph_parse_ptr(), configure_output_video_filter(), do_video_out(), ff_alsa_get_device_list(), ff_filter_alloc(), filter_3800(), filter_fast_3320(), initFilter(), libAVEnumPins_Cleanup(), libAVEnumPins_Clone(), libAVEnumPins_Setup(), libAVPin_Disconnect(), libAVPin_QueryPinInfo(), libAVPin_ReceiveConnection(), libAVPin_Setup(), main(), make_filters_from_proto(), MPA_encode_frame(), mpegts_open_filter(), mpegts_open_pes_filter(), mpegts_open_section_filter(), predictor_update_3930(), predictor_update_filter(), ps_hybrid_analysis_c(), put_hevc_epel_bi_h(), put_hevc_epel_bi_hv(), put_hevc_epel_bi_v(), put_hevc_epel_bi_w_h(), put_hevc_epel_bi_w_hv(), put_hevc_epel_bi_w_v(), put_hevc_epel_h(), put_hevc_epel_hv(), put_hevc_epel_uni_h(), put_hevc_epel_uni_hv(), put_hevc_epel_uni_v(), put_hevc_epel_uni_w_h(), put_hevc_epel_uni_w_hv(), put_hevc_epel_uni_w_v(), put_hevc_epel_v(), put_hevc_qpel_bi_h(), put_hevc_qpel_bi_hv(), put_hevc_qpel_bi_v(), put_hevc_qpel_bi_w_h(), put_hevc_qpel_bi_w_hv(), put_hevc_qpel_bi_w_v(), put_hevc_qpel_h(), put_hevc_qpel_hv(), put_hevc_qpel_uni_h(), put_hevc_qpel_uni_hv(), put_hevc_qpel_uni_v(), put_hevc_qpel_uni_w_h(), put_hevc_qpel_uni_w_hv(), put_hevc_qpel_uni_w_v(), put_hevc_qpel_v(), query_formats(), read_filter_params(), reap_filters(), resample_common_TMPL(), resample_linear(), resample_linear_TMPL(), resample_one(), set_filter(), show_filters(), sws_getDefaultFilter(), truespeech_apply_twopoint_filter(), tta_decode_frame(), tta_encode_frame(), xa_decode(), and yuv2yuvX_TMPL().

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 376 of file mpegaudioenc_template.c.

Referenced by MPA_encode_frame().

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

Definition at line 492 of file mpegaudioenc_template.c.

Referenced by MPA_encode_frame().

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 509 of file mpegaudioenc_template.c.

Referenced by MPA_encode_frame().

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

Definition at line 605 of file mpegaudioenc_template.c.

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

Definition at line 744 of file mpegaudioenc_template.c.

Variable Documentation

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

Definition at line 781 of file mpegaudioenc_template.c.