FFmpeg
Data Structures | Macros | Functions | Variables
qdmc.c File Reference
#include <math.h>
#include <stddef.h>
#include "libavutil/channel_layout.h"
#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "libavutil/tx.h"
#include "avcodec.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "decode.h"
#include "get_bits.h"

Go to the source code of this file.

Data Structures

struct  QDMCTone
 
struct  QDMCContext
 

Macros

#define BITSTREAM_READER_LE
 

Functions

static av_cold void qdmc_init_static_data (void)
 
static void make_noises (QDMCContext *s)
 
static av_cold int qdmc_decode_init (AVCodecContext *avctx)
 
static av_cold int qdmc_decode_close (AVCodecContext *avctx)
 
static int qdmc_get_vlc (GetBitContext *gb, VLC *table, int flag)
 
static int skip_label (QDMCContext *s, GetBitContext *gb)
 
static int read_noise_data (QDMCContext *s, GetBitContext *gb)
 
static void add_tone (QDMCContext *s, int group, int offset, int freq, int stereo_mode, int amplitude, int phase)
 
static int read_wave_data (QDMCContext *s, GetBitContext *gb)
 
static void lin_calc (QDMCContext *s, float amplitude, int node1, int node2, int index)
 
static void add_noise (QDMCContext *s, int ch, int current_subframe)
 
static void add_wave (QDMCContext *s, int offset, int freqs, int group, int stereo_mode, int amp, int phase)
 
static void add_wave0 (QDMCContext *s, int offset, int freqs, int stereo_mode, int amp, int phase)
 
static void add_waves (QDMCContext *s, int current_subframe)
 
static int decode_frame (QDMCContext *s, GetBitContext *gb, int16_t *out)
 
static av_cold void qdmc_flush (AVCodecContext *avctx)
 
static int qdmc_decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
 

Variables

static float sin_table [512]
 
static VLC vtable [6]
 
static const unsigned code_prefix []
 
static const float amplitude_tab [64]
 
static const uint16_t qdmc_nodes [112]
 
static const uint8_t noise_bands_size []
 
static const uint8_t noise_bands_selector []
 
static const uint8_t qdmc_hufftab [][2]
 
static const uint8_t huff_sizes []
 
static const uint8_t huff_bits []
 
const FFCodec ff_qdmc_decoder
 

Macro Definition Documentation

◆ BITSTREAM_READER_LE

#define BITSTREAM_READER_LE

Definition at line 25 of file qdmc.c.

Function Documentation

◆ qdmc_init_static_data()

static av_cold void qdmc_init_static_data ( void  )
static

Definition at line 166 of file qdmc.c.

Referenced by qdmc_decode_init().

◆ make_noises()

static void make_noises ( QDMCContext s)
static

Definition at line 186 of file qdmc.c.

Referenced by qdmc_decode_init().

◆ qdmc_decode_init()

static av_cold int qdmc_decode_init ( AVCodecContext avctx)
static

Definition at line 208 of file qdmc.c.

◆ qdmc_decode_close()

static av_cold int qdmc_decode_close ( AVCodecContext avctx)
static

Definition at line 315 of file qdmc.c.

◆ qdmc_get_vlc()

static int qdmc_get_vlc ( GetBitContext gb,
VLC table,
int  flag 
)
static

Definition at line 324 of file qdmc.c.

Referenced by read_noise_data(), and read_wave_data().

◆ skip_label()

static int skip_label ( QDMCContext s,
GetBitContext gb 
)
static

Definition at line 344 of file qdmc.c.

Referenced by decode_frame().

◆ read_noise_data()

static int read_noise_data ( QDMCContext s,
GetBitContext gb 
)
static

Definition at line 360 of file qdmc.c.

Referenced by decode_frame().

◆ add_tone()

static void add_tone ( QDMCContext s,
int  group,
int  offset,
int  freq,
int  stereo_mode,
int  amplitude,
int  phase 
)
static

Definition at line 408 of file qdmc.c.

Referenced by read_wave_data().

◆ read_wave_data()

static int read_wave_data ( QDMCContext s,
GetBitContext gb 
)
static

Definition at line 425 of file qdmc.c.

Referenced by decode_frame().

◆ lin_calc()

static void lin_calc ( QDMCContext s,
float  amplitude,
int  node1,
int  node2,
int  index 
)
static

Definition at line 487 of file qdmc.c.

Referenced by add_noise().

◆ add_noise()

static void add_noise ( QDMCContext s,
int  ch,
int  current_subframe 
)
static

Definition at line 513 of file qdmc.c.

Referenced by decode_frame().

◆ add_wave()

static void add_wave ( QDMCContext s,
int  offset,
int  freqs,
int  group,
int  stereo_mode,
int  amp,
int  phase 
)
static

Definition at line 547 of file qdmc.c.

Referenced by add_waves().

◆ add_wave0()

static void add_wave0 ( QDMCContext s,
int  offset,
int  freqs,
int  stereo_mode,
int  amp,
int  phase 
)
static

Definition at line 579 of file qdmc.c.

Referenced by add_waves().

◆ add_waves()

static void add_waves ( QDMCContext s,
int  current_subframe 
)
static

Definition at line 597 of file qdmc.c.

Referenced by decode_frame().

◆ decode_frame()

static int decode_frame ( QDMCContext s,
GetBitContext gb,
int16_t *  out 
)
static

Definition at line 621 of file qdmc.c.

Referenced by qdmc_decode_frame().

◆ qdmc_flush()

static av_cold void qdmc_flush ( AVCodecContext avctx)
static

Definition at line 689 of file qdmc.c.

Referenced by qdmc_decode_frame().

