Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add gpu library
- Loading branch information
Showing
75 changed files
with
6,165 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> | ||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="src" path="gen"/> | ||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> | ||
<classpathentry kind="output" path="bin/classes"/> | ||
</classpath> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#Android generated | ||
bin | ||
gen | ||
obj | ||
|
||
#Eclipse | ||
#.project | ||
#.classpath | ||
.settings | ||
|
||
#IntelliJ IDEA | ||
.idea | ||
*.iml | ||
*.ipr | ||
*.iws | ||
out | ||
|
||
#Checkstyle | ||
.checkstyle | ||
|
||
#Maven | ||
target | ||
release.properties | ||
pom.xml.* | ||
|
||
#Ant | ||
build.xml | ||
local.properties | ||
proguard.cfg | ||
|
||
#OSX | ||
.DS_Store |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>gpuimage</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.android.ide.eclipse.adt.ApkBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="jp.co.cyberagent.android.gpuimage" | ||
android:versionCode="4" | ||
android:versionName="1.0.3" > | ||
|
||
<uses-sdk | ||
android:minSdkVersion="8" | ||
android:targetSdkVersion="19" /> | ||
|
||
<application /> | ||
|
||
</manifest> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (C) 2009 The Android Open Source Project | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
LOCAL_PATH := $(call my-dir) | ||
|
||
include $(CLEAR_VARS) | ||
|
||
LOCAL_MODULE := gpuimage-library | ||
LOCAL_SRC_FILES := yuv-decoder.c | ||
LOCAL_LDLIBS := -llog | ||
|
||
include $(BUILD_SHARED_LIBRARY) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Build both ARMv5TE and ARMv7-A machine code. | ||
APP_ABI := armeabi x86 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#include <jni.h> | ||
#include <android/log.h> | ||
|
||
|
||
JNIEXPORT void JNICALL Java_jp_co_cyberagent_android_gpuimage_GPUImageNativeLibrary_YUVtoRBGA(JNIEnv * env, jobject obj, jbyteArray yuv420sp, jint width, jint height, jintArray rgbOut) | ||
{ | ||
int sz; | ||
int i; | ||
int j; | ||
int Y; | ||
int Cr = 0; | ||
int Cb = 0; | ||
int pixPtr = 0; | ||
int jDiv2 = 0; | ||
int R = 0; | ||
int G = 0; | ||
int B = 0; | ||
int cOff; | ||
int w = width; | ||
int h = height; | ||
sz = w * h; | ||
|
||
jint *rgbData = (jint*) ((*env)->GetPrimitiveArrayCritical(env, rgbOut, 0)); | ||
jbyte* yuv = (jbyte*) (*env)->GetPrimitiveArrayCritical(env, yuv420sp, 0); | ||
|
||
for(j = 0; j < h; j++) { | ||
pixPtr = j * w; | ||
jDiv2 = j >> 1; | ||
for(i = 0; i < w; i++) { | ||
Y = yuv[pixPtr]; | ||
if(Y < 0) Y += 255; | ||
if((i & 0x1) != 1) { | ||
cOff = sz + jDiv2 * w + (i >> 1) * 2; | ||
Cb = yuv[cOff]; | ||
if(Cb < 0) Cb += 127; else Cb -= 128; | ||
Cr = yuv[cOff + 1]; | ||
if(Cr < 0) Cr += 127; else Cr -= 128; | ||
} | ||
R = Y + Cr + (Cr >> 2) + (Cr >> 3) + (Cr >> 5); | ||
if(R < 0) R = 0; else if(R > 255) R = 255; | ||
G = Y - (Cb >> 2) + (Cb >> 4) + (Cb >> 5) - (Cr >> 1) + (Cr >> 3) + (Cr >> 4) + (Cr >> 5); | ||
if(G < 0) G = 0; else if(G > 255) G = 255; | ||
B = Y + Cb + (Cb >> 1) + (Cb >> 2) + (Cb >> 6); | ||
if(B < 0) B = 0; else if(B > 255) B = 255; | ||
rgbData[pixPtr++] = 0xff000000 + (R << 16) + (G << 8) + B; | ||
} | ||
} | ||
|
||
(*env)->ReleasePrimitiveArrayCritical(env, rgbOut, rgbData, 0); | ||
(*env)->ReleasePrimitiveArrayCritical(env, yuv420sp, yuv, 0); | ||
} | ||
|
||
JNIEXPORT void JNICALL Java_jp_co_cyberagent_android_gpuimage_GPUImageNativeLibrary_YUVtoARBG(JNIEnv * env, jobject obj, jbyteArray yuv420sp, jint width, jint height, jintArray rgbOut) | ||
{ | ||
int sz; | ||
int i; | ||
int j; | ||
int Y; | ||
int Cr = 0; | ||
int Cb = 0; | ||
int pixPtr = 0; | ||
int jDiv2 = 0; | ||
int R = 0; | ||
int G = 0; | ||
int B = 0; | ||
int cOff; | ||
int w = width; | ||
int h = height; | ||
sz = w * h; | ||
|
||
jint *rgbData = (jint*) ((*env)->GetPrimitiveArrayCritical(env, rgbOut, 0)); | ||
jbyte* yuv = (jbyte*) (*env)->GetPrimitiveArrayCritical(env, yuv420sp, 0); | ||
|
||
for(j = 0; j < h; j++) { | ||
pixPtr = j * w; | ||
jDiv2 = j >> 1; | ||
for(i = 0; i < w; i++) { | ||
Y = yuv[pixPtr]; | ||
if(Y < 0) Y += 255; | ||
if((i & 0x1) != 1) { | ||
cOff = sz + jDiv2 * w + (i >> 1) * 2; | ||
Cb = yuv[cOff]; | ||
if(Cb < 0) Cb += 127; else Cb -= 128; | ||
Cr = yuv[cOff + 1]; | ||
if(Cr < 0) Cr += 127; else Cr -= 128; | ||
} | ||
R = Y + Cr + (Cr >> 2) + (Cr >> 3) + (Cr >> 5); | ||
if(R < 0) R = 0; else if(R > 255) R = 255; | ||
G = Y - (Cb >> 2) + (Cb >> 4) + (Cb >> 5) - (Cr >> 1) + (Cr >> 3) + (Cr >> 4) + (Cr >> 5); | ||
if(G < 0) G = 0; else if(G > 255) G = 255; | ||
B = Y + Cb + (Cb >> 1) + (Cb >> 2) + (Cb >> 6); | ||
if(B < 0) B = 0; else if(B > 255) B = 255; | ||
rgbData[pixPtr++] = 0xff000000 + (B << 16) + (G << 8) + R; | ||
} | ||
} | ||
|
||
(*env)->ReleasePrimitiveArrayCritical(env, rgbOut, rgbData, 0); | ||
(*env)->ReleasePrimitiveArrayCritical(env, yuv420sp, yuv, 0); | ||
} |
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>jp.co.cyberagent.android.gpuimage</groupId> | ||
<artifactId>gpuimage-library</artifactId> | ||
<name>GPUImage for Android Library</name> | ||
<packaging>apklib</packaging> | ||
|
||
<parent> | ||
<groupId>jp.co.cyberagent.android.gpuimage</groupId> | ||
<artifactId>gpuimage-parent</artifactId> | ||
<version>1.1.1</version> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.android</groupId> | ||
<artifactId>android</artifactId> | ||
<version>${android.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.jayway.maven.plugins.android.generation2</groupId> | ||
<artifactId>android-maven-plugin</artifactId> | ||
<executions> | ||
<!-- | ||
Add the execution of the ndk-build goal - this will compile the native code in addition | ||
to building the Java & APK | ||
--> | ||
<execution> | ||
<goals> | ||
<goal>ndk-build</goal> | ||
</goals> | ||
<configuration> | ||
<clearNativeArtifacts>false</clearNativeArtifacts> | ||
<attachNativeArtifacts>true</attachNativeArtifacts> | ||
<target>all</target> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<extensions>true</extensions> | ||
|
||
</plugin> | ||
<plugin> | ||
<groupId>com.jayway.maven.plugins.android.generation2</groupId> | ||
<artifactId>android-maven-plugin</artifactId> | ||
<extensions>true</extensions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# To enable ProGuard in your project, edit project.properties | ||
# to define the proguard.config property as described in that file. | ||
# | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in ${sdk.dir}/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the ProGuard | ||
# include property in project.properties. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This file is automatically generated by Android Tools. | ||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
# | ||
# This file must be checked in Version Control Systems. | ||
# | ||
# To customize properties used by the Ant build system edit | ||
# "ant.properties", and override values to adapt the script to your | ||
# project structure. | ||
# | ||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): | ||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt | ||
|
||
# Project target. | ||
target=android-19 | ||
android.library=true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
</resources> |
Oops, something went wrong.