mirror of
https://github.com/libretro/beetle-psx-libretro.git
synced 2025-02-12 12:38:55 +00:00
Create separate C Griffin file
This commit is contained in:
parent
beed451377
commit
59e746542e
4
Makefile
4
Makefile
@ -305,7 +305,11 @@ endif
|
||||
TRIO_SOURCES += $(MEDNAFEN_DIR)/trio/trio.c \
|
||||
$(MEDNAFEN_DIR)/trio/triostr.c
|
||||
|
||||
ifeq ($(HAVE_GRIFFIN), 1)
|
||||
SOURCES_C := beetle_psx_griffin_c.c
|
||||
else
|
||||
SOURCES_C := $(TREMOR_SRC) $(LIBRETRO_SOURCES_C) $(TRIO_SOURCES) $(THREAD_SOURCES) $(CRC32_SOURCES)
|
||||
endif
|
||||
|
||||
SOURCES := $(LIBRETRO_SOURCES) $(CORE_SOURCES) $(MEDNAFEN_SOURCES) $(HW_CPU_SOURCES) $(HW_MISC_SOURCES) $(HW_SOUND_SOURCES) $(HW_VIDEO_SOURCES)
|
||||
|
||||
|
22
beetle_psx_griffin_c.c
Normal file
22
beetle_psx_griffin_c.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include "mednafen/tremor/tremor_shared.c"
|
||||
#include "mednafen/tremor/codebook.c"
|
||||
#include "mednafen/tremor/floor0.c"
|
||||
#include "mednafen/tremor/floor1.c"
|
||||
#include "mednafen/tremor/mdct.c"
|
||||
#include "mednafen/tremor/registry.c"
|
||||
#include "mednafen/tremor/mapping0.c"
|
||||
#include "mednafen/tremor/info.c"
|
||||
#include "mednafen/tremor/res012.c"
|
||||
#include "mednafen/tremor/framing.c"
|
||||
#include "mednafen/tremor/block.c"
|
||||
#include "mednafen/tremor/sharedbook.c"
|
||||
#include "mednafen/tremor/synthesis.c"
|
||||
#include "mednafen/tremor/vorbisfile.c"
|
||||
#include "mednafen/tremor/bitwise.c"
|
||||
#include "mednafen/tremor/window.c"
|
||||
|
||||
#include "mednafen/trio/trio.c"
|
||||
#include "mednafen/trio/triostr.c"
|
||||
|
||||
#include "threads.c"
|
||||
#include "scrc32.c"
|
@ -25,16 +25,8 @@
|
||||
#include "window.h"
|
||||
#include "registry.h"
|
||||
#include "misc.h"
|
||||
#include "tremor_shared.h"
|
||||
|
||||
static int ilog(unsigned int v){
|
||||
int ret=0;
|
||||
if(v)--v;
|
||||
while(v){
|
||||
ret++;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/* pcm accumulator examples (not exhaustive):
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codebook.h"
|
||||
#include "misc.h"
|
||||
#include "tremor_shared.h"
|
||||
|
||||
/* unpacks a codebook from the packet buffer into the codebook struct,
|
||||
readies the codebook auxiliary structures for decode *************/
|
||||
@ -37,7 +38,7 @@ static_codebook *vorbis_staticbook_unpack(oggpack_buffer *opb){
|
||||
s->entries=oggpack_read(opb,24);
|
||||
if(s->entries==-1)goto _eofout;
|
||||
|
||||
if(_ilog(s->dim)+_ilog(s->entries)>24)goto _eofout;
|
||||
if(ilog(s->dim)+ ilog(s->entries)>24)goto _eofout;
|
||||
|
||||
/* codeword ordering.... length ordered or unordered? */
|
||||
switch((int)oggpack_read(opb,1)){
|
||||
@ -81,7 +82,7 @@ static_codebook *vorbis_staticbook_unpack(oggpack_buffer *opb){
|
||||
s->lengthlist=(long *)_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
|
||||
|
||||
for(i=0;i<s->entries;){
|
||||
long num=oggpack_read(opb,_ilog(s->entries-i));
|
||||
long num=oggpack_read(opb, ilog(s->entries-i));
|
||||
if(num==-1)goto _eofout;
|
||||
if(length>32 || num>s->entries-i ||
|
||||
(num>0 && (num-1)>>(length>>1)>>((length+1)>>1))>0){
|
||||
@ -147,22 +148,6 @@ static_codebook *vorbis_staticbook_unpack(oggpack_buffer *opb){
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* the 'eliminate the decode tree' optimization actually requires the
|
||||
codewords to be MSb first, not LSb. This is an annoying inelegancy
|
||||
(and one of the first places where carefully thought out design
|
||||
turned out to be wrong; Vorbis II and future Ogg codecs should go
|
||||
to an MSb bitpacker), but not actually the huge hit it appears to
|
||||
be. The first-stage decode table catches most words so that
|
||||
bitreverse is not in the main execution path. */
|
||||
|
||||
static ogg_uint32_t bitreverse(ogg_uint32_t x){
|
||||
x= ((x>>16)&0x0000ffff) | ((x<<16)&0xffff0000);
|
||||
x= ((x>> 8)&0x00ff00ff) | ((x<< 8)&0xff00ff00);
|
||||
x= ((x>> 4)&0x0f0f0f0f) | ((x<< 4)&0xf0f0f0f0);
|
||||
x= ((x>> 2)&0x33333333) | ((x<< 2)&0xcccccccc);
|
||||
return((x>> 1)&0x55555555) | ((x<< 1)&0xaaaaaaaa);
|
||||
}
|
||||
|
||||
STIN long decode_packed_entry_number(codebook *book,
|
||||
oggpack_buffer *b){
|
||||
int read=book->dec_maxlength;
|
||||
|
@ -390,7 +390,7 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
|
||||
if(ampraw>0){ /* also handles the -1 out of data case */
|
||||
long maxval=(1<<info->ampbits)-1;
|
||||
int amp=((ampraw*info->ampdB)<<4)/maxval;
|
||||
int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
|
||||
int booknum=oggpack_read(&vb->opb, ilog(info->numbooks));
|
||||
|
||||
if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */
|
||||
codec_setup_info *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "codebook.h"
|
||||
#include "misc.h"
|
||||
#include "block.h"
|
||||
#include "tremor_shared.h"
|
||||
|
||||
#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */
|
||||
|
||||
@ -59,15 +60,6 @@ static void floor1_free_look(vorbis_look_floor *i){
|
||||
}
|
||||
}
|
||||
|
||||
static int ilog(unsigned int v){
|
||||
int ret=0;
|
||||
while(v){
|
||||
ret++;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int icomp(const void *a,const void *b){
|
||||
return(**(int **)a-**(int **)b);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "window.h"
|
||||
#include "registry.h"
|
||||
#include "misc.h"
|
||||
#include "tremor_shared.h"
|
||||
|
||||
/* simplistic, wasteful way of doing this (unique lookup for each
|
||||
mode/submapping); there should be a central repository for
|
||||
@ -114,16 +115,6 @@ static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode
|
||||
return(look);
|
||||
}
|
||||
|
||||
static int ilog(unsigned int v){
|
||||
int ret=0;
|
||||
if(v)--v;
|
||||
while(v){
|
||||
ret++;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/* also responsible for range checking */
|
||||
static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
|
||||
int i,b;
|
||||
|
@ -193,13 +193,11 @@ STIN ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _ilog(unsigned int);
|
||||
|
||||
STIN ogg_int32_t VFLOAT_MULTI(ogg_int32_t a,ogg_int32_t ap,
|
||||
ogg_int32_t i,
|
||||
ogg_int32_t *p){
|
||||
|
||||
int ip=_ilog(abs(i))-31;
|
||||
int ip= ilog(abs(i))-31;
|
||||
return VFLOAT_MULT(a,ap,i<<-ip,ip,p);
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "block.h"
|
||||
#include "tremor_shared.h"
|
||||
|
||||
typedef struct {
|
||||
vorbis_info_residue0 *info;
|
||||
@ -68,15 +69,6 @@ void res0_free_look(vorbis_look_residue *i){
|
||||
}
|
||||
}
|
||||
|
||||
static int ilog(unsigned int v){
|
||||
int ret=0;
|
||||
while(v){
|
||||
ret++;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int icount(unsigned int v){
|
||||
int ret=0;
|
||||
while(v){
|
||||
|
@ -22,16 +22,9 @@
|
||||
#include "misc.h"
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codebook.h"
|
||||
#include "tremor_shared.h"
|
||||
|
||||
/**** pack/unpack helpers ******************************************/
|
||||
int _ilog(unsigned int v){
|
||||
int ret=0;
|
||||
while(v){
|
||||
ret++;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/* 32 bit float (not IEEE; nonnormalized mantissa +
|
||||
biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm
|
||||
@ -159,7 +152,7 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
|
||||
thought of it. Therefore, we opt on the side of caution */
|
||||
long _book_maptype1_quantvals(const static_codebook *b){
|
||||
/* get us a starting hint, we'll polish it below */
|
||||
int bits=_ilog(b->entries);
|
||||
int bits= ilog(b->entries);
|
||||
int vals=b->entries>>((bits-1)*(b->dim-1)/b->dim);
|
||||
|
||||
while(1){
|
||||
@ -314,14 +307,6 @@ void vorbis_book_clear(codebook *b){
|
||||
memset(b,0,sizeof(*b));
|
||||
}
|
||||
|
||||
static ogg_uint32_t bitreverse(ogg_uint32_t x){
|
||||
x= ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL);
|
||||
x= ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL);
|
||||
x= ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL);
|
||||
x= ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL);
|
||||
return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL);
|
||||
}
|
||||
|
||||
static int sort32a(const void *a,const void *b){
|
||||
return (**(ogg_uint32_t **)a>**(ogg_uint32_t **)b)-
|
||||
(**(ogg_uint32_t **)a<**(ogg_uint32_t **)b);
|
||||
@ -392,7 +377,7 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
||||
if(s->lengthlist[i]>0)
|
||||
c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
|
||||
|
||||
c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
|
||||
c->dec_firsttablen= ilog(c->used_entries)-4; /* this is magic */
|
||||
if(c->dec_firsttablen<5)c->dec_firsttablen=5;
|
||||
if(c->dec_firsttablen>8)c->dec_firsttablen=8;
|
||||
|
||||
|
21
mednafen/tremor/tremor_shared.c
Normal file
21
mednafen/tremor/tremor_shared.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include "tremor_shared.h"
|
||||
|
||||
int ilog(unsigned int v)
|
||||
{
|
||||
int ret=0;
|
||||
while(v)
|
||||
{
|
||||
ret++;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
ogg_uint32_t bitreverse(ogg_uint32_t x)
|
||||
{
|
||||
x= ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL);
|
||||
x= ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL);
|
||||
x= ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL);
|
||||
x= ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL);
|
||||
return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL);
|
||||
}
|
21
mednafen/tremor/tremor_shared.h
Normal file
21
mednafen/tremor/tremor_shared.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef _TREMOR_SHARED_H_
|
||||
#define _TREMOR_SHARED_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int ilog(unsigned int v);
|
||||
|
||||
#include "os_types.h"
|
||||
|
||||
ogg_uint32_t bitreverse(ogg_uint32_t x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -875,7 +875,7 @@ typedef struct _trio_reference_t {
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
static TRIO_CONST char rcsid[] = "@(#)$Id: trio.c,v 1.129 2009/09/20 11:37:15 breese Exp $";
|
||||
//static TRIO_CONST char rcsid[] = "@(#)$Id: trio.c,v 1.129 2009/09/20 11:37:15 breese Exp $";
|
||||
|
||||
#if TRIO_FEATURE_FLOAT
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user