mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
skip junk in mp3_helix, refactor find_sync_word
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@889 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
cf82669f50
commit
7c18e34a74
13 changed files with 86 additions and 82 deletions
|
@ -475,9 +475,10 @@ void mp3_update(int *buffer, int length, int stereo)
|
|||
}
|
||||
|
||||
|
||||
void mp3_start_play(FILE *f, int pos) // pos is 0-1023
|
||||
void mp3_start_play(void *f_, int pos) // pos is 0-1023
|
||||
{
|
||||
int byte_offs = 0;
|
||||
FILE *f = f_;
|
||||
|
||||
if (!(PicoOpt & POPT_EN_MCD_CDDA) || f == NULL)
|
||||
return;
|
||||
|
|
|
@ -57,7 +57,7 @@ OBJS += pico/sound/mix_arm.o
|
|||
# common
|
||||
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \
|
||||
platform/common/arm_utils.o platform/common/arm_linux.o platform/common/readpng.o \
|
||||
platform/common/mp3_helix.o platform/common/input.o platform/common/main.o \
|
||||
platform/common/mp3_helix.o platform/common/input.o platform/common/main.o platform/common/mp3.o \
|
||||
platform/linux/sndout_oss.o platform/linux/plat.o platform/linux/in_evdev.o
|
||||
|
||||
# unzip
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// (c) Copyright 2006-2007, Grazvydas "notaz" Ignotas
|
||||
|
||||
#include "940shared.h"
|
||||
#include "../../common/mp3.h"
|
||||
|
||||
static _940_data_t *shared_data = (_940_data_t *) 0x00100000;
|
||||
static _940_ctl_t *shared_ctl = (_940_ctl_t *) 0x00200000;
|
||||
|
@ -25,32 +26,6 @@ void _memcpy(void *dst, const void *src, int count);
|
|||
// asm volatile ("mcr p15, 0, r0, c7, c10, 4" ::: "r0"); /* drain write buffer */
|
||||
|
||||
|
||||
static int find_sync_word(unsigned char *buf, int nBytes)
|
||||
{
|
||||
unsigned char *p, *pe;
|
||||
|
||||
/* find byte-aligned syncword - need 12 (MPEG 1,2) or 11 (MPEG 2.5) matching bits */
|
||||
for (p = buf, pe = buf + nBytes - 4; p < pe; p++)
|
||||
{
|
||||
int pn;
|
||||
if (p[0] != 0xff) continue;
|
||||
pn = p[1];
|
||||
if ((pn & 0xf8) != 0xf8 || // currently must be MPEG1
|
||||
(pn & 6) == 0) { // invalid layer
|
||||
p++; continue;
|
||||
}
|
||||
pn = p[2];
|
||||
if ((pn & 0xf0) < 0x20 || (pn & 0xf0) == 0xf0 || // bitrates
|
||||
(pn & 0x0c) != 0) { // not 44kHz
|
||||
continue;
|
||||
}
|
||||
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void mp3_decode(void)
|
||||
{
|
||||
int mp3_offs = shared_ctl->mp3_offs;
|
||||
|
@ -63,7 +38,7 @@ static void mp3_decode(void)
|
|||
|
||||
for (retries = 0; retries < 2; retries++)
|
||||
{
|
||||
offset = find_sync_word(readPtr, bytesLeft);
|
||||
offset = mp3_find_sync_word(readPtr, bytesLeft);
|
||||
if (offset < 0)
|
||||
goto set_eof;
|
||||
|
||||
|
|
|
@ -19,11 +19,12 @@ AS = $(CROSS)as
|
|||
LD = $(CROSS)ld
|
||||
OBJCOPY = $(CROSS)objcopy
|
||||
|
||||
vpath %.c = ../../common
|
||||
|
||||
BIN = pico940_v3.bin
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
|
||||
.c.o:
|
||||
@echo ">>>" $<
|
||||
$(GCC) $(CFLAGS) -c $< -o $@
|
||||
|
@ -35,7 +36,7 @@ all: $(BIN)
|
|||
# stuff for 940 core
|
||||
|
||||
# init, emu_control, emu
|
||||
OBJS940 += 940init.o 940.o 940ym2612.o memcpy.o misc_arm.o
|
||||
OBJS940 += 940init.o 940.o 940ym2612.o memcpy.o misc_arm.o mp3.o
|
||||
# the asm code seems to be faster when run on 920, but not on 940 for some reason
|
||||
# OBJS940 += ../../Pico/sound/ym2612_asm.o
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue