P2 HDMI splash screen then text mode
Brian_B
Posts: 842
Is anyone working on code that can display a BMP to HDMI and then change to display active data? I've included the HDMI demo BMP code and it doesn't leave much room for to much more code in memory after loading the BMP.
I see the BMP file is comment out as I was seeing how much memory it used.
Thanks for any information.
Comments
You're going to need to reduce the number of bits per pixel. It looks like the image could be edited to only 4 colors. (2 bpp) If you found a tool to generate a 4 bpp bmp file then it might be easy to modify the P2 code to run 4 bpp instead of 8 bpp. I tried GIMP and ImageMagick without success. I thought ImageMagick did it, but it just turned on RLE compression
Rayman has worked with color cell compression, which reduces the bits per pixel significantly but also allows the palette to change throughout the image. It's not that bad for photorealistic images. The code outputs to VGA, but I don't think there is any reason it couldn't be modified to work with HDMI. https://forums.parallax.com/discussion/175755/color-cell-image-cc4-display-code-and-encoding-tool
Another possibility is to dice the image up into little squares the same size as the font. Then add these as "special characters" in the bitmapped font. Hopefully there would be a significant number of redundant blocks.
There is the option, instead of compiling the picture into the binary, of loading it from SD card at runtime.
Or, use the new flash file system?
This is exactly what I do for the bootup screen for my light controllers. I need a pause for the network to settle before actually booting, so while the network is settling, I load a series of frames from the SD card that displays an animation. As I recall the file is much larger than Hub Ram.
Also as @Rayman suggests above, you can use the flash filesystem as well.
I guess there is no existing text mode driver for HDMI?
Think it'd be very easy to convert the ANSI VGA driver to HDMI and then you can do text.
This uses almost no memory as there is no image buffer. It's a tile driver.
Sure I've posted HDMI image code before.
But, that requires using a huge amount of HUB RAM to store the 8bpp image.
So, how to merge the two?
Guess I'd not reserve the HUB RAM for the image and just load it manually into what Prop Tool would think is stack space at top of memory via USD or Flash.
Then, when done with splash, kill that cog and fire up the ANSI HDMI driver.
Roger's driver can do text mode (and the rest of the kitchen sink).
If your splash image contains large areas of solid color, you could apply some kind of RLE compression and uncompress it in real-time during scanout by way of adding such code into the video driver.
@Wuerfel_21 so there’s an @rogloh code that does hdmi without psram?
yes, of course. using PSRAM is just an option.
@Rayman
Take a look at p2textdriver0.93b.zip in the first post here:
https://forums.parallax.com/discussion/170676/p2-dvi-vga-driver/p1
That shows either VGA or DVI/HDMI output with a simple text mode. You can also of course use graphics modes instead if you setup the video driver manually using initRegion() and initDisplay() etc.
Initially in the original version the driver could only use HUB RAM for a frame buffer, the external memory support only came later via the "mbox" parameter. Other demos you've probably seen use that capability.
Ok, does this solve the OPs problem then?
No, it just answers your question.
I think the OP wants to render over the top of a BMP file but has space issues for the rest of the code as HUBRAM is primarily consumed by the BMP data. For simpler graphics one could possibly pre-process the data to use a lesser bit depth like 4bpp and draw that instead. There's nothing to stop you updating over the frame buffer in my video driver but it will obviously corrupt it. If you wanted to you could maintain the original and redraw that each time (or at least the parts corrupted by any rendered text/gfx regions being written over it).
A while back I supplied @VonSzarvas with some graphics APIs that did that sort of thing which made it into his solar panel QuickByte demo for PSRAM and perhaps some of that stuff could be modified to use the HUB RAM instead of external memory, if there's enough space for it - there may not be if the images are too big to fit in HUB.
If alternatively the OP wants to just draw an image temporarily then go into text mode completely without the BMP being shown any more- that is also possible with my drivers. You just need to setup both regions and select between them as being the first (and only) region in the list using setDisplayRegions().
eg. something along the lines of this... somewhat incomplete/untested code but designed to give the idea
@Brian_B are u wanting to draw text on top of image?
Think @SaucySoliton is right and this is a case where 4bpp driver would be nice. I have one but it’s ancient, from fpga days.
8bpp might work but it’d probably take up nearly all of hub ram with not much room left for anything else…
No, I just want to display the logo and then go into text mode. Thank You everyone for the suggestions!