Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Blackmagic Design › BlackMagic Decklink and SDK questions

  • BlackMagic Decklink and SDK questions

    Posted by Pete Black on July 22, 2011 at 10:48 pm

    Hi, I’m currently using a Blackmagic Decklink card to do capture from HD-SDI, for display in a realtime presentation system. on OS X.

    I have working code integrated into a Cocoa app that initialises the device, grabs frames, and does YUV to RGB conversion in GLSL with good performance so I understand the basics pretty well, however I have a few questions:

    I am currently not using the ScreenPreview callbacks – i need to texture map my video frames onto geometry set up in an existing 3d engine, so i fetch captured buffers directly from the main input callback and use GLSL to convert the YUV422 into RGB. Presumably the ScreenPreview PaintGL stuff results in an RGB texture on the GPU, but does it involve software YUV-> RGB conversion?

    I am a little unclear on the behaviour of the API with interlaced inputs (e.g. 1080i50) – when I get a frame callback, am I receiving a full size buffer with alternate lines blanked out, or is the blackmagic hardware performing deinterlace for me? The frame width/height in the arrivedFrame indicates a full frame size.

    Is it possible to have the Decklink hardware perform hardware YUV to RGB conversion? Any software YUV to RGB is a major bottleneck for my app, as i need to decode and display several streams (live input and from movies on disk via ffmpeg) in realtime. Doing this on the GPU gives me good performance however.

    Is it possible to have the Decklink hardware supply planar YUV data instead of interleaved? e.g. an arrivedFrame would contain a Y buffer, a U buffer and a V buffer?

    Thanks

    -Pete

    Ben Snooks replied 13 years, 10 months ago 2 Members · 1 Reply
  • 1 Reply
  • Ben Snooks

    November 27, 2012 at 1:28 am

    Hi,

    Did you find a solution to your problem? I am experiencing a similar problem. I have developed a program that draws video to an opengl texture based on teh example code provided by BlackMagic Design. I have a problem of receiving interlaced video when using the example glsl shader. I have tried to modify the shader to do deinterlacing but have run into problem iterating through the lines of the texture.

    Below is an example of what I am trying to get to wok combined with the YUVtoRGB shader:

    void main()
    {
    /* Get default texel read position (s,t): s is column, t is row of image. */
    vec2 readpos = gl_TexCoord[0].st;
    if (bool(mod(floor(readpos.t + UseOddField), 2.0))) {
    /* This row is to be replaced by the average of its neighbour rows: */
    gl_FragColor = 0.5*(texture2DRect(Image1, readpos – vec2(0.0, 1.0)) + texture2DRect(Image1, readpos + vec2(0.0, 1.0)));
    }
    else {
    /* This row is to be used: */
    gl_FragColor = texture2DRect(Image1, readpos);
    }
    }

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy