This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "AppDelegate.h" | |
#include <stdio.h> | |
@interface AppDelegate () | |
@end | |
@implementation AppDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// [self namolData]; | |
// [self test]; | |
// [self test2]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.m | |
// compare | |
// | |
// Created by Allan on 27/7/2019. | |
// Copyright © 2019 Allan. All rights reserved. | |
// | |
#import "ViewController.h" | |
#include <arm_neon.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <time.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <sys/stat.h> | |
typedef unsigned char uint8_t; | |
/** | |
* @param src input nv12 raw data array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**************************************************************************** | |
Copyright (c) 2010-2012 cocos2d-x.org | |
Copyright (c) 2013-2017 Chukong Technologies Inc. | |
http://www.cocos2d-x.org | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (void)writeDataToFile:(NSString *)fileName wirteData:(NSData*)data{ | |
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:fileName]; | |
BOOL fileExists = [self fileExists:fileName]; | |
if(fileExists){ | |
NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:filePath]; | |
[fileHandle seekToEndOfFile]; | |
[fileHandle writeData:data]; | |
[fileHandle closeFile]; | |
} | |
else{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(CVPixelBufferRef)imageToYUVPixelBuffer:(UIImage *)image{ | |
// convert to CGImage & dump to bitmapData | |
CGImageRef imageRef = [image CGImage]; | |
int width = (int)CGImageGetWidth(imageRef); | |
int height = (int)CGImageGetHeight(imageRef); | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
NSUInteger bytesPerPixel = 4; | |
NSUInteger bytesPerRow = ((bytesPerPixel*width+255)/256)*256; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface SREAGLContext : NSObject | |
+ (EAGLContext*)sharedContext; | |
+ (EAGLContext*)newContext: (EAGLRenderingAPI) api; | |
@end | |
@implementation SREAGLContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); | |
CVPixelBufferLockBaseAddress(imageBuffer,0); | |
size_t height = CVPixelBufferGetHeight(imageBuffer); | |
size_t width = CVPixelBufferGetWidth(imageBuffer); | |
size_t bytesPerRow = CVPixelBufferGetBytesPerRow(imageBuffer); | |
void *sourceData = CVPixelBufferGetBaseAddress(imageBuffer); | |
// Set a bunch of variables we need. The "radius" for the blur kernel needs to be positive and odd. The permute map maps the BGRA channels of the buffer to the ARGB that vImage needs. |
Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv
instead. If you are looking for the previous version of this document, see the revision history.
$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10
$ pyenv install 2.6.9