“执行昂贵的卸载操作!” - 它是什么,以及如何解决它? [英] "Performing a costly unpadding operation!" -- what is it, and how to fix it?

查看:117
本文介绍了“执行昂贵的卸载操作!” - 它是什么,以及如何解决它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Core Filters测试应用程序的调试控制台显示以下消息:

The debug console for my Core Filters test application is showing this message:


CGImageRef 0x7a0e890具有行字节填充。执行昂贵的卸载操作!

CGImageRef 0x7a0e890 has row byte padding. Performing a costly unpadding operation!

我无法在标题中找到该确切消息(减去指针信息)的命中或在Google搜索中。

I couldn't find a hit for that exact message (minus the pointer info) in the headers or in a Google search.

我的问题是(1)这意味着什么,以及(2)我该如何纠正这种情况?

My questions are (1)what does that mean and (2)how can I rectify the situation?

以下是我如何使用CIFilter生成过滤后的UIImage的示例。

The following is an example of how I am generating a filtered UIImage using a CIFilter.

- (UIImage*)sepia
{    
    CIImage *beginImage = [CIImage imageWithCGImage:[self CGImage]];
    CIContext *context = [CIContext contextWithOptions:nil];

    CIFilter *filter = [CIFilter filterWithName:@"CISepiaTone" 
                                  keysAndValues: kCIInputImageKey, beginImage, 
                        @"inputIntensity", [NSNumber numberWithFloat:0.8], nil];
    CIImage *outputImage = [filter outputImage];

    CGImageRef cgimg = 
    [context createCGImage:outputImage fromRect:[outputImage extent]];
    UIImage *newImg = [UIImage imageWithCGImage:cgimg];

    self = newImg;

    CGImageRelease(cgimg);
    return self;
}


推荐答案

字节填充是额外增加的字节数到每个图像行的末尾,以确保每行在内存中的2 ^ n字节上开始。这会以图像大小为代价增加内存访问性能。如果你比较CGImageGetBytesPerRow的结果和从图像尺寸和每像素字节数计算的每行预期字节数,你可以检查这个。

Byte padding is extra bytes added to the end of each image row to ensure that each row starts on a 2^n byte multiple in memory. This increases memory access performance at the expense of image size. You can check this if you compare the result of CGImageGetBytesPerRow and the expected bytes per row calculated from the image dimensions and bytes per pixel.

关于如何纠正unpadding - 你需要确切地找到哪个操作触发了unpadding并从中取出。 Unpadding是昂贵的,因为基本上整个图像内存需要被移动以消除所有行尾间隙。

As to how to rectify the unpadding - you need to find exactly which operation is triggering the unpadding and take it from there. Unpadding is expensive because basically the whole image memory needs to be shuffled up to remove all the end-of-row gaps.

这篇关于“执行昂贵的卸载操作!” - 它是什么,以及如何解决它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