New EVA encoder / decoder (or format ?)

Página 1/5
| 2 | 3 | 4 | 5

Por Louthrax

Prophet (2255)

Imagen del Louthrax

07-01-2014, 17:58

Hi all,

I've been working these days on movie conversion for MSX (using MIF command line, see results here: Big Buck Bunny video on MSX 2 ). I also had a look at the EVA format and tools available.

The main problem with AVI2EVA now is that most of AVI files are not compatible (or they need pre-processing with VirtualDub). I think a good idea would be to use ffmpeg to convert the .AVI (or .MKV, or .MPG, ffmpeg supports lots of formats) into series of .PNG files and a single .WAV file. We then just need a tool to convert all .PNG and interleave the audio.

Converting a movie to EVA would not be so tricky (here for 12 fps and screen mode 2):

ffmpeg -i  -r 12 msx%08d.png
ffmpeg -i  -acodec pcm_s16le -ac 1 msx.wav
mif msx*.png msx.wav -sm2 -ct5 -fr12 -ofresult.eva
del msx*.png
del msx.wav

ffmpeg is really powerfull, and has lots of options for conversion. Maybe even the sound could be converted directly to 8 bit adpcm with it (or at least be converted to 16bits mono wav).
MIF has lots of options too, and can convert to all MSX screens with a good quality.

