Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: thepenguin77 on January 28, 2011, 11:46:25 pm

Title: Four Level Grayscale Video
Post by: thepenguin77 on January 28, 2011, 11:46:25 pm
Yes, that title means exactly what you think it does. I can play 4 level grayscale videos. The videos run at 15 fps and are 12*64*2 = 1,536 bytes a frame. But through some RLE (compressing 00's and FF's) I managed to get compression ratios of about 30% meaning that overall, these videos run at about 16KB/s.

As far as the converting, it is very ugly. First I send a video through SUPER and it spits it out as a series of .jpg's. Then I use a GIMP extension to convert those to .bmp's. Then my converter looks at each picture, decides which colors go where, and spits out a binary which goes through To8xk and Wabbitsign to become an app.

To decide what color to use where, I tried two different strategies. The first was to tally up all the brightnesses of every pixel in the whole video then take the Q1, Mid, and Q3 as the cutoffs for each color. But this resulted in parts of the video that were mostly one color. So used the same technique to calculate the cutoffs each frame and that is what I use now. (But the old way is still possible with the flip of a bit.)

There'll be more videos to come. Even one sync'd with another calculator for sound (bet you can't guess what that is ;)). But for now, you just get to watch me do a Daffy off a jump while skiing.

Edit:
     It looks better in wabbitEmu, so here are the files. (I can't even imagine on a real calc 0.0

Edit2:
     I got too anxious and uploaded an uncompressed video and a decompressing player. Fixed now.
Title: Re: Four Level Grayscale Video
Post by: ztrumpet on January 28, 2011, 11:51:47 pm
THAT'S AWESOME! (pardon my caps)

Wow. O.O  Wonderful job.  How much video can we fit on the calc at once?
Also, nice jump. ;D
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on January 28, 2011, 11:56:17 pm
It obviously depends on the video. But if you get around 30% compression, around 90 seconds. Meaning that it holds more video than sound.

I forgot to mention in the first post, don't garbage collect with this on your calculator. Some of the pages start with FF and the app will surely get corrupted.
Title: Re: Four Level Grayscale Video
Post by: AngelFish on January 28, 2011, 11:56:49 pm
How does it work? Wabbitemu won't run it for me  :'(
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on January 28, 2011, 11:57:41 pm
Send the app and the program and run the program. That's so it's easier to modify while working on it.
Title: Re: Four Level Grayscale Video
Post by: AngelFish on January 28, 2011, 11:59:27 pm
Well, there goes Wabbit...
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on January 29, 2011, 12:03:01 am
I got too anxious. Read the Edit2 on the first post. That will probably fix your problems.
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on January 29, 2011, 03:15:47 am
That's awesome! I wonder if this could be streamed from MSD8x...
Title: Re: Four Level Grayscale Video
Post by: Xeda112358 on January 29, 2011, 03:24:26 am
Wow, now that is a cool idea!
Title: Re: Four Level Grayscale Video
Post by: z80man on January 29, 2011, 03:31:23 am
That's even more amazing than the first time I ran truegray.  O.O
Title: Re: Four Level Grayscale Video
Post by: kindermoumoute on January 29, 2011, 03:53:05 am
Amesome screenshoot !
(a video player on z80, soon ?)


I download the 2 files, and I got a bug :
(http://img814.imageshack.us/img814/2624/bugw.gif)


PS : Which langage is use ?
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on January 29, 2011, 04:02:35 am
Wow, your screenshot looks like a video converted from a VHS tape during two overlapping recordings. :P

He uses assembly, by the way.
Title: Re: Four Level Grayscale Video
Post by: jnesselr on January 29, 2011, 09:44:20 am
Could you make a program that does the same thing, but for black and white screens?
Title: Re: Four Level Grayscale Video
Post by: Ashbad on January 29, 2011, 11:51:31 am
I would totally do this for the sausage song
Title: Re: Four Level Grayscale Video
Post by: JosJuice on January 29, 2011, 02:02:11 pm
I'm surprised no one thought of rickrolls yet :P
Title: Re: Four Level Grayscale Video
Post by: ztrumpet on January 29, 2011, 02:13:20 pm
I'm surprised no one thought of rickrolls yet :P
Believe me, I thought of them and decided that I'd wait for sound. :P
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on January 29, 2011, 04:04:11 pm
I'm surprised no one thought of rickrolls yet :P
Believe me, I thought of them and decided that I'd wait for sound. :P
Even one sync'd with another calculator for sound (bet you can't guess what that is ;)).

kindermoumoute, you got the uncompressed version that I uploaded first. Redownload the video file.
Title: Re: Four Level Grayscale Video
Post by: Builderboy on January 29, 2011, 04:06:10 pm
Wow this is astounding O.O the speed and quality you get, as well as the filesize is really amazing!
Title: Re: Four Level Grayscale Video
Post by: ztrumpet on January 29, 2011, 04:56:05 pm
I'm surprised no one thought of rickrolls yet :P
Believe me, I thought of them and decided that I'd wait for sound. :P
Even one sync'd with another calculator for sound (bet you can't guess what that is ;)).
Oh no.  I think I just guessed it. :P
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on January 29, 2011, 05:30:47 pm
So it turns out that when super converts a video to .jpg's, it doesn't change the frame rate to what you want. So here is a video running at 29 fps. I couldn't think of anything cooler, so this is what you get.

Edit:
    Again, this looks better on wabbit than in the screenshot.
Title: Re: Four Level Grayscale Video
Post by: Darl181 on January 29, 2011, 05:31:53 pm
:w00t:
Calc-based rickroll, here I come!
Title: Re: Four Level Grayscale Video
Post by: yunhua98 on January 29, 2011, 05:33:10 pm
So it turns out that when super converts a video to .jpg's, it doesn't change the frame rate to what you want. So here is a video running at 29 fps. I couldn't think of anything cooler, so this is what you get.

Edit:
    Again, this looks better on wabbit than in the screenshot.

doesn't Wabbit show the same thing as the screenies?

EDIT: I love messing with Wabbit Settings.  :D
Title: Re: Four Level Grayscale Video
Post by: Builderboy on January 29, 2011, 05:53:06 pm
haha messing with the decay time?  It looks even better! O.O I wonder what it looks like on calc
Title: Re: Four Level Grayscale Video
Post by: yunhua98 on January 29, 2011, 05:54:01 pm
*delay time lol

I also set the greyscale to Game grey and changed t to 30 shades of grey
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on January 29, 2011, 06:22:09 pm
Now I hope people at school won't put questionable content on their calc. O.O
Title: Re: Four Level Grayscale Video
Post by: Xeda112358 on January 29, 2011, 11:35:22 pm
Oh jeez... I can see it already... gray scale 3116's and 8's and 4's and 3's oh jeez!

Sorry, it is kind of an inside joke...
/me likes numbers >.>
Title: Re: Four Level Grayscale Video
Post by: kindermoumoute on January 30, 2011, 05:47:02 am
Edit:
    Again, this looks better on wabbit than in the screenshot.
(http://www.omnimaga.org/index.php?action=dlattach;topic=6387.0;attach=5865;image)

 :o
Title: Re: Four Level Grayscale Video
Post by: Xeda112358 on January 30, 2011, 11:35:42 am
:o
My sentiments exactly, Kindermoumoute.
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on January 30, 2011, 08:57:36 pm
Oops, I accidentally left off the last 62 frames of the video. (fourvid.exe <source folder> <output file> <number of frames>). So here is the full video in 12 shades of gray.

Edit:
    Has anyone tried this on a real calculator?
Title: Re: Four Level Grayscale Video
Post by: FloppusMaximus on January 30, 2011, 09:36:11 pm
I imagine dithering would help.  It might also be interesting to consider adjusting the LCD contrast.  And now I'm wondering if there would be enough CPU time to do any more sophisticated decompression.

Also, the Old Spice example looks like it had some serious MPEG and/or JPEG compression artifacts to begin with.  Or maybe the conversion is making the existing artifacts a lot worse.
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on January 30, 2011, 11:02:12 pm
What do you mean by dithering in this case? If you are talking about the scan lines, those are only present in wabbitEmu. I tried it on my real calculator and they are hardly noticeable.

You are also definitely correct about the compression artifacts. I traced the steps through and it looks like SUPER caused them when it converted the .flv to .jpg's. But as of now, I don't know any other way to do that step.

For decompression on the calculator, there is definitely enough time. 16,000,000 hz * 50 % (grayscale) /15 = 533,000 clock cycles per frame. That's 347 clocks per byte, clearly enough time to do something amazing. The only thing I'm doing right now is converting strings of 00's and FF's to 00 00 (length) and FF FF (length).
Title: Re: Four Level Grayscale Video
Post by: z80man on January 30, 2011, 11:13:14 pm
Dithering is a way to artificially increase the number of shades availible. A good example is here on wikipedia http://en.wikipedia.org/wiki/File:Dithering_example_red_blue.png (http://en.wikipedia.org/wiki/File:Dithering_example_red_blue.png) you can see how red and blue are combined to make purple. In your converter you could add dithering to better shade some areas
Title: Re: Four Level Grayscale Video
Post by: Builderboy on January 31, 2011, 01:20:24 am
Perhaps the jpegs themselves are the source of the problem?  Maybe you would be better off with some sort of lossless image file instead of a lossy one.

As for dithering, note that it would also raise the filesize significantly ;)
Title: Re: Four Level Grayscale Video
Post by: z80man on January 31, 2011, 01:57:23 am
Perhaps the jpegs themselves are the source of the problem?  Maybe you would be better off with some sort of lossless image file instead of a lossy one.

As for dithering, note that it would also raise the filesize significantly ;)
In dithering do you mean by breaking up the long chains of FF's and 00's normally found in a frame. I didn't really realize at first that it would prevent the compression from working as efficiently.
Title: Re: Four Level Grayscale Video
Post by: Builderboy on January 31, 2011, 02:03:43 am
Right, by dithering you are adding more complexity, and so RLE will not work as well.  Btw how are you doing your RLE?
Title: Re: Four Level Grayscale Video
Post by: z80man on January 31, 2011, 02:14:20 am
I'm not sure how thepenguin77 is doing it, but for a string of 16 00's I would write $0010. So the 00 would be the identfier and 10 would represent 16 of them. and this is only for 00 and FF.
Title: Re: Four Level Grayscale Video
Post by: Builderboy on January 31, 2011, 02:29:19 am
the thing is though, that this video is not going to be byte based, but pixel based.  you wouldn't have 16 00's, you would have runs of either binary, or runs of 0-3
Title: Re: Four Level Grayscale Video
Post by: Munchor on January 31, 2011, 08:46:32 am
OH MY GOD, THIS IS SO AWESOME!

I just checked this topic, and it looks so great! Do you make every video or is it a converter from PC files?
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on January 31, 2011, 03:08:53 pm
Here is my current method of compression. 00's and FF's are the target since black or white sections are all one color.
Code: [Select]
Data: 00 00 00 00 00 00 00 00 00 06 58 00 36 87 ff ff ff ff ff ff ff ff 59 ff ff    86 32
Comp: 00 00 08                   06 58 00 36 87 ff ff 07                59 ff ff 01 86 32
Expl: 00flag#-1                        one ok   FFflag#-1                  only downside

