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

Commit 546a0444 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "JpegRCompositeStream"

* changes:
  Camera: call encodeJPEGR method in libjpegrecoverymap
  Camera: Add support Jpeg/R output
parents ce46f0a5 8a533b73
Loading
Loading
Loading
Loading
+160 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ typedef enum acamera_metadata_section {
    ACAMERA_AUTOMOTIVE,
    ACAMERA_AUTOMOTIVE_LENS,
    ACAMERA_EXTENSION,
    ACAMERA_JPEGR,
    ACAMERA_SECTION_COUNT,
    ACAMERA_VENDOR = 0x8000
@@ -121,6 +122,7 @@ typedef enum acamera_metadata_section_start {
    ACAMERA_AUTOMOTIVE_START       = ACAMERA_AUTOMOTIVE        << 16,
    ACAMERA_AUTOMOTIVE_LENS_START  = ACAMERA_AUTOMOTIVE_LENS   << 16,
    ACAMERA_EXTENSION_START        = ACAMERA_EXTENSION         << 16,
    ACAMERA_JPEGR_START            = ACAMERA_JPEGR             << 16,
    ACAMERA_VENDOR_START           = ACAMERA_VENDOR            << 16
} acamera_metadata_section_start_t;
@@ -7513,6 +7515,145 @@ typedef enum acamera_metadata_tag {
            ACAMERA_AUTOMOTIVE_LENS_START,
    ACAMERA_AUTOMOTIVE_LENS_END,
    /**
     * <p>The available Jpeg/R stream
     * configurations that this camera device supports
     * (i.e. format, width, height, output/input stream).</p>
     *
     * <p>Type: int32[n*4] (acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t)</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
     * </ul></p>
     *
     * <p>The configurations are listed as <code>(format, width, height, input?)</code> tuples.</p>
     * <p>If the camera device supports Jpeg/R, it will support the same stream combinations with
     * Jpeg/R as it does with P010. The stream combinations with Jpeg/R (or P010) supported
     * by the device is determined by the device's hardware level and capabilities.</p>
     * <p>All the static, control, and dynamic metadata tags related to JPEG apply to Jpeg/R formats.
     * Configuring JPEG and Jpeg/R streams at the same time is not supported.</p>
     * <p>All the configuration tuples <code>(format, width, height, input?)</code> will contain
     * AIMAGE_FORMAT_JPEGR format as OUTPUT only.</p>
     */
    ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS =      // int32[n*4] (acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t)
            ACAMERA_JPEGR_START,
    /**
     * <p>This lists the minimum frame duration for each
     * format/size combination for Jpeg/R output formats.</p>
     *
     * <p>Type: int64[4*n]</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
     * </ul></p>
     *
     * <p>This should correspond to the frame duration when only that
     * stream is active, with all processing (typically in android.*.mode)
     * set to either OFF or FAST.</p>
     * <p>When multiple streams are used in a request, the minimum frame
     * duration will be max(individual stream min durations).</p>
     * <p>See ACAMERA_SENSOR_FRAME_DURATION and
     * ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS for more details about
     * calculating the max frame rate.</p>
     *
     * @see ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS
     * @see ACAMERA_SENSOR_FRAME_DURATION
     */
    ACAMERA_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS =        // int64[4*n]
            ACAMERA_JPEGR_START + 1,
    /**
     * <p>This lists the maximum stall duration for each
     * output format/size combination for Jpeg/R streams.</p>
     *
     * <p>Type: int64[4*n]</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
     * </ul></p>
     *
     * <p>A stall duration is how much extra time would get added
     * to the normal minimum frame duration for a repeating request
     * that has streams with non-zero stall.</p>
     * <p>This functions similarly to
     * ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS for Jpeg/R
     * streams.</p>
     * <p>All Jpeg/R output stream formats may have a nonzero stall
     * duration.</p>
     *
     * @see ACAMERA_SCALER_AVAILABLE_STALL_DURATIONS
     */
    ACAMERA_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS =            // int64[4*n]
            ACAMERA_JPEGR_START + 2,
    /**
     * <p>The available Jpeg/R stream
     * configurations that this camera device supports
     * (i.e. format, width, height, output/input stream).</p>
     *
     * <p>Type: int32[n*4] (acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t)</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
     * </ul></p>
     *
     * <p>Refer to ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS for details.</p>
     * <p>All the configuration tuples <code>(format, width, height, input?)</code> will contain
     * AIMAGE_FORMAT_JPEG_R format as OUTPUT only.</p>
     *
     * @see ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS
     */
    ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 
                                                                // int32[n*4] (acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t)
            ACAMERA_JPEGR_START + 3,
    /**
     * <p>This lists the minimum frame duration for each
     * format/size combination for Jpeg/R output formats for CaptureRequests where
     * ACAMERA_SENSOR_PIXEL_MODE is set to
     * <a href="https://developer.android.com/reference/android/hardware/camera2/CameraMetadata.html#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION">CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION</a>.</p>
     *
     * @see ACAMERA_SENSOR_PIXEL_MODE
     *
     * <p>Type: int64[4*n]</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
     * </ul></p>
     *
     * <p>Refer to ACAMERA_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS for details.</p>
     *
     * @see ACAMERA_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS
     */
    ACAMERA_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 
                                                                // int64[4*n]
            ACAMERA_JPEGR_START + 4,
    /**
     * <p>This lists the maximum stall duration for each
     * output format/size combination for Jpeg/R streams for CaptureRequests where
     * ACAMERA_SENSOR_PIXEL_MODE is set to
     * <a href="https://developer.android.com/reference/android/hardware/camera2/CameraMetadata.html#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION">CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION</a>.</p>
     *
     * @see ACAMERA_SENSOR_PIXEL_MODE
     *
     * <p>Type: int64[4*n]</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
     * </ul></p>
     *
     * <p>Refer to ACAMERA_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS for details.</p>
     *
     * @see ACAMERA_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS
     */
    ACAMERA_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS_MAXIMUM_RESOLUTION = 
                                                                // int64[4*n]
            ACAMERA_JPEGR_START + 5,
    ACAMERA_JPEGR_END,
} acamera_metadata_tag_t;
/**
@@ -10991,6 +11132,25 @@ typedef enum acamera_metadata_enum_acamera_automotive_lens_facing {
// ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS
typedef enum acamera_metadata_enum_acamera_jpegr_available_jpeg_r_stream_configurations {
    ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_OUTPUT      = 0,
    ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_INPUT       = 1,
} acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_t;
// ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION
typedef enum acamera_metadata_enum_acamera_jpegr_available_jpeg_r_stream_configurations_maximum_resolution {
    ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT
                                                                      = 0,
    ACAMERA_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT
                                                                      = 1,
} acamera_metadata_enum_android_jpegr_available_jpeg_r_stream_configurations_maximum_resolution_t;
__END_DECLS
+4 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ cc_library_shared {
        "api2/DepthCompositeStream.cpp",
        "api2/HeicEncoderInfoManager.cpp",
        "api2/HeicCompositeStream.cpp",
        "api2/JpegRCompositeStream.cpp",
        "device3/BufferUtils.cpp",
        "device3/Camera3Device.cpp",
        "device3/Camera3OfflineSession.cpp",
@@ -172,6 +173,9 @@ cc_library_shared {
        "libbinderthreadstateutils",
        "media_permission-aidl-cpp",
        "libcameraservice_device_independent",
        "libjpegrecoverymap",
        "libjpegencoder",
        "libjpegdecoder",
    ],

    export_shared_lib_headers: [
+11 −4
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@

#include "DepthCompositeStream.h"
#include "HeicCompositeStream.h"
#include "JpegRCompositeStream.h"

// Convenience methods for constructing binder::Status objects for error returns

@@ -955,19 +956,24 @@ binder::Status CameraDeviceClient::createStream(
    bool isDepthCompositeStream =
            camera3::DepthCompositeStream::isDepthCompositeStream(surfaces[0]);
    bool isHeicCompisiteStream = camera3::HeicCompositeStream::isHeicCompositeStream(surfaces[0]);
    if (isDepthCompositeStream || isHeicCompisiteStream) {
    bool isJpegRCompositeStream =
        camera3::JpegRCompositeStream::isJpegRCompositeStream(surfaces[0]);
    if (isDepthCompositeStream || isHeicCompisiteStream || isJpegRCompositeStream) {
        sp<CompositeStream> compositeStream;
        if (isDepthCompositeStream) {
            compositeStream = new camera3::DepthCompositeStream(mDevice, getRemoteCallback());
        } else {
        } else if (isHeicCompisiteStream) {
            compositeStream = new camera3::HeicCompositeStream(mDevice, getRemoteCallback());
        } else {
            compositeStream = new camera3::JpegRCompositeStream(mDevice, getRemoteCallback());
        }

        err = compositeStream->createStream(surfaces, deferredConsumer, streamInfo.width,
                streamInfo.height, streamInfo.format,
                static_cast<camera_stream_rotation_t>(outputConfiguration.getRotation()),
                &streamId, physicalCameraId, streamInfo.sensorPixelModesUsed, &surfaceIds,
                outputConfiguration.getSurfaceSetID(), isShared, isMultiResolution);
                outputConfiguration.getSurfaceSetID(), isShared, isMultiResolution,
                streamInfo.colorSpace, streamInfo.dynamicRangeProfile, streamInfo.streamUseCase);
        if (err == OK) {
            Mutex::Autolock l(mCompositeLock);
            mCompositeStreamMap.add(IInterface::asBinder(surfaces[0]->getIGraphicBufferProducer()),
@@ -1823,7 +1829,8 @@ binder::Status CameraDeviceClient::switchToOffline(
        for (const auto& gbp : mConfiguredOutputs.valueAt(index).getGraphicBufferProducers()) {
            sp<Surface> s = new Surface(gbp, false /*controlledByApp*/);
            isCompositeStream = camera3::DepthCompositeStream::isDepthCompositeStream(s) ||
                camera3::HeicCompositeStream::isHeicCompositeStream(s);
                camera3::HeicCompositeStream::isHeicCompositeStream(s) ||
                camera3::JpegRCompositeStream::isJpegRCompositeStream(s);
            if (isCompositeStream) {
                auto compositeIdx = mCompositeStreamMap.indexOfKey(IInterface::asBinder(gbp));
                if (compositeIdx == NAME_NOT_FOUND) {
+4 −2
Original line number Diff line number Diff line
@@ -49,7 +49,8 @@ status_t CompositeStream::createStream(const std::vector<sp<Surface>>& consumers
        camera_stream_rotation_t rotation, int * id, const String8& physicalCameraId,
        const std::unordered_set<int32_t> &sensorPixelModesUsed,
        std::vector<int> * surfaceIds,
        int streamSetId, bool isShared, bool isMultiResolution) {
        int streamSetId, bool isShared, bool isMultiResolution, int32_t colorSpace,
        int64_t dynamicProfile, int64_t streamUseCase) {
    if (hasDeferredConsumer) {
        ALOGE("%s: Deferred consumers not supported in case of composite streams!",
                __FUNCTION__);
@@ -75,7 +76,8 @@ status_t CompositeStream::createStream(const std::vector<sp<Surface>>& consumers
    }

    return createInternalStreams(consumers, hasDeferredConsumer, width, height, format, rotation,
            id, physicalCameraId, sensorPixelModesUsed, surfaceIds, streamSetId, isShared);
            id, physicalCameraId, sensorPixelModesUsed, surfaceIds, streamSetId, isShared,
            colorSpace, dynamicProfile, streamUseCase);
}

status_t CompositeStream::deleteStream() {
+4 −2
Original line number Diff line number Diff line
@@ -46,7 +46,8 @@ public:
            camera_stream_rotation_t rotation, int *id, const String8& physicalCameraId,
            const std::unordered_set<int32_t> &sensorPixelModesUsed,
            std::vector<int> *surfaceIds,
            int streamSetId, bool isShared, bool isMultiResolution);
            int streamSetId, bool isShared, bool isMultiResolution, int32_t colorSpace,
            int64_t dynamicProfile, int64_t streamUseCase);

    status_t deleteStream();

@@ -59,7 +60,8 @@ public:
            camera_stream_rotation_t rotation, int *id, const String8& physicalCameraId,
            const std::unordered_set<int32_t> &sensorPixelModesUsed,
            std::vector<int> *surfaceIds,
            int streamSetId, bool isShared) = 0;
            int streamSetId, bool isShared, int32_t colorSpace,
            int64_t dynamicProfile, int64_t streamUseCase) = 0;

    // Release all internal streams and corresponding resources.
    virtual status_t deleteInternalStreams() = 0;
Loading