Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
36bd1374
Commit
36bd1374
authored
Dec 29, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make FLAC decoding a bit more efficient for s16 and f32.
parent
d8a0fd09
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
mini_al.h
mini_al.h
+18
-2
No files found.
mini_al.h
View file @
36bd1374
...
@@ -28318,7 +28318,16 @@ mal_uint32 mal_decoder_internal_on_read_frames__flac(mal_dsp* pDSP, mal_uint32 f
...
@@ -28318,7 +28318,16 @@ mal_uint32 mal_decoder_internal_on_read_frames__flac(mal_dsp* pDSP, mal_uint32 f
drflac* pFlac = (drflac*)pDecoder->pInternalDecoder;
drflac* pFlac = (drflac*)pDecoder->pInternalDecoder;
mal_assert(pFlac != NULL);
mal_assert(pFlac != NULL);
return (mal_uint32)drflac_read_pcm_frames_s32(pFlac, frameCount, (drflac_int32*)pSamplesOut);
switch (pDecoder->internalFormat) {
case mal_format_s16: return (mal_uint32)drflac_read_pcm_frames_s16(pFlac, frameCount, (drflac_int16*)pSamplesOut);
case mal_format_s32: return (mal_uint32)drflac_read_pcm_frames_s32(pFlac, frameCount, (drflac_int32*)pSamplesOut);
case mal_format_f32: return (mal_uint32)drflac_read_pcm_frames_f32(pFlac, frameCount, (float*)pSamplesOut);
default: break;
}
// Should never get here. If we do, it means the internal format was not set correctly at initialization time.
mal_assert(MAL_FALSE);
return 0;
}
}
mal_result mal_decoder_init_flac__internal(const mal_decoder_config* pConfig, mal_decoder* pDecoder)
mal_result mal_decoder_init_flac__internal(const mal_decoder_config* pConfig, mal_decoder* pDecoder)
...
@@ -28337,8 +28346,15 @@ mal_result mal_decoder_init_flac__internal(const mal_decoder_config* pConfig, ma
...
@@ -28337,8 +28346,15 @@ mal_result mal_decoder_init_flac__internal(const mal_decoder_config* pConfig, ma
pDecoder->onUninit = mal_decoder_internal_on_uninit__flac;
pDecoder->onUninit = mal_decoder_internal_on_uninit__flac;
pDecoder->pInternalDecoder = pFlac;
pDecoder->pInternalDecoder = pFlac;
// The internal format is always s32.
// dr_flac supports reading as s32, s16 and f32. Try to do a one-to-one mapping if possible, but fall back to s32 if not. s32 is the "native" FLAC format
// since it's the only one that's truly lossless.
pDecoder->internalFormat = mal_format_s32;
pDecoder->internalFormat = mal_format_s32;
if (pConfig->format == mal_format_s16) {
pDecoder->internalFormat = mal_format_s16;
} else if (pConfig->format == mal_format_f32) {
pDecoder->internalFormat = mal_format_f32;
}
pDecoder->internalChannels = pFlac->channels;
pDecoder->internalChannels = pFlac->channels;
pDecoder->internalSampleRate = pFlac->sampleRate;
pDecoder->internalSampleRate = pFlac->sampleRate;
mal_get_standard_channel_map(mal_standard_channel_map_flac, pDecoder->internalChannels, pDecoder->internalChannelMap);
mal_get_standard_channel_map(mal_standard_channel_map_flac, pDecoder->internalChannels, pDecoder->internalChannelMap);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment