From 373dc625f82b47096893add42c4472e4a57ab7eb Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 9 Feb 2022 22:23:03 +0100 Subject: Moved third-party libraries to a separate subdirectory --- vorbis/test/Makefile.am | 19 --- vorbis/test/test.c | 99 ---------------- vorbis/test/util.c | 52 --------- vorbis/test/util.h | 23 ---- vorbis/test/write_read.c | 297 ----------------------------------------------- vorbis/test/write_read.h | 27 ----- 6 files changed, 517 deletions(-) delete mode 100644 vorbis/test/Makefile.am delete mode 100644 vorbis/test/test.c delete mode 100644 vorbis/test/util.c delete mode 100644 vorbis/test/util.h delete mode 100644 vorbis/test/write_read.c delete mode 100644 vorbis/test/write_read.h (limited to 'vorbis/test') diff --git a/vorbis/test/Makefile.am b/vorbis/test/Makefile.am deleted file mode 100644 index b68ebdb..0000000 --- a/vorbis/test/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS = foreign - -check_PROGRAMS = test - -check: $(check_PROGRAMS) - ./test$(EXEEXT) - -AM_CPPFLAGS = -I$(top_srcdir)/include @OGG_CFLAGS@ - -test_SOURCES = util.c util.h write_read.c write_read.h test.c -test_LDADD = ../lib/libvorbisenc.la ../lib/libvorbis.la @OGG_LIBS@ @VORBIS_LIBS@ - -debug: - $(MAKE) check CFLAGS="@DEBUG@" - -profile: - $(MAKE) check CFLAGS="@PROFILE@" diff --git a/vorbis/test/test.c b/vorbis/test/test.c deleted file mode 100644 index fe1648d..0000000 --- a/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 -#include -#include - -#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 ; -} - diff --git a/vorbis/test/util.c b/vorbis/test/util.c deleted file mode 100644 index 2ab7483..0000000 --- a/vorbis/test/util.c +++ /dev/null @@ -1,52 +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: utility functions for vorbis codec test suite. - - ********************************************************************/ - -#include -#include -#include -#include -#include - -#include -#include - -#include "util.h" - -void -gen_windowed_sine (float *data, int len, float maximum) -{ int k ; - - memset (data, 0, len * sizeof (float)) ; - - len /= 2 ; - - for (k = 0 ; k < len ; k++) - { data [k] = sin (2.0 * k * M_PI * 1.0 / 32.0 + 0.4) ; - - /* Apply Hanning Window. */ - data [k] *= maximum * (0.5 - 0.5 * cos (2.0 * M_PI * k / ((len) - 1))) ; - } - - return ; -} - -void -set_data_in (float * data, unsigned len, float value) -{ unsigned k ; - - for (k = 0 ; k < len ; k++) - data [k] = value ; -} diff --git a/vorbis/test/util.h b/vorbis/test/util.h deleted file mode 100644 index 85f8d4f..0000000 --- a/vorbis/test/util.h +++ /dev/null @@ -1,23 +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: utility functions for vorbis codec test suite. - - ********************************************************************/ - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -/* Create simple test data consisting of a windowed sine wave. */ -void gen_windowed_sine (float *data, int len, float maximum) ; - -/* Set len values of data array to given value. */ -void set_data_in (float * data, unsigned len, float value) ; diff --git a/vorbis/test/write_read.c b/vorbis/test/write_read.c deleted file mode 100644 index f1190dc..0000000 --- a/vorbis/test/write_read.c +++ /dev/null @@ -1,297 +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: utility functions for vorbis codec test suite. - - ********************************************************************/ - -#include -#include -#include -#include -#include - -#include -#include - -#include "write_read.h" - -/* The following function is basically a hacked version of the code in - * examples/encoder_example.c */ -void -write_vorbis_data_or_die (const char *filename, int srate, float q, const float * data, int count, int ch) -{ - FILE * file ; - ogg_stream_state os; - ogg_page og; - ogg_packet op; - vorbis_info vi; - vorbis_comment vc; - vorbis_dsp_state vd; - vorbis_block vb; - - int eos = 0, ret; - - if ((file = fopen (filename, "wb")) == NULL) { - printf("\n\nError : fopen failed : %s\n", strerror (errno)) ; - exit (1) ; - } - - /********** Encode setup ************/ - - vorbis_info_init (&vi); - - ret = vorbis_encode_init_vbr (&vi,ch,srate,q); - if (ret) { - printf ("vorbis_encode_init_vbr return %d\n", ret) ; - exit (1) ; - } - - vorbis_comment_init (&vc); - vorbis_comment_add_tag (&vc,"ENCODER","test/util.c"); - vorbis_analysis_init (&vd,&vi); - vorbis_block_init (&vd,&vb); - - ogg_stream_init (&os,12345678); - - { - ogg_packet header; - ogg_packet header_comm; - ogg_packet header_code; - - vorbis_analysis_headerout (&vd,&vc,&header,&header_comm,&header_code); - ogg_stream_packetin (&os,&header); - ogg_stream_packetin (&os,&header_comm); - ogg_stream_packetin (&os,&header_code); - - /* Ensures the audio data will start on a new page. */ - while (!eos){ - int result = ogg_stream_flush (&os,&og); - if (result == 0) - break; - fwrite (og.header,1,og.header_len,file); - fwrite (og.body,1,og.body_len,file); - } - - } - - { - /* expose the buffer to submit data */ - float **buffer = vorbis_analysis_buffer (&vd,count); - int i; - - for(i=0;i 0 && read_total < count) { - int bout = samples < count ? samples : count; - bout = read_total + bout > count ? count - read_total : bout; - - memcpy (data + read_total, pcm[0], bout * sizeof (float)) ; - - vorbis_synthesis_read (&vd,bout); - read_total += bout ; - } - } - } - - if (ogg_page_eos (&og)) eos = 1; - } - } - - if (!eos) { - buffer = ogg_sync_buffer (&oy,4096); - bytes = fread (buffer,1,4096,file); - ogg_sync_wrote (&oy,bytes); - if (bytes == 0) eos = 1; - } - } - - ogg_stream_clear (&os); - - vorbis_block_clear (&vb); - vorbis_dsp_clear (&vd); - vorbis_comment_clear (&vc); - vorbis_info_clear (&vi); - } -done_decode: - - /* OK, clean up the framer */ - ogg_sync_clear (&oy); - - fclose (file) ; -} - diff --git a/vorbis/test/write_read.h b/vorbis/test/write_read.h deleted file mode 100644 index c50c483..0000000 --- a/vorbis/test/write_read.h +++ /dev/null @@ -1,27 +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: utility functions for vorbis codec test suite. - - ********************************************************************/ - -/* Write supplied data to an Ogg/Vorbis file with specified filename at - * specified sample rate. Assumes a single channel of audio. */ -void write_vorbis_data_or_die (const char *filename, int srate, float q, - const float * data, int count, int ch) ; - -/* Read given Ogg/Vorbis file into data specified data array. This - * function is basically the inverse of the one above. Again, assumes - * a single channel of audio. */ -void read_vorbis_data_or_die (const char *filename, int srate, - float * data, int count) ; - -- cgit v1.1