Feature: remove useless code

pull/221/head
xufuji456 2 years ago
parent f3dd152a72
commit e108a15a8c
  1. 18
      Live/src/main/AndroidManifest.xml
  2. 19
      Live/src/main/java/com/frank/live/LiveApplication.java
  3. 308
      Live/src/main/java/com/frank/live/PushActivity.java
  4. 372
      Live/src/main/java/com/frank/live/view/SmartCameraView.java
  5. 66
      Live/src/main/java/com/seu/magicfilter/advanced/MagicAmaroFilter.java
  6. 87
      Live/src/main/java/com/seu/magicfilter/advanced/MagicAntiqueFilter.java
  7. 29
      Live/src/main/java/com/seu/magicfilter/advanced/MagicBeautyFilter.java
  8. 89
      Live/src/main/java/com/seu/magicfilter/advanced/MagicBlackCatFilter.java
  9. 68
      Live/src/main/java/com/seu/magicfilter/advanced/MagicBrannanFilter.java
  10. 67
      Live/src/main/java/com/seu/magicfilter/advanced/MagicBrooklynFilter.java
  11. 125
      Live/src/main/java/com/seu/magicfilter/advanced/MagicCalmFilter.java
  12. 87
      Live/src/main/java/com/seu/magicfilter/advanced/MagicCoolFilter.java
  13. 42
      Live/src/main/java/com/seu/magicfilter/advanced/MagicCrayonFilter.java
  14. 69
      Live/src/main/java/com/seu/magicfilter/advanced/MagicEarlyBirdFilter.java
  15. 88
      Live/src/main/java/com/seu/magicfilter/advanced/MagicEmeraldFilter.java
  16. 80
      Live/src/main/java/com/seu/magicfilter/advanced/MagicEvergreenFilter.java
  17. 75
      Live/src/main/java/com/seu/magicfilter/advanced/MagicFreudFilter.java
  18. 109
      Live/src/main/java/com/seu/magicfilter/advanced/MagicHealthyFilter.java
  19. 68
      Live/src/main/java/com/seu/magicfilter/advanced/MagicHefeFilter.java
  20. 68
      Live/src/main/java/com/seu/magicfilter/advanced/MagicHudsonFilter.java
  21. 55
      Live/src/main/java/com/seu/magicfilter/advanced/MagicImageAdjustFilter.java
  22. 66
      Live/src/main/java/com/seu/magicfilter/advanced/MagicInkwellFilter.java
  23. 65
      Live/src/main/java/com/seu/magicfilter/advanced/MagicKevinFilter.java
  24. 88
      Live/src/main/java/com/seu/magicfilter/advanced/MagicLatteFilter.java
  25. 67
      Live/src/main/java/com/seu/magicfilter/advanced/MagicLomoFilter.java
  26. 59
      Live/src/main/java/com/seu/magicfilter/advanced/MagicN1977Filter.java
  27. 65
      Live/src/main/java/com/seu/magicfilter/advanced/MagicNashvilleFilter.java
  28. 140
      Live/src/main/java/com/seu/magicfilter/advanced/MagicNostalgiaFilter.java
  29. 65
      Live/src/main/java/com/seu/magicfilter/advanced/MagicPixelFilter.java
  30. 66
      Live/src/main/java/com/seu/magicfilter/advanced/MagicRiseFilter.java
  31. 81
      Live/src/main/java/com/seu/magicfilter/advanced/MagicRomanceFilter.java
  32. 89
      Live/src/main/java/com/seu/magicfilter/advanced/MagicSakuraFilter.java
  33. 67
      Live/src/main/java/com/seu/magicfilter/advanced/MagicSierraFilter.java
  34. 42
      Live/src/main/java/com/seu/magicfilter/advanced/MagicSketchFilter.java
  35. 93
      Live/src/main/java/com/seu/magicfilter/advanced/MagicSkinWhitenFilter.java
  36. 139
      Live/src/main/java/com/seu/magicfilter/advanced/MagicSunriseFilter.java
  37. 120
      Live/src/main/java/com/seu/magicfilter/advanced/MagicSunsetFilter.java
  38. 68
      Live/src/main/java/com/seu/magicfilter/advanced/MagicSutroFilter.java
  39. 96
      Live/src/main/java/com/seu/magicfilter/advanced/MagicSweetsFilter.java
  40. 96
      Live/src/main/java/com/seu/magicfilter/advanced/MagicTenderFilter.java
  41. 70
      Live/src/main/java/com/seu/magicfilter/advanced/MagicToasterFilter.java
  42. 68
      Live/src/main/java/com/seu/magicfilter/advanced/MagicValenciaFilter.java
  43. 66
      Live/src/main/java/com/seu/magicfilter/advanced/MagicWaldenFilter.java
  44. 118
      Live/src/main/java/com/seu/magicfilter/advanced/MagicWarmFilter.java
  45. 88
      Live/src/main/java/com/seu/magicfilter/advanced/MagicWhiteCatFilter.java
  46. 66
      Live/src/main/java/com/seu/magicfilter/advanced/MagicXproIIFilter.java
  47. 144
      Live/src/main/java/com/seu/magicfilter/base/MagicBaseGroupFilter.java
  48. 58
      Live/src/main/java/com/seu/magicfilter/base/MagicLookupFilter.java
  49. 57
      Live/src/main/java/com/seu/magicfilter/base/gpuimage/GPUImageBrightnessFilter.java
  50. 60
      Live/src/main/java/com/seu/magicfilter/base/gpuimage/GPUImageContrastFilter.java
  51. 69
      Live/src/main/java/com/seu/magicfilter/base/gpuimage/GPUImageExposureFilter.java
  52. 404
      Live/src/main/java/com/seu/magicfilter/base/gpuimage/GPUImageFilter.java
  53. 55
      Live/src/main/java/com/seu/magicfilter/base/gpuimage/GPUImageHueFilter.java
  54. 57
      Live/src/main/java/com/seu/magicfilter/base/gpuimage/GPUImageSaturationFilter.java
  55. 65
      Live/src/main/java/com/seu/magicfilter/base/gpuimage/GPUImageSharpenFilter.java
  56. 163
      Live/src/main/java/com/seu/magicfilter/utils/MagicFilterFactory.java
  57. 59
      Live/src/main/java/com/seu/magicfilter/utils/MagicFilterType.java
  58. 230
      Live/src/main/java/com/seu/magicfilter/utils/OpenGLUtils.java
  59. 54
      Live/src/main/java/com/seu/magicfilter/utils/Rotation.java
  60. 96
      Live/src/main/java/com/seu/magicfilter/utils/TextureRotationUtil.java
  61. 41
      Live/src/main/res/layout/activity_push.xml
  62. 28
      Live/src/main/res/layout/activity_rtmp_live.xml
  63. 32
      Live/src/main/res/raw/amaro.glsl
  64. 53
      Live/src/main/res/raw/antique.glsl
  65. 111
      Live/src/main/res/raw/beauty.glsl
  66. 92
      Live/src/main/res/raw/blackcat.glsl
  67. 73
      Live/src/main/res/raw/brannan.glsl
  68. 9
      Live/src/main/res/raw/brightness.glsl
  69. 148
      Live/src/main/res/raw/brooklyn.glsl
  70. 72
      Live/src/main/res/raw/calm.glsl
  71. 9
      Live/src/main/res/raw/constrast.glsl
  72. 44
      Live/src/main/res/raw/cool.glsl
  73. 56
      Live/src/main/res/raw/crayon.glsl
  74. 102
      Live/src/main/res/raw/earlybird.glsl
  75. 89
      Live/src/main/res/raw/emerald.glsl
  76. 84
      Live/src/main/res/raw/evergreen.glsl
  77. 9
      Live/src/main/res/raw/exposure.glsl
  78. 11
      Live/src/main/res/raw/fragment.glsl
  79. 172
      Live/src/main/res/raw/freud.glsl
  80. 141
      Live/src/main/res/raw/healthy.glsl
  81. 46
      Live/src/main/res/raw/hefe.glsl
  82. 35
      Live/src/main/res/raw/hudson.glsl
  83. 43
      Live/src/main/res/raw/hue.glsl
  84. 16
      Live/src/main/res/raw/inkwell.glsl
  85. 26
      Live/src/main/res/raw/kevin_new.glsl
  86. 163
      Live/src/main/res/raw/latte.glsl
  87. 29
      Live/src/main/res/raw/lomo.glsl
  88. 33
      Live/src/main/res/raw/lookup.glsl
  89. 19
      Live/src/main/res/raw/n1977.glsl
  90. 18
      Live/src/main/res/raw/nashville.glsl
  91. 108
      Live/src/main/res/raw/nostalgia.glsl
  92. 137
      Live/src/main/res/raw/pixar.glsl
  93. 33
      Live/src/main/res/raw/rise.glsl
  94. 50
      Live/src/main/res/raw/romance.glsl
  95. 71
      Live/src/main/res/raw/sakura.glsl
  96. 15
      Live/src/main/res/raw/saturation.glsl
  97. 22
      Live/src/main/res/raw/sharpen.glsl
  98. 32
      Live/src/main/res/raw/sierra.glsl
  99. 49
      Live/src/main/res/raw/sketch.glsl
  100. 98
      Live/src/main/res/raw/skinwhiten.glsl
  101. Some files were not shown because too many files have changed in this diff Show More

@ -7,22 +7,4 @@
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<application
android:name=".LiveApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<!--<activity android:name="com.frank.live.PushActivity"-->
<!--android:screenOrientation="landscape">-->
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN" />-->
<!--<category android:name="android.intent.category.LAUNCHER" />-->
<!--</intent-filter>-->
<!--</activity>-->
</application>
</manifest>

@ -1,19 +0,0 @@
package com.frank.live;
import android.app.Application;
public class LiveApplication extends Application {
private static LiveApplication context;
@Override
public void onCreate() {
super.onCreate();
context = this;
}
public static LiveApplication getInstance() {
return context;
}
}

@ -1,308 +0,0 @@
package com.frank.live;
import android.Manifest;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.hardware.Camera;
import android.os.Bundle;
import android.os.Environment;
import androidx.annotation.NonNull;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceHolder.Callback;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Spinner;
import com.frank.live.view.SmartCameraView;
import com.seu.magicfilter.utils.MagicFilterType;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
public class PushActivity extends Activity implements Callback {
private static String TAG = PushActivity.class.getSimpleName();
private SmartCameraView mSmartCameraView;
// MagicFilterType magicType = MagicFilterType.SUNRISE;
private Button btnMute;
private boolean isStart = false;
private boolean is_mute = false;
private int mDegree;
private Spinner beautyTypeSelector;
private ImageView img_photo;
private boolean takePhoto;
private final static int videoWidth = 640;
private final static int videoHeight = 360;
private final static String[] permissions = new String[]{Manifest.permission.CAMERA};
private final static int CODE_CAMERA = 1001;
private final static String[] beautySelector = new String[]{
LiveApplication.getInstance().getString(R.string.effect_beauty),
LiveApplication.getInstance().getString(R.string.effect_cool),
LiveApplication.getInstance().getString(R.string.effect_sunrise),
LiveApplication.getInstance().getString(R.string.effect_sketch),
LiveApplication.getInstance().getString(R.string.effect_white),
LiveApplication.getInstance().getString(R.string.effect_romantic),
LiveApplication.getInstance().getString(R.string.effect_raw)
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestPermissions();
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_push);
initView();
initListener();
}
@TargetApi(23)
private void requestPermissions() {
requestPermissions(permissions, CODE_CAMERA);
}
private void initView() {
//SurfaceView
mSmartCameraView = findViewById(R.id.gl_surfaceview);
//beauty type
beautyTypeSelector = findViewById(R.id.beauty_type_selector);
//mute
btnMute = findViewById(R.id.button_mute);
//take photo
img_photo = findViewById(R.id.img_photo);
}
private void initListener() {
ArrayAdapter<String> adapterBeautyType = new ArrayAdapter<>(this,
android.R.layout.simple_spinner_item, beautySelector);
adapterBeautyType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
beautyTypeSelector.setAdapter(adapterBeautyType);
beautyTypeSelector.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
switchCameraFilter(MagicFilterType.BEAUTY);
break;
case 1:
switchCameraFilter(MagicFilterType.COOL);
break;
case 2:
switchCameraFilter(MagicFilterType.SUNRISE);
break;
case 3:
switchCameraFilter(MagicFilterType.SKETCH);
break;
case 4:
switchCameraFilter(MagicFilterType.WHITECAT);
break;
case 5:
switchCameraFilter(MagicFilterType.ROMANCE);
break;
default:
switchCameraFilter(MagicFilterType.NONE);
break;
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
btnMute.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
is_mute = !is_mute;
if (is_mute) {
btnMute.setText(getString(R.string.voice));
} else {
btnMute.setText(getString(R.string.mute));
}
}
});
//preview data callback(RGBA)
mSmartCameraView.setPreviewCallback(new SmartCameraView.PreviewCallback() {
@Override
public void onGetRgbaFrame(byte[] data, int width, int height) {
if (takePhoto) {
takePhoto = false;
Log.i(TAG, "takePhoto...");
doTakePhoto(data, width, height);
}
}
});
img_photo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
takePhoto = true;
}
});
}
private void switchCameraFilter(MagicFilterType type) {
mSmartCameraView.setFilter(type);
}
/**
* take photo
*
* @param data preview data
* @param width the width of photo
* @param height the height of photo
*/
private void doTakePhoto(byte[] data, int width, int height) {
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
ByteBuffer buffer = ByteBuffer.wrap(data);
bitmap.copyPixelsFromBuffer(buffer);
Log.i(TAG, "doTakePhoto...");
FileOutputStream fileOutputStream = null;
String PATH = Environment.getExternalStorageDirectory().getPath();
String filePath = PATH + File.separator + "hello" + ".jpg";
try {
fileOutputStream = new FileOutputStream(filePath);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
fileOutputStream.flush();
} catch (IOException e) {
e.printStackTrace();
Log.e(TAG, "doTakePhoto error=" + e.toString());
} finally {
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
Log.i(TAG, "surfaceCreated..");
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Log.i(TAG, "surfaceChanged..");
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.i(TAG, "Surface Destroyed");
}
public void onConfigurationChanged(Configuration newConfig) {
try {
super.onConfigurationChanged(newConfig);
Log.i(TAG, "onConfigurationChanged, start:" + isStart);
setCameraDisplayOrientation(this, getCameraId());
mSmartCameraView.setPreviewOrientation(newConfig.orientation, mDegree);
} catch (Exception ex) {
Log.e(TAG, "error=" + ex.toString());
}
}
private int getCameraId() {
return mSmartCameraView.getCameraId();
}
public void setPreviewResolution(int width, int height) {
mSmartCameraView.setPreviewResolution(width, height);
}
private void setCameraDisplayOrientation(Activity activity, int cameraId) {
Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(cameraId, info);
int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
int degrees = 0;
switch (rotation) {
case Surface.ROTATION_0:
degrees = 0;
break;
case Surface.ROTATION_90:
degrees = 90;
break;
case Surface.ROTATION_180:
degrees = 180;
break;
case Surface.ROTATION_270:
degrees = 270;
break;
}
int result;
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
result = (info.orientation + degrees) % 360;
result = (360 - result) % 360;
} else {
// back-facing
result = (info.orientation - degrees + 360) % 360;
}
Log.i(TAG, "curDegree: " + result);
mDegree = result;
}
@Override
protected void onDestroy() {
if (isStart) {
isStart = false;
if (mSmartCameraView != null) {
mSmartCameraView.stopCamera();
}
Log.i(TAG, "onDestroy StopPublish");
}
super.onDestroy();
finish();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (permissions.length > 0 && grantResults.length > 0) {
setPreviewResolution(videoWidth, videoHeight);
if (!mSmartCameraView.startCamera()) {
Log.e(TAG, "startCamera error...");
}
}
}
}

@ -1,372 +0,0 @@
package com.frank.live.view;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.ImageFormat;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.opengl.Matrix;
import android.util.AttributeSet;
import android.util.Log;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterFactory;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
public class SmartCameraView extends GLSurfaceView implements GLSurfaceView.Renderer {
private GPUImageFilter magicFilter;
private SurfaceTexture surfaceTexture;
private int mOESTextureId = OpenGLUtils.NO_TEXTURE;
private int mSurfaceWidth;
private int mSurfaceHeight;
private int mPreviewWidth;
private int mPreviewHeight;
private float mInputAspectRatio;
private float mOutputAspectRatio;
private float[] mProjectionMatrix = new float[16];
private float[] mSurfaceMatrix = new float[16];
private float[] mTransformMatrix = new float[16];
private Camera mCamera;
private ByteBuffer mGLPreviewBuffer;
private int mCamId = -1;
private int mPreviewRotation = 0;
private int mPreviewOrientation = Configuration.ORIENTATION_PORTRAIT;
private Thread worker;
private final Object writeLock = new Object();
private ConcurrentLinkedQueue<IntBuffer> mGLIntBufferCache = new ConcurrentLinkedQueue<>();
private PreviewCallback mPrevCb;
private final String TAG = "SmartCameraView";
public SmartCameraView(Context context) {
this(context, null);
}
public SmartCameraView(Context context, AttributeSet attrs) {
super(context, attrs);
setEGLContextClientVersion(2);
setRenderer(this);
setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
}
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
Log.e(TAG, "Run into onSurfaceCreated...");
GLES20.glDisable(GL10.GL_DITHER);
GLES20.glClearColor(0, 0, 0, 0);
magicFilter = new GPUImageFilter(MagicFilterType.NONE);
magicFilter.init(getContext().getApplicationContext());
magicFilter.onInputSizeChanged(mPreviewWidth, mPreviewHeight);
mOESTextureId = OpenGLUtils.getExternalOESTextureID();
surfaceTexture = new SurfaceTexture(mOESTextureId);
surfaceTexture.setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() {
@Override
public void onFrameAvailable(SurfaceTexture surfaceTexture) {
requestRender();
}
});
// For camera preview on activity creation
if (mCamera != null) {
try {
mCamera.setPreviewTexture(surfaceTexture);
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
Log.i(TAG, "Run out of onSurfaceCreated...");
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
Log.i(TAG, "Run into onSurfaceChanged...width: " + width + ", height: " + height);
GLES20.glViewport(0, 0, width, height);
mSurfaceWidth = width;
mSurfaceHeight = height;
magicFilter.onDisplaySizeChanged(width, height);
mOutputAspectRatio = width > height ? (float) width / height : (float) height / width;
float aspectRatio = mOutputAspectRatio / mInputAspectRatio;
if (width > height) {
Matrix.orthoM(mProjectionMatrix, 0, -1.0f, 1.0f, -aspectRatio, aspectRatio, -1.0f, 1.0f);
} else {
Matrix.orthoM(mProjectionMatrix, 0, -aspectRatio, aspectRatio, -1.0f, 1.0f, -1.0f, 1.0f);
}
Log.i(TAG, "Run out onSurfaceChanged--");
}
@Override
public void onDrawFrame(GL10 gl) {
GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
surfaceTexture.updateTexImage();
surfaceTexture.getTransformMatrix(mSurfaceMatrix);
Matrix.multiplyMM(mTransformMatrix, 0, mSurfaceMatrix, 0, mProjectionMatrix, 0);
magicFilter.setTextureTransformMatrix(mTransformMatrix);
magicFilter.onDrawFrame(mOESTextureId);
mGLIntBufferCache.add(magicFilter.getGLFboBuffer());
synchronized (writeLock) {
writeLock.notifyAll();
}
}
public void setPreviewCallback(PreviewCallback cb) {
mPrevCb = cb;
}
public int[] setPreviewResolution(int width, int height) {
getHolder().setFixedSize(width, height);
mCamera = openCamera();
mPreviewWidth = width;
mPreviewHeight = height;
mCamera.getParameters().setPreviewSize(mPreviewWidth, mPreviewHeight);
mGLPreviewBuffer = ByteBuffer.allocate(mPreviewWidth * mPreviewHeight * 4);
mInputAspectRatio = mPreviewWidth > mPreviewHeight ?
(float) mPreviewWidth / mPreviewHeight : (float) mPreviewHeight / mPreviewWidth;
return new int[]{mPreviewWidth, mPreviewHeight};
}
public boolean setFilter(final MagicFilterType type) {
if (mCamera == null) {
return false;
}
queueEvent(new Runnable() {
@Override
public void run() {
if (magicFilter != null) {
magicFilter.destroy();
}
magicFilter = MagicFilterFactory.initFilters(type);
if (magicFilter != null) {
magicFilter.init(getContext().getApplicationContext());
magicFilter.onInputSizeChanged(mPreviewWidth, mPreviewHeight);
magicFilter.onDisplaySizeChanged(mSurfaceWidth, mSurfaceHeight);
}
}
});
requestRender();
return true;
}
private void deleteTextures() {
if (mOESTextureId != OpenGLUtils.NO_TEXTURE) {
queueEvent(new Runnable() {
@Override
public void run() {
GLES20.glDeleteTextures(1, new int[]{mOESTextureId}, 0);
mOESTextureId = OpenGLUtils.NO_TEXTURE;
}
});
}
}
public void setCameraId(int id) {
mCamId = id;
}
public void setPreviewOrientation(int orientation, int degree) {
mPreviewOrientation = orientation;
mPreviewRotation = degree;
mCamera.setDisplayOrientation(degree);
}
public int getCameraId() {
return mCamId;
}
public boolean startCamera() {
worker = new Thread(new Runnable() {
@Override
public void run() {
while (!Thread.interrupted()) {
while (!mGLIntBufferCache.isEmpty()) {
IntBuffer picture = mGLIntBufferCache.poll();
mGLPreviewBuffer.asIntBuffer().put(picture.array());
mPrevCb.onGetRgbaFrame(mGLPreviewBuffer.array(), mPreviewWidth, mPreviewHeight);
}
// Waiting for next frame
synchronized (writeLock) {
try {
// isEmpty() may take some time, so we set timeout to detect next frame
writeLock.wait(500);
} catch (InterruptedException ie) {
worker.interrupt();
}
}
}
}
});
worker.start();
if (mCamera == null) {
mCamera = openCamera();
if (mCamera == null) {
return false;
}
}
Camera.Parameters params = mCamera.getParameters();
List<String> supportedFocusModes = params.getSupportedFocusModes();
if (!supportedFocusModes.isEmpty()) {
if (supportedFocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) {
params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
} else {
params.setFocusMode(supportedFocusModes.get(0));
}
}
params.setPictureSize(mPreviewWidth, mPreviewHeight);
params.setPreviewSize(mPreviewWidth, mPreviewHeight);
int VFPS = 15;
int[] range = adaptFpsRange(VFPS, params.getSupportedPreviewFpsRange());
params.setPreviewFpsRange(range[0], range[1]);
params.setPreviewFormat(ImageFormat.NV21);
params.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
params.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_AUTO);
params.setSceneMode(Camera.Parameters.SCENE_MODE_AUTO);
if (!params.getSupportedFocusModes().isEmpty()) {
params.setFocusMode(params.getSupportedFocusModes().get(0));
}
mCamera.setParameters(params);
mCamera.setDisplayOrientation(mPreviewRotation);
try {
mCamera.setPreviewTexture(surfaceTexture);
} catch (IOException e) {
e.printStackTrace();
}
GetParameters(mCamera);
mCamera.startPreview();
return true;
}
public void stopCamera() {
if (worker != null) {
worker.interrupt();
try {
worker.join();
} catch (InterruptedException e) {
e.printStackTrace();
worker.interrupt();
}
mGLIntBufferCache.clear();
worker = null;
}
if (mCamera != null) {
mCamera.stopPreview();
mCamera.release();
mCamera = null;
}
}
public void GetParameters(Camera camera) {
List<Camera.Size> pictureSizes = camera.getParameters().getSupportedPictureSizes();
List<Camera.Size> previewSizes = camera.getParameters().getSupportedPreviewSizes();
Camera.Size psize;
for (int i = 0; i < pictureSizes.size(); i++) {
psize = pictureSizes.get(i);
Log.i(TAG, psize.width + " x " + psize.height);
}
for (int i = 0; i < previewSizes.size(); i++) {
psize = previewSizes.get(i);
Log.i(TAG, psize.width + " x " + psize.height);
}
}
private Camera openCamera() {
Camera camera;
if (mCamId < 0) {
Camera.CameraInfo info = new Camera.CameraInfo();
int numCameras = Camera.getNumberOfCameras();
int frontCamId = -1;
int backCamId = -1;
for (int i = 0; i < numCameras; i++) {
Camera.getCameraInfo(i, info);
if (info.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
backCamId = i;
} else if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
frontCamId = i;
break;
}
}
if (frontCamId != -1) {
mCamId = frontCamId;
} else if (backCamId != -1) {
mCamId = backCamId;
} else {
mCamId = 0;
}
}
camera = Camera.open(mCamId);
return camera;
}
private int[] adaptFpsRange(int expectedFps, List<int[]> fpsRanges) {
expectedFps *= 1000;
int[] closestRange = fpsRanges.get(0);
int measure = Math.abs(closestRange[0] - expectedFps) + Math.abs(closestRange[1] - expectedFps);
for (int[] range : fpsRanges) {
if (range[0] <= expectedFps && range[1] >= expectedFps) {
int curMeasure = Math.abs(range[0] - expectedFps) + Math.abs(range[1] - expectedFps);
if (curMeasure < measure) {
closestRange = range;
measure = curMeasure;
}
}
}
return closestRange;
}
public interface PreviewCallback {
void onGetRgbaFrame(byte[] data, int width, int height);
}
}

@ -1,66 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicAmaroFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1,-1,-1};
private int[] inputTextureUniformLocations = {-1,-1,-1};
private int mGLStrengthLocation;
public MagicAmaroFilter(){
super(MagicFilterType.AMARO, R.raw.amaro);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++)
inputTextureHandles[i] = -1;
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for (int i = 0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/brannan_blowout.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/overlaymap.png");
inputTextureHandles[2] = OpenGLUtils.loadTexture(getContext(), "filter/amaromap.png");
}
});
}
}

@ -1,87 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicAntiqueFilter extends GPUImageFilter{
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
public MagicAntiqueFilter(){
super(MagicFilterType.ANTIQUE, R.raw.antique);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
this.mToneCurveTexture[0] = -1;
}
@Override
protected void onDrawArraysAfter(){
if (this.mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
if (this.mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(this.mToneCurveTextureUniformLocation, 3);
}
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[2048];
int[] arrayOfInt1 = { 0, 1, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 61, 62, 63, 64, 66, 67, 68, 69, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89, 90, 91, 93, 94, 95, 96, 98, 99, 100, 102, 103, 104, 106, 107, 108, 110, 111, 112, 114, 115, 116, 118, 119, 120, 122, 123, 124, 126, 127, 128, 130, 131, 132, 134, 135, 136, 137, 139, 140, 141, 143, 144, 145, 146, 148, 149, 150, 152, 153, 154, 155, 157, 158, 159, 160, 161, 163, 164, 165, 166, 168, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 226, 226, 227, 228, 228, 229, 230, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 239, 240, 241, 241, 242, 242, 243, 244, 244, 245, 245, 246, 247, 247, 248, 248, 249, 249, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 };
int[] arrayOfInt2 = { 15, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 55, 56, 57, 57, 58, 59, 61, 62, 63, 64, 66, 67, 68, 69, 71, 72, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83, 85, 86, 87, 87, 89, 90, 91, 93, 94, 95, 96, 98, 99, 100, 102, 102, 103, 104, 106, 107, 108, 110, 111, 112, 114, 115, 116, 118, 118, 119, 120, 122, 123, 124, 126, 127, 128, 130, 131, 132, 134, 134, 135, 136, 137, 139, 140, 141, 143, 144, 145, 146, 148, 149, 149, 150, 152, 153, 154, 155, 157, 158, 159, 160, 161, 163, 163, 164, 165, 166, 168, 169, 170, 171, 172, 173, 175, 176, 177, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 212, 213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 222, 223, 223, 224, 225, 226, 226, 227, 228, 228, 229, 230, 230, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 238, 239, 239, 240, 241, 241, 242, 242, 243, 244, 244, 245, 245, 245, 246, 247, 247, 248, 248, 249, 249, 250, 251, 251, 252, 252, 252, 253, 253, 254, 254, 255 };
int[] arrayOfInt3 = { 87, 89, 89, 90, 90, 91, 91, 93, 93, 94, 95, 95, 96, 96, 98, 98, 99, 100, 100, 102, 102, 103, 103, 104, 104, 106, 107, 107, 108, 108, 110, 110, 111, 112, 112, 114, 114, 115, 115, 116, 118, 118, 119, 119, 120, 120, 122, 123, 123, 124, 124, 126, 126, 127, 128, 128, 130, 130, 131, 131, 132, 134, 134, 135, 135, 136, 136, 137, 139, 139, 140, 140, 141, 143, 143, 144, 144, 145, 146, 146, 148, 148, 149, 150, 150, 152, 152, 153, 154, 154, 155, 155, 157, 158, 158, 159, 159, 160, 161, 161, 163, 163, 164, 165, 165, 166, 168, 168, 169, 169, 170, 171, 171, 172, 173, 173, 175, 175, 176, 177, 177, 178, 179, 179, 180, 181, 181, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 201, 202, 203, 204, 204, 205, 206, 206, 207, 208, 208, 209, 210, 211, 211, 211, 212, 212, 213, 214, 215, 215, 216, 216, 217, 217, 218, 219, 219, 220, 220, 221, 221, 222, 223, 223, 223, 224, 225, 226, 226, 226, 227, 228, 228, 228, 229, 230, 230, 230, 231, 232, 232, 232, 233, 234, 234, 235, 235, 236, 236, 237, 238, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242, 242, 243, 244, 244, 244, 245, 245, 246, 247, 247, 247, 248, 248, 249, 249, 249, 250, 251, 251, 252, 252, 252, 253, 253, 254, 254, 254, 255 };
int[] arrayOfInt4 = { 0, 1, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 13, 13, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 78, 79, 80, 81, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 97, 98, 99, 101, 102, 103, 105, 106, 107, 109, 110, 111, 113, 114, 115, 117, 118, 119, 121, 122, 123, 125, 126, 127, 129, 130, 131, 133, 134, 136, 137, 138, 140, 141, 142, 144, 145, 146, 148, 149, 150, 152, 153, 154, 156, 157, 158, 159, 161, 162, 163, 165, 166, 167, 168, 170, 171, 172, 173, 175, 176, 177, 178, 180, 181, 182, 183, 184, 186, 187, 188, 189, 190, 191, 192, 193, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 213, 214, 215, 216, 217, 218, 219, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 227, 228, 229, 230, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 240, 240, 241, 242, 242, 243, 244, 244, 245, 245, 246, 247, 247, 248, 248, 249, 250, 250, 251, 251, 252, 253, 253, 254, 254, 255 };
for (int i = 0; i < 256; i++){
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);
arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);
}
int[] arrayOfInt5 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int j = 0; j < 256; j++){
arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);
arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);
arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);
arrayOfByte[(3 + (1024 + j * 4))] = -1;
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
}
});
}
}

