PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
upsamplers.c File Reference
#include <stdio.h>
#include "upsamplers.h"
+ Include dependency graph for upsamplers.c:

Go to the source code of this file.

Data Structures

struct  entry_t
 

Typedefs

typedef struct entry_t entry_t
 

Functions

static void demux (short *mux, short *left, short *right, int len)
 
static int up_12000_16_stereo (struct upsample_t *up)
 
static int up_24000_16_stereo (struct upsample_t *up)
 
static void up_generic_16_stereo (struct upsample_t *up, const short *lut)
 
static void up_generic_16_mono (struct upsample_t *up, const short *lut)
 
static void up_generic_8_mono (struct upsample_t *up, const short *lut)
 
static void up_generic_8_stereo (struct upsample_t *up, const short *lut)
 
static int up_11025_8_mono (struct upsample_t *up)
 
static int up_11025_8_stereo (struct upsample_t *up)
 
static int up_11025_16_mono (struct upsample_t *up)
 
static int up_11025_16_stereo (struct upsample_t *up)
 
static int up_22050_8_mono (struct upsample_t *up)
 
static int up_22050_16_mono (struct upsample_t *up)
 
static int up_22050_16_stereo (struct upsample_t *up)
 
static int up_32000_8_mono (struct upsample_t *up)
 
static int up_32000_16_mono (struct upsample_t *up)
 
static int up_32000_16_stereo (struct upsample_t *up)
 
static int up_44100_8_mono (struct upsample_t *up)
 
static int up_44100_16_mono (struct upsample_t *up)
 
static int up_44100_16_stereo (struct upsample_t *up)
 
static int up_48000_16_mono (struct upsample_t *up)
 
static int up_48000_16_stereo (struct upsample_t *up)
 
upsampler_t find_upsampler (int freq, int bits, int channels)
 

Variables

static const short int up_11025_lut [512]
 
static const short up_22050_lut [512]
 
static const short up_32000_lut [512]
 
static const short up_44100_lut [512]
 
static entry_t upsamplers []
 

Detailed Description

audsrv IOP-side upsamplers

Definition in file upsamplers.c.


Data Structure Documentation

◆ entry_t

struct entry_t

Definition at line 591 of file upsamplers.c.

+ Collaboration diagram for entry_t:
Data Fields
int freq

source frequency

int bits

source sample bit count

int channels

source number of channels

upsampler_t func

upsamplers to convert to native

Function Documentation

◆ demux()

static void demux ( short *  mux,
short *  left,
short *  right,
int  len 
)
static

Demux, split interleaved audio to left and right

Parameters
muxsource buffer
leftleft channel destination buffer
rightright channel destination buffer
lennumber of samples to copy

Definition at line 370 of file upsamplers.c.

◆ up_12000_16_stereo()

static int up_12000_16_stereo ( struct upsample_t up)
static

Definition at line 380 of file upsamplers.c.

◆ up_24000_16_stereo()

static int up_24000_16_stereo ( struct upsample_t up)
static

Definition at line 402 of file upsamplers.c.

◆ up_generic_16_stereo()

static void up_generic_16_stereo ( struct upsample_t up,
const short *  lut 
)
static

Definition at line 420 of file upsamplers.c.

◆ up_generic_16_mono()

static void up_generic_16_mono ( struct upsample_t up,
const short *  lut 
)
static

Definition at line 437 of file upsamplers.c.

◆ up_generic_8_mono()

static void up_generic_8_mono ( struct upsample_t up,
const short *  lut 
)
static

Definition at line 453 of file upsamplers.c.

◆ up_generic_8_stereo()

static void up_generic_8_stereo ( struct upsample_t up,
const short *  lut 
)
static

Definition at line 471 of file upsamplers.c.

◆ up_11025_8_mono()

static int up_11025_8_mono ( struct upsample_t up)
static

Definition at line 491 of file upsamplers.c.

◆ up_11025_8_stereo()

static int up_11025_8_stereo ( struct upsample_t up)
static

Definition at line 497 of file upsamplers.c.

◆ up_11025_16_mono()

static int up_11025_16_mono ( struct upsample_t up)
static

Definition at line 503 of file upsamplers.c.

