Join us on Discord!
You can help CodeWalrus stay online by donating here.
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Jarren Long

#1
If you don't want to split up your image, you might be able to get away with using some simple compression on the bitmap, like Run-Length Encoding (RLE). If your image has scanlines that have the same color repeated over multiple pixels, RLE could reduce your image size quite a bit, which would allow you to load the whole thing in memory. Example being that, if the first scanline of the top of your bitmap is all the same color (we'll say black, 0x00 for this example), you could RLE that entire line, and store it in 8 bytes instead of 1024 (4 bytes of actual color, and 4 bytes for the number of times to repeat that color). That would look like FF00FF00FF00FF00 (read it as "256 pixels of color 0x00, repeated 4 times), instead of 1024 00's. At that point, you would just need to update your code to parse the RLE pixels and reinflate the bitmap on the fly while you render it. Though, you're just sacrificing clock cycles to spare memory by doing that.

Extra credit: instead of encoding the image beforehand, write code that will RLE the bitmap as you read it in.

That would solve the image size issue at least, so long as RLE would be appropriate for your image. If you're trying to display something like a big color gradient, your S.O.L., RLE would actually make the image larger in size.

For drawing more than one pixel at a time with the library you have, you'll need to dig into the API to see how it accesses the video buffer to write out to the graphics area of memory, and then reproduce it yourself. The hardware specs for your device will probably have a breakdown of the memory locations somewhere. And assembly will probably be required. If you're willing to dig in that deep, you can probably just read the bitmap directly into the graphics memory area, and skip the arrays all together.

Now the big question: why on earth would you want to play with a 286?!?
#2
PC, Mac & Vintage Computers / Re: ASCII Video Generator
October 18, 2017, 08:30:39 PM
Now that the contest is over, I've released the source code for this atrocity, see https://github.com/JarrenLong/bmp2ascii, in case anyone is interested in this big ball of wibbly-wobbly, timey-wimey trainwreck, have at it! Hoping @Juju will be letting his out into the wild sometime soon too, I'm definitely curious to see that magical goodness in action :)
#3
Contests / Re: Unofficial Codewalrus Contest 2
October 16, 2017, 12:14:24 AM
*Sent
#4
Latest Updates (not many):

* Bunch of memory optimizations, now doing some of the processing in parallel, so I got a nice speed boost (ballpark of 7-8x faster) and memory reduction (about 70% less memory) in the image conversion process. Video conversion now only takes about a minute for every second of video to process at higher quality settings with coloring enabled. Only a minute :/
* Fonts are now XML-file configurable; characters used for output can be added/removed at will, and the font bitmap can be changed too. I have three fonts right now, all based on the same bitmaps
- Full set: 69 possible output characters (all printable characters from ASCII 1-128) - Slowest, best results
- Only Symbols: Full set, minus all letters/numbers - Middle ground for speed vs. accuracy
- Two character Set: It's either a # or a space - Fastest, edge resolution leaves a bit to be desired
* Added a command line program that can be used to call the API. Takes an input image, some flags, and spits out the result to a destination file
* Now have a "rescale" option, lets the output image be scaled back to the same size as the input image to fix some of the distortion problems (Console app only right now, need to add a checkbox to the WinForms test app to toggle it)
* With exception to the code snippets that handle the FFMPEG/AVI formats, everything is written in pure C#, should be easy to port to other .NET platforms now

B&W Video Test: https://www.booksnbytes.net/test-out-noColor.mp4
Color Video Test: https://www.booksnbytes.net/test-out-q80-e30-c8.mp4
#5
Contests / Re: Unofficial Codewalrus Contest 2 [ucc2]
September 26, 2017, 02:55:23 PM
A few on my end, I'll get an update posted tonight after work (give me 12-13 hours).
#6
More or less. Here's the font I threw together for testing, minus the char->bitmap definitions. Wouldn't be too hard to +/- characters, or change colors once I can bust the charmaps out of the code and dump them into a config file.
#7
No Color Version, same quality setting: https://www.booksnbytes.net/AsciiVidTest-NoColor-q60.mp4

Right now, I have the visible character set defined to cover the printable characters for the basic ASCII set (Hex 0x00-0x7F), so 69 printable characters, but that could definitely be slimmed down to just a handful of characters, which would speed up the number crunching quite a bit.

I did build my ASCII font kinda goofy, which is causing some scaling issues with the converted frames. Somehow I ended up with 10x16 pixel characters, which gives the whole shebang a weird aspect ratio. Definitely gonna need to fix that.

**EDIT**
Also, I do need to figure out something for filling in cells that don't have any edges detected, looks kinda lame just putting a space in there.
#8
First video conversion test complete! (1 second clip, AVI was converted to MP4 for size). Used a 1Mb clip from the movie "Big Buck Bunny" (http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4) as an input with 8-bit color downcoding and a quality setting of 60. Did it take forever to convert? Yep. Ugly. YEP. Did it work? Yep.

Video is too large to attach, stuffed it on my website. You can watch/download it at https://www.booksnbytes.net/AsciiVidTest-8bit-q60.mp4
#9
Update: Got my coloring working! Now spitting out crud in one of 5 different color modes:
- No Color: Does no color sampling, just uses the default colors from the input bitmap font
- Original: Uses colors sampled directly from the source image
- 8-bit: Samples colors from the original image, then converts to 8-bit palette
- 15-bit: Samples colors from the original image, then converts to 15-bit palette
- 16-bit: Samples colors from the original image, then converts to 15-bit palette

It's rough, and slow, but I think I'm on to something.
#10
PC, Mac & Vintage Computers / Re: Bad AppleĀ 
September 15, 2017, 03:05:21 PM
Wowee, yeah it is! I didn't know Javascript had that kind of power behind it.
#11
Quick snapshot at where I'm leaving off at for today attached (almost time to go see Gabriel Iglasias!!!) Long story short, I was bored at work today, so I've gone from 0 to I can read in a bitmap, crunch the heck out of it, and spit out a B&W ASCII image AND text representation of it. Next steps for me are to do some color sampling on the original image, so I can set the foreground/background colors on the ASCII image, then convert those colors to 8-bit goodness. After that, it's just a matter of looping through the frames of an AVI to grab each one out as a bitmap, passing them through my library, and then stitching them back together on the other side.

And optimizing. Lots of optimizing. So much optimizing to do.  :banghead: :banghead: :banghead:
#12
Windows, as a C#.NET library+app. Maybe Linux/Mac too if I start feeling froggy. MAYBE even Android/iOS, but that's probably pushing it.
#13
PC, Mac & Vintage Computers / Re: ASCII Video Generator
September 14, 2017, 08:29:39 PM
Heh, I'm not gonna get that crazy :P I'm thinking an AVI->ASCII video encoder. Well, I'm not thinking it, I'm already half way done with a crude proof-of-concept.
#14
Contests / Re: Unofficial Codewalrus Contest 2
September 14, 2017, 08:28:25 PM
Do it JuJu! If we both end up with something cool, we could always smash them together to make something even neater..
#15
PC, Mac & Vintage Computers / ASCII Video Generator [UCC2]
September 14, 2017, 05:36:11 PM
Just a placeholder for my [UCC2] project, ASCII video generator! Well maybe, seems like a hell of an undertaking...we'll see if this ends up working.
Powered by EzPortal