@ -1,29 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
/**
* Created by Administrator on 2016/5/22.
*/
public class MagicBeautyFilter extends GPUImageFilter {
private int mSingleStepOffsetLocation;
public MagicBeautyFilter(){
super(MagicFilterType.BEAUTY, R.raw.beauty);
}
protected void onInit() {
super.onInit();
mSingleStepOffsetLocation = GLES20.glGetUniformLocation(getProgram(), "singleStepOffset");
}
@Override
public void onInputSizeChanged(final int width, final int height) {
super.onInputSizeChanged(width, height);
setFloatVec2(mSingleStepOffsetLocation, new float[] {2.0f / width, 2.0f / height});
}
}

@ -1,89 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicBlackCatFilter extends GPUImageFilter {
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
public MagicBlackCatFilter(){
super(MagicFilterType.BLACKCAT, R.raw.blackcat);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
mToneCurveTexture[0] = -1;
}
@Override
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[2048];
int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 5, 7, 8, 10, 11, 13, 15, 16, 18, 20, 21, 23, 24, 26, 28, 29, 31, 33, 34, 36, 37, 39, 41, 42, 44, 45, 47, 49, 50, 52, 53, 55, 57, 58, 60, 61, 63, 65, 66, 68, 69, 71, 72, 74, 76, 77, 79, 80, 82, 83, 85, 86, 88, 90, 91, 93, 94, 96, 97, 99, 100, 102, 103, 105, 106, 108, 109, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, 125, 127, 128, 129, 131, 132, 134, 135, 136, 138, 139, 141, 142, 143, 145, 146, 147, 149, 150, 151, 153, 154, 155, 157, 158, 159, 160, 162, 163, 164, 165, 167, 168, 169, 170, 172, 173, 174, 175, 176, 178, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 224, 225, 226, 227, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 240, 240, 241, 242, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 248, 249, 250, 250, 251, 251, 252, 253, 253, 254, 254, 255 };
int[] arrayOfInt2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 5, 7, 8, 10, 11, 13, 15, 16, 16, 18, 20, 21, 23, 24, 26, 28, 29, 31, 33, 34, 36, 37, 39, 41, 41, 42, 44, 45, 47, 49, 50, 52, 53, 55, 57, 58, 60, 61, 63, 65, 66, 68, 69, 71, 72, 74, 76, 77, 79, 80, 82, 83, 85, 86, 86, 88, 90, 91, 93, 94, 96, 97, 99, 100, 102, 103, 105, 106, 108, 109, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, 125, 127, 128, 129, 131, 134, 135, 136, 138, 139, 141, 142, 143, 145, 146, 147, 149, 150, 151, 153, 154, 155, 157, 158, 159, 160, 162, 163, 164, 165, 167, 168, 169, 170, 172, 173, 174, 175, 176, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 199, 200, 201, 203, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 215, 216, 217, 219, 220, 220, 221, 222, 223, 224, 224, 225, 226, 227, 227, 228, 229, 229, 230, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 240, 240, 242, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 248, 249, 250, 251, 251, 252, 253, 253, 254, 254, 255 };
int[] arrayOfInt3 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 3, 5, 7, 8, 10, 10, 11, 13, 15, 16, 18, 20, 20, 21, 23, 24, 26, 28, 29, 29, 31, 33, 34, 36, 37, 39, 39, 41, 42, 44, 45, 47, 49, 50, 50, 52, 53, 55, 57, 58, 60, 61, 63, 63, 65, 66, 68, 69, 71, 72, 74, 76, 77, 79, 79, 80, 82, 83, 85, 86, 88, 90, 91, 93, 94, 96, 97, 99, 100, 100, 102, 103, 105, 106, 108, 109, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, 125, 127, 128, 129, 131, 132, 134, 135, 136, 138, 139, 141, 142, 143, 145, 146, 147, 149, 150, 151, 153, 154, 155, 157, 158, 159, 160, 162, 164, 165, 167, 168, 169, 170, 172, 173, 174, 175, 176, 178, 179, 180, 181, 182, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 215, 215, 216, 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, 227, 227, 228, 229, 229, 230, 232, 232, 233, 234, 234, 235, 236, 236, 238, 238, 239, 240, 240, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 250, 250, 251, 251, 252, 253, 254, 254, 255 };
for (int i = 0; i < 256; i++){
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);
arrayOfByte[(3 + i * 4)] = -1;
}
int[] arrayOfInt4 = { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 12, 13, 13, 14, 14, 15, 16, 17, 18, 18, 19, 19, 20, 21, 21, 23, 24, 25, 26, 26, 26, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 38, 38, 39, 40, 41, 43, 44, 45, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 70, 70, 71, 72, 74, 75, 76, 76, 77, 78, 79, 80, 81, 82, 82, 83, 85, 86, 87, 88, 89, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 101, 102, 103, 104, 105, 107, 107, 108, 109, 111, 112, 113, 114, 114, 115, 116, 117, 119, 120, 120, 121, 122, 123, 124, 125, 126, 126, 127, 128, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 139, 141, 142, 143, 144, 145, 145, 146, 147, 148, 149, 151, 151, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 165, 166, 167, 168, 169, 170, 170, 171, 172, 173, 174, 175, 177, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 189, 189, 190, 191, 192, 193, 194, 195, 195, 196, 198, 199, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 213, 214, 214, 215, 216, 218, 219, 220, 221, 221, 222, 223, 225, 227, 227, 228, 229, 230, 230, 230, 230, 230, 230, 230, 230, 230 };
int[] arrayOfInt5 = { 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83, 84, 86, 87, 88, 89, 91, 92, 93, 95, 96, 97, 99, 100, 101, 103, 104, 105, 107, 108, 109, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, 125, 126, 128, 129, 131, 132, 134, 135, 137, 138, 140, 141, 142, 144, 145, 147, 148, 149, 151, 152, 154, 155, 156, 158, 159, 160, 162, 163, 164, 166, 167, 168, 170, 171, 172, 173, 175, 176, 177, 178, 180, 181, 182, 183, 184, 186, 187, 188, 189, 190, 191, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 225, 225, 226, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 240, 240, 241, 241, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 252, 253, 253, 254, 254, 254, 255, 255 };
int[] arrayOfInt6 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int j = 0; j < 256; j++){
arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt4[j]);
arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);
arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt6[j]);
arrayOfByte[(3 + (1024 + j * 4))] = -1;
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
}
});
}
}

@ -1,68 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicBrannanFilter extends GPUImageFilter{
private int[] inputTextureHandles = {-1,-1,-1,-1,-1};
private int[] inputTextureUniformLocations = {-1,-1,-1,-1,-1};
private int mGLStrengthLocation;
public MagicBrannanFilter(){
super(MagicFilterType.BRANNAN, R.raw.brannan);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++)
inputTextureHandles[i] = -1;
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for (int i = 0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/brannan_process.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/brannan_blowout.png");
inputTextureHandles[2] = OpenGLUtils.loadTexture(getContext(), "filter/brannan_contrast.png");
inputTextureHandles[3] = OpenGLUtils.loadTexture(getContext(), "filter/brannan_luma.png");
inputTextureHandles[4] = OpenGLUtils.loadTexture(getContext(), "filter/brannan_screen.png");
}
});
}
}

@ -1,67 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicBrooklynFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1,-1,-1};
private int[] inputTextureUniformLocations = {-1,-1,-1};
private int mGLStrengthLocation;
public MagicBrooklynFilter(){
super(MagicFilterType.BROOKLYN, R.raw.brooklyn);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for (int i = 0; i < inputTextureHandles.length; i++) {
inputTextureHandles[i] = -1;
}
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for (int i = 0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/brooklynCurves1.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/filter_map_first.png");
inputTextureHandles[2] = OpenGLUtils.loadTexture(getContext(), "filter/brooklynCurves2.png");
}
});
}
}

@ -1,125 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
import java.nio.ByteBuffer;
public class MagicCalmFilter extends GPUImageFilter{
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
private int mMaskGrey1TextureId = -1;
private int mMaskGrey1UniformLocation;
private int mMaskGrey2TextureId = -1;
private int mMaskGrey2UniformLocation;
public MagicCalmFilter(){
super(MagicFilterType.CALM, R.raw.calm);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(3, new int[]{mToneCurveTexture[0], mMaskGrey1TextureId, mMaskGrey2TextureId}, 0);
mToneCurveTexture[0] = -1;
mMaskGrey1TextureId = -1;
mMaskGrey2TextureId = -1;
}
@Override
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey2TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE5);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);
GLES20.glUniform1i(mMaskGrey1UniformLocation, 4);
}
if (mMaskGrey2TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE5);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey2TextureId);
GLES20.glUniform1i(mMaskGrey2UniformLocation, 5);
}
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), "grey1Frame");
mMaskGrey2UniformLocation = GLES20.glGetUniformLocation(getProgram(), "grey2Frame");
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[3072];
int[] arrayOfInt1 = { 38, 39, 40, 41, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 52, 53, 54, 55, 56, 57, 58, 58, 59, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 81, 82, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91, 92, 92, 93, 94, 95, 96, 97, 98, 98, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 137, 138, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 149, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 160, 161, 161, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 195, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 223, 224, 224, 225, 226, 227, 228, 229, 229, 230, 231, 232, 233, 234, 235, 235, 236, 237, 238, 239, 240, 241, 241, 242, 243, 244, 245, 246, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255 };
for (int i = 0; i < 256; i++){
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(3 + i * 4)] = -1;
}
int[] arrayOfInt2 = { 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 93, 94, 95, 96, 97, 98, 99, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 145, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 156, 157, 157, 158, 159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 196, 197, 198, 199, 200, 201, 202, 203, 204, 206, 207, 208, 209, 210, 211, 213, 214, 215, 216, 217, 218, 220, 221, 222, 223, 224, 226, 227, 228, 229, 230, 232, 233, 234, 235, 237, 238, 239, 240, 241, 243, 244, 245, 246, 248, 249, 250, 251, 253, 254, 255 };
int[] arrayOfInt3 = { 0, 1, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 42, 43, 44, 46, 47, 48, 50, 51, 53, 54, 56, 57, 59, 60, 62, 64, 65, 67, 69, 70, 72, 74, 75, 77, 79, 80, 82, 84, 85, 87, 89, 91, 92, 94, 96, 97, 99, 101, 102, 104, 106, 107, 109, 111, 112, 114, 115, 117, 118, 120, 121, 123, 124, 126, 127, 129, 130, 132, 133, 134, 136, 137, 138, 140, 141, 142, 144, 145, 146, 147, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 196, 197, 198, 199, 200, 200, 201, 202, 203, 203, 204, 205, 206, 206, 207, 208, 209, 209, 210, 211, 211, 212, 213, 214, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 222, 222, 223, 224, 224, 225, 226, 226, 227, 227, 228, 229, 229, 230, 231, 231, 232, 233, 233, 234, 234, 235, 236, 236, 237, 237, 238, 239, 239, 240, 240, 241, 242, 242, 243, 243, 244, 245, 245, 246, 246, 247, 247, 248, 249, 249, 250, 250, 251, 252, 252, 253, 253, 254, 254, 255 };
for (int j = 0; j < 256; j++){
arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt3[j]);
arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt3[j]);
arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt2[j]);
arrayOfByte[(3 + (1024 + j * 4))] = -1;
}
int[] arrayOfInt4 = { 0, 1, 3, 4, 5, 7, 8, 10, 11, 12, 14, 15, 16, 18, 19, 20, 22, 23, 24, 26, 27, 28, 30, 31, 33, 34, 35, 37, 38, 39, 41, 42, 43, 45, 46, 47, 49, 50, 51, 53, 54, 55, 57, 58, 59, 61, 62, 63, 64, 66, 67, 68, 70, 71, 72, 74, 75, 76, 77, 79, 80, 81, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 98, 99, 100, 101, 103, 104, 105, 106, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 202, 203, 204, 205, 205, 206, 207, 208, 208, 209, 210, 211, 211, 212, 213, 214, 214, 215, 216, 216, 217, 218, 218, 219, 220, 221, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 231, 232, 233, 233, 234, 235, 235, 236, 237, 237, 238, 239, 239, 240, 240, 241, 242, 242, 243, 244, 244, 245, 246, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 252, 253, 254, 254, 255 };
int[] arrayOfInt5 = { 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 33, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, 47, 47, 48, 49, 49, 50, 51, 52, 53, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 96, 97, 98, 99, 101, 102, 103, 105, 106, 107, 109, 110, 111, 113, 114, 115, 117, 118, 120, 121, 123, 124, 126, 127, 129, 130, 132, 133, 135, 137, 138, 140, 142, 143, 145, 147, 148, 150, 152, 153, 155, 157, 159, 161, 162, 164, 166, 168, 170, 172, 174, 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 247, 249, 251, 253, 255 };
int[] arrayOfInt6 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int k = 0; k < 256; k++){
arrayOfByte[(2048 + k * 4)] = ((byte)arrayOfInt4[k]);
arrayOfByte[(1 + (2048 + k * 4))] = ((byte)arrayOfInt5[k]);
arrayOfByte[(2 + (2048 + k * 4))] = ((byte)arrayOfInt6[k]);
arrayOfByte[(3 + (2048 + k * 4))] = -1;
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 3, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
mMaskGrey1TextureId = OpenGLUtils.loadTexture(getContext(), "filter/calm_mask1.jpg");
mMaskGrey2TextureId = OpenGLUtils.loadTexture(getContext(), "filter/calm_mask2.jpg");
}
});
}
}

@ -1,87 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicCoolFilter extends GPUImageFilter {
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
public MagicCoolFilter(){
super(MagicFilterType.COOL, R.raw.cool);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
this.mToneCurveTexture[0] = -1;
}
@Override
protected void onDrawArraysAfter(){
if (this.mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre() {
if (this.mToneCurveTexture[0] != -1) {
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(this.mToneCurveTextureUniformLocation, 3);
}
}
@Override
protected void onInit() {
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
}
@Override
protected void onInitialized() {
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[2048];
int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 33, 34, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 97, 98, 99, 100, 102, 103, 104, 105, 107, 108, 109, 111, 112, 113, 115, 116, 117, 119, 120, 121, 123, 124, 126, 127, 128, 130, 131, 133, 134, 136, 137, 139, 140, 142, 143, 145, 146, 148, 149, 151, 152, 154, 155, 157, 158, 160, 161, 163, 165, 166, 168, 169, 171, 173, 174, 176, 177, 179, 181, 182, 184, 185, 187, 189, 190, 192, 194, 195, 197, 199, 200, 202, 204, 205, 207, 209, 210, 212, 214, 216, 217, 219, 221, 222, 224, 226, 228, 229, 231, 233, 234, 236, 238, 240, 241, 243, 245, 246, 248, 250, 252, 253, 255 };
int[] arrayOfInt2 = { 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 250, 251, 252, 253, 254, 255 };
int[] arrayOfInt3 = { 0, 3, 6, 9, 11, 14, 17, 20, 23, 26, 28, 31, 34, 37, 40, 43, 45, 48, 51, 54, 57, 59, 62, 65, 68, 70, 73, 76, 79, 81, 84, 87, 89, 92, 95, 97, 100, 102, 105, 108, 110, 113, 115, 118, 120, 123, 125, 128, 130, 133, 135, 137, 140, 142, 144, 147, 149, 151, 153, 156, 158, 160, 162, 164, 166, 168, 171, 173, 175, 177, 179, 180, 182, 184, 186, 188, 190, 191, 193, 195, 197, 198, 200, 201, 203, 205, 206, 207, 209, 210, 212, 213, 214, 216, 217, 218, 219, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 236, 237, 237, 238, 239, 240, 240, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 248, 249, 249, 249, 250, 250, 250, 251, 251, 251, 251, 252, 252, 252, 252, 252, 253, 253, 253, 253, 253, 253, 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt4 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 13, 17, 21, 24, 32, 36, 39, 46, 50, 53, 56, 62, 65, 68, 73, 75, 78, 80, 85, 87, 88, 92, 94, 95, 96, 99, 100, 102, 104, 106, 107, 109, 110, 112, 113, 115, 116, 117, 120, 121, 122, 123, 125, 126, 127, 129, 130, 131, 132, 134, 135, 136, 138, 139, 140, 141, 142, 143, 144, 146, 147, 148, 149, 150, 151, 152, 154, 154, 155, 156, 158, 159, 159, 161, 162, 163, 163, 165, 166, 166, 168, 169, 169, 170, 172, 172, 173, 175, 175, 176, 177, 178, 179, 180, 181, 182, 182, 184, 184, 185, 186, 187, 188, 188, 190, 190, 191, 192, 193, 194, 194, 196, 196, 197, 197, 199, 199, 200, 201, 202, 202, 203, 204, 205, 205, 207, 207, 208, 208, 210, 210, 211, 212, 213, 213, 214, 215, 215, 216, 217, 218, 218, 219, 220, 221, 221, 222, 223, 223, 224, 225, 226, 226, 227, 228, 228, 229, 230, 230, 231, 232, 232, 233, 234, 235, 235, 236, 237, 237, 238, 239, 239, 240, 240, 241, 242, 242, 243, 244, 244, 245, 246, 246, 247, 248, 248, 249, 249, 250, 251, 251, 252, 253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
for (int i = 0; i < 256; i++){
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);
arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);
}
int[] arrayOfInt5 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int j = 0; j < 256; j++){
arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);
arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);
arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);
arrayOfByte[(3 + (1024 + j * 4))] = -1;
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
}
});
}
}

@ -1,42 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
public class MagicCrayonFilter extends GPUImageFilter {
private int mSingleStepOffsetLocation;
//1.0 - 5.0
private int mStrengthLocation;
public MagicCrayonFilter(){
super(MagicFilterType.CRAYON, R.raw.crayon);
}
@Override
protected void onInit() {
super.onInit();
mSingleStepOffsetLocation = GLES20.glGetUniformLocation(getProgram(), "singleStepOffset");
mStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
setFloat(mStrengthLocation, 2.0f);
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mStrengthLocation, 0.5f);
}
@Override
public void onInputSizeChanged(final int width, final int height) {
setFloatVec2(mSingleStepOffsetLocation, new float[] {1.0f / width, 1.0f / height});
}
}

@ -1,69 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicEarlyBirdFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1,-1,-1,-1,-1};
private int[] inputTextureUniformLocations = {-1,-1,-1,-1,-1};
protected int mGLStrengthLocation;
public MagicEarlyBirdFilter(){
super(MagicFilterType.EARLYBIRD, R.raw.earlybird);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++)
inputTextureHandles[i] = -1;
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for(int i=0; i < inputTextureUniformLocations.length; i++)
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture"+(2+i));
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/earlybirdcurves.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/earlybirdoverlaymap_new.png");
inputTextureHandles[2] = OpenGLUtils.loadTexture(getContext(), "filter/vignettemap_new.png");
inputTextureHandles[3] = OpenGLUtils.loadTexture(getContext(), "filter/earlybirdblowout.png");
inputTextureHandles[4] = OpenGLUtils.loadTexture(getContext(), "filter/earlybirdmap.png");
}
});
}
}

@ -1,88 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicEmeraldFilter extends GPUImageFilter {
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
public MagicEmeraldFilter(){
super(MagicFilterType.EMERALD, R.raw.emerald);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
mToneCurveTexture[0] = -1;
}
@Override
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[2048];
int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 4, 7, 8, 9, 10, 12, 13, 14, 17, 18, 19, 21, 22, 23, 25, 26, 29, 30, 31, 32, 34, 35, 36, 39, 40, 41, 43, 44, 45, 46, 48, 50, 51, 53, 54, 55, 56, 58, 60, 61, 62, 64, 65, 66, 67, 69, 70, 72, 73, 75, 76, 77, 78, 79, 81, 82, 84, 85, 87, 88, 89, 90, 91, 92, 94, 96, 97, 98, 99, 101, 102, 103, 104, 105, 106, 107, 110, 111, 112, 113, 114, 115, 116, 117, 119, 120, 121, 122, 123, 125, 126, 127, 128, 129, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 173, 174, 175, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 210, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 226, 226, 227, 228, 228, 229, 230, 231, 231, 232, 233, 234, 234, 235, 236, 236, 237, 237, 238, 239, 239, 240, 241, 242, 242, 243, 244, 244, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 253, 254, 254, 255 };
int[] arrayOfInt2 = { 0, 0, 0, 0, 0, 0, 1, 3, 4, 5, 7, 8, 9, 10, 12, 13, 14, 16, 18, 19, 21, 22, 23, 25, 26, 27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 41, 43, 44, 45, 46, 48, 50, 51, 53, 54, 55, 56, 58, 59, 60, 61, 62, 64, 65, 66, 67, 69, 70, 71, 72, 73, 75, 76, 77, 78, 79, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 94, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 106, 107, 109, 111, 112, 113, 114, 115, 116, 117, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 131, 132, 133, 134, 135, 136, 137, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 206, 207, 209, 210, 210, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 226, 226, 227, 228, 229, 230, 231, 231, 232, 233, 234, 234, 235, 236, 237, 237, 238, 239, 239, 240, 241, 242, 242, 243, 244, 244, 245, 247, 247, 248, 249, 249, 250, 251, 251, 252, 253, 254, 254, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt3 = { 0, 1, 3, 4, 5, 7, 8, 9, 10, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 41, 43, 44, 45, 46, 48, 49, 50, 51, 53, 54, 55, 56, 58, 59, 60, 61, 62, 64, 65, 66, 67, 69, 70, 71, 72, 73, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 94, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 106, 107, 109, 110, 111, 112, 113, 114, 115, 116, 117, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 210, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 226, 226, 227, 228, 228, 229, 230, 231, 231, 232, 233, 234, 234, 235, 236, 237, 237, 238, 239, 239, 240, 241, 242, 242, 243, 244, 244, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 253, 254, 254, 255 };
for (int i = 0; i < 256; i++){
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);
arrayOfByte[(3 + i * 4)] = -1;
}
int[] arrayOfInt4 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 224, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt5 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 126, 127, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 154, 155, 156, 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 229, 230, 231, 232, 233, 233, 234, 235, 236, 237, 237, 238, 239, 240, 240, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 250, 251, 252, 252, 253, 253, 254, 254, 255 };
int[] arrayOfInt6 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int j = 0; j < 256; j++){
arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);
arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt4[j]);
arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt6[j]);
arrayOfByte[(3 + (1024 + j * 4))] = -1;
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
}
});
}
}

@ -1,80 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicEvergreenFilter extends GPUImageFilter {
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
public MagicEvergreenFilter(){
super(MagicFilterType.EVERGREEN, R.raw.evergreen);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
mToneCurveTexture[0] = -1;
}
@Override
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
}
@Override
protected void onInitialized() {
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[1024];
int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 };
int[] arrayOfInt2 = { 0, 1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 17, 18, 19, 20, 21, 21, 22, 23, 24, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 113, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 142, 143, 144, 145, 146, 148, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 175, 177, 178, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 241, 242, 243, 244, 245, 246, 247, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255 };
int[] arrayOfInt3 = { 0, 2, 4, 6, 8, 10, 11, 13, 16, 17, 19, 20, 21, 23, 24, 25, 27, 28, 29, 31, 32, 33, 34, 36, 38, 39, 40, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 56, 58, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 144, 145, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 157, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 173, 175, 176, 177, 177, 178, 179, 180, 181, 182, 183, 184, 185, 185, 186, 187, 188, 190, 191, 192, 193, 193, 194, 195, 196, 197, 198, 199, 200, 200, 201, 202, 203, 205, 206, 207, 207, 208, 209, 210, 211, 212, 213, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 225, 226, 227, 228, 229, 230, 231, 231, 232, 234, 235, 236, 237, 237, 238, 239, 240, 241, 242, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt4 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int i = 0; i < 256; i++)
{
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);
arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
}
});
}
}

@ -1,75 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicFreudFilter extends GPUImageFilter {
private int mTexelHeightUniformLocation;
private int mTexelWidthUniformLocation;
private int[] inputTextureHandles = {-1};
private int[] inputTextureUniformLocations = {-1};
private int mGLStrengthLocation;
public MagicFreudFilter(){
super(MagicFilterType.FREUD, R.raw.freud);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(1, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++)
inputTextureHandles[i] = -1;
}
@Override
protected void onDrawArraysAfter(){
for (int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for (int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
inputTextureUniformLocations[0] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture2");
mTexelWidthUniformLocation = GLES20.glGetUniformLocation(getProgram(), "inputImageTextureWidth");
mTexelHeightUniformLocation = GLES20.glGetUniformLocation(getProgram(), "inputImageTextureHeight");
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/freud_rand.png");
}
});
}
@Override
public void onInputSizeChanged(int width, int height) {
super.onInputSizeChanged(width, height);
GLES20.glUniform1f(mTexelWidthUniformLocation, (float)width);
GLES20.glUniform1f(mTexelHeightUniformLocation, (float)height);
}
}

@ -1,109 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicHealthyFilter extends GPUImageFilter{
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
private int mMaskGrey1TextureId = -1;
private int mMaskGrey1UniformLocation;
private int mTexelHeightUniformLocation;
private int mTexelWidthUniformLocation;
public MagicHealthyFilter(){
super(MagicFilterType.HEALTHY, R.raw.healthy);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
mToneCurveTexture[0] = -1;
int[] texture = new int[1];
texture[0] = mMaskGrey1TextureId;
GLES20.glDeleteTextures(1, texture, 0);
mMaskGrey1TextureId = -1;
}
@Override
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);
GLES20.glUniform1i(mMaskGrey1UniformLocation, 4);
}
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), "mask");
mTexelWidthUniformLocation = GLES20.glGetUniformLocation(getProgram(), "texelWidthOffset");
mTexelHeightUniformLocation = GLES20.glGetUniformLocation(getProgram(), "texelHeightOffset");
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[1024];
int[] arrayOfInt1 = { 95, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 161, 162, 163, 163, 164, 165, 165, 166, 167, 168, 168, 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 177, 178, 179, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 200, 200, 201, 202, 202, 203, 204, 204, 205, 206, 207, 207, 208, 209, 209, 210, 211, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 239, 239, 240, 241, 241, 242, 243, 243, 244, 245, 245, 246, 247, 248, 248, 249, 250, 250, 251, 252, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 7, 8, 9, 12, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 219, 220, 221, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 249, 249, 250, 251, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt3 = { 0, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 105, 106, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 120, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 249, 250, 251, 252, 253, 254, 255 };
for (int i = 0; i < 256; i++)
{
arrayOfByte[(i * 4)] = ((byte)arrayOfInt3[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(3 + i * 4)] = -1;
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
}
});
}
@Override
public void onInputSizeChanged(int width, int height){
super.onInputSizeChanged(width, height);
GLES20.glUniform1f(mTexelWidthUniformLocation, 1.0f / width);
GLES20.glUniform1f(mTexelHeightUniformLocation, 1.0f / height);
}
}

@ -1,68 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicHefeFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1,-1,-1,-1};
private int[] inputTextureUniformLocations = {-1,-1,-1,-1};
private int mGLStrengthLocation;
public MagicHefeFilter(){
super(MagicFilterType.HEFE, R.raw.hefe);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++) {
inputTextureHandles[i] = -1;
}
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for(int i=0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/edgeburn.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/hefemap.png");
inputTextureHandles[2] = OpenGLUtils.loadTexture(getContext(), "filter/hefemetal.png");
inputTextureHandles[3] = OpenGLUtils.loadTexture(getContext(), "filter/hefesoftlight.png");
}
});
}
}

@ -1,68 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicHudsonFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1,-1,-1};
private int[] inputTextureUniformLocations = {-1,-1,-1};
private int mGLStrengthLocation;
public MagicHudsonFilter(){
super(MagicFilterType.HUDSON, R.raw.hudson);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++)
inputTextureHandles[i] = -1;
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for(int i=0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/ohudsonbackground.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/overlaymap.png");
inputTextureHandles[2] = OpenGLUtils.loadTexture(getContext(), "filter/hudsonmap.png");
}
});
}
}

@ -1,55 +0,0 @@
package com.seu.magicfilter.advanced;
import com.seu.magicfilter.base.MagicBaseGroupFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageBrightnessFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageContrastFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageExposureFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageHueFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageSaturationFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageSharpenFilter;
import java.util.ArrayList;
import java.util.List;
public class MagicImageAdjustFilter extends MagicBaseGroupFilter {
public MagicImageAdjustFilter() {
super(initFilters());
}
private static List<GPUImageFilter> initFilters(){
List<GPUImageFilter> filters = new ArrayList<GPUImageFilter>();
filters.add(new GPUImageContrastFilter());
filters.add(new GPUImageBrightnessFilter());
filters.add(new GPUImageExposureFilter());
filters.add(new GPUImageHueFilter());
filters.add(new GPUImageSaturationFilter());
filters.add(new GPUImageSharpenFilter());
return filters;
}
public void setSharpness(final float range){
((GPUImageSharpenFilter) filters.get(5)).setSharpness(range);
}
public void setHue(final float range){
((GPUImageHueFilter) filters.get(3)).setHue(range);
}
public void setBrightness(final float range){
((GPUImageBrightnessFilter) filters.get(1)).setBrightness(range);
}
public void setContrast(final float range){
((GPUImageContrastFilter) filters.get(0)).setContrast(range);
}
public void setSaturation(final float range){
((GPUImageSaturationFilter) filters.get(4)).setSaturation(range);
}
public void setExposure(final float range){
((GPUImageExposureFilter) filters.get(2)).setExposure(range);
}
}

@ -1,66 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicInkwellFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1};
private int[] inputTextureUniformLocations = {-1};
private int mGLStrengthLocation;
public MagicInkwellFilter(){
super(MagicFilterType.INKWELL, R.raw.inkwell);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(1, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++)
inputTextureHandles[i] = -1;
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for(int i = 0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/inkwellmap.png");
}
});
}
}

@ -1,65 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicKevinFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1};
private int[] inputTextureUniformLocations = {-1};
private int mGLStrengthLocation;
public MagicKevinFilter(){
super(MagicFilterType.KEVIN, R.raw.kevin_new);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(1, inputTextureHandles, 0);
for (int i = 0; i < inputTextureHandles.length; i++) {
inputTextureHandles[i] = -1;
}
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for(int i = 0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/kelvinmap.png");
}
});
}
}

@ -1,88 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicLatteFilter extends GPUImageFilter {
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
public MagicLatteFilter(){
super(MagicFilterType.LATTE, R.raw.latte);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
mToneCurveTexture[0] = -1;
}
@Override
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[2048];
int[] arrayOfInt1 = { 5, 6, 8, 9, 11, 12, 14, 15, 16, 18, 19, 21, 22, 23, 25, 26, 28, 29, 30, 32, 33, 34, 36, 37, 39, 40, 41, 43, 44, 45, 46, 48, 49, 50, 52, 53, 54, 55, 56, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 108, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 120, 121, 122, 123, 124, 125, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 158, 158, 159, 160, 161, 162, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 };
int[] arrayOfInt2 = { 5, 6, 8, 11, 12, 14, 15, 18, 19, 21, 22, 25, 26, 28, 29, 32, 33, 34, 36, 39, 40, 41, 43, 44, 46, 48, 49, 50, 52, 54, 55, 56, 58, 59, 61, 62, 64, 65, 66, 67, 69, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 85, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 108, 108, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 120, 121, 122, 123, 125, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 145, 146, 147, 148, 148, 149, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 158, 158, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 166, 167, 168, 169, 170, 170, 171, 172, 173, 174, 174, 175, 175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, 195, 196, 197, 198, 198, 199, 199, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 213, 213, 214, 215, 215, 216, 217, 218, 219, 219, 220, 221, 222, 223, 224, 225, 226, 226, 227, 228, 229, 230, 231, 232, 232, 233, 234, 235, 237, 238, 239, 240, 240, 241, 242, 243, 244, 245, 246, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255 };
int[] arrayOfInt3 = { 5, 6, 8, 11, 12, 14, 15, 16, 18, 21, 22, 23, 25, 26, 28, 30, 32, 33, 34, 36, 37, 40, 41, 43, 44, 45, 46, 49, 50, 52, 53, 54, 55, 58, 59, 60, 61, 62, 64, 66, 67, 68, 69, 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 83, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 106, 107, 108, 108, 109, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 120, 121, 123, 124, 125, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 156, 157, 158, 158, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 166, 167, 168, 169, 170, 170, 170, 171, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 180, 181, 182, 183, 183, 184, 184, 185, 186, 187, 188, 189, 189, 189, 190, 191, 192, 192, 193, 194, 195, 196, 196, 197, 198, 198, 199, 199, 200, 201, 202, 202, 203, 204, 205, 206, 206, 207, 208, 209, 209, 210, 211, 212, 213, 213, 214, 215, 215, 215, 216, 217, 218, 218, 219, 220, 221, 221, 222, 223, 224, 224, 225, 226, 227, 227, 228, 229, 230, 230, 231, 232, 233, 233, 234, 235, 237, 237, 238, 239, 240, 240, 241, 242, 243, 243, 244 };
for (int i = 0; i < 256; i++){
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);
arrayOfByte[(3 + i * 4)] = -1;
}
int[] arrayOfInt4 = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 10, 12, 13, 14, 15, 16, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 66, 67, 68, 69, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 113, 114, 115, 116, 117, 119, 120, 121, 122, 123, 125, 126, 127, 128, 129, 131, 132, 133, 134, 135, 137, 138, 139, 140, 141, 143, 144, 145, 146, 147, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, 161, 162, 163, 164, 165, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 179, 180, 181, 182, 184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 196, 197, 198, 199, 200, 202, 203, 204, 205, 206, 208, 209, 210, 211, 212, 214, 215, 216, 217, 218, 220, 221, 222, 223, 224, 226, 227, 228, 229, 230, 232, 233, 234, 235, 236, 238, 239, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240 };
int[] arrayOfInt5 = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 41, 42, 43, 44, 46, 47, 48, 49, 51, 52, 53, 54, 56, 57, 58, 59, 61, 62, 63, 65, 66, 67, 69, 70, 71, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89, 90, 92, 93, 94, 96, 97, 99, 100, 101, 103, 104, 106, 107, 108, 110, 111, 113, 114, 116, 117, 119, 120, 121, 123, 124, 126, 127, 129, 130, 132, 133, 135, 136, 138, 139, 140, 142, 143, 145, 146, 147, 149, 150, 151, 153, 154, 155, 157, 158, 159, 160, 162, 163, 164, 165, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 231, 232, 233, 233, 234, 234, 235, 236, 236, 237, 237, 238, 238, 239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 244, 245, 245, 246, 246, 247, 247, 247, 248, 248, 249, 249, 249, 250, 250, 250, 251, 251, 251, 252, 252, 252, 252, 253, 253, 253, 253, 254, 254, 254, 254, 255, 255, 255 };
int[] arrayOfInt6 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int j = 0; j < 256; j++){
arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);
arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt4[j]);
arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt6[j]);
arrayOfByte[(3 + (1024 + j * 4))] = -1;
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
}
});
}
}

@ -1,67 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicLomoFilter extends GPUImageFilter{
private int[] inputTextureHandles = {-1,-1};
private int[] inputTextureUniformLocations = {-1,-1};
private int mGLStrengthLocation;
public MagicLomoFilter(){
super(MagicFilterType.LOMO, R.raw.lomo);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++)
inputTextureHandles[i] = -1;
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for(int i=0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/vlomomap_new.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/vignette_map.png");
}
});
}
}

@ -1,59 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicN1977Filter extends GPUImageFilter{
private int[] inputTextureHandles = {-1,-1};
private int[] inputTextureUniformLocations = {-1,-1};
private int mGLStrengthLocation;
public MagicN1977Filter(){
super(MagicFilterType.N1977, R.raw.n1977);
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for(int i=0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/n1977map.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/n1977blowout.png");
}
});
}
}

@ -1,65 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicNashvilleFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1};
private int[] inputTextureUniformLocations = {-1};
private int mGLStrengthLocation;
public MagicNashvilleFilter(){
super(MagicFilterType.NASHVILLE, R.raw.nashville);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(1, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++) {
inputTextureHandles[i] = -1;
}
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for(int i=0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/nashvillemap.png");
}
});
}
}

@ -1,140 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicNostalgiaFilter extends GPUImageFilter {
private int mBlurSizeUniformLocation;
private int mTexelWidthUniformLocation;
private int mTexelHeightUniformLocation;
private int[] mToneCurveTexture = { -1 };
private int[] mToneCurveTexture2 = { -1 };
private int mToneCurveTextureUniformLocation;
private int mToneCurveTextureUniformLocation2;
public MagicNostalgiaFilter(){
super(MagicFilterType.NOSTALGIA, R.raw.nostalgia);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
mToneCurveTexture[0] = -1;
GLES20.glDeleteTextures(1, mToneCurveTexture2, 0);
mToneCurveTexture2[0] = -1;
}
@Override
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mToneCurveTexture2[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
if (mToneCurveTexture2[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation2, 4);
}
GLES20.glUniform1f(mBlurSizeUniformLocation, 1.0F);
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
mToneCurveTextureUniformLocation2 = GLES20.glGetUniformLocation(getProgram(), "curve2");
mTexelWidthUniformLocation = GLES20.glGetUniformLocation(getProgram(), "texelWidthOffset");
mTexelHeightUniformLocation = GLES20.glGetUniformLocation(getProgram(), "texelHeightOffset");
mBlurSizeUniformLocation = GLES20.glGetUniformLocation(getProgram(), "blurSize");
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte1 = new byte[2048];
int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 6, 8, 9, 11, 13, 15, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 39, 41, 43, 45, 47, 49, 50, 52, 54, 56, 57, 59, 61, 62, 64, 66, 68, 69, 71, 72, 74, 76, 77, 79, 80, 82, 84, 85, 87, 88, 90, 91, 93, 94, 96, 97, 98, 100, 101, 103, 104, 106, 107, 108, 110, 111, 112, 114, 115, 116, 118, 119, 120, 122, 123, 124, 125, 127, 128, 129, 130, 131, 133, 134, 135, 136, 137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 204, 205, 206, 207, 207, 208, 209, 210, 210, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 219, 219, 220, 221, 221, 222, 223, 224, 224, 225, 226, 226, 227, 228, 228, 229, 230, 231, 231, 232, 233, 233, 234, 235, 235, 236, 237, 237, 238, 239, 240, 240, 241, 242, 242, 243, 244, 244, 245, 246, 246, 247, 248, 248, 249, 250, 250, 251, 252, 252, 253, 254, 254, 255 };
int[] arrayOfInt2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 14, 16, 17, 19, 20, 22, 23, 24, 26, 27, 29, 30, 32, 33, 34, 36, 37, 39, 40, 42, 43, 44, 46, 47, 49, 50, 52, 53, 54, 56, 57, 59, 60, 61, 63, 64, 66, 67, 69, 70, 71, 73, 74, 75, 77, 78, 80, 81, 82, 84, 85, 87, 88, 89, 91, 92, 93, 95, 96, 97, 99, 100, 101, 103, 104, 105, 107, 108, 109, 111, 112, 113, 115, 116, 117, 119, 120, 121, 122, 124, 125, 126, 127, 129, 130, 131, 132, 134, 135, 136, 137, 139, 140, 141, 142, 144, 145, 146, 147, 148, 149, 151, 152, 153, 154, 155, 156, 158, 159, 160, 161, 162, 163, 164, 165, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 219, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 231, 232, 233, 233, 234, 235, 235, 236, 237, 237, 238, 239, 239, 240, 241, 241, 242, 243, 243, 244, 244, 245, 246, 246, 247, 248, 248, 249, 249, 250, 251, 251, 252, 253, 253, 254, 254, 255 };
int[] arrayOfInt3 = { 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 31, 33, 35, 37, 39, 41, 43, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 65, 67, 69, 71, 73, 75, 76, 78, 80, 82, 84, 85, 87, 89, 91, 92, 94, 96, 98, 99, 101, 102, 104, 106, 107, 109, 110, 112, 114, 115, 117, 118, 119, 121, 122, 124, 125, 126, 128, 129, 130, 132, 133, 134, 135, 137, 138, 139, 140, 141, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 175, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 186, 187, 188, 189, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 200, 200, 201, 202, 202, 203, 204, 204, 205, 206, 206, 207, 208, 208, 209, 210, 210, 211, 212, 212, 213, 214, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 231, 232, 233, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 240, 240, 241, 242, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 252, 253, 254, 254, 255 };
int[] arrayOfInt4 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int i = 0; i < 256; i++){
arrayOfByte1[(0 + i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte1[(1 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte1[(2 + i * 4)] = ((byte)arrayOfInt3[i]);
arrayOfByte1[(3 + i * 4)] = ((byte)arrayOfInt4[i]);
}
int[] arrayOfInt5 = { 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 30, 32, 33, 34, 35, 37, 38, 39, 41, 42, 43, 44, 46, 47, 48, 50, 51, 52, 53, 55, 56, 57, 58, 60, 61, 62, 64, 65, 66, 67, 69, 70, 71, 72, 74, 75, 76, 77, 79, 80, 81, 82, 84, 85, 86, 87, 88, 90, 91, 92, 93, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 127, 128, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 179, 180, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 204, 205, 206, 207, 209, 210, 211, 213, 214, 215, 217, 218, 220, 221, 222, 224, 225, 227, 228, 230, 231, 233, 234, 235, 237, 238, 240, 241, 243, 244, 246, 247, 249, 250, 252, 253, 255 };
int[] arrayOfInt6 = { 0, 3, 6, 8, 11, 14, 16, 18, 21, 24, 26, 29, 30, 33, 35, 37, 39, 41, 43, 45, 47, 49, 50, 52, 53, 54, 56, 58, 59, 61, 62, 63, 65, 65, 66, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 133, 134, 135, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 145, 146, 146, 147, 147, 148, 149, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 158, 159, 159, 160, 161, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168, 169, 170, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 179, 179, 180, 181, 181, 182, 182, 183, 183, 184, 185, 186, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 193, 194, 194, 194, 195, 196, 197, 197, 198, 199, 199, 200, 201, 201, 202, 203, 203, 204, 205, 205, 206, 206, 207, 207, 208, 209, 209, 210, 211, 211, 212, 213, 213, 214, 215, 215, 216, 217, 217, 217, 217, 218, 219, 219, 220, 221, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 228, 229, 229, 229, 230, 231, 231, 232, 232, 233, 234, 234, 235 };
int[] arrayOfInt7 = { 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 96, 97, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 111, 112, 113, 115, 116, 118, 119, 120, 122, 123, 125, 126, 128, 129, 131, 132, 134, 135, 137, 139, 140, 142, 143, 145, 147, 148, 150, 152, 153, 155, 156, 158, 160, 161, 163, 164, 166, 167, 169, 170, 172, 173, 175, 176, 178, 179, 180, 182, 183, 185, 186, 188, 189, 190, 192, 193, 194, 196, 197, 199, 200, 201, 203, 204, 205, 206, 208, 209, 210, 212, 213, 214, 216, 217, 218, 219, 221, 222, 223, 224, 226, 227, 228, 229, 231, 232, 233, 234, 236, 237, 238, 239, 240, 242, 243, 244, 245, 247, 248, 249, 250, 251, 253, 254, 255 };
for (int j = 0; j < 256; j++){
arrayOfByte1[(0 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);
arrayOfByte1[(1 + (1024 + j * 4))] = ((byte)arrayOfInt6[j]);
arrayOfByte1[(2 + (1024 + j * 4))] = ((byte)arrayOfInt7[j]);
arrayOfByte1[(3 + (1024 + j * 4))] = ((byte)arrayOfInt4[j]);
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte1));
GLES20.glGenTextures(1, mToneCurveTexture2, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture2[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte2 = new byte[1024];
int[] arrayOfInt8 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
int[] arrayOfInt9 = { 42, 43, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 62, 63, 64, 65, 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, 72, 73, 74, 75, 75, 76, 77, 78, 78, 79, 80, 81, 81, 82, 83, 84, 84, 85, 86, 87, 87, 88, 89, 90, 91, 91, 92, 93, 94, 94, 95, 96, 97, 98, 98, 99, 100, 101, 102, 103, 103, 104, 105, 106, 107, 108, 108, 109, 110, 111, 112, 113, 113, 114, 115, 116, 117, 118, 119, 120, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 207, 207, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 217, 218, 219, 220, 221, 221, 222, 223, 224, 224, 225, 226, 227, 228, 228, 229, 230, 231, 231, 232, 233, 234, 234, 235, 236, 237, 237, 238, 239, 240, 240, 241, 242, 243, 243, 244, 245, 246, 246, 247, 248, 248, 249, 250, 251, 251, 252, 253, 254, 254, 255 };
int[] arrayOfInt10 = { 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 205, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227, 227, 228, 229, 230, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 240, 240, 241, 241, 242, 243, 243, 244, 245, 245, 246, 246, 247, 248, 248, 249, 250, 250, 251, 251, 252, 253, 253, 254, 254, 255 };
int[] arrayOfInt11 = { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 214, 215, 216, 217, 218, 219, 219, 220, 221, 222, 223, 224, 224, 225, 226, 227, 228, 229, 229, 230, 231, 232, 233, 234, 234, 235, 236, 237, 238, 239, 239, 240, 241, 242, 243, 244, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 253, 254, 255 };
for (int k = 0; k < 256; k++){
arrayOfByte2[(0 + k * 4)] = ((byte)arrayOfInt9[k]);
arrayOfByte2[(1 + k * 4)] = ((byte)arrayOfInt10[k]);
arrayOfByte2[(2 + k * 4)] = ((byte)arrayOfInt11[k]);
arrayOfByte2[(3 + k * 4)] = ((byte)arrayOfInt8[k]);
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte2));
}
});
}
@Override
public void onInputSizeChanged(int width, int height) {
super.onInputSizeChanged(width, height);
GLES20.glUniform1f(mTexelWidthUniformLocation, (1.0f / (float)width));
GLES20.glUniform1f(mTexelHeightUniformLocation, (1.0f / (float)height));
}
}

@ -1,65 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicPixelFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1};
private int[] inputTextureUniformLocations = {-1};
private int mGLStrengthLocation;
public MagicPixelFilter(){
super(MagicFilterType.PIXAR, R.raw.pixar);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(1, inputTextureHandles, 0);
for (int i = 0; i < inputTextureHandles.length; i++) {
inputTextureHandles[i] = -1;
}
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for (int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for (int i=0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
// inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/pixar_curves.png");
}
});
}
}

@ -1,66 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicRiseFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1,-1,-1};
private int[] inputTextureUniformLocations = {-1,-1,-1};
public MagicRiseFilter(){
super(MagicFilterType.RISE, R.raw.rise);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++)
inputTextureHandles[i] = -1;
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for(int i=0; i < inputTextureUniformLocations.length; i++){
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture"+(2+i));
}
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/blackboard1024.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/overlaymap.png");
inputTextureHandles[2] = OpenGLUtils.loadTexture(getContext(), "filter/risemap.png");
}
});
}
}

@ -1,81 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicRomanceFilter extends GPUImageFilter {
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
public MagicRomanceFilter(){
super(MagicFilterType.ROMANCE, R.raw.romance);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
mToneCurveTexture[0] = -1;
}
@Override
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] romance_arrayOfByte = new byte[1024];
int[] romance_arrayOfInt1 = { 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 65, 65, 66, 67, 67, 68, 69, 69, 70, 71, 72, 73, 73, 74, 75, 76, 77, 78, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 100, 101, 102, 103, 104, 105, 106, 107, 109, 110, 111, 112, 113, 114, 116, 117, 118, 119, 120, 122, 123, 124, 125, 127, 128, 129, 130, 131, 133, 134, 135, 136, 138, 139, 140, 141, 143, 144, 145, 146, 148, 149, 150, 151, 153, 154, 155, 156, 158, 159, 160, 161, 162, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 182, 183, 184, 185, 186, 187, 188, 189, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 222, 223, 224, 225, 226, 226, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 237, 237, 238, 239, 239, 240, 241, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 252, 253, 254, 254, 255 };
int[] romance_arrayOfInt2 = { 0, 1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 26, 26, 27, 28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 139, 140, 141, 142, 144, 145, 146, 147, 148, 149, 151, 152, 153, 154, 155, 156, 157, 159, 160, 161, 162, 163, 164, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 };
int[] romance_arrayOfInt3 = { 0, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 20, 21, 23, 25, 26, 28, 30, 31, 33, 34, 36, 38, 39, 41, 42, 44, 45, 47, 48, 50, 51, 53, 54, 56, 57, 59, 60, 62, 63, 65, 66, 67, 69, 70, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83, 84, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 106, 107, 108, 109, 110, 111, 112, 112, 113, 114, 115, 116, 116, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 130, 130, 131, 131, 132, 133, 133, 134, 134, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140, 141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 147, 148, 149, 149, 150, 150, 151, 152, 152, 153, 154, 154, 155, 155, 156, 157, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 183, 184, 185, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 242, 243, 244, 245, 246, 247, 248, 249, 251, 252, 253, 254, 255 };
int[] romance_arrayOfInt4 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int i = 0; i < 256; i++){
romance_arrayOfByte[(i * 4)] = ((byte)romance_arrayOfInt1[i]);
romance_arrayOfByte[(1 + i * 4)] = ((byte)romance_arrayOfInt2[i]);
romance_arrayOfByte[(2 + i * 4)] = ((byte)romance_arrayOfInt3[i]);
romance_arrayOfByte[(3 + i * 4)] = ((byte)romance_arrayOfInt4[i]);
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(romance_arrayOfByte));
}
});
}
}

@ -1,89 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicSakuraFilter extends GPUImageFilter {
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
private int mTexelHeightUniformLocation;
private int mTexelWidthUniformLocation;
public MagicSakuraFilter(){
super(MagicFilterType.SAKURA, R.raw.romance);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
mToneCurveTexture[0] = -1;
}
@Override
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
mTexelWidthUniformLocation = GLES20.glGetUniformLocation(getProgram(), "texelWidthOffset");
mTexelHeightUniformLocation = GLES20.glGetUniformLocation(getProgram(), "texelHeightOffset");
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[1024];
int[] arrayOfInt = { 95, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 161, 162, 163, 163, 164, 165, 165, 166, 167, 168, 168, 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 177, 178, 179, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 200, 200, 201, 202, 202, 203, 204, 204, 205, 206, 207, 207, 208, 209, 209, 210, 211, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 239, 239, 240, 241, 241, 242, 243, 243, 244, 245, 245, 246, 247, 248, 248, 249, 250, 250, 251, 252, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
for (int i = 0; i < 256; i++)
{
arrayOfByte[(i * 4)] = ((byte)arrayOfInt[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt[i]);
arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt[i]);
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
}
});
}
@Override
public void onInputSizeChanged(int width, int height) {
super.onInputSizeChanged(width, height);
GLES20.glUniform1f(mTexelWidthUniformLocation, (1.0f / (float)width));
GLES20.glUniform1f(mTexelHeightUniformLocation, (1.0f / (float)height));
}
}

@ -1,67 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicSierraFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1,-1,-1};
private int[] inputTextureUniformLocations = {-1,-1,-1};
private int mGLStrengthLocation;
public MagicSierraFilter(){
super(MagicFilterType.SIERRA, R.raw.sierra);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++)
inputTextureHandles[i] = -1;
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit(){
super.onInit();
for(int i = 0; i < inputTextureUniformLocations.length; i++)
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture"+(2+i));
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/sierravignette.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/overlaymap.png");
inputTextureHandles[2] = OpenGLUtils.loadTexture(getContext(), "filter/sierramap.png");
}
});
}
}

