Camera: Populate Image tranformation in reader and writer

"ImageReader" and "ImageWriter" must pass information about the
specific buffer transformation.
Currently only the "ImageReader" implementation of the
"android.media.Image" abstract classs will populate the
corresponding transformation, the remaining implementations will
use the default identity tranformation.

Bug: 75316204
Test: Manual using test application,
Camera CTS

Change-Id: If5c12134fbbef8cc20c3d369986ba613bc4f2cec
This commit is contained in:
Emilian Peev
2018-03-19 16:05:10 +00:00
parent b7ad5e429f
commit 450a5ffdfd
6 changed files with 67 additions and 9 deletions

View File

@@ -371,7 +371,7 @@ public class ImageWriter implements AutoCloseable {
Rect crop = image.getCropRect();
nativeQueueInputImage(mNativeContext, image, image.getTimestamp(), crop.left, crop.top,
crop.right, crop.bottom);
crop.right, crop.bottom, image.getTransform());
/**
* Only remove and cleanup the Images that are owned by this
@@ -557,7 +557,8 @@ public class ImageWriter implements AutoCloseable {
// buffer caused leak.
Rect crop = image.getCropRect();
nativeAttachAndQueueImage(mNativeContext, image.getNativeContext(), image.getFormat(),
image.getTimestamp(), crop.left, crop.top, crop.right, crop.bottom);
image.getTimestamp(), crop.left, crop.top, crop.right, crop.bottom,
image.getTransform());
}
/**
@@ -674,6 +675,8 @@ public class ImageWriter implements AutoCloseable {
private final long DEFAULT_TIMESTAMP = Long.MIN_VALUE;
private long mTimestamp = DEFAULT_TIMESTAMP;
private int mTransform = 0; //Default no transform
public WriterSurfaceImage(ImageWriter writer) {
mOwner = writer;
}
@@ -710,6 +713,13 @@ public class ImageWriter implements AutoCloseable {
return mHeight;
}
@Override
public int getTransform() {
throwISEIfImageIsInvalid();
return mTransform;
}
@Override
public long getTimestamp() {
throwISEIfImageIsInvalid();
@@ -856,11 +866,11 @@ public class ImageWriter implements AutoCloseable {
private synchronized native void nativeDequeueInputImage(long nativeCtx, Image wi);
private synchronized native void nativeQueueInputImage(long nativeCtx, Image image,
long timestampNs, int left, int top, int right, int bottom);
long timestampNs, int left, int top, int right, int bottom, int transform);
private synchronized native int nativeAttachAndQueueImage(long nativeCtx,
long imageNativeBuffer, int imageFormat, long timestampNs, int left,
int top, int right, int bottom);
int top, int right, int bottom, int transform);
private synchronized native void cancelImage(long nativeCtx, Image image);