Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GPUImage and performance with external accessory

What is the best way to render a series of frames coming from an external accessory using GPUImage? I am looking for the best performance I can get with a series of frames technically a series of UIImages but they are coming from an external accessory after processing. But the processing is not in GPUImage but I still need to get the best performance I can.

like image 805
Adam Freeman Avatar asked Jul 03 '26 12:07

Adam Freeman


1 Answers

Since it has been a while, I thought I would answer my own question. Basically I wound up using GPUImageRawDataInput. Here is the code chunk that worked for me ->

unsigned char *dataBuffer = ... // 640X480X4 bytes RGBA data

if (!initialized) {
    initialized = true;

    self.rawDataInput = [[GPUImageRawDataInput alloc] initWithBytes:dataBuffer
        size:CGSizeMake(640.0f, 480.0f) pixelFormat:GPUPixelFormatRGBA];

    [self.imageView setTransform:CGAffineTransformMakeRotation(-M_PI_2)];

    [self.rawDataInput addTarget:self.imageView];
}
else {
    [self.rawDataInput updateDataFromBytes:dataBuffer size:CGSizeMake(640.0f, 480.0f)];
}

[self.rawDataInput processData];
like image 92
Adam Freeman Avatar answered Jul 05 '26 16:07

Adam Freeman