diff options
author | Aki <please@ignore.pl> | 2024-03-06 21:47:34 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2024-03-06 21:47:34 +0100 |
commit | a85fcbf8720562e77e0441ac26cb99d89564400c (patch) | |
tree | a15d30b7d00645685c50c291871d34aa5b188bc0 /contrib/vorbis/test/test.c | |
parent | 54fa233a00607b9436c03c78b50b9107a33baa0a (diff) | |
parent | 1c558822681bbed5121bcc19816cbbac6a437b2a (diff) | |
download | starshatter-a85fcbf8720562e77e0441ac26cb99d89564400c.zip starshatter-a85fcbf8720562e77e0441ac26cb99d89564400c.tar.gz starshatter-a85fcbf8720562e77e0441ac26cb99d89564400c.tar.bz2 |
External projects with established upstream are no longer part of this source tree
Diffstat (limited to 'contrib/vorbis/test/test.c')
-rw-r--r-- | contrib/vorbis/test/test.c | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/contrib/vorbis/test/test.c b/contrib/vorbis/test/test.c deleted file mode 100644 index fe1648d..0000000 --- a/contrib/vorbis/test/test.c +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: vorbis coded test suite using vorbisfile - - ********************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <math.h> - -#include "util.h" -#include "write_read.h" - -#define DATA_LEN 2048 - -#define MAX(a,b) ((a) > (b) ? (a) : (b)) - - -static int check_output (const float * data_in, unsigned len, float allowable); - -int -main(void){ - static float data_out [DATA_LEN] ; - static float data_in [DATA_LEN] ; - - /* Do safest and most used sample rates first. */ - int sample_rates [] = { 44100, 48000, 32000, 22050, 16000, 96000 } ; - unsigned k ; - int errors = 0 ; - int ch; - - gen_windowed_sine (data_out, ARRAY_LEN (data_out), 0.95); - - for(ch=1;ch<=8;ch++){ - float q=-.05; - printf("\nTesting %d channel%s\n\n",ch,ch==1?"":"s"); - while(q<1.){ - for (k = 0 ; k < ARRAY_LEN (sample_rates); k ++) { - char filename [64] ; - snprintf (filename, sizeof (filename), "vorbis_%dch_q%.1f_%u.ogg", ch,q*10,sample_rates [k]); - - printf (" %-20s : ", filename); - fflush (stdout); - - /* Set to know value. */ - set_data_in (data_in, ARRAY_LEN (data_in), 3.141); - - write_vorbis_data_or_die (filename, sample_rates [k], q, data_out, ARRAY_LEN (data_out),ch); - read_vorbis_data_or_die (filename, sample_rates [k], data_in, ARRAY_LEN (data_in)); - - if (check_output (data_in, ARRAY_LEN (data_in), (.15f - .1f*q)) != 0) - errors ++ ; - else { - puts ("ok"); - remove (filename); - } - } - q+=.1; - } - } - - if (errors) - exit (1); - - return 0; -} - -static int -check_output (const float * data_in, unsigned len, float allowable) -{ - float max_abs = 0.0 ; - unsigned k ; - - for (k = 0 ; k < len ; k++) { - float temp = fabs (data_in [k]); - max_abs = MAX (max_abs, temp); - } - - if (max_abs < 0.95-allowable) { - printf ("Error : max_abs (%f) too small.\n", max_abs); - return 1 ; - } else if (max_abs > .95+allowable) { - printf ("Error : max_abs (%f) too big.\n", max_abs); - return 1 ; - } - - return 0 ; -} - |