ios - can not get CISourceOverCompositing to work -


im using cisourceovercompositing merge images , export cvpixelbuffer.everything works fine when image count down below 41. when hit 42 or greater, result become black scean. heres processing code:

- (cvpixelbufferref)pixelbufferrefwithmergingstillmaterials:(nsarray *)materials withbackgroundsamplebuffer:(cmsamplebufferref)samplebuffer { // 基于gpu合并所有图层  cvimagebufferref pixelbuffer = cmsamplebuffergetimagebuffer(samplebuffer);  size_t width = cvpixelbuffergetwidth(pixelbuffer); size_t height = cvpixelbuffergetheight(pixelbuffer);  ciimage *backgroundimage = [ciimage imagewithcvpixelbuffer:pixelbuffer];  static int = 0; i=0; cifilter *filter = [cifilter filterwithname:@"cisourceovercompositing"]; // 合并静态素材到一个ciimage (id<microvideostillmaterial> stillmaterial in materials) {      ciimage *foregroundimage = [stillmaterial image];       [filter setdefaults];     [filter setvalue:backgroundimage forkey:kciinputbackgroundimagekey];     [filter setvalue:foregroundimage forkey:kciinputimagekey];      backgroundimage = filter.outputimage;     i++; }  nslog(@"iiiiiiiiiii  %d", i);  eaglcontext *glcontext = [[eaglcontext alloc] initwithapi:keaglrenderingapiopengles2]; cicontext *context = [cicontext contextwitheaglcontext:glcontext];  cfdictionaryref empty = cfdictionarycreate(kcfallocatordefault, // empty iosurface dict                                            null,                                            null,                                            0,                                            &kcftypedictionarykeycallbacks,                                            &kcftypedictionaryvaluecallbacks); cfmutabledictionaryref attributes = cfdictionarycreatemutable(kcfallocatordefault,                                                               1,                                                               &kcftypedictionarykeycallbacks,                                                               &kcftypedictionaryvaluecallbacks);  cfdictionarysetvalue(attributes,kcvpixelbufferiosurfacepropertieskey,empty);  cvpixelbufferref outputpixelbuffer = null;  cvpixelbuffercreate(kcfallocatorsystemdefault, width, height, kcvpixelformattype_32bgra, attributes, &outputpixelbuffer); cvpixelbufferlockbaseaddress(outputpixelbuffer, 0); [context render:backgroundimage tocvpixelbuffer:outputpixelbuffer];  cvpixelbufferunlockbaseaddress(outputpixelbuffer, 0);  return outputpixelbuffer; } 

and piece of code run in background thread.anyone has idea please help.thanks


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -