FFmpeg
Data Structures | Macros | Functions | Variables
metasound.c File Reference
#include <inttypes.h>
#include <math.h>
#include <stdint.h>
#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "get_bits.h"
#include "twinvq.h"
#include "metasound_data.h"

Go to the source code of this file.

Data Structures

struct  MetasoundProps
 

Macros

#define BITSTREAM_READER_LE
 

Functions

static void add_peak (float period, int width, const float *shape, float ppc_gain, float *speech, int len)
 
static void decode_ppc (TwinVQContext *tctx, int period_coef, int g_coef, const float *shape, float *speech)
 
static void dec_bark_env (TwinVQContext *tctx, const uint8_t *in, int use_hist, int ch, float *out, float gain, enum TwinVQFrameType ftype)
 
static void read_cb_data (TwinVQContext *tctx, GetBitContext *gb, uint8_t *dst, enum TwinVQFrameType ftype)
 
static int metasound_read_bitstream (AVCodecContext *avctx, TwinVQContext *tctx, const uint8_t *buf, int buf_size)
 
static av_cold int metasound_decode_init (AVCodecContext *avctx)
 

Variables

static const MetasoundProps codec_props []
 
const FFCodec ff_metasound_decoder
 

Macro Definition Documentation

◆ BITSTREAM_READER_LE

#define BITSTREAM_READER_LE

Definition at line 30 of file metasound.c.

Function Documentation

◆ add_peak()

static void add_peak ( float  period,
int  width,
const float shape,
float  ppc_gain,
float speech,
int  len 
)
static

Definition at line 38 of file metasound.c.

Referenced by decode_ppc().

◆ decode_ppc()

static void decode_ppc ( TwinVQContext tctx,
int  period_coef,
int  g_coef,
const float shape,
float speech 
)
static

Definition at line 60 of file metasound.c.

Referenced by metasound_decode_init().

◆ dec_bark_env()

static void dec_bark_env ( TwinVQContext tctx,
const uint8_t *  in,
int  use_hist,
int  ch,
float out,
float  gain,
enum TwinVQFrameType  ftype 
)
static

Definition at line 112 of file metasound.c.

Referenced by metasound_decode_init().

◆ read_cb_data()

static void read_cb_data ( TwinVQContext tctx,
GetBitContext gb,
uint8_t *  dst,
enum TwinVQFrameType  ftype 
)
static

Definition at line 150 of file metasound.c.

Referenced by metasound_read_bitstream().

◆ metasound_read_bitstream()

static int metasound_read_bitstream ( AVCodecContext avctx,
TwinVQContext tctx,
const uint8_t *  buf,
int  buf_size 
)
static

Definition at line 163 of file metasound.c.

Referenced by metasound_decode_init().

◆ metasound_decode_init()

static av_cold int metasound_decode_init ( AVCodecContext avctx)
static

Definition at line 271 of file metasound.c.

Variable Documentation

◆ codec_props

const MetasoundProps codec_props[]
static
Initial value:
= {
{ MKTAG('V','X','0','3'), 6, 1, 8000 },
{ MKTAG('V','X','0','4'), 12, 2, 8000 },
{ MKTAG('V','O','X','i'), 8, 1, 8000 },
{ MKTAG('V','O','X','j'), 10, 1, 11025 },
{ MKTAG('V','O','X','k'), 16, 1, 16000 },
{ MKTAG('V','O','X','L'), 24, 1, 22050 },
{ MKTAG('V','O','X','q'), 32, 1, 44100 },
{ MKTAG('V','O','X','r'), 40, 1, 44100 },
{ MKTAG('V','O','X','s'), 48, 1, 44100 },
{ MKTAG('V','O','X','t'), 16, 2, 8000 },
{ MKTAG('V','O','X','u'), 20, 2, 11025 },
{ MKTAG('V','O','X','v'), 32, 2, 16000 },
{ MKTAG('V','O','X','w'), 48, 2, 22050 },
{ MKTAG('V','O','X','x'), 64, 2, 44100 },
{ MKTAG('V','O','X','y'), 80, 2, 44100 },
{ MKTAG('V','O','X','z'), 96, 2, 44100 },
{ 0, 0, 0, 0 }
}

Definition at line 249 of file metasound.c.

Referenced by metasound_decode_init().

◆ ff_metasound_decoder

const FFCodec ff_metasound_decoder
Initial value:
= {
.p.name = "metasound",
CODEC_LONG_NAME("Voxware MetaSound"),
.p.type = AVMEDIA_TYPE_AUDIO,
.priv_data_size = sizeof(TwinVQContext),
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}

Definition at line 367 of file metasound.c.

AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:311
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
ff_twinvq_decode_close
av_cold int ff_twinvq_decode_close(AVCodecContext *avctx)
Definition: twinvq.c:745
ff_twinvq_decode_frame
int ff_twinvq_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: twinvq.c:480
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:106
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
metasound_decode_init
static av_cold int metasound_decode_init(AVCodecContext *avctx)
Definition: metasound.c:271
AV_CODEC_ID_METASOUND
@ AV_CODEC_ID_METASOUND
Definition: codec_id.h:509
TwinVQContext
Definition: twinvq.h:137
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55