◆ qdmc_decode_frame()

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

Definition at line 699 of file qdmc.c.

Variable Documentation

◆ sin_table

float sin_table[512]
static

Definition at line 76 of file qdmc.c.

Referenced by add_wave(), add_wave0(), qdmc_decode_init(), and qdmc_init_static_data().

◆ vtable

VLC vtable[6]
static

Definition at line 77 of file qdmc.c.

Referenced by qdmc_init_static_data(), read_noise_data(), and read_wave_data().

◆ code_prefix

const unsigned code_prefix[]
static
Initial value:
= {
0x0, 0x1, 0x2, 0x3, 0x4, 0x6, 0x8, 0xA,
0xC, 0x10, 0x14, 0x18, 0x1C, 0x24, 0x2C, 0x34,
0x3C, 0x4C, 0x5C, 0x6C, 0x7C, 0x9C, 0xBC, 0xDC,
0xFC, 0x13C, 0x17C, 0x1BC, 0x1FC, 0x27C, 0x2FC, 0x37C,
0x3FC, 0x4FC, 0x5FC, 0x6FC, 0x7FC, 0x9FC, 0xBFC, 0xDFC,
0xFFC, 0x13FC, 0x17FC, 0x1BFC, 0x1FFC, 0x27FC, 0x2FFC, 0x37FC,
0x3FFC, 0x4FFC, 0x5FFC, 0x6FFC, 0x7FFC, 0x9FFC, 0xBFFC, 0xDFFC,
0xFFFC, 0x13FFC, 0x17FFC, 0x1BFFC, 0x1FFFC, 0x27FFC, 0x2FFFC, 0x37FFC,
0x3FFFC
}

Definition at line 79 of file qdmc.c.

Referenced by build_table(), and qdmc_get_vlc().

◆ amplitude_tab

const float amplitude_tab[64]
static
Initial value:
= {
1.18750000f, 1.68359380f, 2.37500000f, 3.36718750f, 4.75000000f,
6.73437500f, 9.50000000f, 13.4687500f, 19.0000000f, 26.9375000f,
38.0000000f, 53.8750000f, 76.0000000f, 107.750000f, 152.000000f,
215.500000f, 304.000000f, 431.000000f, 608.000000f, 862.000000f,
1216.00000f, 1724.00000f, 2432.00000f, 3448.00000f, 4864.00000f,
6896.00000f, 9728.00000f, 13792.0000f, 19456.0000f, 27584.0000f,
38912.0000f, 55168.0000f, 77824.0000f, 110336.000f, 155648.000f,
220672.000f, 311296.000f, 441344.000f, 622592.000f, 882688.000f,
1245184.00f, 1765376.00f, 2490368.00f, 3530752.00f, 4980736.00f,
7061504.00f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}

Definition at line 91 of file qdmc.c.

Referenced by add_noise(), add_wave(), and add_wave0().

◆ qdmc_nodes

const uint16_t qdmc_nodes[112]
static
Initial value:
= {
0, 1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 56, 64,
80, 96, 120, 144, 176, 208, 240, 256,
0, 2, 4, 8, 16, 24, 32, 48, 56, 64, 80, 104,
128, 160, 208, 256, 0, 0, 0, 0, 0,
0, 2, 4, 8, 16, 32, 48, 64, 80, 112, 160, 208,
256, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 8, 16, 32, 48, 64, 96, 144, 208, 256,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 16, 32, 64, 256, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}

Definition at line 104 of file qdmc.c.

Referenced by add_noise(), and make_noises().

◆ noise_bands_size

const uint8_t noise_bands_size[]
static
Initial value:
= {
19, 14, 11, 9, 4, 2, 0
}

Definition at line 117 of file qdmc.c.

Referenced by add_noise(), make_noises(), and read_noise_data().

◆ noise_bands_selector

const uint8_t noise_bands_selector[]
static
Initial value:
= {
4, 3, 2, 1, 0, 0, 0,
}

Definition at line 121 of file qdmc.c.

Referenced by qdmc_decode_init().

◆ qdmc_hufftab

const uint8_t qdmc_hufftab[][2]
static

Definition at line 125 of file qdmc.c.

Referenced by qdmc_init_static_data().

◆ huff_sizes

const uint8_t huff_sizes[]
static
Initial value:
= {
27, 12, 28, 47, 9, 9
}

Definition at line 158 of file qdmc.c.

Referenced by qdmc_init_static_data().

◆ huff_bits

const uint8_t huff_bits[]
static
Initial value:
= {
12, 10, 12, 12, 8, 6
}

Definition at line 162 of file qdmc.c.

Referenced by qdmc_init_static_data().

◆ ff_qdmc_decoder

const FFCodec ff_qdmc_decoder
Initial value:
= {
.p.name = "qdmc",
CODEC_LONG_NAME("QDesign Music Codec 1"),
.p.type = AVMEDIA_TYPE_AUDIO,
.priv_data_size = sizeof(QDMCContext),
.flush = qdmc_flush,
}

Definition at line 731 of file qdmc.c.

qdmc_decode_close
static av_cold int qdmc_decode_close(AVCodecContext *avctx)
Definition: qdmc.c:315
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:287
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
qdmc_decode_init
static av_cold int qdmc_decode_init(AVCodecContext *avctx)
Definition: qdmc.c:208
QDMCContext
Definition: qdmc.c:46
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
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:365
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_CODEC_ID_QDMC
@ AV_CODEC_ID_QDMC
Definition: codec_id.h:490
qdmc_decode_frame
static int qdmc_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: qdmc.c:699
qdmc_flush
static av_cold void qdmc_flush(AVCodecContext *avctx)
Definition: qdmc.c:689