@ -1,42 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
public class MagicSketchFilter extends GPUImageFilter {
private int mSingleStepOffsetLocation;
//0.0 - 1.0
private int mStrengthLocation;
public MagicSketchFilter(){
super(MagicFilterType.SKETCH, R.raw.sketch);
}
@Override
protected void onInit() {
super.onInit();
mSingleStepOffsetLocation = GLES20.glGetUniformLocation(getProgram(), "singleStepOffset");
mStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
protected void onInitialized(){
super.onInitialized();
setFloat(mStrengthLocation, 0.5f);
}
@Override
public void onInputSizeChanged(final int width, final int height) {
super.onInputSizeChanged(width, height);
setFloatVec2(mSingleStepOffsetLocation, new float[] {1.0f / width, 1.0f / height});
}
}

@ -1,93 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicSkinWhitenFilter extends GPUImageFilter {
private int mTexelHeightUniformLocation;
private int mTexelWidthUniformLocation;
private int mToneCurveTextureUniformLocation;
private int[] mToneCurveTexture = new int[] {-1};
public MagicSkinWhitenFilter() {
super(MagicFilterType.SKINWHITEN, R.raw.skinwhiten);
}
@Override
protected void onInit() {
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
mTexelWidthUniformLocation = GLES20.glGetUniformLocation(getProgram(), "texelWidthOffset");
mTexelHeightUniformLocation = GLES20.glGetUniformLocation(getProgram(), "texelHeightOffset");
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
mToneCurveTexture[0] = -1;
}
@Override
protected void onInitialized() {
super.onInitialized();
runOnDraw(new Runnable() {
public void run() {
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[1024];
int[] arrayOfInt1 = { 95, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 161, 162, 163, 163, 164, 165, 165, 166, 167, 168, 168, 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 177, 178, 179, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 200, 200, 201, 202, 202, 203, 204, 204, 205, 206, 207, 207, 208, 209, 209, 210, 211, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 239, 239, 240, 241, 241, 242, 243, 243, 244, 245, 245, 246, 247, 248, 248, 249, 250, 250, 251, 252, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt2 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int i = 0; i < 256; i++){
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(3 + i * 4)] = -1;
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
}
});
}
@Override
protected void onDrawArraysPre() {
super.onDrawArraysPre();
if(mToneCurveTexture[0] != -1) {
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(this.mToneCurveTextureUniformLocation, 3);
}
}
@Override
protected void onDrawArraysAfter() {
super.onDrawArraysAfter();
if (mToneCurveTexture[0] != -1) {
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
public void onInputSizeChanged(int width, int height) {
super.onInputSizeChanged(width, height);
GLES20.glUniform1f(mTexelWidthUniformLocation, (1.0f / (float)width));
GLES20.glUniform1f(mTexelHeightUniformLocation, (1.0f / (float)height));
}
}

@ -1,139 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicSunriseFilter extends GPUImageFilter {
private int mMaskGrey1TextureId = -1;
private int mMaskGrey1UniformLocation;
private int mMaskGrey2TextureId = -1;
private int mMaskGrey2UniformLocation;
private int mMaskGrey3TextureId = -1;
private int mMaskGrey3UniformLocation;
private int[] mToneCurveTexture = { -1 };
private int mToneCurveTextureUniformLocation;
public MagicSunriseFilter(){
super(MagicFilterType.SUNRISE, R.raw.sunrise);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
mToneCurveTexture[0] = -1;
GLES20.glDeleteTextures(1, new int[]{mMaskGrey1TextureId}, 0);
mMaskGrey1TextureId = -1;
GLES20.glDeleteTextures(1, new int[]{mMaskGrey2TextureId}, 0);
mMaskGrey2TextureId = -1;
GLES20.glDeleteTextures(1, new int[]{mMaskGrey3TextureId}, 0);
mMaskGrey3TextureId = -1;
}
@Override
protected void onDrawArraysAfter() {
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey2TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE5);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey3TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE6);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre() {
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);
GLES20.glUniform1i(mMaskGrey1UniformLocation, 4);
}
if (mMaskGrey2TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE5);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey2TextureId);
GLES20.glUniform1i(mMaskGrey2UniformLocation, 5);
}
if (mMaskGrey3TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE6);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey3TextureId);
GLES20.glUniform1i(mMaskGrey3UniformLocation, 6);
}
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), "grey1Frame");
mMaskGrey2UniformLocation = GLES20.glGetUniformLocation(getProgram(), "grey2Frame");
mMaskGrey3UniformLocation = GLES20.glGetUniformLocation(getProgram(), "grey3Frame");
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[2048];
int[] arrayOfInt1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 30, 31, 32, 34, 35, 36, 38, 39, 41, 42, 44, 45, 47, 49, 50, 52, 54, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 92, 94, 96, 98, 101, 103, 105, 107, 110, 111, 113, 115, 118, 120, 122, 124, 126, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 150, 152, 154, 156, 158, 159, 161, 162, 164, 166, 167, 169, 170, 172, 173, 174, 176, 177, 178, 180, 181, 182, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 200, 201, 202, 203, 203, 204, 205, 205, 207, 208, 208, 209, 209, 210, 210, 211, 211, 212, 212, 213, 213, 213, 214, 214, 215, 215, 215, 216, 216, 216, 216, 217, 217, 217, 218, 218, 218, 218, 219, 219, 219, 219, 219, 220, 220, 220, 220, 220, 220, 221, 221, 221, 221, 221, 222, 222, 222, 222, 222, 223, 223, 223, 223, 223, 224, 224, 224, 224, 224, 225, 225, 225, 225, 226, 226, 226, 227, 227, 227, 228, 228, 228, 229, 229, 230, 230, 230, 231, 231, 232, 232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 238, 238, 239, 239, 241, 241, 242, 243, 243, 244, 245, 245, 246, 246, 247, 248, 248, 249, 250, 250, 251, 252, 252, 253, 254, 254, 255 };
int[] arrayOfInt2 = { 0, 1, 3, 4, 5, 7, 8, 10, 11, 12, 14, 15, 17, 18, 19, 21, 22, 24, 25, 27, 28, 30, 31, 33, 34, 36, 37, 39, 40, 42, 44, 45, 47, 48, 50, 52, 54, 55, 57, 59, 61, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 83, 85, 87, 90, 92, 94, 96, 98, 101, 103, 105, 107, 110, 111, 113, 115, 117, 119, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 143, 145, 147, 149, 150, 152, 154, 155, 157, 158, 160, 161, 163, 164, 165, 167, 168, 169, 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 198, 199, 199, 200, 200, 201, 201, 202, 202, 203, 203, 204, 204, 205, 205, 205, 207, 207, 208, 208, 208, 209, 209, 210, 210, 210, 211, 211, 211, 212, 212, 212, 213, 213, 213, 214, 214, 214, 215, 215, 215, 216, 216, 216, 217, 217, 217, 218, 218, 219, 219, 219, 220, 220, 220, 221, 221, 222, 222, 222, 223, 223, 224, 224, 225, 225, 225, 226, 226, 227, 227, 228, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, 233, 234, 234, 235, 235, 236, 236, 236, 237, 237, 238, 238, 239, 239, 241, 241, 242, 242, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 };
int[] arrayOfInt3 = { 0, 1, 3, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 17, 18, 19, 21, 22, 23, 25, 26, 28, 29, 30, 32, 33, 35, 36, 38, 39, 41, 43, 44, 46, 47, 49, 51, 53, 54, 56, 58, 60, 62, 64, 66, 68, 69, 71, 73, 76, 78, 80, 82, 83, 85, 87, 89, 91, 93, 95, 97, 100, 102, 104, 106, 108, 110, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 130, 132, 134, 136, 138, 139, 141, 143, 145, 146, 148, 150, 151, 153, 155, 156, 158, 159, 161, 162, 164, 165, 167, 168, 169, 171, 172, 173, 175, 176, 177, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 200, 201, 202, 203, 204, 204, 205, 207, 207, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, 214, 215, 215, 215, 216, 216, 217, 217, 217, 218, 218, 218, 219, 219, 219, 220, 220, 220, 220, 221, 221, 221, 221, 222, 222, 222, 222, 223, 223, 223, 223, 224, 224, 224, 224, 224, 225, 225, 225, 225, 225, 226, 226, 226, 226, 227, 227, 227, 227, 228, 228, 228, 228, 229, 229, 229, 230, 230, 230, 231, 231, 231, 232, 232, 233, 233, 233, 234, 234, 235, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 247, 247, 248, 248, 249, 249, 250, 250, 251, 252, 252, 253, 253, 254, 254, 255 };
int[] arrayOfInt4 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int i = 0; i < 256; i++){
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);
arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);
}
int[] arrayOfInt5 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 139, 140, 141, 143, 144, 145, 146, 147, 148, 150, 151, 152, 153, 154, 155, 156, 158, 159, 160, 161, 162, 163, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177, 178, 180, 181, 182, 183, 184, 185, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 198, 199, 201, 202, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 216, 217, 218, 219, 220, 221, 223, 224, 225, 226, 227, 228, 230, 231, 232, 233, 234, 235, 236, 238, 239, 240, 241, 242, 243, 245, 246, 247, 248, 249, 250, 252, 253, 254, 255 };
int[] arrayOfInt6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 5, 6, 7, 9, 10, 11, 12, 14, 15, 16, 17, 19, 20, 21, 22, 24, 25, 26, 27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 49, 50, 51, 52, 53, 55, 56, 57, 58, 60, 61, 62, 63, 65, 66, 67, 68, 70, 71, 72, 73, 75, 76, 77, 78, 80, 81, 82, 83, 85, 86, 87, 88, 90, 91, 92, 93, 95, 96, 97, 98, 100, 101, 102, 103, 104, 106, 107, 108, 109, 111, 112, 113, 114, 116, 117, 118, 119, 121, 122, 123, 124, 126, 127, 128, 129, 131, 132, 133, 134, 136, 137, 138, 139, 141, 142, 143, 144, 146, 147, 148, 149, 151, 152, 153, 154, 155, 157, 158, 159, 160, 162, 163, 164, 165, 167, 168, 169, 170, 172, 173, 174, 175, 177, 178, 179, 180, 182, 183, 184, 185, 187, 188, 189, 190, 192, 193, 194, 195, 197, 198, 199, 200, 202, 203, 204, 205, 206, 208, 209, 210, 211, 213, 214, 215, 216, 218, 219, 220, 221, 223, 224, 225, 226, 228, 229, 230, 231, 233, 234, 235, 236, 238, 239, 240, 241, 243, 244, 245, 246, 248, 249, 250, 251, 253, 254, 255 };
int[] arrayOfInt7 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 56, 57, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 105, 106, 107, 108, 109, 110, 111, 113, 114, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 139, 140, 141, 142, 144, 145, 146, 147, 148, 149, 150, 152, 153, 154, 155, 156, 157, 159, 160, 161, 162, 163, 164, 165, 167, 168, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 203, 204, 206, 207, 208, 209, 210, 211, 213, 214, 215, 216, 217, 218, 219, 221, 222, 223, 224, 225, 226, 227, 229, 230, 231, 232, 233, 234, 235, 237, 238, 239, 240, 241, 242, 244, 245, 246, 247, 248, 249, 250, 252, 253, 254, 255 };
int[] arrayOfInt8 = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 15, 16, 17, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 24, 25, 26, 27, 27, 28, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 49, 50, 51, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 142, 143, 144, 145, 146, 147, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, 160, 162, 163, 164, 165, 166, 168, 169, 170, 171, 173, 174, 175, 176, 177, 179, 180, 181, 182, 184, 185, 186, 187, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 204, 205, 206, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 223, 224, 226, 227, 228, 230, 231, 232, 234, 235, 236, 238, 239, 240, 242, 243, 244, 246, 247, 248, 250, 251, 252, 254, 255 };
for (int j = 0; j < 256; j++){
arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);
arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt6[j]);
arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt7[j]);
arrayOfByte[(3 + (1024 + j * 4))] = ((byte)arrayOfInt8[j]);
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glActiveTexture(GLES20.GL_TEXTURE5);
GLES20.glActiveTexture(GLES20.GL_TEXTURE6);
}
});
}
}

@ -1,120 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
import java.nio.ByteBuffer;
public class MagicSunsetFilter extends GPUImageFilter {
private int mMaskGrey1TextureId = -1;
private int mMaskGrey1UniformLocation;
private int mMaskGrey2TextureId = -1;
private int mMaskGrey2UniformLocation;
private int[] mToneCurveTexture = { -1 };
private int mToneCurveTextureUniformLocation;
public MagicSunsetFilter(){
super(MagicFilterType.SUNSET, R.raw.sunset);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(3, new int[]{mToneCurveTexture[0], mMaskGrey1TextureId, mMaskGrey2TextureId}, 0);
mToneCurveTexture[0] = -1;
mMaskGrey1TextureId = -1;
mMaskGrey2TextureId = -1;
}
@Override
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey2TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE5);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre() {
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);
GLES20.glUniform1i(mMaskGrey1UniformLocation, 4);
}
if (mMaskGrey2TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE5);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey2TextureId);
GLES20.glUniform1i(mMaskGrey2UniformLocation, 5);
}
}
@Override
protected void onInit() {
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), "grey1Frame");
mMaskGrey2UniformLocation = GLES20.glGetUniformLocation(getProgram(), "grey2Frame");
}
@Override
protected void onInitialized() {
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[2048];
int[] arrayOfInt1 = { 0, 1, 2, 3, 5, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 16, 18, 19, 20, 21, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 38, 39, 40, 41, 42, 44, 45, 47, 48, 49, 51, 52, 54, 55, 56, 59, 60, 62, 63, 64, 66, 67, 70, 71, 72, 74, 76, 78, 79, 80, 83, 84, 85, 88, 89, 90, 93, 94, 95, 98, 99, 100, 102, 104, 106, 107, 108, 109, 112, 113, 114, 116, 117, 118, 119, 120, 122, 124, 125, 126, 128, 129, 130, 131, 132, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 142, 143, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 157, 158, 159, 160, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 169, 170, 171, 171, 172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 178, 179, 179, 180, 181, 181, 182, 183, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 190, 191, 192, 193, 193, 194, 194, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 204, 205, 206, 207, 208, 208, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 222, 223, 224, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 };
int[] arrayOfInt2 = { 0, 1, 2, 3, 4, 5, 6, 7, 9, 9, 10, 12, 12, 13, 14, 16, 16, 17, 19, 20, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 37, 39, 40, 41, 42, 43, 44, 46, 47, 49, 50, 51, 53, 54, 56, 57, 59, 61, 62, 64, 65, 66, 69, 70, 72, 73, 76, 77, 78, 80, 82, 84, 85, 87, 89, 90, 93, 94, 95, 98, 99, 100, 103, 104, 106, 108, 109, 111, 112, 114, 116, 117, 118, 120, 122, 123, 124, 125, 126, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 178, 178, 179, 179, 180, 181, 181, 182, 182, 183, 184, 184, 185, 185, 186, 187, 187, 188, 188, 189, 190, 190, 191, 191, 192, 193, 193, 194, 194, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 202, 202, 203, 204, 204, 205, 206, 207, 208, 208, 208, 209, 210, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 221, 222, 222, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 };
int[] arrayOfInt3 = { 0, 1, 2, 3, 4, 5, 5, 7, 8, 9, 9, 11, 12, 12, 13, 14, 16, 16, 17, 18, 20, 20, 21, 22, 23, 25, 25, 26, 27, 29, 30, 31, 31, 32, 34, 35, 36, 37, 39, 40, 41, 41, 42, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 56, 57, 59, 60, 61, 63, 64, 65, 66, 67, 69, 71, 72, 73, 74, 76, 78, 79, 80, 82, 83, 84, 85, 88, 89, 90, 92, 93, 94, 95, 98, 99, 100, 102, 103, 104, 106, 107, 108, 111, 112, 113, 114, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 147, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 165, 166, 166, 167, 168, 169, 169, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 178, 178, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 194, 194, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 235, 236, 237, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 };
int[] arrayOfInt4 = { 0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 14, 16, 17, 19, 20, 21, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36, 38, 39, 40, 42, 43, 44, 45, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 60, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 230, 231, 232, 233, 234, 235, 235, 236, 237, 238, 239, 239, 240, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 };
for (int i = 0; i < 256; i++)
{
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);
arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);
}
int[] arrayOfInt5 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int j = 0; j < 256; j++)
{
arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);
arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);
arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);
arrayOfByte[(3 + (1024 + j * 4))] = -1;
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
mMaskGrey1TextureId = OpenGLUtils.loadTexture(getContext(), "filter/rise_mask1.jpg");
mMaskGrey2TextureId = OpenGLUtils.loadTexture(getContext(), "filter/rise_mask2.jpg");
}
});
}
}

@ -1,68 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicSutroFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1,-1,-1,-1,-1};
private int[] inputTextureUniformLocations = {-1,-1,-1,-1,-1};
private int mGLStrengthLocation;
public MagicSutroFilter(){
super(MagicFilterType.SUTRO, R.raw.sutro);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for (int i = 0; i < inputTextureHandles.length; i++) {
inputTextureHandles[i] = -1;
}
}
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit() {
super.onInit();
for(int i = 0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized() {
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/vignette_map.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/sutrometal.png");
inputTextureHandles[2] = OpenGLUtils.loadTexture(getContext(), "filter/softlight.png");
inputTextureHandles[3] = OpenGLUtils.loadTexture(getContext(), "filter/sutroedgeburn.png");
inputTextureHandles[4] = OpenGLUtils.loadTexture(getContext(), "filter/sutrocurves.png");
}
});
}
}

@ -1,96 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
import java.nio.ByteBuffer;
public class MagicSweetsFilter extends GPUImageFilter {
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
private int mMaskGrey1TextureId = -1;
private int mMaskGrey1UniformLocation;
private int mLowPerformanceUniformLocation;
public MagicSweetsFilter(){
super(MagicFilterType.SWEETS, R.raw.sweets);
}
@Override
protected void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(2, new int[]{mToneCurveTexture[0], mMaskGrey1TextureId}, 0);
mToneCurveTexture[0] = -1;
mMaskGrey1TextureId = -1;
}
@Override
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);
GLES20.glUniform1i(mMaskGrey1UniformLocation, 4);
}
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), "grey1Frame");
mLowPerformanceUniformLocation = GLES20.glGetUniformLocation(getProgram(), "lowPerformance");
setInteger(mLowPerformanceUniformLocation, 1);
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[1024];
int[] arrayOfInt = { 0, 1, 2, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 29, 30, 30, 31, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 84, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 98, 99, 100, 101, 103, 104, 105, 106, 108, 109, 110, 111, 113, 114, 115, 116, 118, 119, 120, 121, 123, 124, 125, 126, 128, 129, 130, 132, 133, 134, 135, 137, 138, 139, 140, 142, 143, 144, 145, 147, 148, 149, 150, 152, 153, 154, 155, 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 176, 177, 178, 179, 180, 181, 182, 183, 184, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, 217, 218, 219, 220, 221, 222, 222, 223, 224, 225, 226, 227, 227, 228, 229, 230, 230, 231, 232, 233, 234, 234, 235, 236, 237, 237, 238, 239, 240, 240, 241, 242, 243, 243, 244, 245, 246, 246, 247, 248, 248, 249, 250, 251, 251, 252, 253, 254, 254, 255 };
for (int i = 0; i < 256; i++){
arrayOfByte[(i * 4)] = ((byte)arrayOfInt[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt[i]);
arrayOfByte[(3 + i * 4)] = ((byte)i);
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
mMaskGrey1TextureId = OpenGLUtils.loadTexture(getContext(), "filter/rise_mask2.jpg");
}
});
}
}

@ -1,96 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
import java.nio.ByteBuffer;
public class MagicTenderFilter extends GPUImageFilter{
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
private int mMaskGrey1TextureId = -1;
private int mMaskGrey1UniformLocation;
public MagicTenderFilter(){
super(MagicFilterType.TENDER, R.raw.tender);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(2, new int[]{mToneCurveTexture[0], mMaskGrey1TextureId}, 0);
mToneCurveTexture[0] = -1;
mMaskGrey1TextureId = -1;
}
@Override
protected void onDrawArraysAfter() {
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre() {
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);
GLES20.glUniform1i(mMaskGrey1UniformLocation, 4);
}
}
@Override
protected void onInit() {
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), "grey1Frame");
}
@Override
protected void onInitialized() {
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[1024];
int[] arrayOfInt1 = { 10, 12, 14, 15, 17, 19, 21, 22, 24, 26, 28, 29, 31, 33, 35, 38, 40, 41, 43, 45, 47, 48, 50, 52, 53, 55, 57, 58, 60, 61, 63, 65, 66, 68, 69, 71, 72, 74, 75, 77, 79, 80, 81, 83, 84, 86, 87, 89, 92, 93, 94, 96, 97, 99, 100, 101, 103, 104, 105, 107, 108, 109, 110, 112, 113, 114, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 133, 134, 135, 136, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 184, 185, 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 196, 197, 198, 198, 199, 200, 200, 201, 201, 202, 202, 203, 204, 204, 205, 205, 206, 206, 207, 207, 208, 209, 209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215, 215, 216, 216, 216, 217, 217, 218, 218, 219, 219, 219, 220, 220, 221, 221, 222, 222, 223, 223, 224, 224, 224, 225, 225, 226, 226, 227, 227, 227, 228, 228, 229, 229, 230, 230, 230, 231, 231, 232, 232, 232, 233, 233, 234, 234, 234, 234, 235, 235, 236, 236, 236, 237, 237, 238, 238, 238, 239, 239, 240, 240, 240, 241, 241, 242, 242 };
int[] arrayOfInt2 = { 10, 12, 14, 15, 17, 19, 19, 21, 22, 24, 26, 28, 29, 31, 33, 35, 36, 36, 38, 40, 41, 43, 45, 47, 48, 50, 52, 52, 53, 55, 57, 58, 60, 61, 63, 65, 66, 68, 69, 69, 71, 72, 74, 75, 77, 79, 80, 81, 83, 84, 86, 86, 87, 89, 90, 92, 93, 94, 96, 97, 99, 100, 101, 103, 103, 104, 105, 107, 108, 109, 110, 112, 113, 114, 116, 117, 118, 119, 120, 122, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 133, 134, 135, 136, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 184, 185, 186, 187, 187, 188, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 196, 197, 198, 198, 199, 200, 200, 201, 201, 202, 202, 204, 204, 205, 205, 206, 206, 207, 207, 208, 209, 209, 210, 210, 211, 211, 212, 213, 213, 214, 214, 215, 215, 216, 216, 217, 217, 218, 218, 219, 219, 220, 220, 221, 221, 222, 222, 223, 223, 224, 224, 224, 225, 226, 226, 227, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 232, 233, 233, 234, 234, 234, 235, 236, 236, 236, 237, 237, 238, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242 };
int[] arrayOfInt3 = { 10, 12, 12, 14, 15, 15, 17, 17, 19, 21, 21, 22, 24, 24, 26, 28, 28, 29, 31, 31, 33, 33, 35, 36, 36, 38, 40, 40, 41, 43, 43, 45, 47, 47, 48, 50, 52, 52, 53, 55, 55, 57, 58, 58, 60, 61, 63, 63, 65, 66, 68, 68, 69, 71, 71, 72, 74, 75, 77, 77, 79, 80, 81, 81, 83, 84, 86, 87, 87, 89, 90, 92, 93, 94, 94, 96, 97, 99, 100, 101, 103, 103, 104, 105, 107, 108, 109, 110, 112, 113, 113, 114, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 129, 130, 130, 131, 132, 133, 134, 135, 136, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 164, 165, 166, 166, 167, 169, 170, 171, 171, 172, 173, 174, 175, 175, 176, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 187, 188, 189, 190, 191, 191, 192, 193, 193, 195, 195, 196, 196, 197, 198, 199, 200, 200, 201, 201, 202, 203, 204, 204, 205, 206, 206, 207, 207, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 220, 221, 222, 222, 223, 223, 224, 224, 225, 225, 226, 227, 227, 227, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 238, 238, 238, 239, 240, 240, 240, 241, 242, 242 };
int[] arrayOfInt4 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int i = 0; i < 256; i++){
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);
arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
mMaskGrey1TextureId = OpenGLUtils.loadTexture(getContext(), "filter/bluevintage_mask1.jpg");
}
});
}
}

@ -1,70 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicToasterFilter extends GPUImageFilter{
private int[] inputTextureHandles = {-1,-1,-1,-1,-1};
private int[] inputTextureUniformLocations = {-1,-1,-1,-1,-1};
private int mGLStrengthLocation;
public MagicToasterFilter(){
super(MagicFilterType.TOASTER2, R.raw.toaster2_filter_shader);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++)
inputTextureHandles[i] = -1;
}
@Override
protected void onDrawArraysAfter() {
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre() {
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
protected void onInit() {
super.onInit();
for(int i = 0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
protected void onInitialized() {
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/toastermetal.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/toastersoftlight.png");
inputTextureHandles[2] = OpenGLUtils.loadTexture(getContext(), "filter/toastercurves.png");
inputTextureHandles[3] = OpenGLUtils.loadTexture(getContext(), "filter/toasteroverlaymapwarm.png");
inputTextureHandles[4] = OpenGLUtils.loadTexture(getContext(), "filter/toastercolorshift.png");
}
});
}
}

@ -1,68 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicValenciaFilter extends GPUImageFilter{
private int[] inputTextureHandles = {-1,-1};
private int[] inputTextureUniformLocations = {-1,-1};
private int mGLStrengthLocation;
public MagicValenciaFilter(){
super(MagicFilterType.VALENCIA, R.raw.valencia);
}
@Override
protected void onDrawArraysAfter() {
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre() {
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
public void onInit() {
super.onInit();
for(int i = 0; i < inputTextureUniformLocations.length; i++) {
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture" + (2 + i));
}
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
public void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++) {
inputTextureHandles[i] = -1;
}
}
@Override
public void onInitialized() {
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/valenciamap.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/valenciagradientmap.png");
}
});
}
}

@ -1,66 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicWaldenFilter extends GPUImageFilter {
private int[] inputTextureHandles = {-1,-1};
private int[] inputTextureUniformLocations = {-1,-1};
private int mGLStrengthLocation;
public MagicWaldenFilter(){
super(MagicFilterType.WALDEN, R.raw.walden);
}
@Override
protected void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++)
inputTextureHandles[i] = -1;
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length && inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));
}
}
@Override
public void onInit(){
super.onInit();
for(int i = 0; i < inputTextureUniformLocations.length; i++)
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture"+(2+i));
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
public void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/walden_map.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/vignette_map.png");
}
});
}
}

@ -1,118 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicWarmFilter extends GPUImageFilter {
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
private int mMaskGrey1TextureId = -1;
private int mMaskGrey1UniformLocation;
private int mMaskGrey2TextureId = -1;
private int mMaskGrey2UniformLocation;
public MagicWarmFilter(){
super(MagicFilterType.WARM, R.raw.warm);
}
@Override
public void onDestroy(){
super.onDestroy();
GLES20.glDeleteTextures(3, new int[]{mToneCurveTexture[0], mMaskGrey1TextureId, mMaskGrey2TextureId}, 0);
mToneCurveTexture[0] = -1;
mMaskGrey1TextureId = -1;
mMaskGrey2TextureId = -1;
}
@Override
protected void onDrawArraysAfter(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
if (mMaskGrey2TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE5);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
if (mMaskGrey1TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE4);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);
GLES20.glUniform1i(mMaskGrey1UniformLocation, 4);
}
if (mMaskGrey2TextureId != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE5);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey2TextureId);
GLES20.glUniform1i(mMaskGrey2UniformLocation, 5);
}
}
@Override
protected void onInit(){
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), "layerImage");
mMaskGrey2UniformLocation = GLES20.glGetUniformLocation(getProgram(), "greyFrame");
}
@Override
protected void onInitialized(){
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[2048];
int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 9, 12, 14, 17, 20, 23, 25, 28, 31, 33, 35, 38, 40, 42, 44, 46, 48, 50, 52, 53, 55, 57, 58, 60, 61, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 85, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 96, 96, 97, 98, 99, 99, 100, 101, 102, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 119, 120, 121, 123, 124, 126, 127, 128, 130, 131, 133, 135, 136, 138, 139, 141, 143, 144, 146, 148, 149, 151, 153, 154, 156, 158, 159, 161, 163, 165, 166, 168, 170, 172, 173, 175, 177, 179, 180, 182, 184, 185, 187, 189, 190, 192, 194, 195, 197, 199, 200, 202, 203, 205, 207, 208, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 223, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 238, 239, 240, 241, 241, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 249, 249, 249, 250, 250, 250, 251, 251, 251, 251, 252, 252, 252, 252, 253, 253, 253, 253, 253, 253, 254, 254, 254, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt2 = { 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91, 92, 93, 94, 95, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 235, 236, 237, 238, 239, 240, 241, 242 };
int[] arrayOfInt3 = { 9, 10, 11, 11, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 50, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 60, 61, 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 71, 71, 72, 73, 74, 75, 76, 76, 77, 78, 79, 80, 81, 81, 82, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91, 92, 93, 93, 94, 95, 96, 97, 98, 98, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 116, 116, 117, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 136, 137, 137, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 160, 161, 162, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 225, 226, 227, 228, 229, 230 };
int[] arrayOfInt4 = { 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 33, 34, 35, 37, 38, 40, 41, 42, 44, 45, 47, 48, 50, 51, 53, 54, 56, 58, 59, 61, 62, 64, 65, 67, 69, 70, 72, 73, 75, 77, 78, 80, 82, 83, 85, 86, 88, 90, 91, 93, 94, 96, 98, 99, 101, 102, 104, 105, 107, 108, 110, 111, 113, 114, 116, 117, 119, 120, 122, 123, 124, 126, 127, 129, 130, 131, 133, 134, 136, 137, 138, 140, 141, 142, 144, 145, 146, 147, 149, 150, 151, 153, 154, 155, 156, 157, 159, 160, 161, 162, 163, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 216, 217, 218, 218, 219, 220, 221, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 228, 229, 230, 230, 231, 231, 232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 249, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255 };
for (int i = 0; i < 256; i++){
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);
arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);
}
int[] arrayOfInt5 = { 0, 1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 11, 11, 11, 12, 13, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 22, 23, 24, 24, 25, 26, 27, 28, 28, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 39, 40, 41, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 61, 62, 63, 63, 64, 65, 66, 68, 69, 70, 71, 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 88, 89, 90, 92, 93, 94, 95, 95, 97, 98, 99, 100, 102, 103, 104, 105, 106, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 133, 134, 135, 137, 138, 139, 141, 142, 143, 144, 145, 146, 148, 149, 150, 151, 152, 154, 155, 156, 157, 158, 159, 161, 162, 164, 165, 166, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 179, 180, 183, 184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 212, 213, 214, 215, 216, 217, 219, 220, 221, 222, 223, 224, 226, 227, 228, 229, 230, 231, 233, 234, 235, 236, 237, 239, 240, 241, 242, 243, 243, 244, 246, 247, 248, 249, 250, 251, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 69, 70, 71, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 154, 155, 156, 157, 158, 159, 161, 162, 164, 165, 166, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 179, 180, 182, 183, 184, 185, 186, 187, 190, 191, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 212, 213, 214, 215, 216, 217, 220, 221, 222, 223, 224, 226, 227, 228, 229, 230, 231, 233, 234, 235, 236, 237, 239, 240, 241, 242, 243, 244, 246, 247, 249, 250, 251, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt7 = { 45, 45, 46, 46, 47, 47, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 69, 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 74, 75, 75, 76, 76, 77, 78, 78, 79, 79, 80, 80, 80, 81, 82, 82, 83, 84, 84, 85, 86, 87, 87, 88, 89, 89, 90, 91, 92, 92, 93, 94, 95, 95, 95, 96, 97, 98, 98, 99, 100, 101, 102, 103, 103, 104, 105, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 141, 142, 143, 144, 146, 147, 148, 149, 150, 151, 152, 154, 156, 157, 158, 159, 160, 161, 162, 165, 166, 167, 168, 169, 170, 171, 173, 175, 176, 177, 178, 179, 180, 182, 183, 184, 186, 187, 188, 190, 191, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 212, 213, 214, 215, 216, 217, 217, 219, 220, 221, 222, 223, 224, 226, 227, 227, 228, 229, 230, 231, 233, 234, 235, 235, 236, 237, 239, 240, 241, 241, 242, 243, 244, 246, 246, 247, 248, 249, 250, 251, 251, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt8 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int j = 0; j < 256; j++){
arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);
arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt6[j]);
arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt7[j]);
arrayOfByte[(3 + (1024 + j * 4))] = ((byte)arrayOfInt8[j]);
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
}
});
}
}

