I have a binary file. It lies a few pictures in a special format. All images are the same size of 6912 bytes. I need to make 50 fps animation of these images. For this I need 50 times per second sequentially read frame by frame (at 6912 bytes). decode and display on a screen.
Please tell me how to do it?
I must say, the files can be large so read them all at once in the memory is not rational.
I can of course. But to what? In txt? Then the files become more. Now about 500 files takes 6-8 gigabytes. These files I use in my 8 bit program for VJ. I wrote it myself to PureBasic. But as the training I want to rewrite it to touchdesigner.
So is your app making the image files or just reading them? Have you tried using JPGs or making movie files out of the sequences?
I’ve never read bytes straight out of a binary file, so I can’t offer any advice, it could be possible using an external Python library or possibly using the C++ TOP to make an operator that could read your bytes.
You may be better off writing a standalone conversion tool that outputs a standardized video format. I don’t think you’d gain much by hosting that conversion within touchdesigner.
Thank you. Yes I too have come to the conclusion that it is necessary to do DLL. Jpg very slow and kills pixels. My format is very fast and the main feature of the program in binary ways of blending layers. On this there can only raw format.
Looks like I need to write a lot of different CHOP’s.
Read File:
Done DLL.
At the entrance to get the frame number, and file name.
At the exit to issue image will be displayed in the window of CHOP (only for preview) and 6912 bytes in a table conversion.
MixImages
At the entrance receives the address of the two frames on the tables 6912 bytes and the method of mixing.
This CHOP to do in the TD, that it were possible to create their generative footage and mixing control, as well as be able to quickly add new methods of mixing and effects on these 6912 bytes without the horrible Studio C ++.
Do you think at the same TD enough performance to handle 50 fps with standard CHOP 6-10 tables, each with 6912 bytes? There’s no any complicated calculations. Here is a sample code:
[code] For pos = 0 To 6143 Step 4
Select Layers (a) \ mix_pixel
Case #mix_put: PokeL (* mem + pos, PeekL (Layers (a) \ scr_buffer + pos))
Case #mix_or: PokeL (* mem + pos, PeekL (* mem + pos) | PeekL (Layers (a) \ scr_buffer + pos))
Case #mix_xor: PokeL (* mem + pos, PeekL (* mem + pos)! PeekL (Layers (a) \ scr_buffer + pos))
Case #mix_and: PokeL (* mem + pos, PeekL (* mem + pos) & PeekL (Layers (a) \ scr_buffer + pos))
EndSelect
Next [/code]
RenderChop
At the entrance of the receives an address table 6912 bytes and renderet them into conventional image 256x192 pixels. This is best done in a TD or make a DLL - how to think?
Getting the picture will be enlarged to the width of the screen and output to the projector.
Code for render 6912 to img 256x192x4bit pallete
[code]For y = 0 To 191
pixelLine = 32 * ((y & $C0) | ((y << 3) & $38) | ((y >> 3) & $07))
attr = 6144 + ((y & $F8) << 2)
For x = 0 To 31
chr_attr = PeekC(*mem + attr + x )
chr_pixels = PeekC(*mem + pixelLine + x )
Paper = (chr_attr >> 3) & $0F ;
ink = (chr_attr & 7) | ((chr_attr & 64) >> 3)
bit = 128
For z = 0 To 7
If chr_pixels & bit
Plot( x<<3 + z, y, color( ink ))
Else
Plot( x<<3 + z, y, color( Paper ))
EndIf
bit >> 1
Next z
Next x
Next y[/code]
If you make a tool to convert your files, you won’t have to do anything unusual inside TD. You’ll just be able to use MovieIn TOPs to load the videos, and then do whatever you want from there. Writing C++ OPs is not necessary here at all. If you prefer to do the whole thing in C++, there isn’t really much purpose to using TD for it.