◆ up_11025_16_stereo()

static int up_11025_16_stereo ( struct upsample_t up)
static

Definition at line 509 of file upsamplers.c.

◆ up_22050_8_mono()

static int up_22050_8_mono ( struct upsample_t up)
static

Definition at line 515 of file upsamplers.c.

◆ up_22050_16_mono()

static int up_22050_16_mono ( struct upsample_t up)
static

Definition at line 521 of file upsamplers.c.

◆ up_22050_16_stereo()

static int up_22050_16_stereo ( struct upsample_t up)
static

Definition at line 527 of file upsamplers.c.

◆ up_32000_8_mono()

static int up_32000_8_mono ( struct upsample_t up)
static

Definition at line 533 of file upsamplers.c.

◆ up_32000_16_mono()

static int up_32000_16_mono ( struct upsample_t up)
static

Definition at line 539 of file upsamplers.c.

◆ up_32000_16_stereo()

static int up_32000_16_stereo ( struct upsample_t up)
static

Definition at line 545 of file upsamplers.c.

◆ up_44100_8_mono()

static int up_44100_8_mono ( struct upsample_t up)
static

Definition at line 551 of file upsamplers.c.

◆ up_44100_16_mono()

static int up_44100_16_mono ( struct upsample_t up)
static

Definition at line 557 of file upsamplers.c.

◆ up_44100_16_stereo()

static int up_44100_16_stereo ( struct upsample_t up)
static

Definition at line 563 of file upsamplers.c.

◆ up_48000_16_mono()

static int up_48000_16_mono ( struct upsample_t up)
static

Definition at line 569 of file upsamplers.c.

◆ up_48000_16_stereo()

static int up_48000_16_stereo ( struct upsample_t up)
static

Definition at line 584 of file upsamplers.c.

◆ find_upsampler()

upsampler_t find_upsampler ( int  freq,
int  bits,
int  channels 
)

Returns an upsampler from a specified format to SPU2's native

Parameters
freqfrequency used
bitsbits per sample
channelsnumber of audio channels
Returns
a function to be used for upsampling, null if not found

Will return a function to convert source audio to Playstation's native. Note a very limited selection of upsamplers are available, only the most commonly used.

Definition at line 636 of file upsamplers.c.

References entry_t::bits, entry_t::channels, entry_t::freq, and upsamplers.

Referenced by audsrv_format_ok(), cdda_procedure(), and play_thread().

Variable Documentation

◆ up_11025_lut

const short int up_11025_lut[512]
static

lut for converting 11025 -> 48000

Definition at line 90 of file upsamplers.c.

◆ up_22050_lut

const short up_22050_lut[512]
static

lut for converting 22050 -> 48000

Definition at line 159 of file upsamplers.c.

◆ up_32000_lut

const short up_32000_lut[512]
static

lut for converting 32000 -> 48000

Definition at line 228 of file upsamplers.c.

◆ up_44100_lut

const short up_44100_lut[512]
static

lut for converting 44100 -> 48000

Definition at line 296 of file upsamplers.c.

◆ upsamplers

entry_t upsamplers[]
static
Initial value:
=
{
{11025, 8, 1, up_11025_8_mono},
{11025, 8, 2, up_11025_8_stereo},
{11025, 16, 1, up_11025_16_mono},
{11025, 16, 2, up_11025_16_stereo},
{12000, 16, 2, up_12000_16_stereo},
{22050, 8, 1, up_22050_8_mono},
{22050, 16, 1, up_22050_16_mono},
{22050, 16, 2, up_22050_16_stereo},
{24000, 16, 2, up_24000_16_stereo},
{32000, 8, 1, up_32000_8_mono},
{32000, 16, 1, up_32000_16_mono},
{32000, 16, 2, up_32000_16_stereo},
{44100, 8, 1, up_44100_8_mono},
{44100, 16, 1, up_44100_16_mono},
{44100, 16, 2, up_44100_16_stereo},
{48000, 16, 1, up_48000_16_mono},
{48000, 16, 2, up_48000_16_stereo},
{0, 0, 0, 0}
}

supported upsamplers

Definition at line 604 of file upsamplers.c.

Referenced by find_upsampler().