use of androidx.media.filterfw.FrameValue in project platform_frameworks_base by android.
the class ImageGoodnessFilterTest method testGreatPicture.
public void testGreatPicture() throws Exception {
FrameValue sharpnessFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
sharpnessFrame.setValue(50f);
FrameValue oEFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
oEFrame.setValue(0.01f);
FrameValue uEFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
uEFrame.setValue(0.02f);
FrameValue colorFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
colorFrame.setValue(2.1f);
FrameValue contrastFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
contrastFrame.setValue(0.25f);
FrameValue motionFrame = createFrame(FrameType.array(), new int[] { 1 }).asFrameValue();
float[] motionFloatArray = { 0.0f, 0.0f, 0.0f };
motionFrame.setValue(motionFloatArray);
injectInputFrame("sharpness", sharpnessFrame);
injectInputFrame("overExposure", oEFrame);
injectInputFrame("underExposure", uEFrame);
injectInputFrame("colorfulness", colorFrame);
injectInputFrame("contrastRating", contrastFrame);
injectInputFrame("motionValues", motionFrame);
process();
assertEquals("Great Picture!", (String) getOutputFrame("goodOrBadPic").asFrameValue().getValue());
}
use of androidx.media.filterfw.FrameValue in project platform_frameworks_base by android.
the class ImageGoodnessFilterTest method testGoodPicture.
public void testGoodPicture() throws Exception {
FrameValue sharpnessFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
sharpnessFrame.setValue(50f);
FrameValue oEFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
oEFrame.setValue(0.01f);
FrameValue uEFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
uEFrame.setValue(0.01f);
FrameValue colorFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
colorFrame.setValue(2.1f);
FrameValue contrastFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
contrastFrame.setValue(0.18f);
FrameValue motionFrame = createFrame(FrameType.array(), new int[] { 1 }).asFrameValue();
float[] motionFloatArray = { 0.0f, 0.0f, 0.0f };
motionFrame.setValue(motionFloatArray);
injectInputFrame("sharpness", sharpnessFrame);
injectInputFrame("overExposure", oEFrame);
injectInputFrame("underExposure", uEFrame);
injectInputFrame("colorfulness", colorFrame);
injectInputFrame("contrastRating", contrastFrame);
injectInputFrame("motionValues", motionFrame);
process();
assertEquals("Good Picture!", (String) getOutputFrame("goodOrBadPic").asFrameValue().getValue());
}
use of androidx.media.filterfw.FrameValue in project platform_frameworks_base by android.
the class ImageGoodnessFilterTest method testOkPicture.
public void testOkPicture() throws Exception {
FrameValue sharpnessFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
sharpnessFrame.setValue(30f);
FrameValue oEFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
oEFrame.setValue(0.39f);
FrameValue uEFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
uEFrame.setValue(0.25f);
FrameValue colorFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
colorFrame.setValue(2.1f);
FrameValue contrastFrame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
contrastFrame.setValue(0.18f);
FrameValue motionFrame = createFrame(FrameType.array(), new int[] { 1 }).asFrameValue();
float[] motionFloatArray = { 0.0f, 0.0f, 0.0f };
motionFrame.setValue(motionFloatArray);
injectInputFrame("sharpness", sharpnessFrame);
injectInputFrame("overExposure", oEFrame);
injectInputFrame("underExposure", uEFrame);
injectInputFrame("colorfulness", colorFrame);
injectInputFrame("contrastRating", contrastFrame);
injectInputFrame("motionValues", motionFrame);
process();
assertEquals("Ok Picture", (String) getOutputFrame("goodOrBadPic").asFrameValue().getValue());
}
use of androidx.media.filterfw.FrameValue in project platform_frameworks_base by android.
the class AverageFilterTest method testAverageFilter2.
public void testAverageFilter2() throws Exception {
FrameValue frame = createFrame(FrameType.single(), new int[] { 1 }).asFrameValue();
frame.setValue(4f);
injectInputFrame("sharpness", frame);
process();
assertEquals(0.8f, ((Float) getOutputFrame("avg").asFrameValue().getValue()).floatValue(), 0.001f);
}
use of androidx.media.filterfw.FrameValue in project platform_frameworks_base by android.
the class ContrastRatioFilter method onProcess.
@Override
protected void onProcess() {
FrameImage2D inputImage = getConnectedInputPort("image").pullFrame().asFrameImage2D();
float contrastRatio;
ByteBuffer inputBuffer = inputImage.lockBytes(Frame.MODE_READ);
contrastRatio = contrastOperator(inputImage.getWidth(), inputImage.getHeight(), inputBuffer);
inputImage.unlock();
if (mLogVerbose)
Log.v(TAG, "contrastRatio: " + contrastRatio);
OutputPort contrastToGoodnessPort = getConnectedOutputPort("contrastRatingToGoodness");
FrameValue contrastOutFrame2 = contrastToGoodnessPort.fetchAvailableFrame(null).asFrameValue();
contrastOutFrame2.setValue(contrastRatio);
contrastToGoodnessPort.pushFrame(contrastOutFrame2);
}
Aggregations