Sign in to follow this  
pettab

Get output from a graphics card, modify argb value and then send it to another card

Recommended Posts

I have a problem to solve, I need to get the full output of a grapics card (A full screen application is running here) and modify the alpha level on a selected range of pixel colours in this and then send it to a videocard (Bluefish Deepblue Lt) This is for creation of a key-signal from the output of my graphics card that can be sent to the productions bus downstream keyer. I found this http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=214332&SiteID=1 Where he copy it pixel for pixel from the backbuffer, and before the copy I thought that I can input an IF and check if the current pixel value is one of them I want to change tha alpfa value on and if so edit the argb value and then pass it to the card. Are there any other ways of doing this? Is this going to be fast enough (>25 fps) ? The fullscreen application is a flashmovie that is showing information that will later be overlayed in the downnstream keyer over the tv-images. Maybe there are any way of directly get the argb information from the flash-movie and send it to the card?

Share this post


Link to post
Share on other sites
I'm almost doing excactly this. Same videocards and all
The way i solved it was to write a custom ActiveX control-container to host the flash activex-control and getting the control to render directly into a memoryDC.

If you want smooth animations you probably want to upload fields and not frames to the videocard and therefor you need 50 fps. This should not be a problem though, using this technique.

Btw, if your desktop resolution is 32bpp the flash-control will deliver an alpha-channel from your swf, although it won't contain gradients and stuff, just black or white. But on you it sounds as if that would be enough.

just remember to set the framebuffer pixelformat on the BF-card to MEM_FMT_ARGB_PC to account for windows way of storing rgba values.

Share this post


Link to post
Share on other sites
Quote:
Original post by Nirklas
I'm almost doing excactly this. Same videocards and all
The way i solved it was to write a custom ActiveX control-container to host the flash activex-control and getting the control to render directly into a memoryDC.

If you want smooth animations you probably want to upload fields and not frames to the videocard and therefor you need 50 fps. This should not be a problem though, using this technique.

Btw, if your desktop resolution is 32bpp the flash-control will deliver an alpha-channel from your swf, although it won't contain gradients and stuff, just black or white. But on you it sounds as if that would be enough.

just remember to set the framebuffer pixelformat on the BF-card to MEM_FMT_ARGB_PC to account for windows way of storing rgba values.


With the activex control you've written, can you use all functions in the flash activex like fscommands and so on? Interested in sharing this or is it a part of a commercial product?

And for the other solution, so if I have a background in my flash movie with transparancy set to 100% this is in the argb value that I send to bluefish card automatically? I want to control the level of transparancy, of what I understand from you, I can only set 100% or 0 % transparency in my flash movie?

Share this post


Link to post
Share on other sites
Quote:
Original post by pettab
With the activex control you've written, can you use all functions in the flash activex like fscommands and so on? Interested in sharing this or is it a part of a commercial product?

I wrote an activex-container, in which I am hosting the original flash-control. So yes, I just have to query the control for it's IShockwaveFlash interface and call whichever method I like.

I have to get back to you regarding sharing parts of this project after I've checked with my producer. I think it might be difficult though.

Quote:
And for the other solution, so if I have a background in my flash movie with transparancy set to 100% this is in the argb value that I send to bluefish card automatically? I want to control the level of transparancy, of what I understand from you, I can only set 100% or 0 % transparency in my flash movie?

Basically, yes. You get 0% transparancy where you have objects and full transparency where there is no object. But after you've rendered the scene to the offscreen DC you are free to do whatever you want with the framebuffer before you send it to the videocard.

-------------------------------
Niklas Andersson
Systemdeveloper
Swedish Television (SVT)

Share this post


Link to post
Share on other sites
So if using your first method, with an activex-container you get the full alpha values from the flash movie?

See that you work for SVT and suppose that you used it for creation of broadcast graphics. How was the quality with this method where the graphics are a playing flashmovie? Did you use any animations in it? Did they display well? And did you use other transparancylevels than 100%?

Share this post


Link to post
Share on other sites
Quote:
Original post by pettab
So if using your first method, with an activex-container you get the full alpha values from the flash movie?

You must have missunderstood me. I've only presented one method; to write a container to host the flash activex-control.
And with the current flash-control there seems to be no way to get it to deliver full alpha.

Quote:
Original post by pettab
See that you work for SVT and suppose that you used it for creation of broadcast graphics. How was the quality with this method where the graphics are a playing flashmovie? Did you use any animations in it? Did they display well? And did you use other transparancylevels than 100%?

Compared to file-based video the quality is superior, since there is no compression of the actual pixel-data involved. We have only used flash to generate frame-based animations as of yet, mainly because the animations we've displayed haven't been fast enough to require fields. That is something that we are going to implement in the near future though.
About transparency; because of the limited transparancy-data delivered from flash we've only used it as a mask and not to actually blend the graphics over the video.

-------------------------------
Niklas Andersson
Systemdeveloper
Swedish Television (SVT)

Share this post


Link to post
Share on other sites
In the first post I linked to a person using the same card and taking the backbuffer from one card and send it to bluefish, as of what I understand this is done pixel by pixel, therefore I thougt of putting in a if inside the loop and check the current colour value and if it is one of them I want to change transparancy on I just change the a value inte the ARGB struct.

Can this be done? Can the Alpa value be set from 0 to 255?
And will this slow down the process alot? Will I still get over 25 fps?

Share this post


Link to post
Share on other sites
I was dealing with the same problem some time ago.
Accessing the backbuffer directly is not so good idea, since it stalls GPU and your app. What you need to do, is to copy the backbuffer to some other part of graphic memory, which is more accessible from CPU - this can be done asynchronously - probably to a texture created with proper USAGE flags.

Accessing this texture should be fast as hell, and give you 50+ fps.

You could write processing the pixels inside the loop in assembly. Shouldn't be a problem.

Share this post


Link to post
Share on other sites
Quote:
Original post by pettab
The fullscreen application is a flashmovie that is showing information that will later be overlayed in the downnstream keyer over the tv-images. Maybe there are any way of directly get the argb information from the flash-movie and send it to the card?


Quote:
Original post by pettab
In the first post I linked to a person using the same card and taking the backbuffer from one card and send it to bluefish, as of what I understand this is done pixel by pixel, therefore I thougt of putting in a if inside the loop and check the current colour value and if it is one of them I want to change transparancy on I just change the a value inte the ARGB struct.

In your original post it sounds as if the content you want to capture is generated by another application? The person you are refering to had control of the output since it was his own application that was generating it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this