As you can see, any long string gets shortened to three bytes with this. The only downside is that since the flag is a repeated FF or 00, 00 00 and ff ff get expanded one. But those are somewhat rare. The reason that the number of bytes is -1 is just to make life easier in z80.

As for dithering I just figured out that that means artificial grayscale by alternating colors between frames. But I could more easily add 8 level grayscale, it's just the file size that would suffer.

Edit:
    Does anyone have a good idea for compression techniques? I would love to hear them.
Title: Re: Four Level Grayscale Video
Post by: Builderboy on January 31, 2011, 03:55:21 pm
Ahhh thats an interesting take on RLE, I was assuming you were doing it pixel by pixel, not byte by byte.  I wonder what the size difference is between the two o.O There is always Huffman coding, although I have a feeling it would be not very well suited for video.  Hmmm there is some sort of expansion on RLE but I don't remember what it's called, something with a 7.  By its nature, it is a RLE but it is also more...
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on January 31, 2011, 04:16:28 pm
I'm thinking of doing a variation of DEFLATE (http://en.wikipedia.org/wiki/DEFLATE_(algorithm)). Here is the specification (http://www.ietf.org/rfc/rfc1951.txt) if anyone is interested. (if you're going to look at it, the important part is the top of page 11) It is essentially LZ77 paired with huffman tables for the distances and lengths. It's what .png uses so I figure it's good for pictures/video. What I think I'll do is just use the uncompressed and Fixed huffman table parts of it because I don't think my file sizes are big enough to be able to use the dynamic huffman table properly.

Since LZ77 using a sliding window, that creates a sort of problem when doing it on the calculator due to memory requirements. I am thinking of using a sliding window of 768*2*2=3,072 because that is two frames. To accomplish this quickly and efficiently, I'm going to move data around by switching pages rapidly. In what might be the most hacked memory configuration yet, I will have the flash page in the $4000 slot. I will have $3A00 bytes of page $81 swapped into the $8000 range through port ($28). Then, I will alternate having pages 0 and 3 swapped into the $8000 range and the $C000 range so that the two frames are always in the same place: $BA00 and $FA00. Hopefully, this will allow me to get the speed and address space required to make this work. (I'm backing up page 0, so don't worry.)
Title: Re: Four Level Grayscale Video
Post by: Builderboy on January 31, 2011, 04:26:18 pm
wow that sounds complicated O.O I hope you can get it all working :D
Title: Re: Four Level Grayscale Video
Post by: ztrumpet on January 31, 2011, 04:57:42 pm
Sounds epic!  Good luck! ;D
Title: Re: Four Level Grayscale Video
Post by: jnesselr on January 31, 2011, 06:26:14 pm
That is just... intense. I didn't know you could swap pages that quickly, though.
Title: Re: Four Level Grayscale Video
Post by: qazwsx988 on January 31, 2011, 07:06:30 pm
It doesn't seem to work on a real calc, what do you have to do with the files?
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on January 31, 2011, 07:16:43 pm
That is just... intense. I didn't know you could swap pages that quickly, though.
Swapping pages is instant. Meaning it's the fastest way to move data. (You're not really moving it though.)

It doesn't seem to work on a real calc, what do you have to do with the files?
It should work. I was showing people at school. Send both files, from the same post, and run the program. The app only contains data. Oh, and it definitely won't work on an 83+ for so many reasons.
Title: Re: Four Level Grayscale Video
Post by: Deep Toaster on January 31, 2011, 07:25:59 pm
It should work. I was showing people at school. Send both files, from the same post, and run the program. The app only contains data. Oh, and it definitely won't work on an 83+ for so many reasons.

Pity :( Even small videos wouldn't even fit, anyway. But this is epic nonetheless. Great job!
Title: Re: Four Level Grayscale Video
Post by: Darl181 on January 31, 2011, 08:01:48 pm
Would it be possible to run this using msd8x?  The videos can be made to run longer then...
Title: Re: Four Level Grayscale Video
Post by: critor on January 31, 2011, 08:24:41 pm
Great! :)

Oh, and it definitely won't work on an 83+ for so many reasons.

And with a TI-83+SE?
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on January 31, 2011, 08:54:20 pm
Compression artifacts? I don't think so!

I even made a few more fixes so this one is running at 15 fps meaning that this 30 sec file is 500k. Compression's not done yet though.

And with a TI-83+SE?
Yes. An 83+SE is essentially just an 84+SE without a USB port. They even have the crystal timers, which the Nspire lacks, meaning this won't work on that either.

Oh, and so I don't create any suspense. What I did was just have super not change the image sizes, so that way they were pixilated in 480p when I sent them into GIMP which gets rid of those artifacts when it cuts the size.
Title: Re: Four Level Grayscale Video
Post by: apcalc on January 31, 2011, 08:56:51 pm
Oh, and so I don't create any suspense. What I did was just have super not change the image sizes, so that way they were pixilated in 480p when I sent them into GIMP which gets rid of those artifacts when it cuts the size.

Ah!  I guess that explains why I didn't have any artifacts when I did the train video (resized with GIMP), but I did with the Rickroll (resized in SUPER).

Also, I should note, this is extremely amazing to see videos on the 84+.  With such a "slow" processor compared to the Nspire, I am amazed that you get that good speed!
Title: Re: Four Level Grayscale Video
Post by: Builderboy on January 31, 2011, 09:18:57 pm
Wow that looks lovely O.O epic job!
Title: Re: Four Level Grayscale Video
Post by: ztrumpet on January 31, 2011, 09:44:51 pm
Wow, looks incredible! O.O
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on January 31, 2011, 10:59:32 pm
Indeed O.O
Title: Re: Four Level Grayscale Video
Post by: tloz128 on January 31, 2011, 11:15:08 pm
(http://www.omnimaga.org/index.php?action=dlattach;topic=6387.0;attach=5903;image)

"Look at your calculator. Now at me. Now back to yours. Now back to me. Sadly, I'm not in your calculator, but you can make it look like it by using thepenguin77's 4-level grayscale program for ti-8x series calculators."

...also +1. Props to you on this!
Title: Re: Four Level Grayscale Video
Post by: Deep Toaster on January 31, 2011, 11:17:42 pm
Wow.

That looks amazing.

And the speed...

/me walks away stunned
Title: Re: Four Level Grayscale Video
Post by: qazwsx988 on January 31, 2011, 11:22:23 pm
Nvm, it works, I forgot to send the other program.
IT'S FREAKING AMAZING!
Title: Re: Four Level Grayscale Video
Post by: Deep Toaster on January 31, 2011, 11:26:36 pm
Nvm, it works, I forgot to send the other program.

Guess you do need it. Ignore me next time, sorry ;D

IT'S FREAKING AMAZING!
OH MY GOD, THIS IS SO AWESOME!
Wow.
Wow
Wow
Wow,
Wow
(again)
Wow
(again)
:o

Pretty much it.

WOW
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on February 01, 2011, 12:34:59 pm
It just happened. The first ever true calculator Rick Roll.



Description:
Quote
Using my new program for the 84+, FourVid, I am able to play 4 level grayscale videos on the calculator. Then by combining that with my other program, TruSound, I am able to play videos sync'd with sound!

Obviously this is on an 84+SE. Both the sound and video files are 1.3MB in size, which means that I had to clear the memory on both of them before I started.

Here are the files needed to play it. Just note that the sound file is clocked for wabbitEmu (15MHz) so it will run too fast on a real calculator (16MHz).

Also, if you have sent any of my videos to your real calc. You may have noticed that you are missing some memory. This is because some of the app pages started with $FF and the calculator won't delete them. So the only way to get the memory back is to back up everything on your computer and then clear All Mem. This RickRoll video also suffers from the same problem. Sorry about that. I'll fix that soon.

Haha, the files are too big for this post. Video (https://docs.google.com/leaf?id=0BwCVAkfyn6_vNGJiZTlkNzgtYmYwYS00ZTg3LTgzMzUtMzg4MmU4ODZjZTRi&hl=en), player (https://docs.google.com/leaf?id=0BwCVAkfyn6_vMGU2ZDFiOGEtOTQ1ZS00NGE3LThmMmMtZGM2MTkwZjY1MmQ5&hl=en), song (https://docs.google.com/leaf?id=0BwCVAkfyn6_vZTYwMTdlZGQtZjFhYi00MDA0LTgxZjQtMWY4YzJiYTgzYThj&hl=en).

(http://img.removedfromgame.com/imgs/rickRollVid.gif)
Title: Re: Four Level Grayscale Video
Post by: kindermoumoute on February 01, 2011, 12:43:10 pm
:o


EDIT : Wooooooaaaaaaaaaaaa awesome, perfect rickroll on z80 !

EDIT2 : better than Nspire rickroll. :p
Title: Re: Four Level Grayscale Video
Post by: Ikkerens on February 01, 2011, 01:04:25 pm
Nvm, it works, I forgot to send the other program.

Guess you do need it. Ignore me next time, sorry ;D

IT'S FREAKING AMAZING!
OH MY GOD, THIS IS SO AWESOME!
Wow.
Wow
Wow
Wow,
Wow
(again)
Wow
(again)
:o

Pretty much it.

WOW

You have builderboy twice :P
Add mine:
Wow. Say Thug Aim 3 times in a row.
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on February 01, 2011, 03:13:21 pm
This is too epic ;D

Now I wonder if monochrome videos combined with sound would be doable on a 15 MHz calc?
Title: Re: Four Level Grayscale Video
Post by: JosJuice on February 01, 2011, 03:15:33 pm
This is too epic ;D

Now I wonder if monochrome videos combined with sound would be doable on a 15 MHz calc?
And if it's possible, would compression be too hard? I have a feeling that video+audio files will be very large...
Title: Re: Four Level Grayscale Video
Post by: kindermoumoute on February 01, 2011, 03:23:51 pm
It just happened. The first ever true calculator Rick Roll.



Description:
Quote
Using my new program for the 84+, FourVid, I am able to play 4 level grayscale videos on the calculator. Then by combining that with my other program, TruSound, I am able to play videos sync'd with sound!

Obviously this is on an 84+SE. Both the sound and video files are 1.3MB in size, which means that I had to clear the memory on both of them before I started.

Here are the files needed to play it. Just note that the sound file is clocked for wabbitEmu (15MHz) so it will run too fast on a real calculator (16MHz).

Also, if you have sent any of my videos to your real calc. You may have noticed that you are missing some memory. This is because some of the app pages started with $FF and the calculator won't delete them. So the only way to get the memory back is to back up everything on your computer and then clear All Mem. This RickRoll video also suffers from the same problem. Sorry about that. I'll fix that soon.

Haha, the files are too big for this post. Video (https://docs.google.com/leaf?id=0BwCVAkfyn6_vNGJiZTlkNzgtYmYwYS00ZTg3LTgzMzUtMzg4MmU4ODZjZTRi&hl=en), player (https://docs.google.com/leaf?id=0BwCVAkfyn6_vMGU2ZDFiOGEtOTQ1ZS00NGE3LThmMmMtZGM2MTkwZjY1MmQ5&hl=en), song (https://docs.google.com/leaf?id=0BwCVAkfyn6_vZTYwMTdlZGQtZjFhYi00MDA0LTgxZjQtMWY4YzJiYTgzYThj&hl=en).

(http://img.removedfromgame.com/imgs/rickRollVid.gif)

It work perfectly on wabbitemu, I didn't know a sound like this can be listen on 84+.
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on February 01, 2011, 03:24:08 pm
Compression is almost certainly impossible. I could actually almost see this being easy as a matter of fact. Just interlace the video and sound byte for byte and during the time that was previously used to decompress, write a byte to the screen.

Using this strategy, the video would be forced to run at 27 fps and the filesize would be 44KB/s (0.91DCS/s). Meaning 34 seconds of video. But it's possible.

Clearly no grayscale though. Sound requires uninterrupted CPU time and grayscale requires interrupts.
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on February 01, 2011, 03:26:23 pm
I see. It wouldn't be possible to make the video run at lower FPS?
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on February 01, 2011, 03:31:56 pm
Well, maybe. The video and audio have to be interlaced in some easy fraction. So assuming 23000 bytes per second on audio and 800 bytes per screen (768 + driver commands) 1/2 would be 14.5 fps. Which I guess is perfect. That was easy.
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on February 01, 2011, 03:33:33 pm
Well what I mean is couldn't the same video data be re-used every 2 frame? Or is that what you mean? 14.5 fps seems reasonable too because on-calc high FPS is blurry anyway.
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on February 01, 2011, 03:38:14 pm
Yes, that is exactly what I mean. So instead of video sound video sound video sound. It's video sound sound video sound sound.
Title: Re: Four Level Grayscale Video
Post by: Builderboy on February 01, 2011, 03:40:32 pm
Wow O.O I think my brains just exploded out of my ears
Title: Re: Four Level Grayscale Video
Post by: Deep Toaster on February 01, 2011, 03:44:47 pm
It just happened. The first ever true calculator Rick Roll.

Second. You were beaten by apcalc :D

But either way, the graphics are absolutely incredible! And is that the full song?
/me lost the Game in joy

EDIT: HOLY CRAP IT HAS SOUND! :crazy:
Title: Re: Four Level Grayscale Video
Post by: FinaleTI on February 01, 2011, 03:50:08 pm
It just happened. The first ever true calculator Rick Roll.

Second. You were beaten by apcalc :D
But what about this? (http://ourl.ca/3306/60995)
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on February 01, 2011, 03:54:27 pm
That was fake :P
Title: Re: Four Level Grayscale Video
Post by: FinaleTI on February 01, 2011, 03:59:45 pm
It's still funny.
Title: Re: Four Level Grayscale Video
Post by: ztrumpet on February 01, 2011, 04:32:09 pm
That's incredibly.  I'm amazed.  Again.  Wow.  O.O
Title: Re: Four Level Grayscale Video
Post by: squidgetx on February 01, 2011, 05:14:12 pm
Wow, this is great. I can't get it to work on Wabbit though, when I send the app to wabbit it doesn't show up in the apps menu...
Title: Re: Four Level Grayscale Video
Post by: Deep Toaster on February 01, 2011, 07:34:35 pm
I noticed some apps don't work in Wabbit. Try a different ROM?
Title: Re: Four Level Grayscale Video
Post by: guy6020665 on February 01, 2011, 10:46:40 pm
Holy  O.O :w00t: that is amazing!!!!!!
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on February 02, 2011, 05:03:15 pm
Wow, this is great. I can't get it to work on Wabbit though, when I send the app to wabbit it doesn't show up in the apps menu...
Yeah it's a major PITA to get some apps to work in it. I have to restart Wabbit then try again. Send the app first and make sure when launching Wabbit the calc memory is empty.

The worst of all gotta be MirageOS, but now there's Doors CS 7 which sends fine it seems.
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on February 07, 2011, 03:11:25 pm
I've been gone without internet, so that's why there were no updates. But I'm back. And as long as my compressor is actually compressing the file (not just spitting out garbage) it is getting about 3/4 compression ratio. So maybe get ready for 4.5 min long videos. We'll just have to see if the file is decompressable.
Title: Re: Four Level Grayscale Video
Post by: Happybobjr on February 07, 2011, 03:31:33 pm
cool to hear.
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on February 08, 2011, 02:21:43 am
Welcome back. :D And wow, 4.5 mins long vids would be cool. :D
/me whispers something about Global CALCnet Youtube downloader/decompressor for videos that are under 4.5 minutes long. :P (Although I wonder if that's even realistic. :P)
Title: Re: Four Level Grayscale Video
Post by: JosJuice on February 08, 2011, 09:18:22 am
Welcome back. :D And wow, 4.5 mins long vids would be cool. :D
/me whispers something about Global CALCnet Youtube downloader/decompressor for videos that are under 4.5 minutes long. :P (Although I wonder if that's even realistic. :P)
I think Kerm said that gCn supports about 1 fps if running at slightly less than full screen detail (no grayscale).
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on February 13, 2011, 11:59:59 pm
O.O

ok, then, no video streams. X.x
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on February 18, 2011, 04:27:50 pm
Now, I'm sure you've all been checking back at this topic every day for an update. And it is finally here.

I've managed to use a modified version of DEFLATE to compress the video files. So far with normal videos, its been getting compression ratios of about 40%-50%. This video right here got a compression ratio of 46%. It's 90 secs and is 1.1 MB.

(http://img.removedfromgame.com/imgs/superSmash.gif)

I also fixed the memory problem. Now all the pages start with 00 and are safe for use on a real calculator.

Edit:
    I've never officially said this. But ON stops the videos. ON creates an interrupt and therefore doesn't require any code to be run until it is pressed, that way the videos play faster.

Edit2:
    Wow. The oldspice video got a compression ratio of 69%. It's now only 230k.
Title: Re: Four Level Grayscale Video
Post by: kindermoumoute on February 18, 2011, 05:50:29 pm
Woa, awesome... but it will be possible to convert directly a video from a PC software to a calculator varaible ?
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on February 18, 2011, 05:55:27 pm
Right now, it's not very easy. I just converted a section of a youtube video for my calc. The process was youtube >realplayer> flv >super> wmv >moviemaker> wmv >super> mp4 >super> jpg >gimp> bmp >fourvid> 8xk.

Hopefully though, if I can figure out how .avi files work. The conversion will be a few steps shorter.
Title: Re: Four Level Grayscale Video
Post by: apcalc on February 18, 2011, 05:57:36 pm
Right now, it's not very easy. I just converted a section of a youtube video for my calc. The process was youtube >realplayer> flv >super> wmv >moviemaker> wmv >super> mp4 >super> jpg >gimp> bmp >fourvid> 8xk.

Hopefully though, if I can figure out how .avi files work. The conversion will be a few steps shorter.

On Super's website, I requested that they add support for direct video->bmp conversion.  They said that they would consider my suggestion.  Hopefully, if that is added, it will help to eliminate that step! :)
Title: Re: Four Level Grayscale Video
Post by: apcalc on February 19, 2011, 08:26:34 pm
Right now, it's not very easy. I just converted a section of a youtube video for my calc. The process was youtube >realplayer> flv >super> wmv >moviemaker> wmv >super> mp4 >super> jpg >gimp> bmp >fourvid> 8xk.

Hopefully though, if I can figure out how .avi files work. The conversion will be a few steps shorter.

On Super's website, I requested that they add support for direct video->bmp conversion.  They said that they would consider my suggestion.  Hopefully, if that is added, it will help to eliminate that step! :)

YES YES YES!

SUPER listened to my suggestion; I just downloaded the latest version, and it now supports direct video to .bmp conversions! :)
Title: Re: Four Level Grayscale Video
Post by: Happybobjr on February 19, 2011, 08:33:29 pm
Super does a great job
Title: Re: Four Level Grayscale Video
Post by: TIfanx1999 on February 19, 2011, 08:41:06 pm
@Thepenguin77: That smash bros. video looks great!, and I'm glad compression is working now. =)

@apcalc: Do you mean that super can now export a video as a series of BMPs?
Title: Re: Four Level Grayscale Video
Post by: apcalc on February 19, 2011, 08:41:44 pm
@apcalc: Do you mean that super can now export a video as a series of BMPs?

Yep! :)
Title: Re: Four Level Grayscale Video
Post by: TIfanx1999 on February 19, 2011, 08:44:06 pm
Ah, that's pretty cool actually. It should have (and appears to have been) an easy add for them anyways. :)
Title: Re: Four Level Grayscale Video
Post by: christop on March 01, 2011, 02:46:16 pm
Awesome job! This topic reminded me of a video player I was writing back in 2009 but never finished. My video codec only supports monochrome videos (only dithering, no grayscale), though, so it's not really the same as yours. With the way it works, it would probably be difficult to adapt to grayscale too.

I wrote an encoder and decoder that run on my computer, but I designed the compression format to make it fast and easy to decode on a 6MHz Z80 (I was targeting my trusty ol' TI-86). The GIF animation I attached shows the output of the decoder (after scaling and stretching it to the same aspect ratio as the TI-86 screen and converting to GIF). The video is 4:36 long and runs at about 8 fps. The compressed video is 577 KB long, so it's about 260 bytes per frame, or 2KB/s. The source is Red Hot Chili Pepper's "Can't Stop" music video. :)

I think I used FFMPEG to dump the video to individual images (I can't remember what format it dumps to, probably JPEG), eventually converted them to Portable Pixmap (PPM) format, scaled and cropped them, dithered them, and then concatenated them into one file, for my encoder to read. These steps are all fairly easy to do in batch with the NetPBM utilities.

Here's how the decoder works: the input file contains a list of 8x8 pixel tiles. The decoder saves these for later. Each frame consists of 16x8 tiles (128x64 screen / 8x8) running from top to bottom, left to right (column-major order). For each tile, the decoder reads a byte. If the byte is less than 128, then it is an index into the list of tiles. If the byte is 255, then the decoder reads in 8 more bytes and uses those as a "literal" tile. Whichever tile it uses (either from the list or a "literal" tile), the decoder XOR's the tile onto the previous frame at the current tile location. I chose to use XOR so the video can be played backwards (eg, rewinding) easily. To play a video backwards, the decoder XOR's the tiles exactly the same way.

Besides 0-127 and 255, there are several other byte values that are special too. The values between 128 and 143 mean "rotate the tile in the frame". By rotate I mean rotate each byte left or right, and rotate the bytes up or down. This is kind of like shifting the tile horizontally and vertically, but since I'm rotating the tiles, it's reversible (again, so the video can be played backwards). Bits 0 and 1 indicate how many pixels to rotate horizontally (-2, -1, 1, or 2), and bits 2 and 3 are for the vertical shift amount (same as the horizontal). Like the tile XOR operations, tile rotations operate on the tile in the previous frame. To play a video backward, the decoder has to rotate each tile in the opposite direction.

This leaves byte values 144 through 254 for other reversible operations. These are currently unused in my decoder but might be used in the future.

Here's the overall byte format:

video header:
1 byte=n (number of tiles)
8*n bytes=tile data

frame:
1 byte=frame type (most are 2 for "cumulative", but other values are possible, eg, 0 for end of stream)
128 tiles

tile:
1 byte=transformation type
8 bytes=literal tile (if type=255)

I haven't done this yet, but at the end of each frame I should probably write a 2-byte value that says how large that frame was, so the decoder can skip to the beginning of each frame when playing a video backwards.

One other idea I was playing with is to losslessly compress each lossy-compressed frame, but initial results show larger file sizes when this is done. It could be that the RLE compression method that I used on the frame data just isn't suitable for that type of data (I think it was basically the RLE used by the PCX format). This is an area I'll investigate further.

Based on this description of the decoder, it should be obvious how the encoder works, right? :) It basically just has to come up with a good set of tiles to pass to the decoder, and then for each tile within each frame, decide which tile adjustment (using a tile index, literal tile, or other transformation) results in the "best-looking" tile in the output. "Best looking" is subjective, so the encoder really determines the quality/size tradeoff (up to the hard limits of the format, which is currently 129 bytes/frame minimum).

Edit: tiles are actually stored in column-major order, not row-major order. That should make decoding slightly faster than row-major order.
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on March 03, 2011, 04:10:40 am
That's quite nice actually. Actually at such compression you can fit a lot more too. It doesn't look as great but on higher-res calcs it could probably look better due to smaller pixels reducing the dithering effect.
Title: Re: Four Level Grayscale Video
Post by: Builderboy on March 03, 2011, 11:05:53 am
I think that if you added a new dithering algorithm, you could even get that to look even nicer!  Try this one on for size! http://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering :D
Title: Re: Four Level Grayscale Video
Post by: Freyaday on March 03, 2011, 03:40:26 pm
I bow the presence of these programs. I have so much to learn. *Weeps*
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on March 03, 2011, 03:45:09 pm
Btw I wonder if Christop algorithm is the same as the one used in the RealSound video player that got featured on ticalc.org a few years ago?
Title: Re: Four Level Grayscale Video
Post by: christop on March 03, 2011, 04:07:46 pm
Btw I wonder if Christop algorithm is the same as the one used in the RealSound video player that got featured on ticalc.org a few years ago?
Are you referring to this one? http://www.ticalc.org/archives/files/fileinfo/385/38513.html

As far as I know, that only plays sound. That is the only RealSound player I could find on ticalc.

Regarding Floyd-Steinberg dithering, yes, it looks better (I tried it already), but it decreases the amount of compression possible because it changes more pixels between frames than ordered (Bayer) dithering. A better encoder might do a better job at handling it, though. (A better encoder might pass through the video twice: once to generate the best tile set for that video, and then again to do the actual encoding)
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on March 04, 2011, 02:16:00 am
Actually nevermind, it was not RealSound 2 but another video thing by Dan Englender:

http://www.ticalc.org/archives/news/articles/13/130/130297.html

RealSound 2 was an update to the app you linked to, which added video support. However it never actually got released. There's also TIMM, but it only created 8xp files, since it was made back when the 83+ SDK was not free and nobody wanted to develop Flash apps.
Title: Re: Four Level Grayscale Video
Post by: ralphdspam on March 10, 2011, 11:20:09 pm
?? That link is to a ticalc news for usb8x.  ??
NVM, I had no idea.  :P
Title: Re: Four Level Grayscale Video
Post by: willrandship on March 11, 2011, 12:02:33 am
USB8X has a vid player. They demonstrated it with a cutscene from the matrix :P but it's monochrome
Title: Re: Four Level Grayscale Video
Post by: DJ Omnimaga on March 11, 2011, 03:03:29 am
I always wondered if USB8x works via the TI-Nspire in 84+ mode, but then we're getting a bit off topic. :P
Title: Re: Four Level Grayscale Video
Post by: ikemike on March 28, 2011, 11:55:01 am
What file type of movie can USB8X play? It'd be indescribably epic to sit and watch anime in class.
Title: Re: Four Level Grayscale Video
Post by: JosJuice on March 28, 2011, 12:29:42 pm
What file type of movie can USB8X play? It'd be indescribably epic to sit and watch anime in class.
USB8X itself doesn't have a movie player - the player is separate. I don't know where the player can be found, or what it supports...
Title: Re: Four Level Grayscale Video
Post by: FloppusMaximus on March 28, 2011, 11:18:34 pm
I always wondered if USB8x works via the TI-Nspire in 84+ mode, but then we're getting a bit off topic. :P
It doesn't.  The Nspire doesn't emulate the 84+'s USB controller - all USB access is done through a set of special opcodes instead.  I don't know enough about these special opcodes to even say whether a port of USB8x would be possible.
Title: Re: Four Level Grayscale Video
Post by: aeTIos on March 29, 2011, 04:12:11 am
8 pages late: wow. cool!
Title: Re: Four Level Grayscale Video
Post by: ikemike on April 05, 2011, 12:03:53 am
Somewhat off-topic, but what is the longest song trusound can fit on an empty calculator at a decent sound quality?
Title: Re: Four Level Grayscale Video
Post by: willrandship on April 05, 2011, 12:07:13 am
Depends on the calc. An 84+SE? I'd guess 3 mins or less. Maybe if you had slower bit sampling it'd be better,
Title: Re: Four Level Grayscale Video
Post by: JosJuice on April 05, 2011, 12:59:25 pm
Depends on the calc. An 84+SE? I'd guess 3 mins or less. Maybe if you had slower bit sampling it'd be better,
I think it's around 80-90 seconds, or maybe even less. Lower quality would allow longer sounds, but it sounds pretty bad...
Title: Re: Four Level Grayscale Video
Post by: annoyingcalc on August 06, 2011, 10:46:44 am
It just happened. The first ever true calculator Rick Roll.



Description:
Quote
Using my new program for the 84+, FourVid, I am able to play 4 level grayscale videos on the calculator. Then by combining that with my other program, TruSound, I am able to play videos sync'd with sound!

Obviously this is on an 84+SE. Both the sound and video files are 1.3MB in size, which means that I had to clear the memory on both of them before I started.

Here are the files needed to play it. Just note that the sound file is clocked for wabbitEmu (15MHz) so it will run too fast on a real calculator (16MHz).

Also, if you have sent any of my videos to your real calc. You may have noticed that you are missing some memory. This is because some of the app pages started with $FF and the calculator won't delete them. So the only way to get the memory back is to back up everything on your computer and then clear All Mem. This RickRoll video also suffers from the same problem. Sorry about that. I'll fix that soon.

Haha, the files are too big for this post. Video (https://docs.google.com/leaf?id=0BwCVAkfyn6_vNGJiZTlkNzgtYmYwYS00ZTg3LTgzMzUtMzg4MmU4ODZjZTRi&hl=en), player (https://docs.google.com/leaf?id=0BwCVAkfyn6_vMGU2ZDFiOGEtOTQ1ZS00NGE3LThmMmMtZGM2MTkwZjY1MmQ5&hl=en), song (https://docs.google.com/leaf?id=0BwCVAkfyn6_vZTYwMTdlZGQtZjFhYi00MDA0LTgxZjQtMWY4YzJiYTgzYThj&hl=en).

(http://img.removedfromgame.com/imgs/rickRollVid.gif)


This never gets old
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on January 31, 2013, 09:56:22 pm
Holy necro-update batman!!

So today I wanted to show someone a video on my calculator, but I didn't have any because they are just too big to keep on there all the time. So, since I never actually put this program into a usable state, I figured I'd finish it.

This program now operates exactly like TruVid and even has the same dithering patterns. But, what makes it better than TruVid for videos is that it also compresses them. The compression ratio varies, but anything from 1% to 70% is possible.

Here is the same 1:30 video rendered in all 8 modes:
b
a b
a
(http://img.removedfromgame.com/imgs/superSmash%20b.gif)(http://img.removedfromgame.com/imgs/0-superSmash.gif)(http://img.removedfromgame.com/imgs/superSmash%20ab.gif)(http://img.removedfromgame.com/imgs/superSmash%20a.gif)
1,376,256  (2%)
1,359,872  (3%)
1,064,960  (24%)
1,032,192  (27%)
o
n
ao
an
(http://img.removedfromgame.com/imgs/superSmash%20o.gif)(http://img.removedfromgame.com/imgs/superSmash%20n.gif)(http://img.removedfromgame.com/imgs/superSmash%20ao.gif)(http://img.removedfromgame.com/imgs/superSmash%20an.gif)
819,200  (42%)
802,816  (43%)
622,592  (57%)
458,752  (68%)

The first number is the size of the video and the second number is the compression ratio. The flags are:
-   - Use flyod-steinburg dithering
- a - use absolute brightness cutoffs rather than per-frame cutoffs
- b - use both floyd-steinburd dithering and ordered dithering
- n - use no dithering
- o - use ordered dithering


It's interesting that the compression ratios line up rather well with quality. It would appear that to get the best video and still use compression, you should go for the -o flag. -a -n obviously gets the best compression, but it looks terrible. And I'm not sure which is better between (none) and -b, but they both basically have no compression.


In any case, here's everything you need to make your own videos and the -o video: (as well as sources

And this only works on windows because I use DirectShow.
Title: Re: Four Level Grayscale Video
Post by: Sorunome on January 31, 2013, 10:08:44 pm
This is awesome!
I actually think that the higher compression rates look better :P
Title: Re: Four Level Grayscale Video
Post by: pimathbrainiac on January 31, 2013, 10:36:59 pm
-o and -n look best, imho
Title: Re: Four Level Grayscale Video
Post by: Spenceboy98 on January 31, 2013, 11:13:54 pm
-o and -n look best, imho
I agree.
Title: Re: Four Level Grayscale Video
Post by: pimathbrainiac on February 01, 2013, 10:06:43 am
Also, does anyone know of a good conversion software where I can convert with a custom resolution with WMVs.
Title: Re: Four Level Grayscale Video
Post by: thepenguin77 on February 01, 2013, 03:47:54 pm
Super (http://www.erightsoft.com/SUPER.html)

It can convert just about anything to anything. Just watch out when installing though because any more they really try to add in a bunch of garbage.
Title: Re: Four Level Grayscale Video
Post by: Spenceboy98 on February 01, 2013, 05:03:18 pm
I use Freemake to convert my vids.
Title: Re: Four Level Grayscale Video
Post by: Happybobjr on February 02, 2013, 06:43:56 pm
This is wonderful :D
Title: Re: Four Level Grayscale Video
Post by: Spenceboy98 on February 06, 2013, 10:55:28 pm
Converted Gangnam Style:
(http://img.removedfromgame.com/imgs/GangnamCalc.gif)
This is just with -O
Title: Re: Four Level Grayscale Video
Post by: Juju on February 06, 2013, 11:34:54 pm
That's pretty cool, just saw this on your blog and tried it in Wabbitemu :D
Title: Re: Four Level Grayscale Video
Post by: Xeda112358 on February 09, 2013, 07:16:25 pm
@Spenceboy: Could you upload that and will it fit on my calc? o_o I want to show that to non-believers >:D