[mupen64plus-rsp-hle] 148/167: Remove upstream merged patches

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 06:02:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

ecsv-guest pushed a commit to branch armhf_test
in repository mupen64plus-rsp-hle.

commit 2501c5f2c1cd6cb4bf9d71436037a5c7ac5f9418
Author: Sven Eckelmann <sven at narfation.org>
Date:   Sat Apr 5 14:22:55 2014 +0200

    Remove upstream merged patches
---
 debian/changelog                                |   4 +
 debian/patches/jpeg_dispatching_278b0.patch     |  20 -
 debian/patches/jpeg_memory_alloc_reduce.patch   |  36 -
 debian/patches/jpeg_memory_alloc_refactor.patch | 152 ----
 debian/patches/jpeg_memory_alloc_stack.patch    |  40 --
 debian/patches/musyx_initial.patch              | 892 ------------------------
 debian/patches/series                           |   5 -
 7 files changed, 4 insertions(+), 1145 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1c3efe5..b5854de 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,10 @@
 mupen64plus-rsp-hle (2.0+158+g889a070-1) UNRELEASED; urgency=medium
 
   * New Upstream Snapshot from 889a0707a5e1ce0197024789a6f7fc1e0a093a99
+  * debian/patches:
+    - Remove upstream merged jpeg_dispatching_278b0.patch,
+      jpeg_memory_alloc_reduce.patch, jpeg_memory_alloc_refactor.patch,
+      jpeg_memory_alloc_stack.patch, musyx_initial.patch
 
  -- Sven Eckelmann <sven at narfation.org>  Sat, 05 Apr 2014 14:20:14 +0200
 
