Skip to content

Commit

Permalink
Update source to beta3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
NuVanDibe committed Apr 6, 2022
1 parent de61e55 commit 5ce1578
Show file tree
Hide file tree
Showing 30 changed files with 169 additions and 909 deletions.
Binary file modified libfc_visoly_xg1/libflashcart.a
Binary file not shown.
Binary file modified libfc_xrom/libflashcart.a
Binary file not shown.
Binary file modified libpogo/lib/libpogo.a
Binary file not shown.
Binary file modified libpogo/lib/libpogod.a
Binary file not shown.
2 changes: 1 addition & 1 deletion shell2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ endif
LIBFCLASHCART = ../libfc_$(CART)/libflashcart.a


LIBFILE = libpogod.a
LIBFILE = libpogo.a
LIBS = -L$(POGO)/lib -lpogo -lgcc

#ifeq (mb, $(EXT))
Expand Down
Binary file modified shell2/backdrop.o
Binary file not shown.
72 changes: 49 additions & 23 deletions shell2/gba-jpeg-decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ typedef struct JPEG_ScanHeader_Component JPEG_ScanHeader_Component;
struct JPEG_HuffmanTable
{
const unsigned char *huffval; /**< Pointer to values in the table (256 entries). */
int maxcode [16]; /**< The maximum code for each length - 1. */
int maxcode [17]; /**< The maximum code for each length - 1. */
const unsigned char *valptr [16]; /**< Items are subtracted by mincode and then indexed into huffval. */

unsigned char look_nbits [256]; /**< The lookahead buffer lengths. */
Expand Down Expand Up @@ -134,29 +134,52 @@ struct JPEG_Decoder
/** Rewind any bytes that have not been read from and reset the state. */
#define JPEG_BITS_REWIND() \
do { \
int count = bits_left >> 3; \
\
while (count --) \
{ \
data --; \
if (data [-1] == 0xFF) \
data --; \
} \
\
bits_left = 0; \
bits_data = 0; \
if (bytes_left) { \
int count = bits_left >> 3; \
\
while (count --) \
{ \
while (data [-1] == 0xFF) \
data --; \
data --; \
} \
\
bits_left = 0; \
bits_data = 0; \
} else \
data = rewind_point; \
} while (0)

/** Fill the buffer. */
#define JPEG_BITS_CHECK() \
do { \
while (bits_left < 32 - 7) \
{ \
bits_data = (bits_data << 8) | (*data ++); \
if (data [-1] == 0xFF) \
data ++; \
bits_left += 8; \
} \
__label__ no_more_bytes; \
if (bytes_left) { \
while (bits_left < 32 - 7) \
{ \
if (data[0] == 0xff) { \
do data ++; \
while(data[0] == 0xff); \
data ++; \
if (data[-1] == 0x0) \
bits_data = (bits_data << 8) | 0xff; \
else { \
bytes_left = 0; \
rewind_point = &data[-2]; \
goto no_more_bytes; \
} \
} else \
bits_data = (bits_data << 8) | (*data ++); \
bits_left += 8; \
} \
} else { \
no_more_bytes: \
while (bits_left < 32 - 7) \
{ \
bits_data = (bits_data << 8); \
bits_left += 8; \
} \
} \
} while (0)

/** Return and consume a number of bits. */
Expand Down Expand Up @@ -189,9 +212,12 @@ struct JPEG_Decoder
\
JPEG_BITS_DROP (8); \
do result = (result << 1) | JPEG_BITS_GET (1); \
while (result > (TABLE)->maxcode [++ i]); \
while (result > (TABLE)->maxcode [++ i]); \
\
result = (TABLE)->valptr [i] [result]; \
if (i == 16) \
result = 0; \
else \
result = (TABLE)->valptr [i] [result]; \
} \
\
(OUT) = result; \
Expand Down Expand Up @@ -247,7 +273,7 @@ int JPEG_Decoder_ReadHeaders (JPEG_Decoder *decoder, const unsigned char **data)
* Returns true on success and false on failure (failure isn't possible).
*/

int JPEG_Decoder_ReadImage (JPEG_Decoder *decoder, const unsigned char **data, JPEG_OUTPUT_TYPE *out, int outWidth, int outHeight);
int JPEG_Decoder_ReadImage (JPEG_Decoder *decoder, const unsigned char **data, JPEG_OUTPUT_TYPE *out, int outWidth, int outHeight, int jpg_size);

/** Perform a 2D inverse DCT computation on the input.
*
Expand All @@ -265,7 +291,7 @@ void JPEG_IDCT (JPEG_FIXED_TYPE *zz, signed char *chunk, int chunkStride);
* failure (failure isn't possible).
*/

int JPEG_DecompressImage (const unsigned char *data, JPEG_OUTPUT_TYPE **out, int *outWidth, int *outHeight, int jpg_ram_usage);
int JPEG_DecompressImage (const unsigned char *data, JPEG_OUTPUT_TYPE **out, int *outWidth, int *outHeight, int jpg_ram_usage, int jpg_size);

#define PTR (0x02000000)

Expand Down
Binary file modified shell2/guiparser.o
Binary file not shown.
20 changes: 10 additions & 10 deletions shell2/iwram.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@

// module contains functions which execute in iwram for extra speed

#define ROM_BANKSWITCH (volatile u16*)(0x96B592E)
#define WRITE_LOC_1 (volatile u16*)(0x987654*2+0x8000000)
#define WRITE_LOC_2 (volatile u16*)(0x012345*2+0x8000000)
#define WRITE_LOC_3 (volatile u16*)(0x007654*2+0x8000000)
#define WRITE_LOC_4 (volatile u16*)(0x765400*2+0x8000000)
#define WRITE_LOC_5 (volatile u16*)(0x013450*2+0x8000000)

// JPEG functions

extern int bytes_left;
extern const unsigned char *rewind_point;

/* Converts left-to-right coefficient indices into zig-zagged indices. */
const unsigned char ToZigZag [JPEG_DCTSIZE2] =
Expand Down Expand Up @@ -275,7 +270,7 @@ CODE_IN_IWRAM void DecodeCoefficients (
{
unsigned bits_left = *bitsLeftBase, bits_data = *bitsDataBase; /* Input stream state. */
const unsigned char *data = *dataBase; /* Input stream state. */
int r, s, diff; /* Various temporary data variables. */
int r, s; /* Various temporary data variables. */
int index = 1; /* The current zig-zagged index. */

/* Clear all coefficients to zero. */
Expand All @@ -288,10 +283,13 @@ CODE_IN_IWRAM void DecodeCoefficients (
/* Read the DC coefficient. */
JPEG_BITS_CHECK ();
JPEG_HuffmanTable_Decode (dcTable, s);
JPEG_Value (s, diff);
if (s) {
JPEG_BITS_CHECK ();
JPEG_Value (s, s);
}

/* Store the DC coefficient. */
*dcLast += diff;
*dcLast += s;
zz [toZigZag [0]] = *dcLast * quant [0];

while (1)
Expand All @@ -307,6 +305,8 @@ CODE_IN_IWRAM void DecodeCoefficients (
{
index += r;
JPEG_Value (s, r);
//if (index < 0 || index > JPEG_DCTSIZE2 - 1)
// break;
zz [toZigZag [index]] = r * quant [index];
if (index == JPEG_DCTSIZE2 - 1)
break;
Expand Down
Loading

0 comments on commit 5ce1578

Please sign in to comment.