Bit16 - Draw Engine and Media Player

Showcase your libraries, tools and other projects that help your fellow love users.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Bit16 - Draw Engine and Media Player

Post by grump »

MachineCode wrote: Sun Jan 28, 2018 7:17 am When I say "code space" I mean the image is compressed by compiling it into an arbitrary computer program.
That sounds amazing. How did you do that? I'm still super stoked to see that compiler. When will you release it? Do you have some example data, maybe a short video?
@Grump I am sure you are aware of this https://en.wikipedia.org/wiki/Jan_Sloot, since I get the impression you are the type of guy who knows everything.
I don't know everything. For starters, I don't know how to do something like this. But I know the definition of a "codec", and I know what a search space is, and I certainly do know when my bullshit sense is tingling.
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Bit16 - Draw Engine and Media Player

Post by zorg »

For me, "code space" sounds exactly like storing controller input instead of all parameters of the player character each frame; concessions happen so less information needs to be stored. (or, on a bigger scale, storing parameters that have been modified each frame for "reproducable replay", instead of recording a video replay)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
MachineCode
Citizen
Posts: 70
Joined: Fri Jun 20, 2014 1:33 pm

Re: Bit16 - Draw Engine and Media Player

Post by MachineCode »

"That sounds amazing. How did you do that? I'm still super stoked to see that compiler. When will you release it? Do you have some example data, maybe a short video?"
I have mostly coded the decoder at this stage - I told you that. It is pretty simple at less than 1k lines of lua. I also described a first pass algorithm to encode an image. Divide it in to blocks and set each block to the most common colour, then patch the remaining pixels with set pixel and jump relative. With a reduced colour space, that seems like it will work reasonably well and perform similar or better than png. That is not a very hard thing to program in lua. I have not written this yet, but probably will write it to test the draw engine.

This is not a general purpose codec like Netflix uses. It is a draw engine that uses simple commands to draw primitive images in a pixel map. Maybe it is a bit like WMF, but a lot simpler. There is no SVG, just a pixel map. It might be possible to write a compiler that takes a video sequence and encodes it into an instruction sequence. That would be pretty hard and probably require some mpeg like tricks with reusing previous frames. I don't care if I or anyone else makes that work - it is a possibility.

The goal for this draw engine is to be able to quickly draw images from a compressed data stream, control the operation frame by frame and be able to set the viewport frame by frame. In 1024x1024 you can load 96 small 128x85 images and then make a short repeating video by switching the viewport on a frame by frame basis. It is not meant to be Starwars in 4K video. In fact, if you look at the type of programs people like to make with love2d, most of the graphics is quite simple and stylized - it is not photorealistic. Pixel graphics with a reduced colour space often looks better. This draw engine is designed for simple pixel graphics.

Initially I have some simple applications for the draw engine. Static images, video noise and scrolling/panning images. For example, suppose you want to show a simulation of a security camera in a game. Just load the full 360 camera view into the pixelmap, then issue viewport commands to pan the image back and forth. That can easily be encoded into a string and interpreted. You could have hundreds of simple animations like this. You don't need a photo realistic netflix codec for this.

@grump In your efforts to make yourself angry, you seem to have imagined that I claimed to have written a compiler that can replace a codec. No. I was pointing out that draw engines work in a different way to modern codecs. They build an image algorithmically, as opposed to using signal processing techniques to compress colour space in 3D. Codecs also exploit the physiology of the human vision system to eliminate redundant data. Given a system that can draw graphics primitives, you could make a Turing machine that keeps going until the destination pixel map exactly matches the source pixel map. This is not practical, but it illustrates the difference between draw engines and codecs. One sets pixels, the other compresses colour space.

Here is an interesting thing about codecs. It is only in the last 20 years or so that dsp's and SIMD have made the number crunching possible to let us compress 4K video. Before that, draw engines were the way to go. Like X server. Or, OpenGL. The idea of making images or sounds by specifying commands or parameters is not new, but it is useful.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Bit16 - Draw Engine and Media Player

Post by grump »

MachineCode wrote: Sun Jan 28, 2018 2:58 pm @grump In your efforts to make yourself angry
That's almost as far from reality as the encoder for your "codec"/"drawing engine"/whatever. Good luck to you though and maybe stop being so damn defensive.
MachineCode
Citizen
Posts: 70
Joined: Fri Jun 20, 2014 1:33 pm

Re: Bit16 - Draw Engine and Media Player

Post by MachineCode »

Just out of interest, is there any reason you chose "grump" as your forum name?
Post Reply

Who is online

Users browsing this forum: No registered users and 52 guests