Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.         synth.c: The functions for synthesizing samples, at the end of decoding.
  3.  
  4.         copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1
  5.         see COPYING and AUTHORS files in distribution or http://mpg123.org
  6.         initially written by Michael Hipp, heavily dissected and rearranged by Thomas Orgis
  7. */
  8.  
  9. #include "mpg123lib_intern.h"
  10. #include "sample.h"
  11. #include "debug.h"
  12.  
  13. /* Stereo-related synth, wrapping over _some_ plain synth. */
  14. int synth_stereo_wrap(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
  15. {
  16.         int clip;
  17.         clip  = (fr->synth)(bandPtr_l, 0, fr, 0);
  18.         clip += (fr->synth)(bandPtr_r, 1, fr, 1);
  19.         return clip;
  20. }
  21.  
  22. /*
  23.         Part 1: All synth functions that produce signed short.
  24.         That is:
  25.                 - synth_1to1 with cpu-specific variants (synth_1to1_i386, synth_1to1_i586 ...)
  26.                 - synth_1to1_mono and synth_1to1_mono2stereo; which use fr->synths.plain[r_1to1][f_16].
  27.         Nearly every decoder variant has it's own synth_1to1, while the mono conversion is shared.
  28. */
  29.  
  30. #define SAMPLE_T short
  31. #define WRITE_SAMPLE(samples,sum,clip) WRITE_SHORT_SAMPLE(samples,sum,clip)
  32.  
  33. /* Part 1a: All straight 1to1 decoding functions */
  34. #define BLOCK 0x40 /* One decoding block is 64 samples. */
  35.  
  36. #define SYNTH_NAME synth_1to1
  37. #include "synth.h"
  38. #undef SYNTH_NAME
  39.  
  40. /* Mono-related synths; they wrap over _some_ synth_1to1. */
  41. #define SYNTH_NAME       fr->synths.plain[r_1to1][f_16]
  42. #define MONO_NAME        synth_1to1_mono
  43. #define MONO2STEREO_NAME synth_1to1_mono2stereo
  44. #include "synth_mono.h"
  45. #undef SYNTH_NAME
  46. #undef MONO_NAME
  47. #undef MONO2STEREO_NAME
  48.  
  49. /* Now we have possibly some special synth_1to1 ...
  50.    ... they produce signed short; the mono functions defined above work on the special synths, too. */
  51.  
  52. #ifdef OPT_GENERIC_DITHER
  53. #define SYNTH_NAME synth_1to1_dither
  54. /* We need the accurate sample writing... */
  55. #undef WRITE_SAMPLE
  56. #define WRITE_SAMPLE(samples,sum,clip) WRITE_SHORT_SAMPLE_ACCURATE(samples,sum,clip)
  57.  
  58. #define USE_DITHER
  59. #include "synth.h"
  60. #undef USE_DITHER
  61. #undef SYNTH_NAME
  62.  
  63. #undef WRITE_SAMPLE
  64. #define WRITE_SAMPLE(samples,sum,clip) WRITE_SHORT_SAMPLE(samples,sum,clip)
  65.  
  66. #endif
  67.  
  68. #ifdef OPT_X86
  69. /* The i386-specific C code, here as short variant, later 8bit and float. */
  70. #define NO_AUTOINCREMENT
  71. #define SYNTH_NAME synth_1to1_i386
  72. #include "synth.h"
  73. #undef SYNTH_NAME
  74. /* i386 uses the normal mono functions. */
  75. #undef NO_AUTOINCREMENT
  76. #endif
  77.  
  78. #undef BLOCK /* Following functions are so special that they don't need this. */
  79.  
  80. #ifdef OPT_I586
  81. /* This is defined in assembler. */
  82. int synth_1to1_i586_asm(real *bandPtr, int channel, unsigned char *out, unsigned char *buffs, int *bo, real *decwin);
  83. /* This is just a hull to use the mpg123 handle. */
  84. int synth_1to1_i586(real *bandPtr, int channel, mpg123_handle *fr, int final)
  85. {
  86.         int ret;
  87.         if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
  88.  
  89.         ret = synth_1to1_i586_asm(bandPtr, channel, fr->buffer.data+fr->buffer.fill, fr->rawbuffs, &fr->bo, fr->decwin);
  90.         if(final) fr->buffer.fill += 128;
  91.         return ret;
  92. }
  93. #endif
  94.  
  95. #ifdef OPT_I586_DITHER
  96. /* This is defined in assembler. */
  97. int synth_1to1_i586_asm_dither(real *bandPtr, int channel, unsigned char *out, unsigned char *buffs, int *bo, real *decwin, float *dithernoise);
  98. /* This is just a hull to use the mpg123 handle. */
  99. int synth_1to1_i586_dither(real *bandPtr, int channel, mpg123_handle *fr, int final)
  100. {
  101.         int ret;
  102.         int bo_dither[2]; /* Temporary workaround? Could expand the asm code. */
  103.         if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
  104.  
  105.         /* Applying this hack, to change the asm only bit by bit (adding dithernoise pointer). */
  106.         bo_dither[0] = fr->bo;
  107.         bo_dither[1] = fr->ditherindex;
  108.         ret = synth_1to1_i586_asm_dither(bandPtr, channel, fr->buffer.data+fr->buffer.fill, fr->rawbuffs, bo_dither, fr->decwin, fr->dithernoise);
  109.         fr->bo          = bo_dither[0];
  110.         fr->ditherindex = bo_dither[1];
  111.  
  112.         if(final) fr->buffer.fill += 128;
  113.         return ret;
  114. }
  115. #endif
  116.  
  117. #ifdef OPT_3DNOW
  118. /* Those are defined in assembler. */
  119. void do_equalizer_3dnow(real *bandPtr,int channel, real equalizer[2][32]);
  120. int synth_1to1_3dnow_asm(real *bandPtr, int channel, unsigned char *out, unsigned char *buffs, int *bo, real *decwin);
  121. /* This is just a hull to use the mpg123 handle. */
  122. int synth_1to1_3dnow(real *bandPtr, int channel, mpg123_handle *fr, int final)
  123. {
  124.         int ret;
  125.  
  126.         if(fr->have_eq_settings) do_equalizer_3dnow(bandPtr,channel,fr->equalizer);
  127.  
  128.         /* this is in asm, can be dither or not */
  129.         /* uh, is this return from pointer correct? */
  130.         ret = (int) synth_1to1_3dnow_asm(bandPtr, channel, fr->buffer.data+fr->buffer.fill, fr->rawbuffs, &fr->bo, fr->decwin);
  131.         if(final) fr->buffer.fill += 128;
  132.         return ret;
  133. }
  134. #endif
  135.  
  136. #ifdef OPT_MMX
  137. /* This is defined in assembler. */
  138. int synth_1to1_MMX(real *bandPtr, int channel, short *out, short *buffs, int *bo, float *decwins);
  139. /* This is just a hull to use the mpg123 handle. */
  140. int synth_1to1_mmx(real *bandPtr, int channel, mpg123_handle *fr, int final)
  141. {
  142.         if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
  143.  
  144.         /* in asm */
  145.         synth_1to1_MMX(bandPtr, channel, (short*) (fr->buffer.data+fr->buffer.fill), (short *) fr->rawbuffs, &fr->bo, fr->decwins);
  146.         if(final) fr->buffer.fill += 128;
  147.         return 0;
  148. }
  149. #endif
  150.  
  151. #ifdef OPT_SSE
  152. #ifdef ACCURATE_ROUNDING
  153. /* This is defined in assembler. */
  154. int synth_1to1_sse_accurate_asm(real *window, real *b0, short *samples, int bo1);
  155. int synth_1to1_stereo_sse_accurate_asm(real *window, real *b0l, real *b0r, short *samples, int bo1);
  156. void dct64_real_sse(real *out0, real *out1, real *samples);
  157. /* This is just a hull to use the mpg123 handle. */
  158. int synth_1to1_sse(real *bandPtr,int channel, mpg123_handle *fr, int final)
  159. {
  160.         short *samples = (short *) (fr->buffer.data+fr->buffer.fill);  
  161.         real *b0, **buf;
  162.         int clip;
  163.         int bo1;
  164.  
  165.         if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
  166.  
  167.         if(!channel)
  168.         {
  169.                 fr->bo--;
  170.                 fr->bo &= 0xf;
  171.                 buf = fr->real_buffs[0];
  172.         }
  173.         else
  174.         {
  175.                 samples++;
  176.                 buf = fr->real_buffs[1];
  177.         }
  178.  
  179.         if(fr->bo & 0x1)
  180.         {
  181.                 b0 = buf[0];
  182.                 bo1 = fr->bo;
  183.                 dct64_real_sse(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
  184.         }
  185.         else
  186.         {
  187.                 b0 = buf[1];
  188.                 bo1 = fr->bo+1;
  189.                 dct64_real_sse(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
  190.         }
  191.  
  192.         clip = synth_1to1_sse_accurate_asm(fr->decwin, b0, samples, bo1);
  193.  
  194.         if(final) fr->buffer.fill += 128;
  195.  
  196.         return clip;
  197. }
  198.  
  199. int synth_1to1_stereo_sse(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
  200. {
  201.         short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
  202.  
  203.         real *b0l, *b0r, **bufl, **bufr;
  204.         int bo1;
  205.         int clip;
  206.  
  207.         if(fr->have_eq_settings)
  208.         {
  209.                 do_equalizer(bandPtr_l,0,fr->equalizer);
  210.                 do_equalizer(bandPtr_r,1,fr->equalizer);
  211.         }
  212.  
  213.         fr->bo--;
  214.         fr->bo &= 0xf;
  215.         bufl = fr->real_buffs[0];
  216.         bufr = fr->real_buffs[1];
  217.  
  218.         if(fr->bo & 0x1)
  219.         {
  220.                 b0l = bufl[0];
  221.                 b0r = bufr[0];
  222.                 bo1 = fr->bo;
  223.                 dct64_real_sse(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
  224.                 dct64_real_sse(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
  225.         }
  226.         else
  227.         {
  228.                 b0l = bufl[1];
  229.                 b0r = bufr[1];
  230.                 bo1 = fr->bo+1;
  231.                 dct64_real_sse(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
  232.                 dct64_real_sse(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
  233.         }
  234.  
  235.         clip = synth_1to1_stereo_sse_accurate_asm(fr->decwin, b0l, b0r, samples, bo1);
  236.  
  237.         fr->buffer.fill += 128;
  238.  
  239.         return clip;
  240. }
  241. #else
  242. /* This is defined in assembler. */
  243. void synth_1to1_sse_asm(real *bandPtr, int channel, short *samples, short *buffs, int *bo, real *decwin);
  244. /* This is just a hull to use the mpg123 handle. */
  245. int synth_1to1_sse(real *bandPtr, int channel, mpg123_handle *fr, int final)
  246. {
  247.         if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
  248.  
  249.         synth_1to1_sse_asm(bandPtr, channel, (short*) (fr->buffer.data+fr->buffer.fill), (short *) fr->rawbuffs, &fr->bo, fr->decwins);
  250.         if(final) fr->buffer.fill += 128;
  251.         return 0;
  252. }
  253. #endif
  254. #endif
  255.  
  256. #ifdef OPT_3DNOWEXT
  257. /* This is defined in assembler. */
  258. void synth_1to1_3dnowext_asm(real *bandPtr, int channel, short *samples, short *buffs, int *bo, real *decwin);
  259. /* This is just a hull to use the mpg123 handle. */
  260. int synth_1to1_3dnowext(real *bandPtr, int channel, mpg123_handle *fr, int final)
  261. {
  262.         if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
  263.  
  264.         synth_1to1_3dnowext_asm(bandPtr, channel, (short*) (fr->buffer.data+fr->buffer.fill), (short *) fr->rawbuffs, &fr->bo, fr->decwins);
  265.         if(final) fr->buffer.fill += 128;
  266.         return 0;
  267. }
  268. #endif
  269.  
  270. #ifdef OPT_X86_64
  271. #ifdef ACCURATE_ROUNDING
  272. /* Assembler routines. */
  273. int synth_1to1_x86_64_accurate_asm(real *window, real *b0, short *samples, int bo1);
  274. int synth_1to1_stereo_x86_64_accurate_asm(real *window, real *b0l, real *b0r, short *samples, int bo1);
  275. void dct64_real_x86_64(real *out0, real *out1, real *samples);
  276. /* Hull for C mpg123 API */
  277. int synth_1to1_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
  278. {
  279.         short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
  280.  
  281.         real *b0, **buf;
  282.         int bo1;
  283.         int clip;
  284.  
  285.         if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
  286.  
  287.         if(!channel)
  288.         {
  289.                 fr->bo--;
  290.                 fr->bo &= 0xf;
  291.                 buf = fr->real_buffs[0];
  292.         }
  293.         else
  294.         {
  295.                 samples++;
  296.                 buf = fr->real_buffs[1];
  297.         }
  298.  
  299.         if(fr->bo & 0x1)
  300.         {
  301.                 b0 = buf[0];
  302.                 bo1 = fr->bo;
  303.                 dct64_real_x86_64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
  304.         }
  305.         else
  306.         {
  307.                 b0 = buf[1];
  308.                 bo1 = fr->bo+1;
  309.                 dct64_real_x86_64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
  310.         }
  311.  
  312.         clip = synth_1to1_x86_64_accurate_asm(fr->decwin, b0, samples, bo1);
  313.  
  314.         if(final) fr->buffer.fill += 128;
  315.  
  316.         return clip;
  317. }
  318.  
  319. int synth_1to1_stereo_x86_64(real *bandPtr_l, real *bandPtr_r, mpg123_handle *fr)
  320. {
  321.         short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
  322.  
  323.         real *b0l, *b0r, **bufl, **bufr;
  324.         int bo1;
  325.         int clip;
  326.  
  327.         if(fr->have_eq_settings)
  328.         {
  329.                 do_equalizer(bandPtr_l,0,fr->equalizer);
  330.                 do_equalizer(bandPtr_r,1,fr->equalizer);
  331.         }
  332.  
  333.         fr->bo--;
  334.         fr->bo &= 0xf;
  335.         bufl = fr->real_buffs[0];
  336.         bufr = fr->real_buffs[1];
  337.  
  338.         if(fr->bo & 0x1)
  339.         {
  340.                 b0l = bufl[0];
  341.                 b0r = bufr[0];
  342.                 bo1 = fr->bo;
  343.                 dct64_real_x86_64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
  344.                 dct64_real_x86_64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
  345.         }
  346.         else
  347.         {
  348.                 b0l = bufl[1];
  349.                 b0r = bufr[1];
  350.                 bo1 = fr->bo+1;
  351.                 dct64_real_x86_64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
  352.                 dct64_real_x86_64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
  353.         }
  354.  
  355.         clip = synth_1to1_stereo_x86_64_accurate_asm(fr->decwin, b0l, b0r, samples, bo1);
  356.  
  357.         fr->buffer.fill += 128;
  358.  
  359.         return clip;
  360. }
  361. #else
  362. /* This is defined in assembler. */
  363. int synth_1to1_x86_64_asm(short *window, short *b0, short *samples, int bo1);
  364. int synth_1to1_stereo_x86_64_asm(short *window, short *b0l, short *b0r, short *samples, int bo1);
  365. void dct64_x86_64(short *out0, short *out1, real *samples);
  366. /* This is just a hull to use the mpg123 handle. */
  367. int synth_1to1_x86_64(real *bandPtr,int channel, mpg123_handle *fr, int final)
  368. {
  369.         short *samples = (short *) (fr->buffer.data+fr->buffer.fill);  
  370.         short *b0, **buf;
  371.         int clip;
  372.         int bo1;
  373.  
  374.         if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
  375.  
  376.         if(!channel)
  377.         {
  378.                 fr->bo--;
  379.                 fr->bo &= 0xf;
  380.                 buf = fr->short_buffs[0];
  381.         }
  382.         else
  383.         {
  384.                 samples++;
  385.                 buf = fr->short_buffs[1];
  386.         }
  387.  
  388.         if(fr->bo & 0x1)
  389.         {
  390.                 b0 = buf[0];
  391.                 bo1 = fr->bo;
  392.                 dct64_x86_64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
  393.         }
  394.         else
  395.         {
  396.                 b0 = buf[1];
  397.                 bo1 = fr->bo+1;
  398.                 dct64_x86_64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
  399.         }
  400.  
  401.         clip = synth_1to1_x86_64_asm((short *)fr->decwins, b0, samples, bo1);
  402.  
  403.         if(final) fr->buffer.fill += 128;
  404.  
  405.         return clip;
  406. }
  407.  
  408. int synth_1to1_stereo_x86_64(real *bandPtr_l,real *bandPtr_r, mpg123_handle *fr)
  409. {
  410.         short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
  411.         short *b0l, *b0r, **bufl, **bufr;
  412.         int clip;
  413.         int bo1;
  414.  
  415.         if(fr->have_eq_settings)
  416.         {
  417.                 do_equalizer(bandPtr_l,0,fr->equalizer);
  418.                 do_equalizer(bandPtr_r,1,fr->equalizer);
  419.         }
  420.  
  421.         fr->bo--;
  422.         fr->bo &= 0xf;
  423.         bufl = fr->short_buffs[0];
  424.         bufr = fr->short_buffs[1];
  425.  
  426.         if(fr->bo & 0x1)
  427.         {
  428.                 b0l = bufl[0];
  429.                 b0r = bufr[0];
  430.                 bo1 = fr->bo;
  431.                 dct64_x86_64(bufl[1]+((fr->bo+1)&0xf),bufl[0]+fr->bo,bandPtr_l);
  432.                 dct64_x86_64(bufr[1]+((fr->bo+1)&0xf),bufr[0]+fr->bo,bandPtr_r);
  433.         }
  434.         else
  435.         {
  436.                 b0l = bufl[1];
  437.                 b0r = bufr[1];
  438.                 bo1 = fr->bo+1;
  439.                 dct64_x86_64(bufl[0]+fr->bo,bufl[1]+fr->bo+1,bandPtr_l);
  440.                 dct64_x86_64(bufr[0]+fr->bo,bufr[1]+fr->bo+1,bandPtr_r);
  441.         }
  442.  
  443.         clip = synth_1to1_stereo_x86_64_asm((short *)fr->decwins, b0l, b0r, samples, bo1);
  444.  
  445.         fr->buffer.fill += 128;
  446.  
  447.         return clip;
  448. }
  449. #endif
  450. #endif
  451.  
  452. #ifdef OPT_ARM
  453. #ifdef ACCURATE_ROUNDING
  454. /* Assembler routines. */
  455. int synth_1to1_arm_accurate_asm(real *window, real *b0, short *samples, int bo1);
  456. /* Hull for C mpg123 API */
  457. int synth_1to1_arm(real *bandPtr,int channel, mpg123_handle *fr, int final)
  458. {
  459.         short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
  460.  
  461.         real *b0, **buf;
  462.         int bo1;
  463.         int clip;
  464.  
  465.         if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
  466.  
  467.         if(!channel)
  468.         {
  469.                 fr->bo--;
  470.                 fr->bo &= 0xf;
  471.                 buf = fr->real_buffs[0];
  472.         }
  473.         else
  474.         {
  475.                 samples++;
  476.                 buf = fr->real_buffs[1];
  477.         }
  478.  
  479.         if(fr->bo & 0x1)
  480.         {
  481.                 b0 = buf[0];
  482.                 bo1 = fr->bo;
  483.                 dct64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
  484.         }
  485.         else
  486.         {
  487.                 b0 = buf[1];
  488.                 bo1 = fr->bo+1;
  489.                 dct64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
  490.         }
  491.  
  492.         clip = synth_1to1_arm_accurate_asm(fr->decwin, b0, samples, bo1);
  493.  
  494.         if(final) fr->buffer.fill += 128;
  495.  
  496.         return clip;
  497. }
  498. #else
  499. /* Assembler routines. */
  500. int synth_1to1_arm_asm(real *window, real *b0, short *samples, int bo1);
  501. /* Hull for C mpg123 API */
  502. int synth_1to1_arm(real *bandPtr,int channel, mpg123_handle *fr, int final)
  503. {
  504.         short *samples = (short *) (fr->buffer.data+fr->buffer.fill);
  505.  
  506.         real *b0, **buf;
  507.         int bo1;
  508.         int clip;
  509.  
  510.         if(fr->have_eq_settings) do_equalizer(bandPtr,channel,fr->equalizer);
  511.  
  512.         if(!channel)
  513.         {
  514.                 fr->bo--;
  515.                 fr->bo &= 0xf;
  516.                 buf = fr->real_buffs[0];
  517.         }
  518.         else
  519.         {
  520.                 samples++;
  521.                 buf = fr->real_buffs[1];
  522.         }
  523.  
  524.         if(fr->bo & 0x1)
  525.         {
  526.                 b0 = buf[0];
  527.                 bo1 = fr->bo;
  528.                 dct64(buf[1]+((fr->bo+1)&0xf),buf[0]+fr->bo,bandPtr);
  529.         }
  530.         else
  531.         {
  532.                 b0 = buf[1];
  533.                 bo1 = fr->bo+1;
  534.                 dct64(buf[0]+fr->bo,buf[1]+fr->bo+1,bandPtr);
  535.         }
  536.  
  537.         clip = synth_1to1_arm_asm(fr->decwin, b0, samples, bo1);
  538.  
  539.         if(final) fr->buffer.fill += 128;
  540.  
  541.         return clip;
  542. }
  543. #endif
  544. #endif
  545.  
  546. #ifndef NO_DOWNSAMPLE
  547.  
  548. /*
  549.         Part 1b: 2to1 synth.
  550.         Only generic and i386 functions this time.
  551. */
  552. #define BLOCK 0x20 /* One decoding block is 32 samples. */
  553.  
  554. #define SYNTH_NAME synth_2to1
  555. #include "synth.h"
  556. #undef SYNTH_NAME
  557.  
  558. #ifdef OPT_DITHER /* Used for generic_dither and as fallback for i586_dither. */
  559. #define SYNTH_NAME synth_2to1_dither
  560. #define USE_DITHER
  561. #include "synth.h"
  562. #undef USE_DITHER
  563. #undef SYNTH_NAME
  564. #endif
  565.  
  566. #define SYNTH_NAME       fr->synths.plain[r_2to1][f_16]
  567. #define MONO_NAME        synth_2to1_mono
  568. #define MONO2STEREO_NAME synth_2to1_mono2stereo
  569. #include "synth_mono.h"
  570. #undef SYNTH_NAME
  571. #undef MONO_NAME
  572. #undef MONO2STEREO_NAME
  573.  
  574. #ifdef OPT_X86
  575. #define NO_AUTOINCREMENT
  576. #define SYNTH_NAME synth_2to1_i386
  577. #include "synth.h"
  578. #undef SYNTH_NAME
  579. /* i386 uses the normal mono functions. */
  580. #undef NO_AUTOINCREMENT
  581. #endif
  582.  
  583. #undef BLOCK
  584.  
  585. /*
  586.         Part 1c: 4to1 synth.
  587.         Same procedure as above...
  588. */
  589. #define BLOCK 0x10 /* One decoding block is 16 samples. */
  590.  
  591. #define SYNTH_NAME synth_4to1
  592. #include "synth.h"
  593. #undef SYNTH_NAME
  594.  
  595. #ifdef OPT_DITHER
  596. #define SYNTH_NAME synth_4to1_dither
  597. #define USE_DITHER
  598. #include "synth.h"
  599. #undef USE_DITHER
  600. #undef SYNTH_NAME
  601. #endif
  602.  
  603. #define SYNTH_NAME       fr->synths.plain[r_4to1][f_16] /* This is just for the _i386 one... gotta check if it is really useful... */
  604. #define MONO_NAME        synth_4to1_mono
  605. #define MONO2STEREO_NAME synth_4to1_mono2stereo
  606. #include "synth_mono.h"
  607. #undef SYNTH_NAME
  608. #undef MONO_NAME
  609. #undef MONO2STEREO_NAME
  610.  
  611. #ifdef OPT_X86
  612. #define NO_AUTOINCREMENT
  613. #define SYNTH_NAME synth_4to1_i386
  614. #include "synth.h"
  615. #undef SYNTH_NAME
  616. /* i386 uses the normal mono functions. */
  617. #undef NO_AUTOINCREMENT
  618. #endif
  619.  
  620. #undef BLOCK
  621.  
  622. #endif /* NO_DOWNSAMPLE */
  623.  
  624. #ifndef NO_NTOM
  625. /*
  626.         Part 1d: ntom synth.
  627.         Same procedure as above... Just no extra play anymore, straight synth that uses the plain dct64.
  628. */
  629.  
  630. /* These are all in one header, there's no flexibility to gain. */
  631. #define SYNTH_NAME       synth_ntom
  632. #define MONO_NAME        synth_ntom_mono
  633. #define MONO2STEREO_NAME synth_ntom_mono2stereo
  634. #include "synth_ntom.h"
  635. #undef SYNTH_NAME
  636. #undef MONO_NAME
  637. #undef MONO2STEREO_NAME
  638.  
  639. #endif
  640.  
  641. /* Done with short output. */
  642. #undef SAMPLE_T
  643. #undef WRITE_SAMPLE
  644.