@ -1,88 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import java.nio.ByteBuffer;
public class MagicWhiteCatFilter extends GPUImageFilter{
private int[] mToneCurveTexture = {-1};
private int mToneCurveTextureUniformLocation;
public MagicWhiteCatFilter() {
super(MagicFilterType.WHITECAT, R.raw.whitecat);
}
@Override
public void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
mToneCurveTexture[0] = -1;
}
@Override
protected void onDrawArraysAfter() {
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre() {
if (mToneCurveTexture[0] != -1){
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);
}
}
@Override
public void onInit() {
super.onInit();
mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), "curve");
}
@Override
public void onInitialized() {
super.onInitialized();
runOnDraw(new Runnable(){
public void run(){
GLES20.glGenTextures(1, mToneCurveTexture, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
byte[] arrayOfByte = new byte[2048];
int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 249, 250, 251, 252, 253, 254, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt2 = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 4, 5, 6, 7, 8, 10, 11, 12, 12, 13, 14, 16, 17, 18, 19, 19, 20, 22, 23, 24, 25, 26, 26, 28, 29, 30, 31, 32, 33, 35, 35, 36, 37, 38, 39, 41, 42, 42, 43, 44, 45, 46, 48, 49, 50, 50, 51, 52, 54, 55, 56, 57, 58, 58, 59, 61, 62, 63, 64, 65, 66, 66, 67, 69, 70, 71, 72, 73, 74, 75, 75, 77, 78, 79, 80, 81, 82, 83, 85, 85, 86, 87, 88, 89, 90, 91, 92, 93, 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 103, 104, 105, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 236, 237, 238, 239, 240, 240 };
for (int i = 0; i < 256; i++){
arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt1[i]);
arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt2[i]);
arrayOfByte[(3 + i * 4)] = -1;
}
int[] arrayOfInt3 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 9, 14, 17, 19, 22, 25, 27, 30, 34, 36, 39, 41, 43, 45, 49, 51, 52, 54, 55, 57, 58, 61, 63, 64, 65, 67, 68, 69, 72, 73, 75, 76, 77, 78, 81, 82, 83, 84, 86, 87, 88, 90, 91, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 105, 106, 108, 109, 110, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 123, 124, 125, 126, 126, 127, 128, 130, 131, 132, 133, 134, 135, 136, 138, 138, 139, 140, 141, 142, 144, 145, 146, 146, 147, 148, 149, 151, 152, 153, 153, 154, 155, 156, 158, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 168, 170, 171, 172, 172, 173, 174, 175, 176, 177, 178, 179, 180, 180, 181, 183, 183, 184, 185, 186, 186, 188, 189, 190, 190, 191, 192, 193, 194, 195, 196, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204, 204, 206, 207, 207, 208, 209, 209, 211, 212, 212, 213, 214, 214, 215, 217, 217, 218, 219, 219, 220, 221, 222, 223, 224, 224, 225, 226, 227, 228, 228, 229, 230, 230, 231, 233, 233, 234, 235, 235, 236, 237, 238, 239, 239, 240, 241, 241, 242, 243, 244, 245, 245, 246, 247, 248, 249, 249, 250, 250, 251, 252, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
int[] arrayOfInt4 = { 0, 2, 4, 6, 8, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 32, 34, 36, 38, 40, 42, 44, 46, 47, 49, 51, 53, 54, 56, 58, 60, 61, 63, 65, 66, 68, 70, 71, 73, 74, 76, 77, 79, 80, 82, 83, 85, 86, 88, 89, 91, 92, 93, 95, 96, 98, 99, 100, 101, 103, 104, 105, 107, 108, 109, 110, 111, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 216, 217, 218, 219, 219, 220, 221, 222, 222, 223, 224, 224, 225, 226, 226, 227, 228, 228, 229, 230, 230, 231, 232, 232, 233, 233, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 245, 246, 246, 247, 247, 247, 248, 248, 248, 249, 249, 249, 250, 250, 250, 251, 251, 251, 252, 252, 252, 252, 253, 253, 253, 253, 254, 254, 254, 254, 254, 255, 255, 255 };
int[] arrayOfInt5 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };
for (int j = 0; j < 256; j++){
arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt4[j]);
arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt3[j]);
arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);
arrayOfByte[(3 + (1024 + j * 4))] = -1;
}
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));
}
});
}
}

@ -1,66 +0,0 @@
package com.seu.magicfilter.advanced;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicXproIIFilter extends GPUImageFilter{
private int[] inputTextureHandles = {-1,-1};
private int[] inputTextureUniformLocations = {-1,-1};
private int mGLStrengthLocation;
public MagicXproIIFilter(){
super(MagicFilterType.XPROII, R.raw.xproii_filter_shader);
}
@Override
public void onDestroy() {
super.onDestroy();
GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);
for(int i = 0; i < inputTextureHandles.length; i++)
inputTextureHandles[i] = -1;
}
@Override
protected void onDrawArraysAfter(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
@Override
protected void onDrawArraysPre(){
for(int i = 0; i < inputTextureHandles.length
&& inputTextureHandles[i] != OpenGLUtils.NO_TEXTURE; i++){
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);
GLES20.glUniform1i(inputTextureUniformLocations[i], (i + 3));
}
}
@Override
public void onInit(){
super.onInit();
for(int i = 0; i < inputTextureUniformLocations.length; i++)
inputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture"+(2+i));
mGLStrengthLocation = GLES20.glGetUniformLocation(getProgram(), "strength");
}
@Override
public void onInitialized(){
super.onInitialized();
setFloat(mGLStrengthLocation, 1.0f);
runOnDraw(new Runnable(){
public void run(){
inputTextureHandles[0] = OpenGLUtils.loadTexture(getContext(), "filter/xpromap.png");
inputTextureHandles[1] = OpenGLUtils.loadTexture(getContext(), "filter/vignettemap_new.png");
}
});
}
}

@ -1,144 +0,0 @@
package com.seu.magicfilter.base;
import android.content.Context;
import android.opengl.GLES20;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.OpenGLUtils;
import java.nio.FloatBuffer;
import java.util.List;
public class MagicBaseGroupFilter extends GPUImageFilter {
private static int[] frameBuffers = null;
private static int[] frameBufferTextures = null;
private int frameWidth = -1;
private int frameHeight = -1;
protected List<GPUImageFilter> filters;
public MagicBaseGroupFilter(List<GPUImageFilter> filters) {
this.filters = filters;
}
@Override
public void onDestroy() {
for (GPUImageFilter filter : filters) {
filter.destroy();
}
destroyFramebuffers();
}
@Override
public void init(Context context) {
for (GPUImageFilter filter : filters) {
filter.init(context);
}
}
@Override
public void onInputSizeChanged(final int width, final int height) {
super.onInputSizeChanged(width, height);
int size = filters.size();
for (int i = 0; i < size; i++) {
filters.get(i).onInputSizeChanged(width, height);
}
if (frameBuffers != null && (frameWidth != width || frameHeight != height || frameBuffers.length != size - 1)) {
destroyFramebuffers();
frameWidth = width;
frameHeight = height;
}
if (frameBuffers == null) {
frameBuffers = new int[size - 1];
frameBufferTextures = new int[size - 1];
for (int i = 0; i < size - 1; i++) {
GLES20.glGenFramebuffers(1, frameBuffers, i);
GLES20.glGenTextures(1, frameBufferTextures, i);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, frameBufferTextures[i]);
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0,
GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffers[i]);
GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,
GLES20.GL_TEXTURE_2D, frameBufferTextures[i], 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
}
}
}
@Override
public int onDrawFrame(final int textureId, final FloatBuffer cubeBuffer,
final FloatBuffer textureBuffer) {
if (frameBuffers == null || frameBufferTextures == null) {
return OpenGLUtils.NOT_INIT;
}
int size = filters.size();
int previousTexture = textureId;
for (int i = 0; i < size; i++) {
GPUImageFilter filter = filters.get(i);
boolean isNotLast = i < size - 1;
if (isNotLast) {
GLES20.glViewport(0, 0, mInputWidth, mInputHeight);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffers[i]);
GLES20.glClearColor(0, 0, 0, 0);
filter.onDrawFrame(previousTexture, mGLCubeBuffer, mGLTextureBuffer);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
previousTexture = frameBufferTextures[i];
} else {
GLES20.glViewport(0, 0, mOutputWidth, mOutputHeight);
filter.onDrawFrame(previousTexture, cubeBuffer, textureBuffer);
}
}
return OpenGLUtils.ON_DRAWN;
}
public int onDrawFrame(int textureId) {
if (frameBuffers == null || frameBufferTextures == null) {
return OpenGLUtils.NOT_INIT;
}
int size = filters.size();
int previousTexture = textureId;
for (int i = 0; i < size; i++) {
GPUImageFilter filter = filters.get(i);
boolean isNotLast = i < size - 1;
if (isNotLast) {
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffers[i]);
GLES20.glClearColor(0, 0, 0, 0);
filter.onDrawFrame(previousTexture, mGLCubeBuffer, mGLTextureBuffer);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
previousTexture = frameBufferTextures[i];
} else {
filter.onDrawFrame(previousTexture, mGLCubeBuffer, mGLTextureBuffer);
}
}
return OpenGLUtils.ON_DRAWN;
}
private void destroyFramebuffers() {
if (frameBufferTextures != null) {
GLES20.glDeleteTextures(frameBufferTextures.length, frameBufferTextures, 0);
frameBufferTextures = null;
}
if (frameBuffers != null) {
GLES20.glDeleteFramebuffers(frameBuffers.length, frameBuffers, 0);
frameBuffers = null;
}
}
public int getSize() {
return filters.size();
}
}

@ -1,58 +0,0 @@
package com.seu.magicfilter.base;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
public class MagicLookupFilter extends GPUImageFilter {
protected String table;
public MagicLookupFilter(String table) {
super(MagicFilterType.LOCKUP, R.raw.lookup);
this.table = table;
}
private int mLookupTextureUniform;
private int mLookupSourceTexture = OpenGLUtils.NO_TEXTURE;
protected void onInit() {
super.onInit();
mLookupTextureUniform = GLES20.glGetUniformLocation(getProgram(), "inputImageTexture2");
}
protected void onInitialized() {
super.onInitialized();
runOnDraw(new Runnable() {
public void run() {
mLookupSourceTexture = OpenGLUtils.loadTexture(getContext(), table);
}
});
}
protected void onDestroy() {
super.onDestroy();
int[] texture = new int[]{mLookupSourceTexture};
GLES20.glDeleteTextures(1, texture, 0);
mLookupSourceTexture = -1;
}
protected void onDrawArraysAfter() {
if (mLookupSourceTexture != -1) {
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
}
}
protected void onDrawArraysPre() {
if (mLookupSourceTexture != -1) {
GLES20.glActiveTexture(GLES20.GL_TEXTURE3);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mLookupSourceTexture);
GLES20.glUniform1i(mLookupTextureUniform, 3);
}
}
}

@ -1,57 +0,0 @@
/*
* Copyright (C) 2012 CyberAgent
*
* 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.
*/
package com.seu.magicfilter.base.gpuimage;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.utils.MagicFilterType;
/**
* brightness value ranges from -1.0 to 1.0, with 0.0 as the normal level
*/
public class GPUImageBrightnessFilter extends GPUImageFilter {
private int mBrightnessLocation;
private float mBrightness;
public GPUImageBrightnessFilter() {
this(0.0f);
}
public GPUImageBrightnessFilter(final float brightness) {
super(MagicFilterType.BRIGHTNESS, R.raw.brightness);
mBrightness = brightness;
}
@Override
public void onInit() {
super.onInit();
mBrightnessLocation = GLES20.glGetUniformLocation(getProgram(), "brightness");
}
@Override
public void onInitialized() {
super.onInitialized();
setBrightness(mBrightness);
}
public void setBrightness(final float brightness) {
mBrightness = brightness;
setFloat(mBrightnessLocation, mBrightness);
}
}

@ -1,60 +0,0 @@
/*
* Copyright (C) 2012 CyberAgent
*
* 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.
*/
package com.seu.magicfilter.base.gpuimage;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.utils.MagicFilterType;
/**
* Changes the contrast of the image.<br>
* <br>
* contrast value ranges from 0.0 to 4.0, with 1.0 as the normal level
*/
public class GPUImageContrastFilter extends GPUImageFilter {
private int mContrastLocation;
private float mContrast;
public GPUImageContrastFilter() {
this(1.0f);
}
public GPUImageContrastFilter(float contrast) {
super(MagicFilterType.CONTRAST, R.raw.constrast);
mContrast = contrast;
}
@Override
public void onInit() {
super.onInit();
mContrastLocation = GLES20.glGetUniformLocation(getProgram(), "contrast");
}
@Override
public void onInitialized() {
super.onInitialized();
setContrast(mContrast);
}
public void setContrast(final float contrast) {
mContrast = contrast;
setFloat(mContrastLocation, mContrast);
}
}

@ -1,69 +0,0 @@
/*
* Copyright (C) 2012 CyberAgent
*
* 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.
*/
package com.seu.magicfilter.base.gpuimage;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.utils.MagicFilterType;
/**
* exposure: The adjusted exposure (-10.0 - 10.0, with 0.0 as the default)
*/
public class GPUImageExposureFilter extends GPUImageFilter {
public static final String EXPOSURE_FRAGMENT_SHADER = "" +
" varying highp vec2 textureCoordinate;\n" +
" \n" +
" uniform sampler2D inputImageTexture;\n" +
" uniform highp float exposure;\n" +
" \n" +
" void main()\n" +
" {\n" +
" highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" +
" \n" +
" gl_FragColor = vec4(textureColor.rgb * pow(2.0, exposure), textureColor.w);\n" +
" } ";
private int mExposureLocation;
private float mExposure;
public GPUImageExposureFilter() {
this(0.0f);
}
public GPUImageExposureFilter(final float exposure) {
super(MagicFilterType.EXPOSURE, R.raw.exposure);
mExposure = exposure;
}
@Override
public void onInit() {
super.onInit();
mExposureLocation = GLES20.glGetUniformLocation(getProgram(), "exposure");
}
@Override
public void onInitialized() {
super.onInitialized();
setExposure(mExposure);
}
public void setExposure(final float exposure) {
mExposure = exposure;
setFloat(mExposureLocation, mExposure);
}
}

@ -1,404 +0,0 @@
/*
* Copyright (C) 2012 CyberAgent
*
* 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.
*/
package com.seu.magicfilter.base.gpuimage;
import android.content.Context;
import android.graphics.PointF;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.utils.MagicFilterType;
import com.seu.magicfilter.utils.OpenGLUtils;
import com.seu.magicfilter.utils.Rotation;
import com.seu.magicfilter.utils.TextureRotationUtil;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.LinkedList;
public class GPUImageFilter {
private boolean mIsInitialized;
private Context mContext;
private MagicFilterType mType = MagicFilterType.NONE;
private final LinkedList<Runnable> mRunOnDraw;
private final int mVertexShaderId;
private final int mFragmentShaderId;
private int mGLProgId;
private int mGLPositionIndex;
private int mGLInputImageTextureIndex;
private int mGLTextureCoordinateIndex;
private int mGLTextureTransformIndex;
protected int mInputWidth;
protected int mInputHeight;
protected int mOutputWidth;
protected int mOutputHeight;
protected FloatBuffer mGLCubeBuffer;
protected FloatBuffer mGLTextureBuffer;
private int[] mGLCubeId;
private int[] mGLTextureCoordinateId;
private float[] mGLTextureTransformMatrix;
private int[] mGLFboId;
private int[] mGLFboTexId;
private IntBuffer mGLFboBuffer;
public GPUImageFilter() {
this(MagicFilterType.NONE);
}
public GPUImageFilter(MagicFilterType type) {
this(type, R.raw.vertex, R.raw.fragment);
}
public GPUImageFilter(MagicFilterType type, int fragmentShaderId) {
this(type, R.raw.vertex, fragmentShaderId);
}
public GPUImageFilter(MagicFilterType type, int vertexShaderId, int fragmentShaderId) {
mType = type;
mRunOnDraw = new LinkedList<>();
mVertexShaderId = vertexShaderId;
mFragmentShaderId = fragmentShaderId;
mGLCubeBuffer = ByteBuffer.allocateDirect(TextureRotationUtil.CUBE.length * 4)
.order(ByteOrder.nativeOrder())
.asFloatBuffer();
mGLCubeBuffer.put(TextureRotationUtil.CUBE).position(0);
mGLTextureBuffer = ByteBuffer.allocateDirect(TextureRotationUtil.TEXTURE_NO_ROTATION.length * 4)
.order(ByteOrder.nativeOrder())
.asFloatBuffer();
mGLTextureBuffer.put(TextureRotationUtil.getRotation(Rotation.NORMAL, false, true)).position(0);
}
public void init(Context context) {
mContext = context;
onInit();
onInitialized();
}
protected void onInit() {
initVbo();
loadSamplerShader();
}
protected void onInitialized() {
mIsInitialized = true;
}
public final void destroy() {
mIsInitialized = false;
destroyFboTexture();
destoryVbo();
GLES20.glDeleteProgram(mGLProgId);
onDestroy();
}
protected void onDestroy() {
}
public void onInputSizeChanged(final int width, final int height) {
mInputWidth = width;
mInputHeight = height;
initFboTexture(width, height);
}
public void onDisplaySizeChanged(final int width, final int height) {
mOutputWidth = width;
mOutputHeight = height;
}
private void loadSamplerShader() {
mGLProgId = OpenGLUtils.loadProgram(OpenGLUtils.readShaderFromRawResource(getContext(), mVertexShaderId),
OpenGLUtils.readShaderFromRawResource(getContext(), mFragmentShaderId));
mGLPositionIndex = GLES20.glGetAttribLocation(mGLProgId, "position");
mGLTextureCoordinateIndex = GLES20.glGetAttribLocation(mGLProgId,"inputTextureCoordinate");
mGLTextureTransformIndex = GLES20.glGetUniformLocation(mGLProgId, "textureTransform");
mGLInputImageTextureIndex = GLES20.glGetUniformLocation(mGLProgId, "inputImageTexture");
}
private void initVbo() {
mGLCubeId = new int[1];
mGLTextureCoordinateId = new int[1];
GLES20.glGenBuffers(1, mGLCubeId, 0);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mGLCubeId[0]);
GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, mGLCubeBuffer.capacity() * 4, mGLCubeBuffer, GLES20.GL_STATIC_DRAW);
GLES20.glGenBuffers(1, mGLTextureCoordinateId, 0);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mGLTextureCoordinateId[0]);
GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, mGLTextureBuffer.capacity() * 4, mGLTextureBuffer, GLES20.GL_STATIC_DRAW);
}
private void destoryVbo() {
if (mGLCubeId != null) {
GLES20.glDeleteBuffers(1, mGLCubeId, 0);
mGLCubeId = null;
}
if (mGLTextureCoordinateId != null) {
GLES20.glDeleteBuffers(1, mGLTextureCoordinateId, 0);
mGLTextureCoordinateId = null;
}
}
private void initFboTexture(int width, int height) {
if (mGLFboId != null && (mInputWidth != width || mInputHeight != height)) {
destroyFboTexture();
}
mGLFboId = new int[1];
mGLFboTexId = new int[1];
mGLFboBuffer = IntBuffer.allocate(width * height);
GLES20.glGenFramebuffers(1, mGLFboId, 0);
GLES20.glGenTextures(1, mGLFboTexId, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mGLFboTexId[0]);
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mGLFboId[0]);
GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, mGLFboTexId[0], 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
}
private void destroyFboTexture() {
if (mGLFboTexId != null) {
GLES20.glDeleteTextures(1, mGLFboTexId, 0);
mGLFboTexId = null;
}
if (mGLFboId != null) {
GLES20.glDeleteFramebuffers(1, mGLFboId, 0);
mGLFboId = null;
}
}
public int onDrawFrame(final int textureId, final FloatBuffer cubeBuffer, final FloatBuffer textureBuffer) {
if (!mIsInitialized) {
return OpenGLUtils.NOT_INIT;
}
GLES20.glUseProgram(mGLProgId);
runPendingOnDrawTasks();
GLES20.glEnableVertexAttribArray(mGLPositionIndex);
GLES20.glVertexAttribPointer(mGLPositionIndex, 2, GLES20.GL_FLOAT, false, 4 * 2, cubeBuffer);
GLES20.glEnableVertexAttribArray(mGLTextureCoordinateIndex);
GLES20.glVertexAttribPointer(mGLTextureCoordinateIndex, 2, GLES20.GL_FLOAT, false, 4 * 2, textureBuffer);
if (textureId != OpenGLUtils.NO_TEXTURE) {
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);
GLES20.glUniform1i(mGLInputImageTextureIndex, 0);
}
onDrawArraysPre();
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
onDrawArraysAfter();
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glDisableVertexAttribArray(mGLPositionIndex);
GLES20.glDisableVertexAttribArray(mGLTextureCoordinateIndex);
return OpenGLUtils.ON_DRAWN;
}
public int onDrawFrame(int cameraTextureId) {
if (!mIsInitialized) {
return OpenGLUtils.NOT_INIT;
}
if (mGLFboId == null) {
return OpenGLUtils.NO_TEXTURE;
}
GLES20.glUseProgram(mGLProgId);
runPendingOnDrawTasks();
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mGLCubeId[0]);
GLES20.glEnableVertexAttribArray(mGLPositionIndex);
GLES20.glVertexAttribPointer(mGLPositionIndex, 2, GLES20.GL_FLOAT, false, 4 * 2, 0);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mGLTextureCoordinateId[0]);
GLES20.glEnableVertexAttribArray(mGLTextureCoordinateIndex);
GLES20.glVertexAttribPointer(mGLTextureCoordinateIndex, 2, GLES20.GL_FLOAT, false, 4 * 2, 0);
GLES20.glUniformMatrix4fv(mGLTextureTransformIndex, 1, false, mGLTextureTransformMatrix, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, cameraTextureId);
GLES20.glUniform1i(mGLInputImageTextureIndex, 0);
onDrawArraysPre();
GLES20.glViewport(0, 0, mInputWidth, mInputHeight);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mGLFboId[0]);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
GLES20.glReadPixels(0, 0, mInputWidth, mInputHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, mGLFboBuffer);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
GLES20.glViewport(0, 0, mOutputWidth, mOutputHeight);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
onDrawArraysAfter();
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0);
GLES20.glDisableVertexAttribArray(mGLPositionIndex);
GLES20.glDisableVertexAttribArray(mGLTextureCoordinateIndex);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
return mGLFboTexId[0];
}
protected void onDrawArraysPre() {}
protected void onDrawArraysAfter() {}
private void runPendingOnDrawTasks() {
while (!mRunOnDraw.isEmpty()) {
mRunOnDraw.removeFirst().run();
}
}
public int getProgram() {
return mGLProgId;
}
public IntBuffer getGLFboBuffer() {
return mGLFboBuffer;
}
protected Context getContext() {
return mContext;
}
protected MagicFilterType getFilterType() {
return mType;
}
public void setTextureTransformMatrix(float[] mtx){
mGLTextureTransformMatrix = mtx;
}
protected void setInteger(final int location, final int intValue) {
runOnDraw(new Runnable() {
@Override
public void run() {
GLES20.glUniform1i(location, intValue);
}
});
}
protected void setFloat(final int location, final float floatValue) {
runOnDraw(new Runnable() {
@Override
public void run() {
GLES20.glUniform1f(location, floatValue);
}
});
}
protected void setFloatVec2(final int location, final float[] arrayValue) {
runOnDraw(new Runnable() {
@Override
public void run() {
GLES20.glUniform2fv(location, 1, FloatBuffer.wrap(arrayValue));
}
});
}
protected void setFloatVec3(final int location, final float[] arrayValue) {
runOnDraw(new Runnable() {
@Override
public void run() {
GLES20.glUniform3fv(location, 1, FloatBuffer.wrap(arrayValue));
}
});
}
protected void setFloatVec4(final int location, final float[] arrayValue) {
runOnDraw(new Runnable() {
@Override
public void run() {
GLES20.glUniform4fv(location, 1, FloatBuffer.wrap(arrayValue));
}
});
}
protected void setFloatArray(final int location, final float[] arrayValue) {
runOnDraw(new Runnable() {
@Override
public void run() {
GLES20.glUniform1fv(location, arrayValue.length, FloatBuffer.wrap(arrayValue));
}
});
}
protected void setPoint(final int location, final PointF point) {
runOnDraw(new Runnable() {
@Override
public void run() {
float[] vec2 = new float[2];
vec2[0] = point.x;
vec2[1] = point.y;
GLES20.glUniform2fv(location, 1, vec2, 0);
}
});
}
protected void setUniformMatrix3f(final int location, final float[] matrix) {
runOnDraw(new Runnable() {
@Override
public void run() {
GLES20.glUniformMatrix3fv(location, 1, false, matrix, 0);
}
});
}
protected void setUniformMatrix4f(final int location, final float[] matrix) {
runOnDraw(new Runnable() {
@Override
public void run() {
GLES20.glUniformMatrix4fv(location, 1, false, matrix, 0);
}
});
}
protected void runOnDraw(final Runnable runnable) {
synchronized (mRunOnDraw) {
mRunOnDraw.addLast(runnable);
}
}
}

@ -1,55 +0,0 @@
/*
* Copyright (C) 2012 CyberAgent
*
* 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.
*/
package com.seu.magicfilter.base.gpuimage;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.utils.MagicFilterType;
public class GPUImageHueFilter extends GPUImageFilter {
private float mHue;
private int mHueLocation;
public GPUImageHueFilter() {
this(0.0f);
}
public GPUImageHueFilter(final float hue) {
super(MagicFilterType.HUE, R.raw.hue);
mHue = hue;
}
@Override
public void onInit() {
super.onInit();
mHueLocation = GLES20.glGetUniformLocation(getProgram(), "hueAdjust");
}
@Override
public void onInitialized() {
super.onInitialized();
setHue(mHue);
}
public void setHue(final float hue) {
mHue = hue;
float hueAdjust = (mHue % 360.0f) * (float) Math.PI / 180.0f;
setFloat(mHueLocation, hueAdjust);
}
}

@ -1,57 +0,0 @@
/*
* Copyright (C) 2012 CyberAgent
*
* 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.
*/
package com.seu.magicfilter.base.gpuimage;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.utils.MagicFilterType;
/**
* saturation: The degree of saturation or desaturation to apply to the image (0.0 - 2.0, with 1.0 as the default)
*/
public class GPUImageSaturationFilter extends GPUImageFilter {
private int mSaturationLocation;
private float mSaturation;
public GPUImageSaturationFilter() {
this(1.0f);
}
public GPUImageSaturationFilter(final float saturation) {
super(MagicFilterType.SATURATION, R.raw.saturation);
mSaturation = saturation;
}
@Override
public void onInit() {
super.onInit();
mSaturationLocation = GLES20.glGetUniformLocation(getProgram(), "saturation");
}
@Override
public void onInitialized() {
super.onInitialized();
setSaturation(mSaturation);
}
public void setSaturation(final float saturation) {
mSaturation = saturation;
setFloat(mSaturationLocation, mSaturation);
}
}

@ -1,65 +0,0 @@
/*
* Copyright (C) 2012 CyberAgent
*
* 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.
*/
package com.seu.magicfilter.base.gpuimage;
import android.opengl.GLES20;
import com.frank.live.R;
import com.seu.magicfilter.utils.MagicFilterType;
/**
* Sharpens the picture. <br>
* <br>
* sharpness: from -4.0 to 4.0, with 0.0 as the normal level
*/
public class GPUImageSharpenFilter extends GPUImageFilter {
private int mSharpnessLocation;
private float mSharpness;
private int mImageWidthFactorLocation;
private int mImageHeightFactorLocation;
public GPUImageSharpenFilter() {
this(0.0f);
}
public GPUImageSharpenFilter(final float sharpness) {
super(MagicFilterType.SHARPEN, R.raw.vertex_sharpen, R.raw.sharpen);
mSharpness = sharpness;
}
@Override
public void onInit() {
super.onInit();
mSharpnessLocation = GLES20.glGetUniformLocation(getProgram(), "sharpness");
mImageWidthFactorLocation = GLES20.glGetUniformLocation(getProgram(), "imageWidthFactor");
mImageHeightFactorLocation = GLES20.glGetUniformLocation(getProgram(), "imageHeightFactor");
setSharpness(mSharpness);
}
@Override
public void onInputSizeChanged(final int width, final int height) {
super.onInputSizeChanged(width, height);
setFloat(mImageWidthFactorLocation, 1.0f / width);
setFloat(mImageHeightFactorLocation, 1.0f / height);
}
public void setSharpness(final float sharpness) {
mSharpness = sharpness;
setFloat(mSharpnessLocation, mSharpness);
}
}

