aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspicy jpeg <88942473+spicyjpeg@users.noreply.github.com>2022-04-08 00:23:41 +0200
committerGitHub <noreply@github.com>2022-04-08 00:23:41 +0200
commitf56ade9b10c7c2d37f1b0af9191560cd5f0295b4 (patch)
tree0db9fcf373af1980091f04e2d698a50b9250ccd2
parent7ebffc78c180164b928d2fd9adf6a9807a838a10 (diff)
parenta8b404b3400c3ebd8e0b923dcaefcc49ea563e36 (diff)
downloadpsn00bsdk-f56ade9b10c7c2d37f1b0af9191560cd5f0295b4.tar.gz
Merge branch 'Lameguy64:master' into psxmdec
-rw-r--r--CHANGELOG.md6
-rw-r--r--README.md70
-rw-r--r--indev/psxmdec/main.c212
-rw-r--r--indev/psxmdec/makefile41
-rw-r--r--indev/psxmdec/mdec.s185
-rw-r--r--indev/psxmdec/table.h102
-rw-r--r--indev/psxmdec/vlc.c11
7 files changed, 110 insertions, 517 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6ab68d2..c2e6d1c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,12 @@ to ensure the changelog can be parsed correctly.
-------------------------------------------------------------------------------
+## 2022-03-30:
+
+lameguy64:
+
+- indev: psxmdec prototype is now functional through psxpress.
+
## 2022-03-25: 0.19
lameguy64:
diff --git a/README.md b/README.md
index 448a3fa..29e73a0 100644
--- a/README.md
+++ b/README.md
@@ -33,40 +33,42 @@ in custom MIPS assembly instead of equivalents found in the BIOS ROM, for both
stability (the BIOS `libc` implementation of the PlayStation is actually buggy)
and performance reasons.
+
## Notable features
-As of November 28, 2021
+As of March 28, 2022
-* Extensive GPU support with polygon, line and sprite primitives, high-speed
- DMA transfers for VRAM data and ordering tables. All video modes for both
- NTSC and PAL standards also supported with fully adjustable display area
- and automatic video standard detection based on last GPU mode. No BIOS
- ROM checks used.
+* Extensive GPU support with lines, flat shaded or textured polygon and sprite
+ primitives, high-speed DMA for VRAM transfers and ordering tables. All video
+ modes for both NTSC and PAL standards also supported with fully adjustable
+ display area and automatic video standard detection based on last GPU mode.
* Extensive GTE support with rotate, translate, perspective correction and
- lighting fully supported via C and assembly GTE macros paired with high
- speed matrix and vector functions. All calculations performed in fixed
- point integer math, not a single float defined.
+ lighting calculation fully supported through C and/or assembly GTE macros
+ paired with high speed matrix and vector helper functions. All calculations
+ performed in fixed point integer math, not a single float used.
-* Flexible interrupt service routine with easy to use callback mechanism for
- simplified handling and hooking of hardware and DMA interrupts, no crude
+* Flexible interrupt service subsystem with easy to use callback mechanism for
+ simplified handling and hooking of hardware and DMA interrupts. No crude
event handler hooks or kernel hacks providing great compatibility with
- HLE BIOS implementations. Should work without issue for loader/menu type
- programs as well.
+ HLE BIOS implementations and loader/menu type homebrew programs.
+* BIOS controller functions for polling controller input work as intended
+ thanks to proper handling of hardware interrupts. No crude direct I/O polling
+ of controllers in the main loop.
+
* Complete Serial I/O support with SIOCONS driver for tty stdin/stdout
- console access. Hardware flow control also supported.
+ console access. Hardware flow control supported.
-* BIOS controller functions for polling controller input work as intended
- thanks to proper handling of hardware interrupts. No crude manual polling
- of controllers in a main loop. BIOS memory card functions may also work,
- but not yet tested extensively.
+* Full CD-ROM support using libpsxcd featuring data read, CD audio and XA audio
+ playback, built-in ISO9660 file system parser with no file count limit
+ (classic ISO9660 only, no Rock Ridge or Joliet extensions) and multi-session.
+
+* Preliminary MDEC support implemented with libpsxpress (no VLC decoding yet).
+ Sample encoder included.
-* Full CD-ROM support via libpsxcd with data read, CD audio and XA audio
- playback support. Features built-in ISO9660 file system parser for locating
- and querying files and directories. Supports directories containing more
- than 30 files (classic ISO9660 only, no Rock Ridge or Joliet extensions)
- and also supports reading new sessions on a multi-session disc.
+* Can target Konami System 573 arcade hardware with limited support
+ (see examples/io/system573/main.c for details)
* Experimental support for compiling separate sections of an executable into
shared library files (DLLs) and linking them dynamically at runtime, plus
@@ -74,16 +76,17 @@ As of November 28, 2021
generated at build time.
* Uses Sony SDK library syntax for familiarity to experienced programmers
- and to make porting existing homebrew projects to PSn00bSDK easier.
+ and makes porting existing homebrew projects to PSn00bSDK easier.
* Works on real hardware and most popular emulators.
* Fully expandable and customizable to your heart's content.
+
## Obtaining PSn00bSDK
Prebuilt PSn00bSDK packages for Windows and Linux are available through GitHub
-Actions and include the libraries, a copy of the GCC MIPS toolchain, command
+Actions which includes the libraries, a copy of the GCC MIPS toolchain, command
line tools, examples and documentation. CMake is **not** included and must be
installed separately, either from [its website](https://cmake.org/download) or
via MSys2 or your distro's package manager.
@@ -91,6 +94,7 @@ via MSys2 or your distro's package manager.
See [installation.md](doc/installation.md) for a quick start guide and for
details on how to build the SDK yourself.
+
## Examples
There are a few examples and complete source code of `n00bdemo` included in the
@@ -98,29 +102,29 @@ There are a few examples and complete source code of `n00bdemo` included in the
contributed example programs are welcome.
There's also [Lameguy's PlayStation Programming Tutorial Series](http://lameguy64.net/tutorials/pstutorials)
-for learning how to program for the PlayStation. The tutorials should still
+for learning how to program for the PlayStation. Much of the tutorials should
apply to PSn00bSDK.
+
## To-do List
* psxspu: Plenty of work to be done. Hardware timer driven sound/music
system may need to be implemented (an equivalent to the Ss* series of
- functions in libspu basically). Need to figure out the correct frequency
- table for playing sounds in musical note notation. Functions that make use of
- the SPU RAM interrupt feature to play or capture streamed audio should also
- be added.
+ functions in libspu basically). Functions that make use of the SPU RAM
+ interrupt feature to play or capture streamed audio should also be added.
* psxcd: Implement a command queue mechanism for the CD-ROM?
* libc: Improve the memory allocation framework with multiple allocators, GC
and maybe helpers to manage swapping between main RAM and VRAM/SPU RAM.
-* Support for MDEC, and tooling to transcode videos to .STR files (either
- reimplementing the container and compression format used by the Sony SDK, or
- a custom format with better compression).
+* Further support for MDEC, and tooling to transcode videos to .STR files
+ (either reimplementing the container and compression format used by the Sony
+ SDK, or a custom format with better compression).
* Pad and memory card libraries that don't use the BIOS routines.
+
## Credits
Main developer/author/whatever:
diff --git a/indev/psxmdec/main.c b/indev/psxmdec/main.c
index f4f0f51..25baf11 100644
--- a/indev/psxmdec/main.c
+++ b/indev/psxmdec/main.c
@@ -1,17 +1,18 @@
-#include <sys/types.h>
+#include <stdint.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
-#include <psxgte.h>
+#include <stddef.h>
#include <psxgpu.h>
+#include <psxpress.h>
+#include <hwregs_c.h>
-/* mdec.s */
-extern void mdec_reset( void );
-extern void mdec_setscale( void );
-extern void mdec_setquants( void );
-extern void mdec_cmd( unsigned int cmd );
-extern void mdec_in( void *src, int blocks );
-extern void mdec_out( void *dst, int blocks );
+#define SCREEN_XRES 320
+#define SCREEN_YRES 240
+
+//#define BLOCK_SIZE 8 // Monochrome (8x8), 15bpp display
+//#define BLOCK_SIZE 12 // Monochrome (8x8), 24bpp display
+//#define BLOCK_SIZE 16 // Color (16x16), 15bpp display
+#define BLOCK_SIZE 24 // Color (16x16), 24bpp display
/* vlc.c */
int DecDCTvlc( unsigned short *mdec_bs, unsigned short *mdec_rl );
@@ -19,173 +20,74 @@ int DecDCTvlc( unsigned short *mdec_bs, unsigned short *mdec_rl );
/* data.s */
extern unsigned short bs_data[];
-DISPENV disp[2];
-DRAWENV draw[2];
-int db;
-
-void memory_browser(unsigned int addr)
-{
- int i,j,key;
- unsigned char *ptr,*pptr;
-
- while(1)
- {
- /* Set cursor position to top-left */
- printf("\033[1;1H");
- printf("MEMVIEW 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF");
-
- ptr = (unsigned char*)addr;
-
- /* Print contents from current location of memory */
- for(j=0; j<23; j++)
- {
- printf("\n%04X: ", (unsigned int)ptr);
- pptr = ptr;
- for(i=0; i<16; i++)
- {
- printf("%02X ", *ptr);
- ptr++;
- }
- printf(" ");
- for(i=0; i<16; i++)
- {
- if(( *pptr < 32 ) || ( *pptr > 127 ) )
- {
- printf(".");
- }
- else
- {
- printf("%c", *pptr);
- }
- pptr++;
- }
- }
-
- /* Parse input */
- while(1)
- {
- key = getchar();
- if( key == 0x1B )
- {
- key = getchar();
-
- if( key == 0x5B )
- {
- key = getchar();
- if( key == 0x41 ) // Up
- {
- addr -= 16;
- break;
- }
- else if( key == 0x42 ) // Down
- {
- addr += 16;
- break;
- }
- if( key == 0x35 ) // Page up
- {
- addr -= 16*23;
- break;
- }
- else if( key == 0x36 ) // Page down
- {
- addr += 16*23;
- break;
- }
- }
- }
-
- }
- }
-
-} /* memory_browser */
+DISPENV disp;
void init( void )
{
- ResetGraph( 0 );
-
- SetDefDispEnv( &disp[0], 0, 0, 320, 240 );
- SetDefDispEnv( &disp[1], 0, 240, 320, 240 );
+ ResetGraph(0);
+ DecDCTReset(0);
- SetDefDrawEnv( &draw[0], 0, 240, 320, 240 );
- SetDefDrawEnv( &draw[1], 0, 0, 320, 240 );
+ SetDefDispEnv(&disp, 0, 0, SCREEN_XRES, SCREEN_YRES);
- draw[0].isbg = draw[1].isbg = 1;
- setRGB0( &draw[0], 0, 63, 0 );
- setRGB0( &draw[1], 0, 63, 0 );
+ disp.isrgb24 = disp.isrgb24 = 1;
- PutDispEnv( &disp[1] );
- PutDrawEnv( &draw[1] );
- db = 0;
+ PutDispEnv(&disp);
+ SetDispMask(1);
} /* init */
-void display( void )
-{
- DrawSync( 0 );
- VSync( 0 );
-
- PutDispEnv( &disp[db] );
- PutDrawEnv( &draw[db] );
- SetDispMask( 1 );
-
- db = !db;
-
-} /* display */
void decode_test( void )
{
- unsigned short *out_buff;
- unsigned short *dec_buff;
- int dec_len;
- RECT rect;
- int xx;
-
- out_buff = (unsigned short*)malloc( 131072 );
- dec_buff = (unsigned short*)malloc( 7680 );
-
- memset( out_buff, 0, 131072 );
- DecDCTvlc( bs_data, out_buff );
-
- dec_len = ((unsigned short*)out_buff)[0];
-
- printf( "out_buff=%p len=%d\n", out_buff, dec_len );
-
- //memory_browser( (unsigned int)(out_buff+2) );
- mdec_cmd( 0x38000000|dec_len );
-
- mdec_in( out_buff+2, 8 );
-
- rect.x = 320; rect.y = 0;
- rect.w = 16; rect.h = 240;
- xx = 0;
- //while( xx < 320 )
- {
- mdec_out( dec_buff, 120 );
- LoadImage( &rect, (unsigned int*)dec_buff );
- DrawSync( 0 );
- xx += 16;
- rect.x += 16;
+ uint16_t *out_buff;
+ uint16_t dec_len;
+
+ // Allocate and decode VLC encoded BS data
+ printf("Decode start...\n");
+ out_buff = (uint16_t*)malloc(4*((*(long*)bs_data)+1));
+ DecDCTvlc(bs_data, out_buff);
+
+ // Print out decompression results
+ dec_len = ((uint16_t*)out_buff)[0];
+ printf("out_buff=%p len=%d\n", out_buff, dec_len);
+
+ // Initialize MDEC data input
+ MDEC0 = 0x30000000 | dec_len; // 0x38000000 for 15bpp
+ DecDCTinRaw((const uint32_t*)(out_buff+1), dec_len);
+
+ // Decode image slice-by-slice
+ for (uint32_t x = 0; x < (SCREEN_XRES * 3 / 2); x += BLOCK_SIZE)
+ { // 24bpp
+ RECT rect;
+ uint32_t slice[BLOCK_SIZE * SCREEN_YRES / 2];
+
+ rect.x = x;
+ rect.y = 0;
+ rect.w = BLOCK_SIZE;
+ rect.h = SCREEN_YRES;
+
+ // Configure the MDEC to output to the slice buffer and let it finish
+ // decoding a slice, then upload it to the framebuffer.
+ DecDCTout(slice, BLOCK_SIZE * SCREEN_YRES / 2);
+ DecDCToutSync(0);
+
+ LoadImage(&rect, (u_long *) slice);
+ DrawSync(0);
}
+ free(out_buff);
+
} /* decode_test */
int main( int argc, const char *argv[] )
{
init();
- /* init MDEC */
- mdec_reset();
- mdec_setscale();
- mdec_setquants();
-
decode_test();
- while( 1 )
- {
- display();
- }
+ for (;;)
+ __asm__ volatile("");
- return( 0 );
+ return 0;
} /* main */
diff --git a/indev/psxmdec/makefile b/indev/psxmdec/makefile
deleted file mode 100644
index 3b921e0..0000000
--- a/indev/psxmdec/makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-include ../../psn00bsdk-setup.mk
-
-TARGET = mdectest.elf
-
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES = $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
-
-OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
- $(addprefix build/,$(CPPFILES:.cpp=.o)) \
- $(addprefix build/,$(AFILES:.s=.o))
-
-LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
-
-CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
-
-CPPFLAGS = $(CFLAGS) -fno-exceptions
-
-AFLAGS = -g -msoft-float
-
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
-
-all: $(OFILES)
- $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
- elf2x -q $(TARGET)
-
-build/%.o: %.c
- @mkdir -p $(dir $@)
- $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.cpp
- @mkdir -p $(dir $@)
- $(CXX) $(AFLAGS) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.s
- @mkdir -p $(dir $@)
- $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@
-
-clean:
- rm -rf build $(TARGET) $(TARGET:.elf=.exe) \ No newline at end of file
diff --git a/indev/psxmdec/mdec.s b/indev/psxmdec/mdec.s
deleted file mode 100644
index a7b5094..0000000
--- a/indev/psxmdec/mdec.s
+++ /dev/null
@@ -1,185 +0,0 @@
-.set noreorder
-
-.include "hwregs_a.h"
-
-.section .text
-
-.global mdec_reset # Resets the MDEC
-.type mdec_reset, @function
-mdec_reset:
-
- lui $a0, IOBASE
-
- lui $v0, 0xE000 # Reset MDEC
- sw $v0, MDEC1($a0)
- nop
-
- lui $v1, 0x8004 # Wait until reset completes
-.Lreset_wait:
- lw $v0, MDEC1($a0)
- nop
- bne $v0, $v1, .Lreset_wait
- nop
-
- jr $ra
- nop
-
-
-.global mdec_cmd # Sends a MDEC command word
-.type mdec_cmd, @function
-mdec_cmd:
-
- lui $a1, IOBASE
-
-.Lcmd_ready: # Wait until command busy is zero
- lw $v0, MDEC1($a1)
- lui $v1, 0x2000
- and $v0, $v1
- bnez $v0, .Lcmd_ready
- nop
-
- sw $a0, MDEC0($a1) # Write command word
-
- jr $ra
- nop
-
-.global mdec_in # Transmit data to DMA0 (MDEC in)
-.type mdec_in, @function
-mdec_in:
-
- # a0 - data source address
- # a1 - blocks to transfer (64 bytes per block)
-
- lui $a3, IOBASE
-
-.Lmdec_in_wait: # Wait until MDEC is ready for data
- lw $v0, MDEC1($a3)
- lui $v1, 0x1000
- and $v0, $v1
- beqz $v0, .Lmdec_in_wait
- nop
-
- sw $a0, D0_MADR($a3) # Set source address
-
- andi $v0, $a1, 0xFFFF # Set transfer length
- sll $v0, 16
- ori $v0, 0x20 # 32 word block size
- sw $v0, D0_BCR($a3)
-
- lui $v0, 0x0100 # Begin transfer
- ori $v0, 0x0201
- sw $v0, D0_CHCR($a3)
-
- jr $ra
- nop
-
-.global mdec_out # Transmit data to DMA0 (MDEC in)
-.type mdec_out, @function
-mdec_out:
-
- # a0 - data source address
- # a1 - blocks to transfer (64 bytes per block)
-
- lui $a3, IOBASE
-
-.Lmdec_out_ready: # Wait until MDEC is ready for data
- lw $v0, MDEC1($a3)
- lui $v1, 0x1000
- and $v0, $v1
- beqz $v0, .Lmdec_out_ready
- nop
-
- sw $a0, D1_MADR($a3) # Set source address
-
- andi $v0, $a1, 0xFFFF # Set transfer length
- sll $v0, 16
- ori $v0, 0x20 # 32 word block size
- sw $v0, D1_BCR($a3)
-
- lui $v0, 0x0100 # Begin transfer
- ori $v0, 0x0200
- sw $v0, D1_CHCR($a3)
-
-.Lmdec_out_wait:
- lw $v0, D1_CHCR($a3)
- lui $v1, 0x0200
- and $v0, $v1
- bnez $v0, .Lmdec_out_wait
- nop
-
- jr $ra
- nop
-
-.global mdec_setscale # Uploads the internal scaletable to MDEC
-.type mdec_setscale, @function
-mdec_setscale:
-
- addiu $sp, -4
- sw $ra, 0($sp)
-
- lui $a0, 0x6000 # Set scaletable command
- jal mdec_cmd
- nop
-
- la $a0, _mdec_scaletable # Upload scaletable
- jal mdec_in
- li $a1, 1 # 64 halfwords
-
- lw $ra, 0($sp)
- addiu $sp, 4
- jr $ra
- nop
-
-
-.global mdec_setquants # Uploads the internal quant tables
-.type mdec_setquants, @function
-mdec_setquants:
-
- addiu $sp, -4
- sw $ra, 0($sp)
-
- lui $a0, 0x4000 # Set quant tables command
- ori $a0, 0x0001 # luma + chroma data
- jal mdec_cmd
- nop
-
- la $a0, _mdec_qtables # Upload quant tables
- jal mdec_in
- li $a1, 2 # 128 halfwords
-
- lw $ra, 0($sp)
- addiu $sp, 4
- jr $ra
- nop
-
-
-.section .data
-
-_mdec_qtables:
- # taken from CCITT Rec. T.81
- .hword 16, 11, 10, 16, 24, 40, 51, 61 # Luma table
- .hword 12, 12, 14, 19, 26, 58, 60, 55
- .hword 14, 13, 16, 24, 40, 57, 69, 56
- .hword 14, 17, 22, 29, 51, 87, 80, 62
- .hword 18, 22, 37, 56, 68, 109, 103, 77
- .hword 24, 35, 55, 64, 81, 104, 113, 92
- .hword 49, 64, 78, 87, 103, 121, 120, 101
- .hword 72, 92, 95, 98, 112, 100, 103, 99
- .hword 17, 18, 24, 47, 99, 99, 99, 99 # Chroma table
- .hword 18, 21, 26, 66, 99, 99, 99, 99
- .hword 24, 26, 56, 99, 99, 99, 99, 99
- .hword 47, 66, 99, 99, 99, 99, 99, 99
- .hword 99, 99, 99, 99, 99, 99, 99, 99
- .hword 99, 99, 99, 99, 99, 99, 99, 99
- .hword 99, 99, 99, 99, 99, 99, 99, 99
- .hword 99, 99, 99, 99, 99, 99, 99, 99
-
-_mdec_scaletable:
- .hword 0x5A82,0x5A82,0x5A82,0x5A82,0x5A82,0x5A82,0x5A82,0x5A82
- .hword 0x7D8A,0x6A6D,0x471C,0x18F8,0xE707,0xB8E3,0x9592,0x8275
- .hword 0x7641,0x30FB,0xCF04,0x89BE,0x89BE,0xCF04,0x30FB,0x7641
- .hword 0x6A6D,0xE707,0x8275,0xB8E3,0x471C,0x7D8A,0x18F8,0x9592
- .hword 0x5A82,0xA57D,0xA57D,0x5A82,0x5A82,0xA57D,0xA57D,0x5A82
- .hword 0x471C,0x8275,0x18F8,0x6A6D,0x9592,0xE707,0x7D8A,0xB8E3
- .hword 0x30FB,0x89BE,0x7641,0xCF04,0xCF04,0x7641,0x89BE,0x30FB
- .hword 0x18F8,0xB8E3,0x6A6D,0x8275,0x7D8A,0x9592,0x471C,0xE707
diff --git a/indev/psxmdec/table.h b/indev/psxmdec/table.h
deleted file mode 100644
index 3e50b18..0000000
--- a/indev/psxmdec/table.h
+++ /dev/null
@@ -1,102 +0,0 @@
-const static huff_t table0[]={
- {6,3},{8,5},{10,6},{12,8},{76,9},{66,9},{20,11},{58,13},{48,13},{38,13},{32,13},{52,14},{50,14},{48,14},{46,14},{62,15},{60,15},{58,15},{56,15},{54,15},{52,15},{50,15},{48,15},{46,15},{44,15},{42,15},{40,15},{38,15},{36,15},{34,15},{32,15},{48,16},{46,16},{44,16},{42,16},{40,16},{38,16},{36,16},{34,16},{32,16},
-};
-const static huff_t table1[]={
- {6,4},{12,7},{74,9},{24,11},{54,13},{44,14},{42,14},{62,16},{60,16},{58,16},{56,16},{54,16},{52,16},{50,16},{38,17},{36,17},{34,17},{32,17},
-};
-const static huff_t table2[]={
- {10,5},{8,8},{22,11},{40,13},{40,14},
-};
-const static huff_t table3[]={
- {14,6},{72,9},{56,13},{38,14},
-};
-const static huff_t table4[]={
- {12,6},{30,11},{36,13},
-};
-const static huff_t table5[]={
- {14,7},{18,11},{36,14},
-};
-const static huff_t table6[]={
- {10,7},{60,13},{40,17},
-};
-const static huff_t table7[]={
- {8,7},{42,13},
-};
-const static huff_t table8[]={
- {14,8},{34,13},
-};
-const static huff_t table9[]={
- {10,8},{34,14},
-};
-const static huff_t table10[]={
- {78,9},{32,14},
-};
-const static huff_t table11[]={
- {70,9},{52,17},
-};
-const static huff_t table12[]={
- {68,9},{50,17},
-};
-const static huff_t table13[]={
- {64,9},{48,17},
-};
-const static huff_t table14[]={
- {28,11},{46,17},
-};
-const static huff_t table15[]={
- {26,11},{44,17},
-};
-const static huff_t table16[]={
- {16,11},{42,17},
-};
-const static huff_t table17[]={
- {62,13},
-};
-const static huff_t table18[]={
- {52,13},
-};
-const static huff_t table19[]={
- {50,13},
-};
-const static huff_t table20[]={
- {46,13},
-};
-const static huff_t table21[]={
- {44,13},
-};
-const static huff_t table22[]={
- {62,14},
-};
-const static huff_t table23[]={
- {60,14},
-};
-const static huff_t table24[]={
- {58,14},
-};
-const static huff_t table25[]={
- {56,14},
-};
-const static huff_t table26[]={
- {54,14},
-};
-const static huff_t table27[]={
- {62,17},
-};
-const static huff_t table28[]={
- {60,17},
-};
-const static huff_t table29[]={
- {58,17},
-};
-const static huff_t table30[]={
- {56,17},
-};
-const static huff_t table31[]={
- {54,17},
-};
-const static huff_t *huff_table[]={
- table0,table1,table2,table3,table4,table5,table6,table7,table8,table9,table10,table11,table12,table13,table14,table15,table16,table17,table18,table19,table20,table21,table22,table23,table24,table25,table26,table27,table28,table29,table30,table31,
-};
-const static int maxlevel[]={
- 40,18,5,4,3,3,3,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-};
diff --git a/indev/psxmdec/vlc.c b/indev/psxmdec/vlc.c
index bc64a12..064cfb3 100644
--- a/indev/psxmdec/vlc.c
+++ b/indev/psxmdec/vlc.c
@@ -1,3 +1,12 @@
+/* This file is a trimmed version of
+ * https://cgit.grumpycoder.net/cgit/PSX-Bundle/tree/psxdev/vlc.c
+ * that only includes the VLC decompression routine. It cannot be
+ * included as part of the PSn00bSDK Run-time libraries due to license
+ * incompatibilities but is included here largely for prototyping and
+ * reference purposes as a better optimized implementation is preferred
+ * to support full-motion-video playback.
+ *
+ */
#include <sys/types.h>
typedef unsigned short Uint16;
@@ -7,7 +16,7 @@ typedef struct {
unsigned int code,nbits;
} huff_t;
-#include "table.h"
+//#include "table.h"
#define CODE1(a,b,c) (((a)<<10)|((b)&0x3ff)|((c)<<16))
/* run, level, bit */