summaryrefslogtreecommitdiff
path: root/plugins/shn
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2015-01-19 16:47:31 -0500
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2015-01-19 16:47:31 -0500
commitd9c28a178bd5fbab4b949664d9ec48c83d6df092 (patch)
tree33e25ce8d694479ceff267ec9c696982d1adf506 /plugins/shn
parent69b7e9b21892b684d93c335bc143b3998c53ad2b (diff)
Make DFSG-clean0.6.2+dfsgdfsg_clean
Diffstat (limited to 'plugins/shn')
-rw-r--r--plugins/shn/array.c41
-rw-r--r--plugins/shn/shorten.c54
-rw-r--r--plugins/shn/shorten.h224
-rw-r--r--plugins/shn/vario.c146
4 files changed, 0 insertions, 465 deletions
diff --git a/plugins/shn/array.c b/plugins/shn/array.c
deleted file mode 100644
index 0adf8549..00000000
--- a/plugins/shn/array.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/******************************************************************************
-* *
-* Copyright (C) 1992-1995 Tony Robinson *
-* *
-* See the file doc/LICENSE.shorten for conditions on distribution and usage *
-* *
-******************************************************************************/
-
-/*
- * $Id: array.c,v 1.7 2003/08/26 05:34:04 jason Exp $
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "shorten.h"
-#include "shn.h"
-
-void *pmalloc(ulong size, shn_file *this_shn) {
- void *ptr;
-
- ptr = malloc(size);
-
- if(ptr == NULL)
- shn_error_fatal(this_shn,"Call to malloc(%ld) failed in pmalloc() -\nyour system may be low on memory", size);
-
- return(ptr);
-}
-
-slong **long2d(ulong n0, ulong n1, shn_file *this_shn) {
- slong **array0 = NULL;
-
- if((array0 = (slong**) pmalloc((ulong) (n0 * sizeof(slong*) +
- n0 * n1 * sizeof(slong)),this_shn)) != NULL ) {
- slong *array1 = (slong*) (array0 + n0);
- int i;
-
- for(i = 0; i < n0; i++)
- array0[i] = array1 + i * n1;
- }
- return(array0);
-}
diff --git a/plugins/shn/shorten.c b/plugins/shn/shorten.c
deleted file mode 100644
index 0c92af83..00000000
--- a/plugins/shn/shorten.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/******************************************************************************
-* *
-* Copyright (C) 1992-1995 Tony Robinson *
-* *
-* See the file doc/LICENSE.shorten for conditions on distribution and usage *
-* *
-******************************************************************************/
-
-/*
- * $Id: shorten.c,v 1.7 2003/08/26 05:34:04 jason Exp $
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <setjmp.h>
-#include "shorten.h"
-
-void init_offset(slong **offset,int nchan,int nblock,int ftype)
-{
- slong mean = 0;
- int chan, i;
-
- /* initialise offset */
- switch(ftype)
- {
- case TYPE_AU1:
- case TYPE_S8:
- case TYPE_S16HL:
- case TYPE_S16LH:
- case TYPE_ULAW:
- case TYPE_AU2:
- case TYPE_AU3:
- case TYPE_ALAW:
- mean = 0;
- break;
- case TYPE_U8:
- mean = 0x80;
- break;
- case TYPE_U16HL:
- case TYPE_U16LH:
- mean = 0x8000;
- break;
- default:
- shn_debug("Unknown file type: %d", ftype);
- }
-
- for(chan = 0; chan < nchan; chan++)
- for(i = 0; i < nblock; i++)
- offset[chan][i] = mean;
-}
diff --git a/plugins/shn/shorten.h b/plugins/shn/shorten.h
deleted file mode 100644
index 0cb0b0e2..00000000
--- a/plugins/shn/shorten.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/******************************************************************************
-* *
-* Copyright (C) 1992-1995 Tony Robinson *
-* *
-* See the file doc/LICENSE.shorten for conditions on distribution and usage *
-* *
-******************************************************************************/
-
-/*
- * $Id: shorten.h,v 1.4 2001/12/30 05:12:04 jason Exp $
- */
-
-#ifndef _SHORTEN_H
-#define _SHORTEN_H
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <pthread.h>
-
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if SIZEOF_UNSIGNED_LONG == 4
-# define uint32_t unsigned long
-# define int32_t long
-# else
-# define uint32_t unsigned int
-# define int32_t int
-# endif
-# define uint16_t unsigned short
-# define uint8_t unsigned char
-# define int16_t short
-# define int8_t char
-#endif
-
-#undef ulong
-#undef ushort
-#undef uchar
-#undef slong
-#undef sshort
-#undef schar
-#undef uint
-#define uint uint32_t
-#define ulong uint32_t
-#define ushort uint16_t
-#define uchar uint8_t
-#define slong int32_t
-#define sshort int16_t
-#define schar int8_t
-
-#include "shn.h"
-
-extern shn_file *shnfile;
-
-#define MAGIC "ajkg"
-#define FORMAT_VERSION 2
-#define MIN_SUPPORTED_VERSION 1
-#define MAX_SUPPORTED_VERSION 3
-#define MAX_VERSION 7
-
-#define UNDEFINED_UINT -1
-#define DEFAULT_BLOCK_SIZE 256
-#define DEFAULT_V0NMEAN 0
-#define DEFAULT_V2NMEAN 4
-#define DEFAULT_MAXNLPC 0
-#define DEFAULT_NCHAN 1
-#define DEFAULT_NSKIP 0
-#define DEFAULT_NDISCARD 0
-#define NBITPERLONG 32
-#define DEFAULT_MINSNR 256
-#define DEFAULT_MAXRESNSTR "32.0"
-#define DEFAULT_QUANTERROR 0
-#define MINBITRATE 2.5
-
-#define MAX_LPC_ORDER 64
-#define CHANSIZE 0
-#define ENERGYSIZE 3
-#define BITSHIFTSIZE 2
-#define NWRAP 3
-
-#define FNSIZE 2
-#define FN_DIFF0 0
-#define FN_DIFF1 1
-#define FN_DIFF2 2
-#define FN_DIFF3 3
-#define FN_QUIT 4
-#define FN_BLOCKSIZE 5
-#define FN_BITSHIFT 6
-#define FN_QLPC 7
-#define FN_ZERO 8
-#define FN_VERBATIM 9
-
-#define VERBATIM_CKSIZE_SIZE 5 /* a var_put code size */
-#define VERBATIM_BYTE_SIZE 8 /* code size 8 on single bytes means
- * no compression at all */
-#define VERBATIM_CHUNK_MAX 256 /* max. size of a FN_VERBATIM chunk */
-
-#define ULONGSIZE 2
-#define NSKIPSIZE 1
-#define LPCQSIZE 2
-#define LPCQUANT 5
-#define XBYTESIZE 7
-
-#define TYPESIZE 4
-#define TYPE_AU1 0 /* original lossless ulaw */
-#define TYPE_S8 1 /* signed 8 bit characters */
-#define TYPE_U8 2 /* unsigned 8 bit characters */
-#define TYPE_S16HL 3 /* signed 16 bit shorts: high-low */
-#define TYPE_U16HL 4 /* unsigned 16 bit shorts: high-low */
-#define TYPE_S16LH 5 /* signed 16 bit shorts: low-high */
-#define TYPE_U16LH 6 /* unsigned 16 bit shorts: low-high */
-#define TYPE_ULAW 7 /* lossy ulaw: internal conversion to linear */
-#define TYPE_AU2 8 /* new ulaw with zero mapping */
-#define TYPE_AU3 9 /* lossless alaw */
-#define TYPE_ALAW 10 /* lossy alaw: internal conversion to linear */
-#define TYPE_RIFF_WAVE 11 /* Microsoft .WAV files */
-#define TYPE_EOF 12
-#define TYPE_GENERIC_ULAW 128
-#define TYPE_GENERIC_ALAW 129
-
-#define POSITIVE_ULAW_ZERO 0xff
-#define NEGATIVE_ULAW_ZERO 0x7f
-
-#ifndef MAX_PATH
-#define MAX_PATH 2048
-#endif
-
-#ifndef MIN
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#endif
-
-#ifndef MAX
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#endif
-
-#if defined(unix) && !defined(linux)
-#define labs abs
-#endif
-
-#define ROUNDEDSHIFTDOWN(x, n) (((n) == 0) ? (x) : ((x) >> ((n) - 1)) >> 1)
-
-#ifndef M_LN2
-#define M_LN2 0.69314718055994530942
-#endif
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-/* BUFSIZ must be a multiple of four to contain a whole number of words */
-#ifdef BUFSIZ
-#undef BUFSIZ
-#endif
-
-#define BUFSIZ 512
-
-#define V2LPCQOFFSET (1 << LPCQUANT);
-
-#define UINT_GET(nbit, shnfile) \
- ((version == 0) ? uvar_get(nbit, shnfile) : ulong_get(shnfile))
-
-#define putc_exit(val, stream)\
-{ char rval;\
- if((rval = putc((val), (stream))) != (char) (val))\
- complain("FATALERROR: write failed: putc returns EOF");\
-}
-
-extern int getc_exit_val;
-#define getc_exit(stream)\
-(((getc_exit_val = getc(stream)) == EOF) ? \
- complain("FATALERROR: read failed: getc returns EOF"), 0: getc_exit_val)
-
-/************************/
-/* defined in shorten.c */
-extern void init_offset(slong**, int, int, int);
-extern int shorten(FILE*, FILE*, int, char**);
-
-/**************************/
-/* defined in Sulawalaw.c */
-extern int Sulaw2lineartab[];
-#define Sulaw2linear(i) (Sulaw2lineartab[i])
-#ifndef Sulaw2linear
-extern int Sulaw2linear(uchar);
-#endif
-extern uchar Slinear2ulaw(int);
-
-extern int Salaw2lineartab[];
-#define Salaw2linear(i) (Salaw2lineartab[i])
-#ifndef Salaw2linear
-extern int Salaw2linear(uchar);
-#endif
-extern uchar Slinear2alaw(int);
-
-/**********************/
-/* defined in fixio.c */
-extern void init_sizeof_sample(void);
-extern void fwrite_type_init(shn_file*);
-extern void fwrite_type(slong**,int,int,int,shn_file*);
-extern void fwrite_type_quit(shn_file*);
-extern void fix_bitshift(slong*, int, int, int);
-
-/**********************/
-/* defined in vario.c */
-extern void var_get_init(shn_file*);
-extern slong uvar_get(int, shn_file*);
-extern slong var_get(int, shn_file*);
-extern ulong ulong_get(shn_file*);
-extern void var_get_quit(shn_file*);
-
-extern int sizeof_uvar(ulong, int);
-extern int sizeof_var(slong, int);
-
-extern void mkmasktab(void);
-extern ulong word_get(shn_file*);
-
-/**********************/
-/* defined in array.c */
-extern void* pmalloc(ulong, shn_file*);
-extern slong** long2d(ulong, ulong, shn_file*);
-
-#endif
diff --git a/plugins/shn/vario.c b/plugins/shn/vario.c
deleted file mode 100644
index 988e2eb8..00000000
--- a/plugins/shn/vario.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/******************************************************************************
-* *
-* Copyright (C) 1992-1995 Tony Robinson *
-* *
-* See the file doc/LICENSE.shorten for conditions on distribution and usage *
-* *
-******************************************************************************/
-
-/*
- * $Id: vario.c,v 1.10 2004/05/04 02:26:36 jason Exp $
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "shorten.h"
-
-#define MASKTABSIZE 33
-ulong masktab[MASKTABSIZE];
-
-void mkmasktab() {
- int i;
- ulong val = 0;
-
- masktab[0] = val;
- for(i = 1; i < MASKTABSIZE; i++) {
- val <<= 1;
- val |= 1;
- masktab[i] = val;
- }
-}
-
-void var_get_init(shn_file *this_shn)
-{
- mkmasktab();
-
- this_shn->decode_state->getbuf = (uchar*) pmalloc((ulong) BUFSIZ,this_shn);
- this_shn->decode_state->getbufp = this_shn->decode_state->getbuf;
- this_shn->decode_state->nbyteget = 0;
- this_shn->decode_state->gbuffer = 0;
- this_shn->decode_state->nbitget = 0;
-}
-
-ulong word_get(shn_file *this_shn)
-{
- ulong buffer;
- int bytes;
-
- if(this_shn->decode_state->nbyteget < 4)
- {
- this_shn->vars.last_file_position = this_shn->vars.bytes_read;
-
- bytes = deadbeef->fread((uchar*) this_shn->decode_state->getbuf, 1, BUFSIZ, this_shn->vars.fd);
- this_shn->decode_state->nbyteget += bytes;
-
- if(this_shn->decode_state->nbyteget < 4) {
- shn_error_fatal(this_shn,"Premature EOF on compressed stream -\npossible corrupt or truncated file");
- return (ulong)0;
- }
-
- this_shn->vars.bytes_read += bytes;
-
- this_shn->decode_state->getbufp = this_shn->decode_state->getbuf;
- }
-
- buffer = (((slong) (this_shn->decode_state->getbufp[0])) << 24) | (((slong) (this_shn->decode_state->getbufp[1])) << 16) |
- (((slong) (this_shn->decode_state->getbufp[2])) << 8) | ((slong) (this_shn->decode_state->getbufp[3]));
-
- this_shn->decode_state->getbufp += 4;
- this_shn->decode_state->nbyteget -= 4;
-
- return(buffer);
-}
-
-slong uvar_get(int nbin,shn_file *this_shn)
-{
- slong result;
-
- if (this_shn->vars.reading_function_code) {
- this_shn->vars.last_file_position_no_really = this_shn->vars.last_file_position;
- }
-
- if(this_shn->decode_state->nbitget == 0)
- {
- this_shn->decode_state->gbuffer = word_get(this_shn);
- if (this_shn->vars.fatal_error)
- return (ulong)0;
- this_shn->decode_state->nbitget = 32;
- }
-
- for(result = 0; !(this_shn->decode_state->gbuffer & (1L << --(this_shn->decode_state->nbitget))); result++)
- {
- if(this_shn->decode_state->nbitget == 0)
- {
- this_shn->decode_state->gbuffer = word_get(this_shn);
- if (this_shn->vars.fatal_error)
- return (ulong)0;
- this_shn->decode_state->nbitget = 32;
- }
- }
-
- while(nbin != 0)
- {
- if(this_shn->decode_state->nbitget >= nbin)
- {
- result = (result << nbin) | ((this_shn->decode_state->gbuffer >> (this_shn->decode_state->nbitget-nbin)) &masktab[nbin]);
- this_shn->decode_state->nbitget -= nbin;
- nbin = 0;
- }
- else
- {
- result = (result << this_shn->decode_state->nbitget) | (this_shn->decode_state->gbuffer & masktab[this_shn->decode_state->nbitget]);
- this_shn->decode_state->gbuffer = word_get(this_shn);
- if (this_shn->vars.fatal_error)
- return (ulong)0;
- nbin -= this_shn->decode_state->nbitget;
- this_shn->decode_state->nbitget = 32;
- }
- }
-
- return(result);
-}
-
-ulong ulong_get(shn_file *this_shn)
-{
- unsigned int nbit = uvar_get(ULONGSIZE,this_shn);
- if (this_shn->vars.fatal_error)
- return (ulong)0;
- return(uvar_get(nbit,this_shn));
-}
-
-slong var_get(int nbin,shn_file *this_shn)
-{
- ulong uvar = uvar_get(nbin + 1,this_shn);
- if (this_shn->vars.fatal_error)
- return (slong)0;
-
- if(uvar & 1) return((slong) ~(uvar >> 1));
- else return((slong) (uvar >> 1));
-}
-
-void var_get_quit(shn_file *this_shn)
-{
- free((void *) this_shn->decode_state->getbuf);
- this_shn->decode_state->getbuf = NULL;
-}