Skip to content

Commit

Permalink
audio: Implemented SIMD support for audio data type converters.
Browse files Browse the repository at this point in the history
This currently adds an SSE2 implementation (but it's #ifdef'd out for now,
until it's hooked up to the configure script and such).
  • Loading branch information
icculus committed Jan 16, 2017
1 parent 1e66d45 commit 5718293
Show file tree
Hide file tree
Showing 3 changed files with 603 additions and 30 deletions.
4 changes: 4 additions & 0 deletions src/audio/SDL_audio.c
Expand Up @@ -843,6 +843,8 @@ SDL_GetAudioDriver(int index)
return NULL;
}

extern void SDL_ChooseAudioConverters(void);

int
SDL_AudioInit(const char *driver_name)
{
Expand All @@ -857,6 +859,8 @@ SDL_AudioInit(const char *driver_name)
SDL_zero(current_audio);
SDL_zero(open_devices);

SDL_ChooseAudioConverters();

/* Select the proper audio driver */
if (driver_name == NULL) {
driver_name = SDL_getenv("SDL_AUDIODRIVER");
Expand Down
21 changes: 11 additions & 10 deletions src/audio/SDL_audio_c.h
Expand Up @@ -53,16 +53,17 @@ extern SDL_AudioFormat SDL_NextAudioFormat(void);
/* Function to calculate the size and silence for a SDL_AudioSpec */
extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec);

void SDLCALL SDL_Convert_S8_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
void SDLCALL SDL_Convert_U8_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
void SDLCALL SDL_Convert_S16_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
void SDLCALL SDL_Convert_U16_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
void SDLCALL SDL_Convert_S32_to_F32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
void SDLCALL SDL_Convert_F32_to_S8(SDL_AudioCVT *cvt, SDL_AudioFormat format);
void SDLCALL SDL_Convert_F32_to_U8(SDL_AudioCVT *cvt, SDL_AudioFormat format);
void SDLCALL SDL_Convert_F32_to_S16(SDL_AudioCVT *cvt, SDL_AudioFormat format);
void SDLCALL SDL_Convert_F32_to_U16(SDL_AudioCVT *cvt, SDL_AudioFormat format);
void SDLCALL SDL_Convert_F32_to_S32(SDL_AudioCVT *cvt, SDL_AudioFormat format);
/* These pointers get set during init to various SIMD implementations. */
extern SDL_AudioFilter SDL_Convert_S8_to_F32;
extern SDL_AudioFilter SDL_Convert_U8_to_F32;
extern SDL_AudioFilter SDL_Convert_S16_to_F32;
extern SDL_AudioFilter SDL_Convert_U16_to_F32;
extern SDL_AudioFilter SDL_Convert_S32_to_F32;
extern SDL_AudioFilter SDL_Convert_F32_to_S8;
extern SDL_AudioFilter SDL_Convert_F32_to_U8;
extern SDL_AudioFilter SDL_Convert_F32_to_S16;
extern SDL_AudioFilter SDL_Convert_F32_to_U16;
extern SDL_AudioFilter SDL_Convert_F32_to_S32;


/* SDL_AudioStream is a new audio conversion interface. It
Expand Down

0 comments on commit 5718293

Please sign in to comment.