├── framework ├── Source │ ├── Mac │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── GPUImageMac-Prefix.pch │ │ ├── GPUImagePicture.h │ │ └── GPUImageMac-Info.plist │ ├── GPUImageCGAColorspaceFilter.h │ ├── GPUImageMaskFilter.h │ ├── GPUImageAddBlendFilter.h │ ├── GPUImageHueBlendFilter.h │ ├── GPUImageColorBlendFilter.h │ ├── GPUImageColorInvertFilter.h │ ├── GPUImageDivideBlendFilter.h │ ├── GPUImageHalftoneFilter.h │ ├── GPUImageOverlayBlendFilter.h │ ├── GPUImageSubtractBlendFilter.h │ ├── GPUImageLaplacianFilter.h │ ├── GPUImageLinearBurnBlendFilter.h │ ├── GPUImageLuminosityBlendFilter.h │ ├── GPUImageMedianFilter.h │ ├── GPUImageSaturationBlendFilter.h │ ├── GPUImageSourceOverBlendFilter.h │ ├── iOS │ │ ├── Framework │ │ │ ├── module.modulemap │ │ │ └── Info.plist │ │ ├── GPUImage-Prefix.pch │ │ ├── GPUImagePicture+TextureSubimage.h │ │ └── GPUImagePicture.h │ ├── GPUImageDarkenBlendFilter.h │ ├── GPUImageScreenBlendFilter.h │ ├── GPUImageDifferenceBlendFilter.h │ ├── GPUImageExclusionBlendFilter.h │ ├── GPUImageGlassSphereFilter.h │ ├── GPUImageHardLightBlendFilter.h │ ├── GPUImageMultiplyBlendFilter.h │ ├── GPUImageSoftLightBlendFilter.h │ ├── GPUImageXYDerivativeFilter.h │ ├── GPUImageSepiaFilter.h │ ├── GPUImageLocalBinaryPatternFilter.h │ ├── GPUImageWeakPixelInclusionFilter.h │ ├── GPUImageHistogramGenerator.h │ ├── GPUImageNonMaximumSuppressionFilter.h │ ├── GPUImagePrewittEdgeDetectionFilter.h │ ├── GPUImageThresholdSketchFilter.h │ ├── GPUImageKuwaharaRadius3Filter.h │ ├── GPUImageNormalBlendFilter.h │ ├── GPUImageBoxBlurFilter.h │ ├── GPUimageDirectionalSobelEdgeDetectionFilter.h │ ├── GPUImageColorBurnBlendFilter.h │ ├── GPUImageColorDodgeBlendFilter.h │ ├── GPUImageHueFilter.h │ ├── GPUImageBuffer.h │ ├── GPUImageLanczosResamplingFilter.h │ ├── GPUImageColorPackingFilter.h │ ├── GPUImageLightenBlendFilter.h │ ├── GPUImagePolkaDotFilter.h │ ├── GPUImageVoronoiConsumerFilter.h │ ├── GPUImageEmbossFilter.h │ ├── GPUImageGammaFilter.h │ ├── GPUImageOpacityFilter.h │ ├── GPUImageExposureFilter.h │ ├── GPUImageSingleComponentGaussianBlurFilter.h │ ├── GPUImageSketchFilter.h │ ├── GPUImageBrightnessFilter.h │ ├── GPUImageAdaptiveThresholdFilter.h │ ├── GPUImageAlphaBlendFilter.h │ ├── GPUImageLuminanceRangeFilter.h │ ├── GPUImageDissolveBlendFilter.h │ ├── GPUImageAverageLuminanceThresholdFilter.h │ ├── GPUImageGrayscaleFilter.h │ ├── GPUImageSharpenFilter.h │ ├── GPUImageTextureInput.h │ ├── GPUImageContrastFilter.h │ ├── GPUImageStretchDistortionFilter.h │ ├── GPUImagePerlinNoiseFilter.h │ ├── GPUImageJFAVoronoiFilter.h │ ├── GPUImageSaturationFilter.h │ ├── GPUImageMonochromeFilter.h │ ├── GPUImageUIElement.h │ ├── GPUImageZoomBlurFilter.h │ ├── GPUImageMotionBlurFilter.h │ ├── GPUImageThresholdEdgeDetectionFilter.h │ ├── GPUImageBilateralFilter.h │ ├── GPUImageNobleCornerDetectionFilter.h │ ├── GPUImagePixellateFilter.h │ ├── GPUImageHighlightShadowFilter.h │ ├── GPUImageRGBFilter.h │ ├── GPUImageCrosshatchFilter.h │ ├── GPUImageLuminanceThresholdFilter.h │ ├── GPUImagePolarPixellateFilter.h │ ├── GPUImageCropFilter.h │ ├── GPUImagePosterizeFilter.h │ ├── GPUImageSepiaFilter.m │ ├── GPUImageAmatorkaFilter.h │ ├── GPUImageThresholdedNonMaximumSuppressionFilter.h │ ├── GPUImageLowPassFilter.h │ ├── GPUImageMissEtikateFilter.h │ ├── GPUImageRGBOpeningFilter.h │ ├── GPUImageUnsharpMaskFilter.h │ ├── GPUImageRGBClosingFilter.h │ ├── GPUImageHighPassFilter.h │ ├── GPUImageShiTomasiFeatureDetectionFilter.h │ ├── GPUImageColorMatrixFilter.h │ ├── GPUImageRGBErosionFilter.h │ ├── GPUImageRGBDilationFilter.h │ ├── GPUImageErosionFilter.h │ ├── GPUImageWhiteBalanceFilter.h │ ├── GPUImageSoftEleganceFilter.h │ ├── GPUImageMovieComposition.h │ ├── GPUImageClosingFilter.h │ ├── GPUImageTwoInputCrossTextureSamplingFilter.h │ ├── GPUImageOpeningFilter.h │ ├── GPUImageSphereRefractionFilter.h │ ├── GPUImageTextureOutput.h │ ├── GPUImageSwirlFilter.h │ ├── GPUImageThreeInputFilter.h │ ├── GPUImageBulgeDistortionFilter.h │ ├── GPUImage3x3TextureSamplingFilter.h │ ├── GPUImageFalseColorFilter.h │ ├── GPUImagePoissonBlendFilter.h │ ├── GPUImageAverageColor.h │ ├── GPUImageFilterGroup.h │ ├── GPUImageLuminosity.h │ ├── GPUImagePinchDistortionFilter.h │ ├── GPUImageGaussianBlurPositionFilter.h │ ├── GPUImageKuwaharaFilter.h │ ├── GPUImageToonFilter.h │ ├── GPUImageTwoInputFilter.h │ ├── GPUImagePixellatePositionFilter.h │ ├── GPUImage3x3ConvolutionFilter.h │ ├── GPUImageTwoPassTextureSamplingFilter.h │ ├── GPUImageLineGenerator.h │ ├── GPUImageHazeFilter.h │ ├── GPUImageSobelEdgeDetectionFilter.h │ ├── GPUImageFramebufferCache.h │ ├── GPUImageSolidColorGenerator.h │ ├── GPUImageCrosshairGenerator.h │ ├── GPUImageHistogramEqualizationFilter.h │ ├── GPUImageMotionDetector.h │ ├── GPUImageTransformFilter.h │ ├── GPUImageVignetteFilter.h │ ├── GPUImageHistogramFilter.h │ ├── GPUImageParallelCoordinateLineTransformFilter.h │ ├── GPUImageDilationFilter.h │ ├── GPUImageDirectionalNonMaximumSuppressionFilter.h │ ├── GPUImageHSBFilter.h │ ├── GPUImageTiltShiftFilter.h │ ├── GPUImageRGBClosingFilter.m │ ├── GPUImageRGBOpeningFilter.m │ ├── GPUImageTwoPassFilter.h │ ├── GPUImageMosaicFilter.h │ ├── GPUImageChromaKeyFilter.h │ ├── GPUImageiOSBlurFilter.h │ ├── GPUImageAmatorkaFilter.m │ ├── GPUImageMissEtikateFilter.m │ ├── GPUImageColorInvertFilter.m │ ├── GPUImageChromaKeyBlendFilter.h │ ├── GPUImageSmoothToonFilter.h │ ├── GPUImageToneCurveFilter.h │ ├── GPUImageGaussianSelectiveBlurFilter.h │ ├── GPUImageEmbossFilter.m │ ├── GPUImageRawDataOutput.h │ ├── GPUImageHighPassFilter.m │ ├── GPUImageFilterPipeline.h │ ├── GPUImageLookupFilter.h │ ├── GPUImageLightenBlendFilter.m │ ├── GPUImageSourceOverBlendFilter.m │ ├── GPUImageTextureInput.m │ ├── GPUImageSubtractBlendFilter.m │ ├── GPUImageFASTCornerDetectionFilter.h │ ├── GPUImageDifferenceBlendFilter.m │ ├── GPUImageMultiplyBlendFilter.m │ ├── GLProgram.h │ ├── GPUImageAverageLuminanceThresholdFilter.m │ └── GPUImageColorBurnBlendFilter.m └── Resources │ ├── lookup.png │ ├── lookup_amatorka.png │ ├── lookup_miss_etikate.png │ ├── lookup_soft_elegance_1.png │ └── lookup_soft_elegance_2.png ├── examples ├── Mac │ ├── FilterShowcaseSwift │ │ ├── FilterShowcaseSwift │ │ │ ├── main.swift │ │ │ ├── AppDelegate.swift │ │ │ ├── Images.xcassets │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ └── Contents.json │ │ │ └── Info.plist │ │ └── FilterShowcaseSwiftTests │ │ │ ├── Info.plist │ │ │ └── FilterShowcaseSwiftTests.swift │ ├── FilterShowcase │ │ └── FilterShowcase │ │ │ ├── en.lproj │ │ │ ├── InfoPlist.strings │ │ │ └── Credits.rtf │ │ │ ├── main.m │ │ │ ├── FilterShowcase-Prefix.pch │ │ │ ├── SLSAppDelegate.h │ │ │ ├── SLSAppDelegate.m │ │ │ └── FilterShowcase-Info.plist │ ├── PlaygroundExample │ │ └── PlaygroundExample │ │ │ ├── main.swift │ │ │ └── GPUImagePlayground.playground │ │ │ ├── Resources │ │ │ ├── ChairTest.png │ │ │ └── CustomFilter.fsh │ │ │ ├── contents.xcplayground │ │ │ ├── section-1.swift │ │ │ └── timeline.xctimeline │ ├── SimplePhotoFilter │ │ └── SimplePhotoFilter │ │ │ ├── en.lproj │ │ │ ├── InfoPlist.strings │ │ │ └── Credits.rtf │ │ │ ├── SimplePhotoFilter-Prefix.pch │ │ │ ├── main.m │ │ │ └── SLSDocument.h │ └── MultiViewFilterExample │ │ └── MultiViewFilterExample │ │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ └── Credits.rtf │ │ ├── main.m │ │ ├── MultiViewFilterExample-Prefix.pch │ │ ├── SLSAppDelegate.h │ │ ├── Shader2.fsh │ │ ├── SLSAppDelegate.m │ │ ├── SLSMultiViewWindowController.h │ │ ├── Shader1.fsh │ │ └── MultiViewFilterExample-Info.plist └── iOS │ ├── RawDataTest │ ├── RawDataTest │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── RawDataTestAppDelegate.h │ │ ├── main.m │ │ ├── CalculationShader.fsh │ │ └── RawDataTest-Prefix.pch │ └── Default-568h@2x.png │ ├── BenchmarkSuite │ ├── BenchmarkSuite │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── 46-movie-2.png │ │ ├── 86-camera.png │ │ ├── 86-camera@2x.png │ │ ├── 46-movie-2@2x.png │ │ ├── 41-picture-frame.png │ │ ├── 41-picture-frame@2x.png │ │ ├── main.m │ │ ├── BenchmarkTableViewController.h │ │ ├── VideoFilteringBenchmarkController.h │ │ ├── BenchmarkSuite-Prefix.pch │ │ ├── BenchmarkAppDelegate.h │ │ ├── ImageFilteringBenchmarkController.h │ │ ├── VideoFilteringBenchmarkController.m │ │ └── VideoFilteringDisplayController.h │ └── Default-568h@2x.png │ ├── FilterShowcase │ ├── FilterShowcase │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── mask.png │ │ ├── curvies.png │ │ ├── squares.png │ │ ├── dotletterstiles.png │ │ ├── voroni_points2.png │ │ ├── ShowcaseFilterListController.h │ │ ├── main.m │ │ ├── ShowcaseAppDelegate.h │ │ ├── FilterShowcase-Prefix.pch │ │ ├── CustomFilter.fsh │ │ ├── SampleConfiguration.plist │ │ └── ShowcaseAppDelegate.m │ └── Default-568h@2x.png │ ├── SharedIcons │ ├── Icon.png │ ├── Icon-72.png │ ├── Icon@2x.png │ ├── Icon-72@2x.png │ ├── Icon-Small.png │ ├── Icon-Small-50.png │ ├── Icon-Small@2x.png │ ├── iTunesArtwork.png │ └── Icon-Small-50@2x.png │ ├── SimpleImageFilter │ ├── SimpleImageFilter │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── Lambeau.jpg │ │ ├── WID-small.jpg │ │ ├── main.m │ │ ├── SimpleImageAppDelegate.h │ │ ├── SimpleImageFilter-Prefix.pch │ │ ├── SimpleImageViewController.h │ │ ├── SimpleImageAppDelegate.m │ │ └── SimpleImageFilter-Info.plist │ └── Default-568h@2x.png │ ├── SimplePhotoFilter │ ├── SimplePhotoFilter │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── main.m │ │ ├── PhotoAppDelegate.h │ │ ├── SimplePhotoFilter-Prefix.pch │ │ └── PhotoViewController.h │ └── Default-568h@2x.png │ ├── SimpleVideoFilter │ ├── SimpleVideoFilter │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── main.m │ │ ├── SimpleVideoFilterAppDelegate.h │ │ ├── SimpleVideoFilterViewController.h │ │ └── SimpleVideoFilter-Prefix.pch │ └── Default-568h@2x.png │ ├── ColorObjectTracking │ ├── ColorObjectTracking │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── main.m │ │ ├── ColorTrackingAppDelegate.h │ │ ├── ColorObjectTracking-Prefix.pch │ │ ├── ColorTrackingViewController.h │ │ ├── ColorTrackingAppDelegate.m │ │ ├── Threshold.fsh │ │ └── PositionColor.fsh │ └── Default-568h@2x.png │ ├── FeatureExtractionTest │ ├── FeatureExtractionTest │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── 71yih.png │ │ ├── LBPTest.png │ │ ├── LineTest.png │ │ ├── 8pixeltest.png │ │ ├── ChairTest.png │ │ ├── LineTest2.png │ │ ├── GaussianTest.png │ │ ├── main.m │ │ ├── FeatureExtractionTest-Prefix.pch │ │ └── FeatureExtractionAppDelegate.h │ └── Default-568h@2x.png │ ├── MultiViewFilterExample │ ├── MultiViewFilterExample │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── MultiViewViewController.h │ │ ├── main.m │ │ ├── MultiViewAppDelegate.h │ │ ├── Shader2.fsh │ │ ├── MultiViewFilterExample-Prefix.pch │ │ └── Shader1.fsh │ └── Default-568h@2x.png │ ├── SimpleVideoFileFilter │ ├── SimpleVideoFileFilter │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ ├── WID-small.jpg │ │ ├── sample_iPod.m4v │ │ ├── main.m │ │ ├── SimpleVideoFileFilterAppDelegate.h │ │ ├── SimpleVideoFileFilter-Prefix.pch │ │ └── SimpleVideoFileFilterViewController.h │ └── Default-568h@2x.png │ ├── CubeExample │ ├── Default-568h@2x.png │ ├── Shaders │ │ ├── Shader.fsh │ │ └── Shader.vsh │ ├── Classes │ │ ├── ESRenderer.h │ │ ├── CubeExampleAppDelegate.h │ │ ├── DisplayViewController.h │ │ ├── CubeExampleAppDelegate.m │ │ └── ES2Renderer.h │ ├── CubeExample_Prefix.pch │ └── main.m │ ├── FilterShowcaseSwift │ └── FilterShowcaseSwift │ │ ├── AppDelegate.swift │ │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── FilterListViewController.swift │ └── SimpleSwiftVideoFilterExample │ └── SimpleSwiftVideoFilterExample │ ├── AppDelegate.swift │ ├── ViewController.swift │ ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json │ └── Info.plist ├── .gitignore ├── GPUImage.podspec └── License.txt /framework/Source/Mac/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/Mac/FilterShowcaseSwift/FilterShowcaseSwift/main.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | NSApplicationMain(C_ARGC, C_ARGV) -------------------------------------------------------------------------------- /examples/iOS/RawDataTest/RawDataTest/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /framework/Resources/lookup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/framework/Resources/lookup.png -------------------------------------------------------------------------------- /examples/Mac/FilterShowcase/FilterShowcase/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/Mac/PlaygroundExample/PlaygroundExample/main.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | println("Hello, World!") 4 | 5 | -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/iOS/SharedIcons/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SharedIcons/Icon.png -------------------------------------------------------------------------------- /examples/Mac/SimplePhotoFilter/SimplePhotoFilter/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/iOS/SharedIcons/Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SharedIcons/Icon-72.png -------------------------------------------------------------------------------- /examples/iOS/SharedIcons/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SharedIcons/Icon@2x.png -------------------------------------------------------------------------------- /examples/iOS/SimpleImageFilter/SimpleImageFilter/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/iOS/SimplePhotoFilter/SimplePhotoFilter/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFilter/SimpleVideoFilter/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/iOS/ColorObjectTracking/ColorObjectTracking/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/iOS/SharedIcons/Icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SharedIcons/Icon-72@2x.png -------------------------------------------------------------------------------- /examples/iOS/SharedIcons/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SharedIcons/Icon-Small.png -------------------------------------------------------------------------------- /framework/Resources/lookup_amatorka.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/framework/Resources/lookup_amatorka.png -------------------------------------------------------------------------------- /examples/Mac/MultiViewFilterExample/MultiViewFilterExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/iOS/FeatureExtractionTest/FeatureExtractionTest/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/iOS/MultiViewFilterExample/MultiViewFilterExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/iOS/SharedIcons/Icon-Small-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SharedIcons/Icon-Small-50.png -------------------------------------------------------------------------------- /examples/iOS/SharedIcons/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SharedIcons/Icon-Small@2x.png -------------------------------------------------------------------------------- /examples/iOS/SharedIcons/iTunesArtwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SharedIcons/iTunesArtwork.png -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFileFilter/SimpleVideoFileFilter/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /examples/iOS/CubeExample/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/CubeExample/Default-568h@2x.png -------------------------------------------------------------------------------- /examples/iOS/RawDataTest/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/RawDataTest/Default-568h@2x.png -------------------------------------------------------------------------------- /framework/Resources/lookup_miss_etikate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/framework/Resources/lookup_miss_etikate.png -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/BenchmarkSuite/Default-568h@2x.png -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FilterShowcase/Default-568h@2x.png -------------------------------------------------------------------------------- /examples/iOS/SharedIcons/Icon-Small-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SharedIcons/Icon-Small-50@2x.png -------------------------------------------------------------------------------- /framework/Resources/lookup_soft_elegance_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/framework/Resources/lookup_soft_elegance_1.png -------------------------------------------------------------------------------- /framework/Resources/lookup_soft_elegance_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/framework/Resources/lookup_soft_elegance_2.png -------------------------------------------------------------------------------- /examples/iOS/ColorObjectTracking/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/ColorObjectTracking/Default-568h@2x.png -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FilterShowcase/FilterShowcase/mask.png -------------------------------------------------------------------------------- /examples/iOS/SimpleImageFilter/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SimpleImageFilter/Default-568h@2x.png -------------------------------------------------------------------------------- /examples/iOS/SimplePhotoFilter/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SimplePhotoFilter/Default-568h@2x.png -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFilter/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SimpleVideoFilter/Default-568h@2x.png -------------------------------------------------------------------------------- /framework/Source/GPUImageCGAColorspaceFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageCGAColorspaceFilter : GPUImageFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageMaskFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageMaskFilter : GPUImageTwoInputFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /examples/iOS/FeatureExtractionTest/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FeatureExtractionTest/Default-568h@2x.png -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/curvies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FilterShowcase/FilterShowcase/curvies.png -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/squares.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FilterShowcase/FilterShowcase/squares.png -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFileFilter/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SimpleVideoFileFilter/Default-568h@2x.png -------------------------------------------------------------------------------- /framework/Source/GPUImageAddBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageAddBlendFilter : GPUImageTwoInputFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageHueBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageHueBlendFilter : GPUImageTwoInputFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/46-movie-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/BenchmarkSuite/BenchmarkSuite/46-movie-2.png -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/86-camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/BenchmarkSuite/BenchmarkSuite/86-camera.png -------------------------------------------------------------------------------- /examples/iOS/MultiViewFilterExample/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/MultiViewFilterExample/Default-568h@2x.png -------------------------------------------------------------------------------- /framework/Source/GPUImageColorBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageColorBlendFilter : GPUImageTwoInputFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageColorInvertFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageColorInvertFilter : GPUImageFilter 4 | { 5 | } 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /framework/Source/GPUImageDivideBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageDivideBlendFilter : GPUImageTwoInputFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageHalftoneFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImagePixellateFilter.h" 2 | 3 | @interface GPUImageHalftoneFilter : GPUImagePixellateFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/86-camera@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/BenchmarkSuite/BenchmarkSuite/86-camera@2x.png -------------------------------------------------------------------------------- /framework/Source/GPUImageOverlayBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageOverlayBlendFilter : GPUImageTwoInputFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSubtractBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageSubtractBlendFilter : GPUImageTwoInputFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/46-movie-2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/BenchmarkSuite/BenchmarkSuite/46-movie-2@2x.png -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/dotletterstiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FilterShowcase/FilterShowcase/dotletterstiles.png -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/voroni_points2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FilterShowcase/FilterShowcase/voroni_points2.png -------------------------------------------------------------------------------- /examples/iOS/SimpleImageFilter/SimpleImageFilter/Lambeau.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SimpleImageFilter/SimpleImageFilter/Lambeau.jpg -------------------------------------------------------------------------------- /examples/iOS/SimpleImageFilter/SimpleImageFilter/WID-small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SimpleImageFilter/SimpleImageFilter/WID-small.jpg -------------------------------------------------------------------------------- /framework/Source/GPUImageLaplacianFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImage3x3ConvolutionFilter.h" 2 | 3 | @interface GPUImageLaplacianFilter : GPUImage3x3ConvolutionFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageLinearBurnBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageLinearBurnBlendFilter : GPUImageTwoInputFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageLuminosityBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageLuminosityBlendFilter : GPUImageTwoInputFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageMedianFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImage3x3TextureSamplingFilter.h" 2 | 3 | @interface GPUImageMedianFilter : GPUImage3x3TextureSamplingFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSaturationBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageSaturationBlendFilter : GPUImageTwoInputFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSourceOverBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageSourceOverBlendFilter : GPUImageTwoInputFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/iOS/Framework/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module GPUImage { 2 | umbrella header "GPUImageFramework.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/41-picture-frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/BenchmarkSuite/BenchmarkSuite/41-picture-frame.png -------------------------------------------------------------------------------- /framework/Source/GPUImageDarkenBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageDarkenBlendFilter : GPUImageTwoInputFilter 4 | { 5 | } 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /framework/Source/GPUImageScreenBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageScreenBlendFilter : GPUImageTwoInputFilter 4 | { 5 | } 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/41-picture-frame@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/BenchmarkSuite/BenchmarkSuite/41-picture-frame@2x.png -------------------------------------------------------------------------------- /examples/iOS/FeatureExtractionTest/FeatureExtractionTest/71yih.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FeatureExtractionTest/FeatureExtractionTest/71yih.png -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/ShowcaseFilterListController.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface ShowcaseFilterListController : UITableViewController 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageDifferenceBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageDifferenceBlendFilter : GPUImageTwoInputFilter 4 | { 5 | } 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /framework/Source/GPUImageExclusionBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageExclusionBlendFilter : GPUImageTwoInputFilter 4 | { 5 | } 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /framework/Source/GPUImageGlassSphereFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageSphereRefractionFilter.h" 2 | 3 | @interface GPUImageGlassSphereFilter : GPUImageSphereRefractionFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageHardLightBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageHardLightBlendFilter : GPUImageTwoInputFilter 4 | { 5 | } 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /framework/Source/GPUImageMultiplyBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageMultiplyBlendFilter : GPUImageTwoInputFilter 4 | { 5 | } 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSoftLightBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageSoftLightBlendFilter : GPUImageTwoInputFilter 4 | { 5 | } 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /examples/Mac/FilterShowcase/FilterShowcase/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | return NSApplicationMain(argc, (const char **)argv); 6 | } 7 | -------------------------------------------------------------------------------- /examples/iOS/FeatureExtractionTest/FeatureExtractionTest/LBPTest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FeatureExtractionTest/FeatureExtractionTest/LBPTest.png -------------------------------------------------------------------------------- /examples/iOS/FeatureExtractionTest/FeatureExtractionTest/LineTest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FeatureExtractionTest/FeatureExtractionTest/LineTest.png -------------------------------------------------------------------------------- /framework/Source/GPUImageXYDerivativeFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageSobelEdgeDetectionFilter.h" 2 | 3 | @interface GPUImageXYDerivativeFilter : GPUImageSobelEdgeDetectionFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /examples/iOS/FeatureExtractionTest/FeatureExtractionTest/8pixeltest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FeatureExtractionTest/FeatureExtractionTest/8pixeltest.png -------------------------------------------------------------------------------- /examples/iOS/FeatureExtractionTest/FeatureExtractionTest/ChairTest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FeatureExtractionTest/FeatureExtractionTest/ChairTest.png -------------------------------------------------------------------------------- /examples/iOS/FeatureExtractionTest/FeatureExtractionTest/LineTest2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FeatureExtractionTest/FeatureExtractionTest/LineTest2.png -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFileFilter/SimpleVideoFileFilter/WID-small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SimpleVideoFileFilter/SimpleVideoFileFilter/WID-small.jpg -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFileFilter/SimpleVideoFileFilter/sample_iPod.m4v: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/SimpleVideoFileFilter/SimpleVideoFileFilter/sample_iPod.m4v -------------------------------------------------------------------------------- /framework/Source/GPUImageSepiaFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageColorMatrixFilter.h" 2 | 3 | /// Simple sepia tone filter 4 | @interface GPUImageSepiaFilter : GPUImageColorMatrixFilter 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /examples/iOS/FeatureExtractionTest/FeatureExtractionTest/GaussianTest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/iOS/FeatureExtractionTest/FeatureExtractionTest/GaussianTest.png -------------------------------------------------------------------------------- /framework/Source/GPUImageLocalBinaryPatternFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImage3x3TextureSamplingFilter.h" 2 | 3 | @interface GPUImageLocalBinaryPatternFilter : GPUImage3x3TextureSamplingFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageWeakPixelInclusionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImage3x3TextureSamplingFilter.h" 2 | 3 | @interface GPUImageWeakPixelInclusionFilter : GPUImage3x3TextureSamplingFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /examples/Mac/MultiViewFilterExample/MultiViewFilterExample/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | return NSApplicationMain(argc, (const char **)argv); 6 | } 7 | -------------------------------------------------------------------------------- /framework/Source/GPUImageHistogramGenerator.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageHistogramGenerator : GPUImageFilter 4 | { 5 | GLint backgroundColorUniform; 6 | } 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /framework/Source/GPUImageNonMaximumSuppressionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImage3x3TextureSamplingFilter.h" 2 | 3 | @interface GPUImageNonMaximumSuppressionFilter : GPUImage3x3TextureSamplingFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImagePrewittEdgeDetectionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageSobelEdgeDetectionFilter.h" 2 | 3 | @interface GPUImagePrewittEdgeDetectionFilter : GPUImageSobelEdgeDetectionFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageThresholdSketchFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageThresholdEdgeDetectionFilter.h" 2 | 3 | @interface GPUImageThresholdSketchFilter : GPUImageThresholdEdgeDetectionFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/GPUImageKuwaharaRadius3Filter.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPUImageKuwaharaRadius3Filter.h 3 | 4 | #import "GPUImageFilter.h" 5 | 6 | @interface GPUImageKuwaharaRadius3Filter : GPUImageFilter 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /framework/Source/GPUImageNormalBlendFilter.h: -------------------------------------------------------------------------------- 1 | // Created by Jorge Garcia on 9/5/12. 2 | // 3 | 4 | #import "GPUImageTwoInputFilter.h" 5 | 6 | @interface GPUImageNormalBlendFilter : GPUImageTwoInputFilter 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /framework/Source/GPUImageBoxBlurFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageGaussianBlurFilter.h" 2 | 3 | /** A hardware-accelerated box blur of an image 4 | */ 5 | @interface GPUImageBoxBlurFilter : GPUImageGaussianBlurFilter 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /framework/Source/GPUimageDirectionalSobelEdgeDetectionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImage3x3TextureSamplingFilter.h" 2 | 3 | @interface GPUimageDirectionalSobelEdgeDetectionFilter : GPUImage3x3TextureSamplingFilter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /framework/Source/Mac/GPUImageMac-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GPUImageMac' target in the 'GPUImageMac' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /framework/Source/iOS/GPUImage-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GPUImage' target in the 'GPUImage' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /framework/Source/GPUImageColorBurnBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | /** Applies a color burn blend of two images 4 | */ 5 | @interface GPUImageColorBurnBlendFilter : GPUImageTwoInputFilter 6 | { 7 | } 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /examples/Mac/FilterShowcase/FilterShowcase/FilterShowcase-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'FilterShowcase' target in the 'FilterShowcase' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /examples/Mac/PlaygroundExample/PlaygroundExample/GPUImagePlayground.playground/Resources/ChairTest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcherry/GPUImage/master/examples/Mac/PlaygroundExample/PlaygroundExample/GPUImagePlayground.playground/Resources/ChairTest.png -------------------------------------------------------------------------------- /framework/Source/GPUImageColorDodgeBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | /** Applies a color dodge blend of two images 4 | */ 5 | @interface GPUImageColorDodgeBlendFilter : GPUImageTwoInputFilter 6 | { 7 | } 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /framework/Source/GPUImageHueFilter.h: -------------------------------------------------------------------------------- 1 | 2 | #import "GPUImageFilter.h" 3 | 4 | @interface GPUImageHueFilter : GPUImageFilter 5 | { 6 | GLint hueAdjustUniform; 7 | 8 | } 9 | @property (nonatomic, readwrite) CGFloat hue; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /framework/Source/GPUImageBuffer.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageBuffer : GPUImageFilter 4 | { 5 | NSMutableArray *bufferedFramebuffers; 6 | } 7 | 8 | @property(readwrite, nonatomic) NSUInteger bufferSize; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /examples/iOS/RawDataTest/RawDataTest/RawDataTestAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import "GPUImage.h" 2 | #import 3 | 4 | @interface RawDataTestAppDelegate : UIResponder 5 | 6 | @property (strong, nonatomic) UIWindow *window; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /examples/Mac/SimplePhotoFilter/SimplePhotoFilter/SimplePhotoFilter-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SimplePhotoFilter' target in the 'SimplePhotoFilter' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /framework/Source/GPUImageLanczosResamplingFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoPassTextureSamplingFilter.h" 2 | 3 | @interface GPUImageLanczosResamplingFilter : GPUImageTwoPassTextureSamplingFilter 4 | 5 | @property(readwrite, nonatomic) CGSize originalImageSize; 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /examples/iOS/CubeExample/Shaders/Shader.fsh: -------------------------------------------------------------------------------- 1 | varying highp vec2 textureCoordinate; 2 | 3 | uniform sampler2D texture; 4 | 5 | void main() 6 | { 7 | gl_FragColor = texture2D(texture, textureCoordinate); 8 | // gl_FragColor = vec4(textureCoordinate, 1.0, 1.0); 9 | } 10 | -------------------------------------------------------------------------------- /framework/Source/GPUImageColorPackingFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageColorPackingFilter : GPUImageFilter 4 | { 5 | GLint texelWidthUniform, texelHeightUniform; 6 | 7 | CGFloat texelWidth, texelHeight; 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /framework/Source/GPUImageLightenBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | /// Blends two images by taking the maximum value of each color component between the images 4 | @interface GPUImageLightenBlendFilter : GPUImageTwoInputFilter 5 | { 6 | } 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /framework/Source/GPUImagePolkaDotFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImagePixellateFilter.h" 2 | 3 | @interface GPUImagePolkaDotFilter : GPUImagePixellateFilter 4 | { 5 | GLint dotScalingUniform; 6 | } 7 | 8 | @property(readwrite, nonatomic) CGFloat dotScaling; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /framework/Source/GPUImageVoronoiConsumerFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageVoronoiConsumerFilter : GPUImageTwoInputFilter 4 | { 5 | GLint sizeUniform; 6 | } 7 | 8 | @property (nonatomic, readwrite) CGSize sizeInPixels; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /examples/Mac/MultiViewFilterExample/MultiViewFilterExample/MultiViewFilterExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'MultiViewFilterExample' target in the 'MultiViewFilterExample' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /examples/Mac/FilterShowcase/FilterShowcase/SLSAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "SLSFilterShowcaseWindowController.h" 3 | 4 | @interface SLSAppDelegate : NSObject 5 | { 6 | SLSFilterShowcaseWindowController *windowController; 7 | } 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /examples/iOS/CubeExample/Classes/ESRenderer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import 4 | #import 5 | 6 | @protocol ESRenderer 7 | 8 | - (void)renderByRotatingAroundX:(float)xRotation rotatingAroundY:(float)yRotation; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /framework/Source/GPUImageEmbossFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImage3x3ConvolutionFilter.h" 2 | 3 | @interface GPUImageEmbossFilter : GPUImage3x3ConvolutionFilter 4 | 5 | // The strength of the embossing, from 0.0 to 4.0, with 1.0 as the normal level 6 | @property(readwrite, nonatomic) CGFloat intensity; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /framework/Source/GPUImageGammaFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageGammaFilter : GPUImageFilter 4 | { 5 | GLint gammaUniform; 6 | } 7 | 8 | // Gamma ranges from 0.0 to 3.0, with 1.0 as the normal level 9 | @property(readwrite, nonatomic) CGFloat gamma; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "ShowcaseAppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([ShowcaseAppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/iOS/RawDataTest/RawDataTest/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "RawDataTestAppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([RawDataTestAppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/iOS/SimplePhotoFilter/SimplePhotoFilter/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "PhotoAppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([PhotoAppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "BenchmarkAppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([BenchmarkAppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /framework/Source/GPUImageOpacityFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageOpacityFilter : GPUImageFilter 4 | { 5 | GLint opacityUniform; 6 | } 7 | 8 | // Opacity ranges from 0.0 to 1.0, with 1.0 as the normal setting 9 | @property(readwrite, nonatomic) CGFloat opacity; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /examples/iOS/MultiViewFilterExample/MultiViewFilterExample/MultiViewViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImage.h" 3 | 4 | @interface MultiViewViewController : UIViewController 5 | { 6 | GPUImageView *view1, *view2, *view3, *view4; 7 | GPUImageVideoCamera *videoCamera; 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /framework/Source/GPUImageExposureFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageExposureFilter : GPUImageFilter 4 | { 5 | GLint exposureUniform; 6 | } 7 | 8 | // Exposure ranges from -10.0 to 10.0, with 0.0 as the normal level 9 | @property(readwrite, nonatomic) CGFloat exposure; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSingleComponentGaussianBlurFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageGaussianBlurFilter.h" 2 | 3 | // This filter merely performs the standard Gaussian blur on the red color channel (assuming a luminance image) 4 | 5 | @interface GPUImageSingleComponentGaussianBlurFilter : GPUImageGaussianBlurFilter 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /examples/iOS/SimpleImageFilter/SimpleImageFilter/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "SimpleImageAppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([SimpleImageAppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSketchFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageSobelEdgeDetectionFilter.h" 2 | 3 | /** Converts video to look like a sketch. 4 | 5 | This is just the Sobel edge detection filter with the colors inverted. 6 | */ 7 | @interface GPUImageSketchFilter : GPUImageSobelEdgeDetectionFilter 8 | { 9 | } 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /examples/iOS/ColorObjectTracking/ColorObjectTracking/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "ColorTrackingAppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([ColorTrackingAppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/iOS/MultiViewFilterExample/MultiViewFilterExample/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "MultiViewAppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([MultiViewAppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /framework/Source/GPUImageBrightnessFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageBrightnessFilter : GPUImageFilter 4 | { 5 | GLint brightnessUniform; 6 | } 7 | 8 | // Brightness ranges from -1.0 to 1.0, with 0.0 as the normal level 9 | @property(readwrite, nonatomic) CGFloat brightness; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFilter/SimpleVideoFilter/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "SimpleVideoFilterAppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([SimpleVideoFilterAppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/iOS/CubeExample/Shaders/Shader.vsh: -------------------------------------------------------------------------------- 1 | attribute vec4 position; 2 | attribute vec4 inputTextureCoordinate; 3 | 4 | varying vec2 textureCoordinate; 5 | 6 | uniform mat4 modelViewProjMatrix; 7 | 8 | void main() 9 | { 10 | gl_Position = modelViewProjMatrix * position; 11 | textureCoordinate = inputTextureCoordinate.xy; 12 | } 13 | -------------------------------------------------------------------------------- /examples/iOS/RawDataTest/RawDataTest/CalculationShader.fsh: -------------------------------------------------------------------------------- 1 | varying highp vec2 textureCoordinate; 2 | 3 | uniform sampler2D inputImageTexture; 4 | uniform lowp float gamma; 5 | 6 | void main() 7 | { 8 | lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 9 | 10 | gl_FragColor = textureColor; 11 | } 12 | -------------------------------------------------------------------------------- /examples/iOS/SimplePhotoFilter/SimplePhotoFilter/PhotoAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class PhotoViewController; 4 | 5 | @interface PhotoAppDelegate : UIResponder 6 | { 7 | PhotoViewController *rootViewController; 8 | } 9 | 10 | @property (strong, nonatomic) UIWindow *window; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /examples/iOS/FeatureExtractionTest/FeatureExtractionTest/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "FeatureExtractionAppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([FeatureExtractionAppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /framework/Source/GPUImageAdaptiveThresholdFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @interface GPUImageAdaptiveThresholdFilter : GPUImageFilterGroup 4 | 5 | /** A multiplier for the background averaging blur radius in pixels, with a default of 4 6 | */ 7 | @property(readwrite, nonatomic) CGFloat blurRadiusInPixels; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /examples/Mac/PlaygroundExample/PlaygroundExample/GPUImagePlayground.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFileFilter/SimpleVideoFileFilter/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "SimpleVideoFileFilterAppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([SimpleVideoFileFilterAppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /framework/Source/GPUImageAlphaBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageAlphaBlendFilter : GPUImageTwoInputFilter 4 | { 5 | GLint mixUniform; 6 | } 7 | 8 | // Mix ranges from 0.0 (only image 1) to 1.0 (only image 2), with 1.0 as the normal level 9 | @property(readwrite, nonatomic) CGFloat mix; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /examples/Mac/MultiViewFilterExample/MultiViewFilterExample/SLSAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "SLSMultiViewWindowController.h" 3 | 4 | @interface SLSAppDelegate : NSObject 5 | { 6 | SLSMultiViewWindowController *multiViewWindowController; 7 | } 8 | 9 | @property (assign) IBOutlet NSWindow *window; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/BenchmarkTableViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface BenchmarkTableViewController : UITableViewController 4 | { 5 | CGFloat processingTimeForCPURoutine, processingTimeForCoreImageRoutine, processingTimeForGPUImageRoutine; 6 | } 7 | 8 | // Benchmarks 9 | - (void)runBenchmark; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /examples/iOS/MultiViewFilterExample/MultiViewFilterExample/MultiViewAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "MultiViewViewController.h" 3 | 4 | @interface MultiViewAppDelegate : UIResponder 5 | { 6 | MultiViewViewController *rootViewController; 7 | } 8 | 9 | @property (strong, nonatomic) UIWindow *window; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /framework/Source/GPUImageLuminanceRangeFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageLuminanceRangeFilter : GPUImageFilter 4 | { 5 | GLint rangeReductionUniform; 6 | } 7 | 8 | /** The degree to reduce the luminance range, from 0.0 to 1.0. Default is 0.6. 9 | */ 10 | @property(readwrite, nonatomic) CGFloat rangeReductionFactor; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /framework/Source/GPUImageDissolveBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageDissolveBlendFilter : GPUImageTwoInputFilter 4 | { 5 | GLint mixUniform; 6 | } 7 | 8 | // Mix ranges from 0.0 (only image 1) to 1.0 (only image 2), with 0.5 (half of either) as the normal level 9 | @property(readwrite, nonatomic) CGFloat mix; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /examples/Mac/MultiViewFilterExample/MultiViewFilterExample/Shader2.fsh: -------------------------------------------------------------------------------- 1 | varying vec2 textureCoordinate; 2 | 3 | uniform sampler2D inputImageTexture; 4 | 5 | const vec2 sampleDivisor = vec2(0.1, 0.1); 6 | 7 | void main() 8 | { 9 | vec2 samplePos = textureCoordinate - mod(textureCoordinate, sampleDivisor); 10 | gl_FragColor = texture2D(inputImageTexture, samplePos ); 11 | } -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/VideoFilteringBenchmarkController.h: -------------------------------------------------------------------------------- 1 | #import "BenchmarkTableViewController.h" 2 | #import "VideoFilteringDisplayController.h" 3 | 4 | @interface VideoFilteringBenchmarkController : BenchmarkTableViewController 5 | { 6 | VideoFilteringDisplayController *videoFilteringDisplayController; 7 | } 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /examples/iOS/CubeExample/Classes/CubeExampleAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class DisplayViewController; 4 | 5 | @interface CubeExampleAppDelegate : NSObject 6 | { 7 | DisplayViewController *rootViewController; 8 | 9 | UIWindow *window; 10 | } 11 | 12 | @property (strong, nonatomic) UIWindow *window; 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /framework/Source/GPUImageAverageLuminanceThresholdFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @interface GPUImageAverageLuminanceThresholdFilter : GPUImageFilterGroup 4 | 5 | // This is multiplied by the continually calculated average image luminosity to arrive at the final threshold. Default is 1.0. 6 | @property(readwrite, nonatomic) CGFloat thresholdMultiplier; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /framework/Source/GPUImageGrayscaleFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | extern NSString *const kGPUImageLuminanceFragmentShaderString; 4 | 5 | /** Converts an image to grayscale (a slightly faster implementation of the saturation filter, without the ability to vary the color contribution) 6 | */ 7 | @interface GPUImageGrayscaleFilter : GPUImageFilter 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /examples/iOS/ColorObjectTracking/ColorObjectTracking/ColorTrackingAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class ColorTrackingViewController; 4 | 5 | @interface ColorTrackingAppDelegate : UIResponder 6 | { 7 | ColorTrackingViewController *colorTrackingViewController; 8 | } 9 | 10 | @property (strong, nonatomic) UIWindow *window; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFilter/SimpleVideoFilter/SimpleVideoFilterAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | @class SimpleVideoFilterViewController; 3 | 4 | @interface SimpleVideoFilterAppDelegate : UIResponder 5 | { 6 | SimpleVideoFilterViewController *rootViewController; 7 | } 8 | 9 | @property (strong, nonatomic) UIWindow *window; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSharpenFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageSharpenFilter : GPUImageFilter 4 | { 5 | GLint sharpnessUniform; 6 | GLint imageWidthFactorUniform, imageHeightFactorUniform; 7 | } 8 | 9 | // Sharpness ranges from -4.0 to 4.0, with 0.0 as the normal level 10 | @property(readwrite, nonatomic) CGFloat sharpness; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /examples/Mac/SimplePhotoFilter/SimplePhotoFilter/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SimplePhotoFilter 4 | // 5 | // Created by Brad Larson on 4/20/2013. 6 | // Copyright (c) 2013 Sunset Lake Software LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /examples/iOS/SimpleImageFilter/SimpleImageFilter/SimpleImageAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImage.h" 3 | #import "SimpleImageViewController.h" 4 | 5 | @interface SimpleImageAppDelegate : UIResponder 6 | { 7 | SimpleImageViewController *rootViewController; 8 | } 9 | 10 | @property (strong, nonatomic) UIWindow *window; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /framework/Source/GPUImageTextureInput.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageOutput.h" 2 | 3 | @interface GPUImageTextureInput : GPUImageOutput 4 | { 5 | CGSize textureSize; 6 | } 7 | 8 | // Initialization and teardown 9 | - (id)initWithTexture:(GLuint)newInputTexture size:(CGSize)newTextureSize; 10 | 11 | // Image rendering 12 | - (void)processTextureWithFrameTime:(CMTime)frameTime; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /framework/Source/GPUImageContrastFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | /** Adjusts the contrast of the image 4 | */ 5 | @interface GPUImageContrastFilter : GPUImageFilter 6 | { 7 | GLint contrastUniform; 8 | } 9 | 10 | /** Contrast ranges from 0.0 to 4.0 (max contrast), with 1.0 as the normal level 11 | */ 12 | @property(readwrite, nonatomic) CGFloat contrast; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /examples/iOS/MultiViewFilterExample/MultiViewFilterExample/Shader2.fsh: -------------------------------------------------------------------------------- 1 | varying highp vec2 textureCoordinate; 2 | 3 | uniform sampler2D inputImageTexture; 4 | 5 | const highp vec2 sampleDivisor = vec2(0.1, 0.1); 6 | 7 | void main() 8 | { 9 | highp vec2 samplePos = textureCoordinate - mod(textureCoordinate, sampleDivisor); 10 | gl_FragColor = texture2D(inputImageTexture, samplePos ); 11 | } -------------------------------------------------------------------------------- /examples/Mac/SimplePhotoFilter/SimplePhotoFilter/SLSDocument.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface SLSDocument : NSDocument 5 | { 6 | GPUImagePicture *inputPicture; 7 | GPUImageFilter *imageFilter; 8 | } 9 | 10 | @property(readwrite, weak) IBOutlet GPUImageView *imageView; 11 | @property(readwrite, nonatomic) CGFloat sliderSetting; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFileFilter/SimpleVideoFileFilter/SimpleVideoFileFilterAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | @class SimpleVideoFileFilterViewController; 3 | 4 | @interface SimpleVideoFileFilterAppDelegate : UIResponder 5 | { 6 | SimpleVideoFileFilterViewController *rootViewController; 7 | } 8 | 9 | @property (strong, nonatomic) UIWindow *window; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /framework/Source/GPUImageStretchDistortionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | /** Creates a stretch distortion of the image 4 | */ 5 | @interface GPUImageStretchDistortionFilter : GPUImageFilter { 6 | GLint centerUniform; 7 | } 8 | 9 | /** The center about which to apply the distortion, with a default of (0.5, 0.5) 10 | */ 11 | @property(readwrite, nonatomic) CGPoint center; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /examples/iOS/FilterShowcaseSwift/FilterShowcaseSwift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | @UIApplicationMain 4 | class AppDelegate: UIResponder, UIApplicationDelegate { 5 | 6 | var window: UIWindow? 7 | 8 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { 9 | return true 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFilter/SimpleVideoFilter/SimpleVideoFilterViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImage.h" 3 | 4 | @interface SimpleVideoFilterViewController : UIViewController 5 | { 6 | GPUImageVideoCamera *videoCamera; 7 | GPUImageOutput *filter; 8 | GPUImageMovieWriter *movieWriter; 9 | } 10 | 11 | - (IBAction)updateSliderValue:(id)sender; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /framework/Source/GPUImagePerlinNoiseFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImagePerlinNoiseFilter : GPUImageFilter 4 | { 5 | GLint scaleUniform, colorStartUniform, colorFinishUniform; 6 | } 7 | 8 | @property (readwrite, nonatomic) GPUVector4 colorStart; 9 | @property (readwrite, nonatomic) GPUVector4 colorFinish; 10 | 11 | @property (readwrite, nonatomic) float scale; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /examples/iOS/SimpleSwiftVideoFilterExample/SimpleSwiftVideoFilterExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | @UIApplicationMain 4 | class AppDelegate: UIResponder, UIApplicationDelegate { 5 | 6 | var window: UIWindow? 7 | 8 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { 9 | return true 10 | } 11 | } -------------------------------------------------------------------------------- /examples/iOS/CubeExample/CubeExample_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CubeExample' target in the 'CubeExample' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /framework/Source/GPUImageJFAVoronoiFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageJFAVoronoiFilter : GPUImageFilter 4 | { 5 | GLuint secondFilterOutputTexture; 6 | GLuint secondFilterFramebuffer; 7 | 8 | 9 | GLint sampleStepUniform; 10 | GLint sizeUniform; 11 | NSUInteger numPasses; 12 | 13 | } 14 | 15 | @property (nonatomic, readwrite) CGSize sizeInPixels; 16 | 17 | @end -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/ShowcaseAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class ShowcaseFilterListController; 4 | 5 | @interface ShowcaseAppDelegate : UIResponder 6 | { 7 | UINavigationController *filterNavigationController; 8 | 9 | ShowcaseFilterListController *filterListController; 10 | } 11 | 12 | @property (strong, nonatomic) UIWindow *window; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSaturationFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | /** Adjusts the saturation of an image 4 | */ 5 | @interface GPUImageSaturationFilter : GPUImageFilter 6 | { 7 | GLint saturationUniform; 8 | } 9 | 10 | /** Saturation ranges from 0.0 (fully desaturated) to 2.0 (max saturation), with 1.0 as the normal level 11 | */ 12 | @property(readwrite, nonatomic) CGFloat saturation; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /examples/Mac/MultiViewFilterExample/MultiViewFilterExample/SLSAppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "SLSAppDelegate.h" 2 | 3 | @implementation SLSAppDelegate 4 | 5 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 6 | { 7 | multiViewWindowController = [[SLSMultiViewWindowController alloc] initWithWindowNibName:@"SLSMultiViewWindowController"]; 8 | [multiViewWindowController showWindow:self]; 9 | } 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /framework/Source/GPUImageMonochromeFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageMonochromeFilter : GPUImageFilter 4 | { 5 | GLint intensityUniform, filterColorUniform; 6 | } 7 | 8 | @property(readwrite, nonatomic) CGFloat intensity; 9 | @property(readwrite, nonatomic) GPUVector4 color; 10 | 11 | - (void)setColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /framework/Source/GPUImageUIElement.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageOutput.h" 2 | 3 | @interface GPUImageUIElement : GPUImageOutput 4 | 5 | // Initialization and teardown 6 | - (id)initWithView:(UIView *)inputView; 7 | - (id)initWithLayer:(CALayer *)inputLayer; 8 | 9 | // Layer management 10 | - (CGSize)layerSizeInPixels; 11 | - (void)update; 12 | - (void)updateUsingCurrentTime; 13 | - (void)updateWithTimestamp:(CMTime)frameTime; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /framework/Source/GPUImageZoomBlurFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageZoomBlurFilter : GPUImageFilter 4 | 5 | /** A multiplier for the blur size, ranging from 0.0 on up, with a default of 1.0 6 | */ 7 | @property (readwrite, nonatomic) CGFloat blurSize; 8 | 9 | /** The normalized center of the blur. (0.5, 0.5) by default 10 | */ 11 | @property (readwrite, nonatomic) CGPoint blurCenter; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /examples/iOS/RawDataTest/RawDataTest/RawDataTest-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'RawDataTest' target in the 'RawDataTest' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /framework/Source/GPUImageMotionBlurFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageMotionBlurFilter : GPUImageFilter 4 | 5 | /** A multiplier for the blur size, ranging from 0.0 on up, with a default of 1.0 6 | */ 7 | @property (readwrite, nonatomic) CGFloat blurSize; 8 | 9 | /** The angular direction of the blur, in degrees. 0 degrees by default 10 | */ 11 | @property (readwrite, nonatomic) CGFloat blurAngle; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /framework/Source/GPUImageThresholdEdgeDetectionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageSobelEdgeDetectionFilter.h" 2 | 3 | @interface GPUImageThresholdEdgeDetectionFilter : GPUImageSobelEdgeDetectionFilter 4 | { 5 | GLint thresholdUniform; 6 | } 7 | 8 | /** Any edge above this threshold will be black, and anything below white. Ranges from 0.0 to 1.0, with 0.8 as the default 9 | */ 10 | @property(readwrite, nonatomic) CGFloat threshold; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /framework/Source/GPUImageBilateralFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageGaussianBlurFilter.h" 2 | 3 | @interface GPUImageBilateralFilter : GPUImageGaussianBlurFilter 4 | { 5 | CGFloat firstDistanceNormalizationFactorUniform; 6 | CGFloat secondDistanceNormalizationFactorUniform; 7 | } 8 | // A normalization factor for the distance between central color and sample color. 9 | @property(nonatomic, readwrite) CGFloat distanceNormalizationFactor; 10 | @end 11 | -------------------------------------------------------------------------------- /examples/Mac/MultiViewFilterExample/MultiViewFilterExample/SLSMultiViewWindowController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface SLSMultiViewWindowController : NSWindowController 5 | { 6 | GPUImageFilter *filter1, *filter2, *filter3; 7 | GPUImageAVCamera *videoCamera; 8 | } 9 | 10 | @property(readwrite) IBOutlet GPUImageView *upperLeftView, *upperRightView, *lowerLeftView, *lowerRightView; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/BenchmarkSuite-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'BenchmarkSuite' target in the 'BenchmarkSuite' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/FilterShowcase-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'FilterShowcase' target in the 'FilterShowcase' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /framework/Source/GPUImageNobleCornerDetectionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageHarrisCornerDetectionFilter.h" 2 | 3 | /** Noble corner detector 4 | 5 | This is the Noble variant on the Harris detector, from 6 | Alison Noble, "Descriptions of Image Surfaces", PhD thesis, Department of Engineering Science, Oxford University 1989, p45. 7 | */ 8 | 9 | 10 | @interface GPUImageNobleCornerDetectionFilter : GPUImageHarrisCornerDetectionFilter 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Exclude the build directory 2 | build/* 3 | examples/FilterShowcase/build* 4 | 5 | # Exclude temp nibs and swap files 6 | *~.nib 7 | *.swp 8 | 9 | # Exclude OS X folder attributes 10 | .DS_Store 11 | .svn 12 | 13 | # Exclude user-specific XCode 3 and 4 files 14 | *.mode1 15 | *.mode1v3 16 | *.mode2v3 17 | *.perspective 18 | *.perspectivev3 19 | *.pbxuser 20 | *.xcworkspace 21 | xcuserdata 22 | 23 | # Documentation 24 | documentation/* 25 | 26 | -------------------------------------------------------------------------------- /examples/Mac/PlaygroundExample/PlaygroundExample/GPUImagePlayground.playground/section-1.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import GPUImage 3 | 4 | let sourceImage = NSImage(named: "ChairTest.png") 5 | let filter = GPUImageSobelEdgeDetectionFilter() 6 | let outputImage = filter.imageByFilteringImage(sourceImage) 7 | 8 | let customFilter = GPUImageFilter(fragmentShaderFromFile: "CustomFilter") 9 | 10 | let outputImage2 = customFilter.imageByFilteringImage(sourceImage) 11 | -------------------------------------------------------------------------------- /framework/Source/GPUImagePixellateFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImagePixellateFilter : GPUImageFilter 4 | { 5 | GLint fractionalWidthOfAPixelUniform, aspectRatioUniform; 6 | } 7 | 8 | // The fractional width of the image to use as a size for the pixels in the resulting image. Values below one pixel width in the source image are ignored. 9 | @property(readwrite, nonatomic) CGFloat fractionalWidthOfAPixel; 10 | 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /examples/iOS/SimpleImageFilter/SimpleImageFilter/SimpleImageFilter-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SimpleImageFilter' target in the 'SimpleImageFilter' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /examples/iOS/SimplePhotoFilter/SimplePhotoFilter/SimplePhotoFilter-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SimplePhotoFilter' target in the 'SimplePhotoFilter' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFilter/SimpleVideoFilter/SimpleVideoFilter-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SimpleVideoFilter' target in the 'SimpleVideoFilter' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /examples/Mac/FilterShowcase/FilterShowcase/SLSAppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "SLSAppDelegate.h" 2 | 3 | @implementation SLSAppDelegate 4 | 5 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 6 | { 7 | // Insert code here to initialize your application 8 | 9 | windowController = [[SLSFilterShowcaseWindowController alloc] initWithWindowNibName:@"SLSFilterShowcaseWindowController"]; 10 | [windowController showWindow:self]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /examples/iOS/ColorObjectTracking/ColorObjectTracking/ColorObjectTracking-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'ColorObjectTracking' target in the 'ColorObjectTracking' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /examples/iOS/CubeExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CubeExample 4 | // 5 | // Created by Brad Larson on 4/20/2010. 6 | // 7 | 8 | #import 9 | #import "CubeExampleAppDelegate.h" 10 | 11 | int main(int argc, char *argv[]) { 12 | 13 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, NSStringFromClass([CubeExampleAppDelegate class])); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /examples/iOS/FeatureExtractionTest/FeatureExtractionTest/FeatureExtractionTest-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'FeatureExtractionTest' target in the 'FeatureExtractionTest' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFileFilter/SimpleVideoFileFilter/SimpleVideoFileFilter-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SimpleVideoFileFilter' target in the 'SimpleVideoFileFilter' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /examples/iOS/MultiViewFilterExample/MultiViewFilterExample/MultiViewFilterExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'MultiViewFilterExample' target in the 'MultiViewFilterExample' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /framework/Source/GPUImageHighlightShadowFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageHighlightShadowFilter : GPUImageFilter 4 | { 5 | GLint shadowsUniform, highlightsUniform; 6 | } 7 | 8 | /** 9 | * 0 - 1, increase to lighten shadows. 10 | * @default 0 11 | */ 12 | @property(readwrite, nonatomic) CGFloat shadows; 13 | 14 | /** 15 | * 0 - 1, decrease to darken highlights. 16 | * @default 1 17 | */ 18 | @property(readwrite, nonatomic) CGFloat highlights; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /examples/iOS/SimpleVideoFileFilter/SimpleVideoFileFilter/SimpleVideoFileFilterViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImage.h" 3 | 4 | @interface SimpleVideoFileFilterViewController : UIViewController 5 | { 6 | GPUImageMovie *movieFile; 7 | GPUImageOutput *filter; 8 | GPUImageMovieWriter *movieWriter; 9 | NSTimer * timer; 10 | } 11 | 12 | @property (retain, nonatomic) IBOutlet UILabel *progressLabel; 13 | - (IBAction)updatePixelWidth:(id)sender; 14 | 15 | @end -------------------------------------------------------------------------------- /framework/Source/GPUImageRGBFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageRGBFilter : GPUImageFilter 4 | { 5 | GLint redUniform; 6 | GLint greenUniform; 7 | GLint blueUniform; 8 | } 9 | 10 | // Normalized values by which each color channel is multiplied. The range is from 0.0 up, with 1.0 as the default. 11 | @property (readwrite, nonatomic) CGFloat red; 12 | @property (readwrite, nonatomic) CGFloat green; 13 | @property (readwrite, nonatomic) CGFloat blue; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /framework/Source/GPUImageCrosshatchFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageCrosshatchFilter : GPUImageFilter 4 | { 5 | GLint crossHatchSpacingUniform, lineWidthUniform; 6 | } 7 | // The fractional width of the image to use as the spacing for the crosshatch. The default is 0.03. 8 | @property(readwrite, nonatomic) CGFloat crossHatchSpacing; 9 | 10 | // A relative width for the crosshatch lines. The default is 0.003. 11 | @property(readwrite, nonatomic) CGFloat lineWidth; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /framework/Source/GPUImageLuminanceThresholdFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | /** Pixels with a luminance above the threshold will appear white, and those below will be black 4 | */ 5 | @interface GPUImageLuminanceThresholdFilter : GPUImageFilter 6 | { 7 | GLint thresholdUniform; 8 | } 9 | 10 | /** Anything above this luminance will be white, and anything below black. Ranges from 0.0 to 1.0, with 0.5 as the default 11 | */ 12 | @property(readwrite, nonatomic) CGFloat threshold; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /framework/Source/GPUImagePolarPixellateFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImagePolarPixellateFilter : GPUImageFilter { 4 | GLint centerUniform, pixelSizeUniform; 5 | } 6 | 7 | // The center about which to apply the distortion, with a default of (0.5, 0.5) 8 | @property(readwrite, nonatomic) CGPoint center; 9 | // The amount of distortion to apply, from (-2.0, -2.0) to (2.0, 2.0), with a default of (0.05, 0.05) 10 | @property(readwrite, nonatomic) CGSize pixelSize; 11 | 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /framework/Source/GPUImageCropFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageCropFilter : GPUImageFilter 4 | { 5 | GLfloat cropTextureCoordinates[8]; 6 | } 7 | 8 | // The crop region is the rectangle within the image to crop. It is normalized to a coordinate space from 0.0 to 1.0, with 0.0, 0.0 being the upper left corner of the image 9 | @property(readwrite, nonatomic) CGRect cropRegion; 10 | 11 | // Initialization and teardown 12 | - (id)initWithCropRegion:(CGRect)newCropRegion; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /framework/Source/GPUImagePosterizeFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | /** This reduces the color dynamic range into the number of steps specified, leading to a cartoon-like simple shading of the image. 4 | */ 5 | @interface GPUImagePosterizeFilter : GPUImageFilter 6 | { 7 | GLint colorLevelsUniform; 8 | } 9 | 10 | /** The number of color levels to reduce the image space to. This ranges from 1 to 256, with a default of 10. 11 | */ 12 | @property(readwrite, nonatomic) NSUInteger colorLevels; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSepiaFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageSepiaFilter.h" 2 | 3 | @implementation GPUImageSepiaFilter 4 | 5 | - (id)init; 6 | { 7 | if (!(self = [super init])) 8 | { 9 | return nil; 10 | } 11 | 12 | self.intensity = 1.0; 13 | self.colorMatrix = (GPUMatrix4x4){ 14 | {0.3588, 0.7044, 0.1368, 0.0}, 15 | {0.2990, 0.5870, 0.1140, 0.0}, 16 | {0.2392, 0.4696, 0.0912 ,0.0}, 17 | {0,0,0,1.0}, 18 | }; 19 | 20 | return self; 21 | } 22 | 23 | @end 24 | 25 | -------------------------------------------------------------------------------- /examples/iOS/CubeExample/Classes/DisplayViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import "ESRenderer.h" 5 | #import "ES2Renderer.h" 6 | #import "GPUImage.h" 7 | 8 | @interface DisplayViewController : UIViewController 9 | { 10 | CGPoint lastMovementPosition; 11 | @private 12 | ES2Renderer *renderer; 13 | GPUImageTextureInput *textureInput; 14 | GPUImageFilter *filter; 15 | 16 | NSDate *startTime; 17 | } 18 | 19 | - (void)drawView:(id)sender; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/BenchmarkAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | @class ImageFilteringBenchmarkController, VideoFilteringBenchmarkController; 3 | 4 | @interface BenchmarkAppDelegate : UIResponder 5 | { 6 | UITabBarController *mainTabBarController; 7 | ImageFilteringBenchmarkController *imageFilteringBenchmarkController; 8 | VideoFilteringBenchmarkController *videoFilteringBenchmarkController; 9 | } 10 | 11 | @property (strong, nonatomic) UIWindow *window; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /framework/Source/GPUImageAmatorkaFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImagePicture; 4 | 5 | /** A photo filter based on Photoshop action by Amatorka 6 | http://amatorka.deviantart.com/art/Amatorka-Action-2-121069631 7 | */ 8 | 9 | // Note: If you want to use this effect you have to add lookup_amatorka.png 10 | // from Resources folder to your application bundle. 11 | 12 | @interface GPUImageAmatorkaFilter : GPUImageFilterGroup 13 | { 14 | GPUImagePicture *lookupImageSource; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /framework/Source/GPUImageThresholdedNonMaximumSuppressionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImage3x3TextureSamplingFilter.h" 2 | 3 | @interface GPUImageThresholdedNonMaximumSuppressionFilter : GPUImage3x3TextureSamplingFilter 4 | { 5 | GLint thresholdUniform; 6 | } 7 | 8 | /** Any local maximum above this threshold will be white, and anything below black. Ranges from 0.0 to 1.0, with 0.8 as the default 9 | */ 10 | @property(readwrite, nonatomic) CGFloat threshold; 11 | 12 | - (id)initWithPackedColorspace:(BOOL)inputUsesPackedColorspace; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /examples/iOS/SimpleImageFilter/SimpleImageFilter/SimpleImageViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImage.h" 3 | 4 | @interface SimpleImageViewController : UIViewController 5 | { 6 | GPUImagePicture *sourcePicture; 7 | GPUImageOutput *sepiaFilter, *sepiaFilter2; 8 | 9 | UISlider *imageSlider; 10 | } 11 | 12 | // Image filtering 13 | - (void)setupDisplayFiltering; 14 | - (void)setupImageFilteringToDisk; 15 | - (void)setupImageResampling; 16 | 17 | - (IBAction)updateSliderValue:(id)sender; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /framework/Source/GPUImageLowPassFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | #import "GPUImageBuffer.h" 3 | #import "GPUImageDissolveBlendFilter.h" 4 | 5 | @interface GPUImageLowPassFilter : GPUImageFilterGroup 6 | { 7 | GPUImageBuffer *bufferFilter; 8 | GPUImageDissolveBlendFilter *dissolveBlendFilter; 9 | } 10 | 11 | // This controls the degree by which the previous accumulated frames are blended with the current one. This ranges from 0.0 to 1.0, with a default of 0.5. 12 | @property(readwrite, nonatomic) CGFloat filterStrength; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /framework/Source/GPUImageMissEtikateFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImagePicture; 4 | 5 | /** A photo filter based on Photoshop action by Miss Etikate: 6 | http://miss-etikate.deviantart.com/art/Photoshop-Action-15-120151961 7 | */ 8 | 9 | // Note: If you want to use this effect you have to add lookup_miss_etikate.png 10 | // from Resources folder to your application bundle. 11 | 12 | @interface GPUImageMissEtikateFilter : GPUImageFilterGroup 13 | { 14 | GPUImagePicture *lookupImageSource; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /examples/iOS/SimplePhotoFilter/SimplePhotoFilter/PhotoViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImage.h" 3 | 4 | @interface PhotoViewController : UIViewController 5 | { 6 | GPUImageStillCamera *stillCamera; 7 | GPUImageOutput *filter, *secondFilter, *terminalFilter; 8 | UISlider *filterSettingsSlider; 9 | UIButton *photoCaptureButton; 10 | 11 | GPUImagePicture *memoryPressurePicture1, *memoryPressurePicture2; 12 | } 13 | 14 | - (IBAction)updateSliderValue:(id)sender; 15 | - (IBAction)takePhoto:(id)sender; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /examples/Mac/FilterShowcaseSwift/FilterShowcaseSwift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | class AppDelegate: NSObject, NSApplicationDelegate { 4 | 5 | var windowController:FilterShowcaseWindowController? 6 | 7 | func applicationDidFinishLaunching(aNotification: NSNotification?) { 8 | self.windowController = FilterShowcaseWindowController(windowNibName:"FilterShowcaseWindowController") 9 | self.windowController?.showWindow(self) 10 | } 11 | 12 | func applicationWillTerminate(aNotification: NSNotification?) { 13 | } 14 | } -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/ImageFilteringBenchmarkController.h: -------------------------------------------------------------------------------- 1 | #import "BenchmarkTableViewController.h" 2 | 3 | @interface ImageFilteringBenchmarkController : BenchmarkTableViewController 4 | { 5 | CIContext *coreImageContext; 6 | } 7 | 8 | // Still image benchmarks 9 | - (UIImage *)imageProcessedOnCPU:(UIImage *)imageToProcess; 10 | - (UIImage *)imageProcessedUsingCoreImage:(UIImage *)imageToProcess; 11 | - (UIImage *)imageProcessedUsingGPUImage:(UIImage *)imageToProcess; 12 | - (void)writeImage:(UIImage *)imageToWrite toFile:(NSString *)fileName; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /framework/Source/GPUImageRGBOpeningFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImageRGBErosionFilter; 4 | @class GPUImageRGBDilationFilter; 5 | 6 | // A filter that first performs an erosion on each color channel of an image, followed by a dilation of the same radius. 7 | // This helps to filter out smaller bright elements. 8 | 9 | @interface GPUImageRGBOpeningFilter : GPUImageFilterGroup 10 | { 11 | GPUImageRGBErosionFilter *erosionFilter; 12 | GPUImageRGBDilationFilter *dilationFilter; 13 | } 14 | 15 | - (id)initWithRadius:(NSUInteger)radius; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /framework/Source/GPUImageUnsharpMaskFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImageGaussianBlurFilter; 4 | 5 | @interface GPUImageUnsharpMaskFilter : GPUImageFilterGroup 6 | { 7 | GPUImageGaussianBlurFilter *blurFilter; 8 | GPUImageFilter *unsharpMaskFilter; 9 | } 10 | // The blur radius of the underlying Gaussian blur. The default is 4.0. 11 | @property (readwrite, nonatomic) CGFloat blurRadiusInPixels; 12 | 13 | // The strength of the sharpening, from 0.0 on up, with a default of 1.0 14 | @property(readwrite, nonatomic) CGFloat intensity; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /framework/Source/GPUImageRGBClosingFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImageRGBErosionFilter; 4 | @class GPUImageRGBDilationFilter; 5 | 6 | // A filter that first performs a dilation on each color channel of an image, followed by an erosion of the same radius. 7 | // This helps to filter out smaller dark elements. 8 | 9 | @interface GPUImageRGBClosingFilter : GPUImageFilterGroup 10 | { 11 | GPUImageRGBErosionFilter *erosionFilter; 12 | GPUImageRGBDilationFilter *dilationFilter; 13 | } 14 | 15 | - (id)initWithRadius:(NSUInteger)radius; 16 | 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /framework/Source/GPUImageHighPassFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | #import "GPUImageLowPassFilter.h" 3 | #import "GPUImageDifferenceBlendFilter.h" 4 | 5 | @interface GPUImageHighPassFilter : GPUImageFilterGroup 6 | { 7 | GPUImageLowPassFilter *lowPassFilter; 8 | GPUImageDifferenceBlendFilter *differenceBlendFilter; 9 | } 10 | 11 | // This controls the degree by which the previous accumulated frames are blended and then subtracted from the current one. This ranges from 0.0 to 1.0, with a default of 0.5. 12 | @property(readwrite, nonatomic) CGFloat filterStrength; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /framework/Source/GPUImageShiTomasiFeatureDetectionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageHarrisCornerDetectionFilter.h" 2 | 3 | /** Shi-Tomasi feature detector 4 | 5 | This is the Shi-Tomasi feature detector, as described in 6 | J. Shi and C. Tomasi. Good features to track. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 593-600, June 1994. 7 | */ 8 | 9 | @interface GPUImageShiTomasiFeatureDetectionFilter : GPUImageHarrisCornerDetectionFilter 10 | 11 | // Compared to the Harris corner detector, the default sensitivity value for this detector is set to 1.5 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /framework/Source/GPUImageColorMatrixFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | /** Transforms the colors of an image by applying a matrix to them 4 | */ 5 | @interface GPUImageColorMatrixFilter : GPUImageFilter 6 | { 7 | GLint colorMatrixUniform; 8 | GLint intensityUniform; 9 | } 10 | 11 | /** A 4x4 matrix used to transform each color in an image 12 | */ 13 | @property(readwrite, nonatomic) GPUMatrix4x4 colorMatrix; 14 | 15 | /** The degree to which the new transformed color replaces the original color for each pixel 16 | */ 17 | @property(readwrite, nonatomic) CGFloat intensity; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /examples/Mac/FilterShowcase/FilterShowcase/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /framework/Source/GPUImageRGBErosionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoPassTextureSamplingFilter.h" 2 | 3 | // For each pixel, this sets it to the minimum value of each color channel in a rectangular neighborhood extending out dilationRadius pixels from the center. 4 | // This extends out dark features, and can be used for abstraction of color images. 5 | 6 | @interface GPUImageRGBErosionFilter : GPUImageTwoPassTextureSamplingFilter 7 | 8 | // Acceptable values for erosionRadius, which sets the distance in pixels to sample out from the center, are 1, 2, 3, and 4. 9 | - (id)initWithRadius:(NSUInteger)erosionRadius; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /examples/Mac/SimplePhotoFilter/SimplePhotoFilter/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /framework/Source/GPUImageRGBDilationFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoPassTextureSamplingFilter.h" 2 | 3 | // For each pixel, this sets it to the maximum value of each color channel in a rectangular neighborhood extending out dilationRadius pixels from the center. 4 | // This extends out brighter colors, and can be used for abstraction of color images. 5 | 6 | @interface GPUImageRGBDilationFilter : GPUImageTwoPassTextureSamplingFilter 7 | 8 | // Acceptable values for dilationRadius, which sets the distance in pixels to sample out from the center, are 1, 2, 3, and 4. 9 | - (id)initWithRadius:(NSUInteger)dilationRadius; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /framework/Source/GPUImageErosionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoPassTextureSamplingFilter.h" 2 | 3 | // For each pixel, this sets it to the minimum value of the red channel in a rectangular neighborhood extending out dilationRadius pixels from the center. 4 | // This extends out dark features, and is most commonly used with black-and-white thresholded images. 5 | 6 | @interface GPUImageErosionFilter : GPUImageTwoPassTextureSamplingFilter 7 | 8 | // Acceptable values for erosionRadius, which sets the distance in pixels to sample out from the center, are 1, 2, 3, and 4. 9 | - (id)initWithRadius:(NSUInteger)erosionRadius; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /framework/Source/GPUImageWhiteBalanceFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | /** 3 | * Created by Alaric Cole 4 | * Allows adjustment of color temperature in terms of what an image was effectively shot in. This means higher Kelvin values will warm the image, while lower values will cool it. 5 | 6 | */ 7 | @interface GPUImageWhiteBalanceFilter : GPUImageFilter 8 | { 9 | GLint temperatureUniform, tintUniform; 10 | } 11 | //choose color temperature, in degrees Kelvin 12 | @property(readwrite, nonatomic) CGFloat temperature; 13 | 14 | //adjust tint to compensate 15 | @property(readwrite, nonatomic) CGFloat tint; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /examples/Mac/MultiViewFilterExample/MultiViewFilterExample/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSoftEleganceFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImagePicture; 4 | 5 | /** A photo filter based on Soft Elegance Photoshop action 6 | http://h-d-stock.deviantart.com/art/H-D-A-soft-elegance-70107603 7 | */ 8 | 9 | // Note: If you want to use this effect you have to add 10 | // lookup_soft_elegance_1.png and lookup_soft_elegance_2.png 11 | // from Resources folder to your application bundle. 12 | 13 | @interface GPUImageSoftEleganceFilter : GPUImageFilterGroup 14 | { 15 | GPUImagePicture *lookupImageSource1; 16 | GPUImagePicture *lookupImageSource2; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /framework/Source/GPUImageMovieComposition.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPUImageMovieComposition.h 3 | // Givit 4 | // 5 | // Created by Sean Meiners on 2013/01/25. 6 | // 7 | // 8 | 9 | #import "GPUImageMovie.h" 10 | 11 | @interface GPUImageMovieComposition : GPUImageMovie 12 | 13 | @property (readwrite, retain) AVComposition *compositon; 14 | @property (readwrite, retain) AVVideoComposition *videoComposition; 15 | @property (readwrite, retain) AVAudioMix *audioMix; 16 | 17 | - (id)initWithComposition:(AVComposition*)compositon 18 | andVideoComposition:(AVVideoComposition*)videoComposition 19 | andAudioMix:(AVAudioMix*)audioMix; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /framework/Source/iOS/GPUImagePicture+TextureSubimage.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPUImagePicture+TextureSubimage.h 3 | // GPUImage 4 | // 5 | // Created by Jack Wu on 2014-05-28. 6 | // Copyright (c) 2014 Brad Larson. All rights reserved. 7 | // 8 | 9 | #import "GPUImagePicture.h" 10 | 11 | @interface GPUImagePicture (TextureSubimage) 12 | 13 | - (void)replaceTextureWithSubimage:(UIImage*)subimage; 14 | - (void)replaceTextureWithSubCGImage:(CGImageRef)subimageSource; 15 | 16 | - (void)replaceTextureWithSubimage:(UIImage*)subimage inRect:(CGRect)subRect; 17 | - (void)replaceTextureWithSubCGImage:(CGImageRef)subimageSource inRect:(CGRect)subRect; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /framework/Source/GPUImageClosingFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImageErosionFilter; 4 | @class GPUImageDilationFilter; 5 | 6 | // A filter that first performs a dilation on the red channel of an image, followed by an erosion of the same radius. 7 | // This helps to filter out smaller dark elements. 8 | 9 | @interface GPUImageClosingFilter : GPUImageFilterGroup 10 | { 11 | GPUImageErosionFilter *erosionFilter; 12 | GPUImageDilationFilter *dilationFilter; 13 | } 14 | 15 | @property(readwrite, nonatomic) CGFloat verticalTexelSpacing, horizontalTexelSpacing; 16 | 17 | - (id)initWithRadius:(NSUInteger)radius; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /framework/Source/GPUImageTwoInputCrossTextureSamplingFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageTwoInputCrossTextureSamplingFilter : GPUImageTwoInputFilter 4 | { 5 | GLint texelWidthUniform, texelHeightUniform; 6 | 7 | CGFloat texelWidth, texelHeight; 8 | BOOL hasOverriddenImageSizeFactor; 9 | } 10 | 11 | // The texel width and height determines how far out to sample from this texel. By default, this is the normalized width of a pixel, but this can be overridden for different effects. 12 | @property(readwrite, nonatomic) CGFloat texelWidth; 13 | @property(readwrite, nonatomic) CGFloat texelHeight; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /examples/Mac/MultiViewFilterExample/MultiViewFilterExample/Shader1.fsh: -------------------------------------------------------------------------------- 1 | varying vec2 textureCoordinate; 2 | 3 | uniform sampler2D inputImageTexture; 4 | 5 | void main() 6 | { 7 | vec3 tc = vec3(1.0, 0.0, 0.0); 8 | 9 | vec3 pixcol = texture2D(inputImageTexture, textureCoordinate).rgb; 10 | vec3 colors[3]; 11 | colors[0] = vec3(0.0, 0.0, 1.0); 12 | colors[1] = vec3(1.0, 1.0, 0.0); 13 | colors[2] = vec3(1.0, 0.0, 0.0); 14 | float lum = (pixcol.r + pixcol.g + pixcol.b) / 3.0; 15 | int ix = (lum < 0.5)? 0:1; 16 | tc = mix(colors[ix], colors[ix + 1], (lum - float(ix) * 0.5) / 0.5); 17 | 18 | gl_FragColor = vec4(tc, 1.0); 19 | } -------------------------------------------------------------------------------- /framework/Source/GPUImageOpeningFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImageErosionFilter; 4 | @class GPUImageDilationFilter; 5 | 6 | // A filter that first performs an erosion on the red channel of an image, followed by a dilation of the same radius. 7 | // This helps to filter out smaller bright elements. 8 | 9 | @interface GPUImageOpeningFilter : GPUImageFilterGroup 10 | { 11 | GPUImageErosionFilter *erosionFilter; 12 | GPUImageDilationFilter *dilationFilter; 13 | } 14 | 15 | @property(readwrite, nonatomic) CGFloat verticalTexelSpacing, horizontalTexelSpacing; 16 | 17 | - (id)initWithRadius:(NSUInteger)radius; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSphereRefractionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageSphereRefractionFilter : GPUImageFilter 4 | { 5 | GLint radiusUniform, centerUniform, aspectRatioUniform, refractiveIndexUniform; 6 | } 7 | 8 | /// The center about which to apply the distortion, with a default of (0.5, 0.5) 9 | @property(readwrite, nonatomic) CGPoint center; 10 | /// The radius of the distortion, ranging from 0.0 to 1.0, with a default of 0.25 11 | @property(readwrite, nonatomic) CGFloat radius; 12 | /// The index of refraction for the sphere, with a default of 0.71 13 | @property(readwrite, nonatomic) CGFloat refractiveIndex; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/CustomFilter.fsh: -------------------------------------------------------------------------------- 1 | varying highp vec2 textureCoordinate; 2 | 3 | uniform sampler2D inputImageTexture; 4 | 5 | void main() 6 | { 7 | lowp vec3 tc = vec3(1.0, 0.0, 0.0); 8 | 9 | lowp vec3 pixcol = texture2D(inputImageTexture, textureCoordinate).rgb; 10 | lowp vec3 colors[3]; 11 | colors[0] = vec3(0.0, 0.0, 1.0); 12 | colors[1] = vec3(1.0, 1.0, 0.0); 13 | colors[2] = vec3(1.0, 0.0, 0.0); 14 | mediump float lum = (pixcol.r + pixcol.g + pixcol.b) / 3.0; 15 | int ix = (lum < 0.5)? 0:1; 16 | tc = mix(colors[ix], colors[ix + 1], (lum - float(ix) * 0.5) / 0.5); 17 | 18 | gl_FragColor = vec4(tc, 1.0); 19 | } -------------------------------------------------------------------------------- /framework/Source/GPUImageTextureOutput.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImageContext.h" 3 | 4 | @protocol GPUImageTextureOutputDelegate; 5 | 6 | @interface GPUImageTextureOutput : NSObject 7 | { 8 | GPUImageFramebuffer *firstInputFramebuffer; 9 | } 10 | 11 | @property(readwrite, unsafe_unretained, nonatomic) id delegate; 12 | @property(readonly) GLuint texture; 13 | @property(nonatomic) BOOL enabled; 14 | 15 | - (void)doneWithTexture; 16 | 17 | @end 18 | 19 | @protocol GPUImageTextureOutputDelegate 20 | - (void)newFrameReadyFromTextureOutput:(GPUImageTextureOutput *)callbackTextureOutput; 21 | @end 22 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSwirlFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | /** Creates a swirl distortion on the image 4 | */ 5 | @interface GPUImageSwirlFilter : GPUImageFilter 6 | { 7 | GLint radiusUniform, centerUniform, angleUniform; 8 | } 9 | 10 | /// The center about which to apply the distortion, with a default of (0.5, 0.5) 11 | @property(readwrite, nonatomic) CGPoint center; 12 | /// The radius of the distortion, ranging from 0.0 to 1.0, with a default of 0.5 13 | @property(readwrite, nonatomic) CGFloat radius; 14 | /// The amount of distortion to apply, with a minimum of 0.0 and a default of 1.0 15 | @property(readwrite, nonatomic) CGFloat angle; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /framework/Source/GPUImageThreeInputFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | extern NSString *const kGPUImageThreeInputTextureVertexShaderString; 4 | 5 | @interface GPUImageThreeInputFilter : GPUImageTwoInputFilter 6 | { 7 | GPUImageFramebuffer *thirdInputFramebuffer; 8 | 9 | GLint filterThirdTextureCoordinateAttribute; 10 | GLint filterInputTextureUniform3; 11 | GPUImageRotationMode inputRotation3; 12 | GLuint filterSourceTexture3; 13 | CMTime thirdFrameTime; 14 | 15 | BOOL hasSetSecondTexture, hasReceivedThirdFrame, thirdFrameWasVideo; 16 | BOOL thirdFrameCheckDisabled; 17 | } 18 | 19 | - (void)disableThirdFrameCheck; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /examples/iOS/MultiViewFilterExample/MultiViewFilterExample/Shader1.fsh: -------------------------------------------------------------------------------- 1 | varying highp vec2 textureCoordinate; 2 | 3 | uniform sampler2D inputImageTexture; 4 | 5 | void main() 6 | { 7 | lowp vec3 tc = vec3(1.0, 0.0, 0.0); 8 | 9 | lowp vec3 pixcol = texture2D(inputImageTexture, textureCoordinate).rgb; 10 | lowp vec3 colors[3]; 11 | colors[0] = vec3(0.0, 0.0, 1.0); 12 | colors[1] = vec3(1.0, 1.0, 0.0); 13 | colors[2] = vec3(1.0, 0.0, 0.0); 14 | mediump float lum = (pixcol.r + pixcol.g + pixcol.b) / 3.0; 15 | int ix = (lum < 0.5)? 0:1; 16 | tc = mix(colors[ix], colors[ix + 1], (lum - float(ix) * 0.5) / 0.5); 17 | 18 | gl_FragColor = vec4(tc, 1.0); 19 | } -------------------------------------------------------------------------------- /examples/Mac/PlaygroundExample/PlaygroundExample/GPUImagePlayground.playground/Resources/CustomFilter.fsh: -------------------------------------------------------------------------------- 1 | varying vec2 textureCoordinate; 2 | 3 | uniform sampler2D inputImageTexture; 4 | 5 | void main() 6 | { 7 | vec3 tc = vec3(1.0, 0.0, 0.0); 8 | 9 | vec3 pixcol = texture2D(inputImageTexture, textureCoordinate).rgb; 10 | vec3 colors[3]; 11 | colors[0] = vec3(0.0, 0.0, 1.0); 12 | colors[1] = vec3(1.0, 1.0, 0.0); 13 | colors[2] = vec3(1.0, 0.0, 0.0); 14 | float lum = (pixcol.r + pixcol.g + pixcol.b) / 3.0; 15 | int ix = (lum < 0.5)? 0:1; 16 | tc = mix(colors[ix], colors[ix + 1], (lum - float(ix) * 0.5) / 0.5); 17 | 18 | gl_FragColor = vec4(tc, 1.0); 19 | } -------------------------------------------------------------------------------- /framework/Source/GPUImageBulgeDistortionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | /// Creates a bulge distortion on the image 4 | @interface GPUImageBulgeDistortionFilter : GPUImageFilter 5 | { 6 | GLint aspectRatioUniform, radiusUniform, centerUniform, scaleUniform; 7 | } 8 | 9 | /// The center about which to apply the distortion, with a default of (0.5, 0.5) 10 | @property(readwrite, nonatomic) CGPoint center; 11 | /// The radius of the distortion, ranging from 0.0 to 1.0, with a default of 0.25 12 | @property(readwrite, nonatomic) CGFloat radius; 13 | /// The amount of distortion to apply, from -1.0 to 1.0, with a default of 0.5 14 | @property(readwrite, nonatomic) CGFloat scale; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /framework/Source/GPUImage3x3TextureSamplingFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | extern NSString *const kGPUImageNearbyTexelSamplingVertexShaderString; 4 | 5 | @interface GPUImage3x3TextureSamplingFilter : GPUImageFilter 6 | { 7 | GLint texelWidthUniform, texelHeightUniform; 8 | 9 | CGFloat texelWidth, texelHeight; 10 | BOOL hasOverriddenImageSizeFactor; 11 | } 12 | 13 | // The texel width and height determines how far out to sample from this texel. By default, this is the normalized width of a pixel, but this can be overridden for different effects. 14 | @property(readwrite, nonatomic) CGFloat texelWidth; 15 | @property(readwrite, nonatomic) CGFloat texelHeight; 16 | 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /framework/Source/GPUImageFalseColorFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageFalseColorFilter : GPUImageFilter 4 | { 5 | GLint firstColorUniform, secondColorUniform; 6 | } 7 | 8 | // The first and second colors specify what colors replace the dark and light areas of the image, respectively. The defaults are (0.0, 0.0, 0.5) amd (1.0, 0.0, 0.0). 9 | @property(readwrite, nonatomic) GPUVector4 firstColor; 10 | @property(readwrite, nonatomic) GPUVector4 secondColor; 11 | 12 | - (void)setFirstColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent; 13 | - (void)setSecondColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /framework/Source/GPUImagePoissonBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputCrossTextureSamplingFilter.h" 2 | #import "GPUImageFilterGroup.h" 3 | 4 | @interface GPUImagePoissonBlendFilter : GPUImageTwoInputCrossTextureSamplingFilter 5 | { 6 | GLint mixUniform; 7 | 8 | GPUImageFramebuffer *secondOutputFramebuffer; 9 | } 10 | 11 | // Mix ranges from 0.0 (only image 1) to 1.0 (only image 2 gradients), with 1.0 as the normal level 12 | @property(readwrite, nonatomic) CGFloat mix; 13 | 14 | // The number of times to propagate the gradients. 15 | // Crank this up to 100 or even 1000 if you want to get anywhere near convergence. Yes, this will be slow. 16 | @property(readwrite, nonatomic) NSUInteger numIterations; 17 | 18 | @end -------------------------------------------------------------------------------- /framework/Source/GPUImageAverageColor.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | extern NSString *const kGPUImageColorAveragingVertexShaderString; 4 | 5 | @interface GPUImageAverageColor : GPUImageFilter 6 | { 7 | GLint texelWidthUniform, texelHeightUniform; 8 | 9 | NSUInteger numberOfStages; 10 | 11 | GLubyte *rawImagePixels; 12 | CGSize finalStageSize; 13 | } 14 | 15 | // This block is called on the completion of color averaging for a frame 16 | @property(nonatomic, copy) void(^colorAverageProcessingFinishedBlock)(CGFloat redComponent, CGFloat greenComponent, CGFloat blueComponent, CGFloat alphaComponent, CMTime frameTime); 17 | 18 | - (void)extractAverageColorAtFrameTime:(CMTime)frameTime; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /examples/iOS/SimpleSwiftVideoFilterExample/SimpleSwiftVideoFilterExample/ViewController.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import GPUImage 3 | 4 | class ViewController: UIViewController { 5 | 6 | var videoCamera:GPUImageVideoCamera? 7 | var filter:GPUImagePixellateFilter? 8 | 9 | override func viewDidLoad() { 10 | super.viewDidLoad() 11 | 12 | videoCamera = GPUImageVideoCamera(sessionPreset: AVCaptureSessionPreset640x480, cameraPosition: .Back) 13 | videoCamera!.outputImageOrientation = .Portrait; 14 | filter = GPUImagePixellateFilter() 15 | videoCamera?.addTarget(filter) 16 | filter?.addTarget(self.view as GPUImageView) 17 | videoCamera?.startCameraCapture() 18 | } 19 | } -------------------------------------------------------------------------------- /framework/Source/GPUImageFilterGroup.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageOutput.h" 2 | #import "GPUImageFilter.h" 3 | 4 | @interface GPUImageFilterGroup : GPUImageOutput 5 | { 6 | NSMutableArray *filters; 7 | BOOL isEndProcessing; 8 | } 9 | 10 | @property(readwrite, nonatomic, strong) GPUImageOutput *terminalFilter; 11 | @property(readwrite, nonatomic, strong) NSArray *initialFilters; 12 | @property(readwrite, nonatomic, strong) GPUImageOutput *inputFilterToIgnoreForUpdates; 13 | 14 | // Filter management 15 | - (void)addFilter:(GPUImageOutput *)newFilter; 16 | - (GPUImageOutput *)filterAtIndex:(NSUInteger)filterIndex; 17 | - (NSUInteger)filterCount; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /framework/Source/GPUImageLuminosity.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageAverageColor.h" 2 | 3 | @interface GPUImageLuminosity : GPUImageAverageColor 4 | { 5 | GLProgram *secondFilterProgram; 6 | GLint secondFilterPositionAttribute, secondFilterTextureCoordinateAttribute; 7 | GLint secondFilterInputTextureUniform, secondFilterInputTextureUniform2; 8 | GLint secondFilterTexelWidthUniform, secondFilterTexelHeightUniform; 9 | } 10 | 11 | // This block is called on the completion of color averaging for a frame 12 | @property(nonatomic, copy) void(^luminosityProcessingFinishedBlock)(CGFloat luminosity, CMTime frameTime); 13 | 14 | - (void)extractLuminosityAtFrameTime:(CMTime)frameTime; 15 | - (void)initializeSecondaryAttributes; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /framework/Source/GPUImagePinchDistortionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | /** Creates a pinch distortion of the image 4 | */ 5 | @interface GPUImagePinchDistortionFilter : GPUImageFilter 6 | { 7 | GLint aspectRatioUniform, radiusUniform, centerUniform, scaleUniform; 8 | } 9 | 10 | /** The center about which to apply the distortion, with a default of (0.5, 0.5) 11 | */ 12 | @property(readwrite, nonatomic) CGPoint center; 13 | /** The radius of the distortion, ranging from 0.0 to 2.0, with a default of 1.0 14 | */ 15 | @property(readwrite, nonatomic) CGFloat radius; 16 | /** The amount of distortion to apply, from -2.0 to 2.0, with a default of 0.5 17 | */ 18 | @property(readwrite, nonatomic) CGFloat scale; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /framework/Source/GPUImageGaussianBlurPositionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoPassTextureSamplingFilter.h" 2 | 3 | /** A more generalized 9x9 Gaussian blur filter 4 | */ 5 | @interface GPUImageGaussianBlurPositionFilter : GPUImageTwoPassTextureSamplingFilter 6 | { 7 | GLint blurCenterUniform, blurRadiusUniform, aspectRatioUniform; 8 | } 9 | 10 | /** A multiplier for the blur size, ranging from 0.0 on up, with a default of 1.0 11 | */ 12 | @property (readwrite, nonatomic) CGFloat blurSize; 13 | 14 | /** Center for the blur, defaults to 0.5, 0.5 15 | */ 16 | @property (readwrite, nonatomic) CGPoint blurCenter; 17 | 18 | /** Radius for the blur, defaults to 1.0 19 | */ 20 | @property (readwrite, nonatomic) CGFloat blurRadius; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /framework/Source/GPUImageKuwaharaFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | /** Kuwahara image abstraction, drawn from the work of Kyprianidis, et. al. in their publication "Anisotropic Kuwahara Filtering on the GPU" within the GPU Pro collection. This produces an oil-painting-like image, but it is extremely computationally expensive, so it can take seconds to render a frame on an iPad 2. This might be best used for still images. 4 | */ 5 | @interface GPUImageKuwaharaFilter : GPUImageFilter 6 | { 7 | GLint radiusUniform; 8 | } 9 | 10 | /// The radius to sample from when creating the brush-stroke effect, with a default of 3. The larger the radius, the slower the filter. 11 | @property(readwrite, nonatomic) NSUInteger radius; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /framework/Source/GPUImageToonFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImage3x3TextureSamplingFilter.h" 2 | 3 | /** This uses Sobel edge detection to place a black border around objects, 4 | and then it quantizes the colors present in the image to give a cartoon-like quality to the image. 5 | */ 6 | @interface GPUImageToonFilter : GPUImage3x3TextureSamplingFilter 7 | { 8 | GLint thresholdUniform, quantizationLevelsUniform; 9 | } 10 | 11 | /** The threshold at which to apply the edges, default of 0.2 12 | */ 13 | @property(readwrite, nonatomic) CGFloat threshold; 14 | 15 | /** The levels of quantization for the posterization of colors within the scene, with a default of 10.0 16 | */ 17 | @property(readwrite, nonatomic) CGFloat quantizationLevels; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /framework/Source/GPUImageTwoInputFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | extern NSString *const kGPUImageTwoInputTextureVertexShaderString; 4 | 5 | @interface GPUImageTwoInputFilter : GPUImageFilter 6 | { 7 | GPUImageFramebuffer *secondInputFramebuffer; 8 | 9 | GLint filterSecondTextureCoordinateAttribute; 10 | GLint filterInputTextureUniform2; 11 | GPUImageRotationMode inputRotation2; 12 | CMTime firstFrameTime, secondFrameTime; 13 | 14 | BOOL hasSetFirstTexture, hasReceivedFirstFrame, hasReceivedSecondFrame, firstFrameWasVideo, secondFrameWasVideo; 15 | BOOL firstFrameCheckDisabled, secondFrameCheckDisabled; 16 | } 17 | 18 | - (void)disableFirstFrameCheck; 19 | - (void)disableSecondFrameCheck; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /framework/Source/GPUImagePixellatePositionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImagePixellatePositionFilter : GPUImageFilter 4 | { 5 | GLint fractionalWidthOfAPixelUniform, aspectRatioUniform, centerUniform, radiusUniform; 6 | } 7 | 8 | // The fractional width of the image to use as a size for the pixels in the resulting image. Values below one pixel width in the source image are ignored. 9 | @property(readwrite, nonatomic) CGFloat fractionalWidthOfAPixel; 10 | 11 | // the center point to start pixelation in texture coordinates, default 0.5, 0.5 12 | @property(readwrite, nonatomic) CGPoint center; 13 | 14 | // the radius (0.0 - 1.0) in which to pixelate, default 1.0 15 | @property(readwrite, nonatomic) CGFloat radius; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /framework/Source/GPUImage3x3ConvolutionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImage3x3TextureSamplingFilter.h" 2 | 3 | /** Runs a 3x3 convolution kernel against the image 4 | */ 5 | @interface GPUImage3x3ConvolutionFilter : GPUImage3x3TextureSamplingFilter 6 | { 7 | GLint convolutionMatrixUniform; 8 | } 9 | 10 | /** Convolution kernel to run against the image 11 | 12 | The convolution kernel is a 3x3 matrix of values to apply to the pixel and its 8 surrounding pixels. 13 | The matrix is specified in row-major order, with the top left pixel being one.one and the bottom right three.three 14 | If the values in the matrix don't add up to 1.0, the image could be brightened or darkened. 15 | */ 16 | @property(readwrite, nonatomic) GPUMatrix3x3 convolutionKernel; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /framework/Source/GPUImageTwoPassTextureSamplingFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoPassFilter.h" 2 | 3 | @interface GPUImageTwoPassTextureSamplingFilter : GPUImageTwoPassFilter 4 | { 5 | GLint verticalPassTexelWidthOffsetUniform, verticalPassTexelHeightOffsetUniform, horizontalPassTexelWidthOffsetUniform, horizontalPassTexelHeightOffsetUniform; 6 | GLfloat verticalPassTexelWidthOffset, verticalPassTexelHeightOffset, horizontalPassTexelWidthOffset, horizontalPassTexelHeightOffset; 7 | CGFloat _verticalTexelSpacing, _horizontalTexelSpacing; 8 | } 9 | 10 | // This sets the spacing between texels (in pixels) when sampling for the first. By default, this is 1.0 11 | @property(readwrite, nonatomic) CGFloat verticalTexelSpacing, horizontalTexelSpacing; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/SampleConfiguration.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Filters 6 | 7 | 8 | FilterName 9 | GPUImageSepiaFilter 10 | 11 | 12 | FilterName 13 | GPUImageGaussianSelectiveBlurFilter 14 | Attributes 15 | 16 | setExcludeCirclePoint: 17 | CGPoint(0.5, 0.5) 18 | setExcludeCircleRadius: 19 | float(0.2) 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /framework/Source/GPUImageLineGenerator.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageLineGenerator : GPUImageFilter 4 | { 5 | GLint lineWidthUniform, lineColorUniform; 6 | GLfloat *lineCoordinates; 7 | } 8 | 9 | // The width of the displayed lines, in pixels. The default is 1. 10 | @property(readwrite, nonatomic) CGFloat lineWidth; 11 | 12 | // The color of the lines is specified using individual red, green, and blue components (normalized to 1.0). The default is green: (0.0, 1.0, 0.0). 13 | - (void)setLineColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent; 14 | 15 | // Rendering 16 | - (void)renderLinesFromArray:(GLfloat *)lineSlopeAndIntercepts count:(NSUInteger)numberOfLines frameTime:(CMTime)frameTime; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /framework/Source/GPUImageHazeFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | /* 4 | * The haze filter can be used to add or remove haze (similar to a UV filter) 5 | * 6 | * @author Alaric Cole 7 | * @creationDate 03/10/12 8 | * 9 | */ 10 | 11 | /** The haze filter can be used to add or remove haze 12 | 13 | This is similar to a UV filter 14 | */ 15 | @interface GPUImageHazeFilter : GPUImageFilter 16 | { 17 | GLint distanceUniform; 18 | GLint slopeUniform; 19 | } 20 | 21 | /** Strength of the color applied. Default 0. Values between -.3 and .3 are best 22 | */ 23 | @property(readwrite, nonatomic) CGFloat distance; 24 | 25 | /** Amount of color change. Default 0. Values between -.3 and .3 are best 26 | */ 27 | @property(readwrite, nonatomic) CGFloat slope; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSobelEdgeDetectionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoPassFilter.h" 2 | 3 | @interface GPUImageSobelEdgeDetectionFilter : GPUImageTwoPassFilter 4 | { 5 | GLint texelWidthUniform, texelHeightUniform, edgeStrengthUniform; 6 | BOOL hasOverriddenImageSizeFactor; 7 | } 8 | 9 | // The texel width and height factors tweak the appearance of the edges. By default, they match the inverse of the filter size in pixels 10 | @property(readwrite, nonatomic) CGFloat texelWidth; 11 | @property(readwrite, nonatomic) CGFloat texelHeight; 12 | 13 | // The filter strength property affects the dynamic range of the filter. High values can make edges more visible, but can lead to saturation. Default of 1.0. 14 | @property(readwrite, nonatomic) CGFloat edgeStrength; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /examples/iOS/SimpleImageFilter/SimpleImageFilter/SimpleImageAppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "SimpleImageAppDelegate.h" 2 | 3 | @implementation SimpleImageAppDelegate 4 | 5 | @synthesize window = _window; 6 | 7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 8 | { 9 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 10 | // Override point for customization after application launch. 11 | self.window.backgroundColor = [UIColor whiteColor]; 12 | 13 | rootViewController = [[SimpleImageViewController alloc] initWithNibName:nil bundle:nil]; 14 | [self.window addSubview:rootViewController.view]; 15 | 16 | [self.window makeKeyAndVisible]; 17 | return YES; 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /framework/Source/GPUImageFramebufferCache.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "GPUImageFramebuffer.h" 4 | 5 | @interface GPUImageFramebufferCache : NSObject 6 | 7 | // Framebuffer management 8 | - (GPUImageFramebuffer *)fetchFramebufferForSize:(CGSize)framebufferSize textureOptions:(GPUTextureOptions)textureOptions onlyTexture:(BOOL)onlyTexture; 9 | - (GPUImageFramebuffer *)fetchFramebufferForSize:(CGSize)framebufferSize onlyTexture:(BOOL)onlyTexture; 10 | - (void)returnFramebufferToCache:(GPUImageFramebuffer *)framebuffer; 11 | - (void)purgeAllUnassignedFramebuffers; 12 | - (void)addFramebufferToActiveImageCaptureList:(GPUImageFramebuffer *)framebuffer; 13 | - (void)removeFramebufferFromActiveImageCaptureList:(GPUImageFramebuffer *)framebuffer; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSolidColorGenerator.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | // This outputs an image with a constant color. You need to use -forceProcessingAtSize: in order to set the output image 4 | // dimensions, or this won't work correctly 5 | 6 | 7 | @interface GPUImageSolidColorGenerator : GPUImageFilter 8 | { 9 | GLint colorUniform; 10 | GLint useExistingAlphaUniform; 11 | } 12 | 13 | // This color dictates what the output image will be filled with 14 | @property(readwrite, nonatomic) GPUVector4 color; 15 | @property(readwrite, nonatomic, assign) BOOL useExistingAlpha; // whether to use the alpha of the existing image or not, default is NO 16 | 17 | - (void)setColorRed:(CGFloat)redComponent green:(CGFloat)greenComponent blue:(CGFloat)blueComponent alpha:(CGFloat)alphaComponent; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /framework/Source/GPUImageCrosshairGenerator.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageCrosshairGenerator : GPUImageFilter 4 | { 5 | GLint crosshairWidthUniform, crosshairColorUniform; 6 | } 7 | 8 | // The width of the displayed crosshairs, in pixels. Currently this only works well for odd widths. The default is 5. 9 | @property(readwrite, nonatomic) CGFloat crosshairWidth; 10 | 11 | // The color of the crosshairs is specified using individual red, green, and blue components (normalized to 1.0). The default is green: (0.0, 1.0, 0.0). 12 | - (void)setCrosshairColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent; 13 | 14 | // Rendering 15 | - (void)renderCrosshairsFromArray:(GLfloat *)crosshairCoordinates count:(NSUInteger)numberOfCrosshairs frameTime:(CMTime)frameTime; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /framework/Source/GPUImageHistogramEqualizationFilter.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPUImageHistogramEqualizationFilter.h 3 | // FilterShowcase 4 | // 5 | // Created by Adam Marcus on 19/08/2014. 6 | // Copyright (c) 2014 Sunset Lake Software LLC. All rights reserved. 7 | // 8 | 9 | #import "GPUImageFilterGroup.h" 10 | #import "GPUImageHistogramFilter.h" 11 | #import "GPUImageRawDataOutput.h" 12 | #import "GPUImageRawDataInput.h" 13 | #import "GPUImageTwoInputFilter.h" 14 | 15 | @interface GPUImageHistogramEqualizationFilter : GPUImageFilterGroup 16 | { 17 | GPUImageHistogramFilter *histogramFilter; 18 | GPUImageRawDataOutput *rawDataOutputFilter; 19 | GPUImageRawDataInput *rawDataInputFilter; 20 | } 21 | 22 | @property(readwrite, nonatomic) NSUInteger downsamplingFactor; 23 | 24 | - (id)initWithHistogramType:(GPUImageHistogramType)newHistogramType; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /framework/Source/GPUImageMotionDetector.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | #import "GPUImageLowPassFilter.h" 3 | #import "GPUImageAverageColor.h" 4 | 5 | @interface GPUImageMotionDetector : GPUImageFilterGroup 6 | { 7 | GPUImageLowPassFilter *lowPassFilter; 8 | GPUImageTwoInputFilter *frameComparisonFilter; 9 | GPUImageAverageColor *averageColor; 10 | } 11 | 12 | // This controls the low pass filter strength used to compare the current frame with previous ones to detect motion. This ranges from 0.0 to 1.0, with a default of 0.5. 13 | @property(readwrite, nonatomic) CGFloat lowPassFilterStrength; 14 | 15 | // For every frame, this will feed back the calculated centroid of the motion, as well as a relative intensity. 16 | @property(nonatomic, copy) void(^motionDetectionBlock)(CGPoint motionCentroid, CGFloat motionIntensity, CMTime frameTime); 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /framework/Source/GPUImageTransformFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageTransformFilter : GPUImageFilter 4 | { 5 | GLint transformMatrixUniform, orthographicMatrixUniform; 6 | GPUMatrix4x4 orthographicMatrix; 7 | } 8 | 9 | // You can either set the transform to apply to be a 2-D affine transform or a 3-D transform. The default is the identity transform (the output image is identical to the input). 10 | @property(readwrite, nonatomic) CGAffineTransform affineTransform; 11 | @property(readwrite, nonatomic) CATransform3D transform3D; 12 | 13 | // This applies the transform to the raw frame data if set to YES, the default of NO takes the aspect ratio of the image input into account when rotating 14 | @property(readwrite, nonatomic) BOOL ignoreAspectRatio; 15 | 16 | // sets the anchor point to top left corner 17 | @property(readwrite, nonatomic) BOOL anchorTopLeft; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /examples/Mac/FilterShowcaseSwift/FilterShowcaseSwiftTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.sunsetlakesoftware.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /framework/Source/GPUImageVignetteFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | /** Performs a vignetting effect, fading out the image at the edges 4 | */ 5 | @interface GPUImageVignetteFilter : GPUImageFilter 6 | { 7 | GLint vignetteCenterUniform, vignetteColorUniform, vignetteStartUniform, vignetteEndUniform; 8 | } 9 | 10 | // the center for the vignette in tex coords (defaults to 0.5, 0.5) 11 | @property (nonatomic, readwrite) CGPoint vignetteCenter; 12 | 13 | // The color to use for the Vignette (defaults to black) 14 | @property (nonatomic, readwrite) GPUVector3 vignetteColor; 15 | 16 | // The normalized distance from the center where the vignette effect starts. Default of 0.5. 17 | @property (nonatomic, readwrite) CGFloat vignetteStart; 18 | 19 | // The normalized distance from the center where the vignette effect ends. Default of 0.75. 20 | @property (nonatomic, readwrite) CGFloat vignetteEnd; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /framework/Source/GPUImageHistogramFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | typedef enum { kGPUImageHistogramRed, kGPUImageHistogramGreen, kGPUImageHistogramBlue, kGPUImageHistogramRGB, kGPUImageHistogramLuminance} GPUImageHistogramType; 4 | 5 | @interface GPUImageHistogramFilter : GPUImageFilter 6 | { 7 | GPUImageHistogramType histogramType; 8 | 9 | GLubyte *vertexSamplingCoordinates; 10 | 11 | GLProgram *secondFilterProgram, *thirdFilterProgram; 12 | GLint secondFilterPositionAttribute, thirdFilterPositionAttribute; 13 | } 14 | 15 | // Rather than sampling every pixel, this dictates what fraction of the image is sampled. By default, this is 16 with a minimum of 1. 16 | @property(readwrite, nonatomic) NSUInteger downsamplingFactor; 17 | 18 | // Initialization and teardown 19 | - (id)initWithHistogramType:(GPUImageHistogramType)newHistogramType; 20 | - (void)initializeSecondaryAttributes; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /framework/Source/GPUImageParallelCoordinateLineTransformFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | // This is an accumulator that uses a Hough transform in parallel coordinate space to identify probable lines in a scene. 4 | // 5 | // It is entirely based on the work of the Graph@FIT research group at the Brno University of Technology and their publications: 6 | // M. Dubská, J. Havel, and A. Herout. Real-Time Detection of Lines using Parallel Coordinates and OpenGL. Proceedings of SCCG 2011, Bratislava, SK, p. 7. 7 | // M. Dubská, J. Havel, and A. Herout. PClines — Line detection using parallel coordinates. 2011 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), p. 1489- 1494. 8 | 9 | @interface GPUImageParallelCoordinateLineTransformFilter : GPUImageFilter 10 | { 11 | GLubyte *rawImagePixels; 12 | GLfloat *lineCoordinates; 13 | unsigned int maxLinePairsToRender, linePairsToRender; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /framework/Source/GPUImageDilationFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoPassTextureSamplingFilter.h" 2 | 3 | // For each pixel, this sets it to the maximum value of the red channel in a rectangular neighborhood extending out dilationRadius pixels from the center. 4 | // This extends out bright features, and is most commonly used with black-and-white thresholded images. 5 | 6 | extern NSString *const kGPUImageDilationRadiusOneVertexShaderString; 7 | extern NSString *const kGPUImageDilationRadiusTwoVertexShaderString; 8 | extern NSString *const kGPUImageDilationRadiusThreeVertexShaderString; 9 | extern NSString *const kGPUImageDilationRadiusFourVertexShaderString; 10 | 11 | @interface GPUImageDilationFilter : GPUImageTwoPassTextureSamplingFilter 12 | 13 | // Acceptable values for dilationRadius, which sets the distance in pixels to sample out from the center, are 1, 2, 3, and 4. 14 | - (id)initWithRadius:(NSUInteger)dilationRadius; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /framework/Source/GPUImageDirectionalNonMaximumSuppressionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageDirectionalNonMaximumSuppressionFilter : GPUImageFilter 4 | { 5 | GLint texelWidthUniform, texelHeightUniform; 6 | GLint upperThresholdUniform, lowerThresholdUniform; 7 | 8 | BOOL hasOverriddenImageSizeFactor; 9 | } 10 | 11 | // The texel width and height determines how far out to sample from this texel. By default, this is the normalized width of a pixel, but this can be overridden for different effects. 12 | @property(readwrite, nonatomic) CGFloat texelWidth; 13 | @property(readwrite, nonatomic) CGFloat texelHeight; 14 | 15 | // These thresholds set cutoffs for the intensities that definitely get registered (upper threshold) and those that definitely don't (lower threshold) 16 | @property(readwrite, nonatomic) CGFloat upperThreshold; 17 | @property(readwrite, nonatomic) CGFloat lowerThreshold; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /framework/Source/iOS/Framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.sunsetlakesoftware.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.1.4 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /framework/Source/Mac/GPUImagePicture.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImageOutput.h" 3 | 4 | @interface GPUImagePicture : GPUImageOutput 5 | { 6 | CGSize pixelSizeOfImage; 7 | BOOL hasProcessedImage; 8 | 9 | dispatch_semaphore_t imageUpdateSemaphore; 10 | } 11 | 12 | // Initialization and teardown 13 | - (id)initWithURL:(NSURL *)url; 14 | - (id)initWithImage:(NSImage *)newImageSource; 15 | - (id)initWithCGImage:(CGImageRef)newImageSource; 16 | - (id)initWithImage:(NSImage *)newImageSource smoothlyScaleOutput:(BOOL)smoothlyScaleOutput; 17 | - (id)initWithCGImage:(CGImageRef)newImageSource smoothlyScaleOutput:(BOOL)smoothlyScaleOutput; 18 | 19 | // Image rendering 20 | - (void)processImage; 21 | - (BOOL)processImageWithCompletionHandler:(void (^)(void))completion; 22 | - (void)processImageUpToFilter:(GPUImageOutput *)finalFilterInChain withCompletionHandler:(void (^)(NSImage *processedImage))block; 23 | - (CGSize)outputImageSize; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/VideoFilteringBenchmarkController.m: -------------------------------------------------------------------------------- 1 | #import "VideoFilteringBenchmarkController.h" 2 | 3 | @implementation VideoFilteringBenchmarkController 4 | 5 | #pragma mark - 6 | #pragma mark Benchmarks 7 | 8 | - (void)runBenchmark; 9 | { 10 | videoFilteringDisplayController = [[VideoFilteringDisplayController alloc] initWithNibName:@"VideoFilteringDisplayController" bundle:nil]; 11 | videoFilteringDisplayController.delegate = self; 12 | 13 | [self presentModalViewController:videoFilteringDisplayController animated:YES]; 14 | 15 | } 16 | 17 | - (void)finishedTestWithAverageTimesForCPU:(CGFloat)cpuTime coreImage:(CGFloat)coreImageTime gpuImage:(CGFloat)gpuImageTime; 18 | { 19 | [self dismissModalViewControllerAnimated:YES]; 20 | 21 | processingTimeForCPURoutine = cpuTime; 22 | processingTimeForCoreImageRoutine = coreImageTime; 23 | processingTimeForGPUImageRoutine = gpuImageTime; 24 | 25 | [self.tableView reloadData]; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /examples/iOS/FilterShowcase/FilterShowcase/ShowcaseAppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "ShowcaseAppDelegate.h" 2 | #import "ShowcaseFilterListController.h" 3 | 4 | @implementation ShowcaseAppDelegate 5 | 6 | @synthesize window = _window; 7 | 8 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 9 | { 10 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 11 | // Override point for customization after application launch. 12 | self.window.backgroundColor = [UIColor whiteColor]; 13 | 14 | filterNavigationController = [[UINavigationController alloc] init]; 15 | [self.window addSubview:filterNavigationController.view]; 16 | 17 | filterListController = [[ShowcaseFilterListController alloc] initWithNibName:nil bundle:nil]; 18 | 19 | [filterNavigationController pushViewController:filterListController animated:NO]; 20 | 21 | [self.window makeKeyAndVisible]; 22 | 23 | return YES; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /framework/Source/GPUImageHSBFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageColorMatrixFilter.h" 2 | 3 | @interface GPUImageHSBFilter : GPUImageColorMatrixFilter 4 | 5 | /** Reset the filter to have no transformations. 6 | */ 7 | - (void)reset; 8 | 9 | /** Add a hue rotation to the filter. 10 | The hue rotation is in the range [-360, 360] with 0 being no-change. 11 | Note that this adjustment is additive, so use the reset method if you need to. 12 | */ 13 | - (void)rotateHue:(float)h; 14 | 15 | /** Add a saturation adjustment to the filter. 16 | The saturation adjustment is in the range [0.0, 2.0] with 1.0 being no-change. 17 | Note that this adjustment is additive, so use the reset method if you need to. 18 | */ 19 | - (void)adjustSaturation:(float)s; 20 | 21 | /** Add a brightness adjustment to the filter. 22 | The brightness adjustment is in the range [0.0, 2.0] with 1.0 being no-change. 23 | Note that this adjustment is additive, so use the reset method if you need to. 24 | */ 25 | - (void)adjustBrightness:(float)b; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /framework/Source/GPUImageTiltShiftFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImageGaussianBlurFilter; 4 | 5 | /// A simulated tilt shift lens effect 6 | @interface GPUImageTiltShiftFilter : GPUImageFilterGroup 7 | { 8 | GPUImageGaussianBlurFilter *blurFilter; 9 | GPUImageFilter *tiltShiftFilter; 10 | } 11 | 12 | /// The radius of the underlying blur, in pixels. This is 7.0 by default. 13 | @property(readwrite, nonatomic) CGFloat blurRadiusInPixels; 14 | 15 | /// The normalized location of the top of the in-focus area in the image, this value should be lower than bottomFocusLevel, default 0.4 16 | @property(readwrite, nonatomic) CGFloat topFocusLevel; 17 | 18 | /// The normalized location of the bottom of the in-focus area in the image, this value should be higher than topFocusLevel, default 0.6 19 | @property(readwrite, nonatomic) CGFloat bottomFocusLevel; 20 | 21 | /// The rate at which the image gets blurry away from the in-focus region, default 0.2 22 | @property(readwrite, nonatomic) CGFloat focusFallOffRate; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /examples/iOS/ColorObjectTracking/ColorObjectTracking/ColorTrackingViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImage.h" 3 | 4 | typedef enum { PASSTHROUGH_VIDEO, SIMPLE_THRESHOLDING, POSITION_THRESHOLDING, OBJECT_TRACKING} ColorTrackingDisplayMode; 5 | 6 | @interface ColorTrackingViewController : UIViewController 7 | { 8 | CALayer *trackingDot; 9 | 10 | GPUImageVideoCamera *videoCamera; 11 | GPUImageFilter *thresholdFilter, *positionFilter; 12 | GPUImageRawDataOutput *positionRawData, *videoRawData; 13 | GPUImageAverageColor *positionAverageColor; 14 | GPUImageView *filteredVideoView; 15 | 16 | ColorTrackingDisplayMode displayMode; 17 | 18 | BOOL shouldReplaceThresholdColor; 19 | CGPoint currentTouchPoint; 20 | GLfloat thresholdSensitivity; 21 | GPUVector3 thresholdColor; 22 | } 23 | 24 | - (void)configureVideoFiltering; 25 | - (void)configureToolbar; 26 | - (void)configureTrackingDot; 27 | 28 | // Image processing 29 | - (CGPoint)centroidFromTexture:(GLubyte *)pixels ofSize:(CGSize)textureSize; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /framework/Source/GPUImageRGBClosingFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageRGBClosingFilter.h" 2 | #import "GPUImageRGBErosionFilter.h" 3 | #import "GPUImageRGBDilationFilter.h" 4 | 5 | @implementation GPUImageRGBClosingFilter 6 | 7 | - (id)init; 8 | { 9 | if (!(self = [self initWithRadius:1])) 10 | { 11 | return nil; 12 | } 13 | 14 | return self; 15 | } 16 | 17 | - (id)initWithRadius:(NSUInteger)radius; 18 | { 19 | if (!(self = [super init])) 20 | { 21 | return nil; 22 | } 23 | 24 | // First pass: dilation 25 | dilationFilter = [[GPUImageRGBDilationFilter alloc] initWithRadius:radius]; 26 | [self addFilter:dilationFilter]; 27 | 28 | // Second pass: erosion 29 | erosionFilter = [[GPUImageRGBErosionFilter alloc] initWithRadius:radius]; 30 | [self addFilter:erosionFilter]; 31 | 32 | [dilationFilter addTarget:erosionFilter]; 33 | 34 | self.initialFilters = [NSArray arrayWithObjects:dilationFilter, nil]; 35 | self.terminalFilter = erosionFilter; 36 | 37 | return self; 38 | } 39 | 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /framework/Source/GPUImageRGBOpeningFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageRGBOpeningFilter.h" 2 | #import "GPUImageRGBErosionFilter.h" 3 | #import "GPUImageRGBDilationFilter.h" 4 | 5 | @implementation GPUImageRGBOpeningFilter 6 | 7 | - (id)init; 8 | { 9 | if (!(self = [self initWithRadius:1])) 10 | { 11 | return nil; 12 | } 13 | 14 | return self; 15 | } 16 | 17 | - (id)initWithRadius:(NSUInteger)radius; 18 | { 19 | if (!(self = [super init])) 20 | { 21 | return nil; 22 | } 23 | 24 | // First pass: erosion 25 | erosionFilter = [[GPUImageRGBErosionFilter alloc] initWithRadius:radius]; 26 | [self addFilter:erosionFilter]; 27 | 28 | // Second pass: dilation 29 | dilationFilter = [[GPUImageRGBDilationFilter alloc] initWithRadius:radius]; 30 | [self addFilter:dilationFilter]; 31 | 32 | [erosionFilter addTarget:dilationFilter]; 33 | 34 | self.initialFilters = [NSArray arrayWithObjects:erosionFilter, nil]; 35 | self.terminalFilter = dilationFilter; 36 | 37 | return self; 38 | } 39 | 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /framework/Source/GPUImageTwoPassFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageTwoPassFilter : GPUImageFilter 4 | { 5 | GPUImageFramebuffer *secondOutputFramebuffer; 6 | 7 | GLProgram *secondFilterProgram; 8 | GLint secondFilterPositionAttribute, secondFilterTextureCoordinateAttribute; 9 | GLint secondFilterInputTextureUniform, secondFilterInputTextureUniform2; 10 | 11 | NSMutableDictionary *secondProgramUniformStateRestorationBlocks; 12 | } 13 | 14 | // Initialization and teardown 15 | - (id)initWithFirstStageVertexShaderFromString:(NSString *)firstStageVertexShaderString firstStageFragmentShaderFromString:(NSString *)firstStageFragmentShaderString secondStageVertexShaderFromString:(NSString *)secondStageVertexShaderString secondStageFragmentShaderFromString:(NSString *)secondStageFragmentShaderString; 16 | - (id)initWithFirstStageFragmentShaderFromString:(NSString *)firstStageFragmentShaderString secondStageFragmentShaderFromString:(NSString *)secondStageFragmentShaderString; 17 | - (void)initializeSecondaryAttributes; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /framework/Source/GPUImageMosaicFilter.h: -------------------------------------------------------------------------------- 1 | 2 | // This needs a little more work, it's rotating the input tileset and there are some artifacts (I think from GL_LINEAR interpolation), but it's working 3 | 4 | #import "GPUImageTwoInputFilter.h" 5 | #import "GPUImagePicture.h" 6 | 7 | @interface GPUImageMosaicFilter : GPUImageTwoInputFilter { 8 | GLint inputTileSizeUniform, numTilesUniform, displayTileSizeUniform, colorOnUniform; 9 | GPUImagePicture *pic; 10 | } 11 | 12 | // This filter takes an input tileset, the tiles must ascend in luminance 13 | // It looks at the input image and replaces each display tile with an input tile 14 | // according to the luminance of that tile. The idea was to replicate the ASCII 15 | // video filters seen in other apps, but the tileset can be anything. 16 | @property(readwrite, nonatomic) CGSize inputTileSize; 17 | @property(readwrite, nonatomic) float numTiles; 18 | @property(readwrite, nonatomic) CGSize displayTileSize; 19 | @property(readwrite, nonatomic) BOOL colorOn; 20 | @property(readwrite, nonatomic, copy) NSString *tileSet; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /examples/iOS/FeatureExtractionTest/FeatureExtractionTest/FeatureExtractionAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImage.h" 3 | 4 | @interface FeatureExtractionAppDelegate : UIResponder 5 | 6 | @property (strong, nonatomic) UIWindow *window; 7 | 8 | - (void)testHoughTransform:(GPUImageHoughTransformLineDetector *)lineDetector ofName:(NSString *)detectorName againstPicture:(GPUImagePicture *)pictureInput withName:(NSString *)pictureName; 9 | - (void)testCornerDetector:(GPUImageHarrisCornerDetectionFilter *)cornerDetector ofName:(NSString *)detectorName againstPicture:(GPUImagePicture *)pictureInput withName:(NSString *)pictureName; 10 | - (void)testHarrisCornerDetectorAgainstPicture:(GPUImagePicture *)pictureInput withName:(NSString *)pictureName; 11 | - (void)testNobleCornerDetectorAgainstPicture:(GPUImagePicture *)pictureInput withName:(NSString *)pictureName; 12 | - (void)testShiTomasiCornerDetectorAgainstPicture:(GPUImagePicture *)pictureInput withName:(NSString *)pictureName; 13 | - (void)saveImage:(UIImage *)imageToSave fileName:(NSString *)imageName; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /examples/Mac/PlaygroundExample/PlaygroundExample/GPUImagePlayground.playground/timeline.xctimeline: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 7 | 8 | 10 | 11 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/iOS/ColorObjectTracking/ColorObjectTracking/ColorTrackingAppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "ColorTrackingAppDelegate.h" 2 | #import "ColorTrackingViewController.h" 3 | 4 | @implementation ColorTrackingAppDelegate 5 | 6 | @synthesize window = _window; 7 | 8 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 9 | { 10 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 11 | self.window.backgroundColor = [UIColor whiteColor]; 12 | 13 | colorTrackingViewController = [[ColorTrackingViewController alloc] initWithNibName:nil bundle:nil]; 14 | [self.window addSubview:colorTrackingViewController.view]; 15 | 16 | [self.window makeKeyAndVisible]; 17 | return YES; 18 | } 19 | 20 | - (void)applicationWillResignActive:(UIApplication *)application 21 | { 22 | // Pause camera frame readings 23 | } 24 | 25 | - (void)applicationDidBecomeActive:(UIApplication *)application 26 | { 27 | // Reactivate camera frame readings 28 | } 29 | 30 | - (void)applicationWillTerminate:(UIApplication *)application 31 | { 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /framework/Source/Mac/GPUImageMac-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.sunsetlakesoftware.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSHumanReadableCopyright 26 | Copyright © 2013 Sunset Lake Software LLC. All rights reserved. 27 | NSPrincipalClass 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /framework/Source/GPUImageChromaKeyFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageChromaKeyFilter : GPUImageFilter 4 | { 5 | GLint colorToReplaceUniform, thresholdSensitivityUniform, smoothingUniform; 6 | } 7 | 8 | /** The threshold sensitivity controls how similar pixels need to be colored to be replaced 9 | 10 | The default value is 0.3 11 | */ 12 | @property(readwrite, nonatomic) CGFloat thresholdSensitivity; 13 | 14 | /** The degree of smoothing controls how gradually similar colors are replaced in the image 15 | 16 | The default value is 0.1 17 | */ 18 | @property(readwrite, nonatomic) CGFloat smoothing; 19 | 20 | /** The color to be replaced is specified using individual red, green, and blue components (normalized to 1.0). 21 | 22 | The default is green: (0.0, 1.0, 0.0). 23 | 24 | @param redComponent Red component of color to be replaced 25 | @param greenComponent Green component of color to be replaced 26 | @param blueComponent Blue component of color to be replaced 27 | */ 28 | - (void)setColorToReplaceRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /examples/iOS/FilterShowcaseSwift/FilterShowcaseSwift/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /examples/iOS/SimpleSwiftVideoFilterExample/SimpleSwiftVideoFilterExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /examples/Mac/FilterShowcaseSwift/FilterShowcaseSwiftTests/FilterShowcaseSwiftTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FilterShowcaseSwiftTests.swift 3 | // FilterShowcaseSwiftTests 4 | // 5 | // Created by Brad Larson on 7/21/2014. 6 | // Copyright (c) 2014 Sunset Lake Software. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import XCTest 11 | 12 | class FilterShowcaseSwiftTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /examples/iOS/ColorObjectTracking/ColorObjectTracking/Threshold.fsh: -------------------------------------------------------------------------------- 1 | varying highp vec2 textureCoordinate; 2 | 3 | uniform sampler2D inputImageTexture; 4 | uniform mediump vec3 inputColor; 5 | uniform mediump float threshold; 6 | 7 | precision mediump float; 8 | 9 | vec3 normalizeColor(vec3 color) 10 | { 11 | return color / max(dot(color, vec3(1.0/3.0)), 0.3); 12 | } 13 | 14 | vec4 maskPixel(vec3 pixelColor, vec3 maskColor) 15 | { 16 | float d; 17 | vec4 calculatedColor; 18 | 19 | // Compute distance between current pixel color and reference color 20 | d = distance(normalizeColor(pixelColor), normalizeColor(maskColor)); 21 | 22 | // If color difference is larger than threshold, return black. 23 | calculatedColor = (d > threshold) ? vec4(0.0) : vec4(1.0); 24 | 25 | //Multiply color by texture 26 | return calculatedColor; 27 | } 28 | 29 | void main() 30 | { 31 | float d; 32 | vec4 pixelColor, maskedColor; 33 | 34 | pixelColor = texture2D(inputImageTexture, textureCoordinate); 35 | maskedColor = maskPixel(pixelColor.rgb, inputColor); 36 | 37 | gl_FragColor = (maskedColor.a < 1.0) ? pixelColor : maskedColor; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /framework/Source/GPUImageiOSBlurFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImageSaturationFilter; 4 | @class GPUImageGaussianBlurFilter; 5 | @class GPUImageLuminanceRangeFilter; 6 | 7 | @interface GPUImageiOSBlurFilter : GPUImageFilterGroup 8 | { 9 | GPUImageSaturationFilter *saturationFilter; 10 | GPUImageGaussianBlurFilter *blurFilter; 11 | GPUImageLuminanceRangeFilter *luminanceRangeFilter; 12 | } 13 | 14 | /** A radius in pixels to use for the blur, with a default of 12.0. This adjusts the sigma variable in the Gaussian distribution function. 15 | */ 16 | @property (readwrite, nonatomic) CGFloat blurRadiusInPixels; 17 | 18 | /** Saturation ranges from 0.0 (fully desaturated) to 2.0 (max saturation), with 0.8 as the normal level 19 | */ 20 | @property (readwrite, nonatomic) CGFloat saturation; 21 | 22 | /** The degree to which to downsample, then upsample the incoming image to minimize computations within the Gaussian blur, default of 4.0 23 | */ 24 | @property (readwrite, nonatomic) CGFloat downsampling; 25 | 26 | 27 | /** The degree to reduce the luminance range, from 0.0 to 1.0. Default is 0.6. 28 | */ 29 | @property (readwrite, nonatomic) CGFloat rangeReductionFactor; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /examples/iOS/CubeExample/Classes/CubeExampleAppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "CubeExampleAppDelegate.h" 2 | #import "DisplayViewController.h" 3 | 4 | @implementation CubeExampleAppDelegate 5 | 6 | @synthesize window; 7 | 8 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 9 | { 10 | self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 11 | // Override point for customization after application launch. 12 | self.window.backgroundColor = [UIColor whiteColor]; 13 | 14 | rootViewController = [[DisplayViewController alloc] initWithNibName:nil bundle:nil]; 15 | [self.window addSubview:rootViewController.view]; 16 | self.window.rootViewController = rootViewController; 17 | 18 | [self.window makeKeyAndVisible]; 19 | 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application 24 | { 25 | } 26 | 27 | - (void)applicationDidBecomeActive:(UIApplication *)application 28 | { 29 | } 30 | 31 | - (void)applicationWillTerminate:(UIApplication *)application 32 | { 33 | } 34 | 35 | - (void)dealloc 36 | { 37 | [window release]; 38 | 39 | [super dealloc]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /framework/Source/GPUImageAmatorkaFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageAmatorkaFilter.h" 2 | #import "GPUImagePicture.h" 3 | #import "GPUImageLookupFilter.h" 4 | 5 | @implementation GPUImageAmatorkaFilter 6 | 7 | - (id)init; 8 | { 9 | if (!(self = [super init])) 10 | { 11 | return nil; 12 | } 13 | 14 | #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE 15 | UIImage *image = [UIImage imageNamed:@"lookup_amatorka.png"]; 16 | #else 17 | NSImage *image = [NSImage imageNamed:@"lookup_amatorka.png"]; 18 | #endif 19 | 20 | NSAssert(image, @"To use GPUImageAmatorkaFilter you need to add lookup_amatorka.png from GPUImage/framework/Resources to your application bundle."); 21 | 22 | lookupImageSource = [[GPUImagePicture alloc] initWithImage:image]; 23 | GPUImageLookupFilter *lookupFilter = [[GPUImageLookupFilter alloc] init]; 24 | [self addFilter:lookupFilter]; 25 | 26 | [lookupImageSource addTarget:lookupFilter atTextureLocation:1]; 27 | [lookupImageSource processImage]; 28 | 29 | self.initialFilters = [NSArray arrayWithObjects:lookupFilter, nil]; 30 | self.terminalFilter = lookupFilter; 31 | 32 | return self; 33 | } 34 | 35 | #pragma mark - 36 | #pragma mark Accessors 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /framework/Source/GPUImageMissEtikateFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageMissEtikateFilter.h" 2 | #import "GPUImagePicture.h" 3 | #import "GPUImageLookupFilter.h" 4 | 5 | @implementation GPUImageMissEtikateFilter 6 | 7 | - (id)init; 8 | { 9 | if (!(self = [super init])) 10 | { 11 | return nil; 12 | } 13 | 14 | #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE 15 | UIImage *image = [UIImage imageNamed:@"lookup_miss_etikate.png"]; 16 | #else 17 | NSImage *image = [NSImage imageNamed:@"lookup_miss_etikate.png"]; 18 | #endif 19 | 20 | NSAssert(image, @"To use GPUImageMissEtikateFilter you need to add lookup_miss_etikate.png from GPUImage/framework/Resources to your application bundle."); 21 | 22 | lookupImageSource = [[GPUImagePicture alloc] initWithImage:image]; 23 | GPUImageLookupFilter *lookupFilter = [[GPUImageLookupFilter alloc] init]; 24 | [self addFilter:lookupFilter]; 25 | 26 | [lookupImageSource addTarget:lookupFilter atTextureLocation:1]; 27 | [lookupImageSource processImage]; 28 | 29 | self.initialFilters = [NSArray arrayWithObjects:lookupFilter, nil]; 30 | self.terminalFilter = lookupFilter; 31 | 32 | return self; 33 | } 34 | 35 | #pragma mark - 36 | #pragma mark Accessors 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /examples/Mac/FilterShowcaseSwift/FilterShowcaseSwift/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /framework/Source/GPUImageColorInvertFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageColorInvertFilter.h" 2 | 3 | #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE 4 | NSString *const kGPUImageInvertFragmentShaderString = SHADER_STRING 5 | ( 6 | varying highp vec2 textureCoordinate; 7 | 8 | uniform sampler2D inputImageTexture; 9 | 10 | void main() 11 | { 12 | lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 13 | 14 | gl_FragColor = vec4((1.0 - textureColor.rgb), textureColor.w); 15 | } 16 | ); 17 | #else 18 | NSString *const kGPUImageInvertFragmentShaderString = SHADER_STRING 19 | ( 20 | varying vec2 textureCoordinate; 21 | 22 | uniform sampler2D inputImageTexture; 23 | 24 | void main() 25 | { 26 | vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 27 | 28 | gl_FragColor = vec4((1.0 - textureColor.rgb), textureColor.w); 29 | } 30 | ); 31 | #endif 32 | 33 | @implementation GPUImageColorInvertFilter 34 | 35 | - (id)init; 36 | { 37 | if (!(self = [super initWithFragmentShaderFromString:kGPUImageInvertFragmentShaderString])) 38 | { 39 | return nil; 40 | } 41 | 42 | return self; 43 | } 44 | 45 | @end 46 | 47 | -------------------------------------------------------------------------------- /framework/Source/GPUImageChromaKeyBlendFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | /** Selectively replaces a color in the first image with the second image 4 | */ 5 | @interface GPUImageChromaKeyBlendFilter : GPUImageTwoInputFilter 6 | { 7 | GLint colorToReplaceUniform, thresholdSensitivityUniform, smoothingUniform; 8 | } 9 | 10 | /** The threshold sensitivity controls how similar pixels need to be colored to be replaced 11 | 12 | The default value is 0.3 13 | */ 14 | @property(readwrite, nonatomic) CGFloat thresholdSensitivity; 15 | 16 | /** The degree of smoothing controls how gradually similar colors are replaced in the image 17 | 18 | The default value is 0.1 19 | */ 20 | @property(readwrite, nonatomic) CGFloat smoothing; 21 | 22 | /** The color to be replaced is specified using individual red, green, and blue components (normalized to 1.0). 23 | 24 | The default is green: (0.0, 1.0, 0.0). 25 | 26 | @param redComponent Red component of color to be replaced 27 | @param greenComponent Green component of color to be replaced 28 | @param blueComponent Blue component of color to be replaced 29 | */ 30 | - (void)setColorToReplaceRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /examples/iOS/SimpleSwiftVideoFilterExample/SimpleSwiftVideoFilterExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.sunsetlakesoftware.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSmoothToonFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImageGaussianBlurFilter; 4 | @class GPUImageToonFilter; 5 | 6 | /** This uses a similar process as the GPUImageToonFilter, only it precedes the toon effect with a Gaussian blur to smooth out noise. 7 | */ 8 | @interface GPUImageSmoothToonFilter : GPUImageFilterGroup 9 | { 10 | GPUImageGaussianBlurFilter *blurFilter; 11 | GPUImageToonFilter *toonFilter; 12 | } 13 | 14 | /// The image width and height factors tweak the appearance of the edges. By default, they match the filter size in pixels 15 | @property(readwrite, nonatomic) CGFloat texelWidth; 16 | /// The image width and height factors tweak the appearance of the edges. By default, they match the filter size in pixels 17 | @property(readwrite, nonatomic) CGFloat texelHeight; 18 | 19 | /// The radius of the underlying Gaussian blur. The default is 2.0. 20 | @property (readwrite, nonatomic) CGFloat blurRadiusInPixels; 21 | 22 | /// The threshold at which to apply the edges, default of 0.2 23 | @property(readwrite, nonatomic) CGFloat threshold; 24 | 25 | /// The levels of quantization for the posterization of colors within the scene, with a default of 10.0 26 | @property(readwrite, nonatomic) CGFloat quantizationLevels; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /examples/Mac/FilterShowcaseSwift/FilterShowcaseSwift/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.sunsetlakesoftware.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2014 Sunset Lake Software. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /framework/Source/iOS/GPUImagePicture.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImageOutput.h" 3 | 4 | 5 | @interface GPUImagePicture : GPUImageOutput 6 | { 7 | CGSize pixelSizeOfImage; 8 | BOOL hasProcessedImage; 9 | 10 | dispatch_semaphore_t imageUpdateSemaphore; 11 | } 12 | 13 | // Initialization and teardown 14 | - (id)initWithURL:(NSURL *)url; 15 | - (id)initWithImage:(UIImage *)newImageSource; 16 | - (id)initWithCGImage:(CGImageRef)newImageSource; 17 | - (id)initWithImage:(UIImage *)newImageSource smoothlyScaleOutput:(BOOL)smoothlyScaleOutput; 18 | - (id)initWithCGImage:(CGImageRef)newImageSource smoothlyScaleOutput:(BOOL)smoothlyScaleOutput; 19 | 20 | // Image rendering 21 | - (void)processImage; 22 | - (CGSize)outputImageSize; 23 | 24 | /** 25 | * Process image with all targets and filters asynchronously 26 | * The completion handler is called after processing finished in the 27 | * GPU's dispatch queue - and only if this method did not return NO. 28 | * 29 | * @returns NO if resource is blocked and processing is discarded, YES otherwise 30 | */ 31 | - (BOOL)processImageWithCompletionHandler:(void (^)(void))completion; 32 | - (void)processImageUpToFilter:(GPUImageOutput *)finalFilterInChain withCompletionHandler:(void (^)(UIImage *processedImage))block; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /examples/Mac/FilterShowcase/FilterShowcase/FilterShowcase-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.sunsetlakesoftware.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 Sunset Lake Software LLC. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /examples/iOS/CubeExample/Classes/ES2Renderer.h: -------------------------------------------------------------------------------- 1 | #import "ESRenderer.h" 2 | 3 | #import 4 | #import 5 | #import 6 | #import "GPUImage.h" 7 | 8 | @class PVRTexture; 9 | 10 | @interface ES2Renderer : NSObject 11 | { 12 | @private 13 | EAGLContext *context; 14 | 15 | GLuint textureForCubeFace, outputTexture; 16 | 17 | // The pixel dimensions of the CAEAGLLayer 18 | GLint backingWidth; 19 | GLint backingHeight; 20 | 21 | // The OpenGL ES names for the framebuffer and renderbuffer used to render to this view 22 | GLuint defaultFramebuffer, colorRenderbuffer; 23 | 24 | CATransform3D currentCalculatedMatrix; 25 | 26 | GLuint program; 27 | 28 | GPUImageVideoCamera *videoCamera; 29 | GPUImageFilter *inputFilter; 30 | GPUImageTextureOutput *textureOutput; 31 | 32 | } 33 | 34 | @property(readonly) GLuint outputTexture; 35 | @property(nonatomic, copy) void(^newFrameAvailableBlock)(void); 36 | 37 | - (id)initWithSize:(CGSize)newSize; 38 | 39 | - (void)renderByRotatingAroundX:(float)xRotation rotatingAroundY:(float)yRotation; 40 | - (void)convert3DTransform:(CATransform3D *)transform3D toMatrix:(GLfloat *)matrix; 41 | - (void)startCameraCapture; 42 | 43 | @end 44 | 45 | -------------------------------------------------------------------------------- /framework/Source/GPUImageToneCurveFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilter.h" 2 | 3 | @interface GPUImageToneCurveFilter : GPUImageFilter 4 | 5 | @property(readwrite, nonatomic, copy) NSArray *redControlPoints; 6 | @property(readwrite, nonatomic, copy) NSArray *greenControlPoints; 7 | @property(readwrite, nonatomic, copy) NSArray *blueControlPoints; 8 | @property(readwrite, nonatomic, copy) NSArray *rgbCompositeControlPoints; 9 | 10 | // Initialization and teardown 11 | - (id)initWithACVData:(NSData*)data; 12 | 13 | - (id)initWithACV:(NSString*)curveFilename; 14 | - (id)initWithACVURL:(NSURL*)curveFileURL; 15 | 16 | // This lets you set all three red, green, and blue tone curves at once. 17 | // NOTE: Deprecated this function because this effect can be accomplished 18 | // using the rgbComposite channel rather then setting all 3 R, G, and B channels. 19 | - (void)setRGBControlPoints:(NSArray *)points DEPRECATED_ATTRIBUTE; 20 | 21 | - (void)setPointsWithACV:(NSString*)curveFilename; 22 | - (void)setPointsWithACVURL:(NSURL*)curveFileURL; 23 | 24 | // Curve calculation 25 | - (NSMutableArray *)getPreparedSplineCurve:(NSArray *)points; 26 | - (NSMutableArray *)splineCurve:(NSArray *)points; 27 | - (NSMutableArray *)secondDerivative:(NSArray *)cgPoints; 28 | - (void)updateToneCurveTexture; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /framework/Source/GPUImageGaussianSelectiveBlurFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImageGaussianBlurFilter; 4 | 5 | /** A Gaussian blur that preserves focus within a circular region 6 | */ 7 | @interface GPUImageGaussianSelectiveBlurFilter : GPUImageFilterGroup 8 | { 9 | GPUImageGaussianBlurFilter *blurFilter; 10 | GPUImageFilter *selectiveFocusFilter; 11 | BOOL hasOverriddenAspectRatio; 12 | } 13 | 14 | /** The radius of the circular area being excluded from the blur 15 | */ 16 | @property (readwrite, nonatomic) CGFloat excludeCircleRadius; 17 | /** The center of the circular area being excluded from the blur 18 | */ 19 | @property (readwrite, nonatomic) CGPoint excludeCirclePoint; 20 | /** The size of the area between the blurred portion and the clear circle 21 | */ 22 | @property (readwrite, nonatomic) CGFloat excludeBlurSize; 23 | /** A radius in pixels to use for the blur, with a default of 5.0. This adjusts the sigma variable in the Gaussian distribution function. 24 | */ 25 | @property (readwrite, nonatomic) CGFloat blurRadiusInPixels; 26 | /** The aspect ratio of the image, used to adjust the circularity of the in-focus region. By default, this matches the image aspect ratio, but you can override this value. 27 | */ 28 | @property (readwrite, nonatomic) CGFloat aspectRatio; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /framework/Source/GPUImageEmbossFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageEmbossFilter.h" 2 | 3 | @implementation GPUImageEmbossFilter 4 | 5 | @synthesize intensity = _intensity; 6 | 7 | - (id)init; 8 | { 9 | if (!(self = [super init])) 10 | { 11 | return nil; 12 | } 13 | 14 | self.intensity = 1.0; 15 | 16 | return self; 17 | } 18 | 19 | #pragma mark - 20 | #pragma mark Accessors 21 | 22 | - (void)setIntensity:(CGFloat)newValue; 23 | { 24 | // [(GPUImage3x3ConvolutionFilter *)filter setConvolutionMatrix:(GPUMatrix3x3){ 25 | // {-2.0f, -1.0f, 0.0f}, 26 | // {-1.0f, 1.0f, 1.0f}, 27 | // { 0.0f, 1.0f, 2.0f} 28 | // }]; 29 | 30 | _intensity = newValue; 31 | 32 | GPUMatrix3x3 newConvolutionMatrix; 33 | newConvolutionMatrix.one.one = _intensity * (-2.0); 34 | newConvolutionMatrix.one.two = -_intensity; 35 | newConvolutionMatrix.one.three = 0.0f; 36 | 37 | newConvolutionMatrix.two.one = -_intensity; 38 | newConvolutionMatrix.two.two = 1.0; 39 | newConvolutionMatrix.two.three = _intensity; 40 | 41 | newConvolutionMatrix.three.one = 0.0f; 42 | newConvolutionMatrix.three.two = _intensity; 43 | newConvolutionMatrix.three.three = _intensity * 2.0; 44 | 45 | self.convolutionKernel = newConvolutionMatrix; 46 | } 47 | 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /examples/Mac/MultiViewFilterExample/MultiViewFilterExample/MultiViewFilterExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.sunsetlakesoftware.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 Sunset Lake Software LLC. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /framework/Source/GPUImageRawDataOutput.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImageContext.h" 3 | 4 | struct GPUByteColorVector { 5 | GLubyte red; 6 | GLubyte green; 7 | GLubyte blue; 8 | GLubyte alpha; 9 | }; 10 | typedef struct GPUByteColorVector GPUByteColorVector; 11 | 12 | @protocol GPUImageRawDataProcessor; 13 | 14 | #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE 15 | @interface GPUImageRawDataOutput : NSObject { 16 | CGSize imageSize; 17 | GPUImageRotationMode inputRotation; 18 | BOOL outputBGRA; 19 | } 20 | #else 21 | @interface GPUImageRawDataOutput : NSObject { 22 | CGSize imageSize; 23 | GPUImageRotationMode inputRotation; 24 | BOOL outputBGRA; 25 | } 26 | #endif 27 | 28 | @property(readonly) GLubyte *rawBytesForImage; 29 | @property(nonatomic, copy) void(^newFrameAvailableBlock)(void); 30 | @property(nonatomic) BOOL enabled; 31 | 32 | // Initialization and teardown 33 | - (id)initWithImageSize:(CGSize)newImageSize resultsInBGRAFormat:(BOOL)resultsInBGRAFormat; 34 | 35 | // Data access 36 | - (GPUByteColorVector)colorAtLocation:(CGPoint)locationInImage; 37 | - (NSUInteger)bytesPerRowInOutput; 38 | 39 | - (void)setImageSize:(CGSize)newImageSize; 40 | 41 | - (void)lockFramebufferForReading; 42 | - (void)unlockFramebufferAfterReading; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /examples/iOS/FilterShowcaseSwift/FilterShowcaseSwift/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.sunsetlakesoftware.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarTintParameters 32 | 33 | UINavigationBar 34 | 35 | Style 36 | UIBarStyleDefault 37 | Translucent 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /framework/Source/GPUImageHighPassFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageHighPassFilter.h" 2 | 3 | @implementation GPUImageHighPassFilter 4 | 5 | @synthesize filterStrength; 6 | 7 | - (id)init; 8 | { 9 | if (!(self = [super init])) 10 | { 11 | return nil; 12 | } 13 | 14 | // Start with a low pass filter to define the component to be removed 15 | lowPassFilter = [[GPUImageLowPassFilter alloc] init]; 16 | [self addFilter:lowPassFilter]; 17 | 18 | // Take the difference of the current frame from the low pass filtered result to get the high pass 19 | differenceBlendFilter = [[GPUImageDifferenceBlendFilter alloc] init]; 20 | [self addFilter:differenceBlendFilter]; 21 | 22 | // Texture location 0 needs to be the original image for the difference blend 23 | [lowPassFilter addTarget:differenceBlendFilter atTextureLocation:1]; 24 | 25 | self.initialFilters = [NSArray arrayWithObjects:lowPassFilter, differenceBlendFilter, nil]; 26 | self.terminalFilter = differenceBlendFilter; 27 | 28 | self.filterStrength = 0.5; 29 | 30 | return self; 31 | } 32 | 33 | #pragma mark - 34 | #pragma mark Accessors 35 | 36 | - (void)setFilterStrength:(CGFloat)newValue; 37 | { 38 | lowPassFilter.filterStrength = newValue; 39 | } 40 | 41 | - (CGFloat)filterStrength; 42 | { 43 | return lowPassFilter.filterStrength; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /GPUImage.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'GPUImage' 3 | s.version = '0.1.5' 4 | s.license = 'BSD' 5 | s.summary = 'An open source iOS framework for GPU-based image and video processing.' 6 | s.homepage = 'https://github.com/BradLarson/GPUImage' 7 | s.author = { 'Brad Larson' => 'contact@sunsetlakesoftware.com' } 8 | s.source = { :git => 'https://github.com/BradLarson/GPUImage.git', :tag => "#{s.version}" } 9 | 10 | s.source_files = 'framework/Source/**/*.{h,m}' 11 | s.resources = 'framework/Resources/*.png' 12 | s.requires_arc = true 13 | s.xcconfig = { 'CLANG_MODULES_AUTOLINK' => 'YES' } 14 | 15 | s.ios.deployment_target = '5.0' 16 | s.ios.exclude_files = 'framework/Source/Mac' 17 | s.ios.frameworks = ['OpenGLES', 'CoreMedia', 'QuartzCore', 'AVFoundation'] 18 | 19 | s.osx.deployment_target = '10.6' 20 | s.osx.exclude_files = 'framework/Source/iOS', 21 | 'framework/Source/GPUImageFilterPipeline.*', 22 | 'framework/Source/GPUImageMovie.*', 23 | 'framework/Source/GPUImageMovieComposition.*', 24 | 'framework/Source/GPUImageVideoCamera.*', 25 | 'framework/Source/GPUImageStillCamera.*', 26 | 'framework/Source/GPUImageUIElement.*' 27 | s.osx.xcconfig = { 'GCC_WARN_ABOUT_RETURN_TYPE' => 'YES' } 28 | end 29 | -------------------------------------------------------------------------------- /framework/Source/GPUImageFilterPipeline.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPUImageOutput.h" 3 | 4 | @interface GPUImageFilterPipeline : NSObject 5 | { 6 | NSString *stringValue; 7 | } 8 | 9 | @property (strong) NSMutableArray *filters; 10 | 11 | @property (strong) GPUImageOutput *input; 12 | @property (strong) id output; 13 | 14 | - (id) initWithOrderedFilters:(NSArray*) filters input:(GPUImageOutput*)input output:(id )output; 15 | - (id) initWithConfiguration:(NSDictionary*) configuration input:(GPUImageOutput*)input output:(id )output; 16 | - (id) initWithConfigurationFile:(NSURL*) configuration input:(GPUImageOutput*)input output:(id )output; 17 | 18 | - (void) addFilter:(GPUImageOutput *)filter; 19 | - (void) addFilter:(GPUImageOutput *)filter atIndex:(NSUInteger)insertIndex; 20 | - (void) replaceFilterAtIndex:(NSUInteger)index withFilter:(GPUImageOutput *)filter; 21 | - (void) replaceAllFilters:(NSArray *) newFilters; 22 | - (void) removeFilter:(GPUImageOutput *)filter; 23 | - (void) removeFilterAtIndex:(NSUInteger)index; 24 | - (void) removeAllFilters; 25 | 26 | - (UIImage *) currentFilteredFrame; 27 | - (UIImage *) currentFilteredFrameWithOrientation:(UIImageOrientation)imageOrientation; 28 | - (CGImageRef) newCGImageFromCurrentFilteredFrame; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /examples/iOS/FilterShowcaseSwift/FilterShowcaseSwift/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /examples/iOS/ColorObjectTracking/ColorObjectTracking/PositionColor.fsh: -------------------------------------------------------------------------------- 1 | varying highp vec2 textureCoordinate; 2 | 3 | uniform sampler2D inputImageTexture; 4 | uniform mediump vec3 inputColor; 5 | uniform mediump float threshold; 6 | 7 | precision mediump float; 8 | 9 | vec3 normalizeColor(vec3 color) 10 | { 11 | return color / max(dot(color, vec3(1.0/3.0)), 0.3); 12 | } 13 | 14 | vec4 maskPixel(vec3 pixelColor, vec3 maskColor) 15 | { 16 | float d; 17 | vec4 calculatedColor; 18 | 19 | // Compute distance between current pixel color and reference color 20 | d = distance(normalizeColor(pixelColor), normalizeColor(maskColor)); 21 | 22 | // If color difference is larger than threshold, return black. 23 | calculatedColor = (d > threshold) ? vec4(0.0) : vec4(1.0); 24 | 25 | //Multiply color by texture 26 | return calculatedColor; 27 | } 28 | 29 | vec4 coordinateMask(vec4 maskColor, vec2 coordinate) 30 | { 31 | // Return this vector weighted by the mask value 32 | return maskColor * vec4(coordinate, vec2(0.0, 1.0)); 33 | } 34 | 35 | void main() 36 | { 37 | float d; 38 | vec4 pixelColor, maskedColor, coordinateColor; 39 | 40 | pixelColor = texture2D(inputImageTexture, textureCoordinate); 41 | maskedColor = maskPixel(pixelColor.rgb, inputColor); 42 | coordinateColor = coordinateMask(maskedColor, textureCoordinate); 43 | 44 | gl_FragColor = coordinateColor; 45 | } -------------------------------------------------------------------------------- /examples/iOS/SimpleSwiftVideoFilterExample/SimpleSwiftVideoFilterExample/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /framework/Source/GPUImageLookupFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageTwoInputFilter.h" 2 | 3 | @interface GPUImageLookupFilter : GPUImageTwoInputFilter 4 | 5 | // How To Use: 6 | // 1) Use your favourite photo editing application to apply a filter to lookup.png from GPUImage/framework/Resources. 7 | // For this to work properly each pixel color must not depend on other pixels (e.g. blur will not work). 8 | // If you need more complex filter you can create as many lookup tables as required. 9 | // E.g. color_balance_lookup_1.png -> GPUImageGaussianBlurFilter -> color_balance_lookup_2.png 10 | // 2) Use you new lookup.png file as a second input for GPUImageLookupFilter. 11 | 12 | // See GPUImageAmatorkaFilter, GPUImageMissEtikateFilter, and GPUImageSoftEleganceFilter for example. 13 | 14 | // Additional Info: 15 | // Lookup texture is organised as 8x8 quads of 64x64 pixels representing all possible RGB colors: 16 | //for (int by = 0; by < 8; by++) { 17 | // for (int bx = 0; bx < 8; bx++) { 18 | // for (int g = 0; g < 64; g++) { 19 | // for (int r = 0; r < 64; r++) { 20 | // image.setPixel(r + bx * 64, g + by * 64, qRgb((int)(r * 255.0 / 63.0 + 0.5), 21 | // (int)(g * 255.0 / 63.0 + 0.5), 22 | // (int)((bx + by * 8.0) * 255.0 / 63.0 + 0.5))); 23 | // } 24 | // } 25 | // } 26 | //} 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /framework/Source/GPUImageLightenBlendFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageLightenBlendFilter.h" 2 | 3 | #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE 4 | NSString *const kGPUImageLightenBlendFragmentShaderString = SHADER_STRING 5 | ( 6 | varying highp vec2 textureCoordinate; 7 | varying highp vec2 textureCoordinate2; 8 | 9 | uniform sampler2D inputImageTexture; 10 | uniform sampler2D inputImageTexture2; 11 | 12 | void main() 13 | { 14 | lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 15 | lowp vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2); 16 | 17 | gl_FragColor = max(textureColor, textureColor2); 18 | } 19 | ); 20 | #else 21 | NSString *const kGPUImageLightenBlendFragmentShaderString = SHADER_STRING 22 | ( 23 | varying vec2 textureCoordinate; 24 | varying vec2 textureCoordinate2; 25 | 26 | uniform sampler2D inputImageTexture; 27 | uniform sampler2D inputImageTexture2; 28 | 29 | void main() 30 | { 31 | vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 32 | vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2); 33 | 34 | gl_FragColor = max(textureColor, textureColor2); 35 | } 36 | ); 37 | #endif 38 | 39 | @implementation GPUImageLightenBlendFilter 40 | 41 | - (id)init; 42 | { 43 | if (!(self = [super initWithFragmentShaderFromString:kGPUImageLightenBlendFragmentShaderString])) 44 | { 45 | return nil; 46 | } 47 | 48 | return self; 49 | } 50 | 51 | @end 52 | 53 | -------------------------------------------------------------------------------- /examples/iOS/FilterShowcaseSwift/FilterShowcaseSwift/FilterListViewController.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class FilterListViewController: UITableViewController { 4 | 5 | var filterDisplayViewController: FilterDisplayViewController? = nil 6 | var objects = NSMutableArray() 7 | 8 | // #pragma mark - Segues 9 | 10 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 11 | if segue.identifier == "showDetail" { 12 | if let indexPath = self.tableView.indexPathForSelectedRow() { 13 | let filterInList = filterOperations[indexPath.row] 14 | (segue.destinationViewController as FilterDisplayViewController).filterOperation = filterInList 15 | } 16 | } 17 | } 18 | 19 | // #pragma mark - Table View 20 | 21 | override func numberOfSectionsInTableView(tableView: UITableView) -> Int { 22 | return 1 23 | } 24 | 25 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 26 | return filterOperations.count 27 | } 28 | 29 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 30 | let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell 31 | 32 | let filterInList:FilterOperationInterface = filterOperations[indexPath.row] 33 | cell.textLabel?.text = filterInList.listName 34 | return cell 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSourceOverBlendFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageSourceOverBlendFilter.h" 2 | 3 | #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE 4 | NSString *const kGPUImageSourceOverBlendFragmentShaderString = SHADER_STRING 5 | ( 6 | varying highp vec2 textureCoordinate; 7 | varying highp vec2 textureCoordinate2; 8 | 9 | uniform sampler2D inputImageTexture; 10 | uniform sampler2D inputImageTexture2; 11 | 12 | void main() 13 | { 14 | lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 15 | lowp vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate); 16 | 17 | gl_FragColor = mix(textureColor, textureColor2, textureColor2.a); 18 | } 19 | ); 20 | #else 21 | NSString *const kGPUImageSourceOverBlendFragmentShaderString = SHADER_STRING 22 | ( 23 | varying vec2 textureCoordinate; 24 | varying vec2 textureCoordinate2; 25 | 26 | uniform sampler2D inputImageTexture; 27 | uniform sampler2D inputImageTexture2; 28 | 29 | void main() 30 | { 31 | vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 32 | vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate); 33 | 34 | gl_FragColor = mix(textureColor, textureColor2, textureColor2.a); 35 | } 36 | ); 37 | #endif 38 | 39 | @implementation GPUImageSourceOverBlendFilter 40 | 41 | - (id)init; 42 | { 43 | if (!(self = [super initWithFragmentShaderFromString:kGPUImageSourceOverBlendFragmentShaderString])) 44 | { 45 | return nil; 46 | } 47 | 48 | return self; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /framework/Source/GPUImageTextureInput.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageTextureInput.h" 2 | 3 | @implementation GPUImageTextureInput 4 | 5 | #pragma mark - 6 | #pragma mark Initialization and teardown 7 | 8 | - (id)initWithTexture:(GLuint)newInputTexture size:(CGSize)newTextureSize; 9 | { 10 | if (!(self = [super init])) 11 | { 12 | return nil; 13 | } 14 | 15 | runSynchronouslyOnVideoProcessingQueue(^{ 16 | [GPUImageContext useImageProcessingContext]; 17 | }); 18 | 19 | textureSize = newTextureSize; 20 | 21 | runSynchronouslyOnVideoProcessingQueue(^{ 22 | outputFramebuffer = [[GPUImageFramebuffer alloc] initWithSize:newTextureSize overriddenTexture:newInputTexture]; 23 | }); 24 | 25 | return self; 26 | } 27 | 28 | #pragma mark - 29 | #pragma mark Image rendering 30 | 31 | - (void)processTextureWithFrameTime:(CMTime)frameTime; 32 | { 33 | runAsynchronouslyOnVideoProcessingQueue(^{ 34 | for (id currentTarget in targets) 35 | { 36 | NSInteger indexOfObject = [targets indexOfObject:currentTarget]; 37 | NSInteger targetTextureIndex = [[targetTextureIndices objectAtIndex:indexOfObject] integerValue]; 38 | 39 | [currentTarget setInputSize:textureSize atIndex:targetTextureIndex]; 40 | [currentTarget setInputFramebuffer:outputFramebuffer atIndex:targetTextureIndex]; 41 | [currentTarget newFrameReadyAtTime:frameTime atIndex:targetTextureIndex]; 42 | } 43 | }); 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /framework/Source/GPUImageSubtractBlendFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageSubtractBlendFilter.h" 2 | 3 | #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE 4 | NSString *const kGPUImageSubtractBlendFragmentShaderString = SHADER_STRING 5 | ( 6 | varying highp vec2 textureCoordinate; 7 | varying highp vec2 textureCoordinate2; 8 | 9 | uniform sampler2D inputImageTexture; 10 | uniform sampler2D inputImageTexture2; 11 | 12 | void main() 13 | { 14 | lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 15 | lowp vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2); 16 | 17 | gl_FragColor = vec4(textureColor.rgb - textureColor2.rgb, textureColor.a); 18 | } 19 | ); 20 | #else 21 | NSString *const kGPUImageSubtractBlendFragmentShaderString = SHADER_STRING 22 | ( 23 | varying vec2 textureCoordinate; 24 | varying vec2 textureCoordinate2; 25 | 26 | uniform sampler2D inputImageTexture; 27 | uniform sampler2D inputImageTexture2; 28 | 29 | void main() 30 | { 31 | vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 32 | vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2); 33 | 34 | gl_FragColor = vec4(textureColor.rgb - textureColor2.rgb, textureColor.a); 35 | } 36 | ); 37 | #endif 38 | 39 | @implementation GPUImageSubtractBlendFilter 40 | 41 | - (id)init; 42 | { 43 | if (!(self = [super initWithFragmentShaderFromString:kGPUImageSubtractBlendFragmentShaderString])) 44 | { 45 | return nil; 46 | } 47 | 48 | return self; 49 | } 50 | 51 | @end 52 | 53 | -------------------------------------------------------------------------------- /examples/iOS/SimpleImageFilter/SimpleImageFilter/SimpleImageFilter-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ImageFilter 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFiles 12 | 13 | CFBundleIdentifier 14 | com.sunsetlakesoftware.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | UIFileSharingEnabled 30 | 31 | UIPrerenderedIcon 32 | 33 | UIRequiredDeviceCapabilities 34 | 35 | opengles-2 36 | 37 | UISupportedInterfaceOrientations 38 | 39 | UIInterfaceOrientationPortrait 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /framework/Source/GPUImageFASTCornerDetectionFilter.h: -------------------------------------------------------------------------------- 1 | #import "GPUImageFilterGroup.h" 2 | 3 | @class GPUImageGrayscaleFilter; 4 | @class GPUImage3x3TextureSamplingFilter; 5 | @class GPUImageNonMaximumSuppressionFilter; 6 | 7 | /* 8 | An implementation of the Features from Accelerated Segment Test (FAST) feature detector as described in the following publications: 9 | 10 | E. Rosten and T. Drummond. Fusing points and lines for high performance tracking. IEEE International Conference on Computer Vision, 2005. 11 | E. Rosten and T. Drummond. Machine learning for high-speed corner detection. European Conference on Computer Vision, 2006. 12 | 13 | For more about the FAST feature detector, see the resources here: 14 | http://www.edwardrosten.com/work/fast.html 15 | */ 16 | 17 | typedef enum { kGPUImageFAST12Contiguous, kGPUImageFAST12ContiguousNonMaximumSuppressed} GPUImageFASTDetectorType; 18 | 19 | @interface GPUImageFASTCornerDetectionFilter : GPUImageFilterGroup 20 | { 21 | GPUImageGrayscaleFilter *luminanceReductionFilter; 22 | GPUImage3x3TextureSamplingFilter *featureDetectionFilter; 23 | GPUImageNonMaximumSuppressionFilter *nonMaximumSuppressionFilter; 24 | // Generate a lookup texture based on the bit patterns 25 | 26 | // Step 1: convert to monochrome if necessary 27 | // Step 2: do a lookup at each pixel based on the Bresenham circle, encode comparison in two color components 28 | // Step 3: do non-maximum suppression of close corner points 29 | } 30 | 31 | - (id)initWithFASTDetectorVariant:(GPUImageFASTDetectorType)detectorType; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /framework/Source/GPUImageDifferenceBlendFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageDifferenceBlendFilter.h" 2 | 3 | #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE 4 | NSString *const kGPUImageDifferenceBlendFragmentShaderString = SHADER_STRING 5 | ( 6 | varying highp vec2 textureCoordinate; 7 | varying highp vec2 textureCoordinate2; 8 | 9 | uniform sampler2D inputImageTexture; 10 | uniform sampler2D inputImageTexture2; 11 | 12 | void main() 13 | { 14 | mediump vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 15 | mediump vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2); 16 | gl_FragColor = vec4(abs(textureColor2.rgb - textureColor.rgb), textureColor.a); 17 | } 18 | ); 19 | #else 20 | NSString *const kGPUImageDifferenceBlendFragmentShaderString = SHADER_STRING 21 | ( 22 | varying vec2 textureCoordinate; 23 | varying vec2 textureCoordinate2; 24 | 25 | uniform sampler2D inputImageTexture; 26 | uniform sampler2D inputImageTexture2; 27 | 28 | void main() 29 | { 30 | vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 31 | vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2); 32 | gl_FragColor = vec4(abs(textureColor2.rgb - textureColor.rgb), textureColor.a); 33 | } 34 | ); 35 | #endif 36 | 37 | @implementation GPUImageDifferenceBlendFilter 38 | 39 | - (id)init; 40 | { 41 | if (!(self = [super initWithFragmentShaderFromString:kGPUImageDifferenceBlendFragmentShaderString])) 42 | { 43 | return nil; 44 | } 45 | 46 | return self; 47 | } 48 | 49 | @end 50 | 51 | -------------------------------------------------------------------------------- /framework/Source/GPUImageMultiplyBlendFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageMultiplyBlendFilter.h" 2 | 3 | #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE 4 | NSString *const kGPUImageMultiplyBlendFragmentShaderString = SHADER_STRING 5 | ( 6 | varying highp vec2 textureCoordinate; 7 | varying highp vec2 textureCoordinate2; 8 | 9 | uniform sampler2D inputImageTexture; 10 | uniform sampler2D inputImageTexture2; 11 | 12 | void main() 13 | { 14 | lowp vec4 base = texture2D(inputImageTexture, textureCoordinate); 15 | lowp vec4 overlayer = texture2D(inputImageTexture2, textureCoordinate2); 16 | 17 | gl_FragColor = overlayer * base + overlayer * (1.0 - base.a) + base * (1.0 - overlayer.a); 18 | } 19 | ); 20 | #else 21 | NSString *const kGPUImageMultiplyBlendFragmentShaderString = SHADER_STRING 22 | ( 23 | varying vec2 textureCoordinate; 24 | varying vec2 textureCoordinate2; 25 | 26 | uniform sampler2D inputImageTexture; 27 | uniform sampler2D inputImageTexture2; 28 | 29 | void main() 30 | { 31 | vec4 base = texture2D(inputImageTexture, textureCoordinate); 32 | vec4 overlayer = texture2D(inputImageTexture2, textureCoordinate2); 33 | 34 | gl_FragColor = overlayer * base + overlayer * (1.0 - base.a) + base * (1.0 - overlayer.a); 35 | } 36 | ); 37 | #endif 38 | 39 | @implementation GPUImageMultiplyBlendFilter 40 | 41 | - (id)init; 42 | { 43 | if (!(self = [super initWithFragmentShaderFromString:kGPUImageMultiplyBlendFragmentShaderString])) 44 | { 45 | return nil; 46 | } 47 | 48 | return self; 49 | } 50 | 51 | @end 52 | 53 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Brad Larson, Ben Cochran, Hugues Lismonde, Keitaroh Kobayashi, Alaric Cole, Matthew Clark, Jacob Gundersen, Chris Williams. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | Neither the name of the GPUImage framework nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 10 | -------------------------------------------------------------------------------- /examples/iOS/BenchmarkSuite/BenchmarkSuite/VideoFilteringDisplayController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "GPUImage.h" 4 | 5 | @protocol VideoFilteringCallback; 6 | 7 | @interface VideoFilteringDisplayController : UIViewController 8 | { 9 | CGFloat totalFrameTimeForCPU, totalFrameTimeForCoreImage, totalFrameTimeForGPUImage; 10 | NSUInteger numberOfCPUFramesCaptured, numberOfCoreImageFramesCaptured, numberOfGPUImageFramesCaptured; 11 | 12 | GLKView *videoDisplayView; 13 | AVCaptureSession *captureSession; 14 | AVCaptureDeviceInput *videoInput; 15 | AVCaptureVideoDataOutput *videoOutput; 16 | 17 | CIContext *coreImageContext; 18 | CIFilter *coreImageFilter; 19 | 20 | GLuint _renderBuffer; 21 | 22 | BOOL processUsingCPU; 23 | 24 | GPUImageVideoCamera *videoCamera; 25 | GPUImageOutput *benchmarkedGPUImageFilter; 26 | GPUImageView *filterView; 27 | 28 | __unsafe_unretained id delegate; 29 | } 30 | 31 | @property(unsafe_unretained, nonatomic) id delegate; 32 | @property (strong, nonatomic) EAGLContext *openGLESContext; 33 | 34 | // Video filtering 35 | - (void)startAVFoundationVideoProcessing; 36 | - (void)displayVideoForCPU; 37 | - (void)displayVideoForCoreImage; 38 | - (void)displayVideoForGPUImage; 39 | 40 | @end 41 | 42 | @protocol VideoFilteringCallback 43 | 44 | - (void)finishedTestWithAverageTimesForCPU:(CGFloat)cpuTime coreImage:(CGFloat)coreImageTime gpuImage:(CGFloat)gpuImageTime; 45 | 46 | @end -------------------------------------------------------------------------------- /framework/Source/GLProgram.h: -------------------------------------------------------------------------------- 1 | // This is Jeff LaMarche's GLProgram OpenGL shader wrapper class from his OpenGL ES 2.0 book. 2 | // A description of this can be found at his page on the topic: 3 | // http://iphonedevelopment.blogspot.com/2010/11/opengl-es-20-for-ios-chapter-4.html 4 | // I've extended this to be able to take programs as NSStrings in addition to files, for baked-in shaders 5 | 6 | #import 7 | 8 | #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE 9 | #import 10 | #import 11 | #else 12 | #import 13 | #import 14 | #endif 15 | 16 | @interface GLProgram : NSObject 17 | { 18 | NSMutableArray *attributes; 19 | NSMutableArray *uniforms; 20 | GLuint program, 21 | vertShader, 22 | fragShader; 23 | } 24 | 25 | @property(readwrite, nonatomic) BOOL initialized; 26 | 27 | - (id)initWithVertexShaderString:(NSString *)vShaderString 28 | fragmentShaderString:(NSString *)fShaderString; 29 | - (id)initWithVertexShaderString:(NSString *)vShaderString 30 | fragmentShaderFilename:(NSString *)fShaderFilename; 31 | - (id)initWithVertexShaderFilename:(NSString *)vShaderFilename 32 | fragmentShaderFilename:(NSString *)fShaderFilename; 33 | - (void)addAttribute:(NSString *)attributeName; 34 | - (GLuint)attributeIndex:(NSString *)attributeName; 35 | - (GLuint)uniformIndex:(NSString *)uniformName; 36 | - (BOOL)link; 37 | - (void)use; 38 | - (NSString *)vertexShaderLog; 39 | - (NSString *)fragmentShaderLog; 40 | - (NSString *)programLog; 41 | - (void)validate; 42 | @end 43 | -------------------------------------------------------------------------------- /framework/Source/GPUImageAverageLuminanceThresholdFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageAverageLuminanceThresholdFilter.h" 2 | #import "GPUImageLuminosity.h" 3 | #import "GPUImageLuminanceThresholdFilter.h" 4 | 5 | @interface GPUImageAverageLuminanceThresholdFilter() 6 | { 7 | GPUImageLuminosity *luminosityFilter; 8 | GPUImageLuminanceThresholdFilter *luminanceThresholdFilter; 9 | } 10 | @end 11 | 12 | @implementation GPUImageAverageLuminanceThresholdFilter 13 | 14 | @synthesize thresholdMultiplier = _thresholdMultiplier; 15 | 16 | #pragma mark - 17 | #pragma mark Initialization and teardown 18 | 19 | - (id)init; 20 | { 21 | if (!(self = [super init])) 22 | { 23 | return nil; 24 | } 25 | 26 | self.thresholdMultiplier = 1.0; 27 | 28 | luminosityFilter = [[GPUImageLuminosity alloc] init]; 29 | [self addFilter:luminosityFilter]; 30 | 31 | luminanceThresholdFilter = [[GPUImageLuminanceThresholdFilter alloc] init]; 32 | [self addFilter:luminanceThresholdFilter]; 33 | 34 | __unsafe_unretained GPUImageAverageLuminanceThresholdFilter *weakSelf = self; 35 | __unsafe_unretained GPUImageLuminanceThresholdFilter *weakThreshold = luminanceThresholdFilter; 36 | 37 | [luminosityFilter setLuminosityProcessingFinishedBlock:^(CGFloat luminosity, CMTime frameTime) { 38 | weakThreshold.threshold = luminosity * weakSelf.thresholdMultiplier; 39 | }]; 40 | 41 | self.initialFilters = [NSArray arrayWithObjects:luminosityFilter, luminanceThresholdFilter, nil]; 42 | self.terminalFilter = luminanceThresholdFilter; 43 | 44 | return self; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /framework/Source/GPUImageColorBurnBlendFilter.m: -------------------------------------------------------------------------------- 1 | #import "GPUImageColorBurnBlendFilter.h" 2 | 3 | #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE 4 | NSString *const kGPUImageColorBurnBlendFragmentShaderString = SHADER_STRING 5 | ( 6 | varying highp vec2 textureCoordinate; 7 | varying highp vec2 textureCoordinate2; 8 | 9 | uniform sampler2D inputImageTexture; 10 | uniform sampler2D inputImageTexture2; 11 | 12 | void main() 13 | { 14 | mediump vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 15 | mediump vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2); 16 | mediump vec4 whiteColor = vec4(1.0); 17 | gl_FragColor = whiteColor - (whiteColor - textureColor) / textureColor2; 18 | } 19 | ); 20 | #else 21 | NSString *const kGPUImageColorBurnBlendFragmentShaderString = SHADER_STRING 22 | ( 23 | varying vec2 textureCoordinate; 24 | varying vec2 textureCoordinate2; 25 | 26 | uniform sampler2D inputImageTexture; 27 | uniform sampler2D inputImageTexture2; 28 | 29 | void main() 30 | { 31 | vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 32 | vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2); 33 | vec4 whiteColor = vec4(1.0); 34 | gl_FragColor = whiteColor - (whiteColor - textureColor) / textureColor2; 35 | } 36 | ); 37 | #endif 38 | 39 | @implementation GPUImageColorBurnBlendFilter 40 | 41 | - (id)init; 42 | { 43 | if (!(self = [super initWithFragmentShaderFromString:kGPUImageColorBurnBlendFragmentShaderString])) 44 | { 45 | return nil; 46 | } 47 | 48 | return self; 49 | } 50 | 51 | @end 52 | 53 | --------------------------------------------------------------------------------