Blame src/libmpg123/synth_8bit.c

Packit c32a2d
/*
Packit c32a2d
	synth_8bit.c: The functions for synthesizing 8bit samples, at the end of decoding.
Packit c32a2d
Packit c32a2d
	copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1
Packit c32a2d
	see COPYING and AUTHORS files in distribution or http://mpg123.org
Packit c32a2d
	initially written by Michael Hipp, heavily dissected and rearranged by Thomas Orgis
Packit c32a2d
*/
Packit c32a2d
Packit c32a2d
#include "mpg123lib_intern.h"
Packit c32a2d
#include "sample.h"
Packit c32a2d
#include "debug.h"
Packit c32a2d
Packit c32a2d
/* 
Packit c32a2d
	Part 2: All synth functions that produce 8bit output.
Packit c32a2d
	What we need is just a special WRITE_SAMPLE. For the generic and i386 functions, that is.
Packit c32a2d
	For the rather optimized synth_1to1, we will need the postprocessing 8bit converters from synth_8bit.h .
Packit c32a2d
*/
Packit c32a2d
Packit c32a2d
#define SAMPLE_T unsigned char
Packit c32a2d
#define WRITE_SAMPLE(samples,sum,clip) WRITE_8BIT_SAMPLE(samples,sum,clip)
Packit c32a2d
Packit c32a2d
/* Part 2a: All straight 1to1 decoding functions */
Packit c32a2d
#define BLOCK 0x40 /* One decoding block is 64 samples. */
Packit c32a2d
Packit c32a2d
#define SYNTH_NAME synth_1to1_8bit
Packit c32a2d
#include "synth.h"
Packit c32a2d
#undef SYNTH_NAME
Packit c32a2d
Packit c32a2d
/* Mono-related synths; they wrap over _some_ synth_1to1_8bit (could be generic, could be i386). */
Packit c32a2d
#define SYNTH_NAME       fr->synths.plain[r_1to1][f_8]
Packit c32a2d
#define MONO_NAME        synth_1to1_8bit_mono
Packit c32a2d
#define MONO2STEREO_NAME synth_1to1_8bit_m2s
Packit c32a2d
#include "synth_mono.h"
Packit c32a2d
#undef SYNTH_NAME
Packit c32a2d
#undef MONO_NAME
Packit c32a2d
#undef MONO2STEREO_NAME
Packit c32a2d
Packit c32a2d
#ifdef OPT_X86
Packit c32a2d
#define NO_AUTOINCREMENT
Packit c32a2d
#define SYNTH_NAME synth_1to1_8bit_i386
Packit c32a2d
#include "synth.h"
Packit c32a2d
#undef SYNTH_NAME
Packit c32a2d
/* i386 uses the normal mono functions. */
Packit c32a2d
#undef NO_AUTOINCREMENT
Packit c32a2d
#endif
Packit c32a2d
Packit c32a2d
/* But now, we need functions that take the 16bit output of optimized synth_1to1 and convert it.
Packit c32a2d
   I suppose that is still faster than dropping the optimization altogether! */
