FFmpeg
Data Structures | Macros | Functions | Variables
mace.c File Reference
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"
#include "libavutil/common.h"

Go to the source code of this file.

Data Structures

struct  ChannelData
 
struct  MACEContext
 

Macros

#define QT_8S_2_16S(x)   (((x) & 0xFF00) | (((x) >> 8) & 0xFF))
 

Functions

static int16_t mace_broken_clip_int16 (int n)
 MACE version of av_clip_int16(). More...
 
static int16_t read_table (ChannelData *chd, uint8_t val, int tab_idx)
 
static void chomp3 (ChannelData *chd, int16_t *output, uint8_t val, int tab_idx)
 
static void chomp6 (ChannelData *chd, int16_t *output, uint8_t val, int tab_idx)
 
static av_cold int mace_decode_init (AVCodecContext *avctx)
 
static int mace_decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
 

Variables

static const int16_t MACEtab1 [] = {-13, 8, 76, 222, 222, 76, 8, -13}
 
static const int16_t MACEtab3 [] = {-18, 140, 140, -18}
 
static const int16_t MACEtab2 [][4]
 
static const int16_t MACEtab4 [][2]
 
struct {
   const int16_t *   tab1
 
   const int16_t *   tab2
 
   int   stride
 
tabs []
 
const FFCodec ff_mace3_decoder
 
const FFCodec ff_mace6_decoder
 

Detailed Description

MACE decoder.

Definition in file mace.c.

Macro Definition Documentation

◆ QT_8S_2_16S

#define QT_8S_2_16S (   x)    (((x) & 0xFF00) | (((x) >> 8) & 0xFF))

Definition at line 152 of file mace.c.

Function Documentation

◆ mace_broken_clip_int16()

static int16_t mace_broken_clip_int16 ( int  n)
inlinestatic

MACE version of av_clip_int16().

We have to do this to keep binary identical output to the binary decoder.

Definition at line 166 of file mace.c.

Referenced by chomp3(), and chomp6().

◆ read_table()

static int16_t read_table ( ChannelData chd,
uint8_t  val,
int  tab_idx 
)
static

Definition at line 176 of file mace.c.

Referenced by chomp3(), and chomp6().

◆ chomp3()

static void chomp3 ( ChannelData chd,
int16_t *  output,
uint8_t  val,
int  tab_idx 
)
static

Definition at line 191 of file mace.c.

Referenced by mace_decode_frame().

◆ chomp6()

static void chomp6 ( ChannelData chd,
int16_t *  output,
uint8_t  val,
int  tab_idx 
)
static

Definition at line 201 of file mace.c.

Referenced by mace_decode_frame().

◆ mace_decode_init()

static av_cold int mace_decode_init ( AVCodecContext avctx)
static

Definition at line 227 of file mace.c.

◆ mace_decode_frame()

static int mace_decode_frame ( AVCodecContext avctx,
AVFrame frame,
int *  got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 236 of file mace.c.

Variable Documentation

◆ MACEtab1

const int16_t MACEtab1[] = {-13, 8, 76, 222, 222, 76, 8, -13}
static

Definition at line 38 of file mace.c.

◆ MACEtab3

const int16_t MACEtab3[] = {-18, 140, 140, -18}
static

Definition at line 40 of file mace.c.

◆ MACEtab2

const int16_t MACEtab2[][4]
static

Definition at line 42 of file mace.c.

◆ MACEtab4

const int16_t MACEtab4[][2]
static

Definition at line 109 of file mace.c.

◆ tab1

const int16_t* tab1

◆ tab2

const int16_t* tab2

Definition at line 145 of file mace.c.

Referenced by dxv_decompress_cocg(), and ff_acelp_fc_pulse_per_track().

◆ stride

int stride

Definition at line 145 of file mace.c.

Referenced by read_table().

◆ tabs

const { ... } tabs[]
Initial value:
= {
{MACEtab1, &MACEtab2[0][0], 4},
{MACEtab3, &MACEtab4[0][0], 2},
{MACEtab1, &MACEtab2[0][0], 4}
}

Referenced by pretwiddle(), read_table(), twiddle(), and very_broken_op().

◆ ff_mace3_decoder

const FFCodec ff_mace3_decoder
Initial value:
= {
.p.name = "mace3",
CODEC_LONG_NAME("MACE (Macintosh Audio Compression/Expansion) 3:1"),
.p.type = AVMEDIA_TYPE_AUDIO,
.priv_data_size = sizeof(MACEContext),
.p.capabilities = AV_CODEC_CAP_DR1,
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
}

Definition at line 287 of file mace.c.

◆ ff_mace6_decoder

const FFCodec ff_mace6_decoder
Initial value:
= {
.p.name = "mace6",
CODEC_LONG_NAME("MACE (Macintosh Audio Compression/Expansion) 6:1"),
.p.type = AVMEDIA_TYPE_AUDIO,
.priv_data_size = sizeof(MACEContext),
.p.capabilities = AV_CODEC_CAP_DR1,
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
}

Definition at line 300 of file mace.c.

AV_CODEC_ID_MACE6
@ AV_CODEC_ID_MACE6
Definition: codec_id.h:457
MACEtab4
static const int16_t MACEtab4[][2]
Definition: mace.c:109
mace_decode_frame
static int mace_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: mace.c:236
MACEtab2
static const int16_t MACEtab2[][4]
Definition: mace.c:42
AV_CODEC_ID_MACE3
@ AV_CODEC_ID_MACE3
Definition: codec_id.h:456
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
MACEContext
Definition: mace.c:158
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
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:64
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
mace_decode_init
static av_cold int mace_decode_init(AVCodecContext *avctx)
Definition: mace.c:227
MACEtab1
static const int16_t MACEtab1[]
Definition: mace.c:38
MACEtab3
static const int16_t MACEtab3[]
Definition: mace.c:40