Skip to content

Commit

Permalink
Added a fix for a compilation error and a quick check to reduce redun…
Browse files Browse the repository at this point in the history
…dant context setting calls.
  • Loading branch information
BradLarson committed May 28, 2012
1 parent 68cf745 commit 615dc5d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions examples/RawDataTest/RawDataTest/RawDataTestAppDelegate.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
}]; }];


[rawDataInput processData]; [rawDataInput processData];

free(rawDataBytes);


return YES; return YES;
} }
Expand Down
11 changes: 3 additions & 8 deletions framework/Source/GPUImageHarrisCornerDetectionFilter.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ - (id)initWithCornerDetectionFragmentShader:(NSString *)cornerDetectionFragmentS


// First pass: reduce to luminance and take the derivative of the luminance texture // First pass: reduce to luminance and take the derivative of the luminance texture
derivativeFilter = [[GPUImageXYDerivativeFilter alloc] init]; derivativeFilter = [[GPUImageXYDerivativeFilter alloc] init];
// derivativeFilter.imageWidthFactor = 256.0;
// derivativeFilter.imageHeightFactor = 256.0;
[self addFilter:derivativeFilter]; [self addFilter:derivativeFilter];


#ifdef DEBUGFEATUREDETECTION #ifdef DEBUGFEATUREDETECTION
Expand All @@ -103,7 +101,6 @@ - (id)initWithCornerDetectionFragmentShader:(NSString *)cornerDetectionFragmentS
#endif #endif


// Second pass: blur the derivative // Second pass: blur the derivative
// blurFilter = [[GPUImageGaussianBlurFilter alloc] init];
blurFilter = [[GPUImageFastBlurFilter alloc] init]; blurFilter = [[GPUImageFastBlurFilter alloc] init];
[self addFilter:blurFilter]; [self addFilter:blurFilter];


Expand Down Expand Up @@ -162,8 +159,6 @@ - (id)initWithCornerDetectionFragmentShader:(NSString *)cornerDetectionFragmentS
[nonMaximumSuppressionFilter addTarget:simpleThresholdFilter]; [nonMaximumSuppressionFilter addTarget:simpleThresholdFilter];


self.initialFilters = [NSArray arrayWithObjects:derivativeFilter, nil]; self.initialFilters = [NSArray arrayWithObjects:derivativeFilter, nil];
// self.terminalFilter = harrisCornerDetectionFilter;
// self.terminalFilter = nonMaximumSuppressionFilter;
self.terminalFilter = simpleThresholdFilter; self.terminalFilter = simpleThresholdFilter;


self.blurSize = 1.0; self.blurSize = 1.0;
Expand Down Expand Up @@ -196,7 +191,7 @@ - (void)extractCornerLocationsFromImageAtFrameTime:(CMTime)frameTime;


glReadPixels(0, 0, (int)imageSize.width, (int)imageSize.height, GL_RGBA, GL_UNSIGNED_BYTE, rawImagePixels); glReadPixels(0, 0, (int)imageSize.width, (int)imageSize.height, GL_RGBA, GL_UNSIGNED_BYTE, rawImagePixels);


CFAbsoluteTime startTime = CFAbsoluteTimeGetCurrent(); // CFAbsoluteTime startTime = CFAbsoluteTimeGetCurrent();


for (unsigned int yCoordinate = 0; yCoordinate < imageSize.height; yCoordinate++) for (unsigned int yCoordinate = 0; yCoordinate < imageSize.height; yCoordinate++)
{ {
Expand All @@ -216,8 +211,8 @@ - (void)extractCornerLocationsFromImageAtFrameTime:(CMTime)frameTime;
} }
} }


CFAbsoluteTime currentFrameTime = (CFAbsoluteTimeGetCurrent() - startTime); // CFAbsoluteTime currentFrameTime = (CFAbsoluteTimeGetCurrent() - startTime);
NSLog(@"Processing time : %f ms", 1000.0 * currentFrameTime); // NSLog(@"Processing time : %f ms", 1000.0 * currentFrameTime);


if (cornersDetectedBlock != NULL) if (cornersDetectedBlock != NULL)
{ {
Expand Down
6 changes: 5 additions & 1 deletion framework/Source/GPUImageOpenGLESContext.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ + (GPUImageOpenGLESContext *)sharedImageProcessingOpenGLESContext;


+ (void)useImageProcessingContext; + (void)useImageProcessingContext;
{ {
[EAGLContext setCurrentContext:[[GPUImageOpenGLESContext sharedImageProcessingOpenGLESContext] context]]; EAGLContext *imageProcessingContext = [[GPUImageOpenGLESContext sharedImageProcessingOpenGLESContext] context];
if ([EAGLContext currentContext] != imageProcessingContext)
{
[EAGLContext setCurrentContext:imageProcessingContext];
}
} }


+ (GLint)maximumTextureSizeForThisDevice; + (GLint)maximumTextureSizeForThisDevice;
Expand Down
1 change: 1 addition & 0 deletions framework/Source/GPUImageRawDataInput.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
// Image rendering // Image rendering
- (void)updateDataFromBytes:(GLubyte *)bytesToUpload size:(CGSize)imageSize; - (void)updateDataFromBytes:(GLubyte *)bytesToUpload size:(CGSize)imageSize;
- (void)processData; - (void)processData;
- (CGSize)outputImageSize;


@end @end

0 comments on commit 615dc5d

Please sign in to comment.