Re: Accelerate Framework?
On Sat, 15 Jun 2013 13:33:20 -0700, Rick Mann said: >Where to go for questions about the Accelerate Framework? <https://lists.apple.com/mailman/listinfo/perfoptimization-dev> Sean ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Accelerate Framework?
Hi Rick, > Where to go for questions about the Accelerate Framework? I have a fairly good knowledge of the Accelerate framework and its opensource counterpart, Atlas. If I might be of any help, don’t hesitate. Vincent ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Accelerate Framework?
Where to go for questions about the Accelerate Framework? -- Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Accelerate framework
Grr .. again with the moderation for size .. can you not use rich text or something, it just makes a 6k message into a 50k one and this list has a really small max message size. Sending the mail yet again .. original mail follows with the rich text turned into plain -- I said CGImageCreate, I think that's what you want, you certainly don't have a PNG, you have a bitmap of data, a raw buffer. I think you probably have the right data provider, that or use CGCreateDataProviderDirect() which looks the same for raw data but works directly with the buffer, but just plain CGImageCreate() looks like the function which takes raw bytes in an expressed format and makes the image. Definitely the PNGDataProvider is wrong, you don't have one of those. > > On May12, 2012, at 9:27 PM, Luca Ciciriello wrote: > > Now I've used the code: where > > CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, outData, > (768 * 768 * 4), NULL); > CGImageRef test = CGImageCreateWithPNGDataProvider(provider, nil, true, > kCGRenderingIntentDefault); > > where outData is the output of my EmbossEffect function. > > Here "provider" is valorized, but "test" is 0x0. > My suspect is that vImageConvolve_ARGB is working with bitmap and a > CGImageCreateWithPNGDataProvider is working with PNG, but I haven't found an > equivalent function for Bitmap. > > Luca. > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Accelerate framework
.. got moderated for size .. so I'll send again .. I think perhaps the formatted code in your mail was on the ragged edge for the list ... Scott feel free to axe the original version of this message if you see it when doing the moderation queue ... original message --` I'm guessing from my quick read of a few pages of the documentation whilst watching formula1 but I don't think you can do that. You went through a CGImageRef, I would expect you have to go back through it. I don't think UIImage will take what looks like a pretty raw buffer, it's only for a limited set of formats. I, were I trying this, would be looking at CGImageCreate with a CGDataProviderRef which just rips right out of your data buffer and then make a UIImage with that. This is me guessing but it's what I'd try if I were doing this. I don't know if there is a better way to get the initial bytes by the way, there may be, slow drawing into a bitmap context but quite possibly right. Will be interested to see other replies here. > Me to, first time I use the accelerate framework and I haven't found any > sample code in order to help me in my first step. > > Here the code I use: > > CGImageRef inImage = [[UIImage imageNamed:@"estate3.jpg"] CGImage]; > CGContextRef cgctx = CreateARGBBitmapContext(inImage); > > // Get image width, height. We'll use the entire image. > size_t w = CGImageGetWidth(inImage); > size_t h = CGImageGetHeight(inImage); > CGRect rect = {{0,0},{w,h}}; > > // Draw the image to the bitmap context. Once we draw, the memory > // allocated for the context for rendering will then contain the > // raw image data in the specified color space. > CGContextDrawImage(cgctx, rect, inImage); > > void *inData = CGBitmapContextGetData (cgctx); > void *outData = malloc(768 * 768 * 4); > unsigned int inRowBytes= 768 * 4; > unsigned int outRowBytes = 768 * 4; > unsigned int height= 768; > unsigned int width = 768; > unsigned int kernel_height = 3; > unsigned int kernel_width = 3; > int divisor = 2; > vImage_Flags flags = kvImageLeaveAlphaUnchanged; > > > int res = EmbossEffect(inData, inRowBytes, outData, outRowBytes, height, > width, kernel_height, kernel_width, divisor, flags); > if(res != kvImageNoError) > { > NSLog(@"Manipulation Error"); > } > >No exit error here. Then … Here > > NSData *imgData = [[NSData alloc] initWithBytes:outData length:(768 * > 768 * 4)]; > >UIImage *retrivedImage = [UIImage imageWithData:imgData]; /// 1) >[imageView setImage:retrivedImage]; > >Here in 1) the "retrievedImage" is 0x0. > > The function EmbosEffect is: > > int EmbossEffect(void *inData, > unsigned int inRowBytes, > void *outData, > unsigned int outRowBytes, > unsigned int height, > unsigned int width, > unsigned int kernel_height, > unsigned int kernel_width, > int divisor, > vImage_Flags flags) > { > > int16_t kernel[] = {-2, -2, 0, -2, 6, 0, 0, 0, 0}; > vImage_Buffer src = { inData, height, width, inRowBytes }; > vImage_Buffer dest = { outData, height, width, outRowBytes }; > unsigned char bgColor[4] = { 0, 0, 0, 0 }; > vImage_Error err = 0; > > err = vImageConvolve_ARGB(&src, //const > vImage_Buffer *src > &dest, //const > vImage_Buffer *dest, > NULL, > 0, > //unsigned int srcOffsetToROI_X, > 0, > //unsigned int srcOffsetToROI_Y, > kernel,//const > signed int *kernel, > kernel_height, > //unsigned int > kernel_width, > //unsigned int > divisor, //int > bgColor, > flags | kvImageBackgroundColorFill > //vImage_Flags flags > ); > > return err; > } > > Luca. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Accelerate framework
Never used the framework but my first thought would be to create a CGImageRef which can take directly formatted data (I'm assuming that vImages are just a byte buffer) and then make a UIImage from there. What did you do to get a vImage from your UIImage in the first place? On May 12, 2012, at 8:26 PM, Luca Ciciriello wrote: > Now my problem is: > How can I rebuild an UIImage from the output of the vImageConvolve_ARGB > elaboration? > I can't find any code sample on this. > > L. > On May 12, 2012, at 11:16 AM, Luca Ciciriello wrote: > >> Yes You are right. It was a my stupid syntax error. >> >> L. >> >> On May 12, 2012, at 10:34 AM, Ken Thomases wrote: >> >>> On May 12, 2012, at 3:25 AM, Luca Ciciriello wrote: >>> >>>> Using the accelerate framework in iOS 5.1 I've imported the header >>>> Accelerate/Accelerate.h and in my code I'm using the line: >>>> >>>> uint_8 kernel = {-2, -2, 0, -2, 6, 0, 0, 0, 0}; >>>> >>>> My problem is that I've got the error: >>>> >>>> "Use of undeclared identifier uint_8". >>>> >>>> Which is the header I've to use for uint_8? >>> >>> Do you perhaps mean uint8_t? Certainly, the Accelerate framework won't >>> require you to use any type which it hasn't included the definition for. >>> >>> Regards, >>> Ken >>> >>> >> >> >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> https://lists.apple.com/mailman/options/cocoa-dev/luca_ciciriello%40hotmail.com >> >> This email sent to luca_cicirie...@hotmail.com >> > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org > > This email sent to r...@rols.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Accelerate framework
Now my problem is: How can I rebuild an UIImage from the output of the vImageConvolve_ARGB elaboration? I can't find any code sample on this. L. On May 12, 2012, at 11:16 AM, Luca Ciciriello wrote: > Yes You are right. It was a my stupid syntax error. > > L. > > On May 12, 2012, at 10:34 AM, Ken Thomases wrote: > >> On May 12, 2012, at 3:25 AM, Luca Ciciriello wrote: >> >>> Using the accelerate framework in iOS 5.1 I've imported the header >>> Accelerate/Accelerate.h and in my code I'm using the line: >>> >>> uint_8 kernel = {-2, -2, 0, -2, 6, 0, 0, 0, 0}; >>> >>> My problem is that I've got the error: >>> >>> "Use of undeclared identifier uint_8". >>> >>> Which is the header I've to use for uint_8? >> >> Do you perhaps mean uint8_t? Certainly, the Accelerate framework won't >> require you to use any type which it hasn't included the definition for. >> >> Regards, >> Ken >> >> > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/luca_ciciriello%40hotmail.com > > This email sent to luca_cicirie...@hotmail.com > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Accelerate framework
Yes You are right. It was a my stupid syntax error. L. On May 12, 2012, at 10:34 AM, Ken Thomases wrote: > On May 12, 2012, at 3:25 AM, Luca Ciciriello wrote: > >> Using the accelerate framework in iOS 5.1 I've imported the header >> Accelerate/Accelerate.h and in my code I'm using the line: >> >> uint_8 kernel = {-2, -2, 0, -2, 6, 0, 0, 0, 0}; >> >> My problem is that I've got the error: >> >> "Use of undeclared identifier uint_8". >> >> Which is the header I've to use for uint_8? > > Do you perhaps mean uint8_t? Certainly, the Accelerate framework won't > require you to use any type which it hasn't included the definition for. > > Regards, > Ken > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Accelerate framework
On May 12, 2012, at 3:25 AM, Luca Ciciriello wrote: > Using the accelerate framework in iOS 5.1 I've imported the header > Accelerate/Accelerate.h and in my code I'm using the line: > > uint_8 kernel = {-2, -2, 0, -2, 6, 0, 0, 0, 0}; > > My problem is that I've got the error: > > "Use of undeclared identifier uint_8". > > Which is the header I've to use for uint_8? Do you perhaps mean uint8_t? Certainly, the Accelerate framework won't require you to use any type which it hasn't included the definition for. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Accelerate framework
uint_8? Do you mean uint8_t? On May 12, 2012, at 4:25 PM, Luca Ciciriello wrote: > Hi All. A simple question. > Using the accelerate framework in iOS 5.1 I've imported the header > Accelerate/Accelerate.h and in my code I'm using the line: > > uint_8 kernel = {-2, -2, 0, -2, 6, 0, 0, 0, 0}; > > My problem is that I've got the error: > > "Use of undeclared identifier uint_8". > > Which is the header I've to use for uint_8? > > Thanks in advance for any answer. > > Luca. > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org > > This email sent to r...@rols.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Accelerate framework
Hi All. A simple question. Using the accelerate framework in iOS 5.1 I've imported the header Accelerate/Accelerate.h and in my code I'm using the line: uint_8 kernel = {-2, -2, 0, -2, 6, 0, 0, 0, 0}; My problem is that I've got the error: "Use of undeclared identifier uint_8". Which is the header I've to use for uint_8? Thanks in advance for any answer. Luca. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com