• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Best way to composite/tile multiple CGImages to one image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best way to composite/tile multiple CGImages to one image


  • Subject: Re: Best way to composite/tile multiple CGImages to one image
  • From: Trygve Inda <email@hidden>
  • Date: Fri, 14 Mar 2014 14:30:55 -0700
  • Thread-topic: Best way to composite/tile multiple CGImages to one image

>
> On Mar 8, 2014, at 9:17 AM, Trygve Inda <email@hidden> wrote:
>
>>> On 08 Mar 2014, at 04:38, Trygve Inda <email@hidden> wrote:
>>>> I need to composite/tile about 20 images in a 4x5 grid to one image.
>>>
>>> What for? Knowing that might help finding a way to speed it up. I.e. why are
>>> the images separate, where are they supposed to go in the end? Display on
>>> screen? Writing to a standard image file format? Something else?
>>
>> The images are coming from a video file at periodic intervals and are
>> destined for a jpg file consisting of multiple thumbnails stitched together.
>>
>> The CGImages come from an AVAssetImageGenerator.
>>
>> Instruments says the time spent in
>>
>> [imageGenerator copyCGImageAtTime:targetTime actualTime:&actualTime
>> error:&error];
>>
>> Is small, but the time in CGContextDrawImage is quite large. However, if I
>> comment out the CGContextDrawImage line, then the time spent in
>> copyCGImageAtTime it rather more significant.
>>
>> I imagine when I get the CGImageRef from copyCGImageAtTime, I am not
>> actually getting any pixel data until it tries to draw in
>> CGContextDrawImage.
>
> I have an app that does some transformations on images and writes them back to
> jpegs, and it processes 25 images (1288◊1936 pixels) per second on my 2011 MBP
> (2.2 i7), maxing all 8 cores.  Almost 50% of the time is spent in
> CGContextDrawImage.  I played with the code a bit to use CoreImage instead,
> and while it performed at roughly the same rate of 25 images per second, most
> of the CPU time was now spent reading and encoding the jpegs, and CPU time was
> cut in half.  In my case, the spinning platter hard disk is likely the
> bottleneck, and the process is fast enough either way.  Since you are writing
> 1 jpeg for every 20 images, using CoreImage will likely give you a noticeable
> performance boost.
>
> Jim Crate
>
>

So what is the best way to use CoreImage in this case?

I get the original large CGImageRef using an AVImageGenerator which grabs a
frame from a video file.

Thanks,

Trygve




_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Best way to composite/tile multiple CGImages to one image
      • From: Jim Crate <email@hidden>
  • Prev by Date: Re: Removing Core Data from an existing app
  • Next by Date: Re: "No options" constant
  • Previous by thread: Re: Best way to composite/tile multiple CGImages to one image
  • Next by thread: Re: Best way to composite/tile multiple CGImages to one image
  • Index(es):
    • Date
    • Thread