Source code for FrameConverter

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

jburkhardt

  • Posts: 3
  • Joined: Tue Dec 13, 2022 2:36 pm
  • Real Name: John Burkhardt

Source code for FrameConverter

PostThu Sep 14, 2023 9:10 pm

I have a performance critical application that requires BGR color and not BGRA. So now I have two conversion steps per frame, one using Frameconverter to go from YUV10bit to BGRA and then a second one to go to BGR. I would like to avoid this extra conversion so I'm wondering if we can get the source code for FrameConverter, or optionally get we ask for a new format conversion to 24 bit color instead of 32 bit (not sure there is ever even a case when there would be information in the alpha channel). It seems like because of the API design this would require a new enum for BMPPixelFormat for bmdFormat8BitBGR in addition to bmdFormat8BitBGRA ?

Thanks,
John
Offline

Mitra Mahmoodzadeh

  • Posts: 53
  • Joined: Wed Sep 02, 2015 2:45 pm

Re: Source code for FrameConverter

PostFri Sep 15, 2023 4:12 pm

Hello John,
Converting BGRA buffer to BGR is very simple, instead of the Frameconverter you can do that directly as follows:

Code: Select all
c++
void BGRAtoBGR(const unsigned char* bgra, unsigned char* bgr, int width, int height) {
    int straid= width * height * 3;
    memcpy(bgr, bgra, straid);
    bgr+= straid;
    bgra+= straid+ (width * height); // skip alpha channel
}


I think this method is fast enough.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 13 guests