Author Topic: TruVid - 4 level grayscale video with sound  (Read 23976 times)

0 Members and 1 Guest are viewing this topic.

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
TruVid - 4 level grayscale video with sound
« on: July 08, 2011, 12:46:55 am »
That's right, I'm keeping with tradition of names by using Tru, but I'm also breaking the mold by making a 6 letter app name.

I think this video should sum it up.



Basically, I started this a while ago, but then USB called me and I stopped working on it. However, seeing Sircmpwn playing music from his flash drive energized me to finish this. From the classical estimates, this should be impossible, grayscale takes 50% of the processor while sound takes 90%, so how did I do it? Triple threading!!! I am actually doing 3 different things at once on this program. I am playing sound, updating grayscale, and copying new video data, all at once.

I think one of the humorous parts of this is the insane data rate. The video runs at 10 fps, 10 * 768 * 2 = 15,360 Bytes/s. The sound runs between 17,500 Bytes/s and 20,000 Bytes/s. So that's a total of 34KB/s. That means it burns through Mirage in .5 sec! At this rate, the 84+SE can hold about 45 seconds and the 84+BE can hold around 15. But hey, this is full video on the calculator.

I'm also trying to make the conversion process user friendly this time. I'm terrible at directshow and such, but so far, I have the inputs to my program as <soundfile.wav> <videoFile.wmv> where the sound is a .wav and the video file is a .wmv at 192x128 and 30 fps, which is relatively easy to do. I wanted to let you input 1 file and your cpu speed, but I couldn't even resize the BMP's for the video through Windows's routines, I had to do it by hand ;D


From an asm standpoint, this program is insane. First off, you take a grayscale video program. I am displaying a grayscale buffer at 60Hz and copying in new data at 10Hz. That's nothing special, but then I overlay sound interrupts running at 40Khz over top of that. These interrupts lower my base cpu speed to 500KHz, which is just enough time to copy in a new picture :D Better yet, for the first time, I'm using all 3 crystal timers, 2 of which are producing nested interrupts.

And you know, since it's me, perfect grayscale. It's not adjustable yet, but it will be.

In my current setup, I have video and audio looping independently, in the numa numa, assuming you are using the right processor speed, the video and sound are supposed to be the same length, however, the sound ends up being slightly longer since you can't interrupt instructions (which also causes the white noise.) But, I might be able to adjust for that. I could make them loop together, but I'm setting up for Nyan Cat ;D

Here's the source and some samples of this video. I included samples clocked for 15Mhz (wabbit), 15.65Mhz, and 16.3Mhz (mine). So use them if you want. I just have two warnings, 1) I don't think these apps will validate on the calculator, I used a workaround, but it does take a 1/2 hour to send, 2) these sound dreadful in wabbitemu, there's not much that can be done about that.

So have fun. (If you can't figure out how to run it and crash your calculator, I lol at you)

Edit:
    New download link
« Last Edit: July 08, 2011, 12:55:05 am by thepenguin77 »
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

SirCmpwn

  • Guest
Re: TruVid - 4 level grayscale video with sound
« Reply #1 on: July 08, 2011, 12:50:24 am »
Pure awesomeness.  I haven't seen a cooler thing in a while.
I'll also be attempting something similar, at a much lower quality from a flash drive soon.

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: TruVid - 4 level grayscale video with sound
« Reply #2 on: July 08, 2011, 12:57:14 am »
Well yeah that would be awesome if ran from a flash drive.

Also this deserve front page news.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Re: TruVid - 4 level grayscale video with sound
« Reply #3 on: July 08, 2011, 01:06:32 am »
WHA...No...brown...text...

I bow to you, good sir.
See you, space cowboy...

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: TruVid - 4 level grayscale video with sound
« Reply #4 on: July 08, 2011, 01:13:48 am »
...
Why? ? ? Why? ? ?
...
* t0xic_kitt3n wonders what motivates people to do these kinds of things...
Seriously, this is epic stuff. :thumbsup: Can you make a rickroll version of this, for added awesomeness?

Offline z80man

  • Casio Traitor
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 977
  • Rating: +85/-3
    • View Profile
Re: TruVid - 4 level grayscale video with sound
« Reply #5 on: July 08, 2011, 01:25:23 am »
My life is now complete and death will descend upon me like a dove.                         j/k

This is more than epic, it is cipe which is epic spelled backwards. Still trying to send to my calc but what else should I expect from what is almost the max possible app size on the 84+ SE

List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: TruVid - 4 level grayscale video with sound
« Reply #6 on: July 08, 2011, 03:49:56 am »
O.O
thepenguin77=awesome
ld a, 0
ld a, a

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: TruVid - 4 level grayscale video with sound
« Reply #7 on: July 08, 2011, 05:14:26 am »
That's phenomenal thepenguin77, no words to describe the awesomeness of TruVid.

1. I love the song and it makes it all better :P
2. The quality of both the sound and the video are awesome
3. The speed is also great for a calculator

Amazing job!

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: TruVid - 4 level grayscale video with sound
« Reply #8 on: July 08, 2011, 08:34:14 am »
I remember hearing you talk about this on IRC. This is simply fantastic. I love how you are constantly pushing the bounds of what was thought to be possible. Also, please take some time to clean up your work desk, that thing is freakin messy! :P

Offline Stefan Bauwens

  • Creator of Myst 89 - סטיבן
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1799
  • Rating: +162/-24
  • 68k programmer
    • View Profile
    • Portfolio
Re: TruVid - 4 level grayscale video with sound
« Reply #9 on: July 08, 2011, 08:37:50 am »
THIS IS EPIC.


Very proud Ticalc.org POTY winner (2011 68k) with Myst 89!
Very proud TI-Planet.org DBZ winner(2013)

Interview with me

Offline Camdenmil

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 121
  • Rating: +4/-0
    • View Profile
Re: TruVid - 4 level grayscale video with sound
« Reply #10 on: July 08, 2011, 08:52:10 am »
The epicness factor of this... *.*
It is bad luck to be superstitious.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: TruVid - 4 level grayscale video with sound
« Reply #11 on: July 08, 2011, 11:01:00 am »
This is incredinble.  I can't believe this is possible even though you've showed up that it is. :P  Wow.  Thepenguin, you are an incredible coder. ;D

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: TruVid - 4 level grayscale video with sound
« Reply #12 on: July 08, 2011, 11:21:52 am »
Wow...  That is EPIC!  now for the Nspires...  :P

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: TruVid - 4 level grayscale video with sound
« Reply #13 on: July 08, 2011, 11:32:58 am »
Thanks to a suggestion by runer, I'm now trying to dither the videos. It's actually a lot easier than you think. I'm using the Floyd-Steinberg style of dithering.

So the question is, what looks best?
ThresholdDithering
Relative
Absolute

For the absolute vs. relative, that's how I calculate my cutoffs for the different levels of gray. In relative, each frame I calculate the cutoffs so that there are roughly an equal number of all 4 colors, for absolute, I just set the cutoffs at 0x40, 0x80, and 0xC0.

I don't know which one I like best, the one in my original video is the relative threshold. The dithering ones don't look that good, but I know they'll look different on a real calculator.

(Tables are scary to make)
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: TruVid - 4 level grayscale video with sound
« Reply #14 on: July 08, 2011, 11:43:35 am »
I think I like the one with the relative threshold and dithering the best. I gives the best color balance (it isn't too dark) and the dithering makes the detail look a bit clearer.