What are the valid color_key values for use in the mxcfb_color_key struct?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What are the valid color_key values for use in the mxcfb_color_key struct?

1,475 Views
egremillion
Contributor III

I'm playing video as a background to /dev/fb2 and filling /dev/fb3 with overlay as a foreground.  With local alpha enabled and my alpha buffer set to 0xFF, when I enable the color-key and set the color_key value to something like 0x000000 or 0xFF0000) it works exactly as I'd expect (that color becomes transparent and I see the background in that part of my screen).  However, if I set the color_key value to something like 0x646496 it doesn't work (no transparency).

Are there limits to the values that can be used for the color_key?  What color representation should I be using (it appears to be RGB 8/16, 8/8, 8/0 based on my experiments with values like 0x0000FF)?  Any pointers or suggestions would be greatly appreciated!

Additional details: Doing this on a Nitrogen board, Yocto Dora.

Thanks in advance,

Ernie

Labels (3)
0 Kudos
4 Replies

960 Views
gusarambula
NXP TechSupport
NXP TechSupport

It is my understanding that the color_key uses only 18 bits per pixel so you would need to add three zeroes on the MSB of each byte (and use six bits for the color) and it would be RGB as you mentioned only with each color byte starting with three zeroes.

Would you please give it a try and let us know if it’s behaving as expected?

0 Kudos

960 Views
egremillion
Contributor III

Hi, thanks for your answer.  Unfortunately, it still doesn't seem to be working for me.

To start, I'm not sure I understood your reply.  You said the color key uses 18 bits per pixel but then you said to add three zeroes on the MSB and use six bits for the color.  Isn't that 9 bits (more than a byte)?  Also, though it may be correct, I'm not sure why one would use the least significant bits for color instead of the most significant bits...?

If you could clear that up it would help.  In the meantime, here is the test I performed:

I created an image (attached) with bands of color - Red, Green, Blue, Black, White, and I added two purple shades (0x1F001F in case the first three bits should be zero, and 0xF800F8 in case the last three bits should be zero).  I then played that image to the overlay framebuffer using the following GStreamer pipeline:

  gst-launch filesrc location=./ColorTest_EG.new2.png ! pngdec ! freeze ! ffmpegcolorspace ! mfw_v4lsink device=/dev/video19

Then I ran my test program to set the color key.  Here are the results:

color-key=0xFF0000 --> red becomes transparent

color-key=0x00FF00 --> green becomes transparent

color-key=0x0000FF --> blue becomes transparent

color-key=0x000000 --> black becomes transparent

color-key=0xFFFFFF --> white becomes transparent

color-key=0x1F001F --> nothing happens

color-key=0xF800F8 --> nothing happens

Can you help me figure out what I may be doing wrong, or how to make these colors (or other similar colors) transparent as the color key?

Thanks!

Ernie

0 Kudos

960 Views
gusarambula
NXP TechSupport
NXP TechSupport

I apologize for the confusion. I meant two zeroes and six color value bit. However, it seems that RGB 888 might be the actual format.

Would you please share the code in which you are initializing this task? Maybe that can help us figure out how the format is being interpreted since seems odd that you’re having success applying alpha blending in colors that use either full zeroes or full ones but not combinations like purple.

In case you are not seeing this issue anymore please do share your findings as it would also help other community users. If the problem continues I’m hoping we can figure it out together.

0 Kudos

959 Views
egremillion
Contributor III

No worries!  I'm attaching some C code I used to test this.  Please note that I commented out my tests for RGB888 and added in something I had hoped would work for RGB565 (but it didn't work consistently).  I think this will compile on a basic system that has GStreamer 0.10, GLib, etc.

Let me know what you find out - any help determining how to do this properly will be greatly appreciated!

Ernie

0 Kudos