@ -1,163 +0,0 @@
package com.seu.magicfilter.utils;
import com.seu.magicfilter.advanced.MagicAmaroFilter;
import com.seu.magicfilter.advanced.MagicAntiqueFilter;
import com.seu.magicfilter.advanced.MagicBeautyFilter;
import com.seu.magicfilter.advanced.MagicBlackCatFilter;
import com.seu.magicfilter.advanced.MagicBrannanFilter;
import com.seu.magicfilter.advanced.MagicBrooklynFilter;
import com.seu.magicfilter.advanced.MagicCalmFilter;
import com.seu.magicfilter.advanced.MagicCoolFilter;
import com.seu.magicfilter.advanced.MagicCrayonFilter;
import com.seu.magicfilter.advanced.MagicEarlyBirdFilter;
import com.seu.magicfilter.advanced.MagicEmeraldFilter;
import com.seu.magicfilter.advanced.MagicEvergreenFilter;
import com.seu.magicfilter.advanced.MagicFreudFilter;
import com.seu.magicfilter.advanced.MagicHealthyFilter;
import com.seu.magicfilter.advanced.MagicHefeFilter;
import com.seu.magicfilter.advanced.MagicHudsonFilter;
import com.seu.magicfilter.advanced.MagicImageAdjustFilter;
import com.seu.magicfilter.advanced.MagicInkwellFilter;
import com.seu.magicfilter.advanced.MagicKevinFilter;
import com.seu.magicfilter.advanced.MagicLatteFilter;
import com.seu.magicfilter.advanced.MagicLomoFilter;
import com.seu.magicfilter.advanced.MagicN1977Filter;
import com.seu.magicfilter.advanced.MagicNashvilleFilter;
import com.seu.magicfilter.advanced.MagicNostalgiaFilter;
import com.seu.magicfilter.advanced.MagicPixelFilter;
import com.seu.magicfilter.advanced.MagicRiseFilter;
import com.seu.magicfilter.advanced.MagicRomanceFilter;
import com.seu.magicfilter.advanced.MagicSakuraFilter;
import com.seu.magicfilter.advanced.MagicSierraFilter;
import com.seu.magicfilter.advanced.MagicSketchFilter;
import com.seu.magicfilter.advanced.MagicSkinWhitenFilter;
import com.seu.magicfilter.advanced.MagicSunriseFilter;
import com.seu.magicfilter.advanced.MagicSunsetFilter;
import com.seu.magicfilter.advanced.MagicSutroFilter;
import com.seu.magicfilter.advanced.MagicSweetsFilter;
import com.seu.magicfilter.advanced.MagicTenderFilter;
import com.seu.magicfilter.advanced.MagicToasterFilter;
import com.seu.magicfilter.advanced.MagicValenciaFilter;
import com.seu.magicfilter.advanced.MagicWaldenFilter;
import com.seu.magicfilter.advanced.MagicWarmFilter;
import com.seu.magicfilter.advanced.MagicWhiteCatFilter;
import com.seu.magicfilter.advanced.MagicXproIIFilter;
import com.seu.magicfilter.base.MagicLookupFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageBrightnessFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageContrastFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageExposureFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageHueFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageSaturationFilter;
import com.seu.magicfilter.base.gpuimage.GPUImageSharpenFilter;
public class MagicFilterFactory{
public static GPUImageFilter initFilters(MagicFilterType type) {
switch (type) {
case NONE:
return new GPUImageFilter();
case WHITECAT:
return new MagicWhiteCatFilter();
case BLACKCAT:
return new MagicBlackCatFilter();
case SKINWHITEN:
return new MagicSkinWhitenFilter();
case BEAUTY:
return new MagicBeautyFilter();
case ROMANCE:
return new MagicRomanceFilter();
case SAKURA:
return new MagicSakuraFilter();
case AMARO:
return new MagicAmaroFilter();
case WALDEN:
return new MagicWaldenFilter();
case ANTIQUE:
return new MagicAntiqueFilter();
case CALM:
return new MagicCalmFilter();
case BRANNAN:
return new MagicBrannanFilter();
case BROOKLYN:
return new MagicBrooklynFilter();
case EARLYBIRD:
return new MagicEarlyBirdFilter();
case FREUD:
return new MagicFreudFilter();
case HEFE:
return new MagicHefeFilter();
case HUDSON:
return new MagicHudsonFilter();
case INKWELL:
return new MagicInkwellFilter();
case KEVIN:
return new MagicKevinFilter();
case LOCKUP:
return new MagicLookupFilter("");
case LOMO:
return new MagicLomoFilter();
case N1977:
return new MagicN1977Filter();
case NASHVILLE:
return new MagicNashvilleFilter();
case PIXAR:
return new MagicPixelFilter();
case RISE:
return new MagicRiseFilter();
case SIERRA:
return new MagicSierraFilter();
case SUTRO:
return new MagicSutroFilter();
case TOASTER2:
return new MagicToasterFilter();
case VALENCIA:
return new MagicValenciaFilter();
case XPROII:
return new MagicXproIIFilter();
case EVERGREEN:
return new MagicEvergreenFilter();
case HEALTHY:
return new MagicHealthyFilter();
case COOL:
return new MagicCoolFilter();
case EMERALD:
return new MagicEmeraldFilter();
case LATTE:
return new MagicLatteFilter();
case WARM:
return new MagicWarmFilter();
case TENDER:
return new MagicTenderFilter();
case SWEETS:
return new MagicSweetsFilter();
case NOSTALGIA:
return new MagicNostalgiaFilter();
case SUNRISE:
return new MagicSunriseFilter();
case SUNSET:
return new MagicSunsetFilter();
case CRAYON:
return new MagicCrayonFilter();
case SKETCH:
return new MagicSketchFilter();
//image adjust
case BRIGHTNESS:
return new GPUImageBrightnessFilter();
case CONTRAST:
return new GPUImageContrastFilter();
case EXPOSURE:
return new GPUImageExposureFilter();
case HUE:
return new GPUImageHueFilter();
case SATURATION:
return new GPUImageSaturationFilter();
case SHARPEN:
return new GPUImageSharpenFilter();
case IMAGE_ADJUST:
return new MagicImageAdjustFilter();
default:
return null;
}
}
}

@ -1,59 +0,0 @@
package com.seu.magicfilter.utils;
/**
* Created by why8222 on 2016/2/25.
*/
public enum MagicFilterType {
NONE,
FAIRYTALE,
SUNRISE,
SUNSET,
WHITECAT,
BLACKCAT,
SKINWHITEN,
BEAUTY,
HEALTHY,
SWEETS,
ROMANCE,
SAKURA,
WARM,
ANTIQUE,
NOSTALGIA,
CALM,
LATTE,
TENDER,
COOL,
EMERALD,
EVERGREEN,
CRAYON,
SKETCH,
AMARO,
BRANNAN,
BROOKLYN,
EARLYBIRD,
FREUD,
HEFE,
HUDSON,
INKWELL,
KEVIN,
LOCKUP,
LOMO,
N1977,
NASHVILLE,
PIXAR,
RISE,
SIERRA,
SUTRO,
TOASTER2,
VALENCIA,
WALDEN,
XPROII,
//image adjust
CONTRAST,
BRIGHTNESS,
EXPOSURE,
HUE,
SATURATION,
SHARPEN,
IMAGE_ADJUST
}

@ -1,230 +0,0 @@
package com.seu.magicfilter.utils;
import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;
import android.opengl.GLUtils;
import android.util.Log;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.Buffer;
import javax.microedition.khronos.opengles.GL10;
public class OpenGLUtils {
public static final int NO_TEXTURE = -1;
public static final int NOT_INIT = -1;
public static final int ON_DRAWN = 1;
public static int loadTexture(Bitmap img, int usedTexId) {
return loadTexture(img, usedTexId, false);
}
public static int loadTexture(Bitmap img, int usedTexId, boolean recyled) {
if(img == null)
return NO_TEXTURE;
int textures[] = new int[1];
if (usedTexId == NO_TEXTURE) {
GLES20.glGenTextures(1, textures, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, img, 0);
} else {
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, img);
textures[0] = usedTexId;
}
if(recyled)
img.recycle();
return textures[0];
}
public static int loadTexture(Buffer data, int width, int height, int usedTexId) {
if(data == null)
return NO_TEXTURE;
int textures[] = new int[1];
if (usedTexId == NO_TEXTURE) {
GLES20.glGenTextures(1, textures, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height,
0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, data);
} else {
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, width,
height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, data);
textures[0] = usedTexId;
}
return textures[0];
}
public static int loadTexture(Buffer data, int width, int height, int usedTexId, int type) {
if(data == null)
return NO_TEXTURE;
int textures[] = new int[1];
if (usedTexId == NO_TEXTURE) {
GLES20.glGenTextures(1, textures, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height,
0, GLES20.GL_RGBA, type, data);
} else {
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, width,
height, GLES20.GL_RGBA, type, data);
textures[0] = usedTexId;
}
return textures[0];
}
public static int loadTexture(final Context context, final String name){
final int[] textureHandle = new int[1];
GLES20.glGenTextures(1, textureHandle, 0);
if (textureHandle[0] != 0){
// Read in the resource
final Bitmap bitmap = getImageFromAssetsFile(context,name);
// Bind to the texture in OpenGL
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle[0]);
// Set filtering
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
// Load the bitmap into the bound texture.
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
// Recycle the bitmap, since its data has been loaded into OpenGL.
bitmap.recycle();
}
if (textureHandle[0] == 0){
throw new RuntimeException("Error loading texture.");
}
return textureHandle[0];
}
private static Bitmap getImageFromAssetsFile(Context context, String fileName){
Bitmap image = null;
AssetManager am = context.getResources().getAssets();
try{
InputStream is = am.open(fileName);
image = BitmapFactory.decodeStream(is);
is.close();
}catch (IOException e){
e.printStackTrace();
}
return image;
}
public static int loadProgram(String strVSource, String strFSource) {
int iVShader;
int iFShader;
int iProgId;
int[] link = new int[1];
iVShader = loadShader(strVSource, GLES20.GL_VERTEX_SHADER);
if (iVShader == 0) {
Log.d("Load Program", "Vertex Shader Failed");
return 0;
}
iFShader = loadShader(strFSource, GLES20.GL_FRAGMENT_SHADER);
if (iFShader == 0) {
Log.d("Load Program", "Fragment Shader Failed");
return 0;
}
iProgId = GLES20.glCreateProgram();
GLES20.glAttachShader(iProgId, iVShader);
GLES20.glAttachShader(iProgId, iFShader);
GLES20.glLinkProgram(iProgId);
GLES20.glGetProgramiv(iProgId, GLES20.GL_LINK_STATUS, link, 0);
if (link[0] <= 0) {
Log.d("Load Program", "Linking Failed");
return 0;
}
GLES20.glDeleteShader(iVShader);
GLES20.glDeleteShader(iFShader);
return iProgId;
}
private static int loadShader(String strSource, int iType) {
int[] compiled = new int[1];
int iShader = GLES20.glCreateShader(iType);
GLES20.glShaderSource(iShader, strSource);
GLES20.glCompileShader(iShader);
GLES20.glGetShaderiv(iShader, GLES20.GL_COMPILE_STATUS, compiled, 0);
if (compiled[0] == 0) {
Log.e("Load Shader Failed", "Compilation\n" + GLES20.glGetShaderInfoLog(iShader));
return 0;
}
return iShader;
}
public static int getExternalOESTextureID(){
int[] texture = new int[1];
GLES20.glGenTextures(1, texture, 0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, texture[0]);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
return texture[0];
}
public static String readShaderFromRawResource(Context context, int resourceId){
final InputStream inputStream = context.getResources().openRawResource(resourceId);
final InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
final BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String nextLine;
final StringBuilder body = new StringBuilder();
try{
while ((nextLine = bufferedReader.readLine()) != null){
body.append(nextLine);
body.append('\n');
}
}
catch (IOException e){
return null;
}
return body.toString();
}
}

@ -1,54 +0,0 @@
/*
* Copyright (C) 2012 CyberAgent
*
* 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.
*/
package com.seu.magicfilter.utils;
public enum Rotation {
NORMAL, ROTATION_90, ROTATION_180, ROTATION_270;
/**
* Retrieves the int representation of the Rotation.
*
* @return 0, 90, 180 or 270
*/
public int asInt() {
switch (this) {
case NORMAL: return 0;
case ROTATION_90: return 90;
case ROTATION_180: return 180;
case ROTATION_270: return 270;
default: throw new IllegalStateException("Unknown Rotation!");
}
}
/**
* Create a Rotation from an integer. Needs to be either 0, 90, 180 or 270.
*
* @param rotation 0, 90, 180 or 270
* @return Rotation object
*/
public static Rotation fromInt(int rotation) {
switch (rotation) {
case 0: return NORMAL;
case 90: return ROTATION_90;
case 180: return ROTATION_180;
case 270: return ROTATION_270;
case 360: return NORMAL;
default: throw new IllegalStateException(
rotation + " is an unknown rotation. Needs to be either 0, 90, 180 or 270!");
}
}
}

@ -1,96 +0,0 @@
/*
* Copyright (C) 2012 CyberAgent
*
* 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.
*/
package com.seu.magicfilter.utils;
public class TextureRotationUtil {
public static final float TEXTURE_NO_ROTATION[] = {
0.0f, 1.0f,
1.0f, 1.0f,
0.0f, 0.0f,
1.0f, 0.0f,
};
public static final float TEXTURE_ROTATED_90[] = {
1.0f, 1.0f,
1.0f, 0.0f,
0.0f, 1.0f,
0.0f, 0.0f,
};
public static final float TEXTURE_ROTATED_180[] = {
1.0f, 0.0f,
0.0f, 0.0f,
1.0f, 1.0f,
0.0f, 1.0f,
};
public static final float TEXTURE_ROTATED_270[] = {
0.0f, 0.0f,
0.0f, 1.0f,
1.0f, 0.0f,
1.0f, 1.0f,
};
public static final float CUBE[] = {
-1.0f, -1.0f,
1.0f, -1.0f,
-1.0f, 1.0f,
1.0f, 1.0f,
};
private TextureRotationUtil() {}
public static float[] getRotation(final Rotation rotation, final boolean flipHorizontal,
final boolean flipVertical) {
float[] rotatedTex;
switch (rotation) {
case ROTATION_90:
rotatedTex = TEXTURE_ROTATED_90;
break;
case ROTATION_180:
rotatedTex = TEXTURE_ROTATED_180;
break;
case ROTATION_270:
rotatedTex = TEXTURE_ROTATED_270;
break;
case NORMAL:
default:
rotatedTex = TEXTURE_NO_ROTATION;
break;
}
if (flipHorizontal) {
rotatedTex = new float[]{
flip(rotatedTex[0]), rotatedTex[1],
flip(rotatedTex[2]), rotatedTex[3],
flip(rotatedTex[4]), rotatedTex[5],
flip(rotatedTex[6]), rotatedTex[7],
};
}
if (flipVertical) {
rotatedTex = new float[]{
rotatedTex[0], flip(rotatedTex[1]),
rotatedTex[2], flip(rotatedTex[3]),
rotatedTex[4], flip(rotatedTex[5]),
rotatedTex[6], flip(rotatedTex[7]),
};
}
return rotatedTex;
}
private static float flip(final float i) {
return i == 0.0f ? 1.0f : 0.0f;
}
}

@ -1,41 +0,0 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.frank.live.view.SmartCameraView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/gl_surfaceview"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true" />
<Spinner
android:id="@+id/beauty_type_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"/>
<ImageView
android:id="@+id/img_photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:src="@drawable/ic_camera_switch"
android:text="@string/take_photo"
android:clickable="true"
android:focusable="true"
android:tint="@color/colorPrimary"
android:contentDescription="@string/take_photo" />
<Button
android:id="@+id/button_mute"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mute"
android:layout_alignParentEnd="true"
android:layout_marginTop="20dp"
android:layout_below="@+id/img_photo"/>
</RelativeLayout>

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.frank.live.RtmpLiveActivity">
<TextureView
android:id="@+id/surface_camera"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<Button
android:id="@+id/btn_swap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/swap"/>
<ToggleButton
android:id="@+id/btn_live"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOn="@string/stop"
android:textOff="@string/start"
android:layout_centerVertical="true"/>
</RelativeLayout>

@ -1,32 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2; //blowout;
uniform sampler2D inputImageTexture3; //overlay;
uniform sampler2D inputImageTexture4; //map
uniform float strength;
void main()
{
vec4 originColor = texture2D(inputImageTexture, textureCoordinate);
vec4 texel = texture2D(inputImageTexture, textureCoordinate);
vec3 bbTexel = texture2D(inputImageTexture2, textureCoordinate).rgb;
texel.r = texture2D(inputImageTexture3, vec2(bbTexel.r, texel.r)).r;
texel.g = texture2D(inputImageTexture3, vec2(bbTexel.g, texel.g)).g;
texel.b = texture2D(inputImageTexture3, vec2(bbTexel.b, texel.b)).b;
vec4 mapped;
mapped.r = texture2D(inputImageTexture4, vec2(texel.r, .16666)).r;
mapped.g = texture2D(inputImageTexture4, vec2(texel.g, .5)).g;
mapped.b = texture2D(inputImageTexture4, vec2(texel.b, .83333)).b;
mapped.a = 1.0;
mapped.rgb = mix(originColor.rgb, mapped.rgb, strength);
gl_FragColor = mapped;
}

@ -1,53 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision highp float;
varying highp vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D curve;
void main()
{
highp vec4 textureColor;
highp vec4 textureColorRes;
highp float satVal = 65.0 / 100.0;
float xCoordinate = textureCoordinate.x;
float yCoordinate = textureCoordinate.y;
highp float redCurveValue;
highp float greenCurveValue;
highp float blueCurveValue;
textureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));
textureColorRes = textureColor;
redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r;
greenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;
blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;
highp float G = (redCurveValue + greenCurveValue + blueCurveValue);
G = G / 3.0;
redCurveValue = ((1.0 - satVal) * G + satVal * redCurveValue);
greenCurveValue = ((1.0 - satVal) * G + satVal * greenCurveValue);
blueCurveValue = ((1.0 - satVal) * G + satVal * blueCurveValue);
redCurveValue = (((redCurveValue) > (1.0)) ? (1.0) : (((redCurveValue) < (0.0)) ? (0.0) : (redCurveValue)));
greenCurveValue = (((greenCurveValue) > (1.0)) ? (1.0) : (((greenCurveValue) < (0.0)) ? (0.0) : (greenCurveValue)));
blueCurveValue = (((blueCurveValue) > (1.0)) ? (1.0) : (((blueCurveValue) < (0.0)) ? (0.0) : (blueCurveValue)));
redCurveValue = texture2D(curve, vec2(redCurveValue, 0.0)).a;
greenCurveValue = texture2D(curve, vec2(greenCurveValue, 0.0)).a;
blueCurveValue = texture2D(curve, vec2(blueCurveValue, 0.0)).a;
highp vec4 base = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
highp vec4 overlayer = vec4(250.0/255.0, 227.0/255.0, 193.0/255.0, 1.0);
textureColor = overlayer * base;
base = (textureColor - base) * 0.850980 + base;
textureColor = base;
gl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);
}

@ -1,111 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision highp float;
uniform samplerExternalOES inputImageTexture;
uniform vec2 singleStepOffset;
varying vec2 textureCoordinate;
const vec4 params = vec4(0.748, 0.874, 0.241, 0.241);
const vec3 W = vec3(0.299,0.587,0.114);
const mat3 saturateMatrix = mat3(
1.1102,-0.0598,-0.061,
-0.0774,1.0826,-0.1186,
-0.0228,-0.0228,1.1772);
vec2 blurCoordinates[24];
float hardLight(float color) {
if(color <= 0.5) {
color = color * color * 2.0;
} else {
color = 1.0 - ((1.0 - color)*(1.0 - color) * 2.0);
}
return color;
}
void main() {
vec3 centralColor = texture2D(inputImageTexture, textureCoordinate).rgb;
blurCoordinates[0] = textureCoordinate.xy + singleStepOffset * vec2(0.0, -10.0);
blurCoordinates[1] = textureCoordinate.xy + singleStepOffset * vec2(0.0, 10.0);
blurCoordinates[2] = textureCoordinate.xy + singleStepOffset * vec2(-10.0, 0.0);
blurCoordinates[3] = textureCoordinate.xy + singleStepOffset * vec2(10.0, 0.0);
blurCoordinates[4] = textureCoordinate.xy + singleStepOffset * vec2(5.0, -8.0);
blurCoordinates[5] = textureCoordinate.xy + singleStepOffset * vec2(5.0, 8.0);
blurCoordinates[6] = textureCoordinate.xy + singleStepOffset * vec2(-5.0, 8.0);
blurCoordinates[7] = textureCoordinate.xy + singleStepOffset * vec2(-5.0, -8.0);
blurCoordinates[8] = textureCoordinate.xy + singleStepOffset * vec2(8.0, -5.0);
blurCoordinates[9] = textureCoordinate.xy + singleStepOffset * vec2(8.0, 5.0);
blurCoordinates[10] = textureCoordinate.xy + singleStepOffset * vec2(-8.0, 5.0);
blurCoordinates[11] = textureCoordinate.xy + singleStepOffset * vec2(-8.0, -5.0);
blurCoordinates[12] = textureCoordinate.xy + singleStepOffset * vec2(0.0, -6.0);
blurCoordinates[13] = textureCoordinate.xy + singleStepOffset * vec2(0.0, 6.0);
blurCoordinates[14] = textureCoordinate.xy + singleStepOffset * vec2(6.0, 0.0);
blurCoordinates[15] = textureCoordinate.xy + singleStepOffset * vec2(-6.0, 0.0);
blurCoordinates[16] = textureCoordinate.xy + singleStepOffset * vec2(-4.0, -4.0);
blurCoordinates[17] = textureCoordinate.xy + singleStepOffset * vec2(-4.0, 4.0);
blurCoordinates[18] = textureCoordinate.xy + singleStepOffset * vec2(4.0, -4.0);
blurCoordinates[19] = textureCoordinate.xy + singleStepOffset * vec2(4.0, 4.0);
blurCoordinates[20] = textureCoordinate.xy + singleStepOffset * vec2(-2.0, -2.0);
blurCoordinates[21] = textureCoordinate.xy + singleStepOffset * vec2(-2.0, 2.0);
blurCoordinates[22] = textureCoordinate.xy + singleStepOffset * vec2(2.0, -2.0);
blurCoordinates[23] = textureCoordinate.xy + singleStepOffset * vec2(2.0, 2.0);
float sampleColor = centralColor.g * 22.0;
sampleColor += texture2D(inputImageTexture, blurCoordinates[0]).g;
sampleColor += texture2D(inputImageTexture, blurCoordinates[1]).g;
sampleColor += texture2D(inputImageTexture, blurCoordinates[2]).g;
sampleColor += texture2D(inputImageTexture, blurCoordinates[3]).g;
sampleColor += texture2D(inputImageTexture, blurCoordinates[4]).g;
sampleColor += texture2D(inputImageTexture, blurCoordinates[5]).g;
sampleColor += texture2D(inputImageTexture, blurCoordinates[6]).g;
sampleColor += texture2D(inputImageTexture, blurCoordinates[7]).g;
sampleColor += texture2D(inputImageTexture, blurCoordinates[8]).g;
sampleColor += texture2D(inputImageTexture, blurCoordinates[9]).g;
sampleColor += texture2D(inputImageTexture, blurCoordinates[10]).g;
sampleColor += texture2D(inputImageTexture, blurCoordinates[11]).g;
sampleColor += texture2D(inputImageTexture, blurCoordinates[12]).g * 2.0;
sampleColor += texture2D(inputImageTexture, blurCoordinates[13]).g * 2.0;
sampleColor += texture2D(inputImageTexture, blurCoordinates[14]).g * 2.0;
sampleColor += texture2D(inputImageTexture, blurCoordinates[15]).g * 2.0;
sampleColor += texture2D(inputImageTexture, blurCoordinates[16]).g * 2.0;
sampleColor += texture2D(inputImageTexture, blurCoordinates[17]).g * 2.0;
sampleColor += texture2D(inputImageTexture, blurCoordinates[18]).g * 2.0;
sampleColor += texture2D(inputImageTexture, blurCoordinates[19]).g * 2.0;
sampleColor += texture2D(inputImageTexture, blurCoordinates[20]).g * 3.0;
sampleColor += texture2D(inputImageTexture, blurCoordinates[21]).g * 3.0;
sampleColor += texture2D(inputImageTexture, blurCoordinates[22]).g * 3.0;
sampleColor += texture2D(inputImageTexture, blurCoordinates[23]).g * 3.0;
sampleColor = sampleColor / 62.0;
float highPass = centralColor.g - sampleColor + 0.5;
for(int i = 0; i < 5;i++)
{
highPass = hardLight(highPass);
}
float luminance = dot(centralColor, W);
float alpha = pow(luminance, params.r);
vec3 smoothColor = centralColor + (centralColor-vec3(highPass))*alpha*0.1;
smoothColor.r = clamp(pow(smoothColor.r, params.g),0.0,1.0);
smoothColor.g = clamp(pow(smoothColor.g, params.g),0.0,1.0);
smoothColor.b = clamp(pow(smoothColor.b, params.g),0.0,1.0);
vec3 screen = vec3(1.0) - (vec3(1.0)-smoothColor) * (vec3(1.0)-centralColor);
vec3 lighten = max(smoothColor, centralColor);
vec3 softLight = 2.0 * centralColor*smoothColor + centralColor*centralColor
- 2.0 * centralColor*centralColor * smoothColor;
gl_FragColor = vec4(mix(centralColor, screen, alpha), 1.0);
gl_FragColor.rgb = mix(gl_FragColor.rgb, lighten, alpha);
gl_FragColor.rgb = mix(gl_FragColor.rgb, softLight, params.b);
vec3 satColor = gl_FragColor.rgb * saturateMatrix;
gl_FragColor.rgb = mix(gl_FragColor.rgb, satColor, params.a);
gl_FragColor.rgb = vec3(gl_FragColor.rgb + vec3(-0.096));
}

@ -1,92 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision highp float;
varying highp vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D curve;
vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void main() {
float GreyVal;
lowp vec4 textureColor;
lowp vec4 textureColorOri;
float xCoordinate = textureCoordinate.x;
float yCoordinate = textureCoordinate.y;
highp float redCurveValue;
highp float greenCurveValue;
highp float blueCurveValue;
textureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));
// step1 curve
redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r;
greenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;
blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;
//textureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
vec3 tColor = vec3(redCurveValue, greenCurveValue, blueCurveValue);
tColor = rgb2hsv(tColor);
tColor.g = tColor.g * 1.2;
float dStrength = 1.0;
float dSatStrength = 0.3;
float dGap = 0.0;
if( tColor.r >= 0.0 && tColor.r < 0.417)
{
tColor.g = tColor.g + (tColor.g * dSatStrength);
}
else if( tColor.r > 0.958 && tColor.r <= 1.0)
{
tColor.g = tColor.g + (tColor.g * dSatStrength);
}
else if( tColor.r >= 0.875 && tColor.r <= 0.958)
{
dGap = abs(tColor.r - 0.875);
dStrength = (dGap / 0.0833);
tColor.g = tColor.g + (tColor.g * dSatStrength * dStrength);
}
else if( tColor.r >= 0.0417 && tColor.r <= 0.125)
{
dGap = abs(tColor.r - 0.125);
dStrength = (dGap / 0.0833);
tColor.g = tColor.g + (tColor.g * dSatStrength * dStrength);
}
tColor = hsv2rgb(tColor);
tColor = clamp(tColor, 0.0, 1.0);
redCurveValue = texture2D(curve, vec2(tColor.r, 1.0)).r;
greenCurveValue = texture2D(curve, vec2(tColor.g, 1.0)).r;
blueCurveValue = texture2D(curve, vec2(tColor.b, 1.0)).r;
redCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).g;
greenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).g;
blueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).g;
textureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
gl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);
}

@ -1,73 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2; //process
uniform sampler2D inputImageTexture3; //blowout
uniform sampler2D inputImageTexture4; //contrast
uniform sampler2D inputImageTexture5; //luma
uniform sampler2D inputImageTexture6; //screen
mat3 saturateMatrix = mat3(
1.105150, -0.044850,-0.046000,
-0.088050,1.061950,-0.089200,
-0.017100,-0.017100,1.132900);
vec3 luma = vec3(.3, .59, .11);
uniform float strength;
void main()
{
vec4 originColor = texture2D(inputImageTexture, textureCoordinate);
vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;
vec2 lookup;
lookup.y = 0.5;
lookup.x = texel.r;
texel.r = texture2D(inputImageTexture2, lookup).r;
lookup.x = texel.g;
texel.g = texture2D(inputImageTexture2, lookup).g;
lookup.x = texel.b;
texel.b = texture2D(inputImageTexture2, lookup).b;
texel = saturateMatrix * texel;
vec2 tc = (2.0 * textureCoordinate) - 1.0;
float d = dot(tc, tc);
vec3 sampled;
lookup.y = 0.5;
lookup.x = texel.r;
sampled.r = texture2D(inputImageTexture3, lookup).r;
lookup.x = texel.g;
sampled.g = texture2D(inputImageTexture3, lookup).g;
lookup.x = texel.b;
sampled.b = texture2D(inputImageTexture3, lookup).b;
float value = smoothstep(0.0, 1.0, d);
texel = mix(sampled, texel, value);
lookup.x = texel.r;
texel.r = texture2D(inputImageTexture4, lookup).r;
lookup.x = texel.g;
texel.g = texture2D(inputImageTexture4, lookup).g;
lookup.x = texel.b;
texel.b = texture2D(inputImageTexture4, lookup).b;
lookup.x = dot(texel, luma);
texel = mix(texture2D(inputImageTexture5, lookup).rgb, texel, .5);
lookup.x = texel.r;
texel.r = texture2D(inputImageTexture6, lookup).r;
lookup.x = texel.g;
texel.g = texture2D(inputImageTexture6, lookup).g;
lookup.x = texel.b;
texel.b = texture2D(inputImageTexture6, lookup).b;
texel = mix(originColor.rgb, texel.rgb, strength);
gl_FragColor = vec4(texel, 1.0);
}

@ -1,9 +0,0 @@
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform lowp float brightness;
void main() {
lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
gl_FragColor = vec4((textureColor.rgb + vec3(brightness)), textureColor.w);
}

@ -1,148 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2;
uniform sampler2D inputImageTexture3;
uniform sampler2D inputImageTexture4;
uniform float strength;
// gray
float NCGray(vec4 color)
{
float gray = 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b;
return gray;
}
// tone mapping
vec4 NCTonemapping(vec4 color)
{
vec4 mapped;
mapped.r = texture2D(inputImageTexture2, vec2(color.r, 0.0)).r;
mapped.g = texture2D(inputImageTexture2, vec2(color.g, 0.0)).g;
mapped.b = texture2D(inputImageTexture2, vec2(color.b, 0.0)).b;
mapped.a = color.a;
return mapped;
}
// color control
vec4 NCColorControl(vec4 color, float saturation, float brightness, float contrast)
{
float gray = NCGray(color);
color.rgb = vec3(saturation) * color.rgb + vec3(1.0-saturation) * vec3(gray);
color.r = clamp(color.r, 0.0, 1.0);
color.g = clamp(color.g, 0.0, 1.0);
color.b = clamp(color.b, 0.0, 1.0);
color.rgb = vec3(contrast) * (color.rgb - vec3(0.5)) + vec3(0.5);
color.r = clamp(color.r, 0.0, 1.0);
color.g = clamp(color.g, 0.0, 1.0);
color.b = clamp(color.b, 0.0, 1.0);
color.rgb = color.rgb + vec3(brightness);
color.r = clamp(color.r, 0.0, 1.0);
color.g = clamp(color.g, 0.0, 1.0);
color.b = clamp(color.b, 0.0, 1.0);
return color;
}
// hue adjust
vec4 NCHueAdjust(vec4 color, float hueAdjust)
{
vec3 kRGBToYPrime = vec3(0.299, 0.587, 0.114);
vec3 kRGBToI = vec3(0.595716, -0.274453, -0.321263);
vec3 kRGBToQ = vec3(0.211456, -0.522591, 0.31135);
vec3 kYIQToR = vec3(1.0, 0.9563, 0.6210);
vec3 kYIQToG = vec3(1.0, -0.2721, -0.6474);
vec3 kYIQToB = vec3(1.0, -1.1070, 1.7046);
float yPrime = dot(color.rgb, kRGBToYPrime);
float I = dot(color.rgb, kRGBToI);
float Q = dot(color.rgb, kRGBToQ);
float hue = atan(Q, I);
float chroma = sqrt (I * I + Q * Q);
hue -= hueAdjust;
Q = chroma * sin (hue);
I = chroma * cos (hue);
color.r = dot(vec3(yPrime, I, Q), kYIQToR);
color.g = dot(vec3(yPrime, I, Q), kYIQToG);
color.b = dot(vec3(yPrime, I, Q), kYIQToB);
return color;
}
// colorMatrix
vec4 NCColorMatrix(vec4 color, float red, float green, float blue, float alpha, vec4 bias)
{
color = color * vec4(red, green, blue, alpha) + bias;
return color;
}
// multiply blend
vec4 NCMultiplyBlend(vec4 overlay, vec4 base)
{
vec4 outputColor;
float a = overlay.a + base.a * (1.0 - overlay.a);
// // normal blend
// outputColor.r = (base.r * base.a + overlay.r * overlay.a * (1.0 - base.a))/a;
// outputColor.g = (base.g * base.a + overlay.g * overlay.a * (1.0 - base.a))/a;
// outputColor.b = (base.b * base.a + overlay.b * overlay.a * (1.0 - base.a))/a;
// multiply blend
outputColor.rgb = ((1.0-base.a) * overlay.rgb * overlay.a + (1.0-overlay.a) * base.rgb * base.a + overlay.a * base.a * overlay.rgb * base.rgb) / a;
outputColor.a = a;
return outputColor;
}
void main()
{
vec4 originColor = texture2D(inputImageTexture, textureCoordinate);
vec4 color = texture2D(inputImageTexture, textureCoordinate);
color.a = 1.0;
// tone mapping
color.r = texture2D(inputImageTexture2, vec2(color.r, 0.0)).r;
color.g = texture2D(inputImageTexture2, vec2(color.g, 0.0)).g;
color.b = texture2D(inputImageTexture2, vec2(color.b, 0.0)).b;
// color control
color = NCColorControl(color, 0.88, 0.03, 0.85);
// hue adjust
color = NCHueAdjust(color, -0.0444);
// normal blend
vec4 bg = vec4(0.5647, 0.1961, 0.0157, 0.14);
color = NCMultiplyBlend(bg, color);
// normal blend
vec4 bg2 = texture2D(inputImageTexture3, textureCoordinate);
bg2.a *= 0.9;
color = NCMultiplyBlend(bg2, color);
// tone mapping
color.r = texture2D(inputImageTexture4, vec2(color.r, 0.0)).r;
color.g = texture2D(inputImageTexture4, vec2(color.g, 0.0)).g;
color.b = texture2D(inputImageTexture4, vec2(color.b, 0.0)).b;
color.rgb = mix(originColor.rgb, color.rgb, strength);
gl_FragColor = color;
}

@ -1,72 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision highp float;
varying highp vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D grey1Frame;
uniform sampler2D grey2Frame;
uniform sampler2D curve;
const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);
void main()
{
lowp float satura = 0.5;
float GreyVal;
lowp vec4 textureColor;
lowp vec4 textureColorRes;
highp float redCurveValue;
highp float greenCurveValue;
highp float blueCurveValue;
vec4 grey1Color;
vec4 grey2Color;
float xCoordinate = textureCoordinate.x;
float yCoordinate = textureCoordinate.y;
textureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));
textureColorRes = textureColor;
grey1Color = texture2D(grey1Frame, vec2(xCoordinate, yCoordinate));
grey2Color = texture2D(grey2Frame, vec2(xCoordinate, yCoordinate));
// step 1. saturation
lowp float luminance = dot(textureColor.rgb, luminanceWeighting);
lowp vec3 greyScaleColor = vec3(luminance);
textureColor = vec4(mix(greyScaleColor, textureColor.rgb, satura), textureColor.w);
// step 2. level, blur curve, rgb curve
redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r;
redCurveValue = texture2D(curve, vec2(redCurveValue, 1.0/2.0)).r;
greenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;
greenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0/2.0)).g;
blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;
blueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0/2.0)).b;
blueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0/2.0)).g;
lowp vec4 base = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
redCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).r;
greenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).r;
blueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).r;
lowp vec4 overlayer = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
//gl_FragColor = base * (1.0 - grey1Color.r) + overlayer * grey1Color.r;
base = (base - overlayer) * (1.0 - grey1Color.r) + overlayer;
redCurveValue = texture2D(curve, vec2(base.r, 1.0)).g;
greenCurveValue = texture2D(curve, vec2(base.g, 1.0)).g;
blueCurveValue = texture2D(curve, vec2(base.b, 1.0)).g;
overlayer = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
textureColor = (base - overlayer) * (1.0 - grey2Color.r) + overlayer;
//base * (grey2Color.r) + overlayer * (1.0 - grey2Color.r);
gl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);
}

@ -1,9 +0,0 @@
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform lowp float contrast;
void main() {
lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
gl_FragColor = vec4(((textureColor.rgb - vec3(0.5)) * contrast + vec3(0.5)), textureColor.w);
}

@ -1,44 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision highp float;
varying highp vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D curve;
void main() {
lowp vec4 textureColor;
lowp vec4 textureColorOri;
float xCoordinate = textureCoordinate.x;
float yCoordinate = textureCoordinate.y;
highp float redCurveValue;
highp float greenCurveValue;
highp float blueCurveValue;
textureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));
textureColorOri = textureColor;
// step1 curve
redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r;
greenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;
blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;
// step2 level
redCurveValue = texture2D(curve, vec2(redCurveValue, 0.0)).a;
greenCurveValue = texture2D(curve, vec2(greenCurveValue, 0.0)).a;
blueCurveValue = texture2D(curve, vec2(blueCurveValue, 0.0)).a;
// step3 brightness/constrast adjust
redCurveValue = redCurveValue * 1.25 - 0.12549;
greenCurveValue = greenCurveValue * 1.25 - 0.12549;
blueCurveValue = blueCurveValue * 1.25 - 0.12549;
//redCurveValue = (((redCurveValue) > (1.0)) ? (1.0) : (((redCurveValue) < (0.0)) ? (0.0) : (redCurveValue)));
//greenCurveValue = (((greenCurveValue) > (1.0)) ? (1.0) : (((greenCurveValue) < (0.0)) ? (0.0) : (greenCurveValue)));
//blueCurveValue = (((blueCurveValue) > (1.0)) ? (1.0) : (((blueCurveValue) < (0.0)) ? (0.0) : (blueCurveValue)));
// step4 normal blending with original
textureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
textureColor = (textureColorOri - textureColor) * 0.549 + textureColor;
gl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);
}

@ -1,56 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying highp vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform vec2 singleStepOffset;
uniform float strength;
const highp vec3 W = vec3(0.299,0.587,0.114);
const mat3 rgb2yiqMatrix = mat3(
0.299, 0.587, 0.114,
0.596,-0.275,-0.321,
0.212,-0.523, 0.311);
const mat3 yiq2rgbMatrix = mat3(
1.0, 0.956, 0.621,
1.0,-0.272,-1.703,
1.0,-1.106, 0.0);
void main()
{
vec4 oralColor = texture2D(inputImageTexture, textureCoordinate);
vec3 maxValue = vec3(0.,0.,0.);
for(int i = -2; i<=2; i++)
{
for(int j = -2; j<=2; j++)
{
vec4 tempColor = texture2D(inputImageTexture, textureCoordinate+singleStepOffset*vec2(i,j));
maxValue.r = max(maxValue.r,tempColor.r);
maxValue.g = max(maxValue.g,tempColor.g);
maxValue.b = max(maxValue.b,tempColor.b);
}
}
vec3 textureColor = oralColor.rgb / maxValue;
float gray = dot(textureColor, W);
float k = 0.223529;
float alpha = min(gray,k)/k;
textureColor = textureColor * alpha + (1.-alpha)*oralColor.rgb;
vec3 yiqColor = textureColor * rgb2yiqMatrix;
yiqColor.r = max(0.0,min(1.0,pow(gray,strength)));
textureColor = yiqColor * yiq2rgbMatrix;
gl_FragColor = vec4(textureColor, oralColor.w);
}

@ -1,102 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2; //earlyBirdCurves
uniform sampler2D inputImageTexture3; //earlyBirdOverlay
uniform sampler2D inputImageTexture4; //vig
uniform sampler2D inputImageTexture5; //earlyBirdBlowout
uniform sampler2D inputImageTexture6; //earlyBirdMap
const mat3 saturate = mat3(
1.210300,
-0.089700,
-0.091000,
-0.176100,
1.123900,
-0.177400,
-0.034200,
-0.034200,
1.265800);
const vec3 rgbPrime = vec3(0.25098, 0.14640522, 0.0);
const vec3 desaturate = vec3(.3, .59, .11);
void main()
{
vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;
vec2 lookup;
lookup.y = 0.5;
lookup.x = texel.r;
texel.r = texture2D(inputImageTexture2, lookup).r;
lookup.x = texel.g;
texel.g = texture2D(inputImageTexture2, lookup).g;
lookup.x = texel.b;
texel.b = texture2D(inputImageTexture2, lookup).b;
float desaturatedColor;
vec3 result;
desaturatedColor = dot(desaturate, texel);
lookup.x = desaturatedColor;
result.r = texture2D(inputImageTexture3, lookup).r;
lookup.x = desaturatedColor;
result.g = texture2D(inputImageTexture3, lookup).g;
lookup.x = desaturatedColor;
result.b = texture2D(inputImageTexture3, lookup).b;
texel = saturate * mix(texel, result, .5);
vec2 tc = (2.0 * textureCoordinate) - 1.0;
float d = dot(tc, tc);
vec3 sampled;
lookup.y = .5;
/*
lookup.x = texel.r;
sampled.r = texture2D(inputImageTexture4, lookup).r;
lookup.x = texel.g;
sampled.g = texture2D(inputImageTexture4, lookup).g;
lookup.x = texel.b;
sampled.b = texture2D(inputImageTexture4, lookup).b;
float value = smoothstep(0.0, 1.25, pow(d, 1.35)/1.65);
texel = mix(texel, sampled, value);
*/
//---
lookup = vec2(d, texel.r);
texel.r = texture2D(inputImageTexture4, lookup).r;
lookup.y = texel.g;
texel.g = texture2D(inputImageTexture4, lookup).g;
lookup.y = texel.b;
texel.b = texture2D(inputImageTexture4, lookup).b;
float value = smoothstep(0.0, 1.25, pow(d, 1.35)/1.65);
//---
lookup.x = texel.r;
sampled.r = texture2D(inputImageTexture5, lookup).r;
lookup.x = texel.g;
sampled.g = texture2D(inputImageTexture5, lookup).g;
lookup.x = texel.b;
sampled.b = texture2D(inputImageTexture5, lookup).b;
texel = mix(sampled, texel, value);
lookup.x = texel.r;
texel.r = texture2D(inputImageTexture6, lookup).r;
lookup.x = texel.g;
texel.g = texture2D(inputImageTexture6, lookup).g;
lookup.x = texel.b;
texel.b = texture2D(inputImageTexture6, lookup).b;
gl_FragColor = vec4(texel, 1.0);
}

@ -1,89 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision highp float;
varying highp vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D curve;
vec3 RGBtoHSL(vec3 c) {
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
vec3 HSLtoRGB(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void main() {
float GreyVal;
highp vec4 textureColor;
float xCoordinate = textureCoordinate.x;
float yCoordinate = textureCoordinate.y;
highp float redCurveValue;
highp float greenCurveValue;
highp float blueCurveValue;
textureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));
// step1 curve
redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r;
greenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;
blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;
vec3 tColor = vec3(redCurveValue, greenCurveValue, blueCurveValue);
tColor = RGBtoHSL(tColor);
tColor = clamp(tColor, 0.0, 1.0);
tColor.g = tColor.g * 1.5;
float dStrength = 1.0;
float dSatStrength = 0.15;
float dHueStrength = 0.08;
float dGap = 0.0;
if( tColor.r >= 0.625 && tColor.r <= 0.708)
{
tColor.r = tColor.r - (tColor.r * dHueStrength);
tColor.g = tColor.g + (tColor.g * dSatStrength);
}
else if( tColor.r >= 0.542 && tColor.r < 0.625)
{
dGap = abs(tColor.r - 0.542);
dStrength = (dGap / 0.0833);
tColor.r = tColor.r + (tColor.r * dHueStrength * dStrength);
tColor.g = tColor.g + (tColor.g * dSatStrength * dStrength);
}
else if( tColor.r > 0.708 && tColor.r <= 0.792)
{
dGap = abs(tColor.r - 0.792);
dStrength = (dGap / 0.0833);
tColor.r = tColor.r + (tColor.r * dHueStrength * dStrength);
tColor.g = tColor.g + (tColor.g * dSatStrength * dStrength);
}
tColor = HSLtoRGB(tColor);
tColor = clamp(tColor, 0.0, 1.0);
redCurveValue = texture2D(curve, vec2(tColor.r, 1.0)).r;
greenCurveValue = texture2D(curve, vec2(tColor.g, 1.0)).r;
blueCurveValue = texture2D(curve, vec2(tColor.b, 1.0)).r;
redCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).g;
greenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).g;
blueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).g;
textureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
gl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);
}

@ -1,84 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision highp float;
varying highp vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D curve;
vec3 RGBtoHSL(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
vec3 HSLtoRGB(vec3 c)
{
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void main()
{
float GreyVal;
lowp vec4 textureColor;
float xCoordinate = textureCoordinate.x;
float yCoordinate = textureCoordinate.y;
highp float redCurveValue;
highp float greenCurveValue;
highp float blueCurveValue;
textureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));
vec3 tColor = vec3(textureColor.r, textureColor.g, textureColor.b);
tColor = RGBtoHSL(tColor);
tColor = clamp(tColor, 0.0, 1.0);
tColor.g = tColor.g * 1.3;
float dStrength = 1.0;
float dSatStrength = 0.5;
float dGap = 0.0;
if( tColor.r >= 0.292 && tColor.r <= 0.375)
{
tColor.g = tColor.g + (tColor.g * dSatStrength);
}
else if( tColor.r >= 0.208 && tColor.r < 0.292)
{
dGap = abs(tColor.r - 0.208);
dStrength = (dGap / 0.0833);
tColor.g = tColor.g + (tColor.g * dSatStrength * dStrength);
}
else if( tColor.r > 0.375 && tColor.r <= 0.458)
{
dGap = abs(tColor.r - 0.458);
dStrength = (dGap / 0.0833);
tColor.g = tColor.g + (tColor.g * dSatStrength * dStrength);
}
tColor = HSLtoRGB(tColor);
tColor = clamp(tColor, 0.0, 1.0);
redCurveValue = texture2D(curve, vec2(tColor.r, 0.0)).b;
greenCurveValue = texture2D(curve, vec2(tColor.g, 0.0)).b;
blueCurveValue = texture2D(curve, vec2(tColor.b, 0.0)).b;
redCurveValue = texture2D(curve, vec2(redCurveValue, 0.0)).r;
blueCurveValue = texture2D(curve, vec2(blueCurveValue, 0.0)).g;
textureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
gl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);
}

@ -1,9 +0,0 @@
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform highp float exposure;
void main() {
highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
gl_FragColor = vec4(textureColor.rgb * pow(2.0, exposure), textureColor.w);
}

@ -1,11 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
void main() {
gl_FragColor = texture2D(inputImageTexture, textureCoordinate);
}

@ -1,172 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision highp float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2;
uniform float inputImageTextureHeight;
uniform float inputImageTextureWidth;
float texture2Size = 1024.0;
uniform float strength;
// gray
float NCGray(vec4 color)
{
float gray = 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b;
return gray;
}
// tone mapping
vec4 NCTonemapping(vec4 color)
{
vec4 mapped;
mapped.r = texture2D(inputImageTexture2, vec2(color.r, 0.0)).r;
mapped.g = texture2D(inputImageTexture2, vec2(color.g, 0.0)).g;
mapped.b = texture2D(inputImageTexture2, vec2(color.b, 0.0)).b;
mapped.a = color.a;
return mapped;
}
// color control
vec4 NCColorControl(vec4 color, float saturation, float brightness, float contrast)
{
float gray = NCGray(color);
color.rgb = vec3(saturation) * color.rgb + vec3(1.0-saturation) * vec3(gray);
color.r = clamp(color.r, 0.0, 1.0);
color.g = clamp(color.g, 0.0, 1.0);
color.b = clamp(color.b, 0.0, 1.0);
color.rgb = vec3(contrast) * (color.rgb - vec3(0.5)) + vec3(0.5);
color.r = clamp(color.r, 0.0, 1.0);
color.g = clamp(color.g, 0.0, 1.0);
color.b = clamp(color.b, 0.0, 1.0);
color.rgb = color.rgb + vec3(brightness);
color.r = clamp(color.r, 0.0, 1.0);
color.g = clamp(color.g, 0.0, 1.0);
color.b = clamp(color.b, 0.0, 1.0);
return color;
}
// hue adjust
vec4 NCHueAdjust(vec4 color, float hueAdjust)
{
vec3 kRGBToYPrime = vec3(0.299, 0.587, 0.114);
vec3 kRGBToI = vec3(0.595716, -0.274453, -0.321263);
vec3 kRGBToQ = vec3(0.211456, -0.522591, 0.31135);
vec3 kYIQToR = vec3(1.0, 0.9563, 0.6210);
vec3 kYIQToG = vec3(1.0, -0.2721, -0.6474);
vec3 kYIQToB = vec3(1.0, -1.1070, 1.7046);
float yPrime = dot(color.rgb, kRGBToYPrime);
float I = dot(color.rgb, kRGBToI);
float Q = dot(color.rgb, kRGBToQ);
float hue = atan(Q, I);
float chroma = sqrt (I * I + Q * Q);
hue -= hueAdjust;
Q = chroma * sin (hue);
I = chroma * cos (hue);
color.r = dot(vec3(yPrime, I, Q), kYIQToR);
color.g = dot(vec3(yPrime, I, Q), kYIQToG);
color.b = dot(vec3(yPrime, I, Q), kYIQToB);
return color;
}
// colorMatrix
vec4 NCColorMatrix(vec4 color, float red, float green, float blue, float alpha, vec4 bias)
{
color = color * vec4(red, green, blue, alpha) + bias;
return color;
}
// multiply blend
vec4 NCMultiplyBlend(vec4 overlay, vec4 base)
{
vec4 outputColor;
float a = overlay.a + base.a * (1.0 - overlay.a);
// // normal blend
// outputColor.r = (base.r * base.a + overlay.r * overlay.a * (1.0 - base.a))/a;
// outputColor.g = (base.g * base.a + overlay.g * overlay.a * (1.0 - base.a))/a;
// outputColor.b = (base.b * base.a + overlay.b * overlay.a * (1.0 - base.a))/a;
// multiply blend
outputColor.rgb = ((1.0-base.a) * overlay.rgb * overlay.a + (1.0-overlay.a) * base.rgb * base.a + overlay.a * base.a * overlay.rgb * base.rgb) / a;
outputColor.a = a;
return outputColor;
}
// xy should be a integer position (e.g. pixel position on the screen)
// similar to a texture lookup but is only ALU
float PseudoRandom(vec2 co)
{
// return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
mediump float a = 12.9898;
mediump float b = 78.233;
mediump float c = 43758.5453;
mediump float dt= dot(co.xy ,vec2(a,b));
mediump float sn= mod(dt,3.14);
return fract(sin(sn) * c);
}
void main()
{
vec4 originColor = texture2D(inputImageTexture, textureCoordinate);
vec4 color = texture2D(inputImageTexture, textureCoordinate);
color.a = 1.0;
// color control
// color = NCColorControl(color, 0.6, -0.06, 0.75);
color = NCColorControl(color, 0.5, 0.1, 0.9);
// rand
float x = textureCoordinate.x*inputImageTextureWidth/texture2Size;
float y = textureCoordinate.y*inputImageTextureHeight/texture2Size;
vec4 rd = texture2D(inputImageTexture2, vec2( fract(x), fract(y)));
// vec4 rd = texture2D(inputImageTexture2, textureCoordinate);
// float rand_number1 = PseudoRandom(textureCoordinate.xy);
// float rand_number2 = PseudoRandom(textureCoordinate.yx);
// float rand_number3 = PseudoRandom(vec2(rand_number1, rand_number2));
// float rand_number4 = PseudoRandom(vec2(rand_number2, rand_number1));
// float rand_number5 = PseudoRandom(vec2(rand_number3, rand_number4));
// vec4 rd = vec4(rand_number1, rand_number3, rand_number5, 1.0);
// if(rand_number4>0.2)
// rd = vec4(1.0);
// rand color control
// rd = NCColorControl(rd, 0.65, 0.1, 0.7);
rd = NCColorControl(rd, 1.0, 0.4, 1.2);
// normal blend
// rd.a *= 1.0;
color = NCMultiplyBlend(rd, color);
// color matrix
// color = NCColorMatrix(color, 1.0, 1.0, 1.0, 1.0, vec4(-0.1, -0.1, -0.1, 0));
color = NCColorMatrix(color, 1.0, 1.0, 1.0, 1.0, vec4(-0.15, -0.15, -0.15, 0));
color.rgb = mix(originColor.rgb, color.rgb, strength);
gl_FragColor = color;
}

@ -1,141 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D curve;
uniform sampler2D mask;
uniform float texelWidthOffset ;
uniform float texelHeightOffset;
varying mediump vec2 textureCoordinate;
vec4 level0c(vec4 color, sampler2D sampler)
{
color.r = texture2D(sampler, vec2(color.r, 0.)).r;
color.g = texture2D(sampler, vec2(color.g, 0.)).r;
color.b = texture2D(sampler, vec2(color.b, 0.)).r;
return color;
}
vec4 level1c(vec4 color, sampler2D sampler)
{
color.r = texture2D(sampler, vec2(color.r, 0.)).g;
color.g = texture2D(sampler, vec2(color.g, 0.)).g;
color.b = texture2D(sampler, vec2(color.b, 0.)).g;
return color;
}
vec4 level2c(vec4 color, sampler2D sampler)
{
color.r = texture2D(sampler, vec2(color.r,0.)).b;
color.g = texture2D(sampler, vec2(color.g,0.)).b;
color.b = texture2D(sampler, vec2(color.b,0.)).b;
return color;
}
vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
vec3 hsv2rgb(vec3 c)
{
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
vec4 normal(vec4 c1, vec4 c2, float alpha)
{
return (c2-c1) * alpha + c1;
}
vec4 multiply(vec4 c1, vec4 c2)
{
return c1 * c2 * 1.01;
}
vec4 overlay(vec4 c1, vec4 c2)
{
vec4 color = vec4(0.,0.,0.,1.);
color.r = c1.r < 0.5 ? 2.0*c1.r*c2.r : 1.0 - 2.0*(1.0-c1.r)*(1.0-c2.r);
color.g = c1.g < 0.5 ? 2.0*c1.g*c2.g : 1.0 - 2.0*(1.0-c1.g)*(1.0-c2.g);
color.b = c1.b < 0.5 ? 2.0*c1.b*c2.b : 1.0 - 2.0*(1.0-c1.b)*(1.0-c2.b);
return color;
}
vec4 screen(vec4 c1, vec4 c2)
{
return vec4(1.) - ((vec4(1.) - c1) * (vec4(1.) - c2));
}
void main()
{
// iOS ImageLiveFilter adjustment
// begin
vec4 textureColor;
vec4 t0 = texture2D(mask, vec2(textureCoordinate.x, textureCoordinate.y));
// naver skin
vec4 c2 = texture2D(inputImageTexture, textureCoordinate);
vec4 c5 = c2;
// healthy
vec3 hsv = rgb2hsv(c5.rgb);
lowp float h = hsv.x;
lowp float s = hsv.y;
lowp float v = hsv.z;
lowp float cF = 0.;
// color strength
lowp float cG = 0.;
// color gap;
lowp float sF = 0.06;
// saturation strength;
if(h >= 0.125 && h <= 0.208)
{
// 45 to 75
s = s - (s * sF);
}
else if (h >= 0.208 && h < 0.292)
{
// 75 to 105
cG = abs(h - 0.208);
cF = (cG / 0.0833);
s = s - (s * sF * cF);
}
else if (h > 0.042 && h <= 0.125)
{
// 15 to 45
cG = abs(h - 0.125);
cF = (cG / 0.0833);
s = s - (s * sF * cF);
}
hsv.y = s;
vec4 c6 = vec4(hsv2rgb(hsv),1.);
c6 = normal(c6, screen (c6, c6), 0.275); // screen 70./255.
c6 = normal(c6, overlay (c6, vec4(1., 0.61176, 0.25098, 1.)), 0.04); // overlay 10./255.
c6 = normal(c6, multiply(c6, t0), 0.262); // multiply 67./255.
c6 = level1c(level0c(c6,curve),curve);
gl_FragColor = c6;
// end
}

@ -1,46 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2; //edgeBurn
uniform sampler2D inputImageTexture3; //hefeMap
uniform sampler2D inputImageTexture4; //hefeGradientMap
uniform sampler2D inputImageTexture5; //hefeSoftLight
uniform sampler2D inputImageTexture6; //hefeMetal
uniform float strength;
void main()
{
vec4 originColor = texture2D(inputImageTexture, textureCoordinate);
vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;
vec3 edge = texture2D(inputImageTexture2, textureCoordinate).rgb;
texel = texel * edge;
texel = vec3(
texture2D(inputImageTexture3, vec2(texel.r, .16666)).r,
texture2D(inputImageTexture3, vec2(texel.g, .5)).g,
texture2D(inputImageTexture3, vec2(texel.b, .83333)).b);
vec3 luma = vec3(.30, .59, .11);
vec3 gradSample = texture2D(inputImageTexture4, vec2(dot(luma, texel), .5)).rgb;
vec3 final = vec3(
texture2D(inputImageTexture5, vec2(gradSample.r, texel.r)).r,
texture2D(inputImageTexture5, vec2(gradSample.g, texel.g)).g,
texture2D(inputImageTexture5, vec2(gradSample.b, texel.b)).b
);
vec3 metal = texture2D(inputImageTexture6, textureCoordinate).rgb;
vec3 metaled = vec3(
texture2D(inputImageTexture5, vec2(metal.r, texel.r)).r,
texture2D(inputImageTexture5, vec2(metal.g, texel.g)).g,
texture2D(inputImageTexture5, vec2(metal.b, texel.b)).b
);
metaled.rgb = mix(originColor.rgb, metaled.rgb, strength);
gl_FragColor = vec4(metaled, 1.0);
}

@ -1,35 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2; //blowout;
uniform sampler2D inputImageTexture3; //overlay;
uniform sampler2D inputImageTexture4; //map
uniform float strength;
void main()
{
vec4 originColor = texture2D(inputImageTexture, textureCoordinate);
vec4 texel = texture2D(inputImageTexture, textureCoordinate);
vec3 bbTexel = texture2D(inputImageTexture2, textureCoordinate).rgb;
texel.r = texture2D(inputImageTexture3, vec2(bbTexel.r, texel.r)).r;
texel.g = texture2D(inputImageTexture3, vec2(bbTexel.g, texel.g)).g;
texel.b = texture2D(inputImageTexture3, vec2(bbTexel.b, texel.b)).b;
vec4 mapped;
mapped.r = texture2D(inputImageTexture4, vec2(texel.r, .16666)).r;
mapped.g = texture2D(inputImageTexture4, vec2(texel.g, .5)).g;
mapped.b = texture2D(inputImageTexture4, vec2(texel.b, .83333)).b;
mapped.a = 1.0;
mapped.rgb = mix(originColor.rgb, mapped.rgb, strength);
gl_FragColor = mapped;
}

@ -1,43 +0,0 @@
precision highp float;
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform mediump float hueAdjust;
const highp vec4 kRGBToYPrime = vec4 (0.299, 0.587, 0.114, 0.0);
const highp vec4 kRGBToI = vec4 (0.595716, -0.274453, -0.321263, 0.0);
const highp vec4 kRGBToQ = vec4 (0.211456, -0.522591, 0.31135, 0.0);
const highp vec4 kYIQToR = vec4 (1.0, 0.9563, 0.6210, 0.0);
const highp vec4 kYIQToG = vec4 (1.0, -0.2721, -0.6474, 0.0);
const highp vec4 kYIQToB = vec4 (1.0, -1.1070, 1.7046, 0.0);
void main () {
// Sample the input pixel
highp vec4 color = texture2D(inputImageTexture, textureCoordinate);
// Convert to YIQ
highp float YPrime = dot (color, kRGBToYPrime);
highp float I = dot (color, kRGBToI);
highp float Q = dot (color, kRGBToQ);
// Calculate the hue and chroma
highp float hue = atan (Q, I);
highp float chroma = sqrt (I * I + Q * Q);
// Make the user's adjustments
hue += (-hueAdjust); //why negative rotation?
// Convert back to YIQ
Q = chroma * sin (hue);
I = chroma * cos (hue);
// Convert back to RGB
highp vec4 yIQ = vec4 (YPrime, I, Q, 0.0);
color.r = dot (yIQ, kYIQToR);
color.g = dot (yIQ, kYIQToG);
color.b = dot (yIQ, kYIQToB);
// Save the result
gl_FragColor = color;
}

@ -1,16 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2;
void main()
{
vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;
texel = vec3(dot(vec3(0.3, 0.6, 0.1), texel));
texel = vec3(texture2D(inputImageTexture2, vec2(texel.r, .16666)).r);
gl_FragColor = vec4(texel, 1.0);
}

@ -1,26 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2;
void main()
{
vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;
vec2 lookup;
lookup.y = .5;
lookup.x = texel.r;
texel.r = texture2D(inputImageTexture2, lookup).r;
lookup.x = texel.g;
texel.g = texture2D(inputImageTexture2, lookup).g;
lookup.x = texel.b;
texel.b = texture2D(inputImageTexture2, lookup).b;
gl_FragColor = vec4(texel, 1.0);
}

@ -1,163 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision highp float;
varying highp vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D curve;
vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
vec3 hsv2rgb(vec3 c)
{
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void main()
{
float GreyVal;
lowp vec4 textureColor;
lowp vec4 textureColorOri;
float xCoordinate = textureCoordinate.x;
float yCoordinate = textureCoordinate.y;
highp float redCurveValue;
highp float greenCurveValue;
highp float blueCurveValue;
textureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));
mediump vec4 base = textureColor;
mediump vec4 overlay = vec4(0.792, 0.58, 0.372, 1.0);
// step1 overlay blending
mediump float ra;
if (base.r < 0.5)
{
ra = overlay.r * base.r * 2.0;
}
else
{
ra = 1.0 - ((1.0 - base.r) * (1.0 - overlay.r) * 2.0);
}
mediump float ga;
if (base.g < 0.5)
{
ga = overlay.g * base.g * 2.0;
}
else
{
ga = 1.0 - ((1.0 - base.g) * (1.0 - overlay.g) * 2.0);
}
mediump float ba;
if (base.b < 0.5)
{
ba = overlay.b * base.b * 2.0;
}
else
{
ba = 1.0 - ((1.0 - base.b) * (1.0 - overlay.b) * 2.0);
}
textureColor = vec4(ra, ga, ba, 1.0);
textureColor = (textureColor - base) * 0.3 + base;
redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r;
greenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;
blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;
redCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).g;
greenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).g;
blueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).g;
vec3 tColor = vec3(redCurveValue, greenCurveValue, blueCurveValue);
tColor = rgb2hsv(tColor);
tColor.g = tColor.g * 0.6;
float dStrength = 1.0;
float dSatStrength = 0.2;
float dGap = 0.0;
if( tColor.r >= 0.0 && tColor.r < 0.417)
{
tColor.g = tColor.g + (tColor.g * dSatStrength);
}
else if( tColor.r > 0.958 && tColor.r <= 1.0)
{
tColor.g = tColor.g + (tColor.g * dSatStrength);
}
else if( tColor.r >= 0.875 && tColor.r <= 0.958)
{
dGap = abs(tColor.r - 0.875);
dStrength = (dGap / 0.0833);
tColor.g = tColor.g + (tColor.g * dSatStrength * dStrength);
}
else if( tColor.r >= 0.0417 && tColor.r <= 0.125)
{
dGap = abs(tColor.r - 0.125);
dStrength = (dGap / 0.0833);
tColor.g = tColor.g + (tColor.g * dSatStrength * dStrength);
}
tColor = hsv2rgb(tColor);
tColor = clamp(tColor, 0.0, 1.0);
redCurveValue = texture2D(curve, vec2(tColor.r, 1.0)).r;
greenCurveValue = texture2D(curve, vec2(tColor.g, 1.0)).r;
blueCurveValue = texture2D(curve, vec2(tColor.b, 1.0)).r;
base = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
overlay = vec4(0.792, 0.494, 0.372, 1.0);
// step5 overlay blending
if (base.r < 0.5)
{
ra = overlay.r * base.r * 2.0;
}
else
{
ra = 1.0 - ((1.0 - base.r) * (1.0 - overlay.r) * 2.0);
}
if (base.g < 0.5)
{
ga = overlay.g * base.g * 2.0;
}
else
{
ga = 1.0 - ((1.0 - base.g) * (1.0 - overlay.g) * 2.0);
}
if (base.b < 0.5)
{
ba = overlay.b * base.b * 2.0;
}
else
{
ba = 1.0 - ((1.0 - base.b) * (1.0 - overlay.b) * 2.0);
}
textureColor = vec4(ra, ga, ba, 1.0);
textureColor = (textureColor - base) * 0.15 + base;
gl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);
}

@ -1,29 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2;
uniform sampler2D inputImageTexture3;
uniform float strength;
void main()
{
vec4 originColor = vec4(0.2,0.6,0.9,1.0);
vec3 texel;
vec2 tc = (2.0 * textureCoordinate) - 1.0;
float d = dot(tc, tc);
vec2 lookup = vec2(d, originColor.r);
texel.r = texture2D(inputImageTexture3, lookup).r;
lookup.y = originColor.g;
texel.g = texture2D(inputImageTexture3, lookup).g;
lookup.y = originColor.b;
texel.b = texture2D(inputImageTexture3, lookup).b;
texel.rgb = mix(originColor.rgb, texel.rgb, strength);
gl_FragColor = vec4(texel,1.0);
}

@ -1,33 +0,0 @@
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform sampler2D inputImageTexture2; // lookup texture\n" +
void main() {
lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" +
mediump float blueColor = textureColor.b * 63.0;
mediump vec2 quad1;
quad1.y = floor(floor(blueColor) / 8.0);
quad1.x = floor(blueColor) - (quad1.y * 8.0);
mediump vec2 quad2;\n" +
quad2.y = floor(ceil(blueColor) / 8.0);\n" +
quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n" +
highp vec2 texPos1;
texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
highp vec2 texPos2;\n" +
texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
lowp vec4 newColor1 = texture2D(inputImageTexture2, texPos1);
lowp vec4 newColor2 = texture2D(inputImageTexture2, texPos2);
lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));
gl_FragColor = vec4(newColor.rgb, textureColor.w);
}

@ -1,19 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2;
void main()
{
vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;
texel = vec3(
texture2D(inputImageTexture2, vec2(texel.r, .16666)).r,
texture2D(inputImageTexture2, vec2(texel.g, .5)).g,
texture2D(inputImageTexture2, vec2(texel.b, .83333)).b);
gl_FragColor = vec4(texel, 1.0);
}

@ -1,18 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2;
void main()
{
vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;
texel = vec3(
texture2D(inputImageTexture2, vec2(texel.r, .16666)).r,
texture2D(inputImageTexture2, vec2(texel.g, .5)).g,
texture2D(inputImageTexture2, vec2(texel.b, .83333)).b);
gl_FragColor = vec4(texel, 1.0);
}

@ -1,108 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision highp float;
varying highp vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D curve;
uniform sampler2D curve2;
uniform highp float texelWidthOffset;
uniform highp float texelHeightOffset;
uniform highp float blurSize;
vec4 OverlayBlendingVec4(vec4 down, vec4 up, float fAlpha)
{
if ( down.r < 0.5 )
{
up.r = up.r * down.r * 2.0;
}
else
{
up.r = 1.0 - ( ( 1.0 - down.r) * ( 1.0 - up.r ) * 2.0 );
}
if ( down.g < 0.5 )
{
up.g = up.g * down.g * 2.0;
}
else
{
up.g = 1.0 - ( ( 1.0 - down.g) * ( 1.0 - up.g ) * 2.0 );
}
if ( down.b < 0.5 )
{
up.b = up.b * down.b * 2.0;
}
else
{
up.b = 1.0 - ( ( 1.0 - down.b) * ( 1.0 - up.b ) * 2.0 );
}
down = ( up - down ) * fAlpha + down;
return down;
}
void main()
{
float xCoordinate = textureCoordinate.x;
float yCoordinate = textureCoordinate.y;
vec4 textureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));
highp vec2 firstOffset = vec2(1.3846153846 * texelWidthOffset, 1.3846153846 * texelHeightOffset) * blurSize;
highp vec2 secondOffset = vec2(3.2307692308 * texelWidthOffset, 3.2307692308 * texelHeightOffset) * blurSize;
highp vec2 centerTextureCoordinate = vec2(xCoordinate, yCoordinate);
highp vec2 oneStepLeftTextureCoordinate = vec2(xCoordinate, yCoordinate) - firstOffset;
highp vec2 twoStepsLeftTextureCoordinate = vec2(xCoordinate, yCoordinate) - secondOffset;
highp vec2 oneStepRightTextureCoordinate = vec2(xCoordinate, yCoordinate) + firstOffset;
highp vec2 twoStepsRightTextureCoordinate = vec2(xCoordinate, yCoordinate) + secondOffset;
lowp vec4 fragmentColor = texture2D(inputImageTexture, vec2(centerTextureCoordinate.x, centerTextureCoordinate.y)) * 0.2270270270;
fragmentColor += texture2D(inputImageTexture, vec2(oneStepLeftTextureCoordinate.x, oneStepLeftTextureCoordinate.y)) * 0.3162162162;
fragmentColor += texture2D(inputImageTexture, vec2(oneStepRightTextureCoordinate.x, oneStepRightTextureCoordinate.y)) * 0.3162162162;
fragmentColor += texture2D(inputImageTexture, vec2(twoStepsLeftTextureCoordinate.x, twoStepsLeftTextureCoordinate.y)) * 0.0702702703;
fragmentColor += texture2D(inputImageTexture, vec2(twoStepsRightTextureCoordinate.x, twoStepsRightTextureCoordinate.y)) * 0.0702702703;
lowp vec4 blurColor = fragmentColor;
// step1 ScreenBlending
blurColor = 1.0 - ((1.0 - textureColor) * (1.0 - blurColor));
blurColor = clamp(blurColor, 0.0, 1.0);
textureColor = (blurColor - textureColor) * 0.7 + textureColor;
textureColor = clamp(textureColor, 0.0, 1.0);
// step2 OverlayBlending
textureColor = OverlayBlendingVec4(textureColor, vec4(0.0, 0.0, 0.0, 1.0), 0.3);
textureColor = clamp(textureColor, vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0));
// step3 curve
highp float redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r;
highp float greenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;
highp float blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;
// step4 curve
redCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).r;
greenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).r;
blueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).r;
// step5 level
redCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).g;
greenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).g;
blueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).g;
// step6 curve
redCurveValue = texture2D(curve2, vec2(redCurveValue, 1.0)).r;
greenCurveValue = texture2D(curve2, vec2(greenCurveValue, 1.0)).g;
blueCurveValue = texture2D(curve2, vec2(blueCurveValue, 1.0)).b;
// step7 curve
redCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).b;
greenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).b;
blueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).b;
lowp vec4 BCSColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
gl_FragColor = vec4(BCSColor.r,BCSColor.g,BCSColor.b,1.0);
}

@ -1,137 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2;
uniform float strength;
// gray
float NCGray(vec4 color)
{
float gray = 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b;
return gray;
}
// tone mapping
vec4 NCTonemapping(vec4 color)
{
vec4 mapped;
mapped.r = texture2D(inputImageTexture2, vec2(color.r, 0.0)).r;
mapped.g = texture2D(inputImageTexture2, vec2(color.g, 0.0)).g;
mapped.b = texture2D(inputImageTexture2, vec2(color.b, 0.0)).b;
mapped.a = color.a;
return mapped;
}
// color control
vec4 NCColorControl(vec4 color, float saturation, float brightness, float contrast)
{
float gray = NCGray(color);
color.rgb = vec3(saturation) * color.rgb + vec3(1.0-saturation) * vec3(gray);
color.r = clamp(color.r, 0.0, 1.0);
color.g = clamp(color.g, 0.0, 1.0);
color.b = clamp(color.b, 0.0, 1.0);
color.rgb = vec3(contrast) * (color.rgb - vec3(0.5)) + vec3(0.5);
color.r = clamp(color.r, 0.0, 1.0);
color.g = clamp(color.g, 0.0, 1.0);
color.b = clamp(color.b, 0.0, 1.0);
color.rgb = color.rgb + vec3(brightness);
color.r = clamp(color.r, 0.0, 1.0);
color.g = clamp(color.g, 0.0, 1.0);
color.b = clamp(color.b, 0.0, 1.0);
return color;
}
// hue adjust
vec4 NCHueAdjust(vec4 color, float hueAdjust)
{
vec3 kRGBToYPrime = vec3(0.299, 0.587, 0.114);
vec3 kRGBToI = vec3(0.595716, -0.274453, -0.321263);
vec3 kRGBToQ = vec3(0.211456, -0.522591, 0.31135);
vec3 kYIQToR = vec3(1.0, 0.9563, 0.6210);
vec3 kYIQToG = vec3(1.0, -0.2721, -0.6474);
vec3 kYIQToB = vec3(1.0, -1.1070, 1.7046);
float yPrime = dot(color.rgb, kRGBToYPrime);
float I = dot(color.rgb, kRGBToI);
float Q = dot(color.rgb, kRGBToQ);
float hue = atan(Q, I);
float chroma = sqrt (I * I + Q * Q);
hue -= hueAdjust;
Q = chroma * sin (hue);
I = chroma * cos (hue);
color.r = dot(vec3(yPrime, I, Q), kYIQToR);
color.g = dot(vec3(yPrime, I, Q), kYIQToG);
color.b = dot(vec3(yPrime, I, Q), kYIQToB);
return color;
}
// colorMatrix
vec4 NCColorMatrix(vec4 color, float red, float green, float blue, float alpha, vec4 bias)
{
color = color * vec4(red, green, blue, alpha) + bias;
return color;
}
// multiply blend
vec4 NCMultiplyBlend(vec4 overlay, vec4 base)
{
vec4 outputColor;
float a = overlay.a + base.a * (1.0 - overlay.a);
// // normal blend
// outputColor.r = (base.r * base.a + overlay.r * overlay.a * (1.0 - base.a))/a;
// outputColor.g = (base.g * base.a + overlay.g * overlay.a * (1.0 - base.a))/a;
// outputColor.b = (base.b * base.a + overlay.b * overlay.a * (1.0 - base.a))/a;
// multiply blend
outputColor.rgb = ((1.0-base.a) * overlay.rgb * overlay.a + (1.0-overlay.a) * base.rgb * base.a + overlay.a * base.a * overlay.rgb * base.rgb) / a;
outputColor.a = a;
return outputColor;
}
void main()
{
vec4 originColor = texture2D(inputImageTexture, textureCoordinate);
vec4 color = texture2D(inputImageTexture, textureCoordinate);
color.a = 1.0;
// tone mapping
color.r = texture2D(inputImageTexture2, vec2(color.r, 0.0)).r;
color.g = texture2D(inputImageTexture2, vec2(color.g, 0.0)).g;
color.b = texture2D(inputImageTexture2, vec2(color.b, 0.0)).b;
// color control
color = NCColorControl(color, 1.0, 0.08, 1.0);
// hue adjust
color = NCHueAdjust(color, 0.0556);
// color matrix
color = NCColorMatrix(color, 1.0, 1.0, 1.0, 1.0, vec4(0.02, 0.02, 0.06, 0));
color.rgb = mix(originColor.rgb, color.rgb, strength);
gl_FragColor = color;
}

@ -1,33 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2; //blowout;
uniform sampler2D inputImageTexture3; //overlay;
uniform sampler2D inputImageTexture4; //map
uniform float strength;
void main()
{
vec4 originColor = texture2D(inputImageTexture, textureCoordinate);
vec4 texel = texture2D(inputImageTexture, textureCoordinate);
vec3 bbTexel = texture2D(inputImageTexture2, textureCoordinate).rgb;
texel.r = texture2D(inputImageTexture3, vec2(bbTexel.r, texel.r)).r;
texel.g = texture2D(inputImageTexture3, vec2(bbTexel.g, texel.g)).g;
texel.b = texture2D(inputImageTexture3, vec2(bbTexel.b, texel.b)).b;
vec4 mapped;
mapped.r = texture2D(inputImageTexture4, vec2(texel.r, .16666)).r;
mapped.g = texture2D(inputImageTexture4, vec2(texel.g, .5)).g;
mapped.b = texture2D(inputImageTexture4, vec2(texel.b, .83333)).b;
mapped.a = 1.0;
mapped.rgb = mix(originColor.rgb, mapped.rgb, strength);
gl_FragColor = mapped;
}

@ -1,50 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision highp float;
varying highp vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D curve;
void main()
{
lowp vec4 textureColor;
lowp vec4 textureColorRes;
lowp vec4 textureColorOri;
vec4 grey1Color;
vec4 layerColor;
mediump float satVal = 115.0 / 100.0;
float xCoordinate = textureCoordinate.x;
float yCoordinate = textureCoordinate.y;
highp float redCurveValue;
highp float greenCurveValue;
highp float blueCurveValue;
textureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));
textureColorRes = textureColor;
textureColorOri = textureColor;
// step1. screen blending
textureColor = 1.0 - ((1.0 - textureColorOri) * (1.0 - textureColorOri));
textureColor = (textureColor - textureColorOri) + textureColorOri;
// step2. curve
redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r;
greenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;
blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;
// step3. saturation
highp float G = (redCurveValue + greenCurveValue + blueCurveValue);
G = G / 3.0;
redCurveValue = ((1.0 - satVal) * G + satVal * redCurveValue);
greenCurveValue = ((1.0 - satVal) * G + satVal * greenCurveValue);
blueCurveValue = ((1.0 - satVal) * G + satVal * blueCurveValue);
textureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
gl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);
}

@ -1,71 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D curve;
uniform float texelWidthOffset;
uniform float texelHeightOffset;
varying mediump vec2 textureCoordinate;
vec4 gaussianBlur(sampler2D sampler) {
lowp float strength = 1.;
vec4 color = vec4(0.);
vec2 step = vec2(0.);
color += texture2D(sampler,textureCoordinate)* 0.25449 ;
step.x = 1.37754 * texelWidthOffset * strength;
step.y = 1.37754 * texelHeightOffset * strength;
color += texture2D(sampler,textureCoordinate+step) * 0.24797;
color += texture2D(sampler,textureCoordinate-step) * 0.24797;
step.x = 3.37754 * texelWidthOffset * strength;
step.y = 3.37754 * texelHeightOffset * strength;
color += texture2D(sampler,textureCoordinate+step) * 0.09122;
color += texture2D(sampler,textureCoordinate-step) * 0.09122;
step.x = 5.37754 * texelWidthOffset * strength;
step.y = 5.37754 * texelHeightOffset * strength;
color += texture2D(sampler,textureCoordinate+step) * 0.03356;
color += texture2D(sampler,textureCoordinate-step) * 0.03356;
return color;
}
vec4 overlay(vec4 c1, vec4 c2){
vec4 r1 = vec4(0.,0.,0.,1.);
r1.r = c1.r < 0.5 ? 2.0*c1.r*c2.r : 1.0 - 2.0*(1.0-c1.r)*(1.0-c2.r);
r1.g = c1.g < 0.5 ? 2.0*c1.g*c2.g : 1.0 - 2.0*(1.0-c1.g)*(1.0-c2.g);
r1.b = c1.b < 0.5 ? 2.0*c1.b*c2.b : 1.0 - 2.0*(1.0-c1.b)*(1.0-c2.b);
return r1;
}
vec4 level0c(vec4 color, sampler2D sampler) {
color.r = texture2D(sampler, vec2(color.r, 0.)).r;
color.g = texture2D(sampler, vec2(color.g, 0.)).r;
color.b = texture2D(sampler, vec2(color.b, 0.)).r;
return color;
}
vec4 normal(vec4 c1, vec4 c2, float alpha) {
return (c2-c1) * alpha + c1;
}
vec4 screen(vec4 c1, vec4 c2) {
vec4 r1 = vec4(1.) - ((vec4(1.) - c1) * (vec4(1.) - c2));
return r1;
}
void main() {
// naver skin
lowp vec4 c0 = texture2D(inputImageTexture, textureCoordinate);
lowp vec4 c1 = gaussianBlur(inputImageTexture);
lowp vec4 c2 = overlay(c0, level0c(c1, curve));
lowp vec4 c3 = normal(c0,c2,0.15);
gl_FragColor = c3;
}

@ -1,15 +0,0 @@
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform lowp float saturation;
// Values from \"Graphics Shaders: Theory and Practice\" by Bailey and Cunningham
const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);
void main() {
lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
lowp float luminance = dot(textureColor.rgb, luminanceWeighting);
lowp vec3 greyScaleColor = vec3(luminance);
gl_FragColor = vec4(mix(greyScaleColor, textureColor.rgb, saturation), textureColor.w);
}

@ -1,22 +0,0 @@
precision highp float;
varying highp vec2 textureCoordinate;
varying highp vec2 leftTextureCoordinate;
varying highp vec2 rightTextureCoordinate;
varying highp vec2 topTextureCoordinate;
varying highp vec2 bottomTextureCoordinate;
varying highp float centerMultiplier;
varying highp float edgeMultiplier;
uniform sampler2D inputImageTexture;
void main() {
mediump vec3 textureColor = texture2D(inputImageTexture, textureCoordinate).rgb;
mediump vec3 leftTextureColor = texture2D(inputImageTexture, leftTextureCoordinate).rgb;
mediump vec3 rightTextureColor = texture2D(inputImageTexture, rightTextureCoordinate).rgb;
mediump vec3 topTextureColor = texture2D(inputImageTexture, topTextureCoordinate).rgb;
mediump vec3 bottomTextureColor = texture2D(inputImageTexture, bottomTextureCoordinate).rgb;
gl_FragColor = vec4((textureColor * centerMultiplier - (leftTextureColor * edgeMultiplier + rightTextureColor * edgeMultiplier + topTextureColor * edgeMultiplier + bottomTextureColor * edgeMultiplier)), texture2D(inputImageTexture, bottomTextureCoordinate).w);
}

@ -1,32 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying mediump vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D inputImageTexture2; //blowout;
uniform sampler2D inputImageTexture3; //overlay;
uniform sampler2D inputImageTexture4; //map
uniform float strength;
void main()
{
vec4 originColor = texture2D(inputImageTexture, textureCoordinate);
vec4 texel = texture2D(inputImageTexture, textureCoordinate);
vec3 bbTexel = texture2D(inputImageTexture2, textureCoordinate).rgb;
texel.r = texture2D(inputImageTexture3, vec2(bbTexel.r, texel.r)).r;
texel.g = texture2D(inputImageTexture3, vec2(bbTexel.g, texel.g)).g;
texel.b = texture2D(inputImageTexture3, vec2(bbTexel.b, texel.b)).b;
vec4 mapped;
mapped.r = texture2D(inputImageTexture4, vec2(texel.r, .16666)).r;
mapped.g = texture2D(inputImageTexture4, vec2(texel.g, .5)).g;
mapped.b = texture2D(inputImageTexture4, vec2(texel.b, .83333)).b;
mapped.a = 1.0;
mapped.rgb = mix(originColor.rgb, mapped.rgb, strength);
gl_FragColor = mapped;
}

@ -1,49 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision mediump float;
varying highp vec2 textureCoordinate;
uniform samplerExternalOES inputImageTexture;
uniform vec2 singleStepOffset;
uniform float strength;
const highp vec3 W = vec3(0.299,0.587,0.114);
void main()
{
float threshold = 0.0;
//pic1
vec4 oralColor = texture2D(inputImageTexture, textureCoordinate);
//pic2
vec3 maxValue = vec3(0.,0.,0.);
for(int i = -2; i<=2; i++)
{
for(int j = -2; j<=2; j++)
{
vec4 tempColor = texture2D(inputImageTexture, textureCoordinate+singleStepOffset*vec2(i,j));
maxValue.r = max(maxValue.r,tempColor.r);
maxValue.g = max(maxValue.g,tempColor.g);
maxValue.b = max(maxValue.b,tempColor.b);
threshold += dot(tempColor.rgb, W);
}
}
//pic3
float gray1 = dot(oralColor.rgb, W);
//pic4
float gray2 = dot(maxValue, W);
//pic5
float contour = gray1 / gray2;
threshold = threshold / 25.;
float alpha = max(1.0,gray1>threshold?1.0:(gray1/threshold));
float result = contour * alpha + (1.0-alpha)*gray1;
gl_FragColor = vec4(vec3(result,result,result), oralColor.w);
}

@ -1,98 +0,0 @@
#extension GL_OES_EGL_image_external : require
precision highp float;
uniform samplerExternalOES inputImageTexture;
uniform sampler2D curve;
uniform float texelWidthOffset;
uniform float texelHeightOffset;
varying mediump vec2 textureCoordinate;
const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);
vec4 gaussianBlur(sampler2D sampler) {
lowp float strength = 1.;
vec4 color = vec4(0.);
vec2 step = vec2(0.);
color += texture2D(sampler,textureCoordinate)* 0.25449 ;
step.x = 1.37754 * texelWidthOffset * strength;
step.y = 1.37754 * texelHeightOffset * strength;
color += texture2D(sampler,textureCoordinate+step) * 0.24797;
color += texture2D(sampler,textureCoordinate-step) * 0.24797;
step.x = 3.37754 * texelWidthOffset * strength;
step.y = 3.37754 * texelHeightOffset * strength;
color += texture2D(sampler,textureCoordinate+step) * 0.09122;
color += texture2D(sampler,textureCoordinate-step) * 0.09122;
step.x = 5.37754 * texelWidthOffset * strength;
step.y = 5.37754 * texelHeightOffset * strength;
color += texture2D(sampler,textureCoordinate+step) * 0.03356;
color += texture2D(sampler,textureCoordinate-step) * 0.03356;
return color;
}
void main() {
vec4 blurColor;
lowp vec4 textureColor;
lowp float strength = -1.0 / 510.0;
float xCoordinate = textureCoordinate.x;
float yCoordinate = textureCoordinate.y;
lowp float satura = 0.7;
// naver skin
textureColor = texture2D(inputImageTexture, textureCoordinate);
blurColor = gaussianBlur(inputImageTexture);
//saturation
lowp float luminance = dot(blurColor.rgb, luminanceWeighting);
lowp vec3 greyScaleColor = vec3(luminance);
blurColor = vec4(mix(greyScaleColor, blurColor.rgb, satura), blurColor.w);
lowp float redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r;
lowp float greenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).r;
lowp float blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).r;
redCurveValue = min(1.0, redCurveValue + strength);
greenCurveValue = min(1.0, greenCurveValue + strength);
blueCurveValue = min(1.0, blueCurveValue + strength);
mediump vec4 overlay = blurColor;
mediump vec4 base = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);
//gl_FragColor = overlay;
// step4 overlay blending
mediump float ra;
if (base.r < 0.5) {
ra = overlay.r * base.r * 2.0;
} else {
ra = 1.0 - ((1.0 - base.r) * (1.0 - overlay.r) * 2.0);
}
mediump float ga;
if (base.g < 0.5) {
ga = overlay.g * base.g * 2.0;
} else {
ga = 1.0 - ((1.0 - base.g) * (1.0 - overlay.g) * 2.0);
}
mediump float ba;
if (base.b < 0.5) {
ba = overlay.b * base.b * 2.0;
} else {
ba = 1.0 - ((1.0 - base.b) * (1.0 - overlay.b) * 2.0);
}
textureColor = vec4(ra, ga, ba, 1.0);
gl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save