diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2012-06-08 14:35:13 -0700 |
---|---|---|
committer | Ruei-sung Lin <rslin@google.com> | 2012-06-13 15:51:11 -0700 |
commit | 4239373aedb5f95e7edcc3c75920eb3e265b667c (patch) | |
tree | 77a2a8de8f6a579a640118d94ef824166ccb114e /media/mca | |
parent | d772c4878e2207795e92b26a462fd02bca7e3c2e (diff) | |
download | frameworks_base-4239373aedb5f95e7edcc3c75920eb3e265b667c.zip frameworks_base-4239373aedb5f95e7edcc3c75920eb3e265b667c.tar.gz frameworks_base-4239373aedb5f95e7edcc3c75920eb3e265b667c.tar.bz2 |
Add property to override backdropper effect threshold.
Also, change the default background mean to be the first incoming frame.
Bug: 6600585
Change-Id: I2181e75711d48d01f48e3fb1d604eb467f08fda4
Diffstat (limited to 'media/mca')
-rw-r--r-- | media/mca/filterpacks/java/android/filterpacks/videoproc/BackDropperFilter.java | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/media/mca/filterpacks/java/android/filterpacks/videoproc/BackDropperFilter.java b/media/mca/filterpacks/java/android/filterpacks/videoproc/BackDropperFilter.java index 52c9fda..78f7f3e 100644 --- a/media/mca/filterpacks/java/android/filterpacks/videoproc/BackDropperFilter.java +++ b/media/mca/filterpacks/java/android/filterpacks/videoproc/BackDropperFilter.java @@ -29,6 +29,7 @@ import android.filterfw.core.ShaderProgram; import android.filterfw.format.ImageFormat; import android.opengl.GLES20; import android.os.SystemClock; +import android.os.SystemProperties; import android.util.Log; import java.lang.ArrayIndexOutOfBoundsException; @@ -510,6 +511,20 @@ public class BackDropperFilter extends Filter { super(name); mLogVerbose = Log.isLoggable(TAG, Log.VERBOSE); + + String adjStr = SystemProperties.get("ro.media.effect.bgdropper.adj"); + if (adjStr.length() > 0) { + try { + mAcceptStddev += Float.parseFloat(adjStr); + if (mLogVerbose) { + Log.v(TAG, "Adjusting accept threshold by " + adjStr + + ", now " + mAcceptStddev); + } + } catch (NumberFormatException e) { + Log.e(TAG, + "Badly formatted property ro.media.effect.bgdropper.adj: " + adjStr); + } + } } @Override @@ -695,7 +710,6 @@ public class BackDropperFilter extends Filter { mBgUpdateVarianceProgram.setHostValue("bg_adapt_rate", mAdaptRateLearning); mBgUpdateVarianceProgram.setHostValue("fg_adapt_rate", mAdaptRateLearning); mFrameCount = 0; - mStartLearning = false; } // Select correct pingpong buffers @@ -720,6 +734,11 @@ public class BackDropperFilter extends Filter { mBgInput.setTextureParameter(GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR_MIPMAP_NEAREST); + if (mStartLearning) { + copyShaderProgram.process(mVideoInput, mBgMean[inputIndex]); + mStartLearning = false; + } + // Process shaders Frame[] distInputs = { mVideoInput, mBgMean[inputIndex], mBgVariance[inputIndex] }; mBgDistProgram.process(distInputs, mDistance); @@ -765,7 +784,12 @@ public class BackDropperFilter extends Filter { ByteBuffer mMaskAverageByteBuffer = mMaskAverage.getData(); byte[] mask_average = mMaskAverageByteBuffer.array(); int bi = (int)(mask_average[3] & 0xFF); - if (mLogVerbose) Log.v(TAG, String.format("Mask_average is %d", bi)); + + if (mLogVerbose) { + Log.v(TAG, + String.format("Mask_average is %d, threshold is %d", + bi, DEFAULT_LEARNING_DONE_THRESHOLD)); + } if (bi >= DEFAULT_LEARNING_DONE_THRESHOLD) { mStartLearning = true; // Restart learning |