DCEmulation

dreamcast development • homebrew software • hardware hacking • indie games • emulators • and more!
Back to main site
It is currently Tue Sep 02, 2014 7:15 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 139 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 7  Next
Author Message
PostPosted: Wed Jun 08, 2011 1:21 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 295
No, what I'm talking about has nothing to do with your project, it has to do with dcload and dctool as a link between pc and dc, this is what slows down the connection between the dc and the pc, with too many control functions, and a slow ( way slow ) driver. From a 100mbit connection it's not understandable that you get less than 500KB/s of speed, seriously... that's what I'm talking about...

Didn't anyone notice it is too slow?


Top
 Profile  
 
PostPosted: Wed Jun 08, 2011 1:38 pm 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 316
I've never gotten it to work for me, so I can't comment on the speed.


Top
 Profile  
 
PostPosted: Wed Jun 08, 2011 1:54 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 295
Do you have a BBA?
Then it is probably an IP problem. If you just burnt it, it has a default local Ip assigned and it must be specified in the pc program or else it just won't work.

I could help you with that on PM if you want, I think we are getting too far off the topic. Mabye we should start a new one with all this.


Top
 Profile  
 
PostPosted: Wed Jun 08, 2011 3:37 pm 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 316
Yes, I have the BBA, which works fine from PlanetWeb or with Doom. I have no idea why the loader can't reach the DC it just can't. I suspect it might be something to do with ip tables in linux (I use Xubuntu) that doesn't affect Windows.


Top
 Profile  
 
PostPosted: Wed Jun 08, 2011 5:21 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 295
The adress hardcoded in dcload for dreamcast has to be the same dctool from linux expects, to make sure, get your dc load cdrom, hex edit the bin and search for 192.168, then edit it to suit your ip, burn again and tell dctool to send whatever you want to send to that IP, that or use ARP with the mac and it should work fine.

Any other thing might be firewall issues...


Top
 Profile  
 
PostPosted: Thu Jun 09, 2011 7:51 am 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 397
Chilly Willy wrote:
PH3NOM wrote:
Next Ill try out some 96kHz samples to see how the DC's SPU handles it!
Hopefully software re-sampling wouldn't be necessary. But if it is, 48kHz would be the re-sample rate, or should it be 44.1kHz for DC?


Err - from the formula used to set the sample rate, it seems AICA plays at 44.1kHz, and the sample is resampled in hardware to that rate. I have no idea how AICA's resampling would sound for something like that. I guess you'll have to try it and see. 48 to 44.1 shouldn't be a problem.


Cool, I tried some 96kHz MP4's with DCMC last night. It sounds the same as 48kHz!

Chilly Willy wrote:
PH3NOM wrote:
And, to be perfectly clear, 6ch audio is down-mixed to stereo ( in software ) before sending the samples to the SPU.


There are a number of different down-mix formulas used by different players to allow simple mixing, or Dolby mixing, Dolby Pro mixing, etc. You'll probably want to check that out... maybe make it an option the user can set.


Yeah, currently LibA52 is using Dolby Pro downmixing, and LibFAAD is using a standard Stereo downmix.
It is a good idea to put the downmixing functions into my audio driver, then it would be easy to allow
the user to change this, in the GUI.

Chilly Willy wrote:
I followed this guide:
http://www.dcemu.co.uk/vbulletin/thread ... from-China