I think that combining this could produce very good results, and the encoding could even be multi-platform (ffmpeg is multi-platform, MIF command line will be too when I'll release the sources). I've already patched MIF to get wild-card filenames (*.png) and concatenate the output into a single video file, and made a small MSX player for it.

The current player code (screen 2/4 only for now) is quite simple, and works on all interfaces:

#include 
#include 
#include 
#include 
#include 
#include 
#include 

char	acBuffer[0x1800 * 2 + 0x20];

int main(int argc, char **argv)
{
	/*~~~~~~~~~~~~*/
	FILE	*poFile;
	/*~~~~~~~~~~~~*/

	VDP_init();
	VDP_screen(2);

	if(BIOS_MSXVersion())
	{
		VDP_enable(VDP_HIDE_SPRITES);
		VDP_enable(VDP_PALETTE0);
	}

	VDP_setBackgroundColor(0);

	poFile = fopen("bbbunny.adm", "rb");

	if(BIOS_MSXVersion())
	{
		/*~~~~~~~~~~*/
		int iPage = 0;
		/*~~~~~~~~~~*/

		while(fread(acBuffer, 0x1800 * 2 + 0x20, poFile))
		{
			VDP_copyToVM(0x2000 + (iPage << 14), acBuffer + 0x1820, 0x1800);
			VDP_copyToVM(0x0000 + (iPage << 14), acBuffer + 0x20, 0x1800);

			VDP_waitSync();
			VDP_setPalet((unsigned int *) acBuffer, 16);
			VDP_writeRegister(10, iPage);
			VDP_writeRegister(4, (iPage << 3) | 0x03);
			iPage ^= 1;
		}
	}
	else
	{
		/*~~~~~~~*/
		int iIndex;
		/*~~~~~~~*/

		while(fread(acBuffer, 0x1800 * 2 + 0x20, poFile))
		{
			VDP_waitSync();
			for(iIndex = 0; iIndex < 0x1800; iIndex += 256)
			{
				VDP_copyToVMMSX1(0x2000 + iIndex, acBuffer + 0x1820 + iIndex, 256);
				VDP_copyToVMMSX1(0x0000 + iIndex, acBuffer + 0x20 + iIndex, 256);
			}
		}
	}

	fclose(poFile);

	if(BIOS_MSXVersion()) BIOS_restorePalet();
	VDP_screen(0);
	if(BIOS_MSXVersion()) VDP_close();
}

The drawback is that I only have 5.4545 FPS instead of 11 or 12 with EVA, that uses direct access to the drive / SD Card.

I'm wondering too if I should keep compatibility with the EVA format or go for something new (as screen 4 is really an interesting encoding option, not sure if we can patch that into the existing EVA header format).

I'll continue my tests and post results or demos here.

Login sesión o register para postear comentarios

Por igal

Master (213)

Imagen del igal

07-01-2014, 19:27

I do not know help you but I am very interested by your work.

Por NYYRIKKI

Enlighted (5508)

Imagen del NYYRIKKI

08-01-2014, 12:39

Quote:

I'm wondering too if I should keep compatibility with the EVA format or go for something new (as screen 4 is really an interesting encoding option, not sure if we can patch that into the existing EVA header format).

Yes, you can... From here you can find a simple and slow vbscript to merge WAV & SC4 frames to "EVA" (No one has bothered to make a real program for this)

About the format: The EVA-format it self is not optimized for SC4, but it does good job on interleaving sound & picture data. One thing that improved the sound quality & framerate was that I added to triple buffering to the EVA SC4-player. Although there is some little things that can be improved, I don't expect that you can make it very much faster. Some size optimization is how ever possible.

Por Louthrax

Prophet (2255)

Imagen del Louthrax

08-01-2014, 14:28

Thanks NYYRIKKI, I'll have a look at that.I was also thinking about screen 5 support (which should enable 180x150 resolution, same amount of bytes as 128*106 in screen 8 & 12).

By the way, I'm on the point of dropping the idea of the "generic player", using only DOS accesses. It works well with video only. Well, just 5.45 FPS, but it works. But when trying to add PCM sound, I think I'm facing a wall :
- SCC & Artrag method allow 1 frame of buffering max (this is not enough, or we should allow interruptions during all the disk-access routine ??).
- Music Module has RAM for samples, but can't be written & played at the same time (I need to check this again but the Y8950 documentation I have is very unclear). That's really too bad !
- TurboR PCM & PSG : there's no buffer at all.

I've checked demos & players, and it seems like nobody has ever been able to achieve that (streaming PCM from a drive without using "direct access"). The NOP TraxPlayer was quite impressive though, playing samples from floppy disk drive.

Could anybody confirm that this is really impossible ?

Por Retrofan

Paragon (1246)

Imagen del Retrofan

08-01-2014, 19:46

Maybe you could use the Sunrise MP3 player instead which can stream (load into buffer and play) Wink It's MP3 instead of PCM, but... it's a compressed format and the cartridge does decode it Wink

Por edoz

Prophet (2248)

Imagen del edoz

08-01-2014, 20:01

What is the different between the player for the megasccrom+ ? This one play's sound on the PCM or MSX audio

Por Louthrax

Prophet (2255)

Imagen del Louthrax

08-01-2014, 20:39

edoz wrote:

What is the different between the player for the megasccrom+ ? This one play's sound on the PCM or MSX audio

Well, I was trying to have a "generic" player first, that would run on all MSX-DOS 2 drives (with more or less sync problems). The way EVA works is extremely clever (loading data from the IDE / SDCard drive AND playing video / audio at the same time), but makes the code very platform specific. The code can't be divided in, let's say, a main player code, and a library (or another .ASM file) handling the drive I/O access. Everything is interlaced in the code in small [ReadData / Write PCM / Write Video] sequences, which makes the player quite hard to port to a new interface...

Por Louthrax

Prophet (2255)

Imagen del Louthrax

08-01-2014, 20:47

Retrofan wrote:

Maybe you could use the Sunrise MP3 player instead which can stream (load into buffer and play) Wink It's MP3 instead of PCM, but... it's a compressed format and the cartridge does decode it Wink

Is it possible to write in the buffer when the MP3 is beeing played/decoded ? If yes, that might work. MP3 format would also reduce the amount of bytes read from the file (well, 8 bits mono PCM at 15Khz does not take that much).

But I'm still a bit disapointed by the fact that this can't be done on Music Module...

Por hit9918

Prophet (2886)

Imagen del hit9918

08-01-2014, 22:46

In case you got a bdos device that can really run without disabling interrupts.
Then on chips other than SCC, the problem is lack of timer interrupt.
I wonder, when on 9938 the vertical border is removed, maybe it can have line interrupts thrughout the whole frame.
With messy mirroring, needs verification on real machine.

Por NYYRIKKI

Enlighted (5508)

Imagen del NYYRIKKI

09-01-2014, 12:15

Louthrax wrote:

But I'm still a bit disapointed by the fact that this can't be done on Music Module...

I think it could be done, but it would definately NOT be easy... If it is true that you can't play ADPCM-sample at the same time while you write the sample RAM, then you could play PCM-sample on CPU while you update the sample RAM and then switch to ADPCM while loading... This would how ever mean that you would need to have part of the sample in PCM-format and part in ADPCM-format.

Unfortunately the documentation is so weird that I don't understand even the ADPCM-format well enough to play sample in correct volume and the MSX-Audio generated interrupts are also not clear to me... Well I've had not much use for direct access of MSX-Audio. How ever I just wanted to point out that in theory this could be done Smile

MP3-decoder card is the easy way to do this and maybe MoonSound could work as well (?) but with more traditional hardware you will hit to a big brick wall. It does not make it any easier that all the HDD implementations operate in different speeds and some disable interrupts for a long time while others have practically no effect to interrupts operation. Also when you use standard disk I/O you first need to transfer data to RAM before you can send it to VRAM / Sound device -> Causes huge slowdown.

Por Manuel

Ascended (16431)

Imagen del Manuel

09-01-2014, 12:58

AFAIK on MoonSound you can also not change the sampleRAM while playing samples.

Página 1/5
| 2 | 3 | 4 | 5