Packit c32a2d
Packit c32a2d
#define BASE_SYNTH_NAME  fr->synths.plain[r_1to1][f_16]
Packit c32a2d
#define SYNTH_NAME       synth_1to1_8bit_wrap
Packit c32a2d
#define MONO_NAME        synth_1to1_8bit_wrap_mono
Packit c32a2d
#define MONO2STEREO_NAME synth_1to1_8bit_wrap_m2s
Packit c32a2d
#include "synth_8bit.h"
Packit c32a2d
#undef BASE_SYNTH_NAME
Packit c32a2d
#undef SYNTH_NAME
Packit c32a2d
#undef MONO_NAME
Packit c32a2d
#undef MONO2STEREO_NAME
Packit c32a2d
Packit c32a2d
#undef BLOCK
Packit c32a2d
Packit c32a2d
#ifndef NO_DOWNSAMPLE
Packit c32a2d
Packit c32a2d
/*
Packit c32a2d
	Part 2b: 2to1 synth. Only generic and i386.
Packit c32a2d
*/
Packit c32a2d
#define BLOCK 0x20 /* One decoding block is 32 samples. */
Packit c32a2d
Packit c32a2d
#define SYNTH_NAME synth_2to1_8bit
Packit c32a2d
#include "synth.h"
Packit c32a2d
#undef SYNTH_NAME
Packit c32a2d
Packit c32a2d
/* Mono-related synths; they wrap over _some_ synth_2to1_8bit (could be generic, could be i386). */
Packit c32a2d
#define SYNTH_NAME       fr->synths.plain[r_2to1][f_8]
Packit c32a2d
#define MONO_NAME        synth_2to1_8bit_mono
Packit c32a2d
#define MONO2STEREO_NAME synth_2to1_8bit_m2s
Packit c32a2d
#include "synth_mono.h"
Packit c32a2d
#undef SYNTH_NAME
Packit c32a2d
#undef MONO_NAME
Packit c32a2d
#undef MONO2STEREO_NAME
Packit c32a2d
Packit c32a2d
#ifdef OPT_X86
Packit c32a2d
#define NO_AUTOINCREMENT
Packit c32a2d
#define SYNTH_NAME synth_2to1_8bit_i386
Packit c32a2d
#include "synth.h"
Packit c32a2d
#undef SYNTH_NAME
Packit c32a2d
/* i386 uses the normal mono functions. */
Packit c32a2d
#undef NO_AUTOINCREMENT
Packit c32a2d
#endif
Packit c32a2d
Packit c32a2d
#undef BLOCK
Packit c32a2d
Packit c32a2d
/*
Packit c32a2d
	Part 2c: 4to1 synth. Only generic and i386.
Packit c32a2d
*/
Packit c32a2d
#define BLOCK 0x10 /* One decoding block is 16 samples. */
Packit c32a2d
Packit c32a2d
#define SYNTH_NAME synth_4to1_8bit
Packit c32a2d
#include "synth.h"
Packit c32a2d
#undef SYNTH_NAME
Packit c32a2d
Packit c32a2d
/* Mono-related synths; they wrap over _some_ synth_4to1_8bit (could be generic, could be i386). */
Packit c32a2d
#define SYNTH_NAME       fr->synths.plain[r_4to1][f_8]
Packit c32a2d
#define MONO_NAME        synth_4to1_8bit_mono
Packit c32a2d
#define MONO2STEREO_NAME synth_4to1_8bit_m2s
Packit c32a2d
#include "synth_mono.h"
Packit c32a2d
#undef SYNTH_NAME
Packit c32a2d
#undef MONO_NAME
Packit c32a2d
#undef MONO2STEREO_NAME
Packit c32a2d
Packit c32a2d
#ifdef OPT_X86
Packit c32a2d
#define NO_AUTOINCREMENT
Packit c32a2d
#define SYNTH_NAME synth_4to1_8bit_i386
Packit c32a2d
#include "synth.h"
Packit c32a2d
#undef SYNTH_NAME
Packit c32a2d
/* i386 uses the normal mono functions. */
Packit c32a2d
#undef NO_AUTOINCREMENT
Packit c32a2d
#endif
Packit c32a2d
Packit c32a2d
#undef BLOCK
Packit c32a2d
Packit c32a2d
#endif /* NO_DOWNSAMPLE */
Packit c32a2d
Packit c32a2d
#ifndef NO_NTOM
Packit c32a2d
/*
Packit c32a2d
	Part 2d: ntom synth.
Packit c32a2d
	Same procedure as above... Just no extra play anymore, straight synth that may use an optimized dct64.
Packit c32a2d
*/
Packit c32a2d
Packit c32a2d
/* These are all in one header, there's no flexibility to gain. */
Packit c32a2d
#define SYNTH_NAME       synth_ntom_8bit
Packit c32a2d
#define MONO_NAME        synth_ntom_8bit_mono
Packit c32a2d
#define MONO2STEREO_NAME synth_ntom_8bit_m2s
Packit c32a2d
#include "synth_ntom.h"
Packit c32a2d
#undef SYNTH_NAME
Packit c32a2d
#undef MONO_NAME
Packit c32a2d
#undef MONO2STEREO_NAME
Packit c32a2d
Packit c32a2d
#endif
Packit c32a2d
Packit c32a2d
#undef SAMPLE_T
Packit c32a2d
#undef WRITE_SAMPLE