BRAW SDK: IBlackmagicRawPipelineIterator

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

fnordware

  • Posts: 7
  • Joined: Wed Sep 02, 2020 5:22 pm
  • Real Name: Brendan Bolles

BRAW SDK: IBlackmagicRawPipelineIterator

PostThu Sep 10, 2020 5:35 pm

It seems like in the ProcessClipMetal.mm example I should be able to replace the Metal setup stuff (everything between factory->CreateCodec() and codec->OpenClip()) with something like this:

Code: Select all
      bool pipelineSet = false;
      
      IBlackmagicRawPipelineIterator *pipelineIterator = nullptr;
      result = factory->CreatePipelineIterator(blackmagicRawInteropOpenGL, &pipelineIterator);

      do
      {
         BlackmagicRawInterop pipeline_interop = blackmagicRawInteropNone;
         BlackmagicRawPipeline pipeline_pipeline = blackmagicRawPipelineCPU;
         
         result = pipelineIterator->GetInterop(&pipeline_interop);
         result = pipelineIterator->GetPipeline(&pipeline_pipeline);
         
         IBlackmagicRawPipelineDeviceIterator *deviceIterator = nullptr;
         result = factory->CreatePipelineDeviceIterator(pipeline_pipeline, pipeline_interop, &deviceIterator);
         
         do
         {
            BlackmagicRawInterop device_interop = blackmagicRawInteropNone;
            BlackmagicRawPipeline device_pipeline = blackmagicRawPipelineCPU;
            
            result = deviceIterator->GetInterop(&device_interop);
            result = deviceIterator->GetPipeline(&device_pipeline);
            
            if(device_pipeline == blackmagicRawPipelineMetal)
            {
               IBlackmagicRawPipelineDevice *device = nullptr;
               result = deviceIterator->CreateDevice(&device);
            
               IBlackmagicRawConfiguration *config = nullptr;
               result = codec->QueryInterface(IID_IBlackmagicRawConfiguration, (void **)&config);
            
               result = config->SetFromDevice(device);

               pipelineSet = true;
            }
            
         }while(deviceIterator->Next() == S_OK && !pipelineSet);
         
      }while(pipelineIterator->Next() == S_OK && !pipelineSet);



But when I do this, all the frames that come out are black. What am I missing?
Offline

CaptainHook

Blackmagic Design

  • Posts: 1735
  • Joined: Wed Aug 22, 2012 4:50 am
  • Location: Melbourne, Australia
  • Real Name: Hook

Re: BRAW SDK: IBlackmagicRawPipelineIterator

PostTue Sep 15, 2020 4:52 am

Hi,

Here's a modified version of ProcessClipMetal.mm that processes the image with a Metal device using iterators and saves the resultant buffer to a png file. It demonstrates how to get Metal buffers from the GPU to CPU and how to create and use a device (in a blocking manner).

We will likely update our sample code in the future to this or something similar, thanks!
Attachments
ProcessClipMetal.mm.zip
(4.15 KiB) Downloaded 7 times
**Any post by me prior to Aug 2014 was before i started working for Blackmagic**
Offline

fnordware

  • Posts: 7
  • Joined: Wed Sep 02, 2020 5:22 pm
  • Real Name: Brendan Bolles

Re: BRAW SDK: IBlackmagicRawPipelineIterator

PostThu Sep 17, 2020 1:45 am

Great, thanks! And here's a version that uses IBlackmagicRawResourceManager, so you don't even need those Metal calls. Note the file has been changed from a .mm to .cpp.
Attachments
ProcessClipMetal.cpp.zip
(3.92 KiB) Downloaded 21 times
Offline

fnordware

  • Posts: 7
  • Joined: Wed Sep 02, 2020 5:22 pm
  • Real Name: Brendan Bolles

Re: BRAW SDK: IBlackmagicRawPipelineIterator

PostThu Sep 17, 2020 5:31 am

fnordware wrote:Great, thanks! And here's a version that uses IBlackmagicRawResourceManager, so you don't even need those Metal calls. Note the file has been changed from a .mm to .cpp.


BTW, it feels like I should be able to swap in OpenCL enums for Metal ones and have a working OpenCL example, but it's not working for me. Ditto for CUDA. Any idea?
Offline

Hendrik Proosa

  • Posts: 1136
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: BRAW SDK: IBlackmagicRawPipelineIterator

PostSat Sep 19, 2020 7:59 pm

I can’t add anything to this thread but just wanted to thank you both, while reading your code examples, I think I just realized how to actually use the gpu decode and it provided a handle to also get the idea of opengl interop :)
I do stuff.
Offline

fnordware

  • Posts: 7
  • Joined: Wed Sep 02, 2020 5:22 pm
  • Real Name: Brendan Bolles

Re: BRAW SDK: IBlackmagicRawPipelineIterator

PostWed Sep 23, 2020 10:02 pm

Just wanted to ping this thread again. Seems like the attached example should work to use an OpenCL pipeline, but it doesn't. On one machine it stalls, on another I get a black frame. Both machines (they are Macs, BTW) don't show OpenCL as an available pipeline under blackmagicRawInteropOpenGL, but do have it under blackmagicRawInteropNone. The Metal pipeline works on both.
Attachments
ProcessClipOpenCL.cpp.zip
(4.07 KiB) Downloaded 3 times

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 3 guests