Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6ac85e8 authored by Ravneet Dhanjal's avatar Ravneet Dhanjal Committed by Android (Google) Code Review
Browse files

Merge "Camera: Add JPEG_R support for advanced extensions" into main

parents 53bf86a5 c404a3ce
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -847,16 +847,18 @@ public final class CameraExtensionCharacteristics {
     * of the camera resolutions advertised by
     * {@link StreamConfigurationMap#getOutputSizes}.</p>
     *
     * <p>Device-specific extensions currently support at most two
     * <p>Device-specific extensions currently support at most three
     * multi-frame capture surface formats. ImageFormat.JPEG will be supported by all
     * extensions and ImageFormat.YUV_420_888 may or may not be supported.</p>
     * extensions while ImageFormat.YUV_420_888 and ImageFormat.JPEG_R may or may not be
     * supported.</p>
     *
     * @param extension the extension type
     * @param format    device-specific extension output format
     * @return non-modifiable list of available sizes or an empty list if the format is not
     * supported.
     * @throws IllegalArgumentException in case of format different from ImageFormat.JPEG /
     *                                  ImageFormat.YUV_420_888; or unsupported extension.
     * @throws IllegalArgumentException in case of format different from ImageFormat.JPEG,
     *                                  ImageFormat.YUV_420_888, ImageFormat.JPEG_R; or
     *                                  unsupported extension.
     */
    public @NonNull
    List<Size> getExtensionSupportedSizes(@Extension int extension, int format) {
@@ -940,14 +942,16 @@ public final class CameraExtensionCharacteristics {
     * @param format            device-specific extension output format
     * @return the range of estimated minimal and maximal capture latency in milliseconds
     * or null if no capture latency info can be provided
     * @throws IllegalArgumentException in case of format different from {@link ImageFormat#JPEG} /
     *                                  {@link ImageFormat#YUV_420_888}; or unsupported extension.
     * @throws IllegalArgumentException in case of format different from {@link ImageFormat#JPEG},
     *                                  {@link ImageFormat#YUV_420_888}, {@link ImageFormat#JPEG_R};
     *                                  or unsupported extension.
     */
    public @Nullable Range<Long> getEstimatedCaptureLatencyRangeMillis(@Extension int extension,
            @NonNull Size captureOutputSize, @ImageFormat.Format int format) {
        switch (format) {
            case ImageFormat.YUV_420_888:
            case ImageFormat.JPEG:
            case ImageFormat.JPEG_R:
                //No op
                break;
            default:
@@ -994,6 +998,10 @@ public final class CameraExtensionCharacteristics {
                    // specific and cannot be estimated accurately enough.
                    return  null;
                }
                if (format == ImageFormat.JPEG_R) {
                    // JpegR/UltraHDR is not supported for basic extensions
                    return null;
                }

                LatencyRange latencyRange = extenders.second.getEstimatedCaptureLatencyRange(sz);
                if (latencyRange != null) {
+12 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import android.hardware.camera2.extension.Request;
import android.hardware.camera2.extension.SizeList;
import android.hardware.camera2.impl.CameraMetadataNative;
import android.hardware.camera2.impl.PhysicalCaptureResultInfo;
import android.hardware.camera2.utils.SurfaceUtils;
import android.media.Image;
import android.media.ImageReader;
import android.os.Binder;
@@ -1691,11 +1692,17 @@ public class CameraExtensionsProxyService extends Service {
        private final Surface mSurface;
        private final Size mSize;
        private final int mImageFormat;
        private final int mDataspace;

        public OutputSurfaceImplStub(OutputSurface outputSurface) {
            mSurface = outputSurface.surface;
            mSize = new Size(outputSurface.size.width, outputSurface.size.height);
            mImageFormat = outputSurface.imageFormat;
            if (mSurface != null) {
                mDataspace = SurfaceUtils.getSurfaceDataspace(mSurface);
            } else {
                mDataspace = -1;
            }
        }

        @Override
@@ -1712,6 +1719,11 @@ public class CameraExtensionsProxyService extends Service {
        public int getImageFormat() {
            return mImageFormat;
        }

        @Override
        public int getDataspace() {
            return mDataspace;
        }
    }

    private class PreviewExtenderImplStub extends IPreviewExtenderImpl.Stub implements