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 66d0d70aa94560f768aca8e02a5ea075b1a42a72 Author: Sven Eckelmann <[email protected]> Date: Fri Dec 13 18:22:04 2013 +0100 Fix JPEG decoding for Bottom of the 9th --- debian/changelog | 7 ++ debian/patches/jpeg_dispatching_278b0.patch | 19 +++ debian/patches/jpeg_memory_alloc_reduce.patch | 35 ++++++ debian/patches/jpeg_memory_alloc_refactor.patch | 151 ++++++++++++++++++++++++ debian/patches/jpeg_memory_alloc_stack.patch | 39 ++++++ debian/patches/series | 4 + 6 files changed, 255 insertions(+) diff --git a/debian/changelog b/debian/changelog index bcb80b8..a6c2b5f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,13 @@ mupen64plus-rsp-hle (2.0-2) UNRELEASED; urgency=low * Upgraded to policy 3.9.5, no changes required + * debian/patches: + - Add jpeg_dispatching_278b0.patch, Bottom of the 9th jpeg task dispatching + - Add jpeg_memory_alloc_reduce.patch, macroblock memory allocation was + bigger than needed + - Add jpeg_memory_alloc_stack.patch, Refactor standard macroblock decoder + - Add jpeg_memory_alloc_refactor.patch, Avoid dynamic memory allocation for + macroblocks -- Sven Eckelmann <[email protected]> Sat, 16 Nov 2013 18:12:30 +0100 diff --git a/debian/patches/jpeg_dispatching_278b0.patch b/debian/patches/jpeg_dispatching_278b0.patch new file mode 100644 index 0000000..7e53747 --- /dev/null +++ b/debian/patches/jpeg_dispatching_278b0.patch @@ -0,0 +1,19 @@ +Description: Bottom of the 9th jpeg task dispatching +Author: Bobby Smiles <[email protected]> + +--- +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 new file mode 100644 index 0000000..67de863 --- /dev/null +++ b/debian/patches/jpeg_memory_alloc_reduce.patch @@ -0,0 +1,35 @@ +Description: macroblock memory allocation was bigger than needed +Author: Bobby Smiles <[email protected]> + +--- +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 new file mode 100644 index 0000000..ac1d8dc --- /dev/null +++ b/debian/patches/jpeg_memory_alloc_refactor.patch @@ -0,0 +1,151 @@ +Description: Refactor standard macroblock decoder +Author: Bobby Smiles <[email protected]> + +--- +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 new file mode 100644 index 0000000..524e63c --- /dev/null +++ b/debian/patches/jpeg_memory_alloc_stack.patch @@ -0,0 +1,39 @@ +Description: Avoid dynamic memory allocation for macroblocks +Author: Bobby Smiles <[email protected]> + +--- +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/series b/debian/patches/series new file mode 100644 index 0000000..f9aa81a --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,4 @@ +jpeg_dispatching_278b0.patch +jpeg_memory_alloc_reduce.patch +jpeg_memory_alloc_stack.patch +jpeg_memory_alloc_refactor.patch -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-rsp-hle.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

