Path: blob/master/libs/mpg123/src/libmpg123/synth_8bit.c
4394 views
/*1synth_8bit.c: The functions for synthesizing 8bit samples, at the end of decoding.23copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.14see COPYING and AUTHORS files in distribution or http://mpg123.org5initially written by Michael Hipp, heavily dissected and rearranged by Thomas Orgis6*/78#include "mpg123lib_intern.h"9#include "../common/sample.h"10#include "../common/debug.h"1112/*13Part 2: All synth functions that produce 8bit output.14What we need is just a special WRITE_SAMPLE. For the generic and i386 functions, that is.15For the rather optimized INT123_synth_1to1, we will need the postprocessing 8bit converters from synth_8bit.h .16*/1718#define SAMPLE_T unsigned char19#define WRITE_SAMPLE(samples,sum,clip) WRITE_8BIT_SAMPLE(samples,sum,clip)2021/* Part 2a: All straight 1to1 decoding functions */22#define BLOCK 0x40 /* One decoding block is 64 samples. */2324#define SYNTH_NAME INT123_synth_1to1_8bit25#include "synth.h"26#undef SYNTH_NAME2728/* Mono-related synths; they wrap over _some_ INT123_synth_1to1_8bit (could be generic, could be i386). */29#define SYNTH_NAME fr->synths.plain[r_1to1][f_8]30#define MONO_NAME INT123_synth_1to1_8bit_mono31#define MONO2STEREO_NAME INT123_synth_1to1_8bit_m2s32#include "synth_mono.h"33#undef SYNTH_NAME34#undef MONO_NAME35#undef MONO2STEREO_NAME3637#ifdef OPT_X8638#define NO_AUTOINCREMENT39#define SYNTH_NAME INT123_synth_1to1_8bit_i38640#include "synth.h"41#undef SYNTH_NAME42/* i386 uses the normal mono functions. */43#undef NO_AUTOINCREMENT44#endif4546/* But now, we need functions that take the 16bit output of optimized INT123_synth_1to1 and convert it.47I suppose that is still faster than dropping the optimization altogether! */4849#define BASE_SYNTH_NAME fr->synths.plain[r_1to1][f_16]50#define SYNTH_NAME INT123_synth_1to1_8bit_wrap51#define MONO_NAME INT123_synth_1to1_8bit_wrap_mono52#define MONO2STEREO_NAME INT123_synth_1to1_8bit_wrap_m2s53#include "synth_8bit.h"54#undef BASE_SYNTH_NAME55#undef SYNTH_NAME56#undef MONO_NAME57#undef MONO2STEREO_NAME5859#undef BLOCK6061#ifndef NO_DOWNSAMPLE6263/*64Part 2b: 2to1 synth. Only generic and i386.65*/66#define BLOCK 0x20 /* One decoding block is 32 samples. */6768#define SYNTH_NAME INT123_synth_2to1_8bit69#include "synth.h"70#undef SYNTH_NAME7172/* Mono-related synths; they wrap over _some_ INT123_synth_2to1_8bit (could be generic, could be i386). */73#define SYNTH_NAME fr->synths.plain[r_2to1][f_8]74#define MONO_NAME INT123_synth_2to1_8bit_mono75#define MONO2STEREO_NAME INT123_synth_2to1_8bit_m2s76#include "synth_mono.h"77#undef SYNTH_NAME78#undef MONO_NAME79#undef MONO2STEREO_NAME8081#ifdef OPT_X8682#define NO_AUTOINCREMENT83#define SYNTH_NAME INT123_synth_2to1_8bit_i38684#include "synth.h"85#undef SYNTH_NAME86/* i386 uses the normal mono functions. */87#undef NO_AUTOINCREMENT88#endif8990#undef BLOCK9192/*93Part 2c: 4to1 synth. Only generic and i386.94*/95#define BLOCK 0x10 /* One decoding block is 16 samples. */9697#define SYNTH_NAME INT123_synth_4to1_8bit98#include "synth.h"99#undef SYNTH_NAME100101/* Mono-related synths; they wrap over _some_ INT123_synth_4to1_8bit (could be generic, could be i386). */102#define SYNTH_NAME fr->synths.plain[r_4to1][f_8]103#define MONO_NAME INT123_synth_4to1_8bit_mono104#define MONO2STEREO_NAME INT123_synth_4to1_8bit_m2s105#include "synth_mono.h"106#undef SYNTH_NAME107#undef MONO_NAME108#undef MONO2STEREO_NAME109110#ifdef OPT_X86111#define NO_AUTOINCREMENT112#define SYNTH_NAME INT123_synth_4to1_8bit_i386113#include "synth.h"114#undef SYNTH_NAME115/* i386 uses the normal mono functions. */116#undef NO_AUTOINCREMENT117#endif118119#undef BLOCK120121#endif /* NO_DOWNSAMPLE */122123#ifndef NO_NTOM124/*125Part 2d: ntom synth.126Same procedure as above... Just no extra play anymore, straight synth that may use an optimized INT123_dct64.127*/128129/* These are all in one header, there's no flexibility to gain. */130#define SYNTH_NAME INT123_synth_ntom_8bit131#define MONO_NAME INT123_synth_ntom_8bit_mono132#define MONO2STEREO_NAME INT123_synth_ntom_8bit_m2s133#include "synth_ntom.h"134#undef SYNTH_NAME135#undef MONO_NAME136#undef MONO2STEREO_NAME137138#endif139140#undef SAMPLE_T141#undef WRITE_SAMPLE142143144