If you notice my posts (I'm JLF65 over there), it cost me a total of $26.14 USD and took almost 7 weeks, but I'm happy with how it turned out. I'm using an 8GB MicroSDHC card in the adapter, with no problems so far. I'm currently ripping my Sonic Adventure disc in DreamShell to the SD card. I'll probably rip a number of my game discs to see if they work so I can cut back on wear on the drive. I already made an SDISO for my Doom port... the SD is noticeably slower than the CD drive but I like the lack of grinding on the drive. :mrgreen:


Haha, nice. I have all the parts, I just havn't had time to assemble the adapter, yet.
I need to track down an old friend, to see if he can assemble it for me :o


Top
 Profile  
 
PostPosted: Thu Jun 09, 2011 1:45 pm 
Offline
Psychotic DCEmu
Psychotic DCEmu

Joined: Mon Aug 11, 2008 7:34 am
Posts: 577
Location: Nowhere U.S.A.
Edit;
The SD card options sound nice, but I'll not be able to get one anytime soon.

Will you still be implementing optimizations for non-sd users?

_________________
ImageImageImageImage


Top
 Profile  
 
PostPosted: Thu Jun 09, 2011 5:24 pm 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 316
PH3NOM wrote:
Chilly Willy wrote:
PH3NOM wrote:
Next Ill try out some 96kHz samples to see how the DC's SPU handles it!
Hopefully software re-sampling wouldn't be necessary. But if it is, 48kHz would be the re-sample rate, or should it be 44.1kHz for DC?


Err - from the formula used to set the sample rate, it seems AICA plays at 44.1kHz, and the sample is resampled in hardware to that rate. I have no idea how AICA's resampling would sound for something like that. I guess you'll have to try it and see. 48 to 44.1 shouldn't be a problem.


Cool, I tried some 96kHz MP4's with DCMC last night. It sounds the same as 48kHz!


Nice! Good to hear... in more ways than one. :wink: :lol:

Quote:
Chilly Willy wrote:
PH3NOM wrote:
And, to be perfectly clear, 6ch audio is down-mixed to stereo ( in software ) before sending the samples to the SPU.


There are a number of different down-mix formulas used by different players to allow simple mixing, or Dolby mixing, Dolby Pro mixing, etc. You'll probably want to check that out... maybe make it an option the user can set.


Yeah, currently LibA52 is using Dolby Pro downmixing, and LibFAAD is using a standard Stereo downmix.
It is a good idea to put the downmixing functions into my audio driver, then it would be easy to allow
the user to change this, in the GUI.


That would be good - pull all the down-mixing into a single module of the program so it's easier to control. While you're doing that, it gives you the chance to look over all the ways different libs go about doing down-mixing. You may find some do a better job than others.

Quote:
Chilly Willy wrote:
I followed this guide:
http://www.dcemu.co.uk/vbulletin/thread ... from-China

If you notice my posts (I'm JLF65 over there), it cost me a total of $26.14 USD and took almost 7 weeks, but I'm happy with how it turned out. I'm using an 8GB MicroSDHC card in the adapter, with no problems so far. I'm currently ripping my Sonic Adventure disc in DreamShell to the SD card. I'll probably rip a number of my game discs to see if they work so I can cut back on wear on the drive. I already made an SDISO for my Doom port... the SD is noticeably slower than the CD drive but I like the lack of grinding on the drive. :mrgreen:


Haha, nice. I have all the parts, I just havn't had time to assemble the adapter, yet.
I need to track down an old friend, to see if he can assemble it for me :o


Ah, so you want to build it yourself... or have someone else do the grunt work. :grin:

Given the price of a plain USB SD adapter, if you can mod it yourself (or get a friend to), it can save time and money.


Top
 Profile  
 
PostPosted: Fri Jun 10, 2011 10:00 am 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 295
Stryfe wrote:
Edit;
The SD card options sound nice, but I'll not be able to get one anytime soon.

Will you still be implementing optimizations for non-sd users?


I guess so, what it doesn't have is sd support for now, but phenom is trying to squeeze out the dc potential , specially for the cd.


Top
 Profile  
 
PostPosted: Sat Jun 11, 2011 9:14 am 
Offline
Insane DCEmu
Insane DCEmu
User avatar

Joined: Wed Apr 09, 2008 7:04 am
Posts: 186
Location: Europe
So when the project will be available for testing ?

_________________
Order Fast Striker, GunLord and NEO XYX for Dreamcast at http://www.ngdevdirect.com
Order 2d/3d Shoot 'em up Sturmwind http://www.redspotgames.com/shop
Order Dux 1.0, Redux incl. Dux 1.5 and The Ghost Blade at http://hucast.com/index.php


Top
 Profile  
 
PostPosted: Tue Jun 14, 2011 7:23 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 397
Basil wrote:
So when the project will be available for testing ?


It would be nice to have a public release soon, maybe around 4th of July. But that is far from a promise!
Realistically I would like to be finished with the project by the end of the summer.
Aside from finishing what I want to do with the code, I would also like to make a website to centralize the project before I release anything.

Just rest assured I will be working on this project, as much as I can. There are many things still to solidify.

Currently, I am finishing my re-write of the LibMPG123 decoder to use the k:os sound stream functions.

Trying to use SDL audio while decoding with XviD was stupid slow! :o

I believe my port of LibMPG123 is actually faster than the existing K:OS MP3 port ( the library itself is using SH4-optimized inline ASM for the idct ) but I need to do some benchmarking to provide some numbers to back it up.


Top
 Profile  
 
PostPosted: Wed Jun 15, 2011 2:02 am 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 316
SDL in general on the DC isn't very helpful. You're better off just using KOS straight than SDL for either video or audio. There's plenty of example code, and it's easy.


Top
 Profile  
 
PostPosted: Wed Jun 15, 2011 3:17 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 295
SDl is good for quick ports, and some games but not if you want to squeeze the dc that's for sure. Still I got a decent performance for 2d stuff but video playback is on another league...


Top
 Profile  
 
PostPosted: Wed Jun 15, 2011 3:54 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 397
Chilly Willy wrote:
SDL in general on the DC isn't very helpful. You're better off just using KOS straight than SDL for either video or audio. There's plenty of example code, and it's easy.


For DCMC, all video output is done using the PVR directly.

For audio output, it was really easy to bolt on a SDL audio driver for all of the various audio decoder libraries.

CPU speed using SDL mixer is not a problem for decoding only audio on DC.

But, when simultaneously decoding XviD video and MP3 audio, SDL mixer shows what a burden on CPU it really is.

I have basically finished the <dc/sound/stream.h> implementation of LibMPG123.
It wasnt really necessary to be this complex, but I decided to follow the mold of the K:OS examples

Code:
/*
**
** mpg123spu.c
** (C) PH3NOM 2011
**
*/

#include <kos/thread.h>
#include <dc/sound/stream.h>

#include <assert.h>
#include <string.h>
#include "stdio.h"
#include "sys/types.h"

#include "mpg123.h"

#include "mpg123spu.h"

#define BS_SIZE 65536
#define BS_MIN  16*1024      

FILE * mp3fd;
mpg123_handle *mh;
char * mp3file[128];

static unsigned int buffer[BS_SIZE], *buf_ptr;
unsigned int outbuf[BS_SIZE+16384], *outbuf_ptr;
static int pcm_count, pcm_discard;
static int err, bs_count, rsize;
unsigned int done;

long rate;
int channels, enc;

static snd_stream_hnd_t stream_hnd = -1;
static volatile int spu_status;
static kthread_t * adec_thread;

/* Exit the audio decoder. This is called from outside the decode thread. */
int libmpg123_quit() {
    spu_status = SPU_STATUS_DONE;
    //thd_wait(adec_thread);
    while( spu_status != SPU_STATUS_NULL )
      thd_sleep(10);

    printf("MPG123 Exited ok\n");
}

/* Exit the audio decoder. */
static int mpg_quit() {

    /* Release the audio decoder */       
    mpg123_close(mh);
    mpg123_exit();
                 
    /* Release the audio driver */
    fs_close(mp3fd);
    //free(outbuf);
    //free(buffer);
    sq_clr( mp3file, sizeof(mp3file));
    sq_clr( buffer, sizeof(buffer));
    sq_clr( outbuf, sizeof(outbuf));
   
    printf("LibMPG123 Decoder Finished.\n");

    return 0;
}

/* Initialize the audio decoder */
static int mp3_init( ) {
   
    int i;
    int err = 0;

    /* Open the MP3 File */
    mp3fd = fs_open( mp3file, O_RDONLY );
    assert( mp3fd!= NULL );

    buf_ptr = buffer;
    outbuf_ptr = outbuf;
    pcm_count = pcm_discard = 0;

    /* Initialize the Decoder */
    mpg123_init();
    mh = mpg123_new(NULL, &err);
    assert(mh != NULL);
   
    /* Open the MP3 context in open_fd mode */
    err = mpg123_open_fd(mh, mp3fd);
    assert(err == MPG123_OK);   

}

/* Check to see if more input data is needed, then do so */
static int mp3_read() {

    /* Get the current bitstream offset */
    off_t mp3pos = mpg123_tell_stream (   mh );
   
    /* If the buffer is below the minimum value, pull in more data */   
    if( bs_count <= BS_MIN || err == MPG123_NEED_MORE ) {

       memcpy(buffer, buf_ptr, bs_count);
   
       long bytes_read = fs_read( mp3fd, buffer+bs_count, BS_SIZE-bs_count );
   
       bs_count+= bytes_read; buf_ptr = buffer;
       
    }

    /* Get the bitstream read size */
    int read_size = mpg123_tell_stream ( mh ) - mp3pos;
   
    return read_size;     

}

/* Taken from old K:OS MP3 decoder */
static int pcm_empty(int size) {
   if (pcm_count >= size) {
      /* Shift everything back */
      memcpy(outbuf, outbuf + size, pcm_count - size);

      /* Shift pointers back */
      pcm_count -= size;
      outbuf_ptr = outbuf + pcm_count;
   }

   return 0;
}

/* LibMPG123 Decoder callback */
static int mp3_decode(snd_stream_hnd_t hnd, int size, int * actual) {
       
        /* Update the PCM buffer */
        pcm_empty(pcm_discard);
                       
        /* Read the bitstream */
        rsize = mp3_read();
               
        /* Decode the mpeg data */
        err = mpg123_decode(mh, buf_ptr, rsize, outbuf, size, &done); 
       
        /* Adjust the pointers */
        buf_ptr += rsize;
        bs_count -= rsize;
        outbuf_ptr += done;
        pcm_count += done;
        pcm_discard = *actual = done;

        /* If this is the first frame, intitialize the output structures */
        if (err == MPG123_NEW_FORMAT ){
            mpg123_getformat(mh, &rate, &channels, &enc);
            printf("MP3 File Info: %iHz, %i channels...\n", rate, channels);
        }
       
        /* Sould we exit? */
        if (err == MPG123_ERR){
            printf("err = %s\n", mpg123_strerror(mh));
            spu_status = SPU_STATUS_DONE;
        }
       
        return outbuf;

}

static int mp3_thread() {

    printf("MP3 Decoder Thread Starting\n");

    if( spu_status != SPU_STATUS_NULL ) {
        printf("SPU ERROR: Already Running!\n");
        return -1;
    }

    while( spu_status != SPU_STATUS_DONE) {
       
    switch( spu_status ) {
         
      case SPU_STATUS_NULL:
         mp3_init();   
        if( err == MPG123_OK ) {
           stream_hnd = snd_stream_alloc(NULL, SND_STREAM_BUFFER_MAX);
            assert( stream_hnd != -1 );
            spu_status = SPU_STATUS_INITIALIZED;
         }
         break;
      case SPU_STATUS_INITIALIZED:
         snd_stream_set_callback(stream_hnd, mp3_decode);
         snd_stream_prefill( stream_hnd );
         if( spu_status != SPU_STATUS_DONE )
            spu_status = SPU_STATUS_READY;
         break;
      case SPU_STATUS_READY:   
         snd_stream_start(stream_hnd, rate, channels - 1);
         spu_status = SPU_STATUS_STREAMING;
         break;
      case SPU_STATUS_STREAMING:                   
         while( spu_status != SPU_STATUS_DONE ){
            if (snd_stream_poll(stream_hnd) < 0)
               printf("Nothing decoded\n");
            else
               thd_sleep(50);
         }
         printf("SPU_STATUS: Finish Decode\n");
         break;
      case SPU_STATUS_DONE:
         printf("Shutting Down LibMPG123 and soundstream\n");   
         mpg_quit();
         snd_stream_stop(stream_hnd);
        snd_stream_destroy(stream_hnd);
        break;
     
      default:
         mpg_quit();
         snd_stream_stop(stream_hnd);
        snd_stream_destroy(stream_hnd);
        break;   
    }
   
    }         

    spu_status = SPU_STATUS_NULL;
    printf("MP3 Decoder Thread Finished\n");
   
    return 0;
}

/* Create a new thread to decode the MP3 File */
void libmpg123_dec( char * mp3_file ) {
   
    sprintf( mp3file, "%s", mp3_file );
    adec_thread = thd_create( mp3_thread, NULL);

}


I will post this new K:OS mp3 decoder before I actually release DCMC ;-)


Top
 Profile  
 
PostPosted: Thu Jun 16, 2011 7:02 am 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 295
Awesome, that might actually give the chance to use mp3 in 2d games without affecting the performance that much... I've had to use formats like wav or mod, s3m, etc...

DCMC is looking really good so far.


Top
 Profile  
 
PostPosted: Thu Jun 16, 2011 3:15 pm 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 316
Is that being done on the ARM processor? We need more sound code on the ARM... ogg-vorbis, mp3, and mikmod/modplug at the very least. That would do games and media players the best good.


Top
 Profile  
 
PostPosted: Thu Jun 16, 2011 6:00 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 397
Chilly Willy wrote:
Is that being done on the ARM processor? We need more sound code on the ARM... ogg-vorbis, mp3, and mikmod/modplug at the very least. That would do games and media players the best good.


Well, the sound driver runs on the ARM, and tells the SH4 when it needs some more data.
SH4 is doing all of the decoding, but the library is using SH4-optimized inline ASM for the idct functions.

I originally wanted to have the MP3 decoder running completely on the ARM processor.
https://datatype.helixcommunity.org/Mp3dec

But, the ARM processor on the DC does not have Multiplier logic, so it is almost useless.

MultiMedia Mike mentioned something to me about offloading later stages of decoding onto the ARM, but I havnt heard back from him in a while, so I dont know what exactly he had in mind.


Top
 Profile  
 
PostPosted: Fri Jun 17, 2011 1:27 am 
Offline
Insane DCEmu
Insane DCEmu

Joined: Thu Apr 03, 2008 5:01 am
Posts: 126
You won't be able to do anything on the ARM. It's virtually a ~3MHz chip.


Top
 Profile  
 
PostPosted: Sun Jun 19, 2011 2:01 am 
Offline
DC Developer
DC Developer

Joined: Thu Aug 20, 2009 9:00 am
Posts: 316
Looking at this thread: viewtopic.php?p=241423

There's some disagreement over the ARM... some old AICA docs from people like the Hitmen suggest it's only up to 25MHz, not 45MHz. The older ARM7 (v3 arch) only clocked up to 26MHz and didn't have multiply instructions. However, EVERYTHING else everywhere says it's a 45MHz ARM7, and an ARM7 that speed would have the multiply instructions. KOS sets the default flag for the compiler to

Code:
   export DC_ARM_CFLAGS="-mcpu=arm7 -Wall -O2 -fno-strict-aliasing"


In any case, a 25MHz ARM v3 without multiply would easily handle tracker music, but probably not anything more involved.


Top
 Profile  
 
PostPosted: Sun Jun 19, 2011 5:48 am 
Offline
Insane DCEmu
Insane DCEmu

Joined: Thu Apr 03, 2008 5:01 am
Posts: 126
The AICA master clock is 45MHz, so the internal hardware (mixer, DSP...) is running at 45MHz.
However, the ARM has its own clock of 22,5MHz. But because of lack of cache, the ARM won't be able to provide more than ~3 MIPS.

Furthermore, it's an ARM7DI; while it has the mul opcodes, those take a lot of cycles to be executed, compared to GBA's ARM7TDMI for instance (I remember calculating it for a 32b,32b=>64b multiplication, it was something like 8 times slower).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 139 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 7  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group