LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Bad apple VIDEO

Root / Talk About Programs / [.]

Gaelstrom_ValenceCreated:
Today, I've been coding my own video player and noticed that raw, uncompressed bitmap video takes a LOT of space in SmileBASIC. SmileBasic is capable of playing 30fps 400x240px quality video... if you don't mind it being 8 frames long. I had the video in a one-dimensional array, and SmileBASIC gave me a an "out of memory" error when I added more than eight images to it. EDIT: I should mention I had a second array acting as a frame buffer. 96,000 elements.

SB has around 8MB of heap memory, so you'd have enough room if the video was compressed a little. You don't really need a framebuffer if you implement some kind of GPAGE swap buffer (unless you're doing something behind-the-scenes I don't understand). SB is fast enough as long as all of the data is prebuffered, which is unfortunate.

That's very interesting. Did you test with full color or just black and white? Do you think it matters? I wonder... It sounds like it would be possible for someone, someone smarter than I, to make a codec (of sorts) for playing videos in SmileBASIC. Heck, maybe even at 60fps! Does anyone here know how video compression works, and which of its tricks would be applicable in SmileBASIC?

I've never personally tried, but you'd definitely have to have the data decompressed and prebuffered before playing the video if you want high framerates. A lot of video compression algorithms have block compression and involve the difference between the current frame and the last, but those practically require modern high-power hardware and quite a block of memory. Drawing a 2x-scale frame is absolutely trivial, in both performance and skill, so decreasing resolution is a great fix to use less memory. Palletized video would probably be slower and use more memory unless your implementation was totally rock-solid, to be honest.

I used COPY to copy the frame from the data array into the buffer array and used GLOAD to put the data from the buffer array on screen. Yes, it was full color.

Oh, alright. To boost performance you could cut the resolution down to something reasonable and GLOAD to a region in the sprite page. The video would be displayed on a scaled sprite.

Oh, alright. To boost performance you could cut the resolution down to something reasonable and GLOAD to a region in the sprite page. The video would be displayed on a scaled sprite.
I did that already, lolol. //slapped I can't say I know how the video could be longer than a minute even at 50x30px resolution. Was it 10fps? That would work uncompressed.