diff --git a/debian/patches/jpeg_dispatching_278b0.patch b/debian/patches/jpeg_dispatching_278b0.patch
deleted file mode 100644
index c1a9c83..0000000
--- a/debian/patches/jpeg_dispatching_278b0.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Description: Bottom of the 9th jpeg task dispatching
-Origin: upstream, https://github.com/mupen64plus/mupen64plus-rsp-hle/commit/6e2d80e4135e1b7d801d660d572ab20608c94706
-Author: Bobby Smiles <bobby.smiles32 at gmail.com>
-
----
-diff --git a/src/main.c b/src/main.c
-index ff6525aefab5587ab3f87c7a82aea0b119c6e641..396321f77680acc9126fa7d17c09e823ce9c67c5 100644
---- a/src/main.c
-+++ b/src/main.c
-@@ -226,7 +226,9 @@ static void normal_task_dispatching()
-         case 0x2caa6: jpeg_decode_PS(); return;
- 
-         /* JPEG: found in Ogre Battle, Bottom of the 9th */
--        case 0x130de: jpeg_decode_OB(); return;
-+        case 0x130de:
-+        case 0x278b0:
-+            jpeg_decode_OB(); return;
-     }
- 
-     handle_unknown_task(sum);
diff --git a/debian/patches/jpeg_memory_alloc_reduce.patch b/debian/patches/jpeg_memory_alloc_reduce.patch
deleted file mode 100644
index 923fdf5..0000000
--- a/debian/patches/jpeg_memory_alloc_reduce.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Description: macroblock memory allocation was bigger than needed
-Origin: upstream, https://github.com/mupen64plus/mupen64plus-rsp-hle/commit/60ecc0ddfcb0da8ca734ac39647565c9d8692139
-Author: Bobby Smiles <bobby.smiles32 at gmail.com>
-
----
-diff --git a/src/jpeg.c b/src/jpeg.c
-index 28fcc8bdd9223ed545b56023742c85b899b5c7bc..2083220bff8b451096e2158d9221a13d8c177d01 100755
---- a/src/jpeg.c
-+++ b/src/jpeg.c
-@@ -250,7 +250,7 @@ static void jpeg_decode_std(const char * const version, const std_macroblock_dec
-     }
-     
-     subblock_count = mode + 4;
--    macroblock_size = 2*subblock_count*SUBBLOCK_SIZE;
-+    macroblock_size = subblock_count*SUBBLOCK_SIZE;
- 
-     rdram_read_many_u16((uint16_t*)qtables[0], qtableY_ptr, SUBBLOCK_SIZE);
-     rdram_read_many_u16((uint16_t*)qtables[1], qtableU_ptr, SUBBLOCK_SIZE);
-@@ -265,7 +265,7 @@ static void jpeg_decode_std(const char * const version, const std_macroblock_dec
- 
-     for (mb = 0; mb < macroblock_count; ++mb)
-     {
--        rdram_read_many_u16((uint16_t*)macroblock, address, macroblock_size >> 1);
-+        rdram_read_many_u16((uint16_t*)macroblock, address, macroblock_size);
-         decode_mb(macroblock, subblock_count, (const int16_t (*)[SUBBLOCK_SIZE])qtables);
- 
-         if (mode == 0)
-@@ -277,7 +277,7 @@ static void jpeg_decode_std(const char * const version, const std_macroblock_dec
-             EmitTilesMode2(emit_line, macroblock, address);
-         }
- 
--        address += macroblock_size;
-+        address += 2*macroblock_size;
-     }
-     free(macroblock);
- }
diff --git a/debian/patches/jpeg_memory_alloc_refactor.patch b/debian/patches/jpeg_memory_alloc_refactor.patch
deleted file mode 100644
index 607c7b3..0000000
--- a/debian/patches/jpeg_memory_alloc_refactor.patch
+++ /dev/null
@@ -1,152 +0,0 @@
-Description: Refactor standard macroblock decoder
-Origin: upstream, https://github.com/mupen64plus/mupen64plus-rsp-hle/commit/8979df77740ba8c845a6ff3b3cc452ae7c5ba927
-Author: Bobby Smiles <bobby.smiles32 at gmail.com>
-
----
-diff --git a/src/jpeg.c b/src/jpeg.c
-index e1a3fefee96ac54dd13534c16a80f2c5fbc100f8..3db2e8969d0fef64e7e85884bc8df8eb04a2f6d4 100755
---- a/src/jpeg.c
-+++ b/src/jpeg.c
-@@ -33,7 +33,7 @@
- #define SUBBLOCK_SIZE 64
- 
- typedef void (*tile_line_emitter_t)(const int16_t *y, const int16_t *u, uint32_t address);
--typedef void (*std_macroblock_decoder_t)(int16_t *macroblock, unsigned int subblock_count, const int16_t qtables[3][SUBBLOCK_SIZE]);
-+typedef void (*subblock_transform_t)(int16_t* dst, const int16_t* src);
- 
- /* rdram operations */
- // FIXME: these functions deserve their own module
-@@ -43,7 +43,10 @@ static uint32_t rdram_read_u32(uint32_t address);
- static void rdram_write_many_u32(const uint32_t *src, uint32_t address, unsigned int count);
- 
- /* standard jpeg ucode decoder */
--static void jpeg_decode_std(const char * const version, const std_macroblock_decoder_t decode_mb, const tile_line_emitter_t emit_line);
-+static void jpeg_decode_std(const char * const version,
-+        const subblock_transform_t transform_luma,
-+        const subblock_transform_t transform_chroma,
-+        const tile_line_emitter_t emit_line);
- 
- /* helper functions */
- static uint8_t clamp_u8(int16_t x);
-@@ -60,9 +63,11 @@ static void EmitYUVTileLine(const int16_t *y, const int16_t *u, uint32_t address
- static void EmitRGBATileLine(const int16_t *y, const int16_t *u, uint32_t address);
- 
- /* macroblocks operations */
--static void DecodeMacroblock1(int16_t *macroblock, int32_t *y_dc, int32_t *u_dc, int32_t *v_dc, const int16_t *qtable);
--static void DecodeMacroblock2(int16_t *macroblock, unsigned int subblock_count, const int16_t qtables[3][SUBBLOCK_SIZE]);
--static void DecodeMacroblock3(int16_t *macroblock, unsigned int subblock_count, const int16_t qtables[3][SUBBLOCK_SIZE]);
-+static void decode_macroblock_ob(int16_t *macroblock, int32_t *y_dc, int32_t *u_dc, int32_t *v_dc, const int16_t *qtable);
-+static void decode_macroblock_std(
-+        const subblock_transform_t transform_luma,
-+        const subblock_transform_t transform_chroma,
-+        int16_t *macroblock, unsigned int subblock_count, const int16_t qtables[3][SUBBLOCK_SIZE]);
- static void EmitTilesMode0(const tile_line_emitter_t emit_line, const int16_t *macroblock, uint32_t address);
- static void EmitTilesMode2(const tile_line_emitter_t emit_line, const int16_t *macroblock, uint32_t address);
- 
-@@ -145,7 +150,7 @@ static const float IDCT_K[10] =
-  **************************************************************************/
- void jpeg_decode_PS0()
- {
--    jpeg_decode_std("PS0", DecodeMacroblock3, EmitYUVTileLine);
-+    jpeg_decode_std("PS0", RescaleYSubBlock, RescaleUVSubBlock, EmitYUVTileLine);
- }
- 
- /***************************************************************************
-@@ -154,7 +159,7 @@ void jpeg_decode_PS0()
-  **************************************************************************/
- void jpeg_decode_PS()
- {
--    jpeg_decode_std("PS", DecodeMacroblock2, EmitRGBATileLine);
-+    jpeg_decode_std("PS", NULL, NULL, EmitRGBATileLine);
- }
- 
- /***************************************************************************
-@@ -197,7 +202,7 @@ void jpeg_decode_OB()
-         int16_t macroblock[6*SUBBLOCK_SIZE];
- 
-         rdram_read_many_u16((uint16_t*)macroblock, address, 6*SUBBLOCK_SIZE);
--        DecodeMacroblock1(macroblock, &y_dc, &u_dc, &v_dc, (qscale != 0) ? qtable : NULL);
-+        decode_macroblock_ob(macroblock, &y_dc, &u_dc, &v_dc, (qscale != 0) ? qtable : NULL);
-         EmitTilesMode2(EmitYUVTileLine, macroblock, address);
- 
-         address += (2*6*SUBBLOCK_SIZE);
-@@ -206,7 +211,10 @@ void jpeg_decode_OB()
- 
- 
- /* local functions */
--static void jpeg_decode_std(const char * const version, const std_macroblock_decoder_t decode_mb, const tile_line_emitter_t emit_line)
-+static void jpeg_decode_std(const char * const version,
-+        const subblock_transform_t transform_luma,
-+        const subblock_transform_t transform_chroma,
-+        const tile_line_emitter_t emit_line)
- {
-     int16_t qtables[3][SUBBLOCK_SIZE];
-     unsigned int mb;
-@@ -259,7 +267,8 @@ static void jpeg_decode_std(const char * const version, const std_macroblock_dec
-     for (mb = 0; mb < macroblock_count; ++mb)
-     {
-         rdram_read_many_u16((uint16_t*)macroblock, address, macroblock_size);
--        decode_mb(macroblock, subblock_count, (const int16_t (*)[SUBBLOCK_SIZE])qtables);
-+        decode_macroblock_std(transform_luma, transform_chroma,
-+                macroblock, subblock_count, (const int16_t (*)[SUBBLOCK_SIZE])qtables);
- 
-         if (mode == 0)
-         {
-@@ -399,7 +408,7 @@ static void EmitTilesMode2(const tile_line_emitter_t emit_line, const int16_t *m
-     }
- }
- 
--static void DecodeMacroblock1(int16_t *macroblock, int32_t *y_dc, int32_t *u_dc, int32_t *v_dc, const int16_t *qtable)
-+static void decode_macroblock_ob(int16_t *macroblock, int32_t *y_dc, int32_t *u_dc, int32_t *v_dc, const int16_t *qtable)
- {
-     int sb;
- 
-@@ -426,28 +435,10 @@ static void DecodeMacroblock1(int16_t *macroblock, int32_t *y_dc, int32_t *u_dc,
-     }
- }
- 
--static void DecodeMacroblock2(int16_t *macroblock, unsigned int subblock_count, const int16_t qtables[3][SUBBLOCK_SIZE])
--{
--    unsigned int sb;
--    unsigned int q = 0;
--
--    for (sb = 0; sb < subblock_count; ++sb)
--    {
--        int16_t tmp_sb[SUBBLOCK_SIZE];
--        const int isChromaSubBlock = (subblock_count - sb <= 2);
--
--        if (isChromaSubBlock) { ++q; }
--
--        MultSubBlocks(macroblock, macroblock, qtables[q], 4);
--        ZigZagSubBlock(tmp_sb, macroblock);
--        InverseDCTSubBlock(macroblock, tmp_sb);
--
--        macroblock += SUBBLOCK_SIZE;
--    }
--
--}
--
--static void DecodeMacroblock3(int16_t *macroblock, unsigned int subblock_count, const int16_t qtables[3][SUBBLOCK_SIZE])
-+static void decode_macroblock_std(
-+        const subblock_transform_t transform_luma,
-+        const subblock_transform_t transform_chroma,
-+        int16_t *macroblock, unsigned int subblock_count, const int16_t qtables[3][SUBBLOCK_SIZE])
- {
-     unsigned int sb;
-     unsigned int q = 0;
-@@ -465,11 +456,13 @@ static void DecodeMacroblock3(int16_t *macroblock, unsigned int subblock_count,
- 
-         if (isChromaSubBlock)
-         {
--            RescaleUVSubBlock(macroblock, macroblock);
-+            if (transform_chroma != NULL)
-+                transform_chroma(macroblock, macroblock);
-         }
-         else
-         {
--            RescaleYSubBlock(macroblock, macroblock);
-+            if (transform_luma != NULL)
-+                transform_luma(macroblock, macroblock);
-         }
- 
-         macroblock += SUBBLOCK_SIZE;
diff --git a/debian/patches/jpeg_memory_alloc_stack.patch b/debian/patches/jpeg_memory_alloc_stack.patch
deleted file mode 100644
index 16733d5..0000000
--- a/debian/patches/jpeg_memory_alloc_stack.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-Description: Avoid dynamic memory allocation for macroblocks
-Origin: upstream, https://github.com/mupen64plus/mupen64plus-rsp-hle/commit/7f34cc810191b05ceff7a48171cf882e8550248b
-Author: Bobby Smiles <bobby.smiles32 at gmail.com>
-
----
-diff --git a/src/jpeg.c b/src/jpeg.c
-index 2083220bff8b451096e2158d9221a13d8c177d01..e1a3fefee96ac54dd13534c16a80f2c5fbc100f8 100755
---- a/src/jpeg.c
-+++ b/src/jpeg.c
-@@ -218,7 +218,7 @@ static void jpeg_decode_std(const char * const version, const std_macroblock_dec
-     uint32_t qtableV_ptr;
-     unsigned int subblock_count;
-     unsigned int macroblock_size;
--    int16_t *macroblock;
-+    int16_t macroblock[6*SUBBLOCK_SIZE]; /* macroblock contains at most 6 subblobcks */
-     const OSTask_t * const task = get_task();
- 
-     if (task->flags & 0x1)
-@@ -256,13 +256,6 @@ static void jpeg_decode_std(const char * const version, const std_macroblock_dec
-     rdram_read_many_u16((uint16_t*)qtables[1], qtableU_ptr, SUBBLOCK_SIZE);
-     rdram_read_many_u16((uint16_t*)qtables[2], qtableV_ptr, SUBBLOCK_SIZE);
- 
--    macroblock = malloc(sizeof(*macroblock) * macroblock_size);
--    if (!macroblock)
--    {
--        DebugMessage(M64MSG_WARNING, "jpeg_decode_%s: could not allocate macroblock", version);
--        return;
--    }
--
-     for (mb = 0; mb < macroblock_count; ++mb)
-     {
-         rdram_read_many_u16((uint16_t*)macroblock, address, macroblock_size);
-@@ -279,7 +272,6 @@ static void jpeg_decode_std(const char * const version, const std_macroblock_dec
- 
-         address += 2*macroblock_size;
-     }
--    free(macroblock);
- }
- 
- static uint8_t clamp_u8(int16_t x)
diff --git a/debian/patches/musyx_initial.patch b/debian/patches/musyx_initial.patch
deleted file mode 100644
index 2860b9f..0000000
--- a/debian/patches/musyx_initial.patch
+++ /dev/null
@@ -1,892 +0,0 @@
-Description: Add initial support for MusyX
-Origin: upstream, https://github.com/mupen64plus/mupen64plus-rsp-hle/commit/d31b8ea3ff5b5769a8be82fdc5910917b7042d55
-Author: Bobby Smiles <bobby.smiles32 at gmail.com>
-
----
-diff --git a/projects/msvc11/mupen64plus-rsp-hle.vcxproj b/projects/msvc11/mupen64plus-rsp-hle.vcxproj
-index 38c90592d48dba147723ba96e6c2d6f4e218ad82..b8e9409a9b72b3dabbd0a79eaafb0cdef0c4c3e5 100644
---- a/projects/msvc11/mupen64plus-rsp-hle.vcxproj
-+++ b/projects/msvc11/mupen64plus-rsp-hle.vcxproj
-@@ -96,6 +96,7 @@
-     <ClCompile Include="..\..\src\cicx105.c" />
-     <ClCompile Include="..\..\src\jpeg.c" />
-     <ClCompile Include="..\..\src\main.c" />
-+    <ClCompile Include="..\..\src\musyx.c" />
-     <ClCompile Include="..\..\src\ucode1.cpp" />
-     <ClCompile Include="..\..\src\ucode2.cpp" />
-     <ClCompile Include="..\..\src\ucode3.cpp" />
-@@ -107,8 +108,9 @@
-     <ClInclude Include="..\..\src\cicx105.h" />
-     <ClInclude Include="..\..\src\hle.h" />
-     <ClInclude Include="..\..\src\jpeg.h" />
-+    <ClInclude Include="..\..\src\musyx.h" />
-   </ItemGroup>
-   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-   <ImportGroup Label="ExtensionTargets">
-   </ImportGroup>
--</Project>
-\ No newline at end of file
-+</Project>
-diff --git a/projects/msvc8/mupen64plus-rsp-hle.vcproj b/projects/msvc8/mupen64plus-rsp-hle.vcproj
-index 1b9522852cbcc8ca09eb027bee68c53924121322..f820a3718e95cd3f584cc12278bb5b5729ca9d6d 100644
---- a/projects/msvc8/mupen64plus-rsp-hle.vcproj
-+++ b/projects/msvc8/mupen64plus-rsp-hle.vcproj
-@@ -195,6 +195,10 @@
- 				>
- 			</File>
- 			<File
-+				RelativePath="..\..\src\musyx.c"
-+				>
-+			</File>
-+			<File
- 				RelativePath="..\..\src\ucode1.cpp"
- 				>
- 			</File>
-@@ -236,6 +240,10 @@
- 				RelativePath="..\..\src\jpeg.h"
- 				>
- 			</File>
-+			<File
-+				RelativePath="..\..\src\musyx.h"
-+				>
-+			</File>
- 		</Filter>
- 	</Files>
- 	<Globals>
-diff --git a/projects/unix/Makefile b/projects/unix/Makefile
-index a6cef2318a77a32655cdba5f03a0d2fa231c0cf9..af975a6a545a261e340cdec5b9dfca109dfdf6bf 100644
---- a/projects/unix/Makefile
-+++ b/projects/unix/Makefile
-@@ -242,6 +242,7 @@ SOURCE = \
- 	$(SRCDIR)/alist.c \
- 	$(SRCDIR)/cicx105.c \
- 	$(SRCDIR)/jpeg.c \
-+	$(SRCDIR)/musyx.c \
- 	$(SRCDIR)/ucode3.cpp \
- 	$(SRCDIR)/ucode2.cpp \
- 	$(SRCDIR)/ucode1.cpp \
-diff --git a/src/main.c b/src/main.c
-index 396321f77680acc9126fa7d17c09e823ce9c67c5..5c9b79fea971638ff7806e3267c85cdf36830630 100644
---- a/src/main.c
-+++ b/src/main.c
-@@ -33,6 +33,7 @@
- #include "alist.h"
- #include "cicx105.h"
- #include "jpeg.h"
-+#include "musyx.h"
- 
- #define min(a,b) (((a) < (b)) ? (a) : (b))
- 
-@@ -166,8 +167,7 @@ static int try_fast_audio_dispatching()
-              * GauntletLegend, Rush2049, IndianaJones, BattleForNaboo
-              * TODO: implement ucode
-              **/
--            DebugMessage(M64MSG_WARNING, "MusyX ucode not implemented.");
--            /* return 1; */
-+            musyx_task(); return 1;
-         }
-         else
-         {
-diff --git a/src/musyx.c b/src/musyx.c
-new file mode 100644
-index 0000000000000000000000000000000000000000..b3dd98dd2e5d6e511f9eca25c3bd92c3d59d3c3f
---- /dev/null
-+++ b/src/musyx.c
-@@ -0,0 +1,763 @@
-+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-+ *   Mupen64plus-rsp-hle - musyx.c                                         *
-+ *   Mupen64Plus homepage: http://code.google.com/p/mupen64plus/           *
-+ *   Copyright (C) 2013 Bobby Smiles                                       *
-+ *                                                                         *
-+ *   This program is free software; you can redistribute it and/or modify  *
-+ *   it under the terms of the GNU General Public License as published by  *
-+ *   the Free Software Foundation; either version 2 of the License, or     *
-+ *   (at your option) any later version.                                   *
-+ *                                                                         *
-+ *   This program is distributed in the hope that it will be useful,       *
-+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
-+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
-+ *   GNU General Public License for more details.                          *
-+ *                                                                         *
-+ *   You should have received a copy of the GNU General Public License     *
-+ *   along with this program; if not, write to the                         *
-+ *   Free Software Foundation, Inc.,                                       *
-+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
-+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-+
-+#include <stdbool.h>
-+#include <stdint.h>
-+#include <string.h>
-+
-+extern const uint16_t ResampleLUT[0x200];
-+
-+#include "m64p_types.h"
-+#include "hle.h"
-+
-+/* various constants */
-+enum { SUBFRAME_SIZE = 192 };
-+enum { MAX_VOICES = 32 };
-+
-+enum { SAMPLE_BUFFER_SIZE = 0x200 };
-+
-+
-+enum
-+{
-+    SFD_VOICE_COUNT     = 0x0,
-+    SFD_SFX_INDEX       = 0x2,
-+    SFD_VOICE_BITMASK   = 0x4,
-+    SFD_STATE_PTR       = 0x8,
-+    SFD_SFX_PTR         = 0xc,
-+
-+    SFD_VOICES          = 0x10
-+};
-+
-+enum
-+{
-+    VOICE_ENV_BEGIN         = 0x00,
-+    VOICE_ENV_STEP          = 0x10,
-+    VOICE_PITCH_Q16         = 0x20,
-+    VOICE_PITCH_SHIFT       = 0x22,
-+    VOICE_CATSRC_0          = 0x24,
-+    VOICE_CATSRC_1          = 0x30,
-+    VOICE_ADPCM_FRAMES      = 0x3c,
-+    VOICE_SKIP_SAMPLES      = 0x3e,
-+
-+    /* for PCM16 */
-+    VOICE_U16_40            = 0x40,
-+    VOICE_U16_42            = 0x42,
-+
-+    /* for ADPCM */
-+    VOICE_ADPCM_TABLE_PTR   = 0x40,
-+
-+    VOICE_INTERLEAVED_PTR   = 0x44,
-+    VOICE_END_POINT         = 0x48,
-+    VOICE_RESTART_POINT     = 0x4a,
-+    VOICE_U16_4C            = 0x4c,
-+    VOICE_U16_4E            = 0x4e,
-+
-+    VOICE_SIZE              = 0x50
-+};
-+
-+enum
-+{
-+    CATSRC_PTR1     = 0x00,
-+    CATSRC_PTR2     = 0x04,
-+    CATSRC_SIZE1    = 0x08,
-+    CATSRC_SIZE2    = 0x0a
-+};
-+
-+enum
-+{
-+    STATE_LAST_SAMPLE   = 0x0,
-+    STATE_BASE_VOL      = 0x100,
-+    STATE_CC0           = 0x110,
-+    STATE_740_LAST4     = 0x290
-+};
-+
-+enum
-+{
-+    SFX_CBUFFER_PTR     = 0x00,
-+    SFX_CBUFFER_LENGTH  = 0x04,
-+    SFX_TAP_COUNT       = 0x08,
-+    SFX_FIR4_HGAIN      = 0x0a,
-+    SFX_TAP_DELAYS      = 0x0c,
-+    SFX_TAP_GAINS       = 0x2c,
-+    // padding          = 0x3c
-+    SFX_FIR4_HCOEFFS    = 0x40
-+};
-+
-+
-+/* struct definition */
-+typedef struct
-+{
-+    /* internal subframes */
-+    int16_t left[SUBFRAME_SIZE];
-+    int16_t right[SUBFRAME_SIZE];
-+    int16_t cc0[SUBFRAME_SIZE];
-+    int16_t e50[SUBFRAME_SIZE];
-+
-+    /* internal subframes base volumes */
-+    int32_t base_vol[4];
-+
-+    /* */
-+    int16_t subframe_740_last4[4];
-+} musyx_t;
-+
-+/* helper functions prototypes */
-+static void load_base_vol(int32_t* base_vol, uint32_t address);
-+static void save_base_vol(const int32_t* base_vol, uint32_t address);
-+static void update_base_vol(int32_t* base_vol, uint32_t voice_mask, uint32_t last_sample_ptr);
-+
-+static void init_subframes(musyx_t* musyx);
-+
-+static uint32_t voice_stage(musyx_t* musyx, uint32_t voice_ptr, uint32_t last_sample_ptr);
-+
-+static void dma_cat8(uint8_t* dst, uint32_t catsrc_ptr);
-+static void dma_cat16(uint16_t* dst, uint32_t catsrc_ptr);
-+
-+static void load_samples_PCM16(uint32_t voice_ptr, int16_t* samples, unsigned* segbase, unsigned* offset);
-+static void load_samples_ADPCM(uint32_t voice_ptr, int16_t* samples, unsigned* segbase, unsigned* offset);
-+
-+static void adpcm_decode_frames(int16_t* dst, const uint8_t* src, const int16_t* table, uint8_t count, uint8_t skip_samples);
-+
-+static int16_t adpcm_get_predicted_sample(uint8_t byte, uint8_t mask, unsigned lshift, unsigned rshift);
-+static void adpcm_get_predicted_frame(int16_t* dst, const uint8_t* src, const uint8_t* nibbles, unsigned int rshift);
-+static void adpcm_decode_upto_8_samples(int16_t* dst, const int16_t* src,
-+        const int16_t* cb_entry, const int16_t* last_samples, size_t size);
-+
-+static void mix_voice_samples(musyx_t* musyx, uint32_t voice_ptr, const int16_t* samples, unsigned segbase, unsigned offset, uint32_t last_sample_ptr);
-+
-+static void sfx_stage(musyx_t* musyx, uint32_t sfx_ptr, uint16_t idx);
-+
-+static void interleave_stage(musyx_t* musyx, uint32_t output_ptr);
-+
-+
-+static uint8_t*  dram_u8 (uint32_t address);
-+static uint16_t* dram_u16(uint32_t address);
-+static uint32_t* dram_u32(uint32_t address);
-+
-+static void load_u8(uint8_t* dst, uint32_t address, size_t count);
-+static void load_u16(uint16_t* dst, uint32_t address, size_t count);
-+static void load_u32(uint32_t* dst, uint32_t address, size_t count);
-+
-+static void store_u16(const uint16_t* src, uint32_t address, size_t count);
-+
-+static inline int16_t clamp_s16(int32_t x)
-+{
-+    if (x > 32767) { x = 32767; } else if (x < -32768) { x = -32768; }
-+    return x;
-+}
-+
-+static inline unsigned int align(unsigned int x, unsigned amount)
-+{
-+    --amount;
-+    return (x + amount) & ~amount;
-+}
-+
-+static int32_t rdot(size_t n, const int16_t* x, const int16_t* y)
-+{
-+    int32_t accu = 0;
-+
-+    y += n;
-+
-+    while(n != 0)
-+    {
-+        accu += ((int32_t)*(x++) * (int32_t)*(--y));
-+        --n;
-+    }
-+
-+    return accu;
-+}
-+
-+
-+static int32_t dot4(const int16_t* x, const int16_t* y)
-+{
-+    size_t i;
-+    int32_t accu = 0;
-+
-+    for(i = 0; i < 4; ++i)
-+        accu = clamp_s16(accu + (((int32_t)x[i] * (int32_t)y[i]) >> 15));
-+
-+    return accu;
-+}
-+
-+/* Fast and dirty way of reading dram memory 
-+ * Assume properly aligned access
-+ */
-+uint8_t* dram_u8(uint32_t address)
-+{
-+    return (uint8_t*)&rsp.RDRAM[(address & 0xffffff) ^ S8];
-+}
-+
-+uint16_t* dram_u16(uint32_t address)
-+{
-+    return (uint16_t*)&rsp.RDRAM[(address & 0xffffff) ^ S16];
-+}
-+
-+uint32_t* dram_u32(uint32_t address)
-+{
-+    return (uint32_t*)&rsp.RDRAM[address & 0xffffff];
-+}
-+
-+void load_u8(uint8_t* dst, uint32_t address, size_t count)
-+{
-+    while(count != 0)
-+    {
-+        *(dst++) = *dram_u8(address); address += 1;
-+        --count;
-+    }
-+}
-+
-+void load_u16(uint16_t* dst, uint32_t address, size_t count)
-+{
-+    while(count != 0)
-+    {
-+        *(dst++) = *dram_u16(address); address += 2;
-+        --count;
-+    }
-+}
-+
-+void load_u32(uint32_t* dst, uint32_t address, size_t count)
-+{
-+    /* Optimization for uint32_t */
-+    const uint32_t* src = dram_u32(address);
-+
-+    memcpy(dst, src, count * sizeof(uint32_t));
-+}
-+
-+void store_u16(const uint16_t* src, uint32_t address, size_t count)
-+{
-+    while(count != 0)
-+    {
-+        *dram_u16(address) = *(src++); address += 2;
-+        --count;
-+    }
-+}
-+
-+/**************************************************************************
-+ * MusyX audio ucode
-+ **************************************************************************/
-+void musyx_task()
-+{
-+    const OSTask_t * const task = get_task();
-+    
-+    uint32_t sfd_ptr   = task->data_ptr;
-+    uint32_t sfd_count = task->data_size;
-+
-+    DebugMessage(M64MSG_VERBOSE, "musyx_task: *data=%x, #SF=%d",
-+            sfd_ptr,
-+            sfd_count);
-+
-+    uint32_t state_ptr = *dram_u32(sfd_ptr + SFD_STATE_PTR);
-+
-+    musyx_t musyx;
-+
-+    /* load initial state */
-+    load_base_vol(musyx.base_vol, state_ptr + STATE_BASE_VOL);
-+    load_u16((uint16_t*)musyx.cc0, state_ptr + STATE_CC0, SUBFRAME_SIZE);
-+    load_u16((uint16_t*)musyx.subframe_740_last4, state_ptr + STATE_740_LAST4, 4);
-+    
-+    for(;;)
-+    {
-+        /* parse SFD structre */
-+        /*uint16_t voice_count = *dram_u16(sfd_ptr + SFD_VOICE_COUNT);*/
-+        uint16_t sfx_index   = *dram_u16(sfd_ptr + SFD_SFX_INDEX);
-+        uint32_t voice_mask  = *dram_u32(sfd_ptr + SFD_VOICE_BITMASK);
-+        uint32_t sfx_ptr     = *dram_u32(sfd_ptr + SFD_SFX_PTR);
-+        uint32_t voice_ptr       = sfd_ptr + SFD_VOICES;
-+        uint32_t last_sample_ptr = state_ptr + STATE_LAST_SAMPLE;
-+       
-+        /* initialize internal subframes using updated base volumes */
-+        update_base_vol(musyx.base_vol, voice_mask, last_sample_ptr);
-+        init_subframes(&musyx);
-+
-+        /* active voices get mixed into L,R,cc0,e50 subframes (optional) */
-+        uint32_t output_ptr = voice_stage(&musyx, voice_ptr, last_sample_ptr);
-+
-+        /* apply delay-based effects (optional) */
-+        sfx_stage(&musyx, sfx_ptr, sfx_index);
-+        
-+        /* emit interleaved L,R subframes */
-+        interleave_stage(&musyx, output_ptr);
-+
-+        --sfd_count;
-+        if (sfd_count == 0)
-+            break;
-+
-+        sfd_ptr += SFD_VOICES + MAX_VOICES * VOICE_SIZE;
-+        state_ptr = *dram_u32(sfd_ptr + SFD_STATE_PTR);
-+    }
-+
-+    /* writeback updated state */
-+    save_base_vol(musyx.base_vol, state_ptr + STATE_BASE_VOL);
-+    store_u16((uint16_t*)musyx.cc0, state_ptr + STATE_CC0, SUBFRAME_SIZE);
-+    store_u16((uint16_t*)musyx.subframe_740_last4, state_ptr + STATE_740_LAST4, 4);
-+}
-+
-+void load_base_vol(int32_t* base_vol, uint32_t address)
-+{
-+    base_vol[0] = ((uint32_t)(*dram_u16(address    )) << 16) | (*dram_u16(address +  8));
-+    base_vol[1] = ((uint32_t)(*dram_u16(address + 2)) << 16) | (*dram_u16(address + 10));
-+    base_vol[2] = ((uint32_t)(*dram_u16(address + 4)) << 16) | (*dram_u16(address + 12));
-+    base_vol[3] = ((uint32_t)(*dram_u16(address + 6)) << 16) | (*dram_u16(address + 14));
-+}
-+
-+void save_base_vol(const int32_t* base_vol, uint32_t address)
-+{
-+    unsigned k;
-+
-+    for(k = 0; k < 4; ++k)
-+    {
-+        *dram_u16(address) = (uint16_t)(base_vol[k] >> 16); address += 2;
-+    }
-+
-+    for(k = 0; k < 4; ++k)
-+    {
-+        *dram_u16(address) = (uint16_t)(base_vol[k]); address += 2;
-+    }
-+}
-+
-+void update_base_vol(int32_t* base_vol, uint32_t voice_mask, uint32_t last_sample_ptr)
-+{
-+    unsigned i, k;
-+    uint32_t mask;
-+
-+    DebugMessage(M64MSG_VERBOSE, "base_vol voice_mask = %08x", voice_mask);
-+    DebugMessage(M64MSG_VERBOSE, "BEFORE: base_vol = %08x %08x %08x %08x",
-+            base_vol[0], base_vol[1], base_vol[2], base_vol[3]);
-+
-+    /* optim: skip voices contributions entirely if voice_mask is empty */
-+    if (voice_mask != 0)
-+    {
-+        for(i = 0, mask = 1; i < MAX_VOICES; ++i, mask <<= 1, last_sample_ptr += 8)
-+        {
-+            if ((voice_mask & mask) == 0)
-+                continue;
-+
-+            for(k = 0; k < 4; ++k)
-+                base_vol[k] += (int16_t)*dram_u16(last_sample_ptr + k * 2);
-+        }
-+    }
-+
-+    /* apply 3% decay */
-+    for(k = 0; k < 4; ++k)
-+    {
-+        base_vol[k] = (base_vol[k] * 0x0000f850) >> 16;
-+    }
-+
-+    DebugMessage(M64MSG_VERBOSE, "AFTER: base_vol = %08x %08x %08x %08x",
-+            base_vol[0], base_vol[1], base_vol[2], base_vol[3]);
-+}
-+
-+void init_subframes(musyx_t* musyx)
-+{
-+    unsigned i;
-+
-+    int16_t base_cc0 = clamp_s16(musyx->base_vol[2]);
-+    int16_t base_e50 = clamp_s16(musyx->base_vol[3]);
-+
-+    int16_t* left  = musyx->left;
-+    int16_t* right = musyx->right;
-+    int16_t* cc0   = musyx->cc0;
-+    int16_t* e50   = musyx->e50;
-+
-+    for(i = 0; i < SUBFRAME_SIZE; ++i)
-+    {
-+        *(e50++)    = base_e50;
-+        *(left++)   = clamp_s16( *cc0 + base_cc0);
-+        *(right++)  = clamp_s16(-*cc0 - base_cc0);
-+        *(cc0++)    = 0;
-+    }
-+}
-+
-+/* Process voices, and returns interleaved subframe destination address */
-+uint32_t voice_stage(musyx_t* musyx, uint32_t voice_ptr, uint32_t last_sample_ptr)
-+{
-+    uint32_t output_ptr;
-+    int i = 0;
-+
-+    /* voice stage can be skipped if first voice has no samples */
-+    if (*dram_u16(voice_ptr + VOICE_CATSRC_0 + CATSRC_SIZE1) == 0)
-+    {
-+        DebugMessage(M64MSG_VERBOSE, "Skipping Voice stage");
-+        output_ptr = *dram_u32(voice_ptr + VOICE_INTERLEAVED_PTR);
-+    }
-+    /* otherwise process voices until a non null output_ptr is encountered */
-+    else for(;;)
-+    {
-+        DebugMessage(M64MSG_VERBOSE, "Processing Voice #%d", i);
-+
-+        /* load voice samples (PCM16 or APDCM) */
-+        int16_t samples[SAMPLE_BUFFER_SIZE];
-+        unsigned segbase;
-+        unsigned offset;
-+
-+        if (*dram_u8(voice_ptr + VOICE_ADPCM_FRAMES) == 0)
-+        {
-+            load_samples_PCM16(voice_ptr, samples, &segbase, &offset);
-+        }
-+        else
-+        {
-+            load_samples_ADPCM(voice_ptr, samples, &segbase, &offset);
-+        }
-+
-+        /* mix them with each internal subframes */
-+        mix_voice_samples(musyx, voice_ptr, samples, segbase, offset, last_sample_ptr + i * 8);
-+
-+        /* check break condition */
-+        output_ptr = *dram_u32(voice_ptr + VOICE_INTERLEAVED_PTR);
-+        if (output_ptr != 0) break;
-+
-+        /* next voice */
-+        ++i;
-+        voice_ptr += VOICE_SIZE;
-+    }
-+    
-+    return output_ptr;
-+}
-+
-+void dma_cat8(uint8_t* dst, uint32_t catsrc_ptr)
-+{
-+    uint32_t ptr1  = *dram_u32(catsrc_ptr + CATSRC_PTR1);
-+    uint32_t ptr2  = *dram_u32(catsrc_ptr + CATSRC_PTR2);
-+    uint16_t size1 = *dram_u16(catsrc_ptr + CATSRC_SIZE1);
-+    uint16_t size2 = *dram_u16(catsrc_ptr + CATSRC_SIZE2);
-+
-+    DebugMessage(M64MSG_VERBOSE, "dma_cat: %08x %08x %04x %04x",
-+            ptr1,
-+            ptr2,
-+            size1,
-+            size2);
-+
-+    size_t count1 = size1;
-+    size_t count2 = size2;
-+
-+    load_u8(dst, ptr1, count1);
-+
-+    if (size2 == 0)
-+        return;
-+
-+    load_u8(dst + count1, ptr2, count2);
-+}
-+
-+void dma_cat16(uint16_t* dst, uint32_t catsrc_ptr)
-+{
-+    uint32_t ptr1  = *dram_u32(catsrc_ptr + CATSRC_PTR1);
-+    uint32_t ptr2  = *dram_u32(catsrc_ptr + CATSRC_PTR2);
-+    uint16_t size1 = *dram_u16(catsrc_ptr + CATSRC_SIZE1);
-+    uint16_t size2 = *dram_u16(catsrc_ptr + CATSRC_SIZE2);
-+
-+    DebugMessage(M64MSG_VERBOSE, "dma_cat: %08x %08x %04x %04x",
-+            ptr1,
-+            ptr2,
-+            size1,
-+            size2);
-+
-+    size_t count1 = size1 >> 1;
-+    size_t count2 = size2 >> 1;
-+
-+    load_u16(dst, ptr1, count1);
-+
-+    if (size2 == 0)
-+        return;
-+
-+    load_u16(dst + count1, ptr2, count2);
-+}
-+
-+void load_samples_PCM16(uint32_t voice_ptr, int16_t* samples, unsigned* segbase, unsigned* offset)
-+{
-+    DebugMessage(M64MSG_VERBOSE, "Format: PCM16");
-+
-+    uint8_t  u8_3e  = *dram_u8 (voice_ptr + VOICE_SKIP_SAMPLES);
-+    uint16_t u16_40 = *dram_u16(voice_ptr + VOICE_U16_40);
-+    uint16_t u16_42 = *dram_u16(voice_ptr + VOICE_U16_42);
-+    
-+    unsigned count = align(u16_40 + u8_3e, 4);
-+    
-+    *segbase = SAMPLE_BUFFER_SIZE - count;
-+    *offset  = u8_3e;
-+
-+    dma_cat16((uint16_t*)samples + *segbase, voice_ptr + VOICE_CATSRC_0);
-+
-+    if (u16_42 != 0)
-+    {
-+        dma_cat16((uint16_t*)samples, voice_ptr + VOICE_CATSRC_1);
-+    }
-+}
-+
-+void load_samples_ADPCM(uint32_t voice_ptr, int16_t* samples, unsigned* segbase, unsigned* offset)
-+{
-+    /* decompressed samples cannot exceed 0x400 bytes;
-+     * ADPCM has a compression ratio of 5/16 */
-+    uint8_t buffer[SAMPLE_BUFFER_SIZE * 2 * 5 / 16];
-+    int16_t adpcm_table[128];
-+
-+    DebugMessage(M64MSG_VERBOSE, "Format: ADPCM");
-+
-+    uint8_t u8_3c = *dram_u8(voice_ptr + VOICE_ADPCM_FRAMES    );
-+    uint8_t u8_3d = *dram_u8(voice_ptr + VOICE_ADPCM_FRAMES + 1);
-+    uint8_t u8_3e = *dram_u8(voice_ptr + VOICE_SKIP_SAMPLES    );
-+    uint8_t u8_3f = *dram_u8(voice_ptr + VOICE_SKIP_SAMPLES + 1);
-+    uint32_t adpcm_table_ptr = *dram_u32(voice_ptr + VOICE_ADPCM_TABLE_PTR);
-+
-+    DebugMessage(M64MSG_VERBOSE, "Loading ADPCM table: %08x", adpcm_table_ptr);
-+    load_u16((uint16_t*)adpcm_table, adpcm_table_ptr, 128);
-+
-+    unsigned count = u8_3c << 5;
-+
-+    *segbase = SAMPLE_BUFFER_SIZE - count;
-+    *offset  = u8_3e & 0x1f;
-+
-+    dma_cat8(buffer, voice_ptr + VOICE_CATSRC_0);
-+    adpcm_decode_frames(samples + *segbase, buffer, adpcm_table, u8_3c, u8_3e);
-+
-+    if (u8_3d != 0)
-+    {
-+        dma_cat8(buffer, voice_ptr + VOICE_CATSRC_1);
-+        adpcm_decode_frames(samples, buffer, adpcm_table, u8_3d, u8_3f);
-+    }
-+}
-+
-+void adpcm_decode_frames(int16_t* dst, const uint8_t* src, const int16_t* table, uint8_t count, uint8_t skip_samples)
-+{
-+    DebugMessage(M64MSG_VERBOSE, "ADPCM decode: count=%d, skip=%d", count, skip_samples);
-+
-+    int16_t frame[32];
-+    const uint8_t* nibbles = src + 8;
-+    unsigned i;
-+    bool jump_gap = false;
-+
-+    if (skip_samples >= 32)
-+    {
-+        jump_gap = true;
-+        nibbles += 16;
-+        src += 4;
-+    }
-+
-+    for(i = 0; i < count; ++i)
-+    {
-+        uint8_t code = nibbles[0];
-+
-+        const int16_t* book = (code & 0xf0) + table;
-+        unsigned int rshift = (code & 0x0f);
-+
-+        adpcm_get_predicted_frame(frame, src, nibbles, rshift);
-+
-+        memcpy(dst, frame, 2 * sizeof(frame[0]));
-+        adpcm_decode_upto_8_samples(dst +  2, frame +  2, book, dst     , 6);
-+        adpcm_decode_upto_8_samples(dst +  8, frame +  8, book, dst +  6, 8);
-+        adpcm_decode_upto_8_samples(dst + 16, frame + 16, book, dst + 14, 8);
-+        adpcm_decode_upto_8_samples(dst + 24, frame + 24, book, dst + 22, 8);
-+
-+        if (jump_gap)
-+        {
-+            nibbles += 8;
-+            src += 32;
-+        }
-+
-+        jump_gap = !jump_gap;
-+        nibbles += 16;
-+        src += 4;
-+        dst += 32;
-+    }
-+}
-+
-+int16_t adpcm_get_predicted_sample(uint8_t byte, uint8_t mask, unsigned lshift, unsigned rshift)
-+{
-+    int16_t sample = ((uint16_t)byte & (uint16_t)mask) << lshift;
-+    sample >>= rshift; /* signed */
-+    return sample;
-+}
-+
-+void adpcm_get_predicted_frame(int16_t* dst, const uint8_t* src, const uint8_t* nibbles, unsigned int rshift)
-+{
-+    unsigned int i;
-+
-+    *(dst++) = (src[0] << 8) | src[1];
-+    *(dst++) = (src[2] << 8) | src[3];
-+
-+    for(i = 1; i < 16; ++i)
-+    {
-+        uint8_t byte = nibbles[i];
-+
-+        *(dst++) = adpcm_get_predicted_sample(byte, 0xf0,  8, rshift);
-+        *(dst++) = adpcm_get_predicted_sample(byte, 0x0f, 12, rshift);
-+    }
-+}
-+
-+void adpcm_decode_upto_8_samples(int16_t* dst, const int16_t* src,
-+        const int16_t* cb_entry, const int16_t* last_samples, size_t size)
-+{
-+    const int16_t * const book1 = cb_entry;
-+    const int16_t * const book2 = cb_entry + 8;
-+
-+    const int16_t l1 = last_samples[0];
-+    const int16_t l2 = last_samples[1];
-+
-+    size_t i;
-+    int32_t accu;
-+
-+    for(i = 0; i < size; ++i)
-+    {
-+        accu = (int32_t)src[i] << 11;
-+        accu += book1[i] * l1 + book2[i] * l2 + rdot(i, book2, src);
-+        dst[i] = clamp_s16(accu >> 11);
-+    }
-+}
-+
-+void mix_voice_samples(musyx_t* musyx, uint32_t voice_ptr, const int16_t* samples, unsigned segbase, unsigned offset, uint32_t last_sample_ptr)
-+{
-+    int i,k;
-+
-+    /* parse VOICE structure */
-+    const uint16_t pitch_q16   = *dram_u16(voice_ptr + VOICE_PITCH_Q16);
-+    const uint16_t pitch_shift = *dram_u16(voice_ptr + VOICE_PITCH_SHIFT); // Q4.12
-+
-+    const uint16_t end_point     = *dram_u16(voice_ptr + VOICE_END_POINT);
-+    const uint16_t restart_point = *dram_u16(voice_ptr + VOICE_RESTART_POINT);
-+
-+    const uint16_t u16_4e = *dram_u16(voice_ptr + VOICE_U16_4E);
-+
-+    /* init values and pointers */
-+    const int16_t*       sample         = samples + segbase + offset + u16_4e;
-+    const int16_t* const sample_end     = samples + segbase + end_point;
-+    const int16_t* const sample_restart = samples + (restart_point & 0x7fff) +
-+        (((restart_point & 0x8000) != 0) ? 0x000 : segbase);
-+
-+
-+    uint32_t pitch_accu = pitch_q16;
-+    uint32_t pitch_step = pitch_shift << 4;
-+
-+    int32_t  v4_env[4];
-+    int32_t  v4_env_step[4];
-+    int16_t* v4_dst[4];
-+    int16_t  v4[4];
-+
-+    load_u32((uint32_t*)v4_env,      voice_ptr + VOICE_ENV_BEGIN, 4);
-+    load_u32((uint32_t*)v4_env_step, voice_ptr + VOICE_ENV_STEP,  4);
-+
-+    v4_dst[0] = musyx->left;
-+    v4_dst[1] = musyx->right;
-+    v4_dst[2] = musyx->cc0;
-+    v4_dst[3] = musyx->e50;
-+
-+    DebugMessage(M64MSG_VERBOSE,
-+            "Voice debug: segbase=%d"
-+            "\tu16_4e=%04x\n"
-+            "\tpitch: frac0=%04x shift=%04x\n"
-+            "\tend_point=%04x restart_point=%04x\n"
-+            "\tenv      = %08x %08x %08x %08x\n"
-+            "\tenv_step = %08x %08x %08x %08x\n",
-+            segbase,
-+            u16_4e,
-+            pitch_q16, pitch_shift,
-+            end_point, restart_point,
-+            v4_env[0],      v4_env[1],      v4_env[2],      v4_env[3],
-+            v4_env_step[0], v4_env_step[1], v4_env_step[2], v4_env_step[3]);
-+   
-+
-+    for(i = 0; i < SUBFRAME_SIZE; ++i)
-+    {
-+        /* update sample and resample_lut pointers and then pitch_accu */
-+        sample += (pitch_accu >> 16);
-+        const int16_t* lut = (int16_t*)(ResampleLUT + ((pitch_accu & 0xfc00) >> 8));
-+        pitch_accu &= 0xffff;
-+        pitch_accu += pitch_step;
-+
-+        /* handle end/restart points */
-+        int dist = sample - sample_end;
-+        if (dist >= 0) { sample = sample_restart + dist; }
-+
-+        /* apply resample filter */
-+        int16_t v = clamp_s16(dot4(sample, lut));
-+
-+        for(k = 0; k < 4; ++k)
-+        {
-+            /* envmix */
-+            int32_t accu = (v * (v4_env[k] >> 16)) >> 15;
-+            v4[k] = clamp_s16(accu);
-+            *(v4_dst[k]) = clamp_s16(accu + *(v4_dst[k]));
-+            
-+            /* update envelopes and dst pointers */
-+            ++(v4_dst[k]);
-+            v4_env[k] += v4_env_step[k];
-+        }
-+    }
-+
-+    /* save last resampled sample */
-+    store_u16((uint16_t*)v4, last_sample_ptr, 4);
-+
-+    DebugMessage(M64MSG_VERBOSE, "last_sample = %04x %04x %04x %04x",
-+        v4[0], v4[1], v4[2], v4[3]);
-+}
-+
-+
-+void sfx_stage(musyx_t* musyx, uint32_t sfx_ptr, uint16_t idx)
-+{
-+    DebugMessage(M64MSG_VERBOSE, "SFX: %08x, idx=%d", sfx_ptr, idx);
-+
-+    if (sfx_ptr == 0)
-+        return;
-+
-+    /* load sfx  parameters */
-+    uint32_t tap_delays[8];
-+    uint16_t tap_gains[8];
-+    uint16_t fir4_hcoeffs[4];
-+
-+    uint32_t cbuffer_ptr    = *dram_u32(sfx_ptr + SFX_CBUFFER_PTR);
-+    uint32_t cbuffer_length = *dram_u32(sfx_ptr + SFX_CBUFFER_LENGTH);
-+
-+    uint16_t tap_count      = *dram_u16(sfx_ptr + SFX_TAP_COUNT);
-+    load_u32(tap_delays, sfx_ptr + SFX_TAP_DELAYS, 8);
-+    load_u16(tap_gains,  sfx_ptr + SFX_TAP_GAINS,  8);
-+    
-+    uint16_t fir4_hgain     = *dram_u16(sfx_ptr + SFX_FIR4_HGAIN);
-+    load_u16(fir4_hcoeffs, sfx_ptr + SFX_FIR4_HCOEFFS, 4);
-+
-+
-+    DebugMessage(M64MSG_VERBOSE, "cbuffer: ptr=%08x length=%d", cbuffer_ptr, cbuffer_length);
-+
-+    DebugMessage(M64MSG_VERBOSE, "fir4: hgain=%04x hcoeff=%04x %04x %04x %04x",
-+            fir4_hgain, fir4_hcoeffs[0], fir4_hcoeffs[1], fir4_hcoeffs[2], fir4_hcoeffs[3]);
-+    
-+    DebugMessage(M64MSG_VERBOSE, "tap count=%d", tap_count);
-+    // TODO: 
-+}
-+
-+void interleave_stage(musyx_t* musyx, uint32_t output_ptr)
-+{
-+    DebugMessage(M64MSG_VERBOSE, "interleave: %08x", output_ptr);
-+
-+    size_t i;
-+
-+    int16_t base_left  = clamp_s16(musyx->base_vol[0]);
-+    int16_t base_right = clamp_s16(musyx->base_vol[1]);
-+
-+    int16_t* left  = musyx->left;
-+    int16_t* right = musyx->right;
-+    uint32_t* dst  = dram_u32(output_ptr);
-+
-+    for(i = 0; i < SUBFRAME_SIZE; ++i)
-+    {
-+        uint16_t l = clamp_s16(*(left++)  + base_left );
-+        uint16_t r = clamp_s16(*(right++) + base_right);
-+
-+        *(dst++) = (l << 16) | r;
-+    }
-+}
-+
-diff --git a/src/musyx.h b/src/musyx.h
-new file mode 100644
-index 0000000000000000000000000000000000000000..c3bf5aee1bbec643567126a09c365d5613b1e7b8
---- /dev/null
-+++ b/src/musyx.h
-@@ -0,0 +1,28 @@
-+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-+ *   Mupen64plus-rsp-hle - musyx.h                                         *
-+ *   Mupen64Plus homepage: http://code.google.com/p/mupen64plus/           *
-+ *   Copyright (C) 2013 Bobby Smiles                                       *
-+ *                                                                         *
-+ *   This program is free software; you can redistribute it and/or modify  *
-+ *   it under the terms of the GNU General Public License as published by  *
-+ *   the Free Software Foundation; either version 2 of the License, or     *
-+ *   (at your option) any later version.                                   *
-+ *                                                                         *
-+ *   This program is distributed in the hope that it will be useful,       *
-+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
-+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
-+ *   GNU General Public License for more details.                          *
-+ *                                                                         *
-+ *   You should have received a copy of the GNU General Public License     *
-+ *   along with this program; if not, write to the                         *
-+ *   Free Software Foundation, Inc.,                                       *
-+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
-+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-+
-+#ifndef MUSYX_H
-+#define MUSYX_H
-+
-+void musyx_task();
-+
-+#endif
-+
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index fcfbe23..0000000
--- a/debian/patches/series
+++ /dev/null
@@ -1,5 +0,0 @@
-jpeg_dispatching_278b0.patch
-jpeg_memory_alloc_reduce.patch
-jpeg_memory_alloc_stack.patch
-jpeg_memory_alloc_refactor.patch
-musyx_initial.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-rsp-hle.git



More information about the Pkg-games-commits mailing list