iOS third-party make filters the most mainstream open source framework Gpuimage

Source: Internet
Author: User

Gpuimage is now the most mainstream open source framework for iOS filters. The author Bradlarson the image processing unit based on OpenGL to provide the Gpuimagefilter base class, with shader, common filters are not the problem.  There are several concepts in Gpuimage:

? Output, source

? Intput, input source

? Filter, Filter

So a complete filter processing flow is: output+x+input , X is the group of filters (1+ filters). Gpuimage for convenience, the new version provides Gpuimagefilterpipeline, which allows users to use multiple filter combinations without worrying about the chain logic before and after.

gpuimage separates the image filter processing from the live filter, and the dynamic filter is based on the process above, but the picture processing is (output+filter) *x + Input this logic. If the effect of processing a picture requires multiple combinations of filters, a filter is used to generate a picture output, and then passed to the next filter processing, the process if the filter overlay more times, or the filter effect is called multiple times, so that the memory consumption is particularly large, The exported image output after each filter processing is in memory, and if the original is particularly large, the memory is estimated to explode.

Output+x+input This mode to handle, so the code logic is single, high efficiency, eat less memory. Read the source know output +x+ input, when X is multiple, last filter n processed texture, there is GPU memory, the GPU directly passes this texture to n+1 as its output, so that the entire filter process down, only one texture memory occupied.

< Span class= "token p" style= "color: #5a5a5a; font-family: ' Microsoft Yahei '; font-size:18px; line-height:29px; White-space:pre-wrap; Outline:none!important; " > with this line to go, the process of basic no problem encountered, but the code structure design and packaging time-consuming. Project, found that the filter module after the call, memory went down, repeated checks, all gpuimage related elements have been released. Later thought of the video memory, ARC environment, only responsible for recycling OC object memory, video memory naturally need to gpuimage users to recycle, so it is easy, turn Gpuimage API, know

There is a framebuffercache in Gpuimagecontext:

[[Gpuimagecontextsharedimageprocessingcontext]. Framebuffercachepurgeallunassignedframebuffers].

iOS third-party make filters the most mainstream open source framework Gpuimage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.