diff options
author | aliaspider | 2014-11-02 08:18:58 +0100 |
---|---|---|
committer | aliaspider | 2014-11-02 08:18:58 +0100 |
commit | 72624fa54282899e50f1ea0febfafc8f1fdde441 (patch) | |
tree | 499f317ee4923be52df94352dc6bfc739907646a | |
parent | 89e63225bb059560787ae67444c2cc1fd2a38a66 (diff) | |
download | snesemu-72624fa54282899e50f1ea0febfafc8f1fdde441.tar.gz snesemu-72624fa54282899e50f1ea0febfafc8f1fdde441.tar.bz2 snesemu-72624fa54282899e50f1ea0febfafc8f1fdde441.zip |
remove alternative sample decoders
-rw-r--r-- | source/snes9x.h | 1 | ||||
-rw-r--r-- | source/soundux.c | 269 |
2 files changed, 0 insertions, 270 deletions
diff --git a/source/snes9x.h b/source/snes9x.h index c230f17..9ddce7b 100644 --- a/source/snes9x.h +++ b/source/snes9x.h @@ -334,7 +334,6 @@ typedef struct bool8 ThreadSound; bool8 Mute; bool8 NextAPUEnabled; - uint8 AltSampleDecode; bool8 FixFrequency; /* Graphics options */ diff --git a/source/soundux.c b/source/soundux.c index 1ddbd48..d991c04 100644 --- a/source/soundux.c +++ b/source/soundux.c @@ -494,267 +494,6 @@ void S9xSetSoundType(int channel, int type_of_sound) SoundData.channels[channel].type = type_of_sound; } -void AltDecodeBlock(Channel* ch) -{ - if (ch->block_pointer >= 0x10000 - 9) - { - ch->last_block = TRUE; - ch->loop = FALSE; - ch->block = ch->decoded; - memset((void*) ch->decoded, 0, sizeof(int16) * 16); - return; - } - signed char* compressed = (signed char*) &IAPU.RAM [ch->block_pointer]; - - unsigned char filter = *compressed; - if ((ch->last_block = filter & 1)) - ch->loop = (filter & 2) != 0; - -#if !defined(ANDROID) && (defined (USE_X86_ASM) && (defined (__i386__) || defined (__i486__) ||\ - defined (__i586__) || defined (__WIN32__) || defined (__DJGPP))) - int16* raw = ch->block = ch->decoded; - - if (Settings.AltSampleDecode == 1) - DecodeBlockAsm(compressed, raw, &ch->previous [0], &ch->previous [1]); - else - DecodeBlockAsm2(compressed, raw, &ch->previous [0], &ch->previous [1]); -#else - int32 out; - unsigned char shift; - signed char sample1, sample2; - unsigned int i; - - compressed++; - signed short* raw = ch->block = ch->decoded; - - int32 prev0 = ch->previous [0]; - int32 prev1 = ch->previous [1]; - shift = filter >> 4; - - switch ((filter >> 2) & 3) - { - case 0: - for (i = 8; i != 0; i--) - { - sample1 = *compressed++; - sample2 = sample1 << 4; - sample2 >>= 4; - sample1 >>= 4; - *raw++ = ((int32) sample1 << shift); - *raw++ = ((int32) sample2 << shift); - } - prev1 = *(raw - 2); - prev0 = *(raw - 1); - break; - case 1: - for (i = 8; i != 0; i--) - { - sample1 = *compressed++; - sample2 = sample1 << 4; - sample2 >>= 4; - sample1 >>= 4; - prev0 = (int16) prev0; - *raw++ = prev1 = ((int32) sample1 << shift) + prev0 - (prev0 >> 4); - prev1 = (int16) prev1; - *raw++ = prev0 = ((int32) sample2 << shift) + prev1 - (prev1 >> 4); - } - break; - case 2: - for (i = 8; i != 0; i--) - { - sample1 = *compressed++; - sample2 = sample1 << 4; - sample2 >>= 4; - sample1 >>= 4; - - out = (sample1 << shift) - prev1 + (prev1 >> 4); - prev1 = (int16) prev0; - prev0 &= ~3; - *raw++ = prev0 = out + (prev0 << 1) - (prev0 >> 5) - - (prev0 >> 4); - - out = (sample2 << shift) - prev1 + (prev1 >> 4); - prev1 = (int16) prev0; - prev0 &= ~3; - *raw++ = prev0 = out + (prev0 << 1) - (prev0 >> 5) - - (prev0 >> 4); - } - break; - case 3: - for (i = 8; i != 0; i--) - { - sample1 = *compressed++; - sample2 = sample1 << 4; - sample2 >>= 4; - sample1 >>= 4; - out = (sample1 << shift); - - out = out - prev1 + (prev1 >> 3) + (prev1 >> 4); - prev1 = (int16) prev0; - prev0 &= ~3; - *raw++ = prev0 = out + (prev0 << 1) - (prev0 >> 3) - - (prev0 >> 4) - (prev1 >> 6); - - out = (sample2 << shift); - out = out - prev1 + (prev1 >> 3) + (prev1 >> 4); - prev1 = (int16) prev0; - prev0 &= ~3; - *raw++ = prev0 = out + (prev0 << 1) - (prev0 >> 3) - - (prev0 >> 4) - (prev1 >> 6); - } - break; - } - ch->previous [0] = prev0; - ch->previous [1] = prev1; -#endif - - ch->block_pointer += 9; -} - -void AltDecodeBlock2(Channel* ch) -{ - int32 out; - unsigned char filter; - unsigned char shift; - signed char sample1, sample2; - unsigned char i; - - if (ch->block_pointer > 0x10000 - 9) - { - ch->last_block = TRUE; - ch->loop = FALSE; - ch->block = ch->decoded; - memset((void*) ch->decoded, 0, sizeof(int16) * 16); - return; - } - - signed char* compressed = (signed char*) &IAPU.RAM [ch->block_pointer]; - - filter = *compressed; - if ((ch->last_block = filter & 1)) - ch->loop = (filter & 2) != 0; - - compressed++; - signed short* raw = ch->block = ch->decoded; - - shift = filter >> 4; - int32 prev0 = ch->previous [0]; - int32 prev1 = ch->previous [1]; - - if (shift > 12) - shift -= 4; - - switch ((filter >> 2) & 3) - { - case 0: - for (i = 8; i != 0; i--) - { - sample1 = *compressed++; - sample2 = sample1 << 4; - //Sample 2 = Bottom Nibble, Sign Extended. - sample2 >>= 4; - //Sample 1 = Top Nibble, shifted down and Sign Extended. - sample1 >>= 4; - - out = (int32)(sample1 << shift); - - prev1 = prev0; - prev0 = out; - CLIP16(out); - *raw++ = (int16)out; - - out = (int32)(sample2 << shift); - - prev1 = prev0; - prev0 = out; - CLIP16(out); - *raw++ = (int16)out; - } - break; - case 1: - for (i = 8; i != 0; i--) - { - sample1 = *compressed++; - sample2 = sample1 << 4; - //Sample 2 = Bottom Nibble, Sign Extended. - sample2 >>= 4; - //Sample 1 = Top Nibble, shifted down and Sign Extended. - sample1 >>= 4; - out = (int32)(sample1 << shift); - out += (int32)((double)prev0 * 15 / 16); - - prev1 = prev0; - prev0 = out; - CLIP16(out); - *raw++ = (int16)out; - - out = (int32)(sample2 << shift); - out += (int32)((double)prev0 * 15 / 16); - - prev1 = prev0; - prev0 = out; - CLIP16(out); - *raw++ = (int16)out; - } - break; - case 2: - for (i = 8; i != 0; i--) - { - sample1 = *compressed++; - sample2 = sample1 << 4; - //Sample 2 = Bottom Nibble, Sign Extended. - sample2 >>= 4; - //Sample 1 = Top Nibble, shifted down and Sign Extended. - sample1 >>= 4; - - out = ((sample1 << shift) * 256 + (prev0 & ~0x2) * 488 - prev1 * 240) >> 8; - - prev1 = prev0; - prev0 = (int16)out; - *raw++ = (int16)out; - - out = ((sample2 << shift) * 256 + (prev0 & ~0x2) * 488 - prev1 * 240) >> 8; - - prev1 = prev0; - prev0 = (int16)out; - *raw++ = (int16)out; - } - break; - - case 3: - for (i = 8; i != 0; i--) - { - sample1 = *compressed++; - sample2 = sample1 << 4; - //Sample 2 = Bottom Nibble, Sign Extended. - sample2 >>= 4; - //Sample 1 = Top Nibble, shifted down and Sign Extended. - sample1 >>= 4; - out = (int32)(sample1 << shift); - out += (int32)((double)prev0 * 115 / 64 - (double)prev1 * 13 / 16); - - prev1 = prev0; - prev0 = out; - - CLIP16(out); - *raw++ = (int16)out; - - out = (int32)(sample2 << shift); - out += (int32)((double)prev0 * 115 / 64 - (double)prev1 * 13 / 16); - - prev1 = prev0; - prev0 = out; - - CLIP16(out); - *raw++ = (int16)out; - } - break; - } - ch->previous [0] = prev0; - ch->previous [1] = prev1; - ch->block_pointer += 9; -} - void DecodeBlock(Channel* ch) { int32 out; @@ -764,14 +503,6 @@ void DecodeBlock(Channel* ch) unsigned char i; bool invalid_header; - if (Settings.AltSampleDecode) - { - if (Settings.AltSampleDecode < 3) - AltDecodeBlock(ch); - else - AltDecodeBlock2(ch); - return; - } if (ch->block_pointer > 0x10000 - 9) { ch->last_block = TRUE; |