Chnaged de allocation method in data provider release callback

This commit is contained in:
Prianka Liz Kariat 2023-09-28 21:43:18 +05:30
parent 8ea805b6f0
commit 120f82508c

View File

@ -32,10 +32,13 @@ using ::mediapipe::ImageFrame;
vImage_Buffer allocatedVImageBuffer(vImagePixelCount width, vImagePixelCount height,
size_t rowBytes) {
UInt8 *data = new UInt8[height * rowBytes];
return {.data = data, .width = width, .height = height, .rowBytes = rowBytes};
}
static void FreeDataProviderReleaseCallback(void *info, const void *data, size_t size) {
delete[] info;
}
} // namespace
@interface MPPPixelDataUtils : NSObject
@ -170,12 +173,6 @@ vImage_Buffer allocatedVImageBuffer(vImagePixelCount width, vImagePixelCount hei
@implementation MPPCGImageUtils
namespace {
static void FreeDataProviderReleaseCallback(void *info, const void *data, size_t size) {
free(info);
}
} // namespace
+ (std::unique_ptr<ImageFrame>)imageFrameFromCGImage:(CGImageRef)cgImage error:(NSError **)error {
size_t width = CGImageGetWidth(cgImage);
size_t height = CGImageGetHeight(cgImage);