Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/BradLarson/GPUImage
Browse files Browse the repository at this point in the history
  • Loading branch information
jjxtra committed Jan 29, 2013
2 parents 7cb386c + 389f090 commit 59bc06c
Show file tree
Hide file tree
Showing 63 changed files with 1,844 additions and 330 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
case GPUIMAGE_AMATORKA: cell.textLabel.text = @"Amatorka (Lookup)"; break;
case GPUIMAGE_PIXELLATE: cell.textLabel.text = @"Pixellate"; break;
case GPUIMAGE_POLARPIXELLATE: cell.textLabel.text = @"Polar pixellate"; break;
case GPUIMAGE_PIXELLATE_POSITION: cell.textLabel.text = @"Pixellate (position)"; break;
case GPUIMAGE_POLKADOT: cell.textLabel.text = @"Polka dot"; break;
case GPUIMAGE_HALFTONE: cell.textLabel.text = @"Halftone"; break;
case GPUIMAGE_CROSSHATCH: cell.textLabel.text = @"Crosshatch"; break;
Expand Down Expand Up @@ -148,6 +149,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
case GPUIMAGE_SCREENBLEND: cell.textLabel.text = @"Screen blend"; break;
case GPUIMAGE_COLORBURN: cell.textLabel.text = @"Color burn blend"; break;
case GPUIMAGE_COLORDODGE: cell.textLabel.text = @"Color dodge blend"; break;
case GPUIMAGE_LINEARBURN: cell.textLabel.text = @"Linear burn blend"; break;
case GPUIMAGE_ADD: cell.textLabel.text = @"Add blend"; break;
case GPUIMAGE_DIVIDE: cell.textLabel.text = @"Divide blend"; break;
case GPUIMAGE_MULTIPLY: cell.textLabel.text = @"Multiply blend"; break;
Expand All @@ -159,6 +161,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
case GPUIMAGE_SUBTRACTBLEND: cell.textLabel.text = @"Subtract blend"; break;
case GPUIMAGE_HARDLIGHTBLEND: cell.textLabel.text = @"Hard light blend"; break;
case GPUIMAGE_SOFTLIGHTBLEND: cell.textLabel.text = @"Soft light blend"; break;
case GPUIMAGE_COLORBLEND: cell.textLabel.text = @"Color blend"; break;
case GPUIMAGE_HUEBLEND: cell.textLabel.text = @"Hue blend"; break;
case GPUIMAGE_SATURATIONBLEND: cell.textLabel.text = @"Saturation blend"; break;
case GPUIMAGE_LUMINOSITYBLEND: cell.textLabel.text = @"Luminosity blend"; break;
case GPUIMAGE_NORMALBLEND: cell.textLabel.text = @"Normal blend"; break;
case GPUIMAGE_OPACITY: cell.textLabel.text = @"Opacity adjustment"; break;
case GPUIMAGE_KUWAHARA: cell.textLabel.text = @"Kuwahara"; break;
Expand All @@ -169,6 +175,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
case GPUIMAGE_BILATERAL: cell.textLabel.text = @"Bilateral blur"; break;
case GPUIMAGE_BOXBLUR: cell.textLabel.text = @"Box blur"; break;
case GPUIMAGE_GAUSSIAN_SELECTIVE: cell.textLabel.text = @"Gaussian selective blur"; break;
case GPUIMAGE_GAUSSIAN_POSITION: cell.textLabel.text = @"Gaussian (centered)"; break;
case GPUIMAGE_UIELEMENT: cell.textLabel.text = @"UI element"; break;
case GPUIMAGE_CUSTOM: cell.textLabel.text = @"Custom"; break;
case GPUIMAGE_FILECONFIG: cell.textLabel.text = @"Filter Chain"; break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ typedef enum {
GPUIMAGE_AVERAGELUMINANCETHRESHOLD,
GPUIMAGE_PIXELLATE,
GPUIMAGE_POLARPIXELLATE,
GPUIMAGE_PIXELLATE_POSITION,
GPUIMAGE_POLKADOT,
GPUIMAGE_HALFTONE,
GPUIMAGE_CROSSHATCH,
Expand Down Expand Up @@ -66,6 +67,7 @@ typedef enum {
GPUIMAGE_VIGNETTE,
GPUIMAGE_GAUSSIAN,
GPUIMAGE_GAUSSIAN_SELECTIVE,
GPUIMAGE_GAUSSIAN_POSITION,
GPUIMAGE_FASTBLUR,
GPUIMAGE_BOXBLUR,
GPUIMAGE_MEDIAN,
Expand Down Expand Up @@ -94,12 +96,17 @@ typedef enum {
GPUIMAGE_DARKEN,
GPUIMAGE_COLORBURN,
GPUIMAGE_COLORDODGE,
GPUIMAGE_LINEARBURN,
GPUIMAGE_SCREENBLEND,
GPUIMAGE_DIFFERENCEBLEND,
GPUIMAGE_SUBTRACTBLEND,
GPUIMAGE_EXCLUSIONBLEND,
GPUIMAGE_HARDLIGHTBLEND,
GPUIMAGE_SOFTLIGHTBLEND,
GPUIMAGE_COLORBLEND,
GPUIMAGE_HUEBLEND,
GPUIMAGE_SATURATIONBLEND,
GPUIMAGE_LUMINOSITYBLEND,
GPUIMAGE_NORMALBLEND,
GPUIMAGE_OPACITY,
GPUIMAGE_CUSTOM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
- (void)setupFilter;
{
videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
// videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset1280x720 cameraPosition:AVCaptureDevicePositionBack];
// videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset1920x1080 cameraPosition:AVCaptureDevicePositionBack];
// videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionFront];
videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
facesSwitch.hidden = YES;
Expand Down Expand Up @@ -104,6 +106,17 @@ - (void)setupFilter;

filter = [[GPUImagePolarPixellateFilter alloc] init];
}; break;
case GPUIMAGE_PIXELLATE_POSITION:
{
self.title = @"Pixellate (position)";
self.filterSettingsSlider.hidden = NO;

[self.filterSettingsSlider setValue:0.25];
[self.filterSettingsSlider setMinimumValue:0.0];
[self.filterSettingsSlider setMaximumValue:0.5];

filter = [[GPUImagePixellatePositionFilter alloc] init];
}; break;
case GPUIMAGE_POLKADOT:
{
self.title = @"Polka Dot";
Expand Down Expand Up @@ -968,6 +981,14 @@ - (void)setupFilter;

filter = [[GPUImageColorDodgeBlendFilter alloc] init];
}; break;
case GPUIMAGE_LINEARBURN:
{
self.title = @"Linear Burn Blend";
self.filterSettingsSlider.hidden = YES;
needsSecondImage = YES;

filter = [[GPUImageLinearBurnBlendFilter alloc] init];
}; break;
case GPUIMAGE_EXCLUSIONBLEND:
{
self.title = @"Exclusion Blend";
Expand Down Expand Up @@ -1008,6 +1029,38 @@ - (void)setupFilter;

filter = [[GPUImageSoftLightBlendFilter alloc] init];
}; break;
case GPUIMAGE_COLORBLEND:
{
self.title = @"Color Blend";
self.filterSettingsSlider.hidden = YES;
needsSecondImage = YES;

filter = [[GPUImageColorBlendFilter alloc] init];
}; break;
case GPUIMAGE_HUEBLEND:
{
self.title = @"Hue Blend";
self.filterSettingsSlider.hidden = YES;
needsSecondImage = YES;

filter = [[GPUImageHueBlendFilter alloc] init];
}; break;
case GPUIMAGE_SATURATIONBLEND:
{
self.title = @"Saturation Blend";
self.filterSettingsSlider.hidden = YES;
needsSecondImage = YES;

filter = [[GPUImageSaturationBlendFilter alloc] init];
}; break;
case GPUIMAGE_LUMINOSITYBLEND:
{
self.title = @"Luminosity Blend";
self.filterSettingsSlider.hidden = YES;
needsSecondImage = YES;

filter = [[GPUImageLuminosityBlendFilter alloc] init];
}; break;
case GPUIMAGE_NORMALBLEND:
{
self.title = @"Normal Blend";
Expand Down Expand Up @@ -1113,6 +1166,18 @@ - (void)setupFilter;
filter = [[GPUImageGaussianSelectiveBlurFilter alloc] init];
[(GPUImageGaussianSelectiveBlurFilter*)filter setExcludeCircleRadius:40.0/320.0];
}; break;
case GPUIMAGE_GAUSSIAN_POSITION:
{
self.title = @"Selective Blur";
self.filterSettingsSlider.hidden = NO;

[self.filterSettingsSlider setMinimumValue:0.0];
[self.filterSettingsSlider setMaximumValue:.75f];
[self.filterSettingsSlider setValue:40.0/320.0];

filter = [[GPUImageGaussianBlurPositionFilter alloc] init];
[(GPUImageGaussianBlurPositionFilter*)filter setBlurRadius:40.0/320.0];
}; break;
case GPUIMAGE_BILATERAL:
{
self.title = @"Bilateral Blur";
Expand Down Expand Up @@ -1415,6 +1480,7 @@ - (IBAction)updateFilterFromSlider:(id)sender;
case GPUIMAGE_SEPIA: [(GPUImageSepiaFilter *)filter setIntensity:[(UISlider *)sender value]]; break;
case GPUIMAGE_PIXELLATE: [(GPUImagePixellateFilter *)filter setFractionalWidthOfAPixel:[(UISlider *)sender value]]; break;
case GPUIMAGE_POLARPIXELLATE: [(GPUImagePolarPixellateFilter *)filter setPixelSize:CGSizeMake([(UISlider *)sender value], [(UISlider *)sender value])]; break;
case GPUIMAGE_PIXELLATE_POSITION: [(GPUImagePixellatePositionFilter *)filter setRadius:[(UISlider *)sender value]]; break;
case GPUIMAGE_POLKADOT: [(GPUImagePolkaDotFilter *)filter setFractionalWidthOfAPixel:[(UISlider *)sender value]]; break;
case GPUIMAGE_HALFTONE: [(GPUImageHalftoneFilter *)filter setFractionalWidthOfAPixel:[(UISlider *)sender value]]; break;
case GPUIMAGE_SATURATION: [(GPUImageSaturationFilter *)filter setSaturation:[(UISlider *)sender value]]; break;
Expand Down Expand Up @@ -1472,11 +1538,13 @@ - (IBAction)updateFilterFromSlider:(id)sender;
case GPUIMAGE_MOSAIC: [(GPUImageMosaicFilter *)filter setDisplayTileSize:CGSizeMake([(UISlider *)sender value], [(UISlider *)sender value])]; break;
case GPUIMAGE_VIGNETTE: [(GPUImageVignetteFilter *)filter setVignetteEnd:[(UISlider *)sender value]]; break;
case GPUIMAGE_GAUSSIAN: [(GPUImageGaussianBlurFilter *)filter setBlurSize:[(UISlider*)sender value]]; break;
case GPUIMAGE_BILATERAL: [(GPUImageBilateralFilter *)filter setBlurSize:[(UISlider*)sender value]]; break;
// case GPUIMAGE_BILATERAL: [(GPUImageBilateralFilter *)filter setBlurSize:[(UISlider*)sender value]]; break;
case GPUIMAGE_BILATERAL: [(GPUImageBilateralFilter *)filter setDistanceNormalizationFactor:[(UISlider*)sender value]]; break;
case GPUIMAGE_FASTBLUR: [(GPUImageFastBlurFilter *)filter setBlurPasses:round([(UISlider*)sender value])]; break;
// case GPUIMAGE_FASTBLUR: [(GPUImageFastBlurFilter *)filter setBlurSize:[(UISlider*)sender value]]; break;
case GPUIMAGE_OPACITY: [(GPUImageOpacityFilter *)filter setOpacity:[(UISlider *)sender value]]; break;
case GPUIMAGE_GAUSSIAN_SELECTIVE: [(GPUImageGaussianSelectiveBlurFilter *)filter setExcludeCircleRadius:[(UISlider*)sender value]]; break;
case GPUIMAGE_GAUSSIAN_POSITION: [(GPUImageGaussianBlurPositionFilter *)filter setBlurRadius:[(UISlider *)sender value]]; break;
case GPUIMAGE_FILTERGROUP: [(GPUImagePixellateFilter *)[(GPUImageFilterGroup *)filter filterAtIndex:1] setFractionalWidthOfAPixel:[(UISlider *)sender value]]; break;
case GPUIMAGE_CROP: [(GPUImageCropFilter *)filter setCropRegion:CGRectMake(0.0, 0.0, 1.0, [(UISlider*)sender value])]; break;
case GPUIMAGE_TRANSFORM: [(GPUImageTransformFilter *)filter setAffineTransform:CGAffineTransformMakeRotation([(UISlider*)sender value])]; break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,31 @@ - (void)loadView
GPUImageFilter *filter2 = [[GPUImageFilter alloc] initWithFragmentShaderFromFile:@"Shader2"];
GPUImageSepiaFilter *filter3 = [[GPUImageSepiaFilter alloc] init];

// GPUImageBrightnessFilter *filter1 = [[GPUImageBrightnessFilter alloc] init];
// GPUImageBrightnessFilter *filter2 = [[GPUImageBrightnessFilter alloc] init];
// [filter2 setBrightness:0.5];
// GPUImageBrightnessFilter *filter3 = [[GPUImageBrightnessFilter alloc] init];
// [filter3 setBrightness:-0.5];

// GPUImageSobelEdgeDetectionFilter *filter1 = [[GPUImageSobelEdgeDetectionFilter alloc] init];
// GPUImageSobelEdgeDetectionFilter *filter2 = [[GPUImageSobelEdgeDetectionFilter alloc] init];
// [filter2 setTexelHeight:(1.0 / 1024.0)];
// [filter2 setTexelWidth:(1.0 / 768.0)];
// GPUImageSobelEdgeDetectionFilter *filter3 = [[GPUImageSobelEdgeDetectionFilter alloc] init];
// [filter3 setTexelHeight:(1.0 / 200.0)];
// [filter3 setTexelWidth:(1.0 / 400.0)];

// GPUImageTransformFilter *filter1 = [[GPUImageTransformFilter alloc] init];
// GPUImageTransformFilter *filter2 = [[GPUImageTransformFilter alloc] init];
// CATransform3D perspectiveTransform = CATransform3DIdentity;
// perspectiveTransform.m34 = 0.4;
// perspectiveTransform.m33 = 0.4;
// perspectiveTransform = CATransform3DScale(perspectiveTransform, 0.75, 0.75, 0.75);
// perspectiveTransform = CATransform3DRotate(perspectiveTransform, 0.5, 0.0, 1.0, 0.0);
// [filter2 setTransform3D:perspectiveTransform];
// GPUImageTransformFilter *filter3 = [[GPUImageTransformFilter alloc] init];
// [filter3 setAffineTransform:CGAffineTransformMakeRotation(1.0)];

// For thumbnails smaller than the input video size, we currently need to make them render at a smaller size.
// This is to avoid wasting processing time on larger frames than will be displayed.
// You'll need to use -forceProcessingAtSize: with a zero size to re-enable full frame processing of video.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,19 @@ - (void)viewDidLoad
// stillCamera = [[GPUImageStillCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
stillCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
// filter = [[GPUImageGammaFilter alloc] init];
// filter = [[GPUImageSketchFilter alloc] init];
filter = [[GPUImageSketchFilter alloc] init];
// filter = [[GPUImageUnsharpMaskFilter alloc] init];
// [(GPUImageSketchFilter *)filter setTexelHeight:(1.0 / 1024.0)];
// [(GPUImageSketchFilter *)filter setTexelWidth:(1.0 / 768.0)];
// filter = [[GPUImageSmoothToonFilter alloc] init];
filter = [[GPUImageSepiaFilter alloc] init];
// filter = [[GPUImageSepiaFilter alloc] init];
// filter = [[GPUImageCropFilter alloc] initWithCropRegion:CGRectMake(0.5, 0.5, 0.5, 0.5)];
// secondFilter = [[GPUImageSepiaFilter alloc] init];
// terminalFilter = [[GPUImageSepiaFilter alloc] init];
// [filter addTarget:secondFilter];
// [secondFilter addTarget:terminalFilter];

[filter prepareForImageCapture];
// [filter prepareForImageCapture];
// [terminalFilter prepareForImageCapture];

[stillCamera addTarget:filter];
Expand Down Expand Up @@ -107,7 +108,7 @@ - (IBAction)takePhoto:(id)sender;
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
// report_memory(@"After asset library creation");

[library writeImageDataToSavedPhotosAlbum:processedJPEG metadata:nil completionBlock:^(NSURL *assetURL, NSError *error2)
[library writeImageDataToSavedPhotosAlbum:processedJPEG metadata:stillCamera.currentCaptureMetadata completionBlock:^(NSURL *assetURL, NSError *error2)
{
// report_memory(@"After writing to library");
if (error2) {
Expand Down
Loading

0 comments on commit 59bc06c

Please sign in to comment.