Skip to content

Instantly share code, notes, and snippets.

View AllanChen's full-sized avatar

AllanChan AllanChen

View GitHub Profile
@AllanChen
AllanChen / WMFVideoReadWrite.cpp
Created February 19, 2022 07:48 — forked from m1keall1son/WMFVideoReadWrite.cpp
C++ Program to read a video file and re-encode it to H.264 / AAC using Windows Media Foundation
//USAGE $ program.exe path\\to\\video-in.mp4 path\\to\\video-out.mp4
#include <iostream>
#include <string>
#include <mfidl.h> // Media Foundation interfaces
#include <mfapi.h> // Media Foundation platform APIs
#include <mferror.h> // Media Foundation error codes
#include <mfreadwrite.h>
#include <wmcontainer.h> // ASF-specific components
@AllanChen
AllanChen / Upscale_yuv.c
Created July 12, 2018 06:42 — forked from abhishekmurthy/Upscale_yuv.c
Upscaling a YUV image using Bilinear or Nearest scale algorithms
#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
@AllanChen
AllanChen / OpenGLToCVPixelBuffer.m
Created June 1, 2018 07:12 — forked from caojianhua/OpenGLToCVPixelBuffer.m
Create CVPixelBufferRef from OpenGL
@interface SREAGLContext : NSObject
+ (EAGLContext*)sharedContext;
+ (EAGLContext*)newContext: (EAGLRenderingAPI) api;
@end
@implementation SREAGLContext
@AllanChen
AllanChen / CMSampleBufferRef_to_vImage.m
Created May 30, 2018 11:57 — forked from podkovyrin/CMSampleBufferRef_to_vImage.m
CMSampleBufferRef to vImage and resize
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.
@AllanChen
AllanChen / gist:236879333be296ac75aa3dea3c07cba8
Created June 8, 2016 02:02 — forked from Bouke/gist:11261620
Multiple Python installations on OS X

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

@AllanChen
AllanChen / GPUImageFourInputFilter.h
Created December 28, 2015 10:08 — forked from johnpaulmanoza/GPUImageFourInputFilter.h
GPUImage Add Four Input Filter
#import <GPUImageThreeInputFilter.h>
extern NSString *const kGPUImageFourInputTextureVertexShaderString;
@interface GPUImageFourInputFilter : GPUImageThreeInputFilter
{
GPUImageFramebuffer *fourthInputFramebuffer;
GLint filterFourthTextureCoordinateAttribute;
GLint filterInputTextureUniform4;
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@AllanChen
AllanChen / .gitignore
Last active August 29, 2015 14:21 — forked from adamgit/.gitignore
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.3
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#