Go to the documentation of this file.
4 #define PROFILING_NAME_WIDTH 40
5 #define PROFILING_NUMBER_WIDTH 10
6 #define PROFILING_NUMBER_MARGIN 2
42 printf(
" No seek table");
53 printf(
" [libFLAC] Failed to seek to PCM frame @ %d", (
int)targetPCMFrameIndex);
59 printf(
" [dr_flac] Failed to seek to PCM frame @ %d", (
int)targetPCMFrameIndex);
64 printf(
" Current PCM frame inconsistent @ %d: libFLAC=%d, dr_flac=%d", (
int)targetPCMFrameIndex, (
int)pLibFlac->
currentPCMFrame, (
int)pFlac->
currentPCMFrame);
73 if (pPCMFrames_libflac ==
NULL) {
74 printf(
" [libFLAC] Out of memory");
80 if (pPCMFrames_drflac ==
NULL) {
81 free(pPCMFrames_libflac);
82 printf(
" [dr_flac] Out of memory");
88 if (pcmFrameCount_libflac != pcmFrameCount_drflac) {
89 free(pPCMFrames_drflac);
90 free(pPCMFrames_libflac);
91 printf(
" Decoded frame counts differ @ %d: libFLAC=%d, dr_flac=%d", (
int)targetPCMFrameIndex, (
int)pLibFlac->
currentPCMFrame, (
int)pFlac->
currentPCMFrame);
98 for (iPCMFrame = 0; iPCMFrame < pcmFrameCount_libflac; iPCMFrame += 1) {
104 for (iChannel = 0; iChannel < pLibFlac->
channels; iChannel += 1) {
105 if (pPCMFrame_libflac[iChannel] != pPCMFrame_drflac[iChannel]) {
106 printf(
" PCM Frame @ %d[%d] does not match: targetPCMFrameIndex=%d", (
int)iPCMFrame, iChannel, (
int)targetPCMFrameIndex);
113 free(pPCMFrames_drflac);
114 free(pPCMFrames_libflac);
121 free(pPCMFrames_drflac);
122 free(pPCMFrames_libflac);
141 printf(
" Failed to open via libFLAC.");
148 printf(
" Failed to open via dr_flac.");
172 while (result ==
DRFLAC_SUCCESS && iteration < totalIterationCount) {
203 while (pFile !=
NULL) {
249 if (pProcessingTime !=
NULL) {
250 *pProcessingTime = 0;
259 for (i = 0; i < 100; ++i) {
270 if (pProcessingTime !=
NULL) {
271 *pProcessingTime += (endTime - startTime);
284 if (pFilePath ==
NULL) {
304 if (pFilePath ==
NULL) {
324 if (pFilePath ==
NULL) {
404 while (pFile !=
NULL) {
458 printf(
"=======================================================================\n");
459 printf(
"SEEK TESTING\n");
460 printf(
"=======================================================================\n");
467 printf(
"=======================================================================\n");
468 printf(
"WARNING: Correctness Tests Disabled\n");
469 printf(
"=======================================================================\n");
474 printf(
"=======================================================================\n");
475 printf(
"SEEK PROFILING\n");
476 printf(
"=======================================================================\n");
dr_file_iterator * dr_file_iterator_next(dr_file_iterator *pState)
drflac_uint64 pcmFrameCount
drflac_result seek_test_pcm_frame(libflac *pLibFlac, drflac *pFlac, drflac_uint64 targetPCMFrameIndex)
drflac_result seek_profiling_drflac_and_close(drflac *pFlac, double *pProcessingTime)
unsigned long long drflac_uint64
drflac_result seek_profiling_directory(const char *pDirectoryPath, profiling_state *pProfiling)
#define PROFILING_NUMBER_MARGIN
drflac_result libflac_init_file(const char *pFilePath, libflac *pDecoder)
drflac_bool32 libflac_seek_to_pcm_frame(libflac *pDecoder, drflac_uint64 targetPCMFrameIndex)
int dr_printf_fixed_with_margin(int width, int margin, const char *const format,...)
profiling_state profiling_state_sum(const profiling_state *pA, const profiling_state *pB)
drflac_uint32 seekpointCount
drflac_bool32 _noBinarySearchSeek
void profiling_state_init(profiling_state *pProfiling)
drflac_result seek_profiling_file__binary_search(const char *pFilePath, double *pProcessingTime)
drflac_result seek_profiling()
drflac_result seek_profiling_file__brute_force(const char *pFilePath, double *pProcessingTime)
drflac_bool32 _noBruteForceSeek
drflac_result seek_test_file(const char *pFilePath)
dr_uint64 dr_rand_range_u64(dr_uint64 lo, dr_uint64 hi)
dr_bool32 dr_argv_is_set(int argc, char **argv, const char *value)
drflac_result seek_test()
drflac_bool32 _noSeekTableSeek
drflac_uint64 currentPCMFrame
const char * dr_path_file_name(const char *path)
drflac_result seek_profiling_file(const char *pFilePath, profiling_state *pProfiling)
DRFLAC_API drflac * drflac_open_file(const char *pFileName, const drflac_allocation_callbacks *pAllocationCallbacks)
drflac_uint32 drflac_bool32
int dr_printf_fixed(int width, const char *const format,...)
DRFLAC_API drflac_uint64 drflac_read_pcm_frames_s32(drflac *pFlac, drflac_uint64 framesToRead, drflac_int32 *pBufferOut)
void libflac_uninit(libflac *pDecoder)
drflac_result seek_profiling_file__seek_table(const char *pFilePath, double *pProcessingTime)
unsigned int drflac_uint32
DRFLAC_API void drflac_close(drflac *pFlac)
int main(int argc, char **argv)
drflac_uint64 totalPCMFrameCount
#define PROFILING_NAME_WIDTH
#define PROFILING_NUMBER_WIDTH
double totalSeconds_BinarySearch
DRFLAC_API drflac_bool32 drflac_seek_to_pcm_frame(drflac *pFlac, drflac_uint64 pcmFrameIndex)
double totalSeconds_BruteForce
dr_file_iterator * dr_file_iterator_begin(const char *pFolderPath, dr_file_iterator *pState)
double totalSeconds_SeekTable
drflac_uint64 libflac_read_pcm_frames_s32(libflac *pDecoder, drflac_uint64 framesToRead, drflac_int32 *pBufferOut)
drflac_uint64 currentPCMFrame
drflac_result seek_test_directory(const char *pDirectoryPath)