Search in sources :

Example 1 with StreamConfigurationDuration

use of android.hardware.camera2.params.StreamConfigurationDuration in project platform_frameworks_base by android.

the class CameraMetadataTest method testOverrideStreamConfigurationMap.

/**
     * Set the raw native value of the available stream configurations; ensure that
     * the read-out managed value is consistent with what we write in.
     */
@SmallTest
public void testOverrideStreamConfigurationMap() {
    /*
         * First, write all the raw values:
         * - availableStreamConfigurations
         * - availableMinFrameDurations
         * - availableStallDurations
         *
         * Then, read this out as a synthetic multi-key 'streamConfigurationMap'
         *
         * Finally, validate that the map was unmarshaled correctly
         * and is converting the internal formats to public formats properly.
         */
    //
    // android.scaler.availableStreamConfigurations (int x n x 4 array)
    //
    final int OUTPUT = 0;
    final int INPUT = 1;
    int[] rawAvailableStreamConfigs = new int[] { // RAW16
    0x20, // RAW16
    3280, // RAW16
    2464, // RAW16
    OUTPUT, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3264, // YCbCr_420_888
    2448, // YCbCr_420_888
    OUTPUT, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3200, // YCbCr_420_888
    2400, // YCbCr_420_888
    OUTPUT, // BLOB
    0x21, // BLOB
    3264, // BLOB
    2448, // BLOB
    OUTPUT, // BLOB
    0x21, // BLOB
    3200, // BLOB
    2400, // BLOB
    OUTPUT, // BLOB
    0x21, // BLOB
    2592, // BLOB
    1944, // BLOB
    OUTPUT, // BLOB
    0x21, // BLOB
    2048, // BLOB
    1536, // BLOB
    OUTPUT, // BLOB
    0x21, // BLOB
    1920, // BLOB
    1080, // BLOB
    OUTPUT, // IMPLEMENTATION_DEFINED
    0x22, // IMPLEMENTATION_DEFINED
    640, // IMPLEMENTATION_DEFINED
    480, // IMPLEMENTATION_DEFINED
    OUTPUT, // RAW16
    0x20, // RAW16
    320, // RAW16
    240, // RAW16
    INPUT };
    Key<StreamConfiguration[]> configKey = CameraCharacteristics.SCALER_AVAILABLE_STREAM_CONFIGURATIONS.getNativeKey();
    mMetadata.writeValues(configKey.getTag(), toByteArray(rawAvailableStreamConfigs));
    //
    // android.scaler.availableMinFrameDurations (int x n x 4 array)
    //
    long[] expectedAvailableMinDurations = new long[] { // RAW16
    0x20, // RAW16
    3280, // RAW16
    2464, // RAW16
    33333331, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3264, // YCbCr_420_888
    2448, // YCbCr_420_888
    33333332, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3200, // YCbCr_420_888
    2400, // YCbCr_420_888
    33333333, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    3264, // ImageFormat.JPEG
    2448, // ImageFormat.JPEG
    33333334, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    3200, // ImageFormat.JPEG
    2400, // ImageFormat.JPEG
    33333335, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    2592, // ImageFormat.JPEG
    1944, // ImageFormat.JPEG
    33333336, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    2048, // ImageFormat.JPEG
    1536, // ImageFormat.JPEG
    33333337, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    1920, // ImageFormat.JPEG
    1080, // ImageFormat.JPEG
    33333338 };
    long[] rawAvailableMinDurations = new long[] { // RAW16
    0x20, // RAW16
    3280, // RAW16
    2464, // RAW16
    33333331, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3264, // YCbCr_420_888
    2448, // YCbCr_420_888
    33333332, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3200, // YCbCr_420_888
    2400, // YCbCr_420_888
    33333333, // BLOB
    0x21, // BLOB
    3264, // BLOB
    2448, // BLOB
    33333334, // BLOB
    0x21, // BLOB
    3200, // BLOB
    2400, // BLOB
    33333335, // BLOB
    0x21, // BLOB
    2592, // BLOB
    1944, // BLOB
    33333336, // BLOB
    0x21, // BLOB
    2048, // BLOB
    1536, // BLOB
    33333337, // BLOB
    0x21, // BLOB
    1920, // BLOB
    1080, // BLOB
    33333338 };
    Key<StreamConfigurationDuration[]> durationKey = CameraCharacteristics.SCALER_AVAILABLE_MIN_FRAME_DURATIONS.getNativeKey();
    mMetadata.writeValues(durationKey.getTag(), toByteArray(rawAvailableMinDurations));
    //
    // android.scaler.availableStallDurations (int x n x 4 array)
    //
    long[] expectedAvailableStallDurations = new long[] { // RAW16
    0x20, // RAW16
    3280, // RAW16
    2464, // RAW16
    0, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3264, // YCbCr_420_888
    2448, // YCbCr_420_888
    0, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3200, // YCbCr_420_888
    2400, // YCbCr_420_888
    0, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    3264, // ImageFormat.JPEG
    2448, // ImageFormat.JPEG
    33333334, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    3200, // ImageFormat.JPEG
    2400, // ImageFormat.JPEG
    33333335, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    2592, // ImageFormat.JPEG
    1944, // ImageFormat.JPEG
    33333336, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    2048, // ImageFormat.JPEG
    1536, // ImageFormat.JPEG
    33333337, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    1920, // ImageFormat.JPEG
    1080, // ImageFormat.JPEG
    33333338 };
    // Note: RAW16 and YUV_420_888 omitted intentionally; omitted values should default to 0
    long[] rawAvailableStallDurations = new long[] { // BLOB
    0x21, // BLOB
    3264, // BLOB
    2448, // BLOB
    33333334, // BLOB
    0x21, // BLOB
    3200, // BLOB
    2400, // BLOB
    33333335, // BLOB
    0x21, // BLOB
    2592, // BLOB
    1944, // BLOB
    33333336, // BLOB
    0x21, // BLOB
    2048, // BLOB
    1536, // BLOB
    33333337, // BLOB
    0x21, // BLOB
    1920, // BLOB
    1080, // BLOB
    33333338 };
    Key<StreamConfigurationDuration[]> stallDurationKey = CameraCharacteristics.SCALER_AVAILABLE_STALL_DURATIONS.getNativeKey();
    mMetadata.writeValues(stallDurationKey.getTag(), toByteArray(rawAvailableStallDurations));
    //
    // android.scaler.streamConfigurationMap (synthetic as StreamConfigurationMap)
    //
    StreamConfigurationMap streamConfigMap = mMetadata.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
    // Inputs
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.RAW_SENSOR, 320, 240, /*output*/
    false);
    // Outputs
    checkStreamConfigurationMapByFormatSize(streamConfigMap, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, 640, 480, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.JPEG, 1920, 1080, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.JPEG, 2048, 1536, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.JPEG, 2592, 1944, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.JPEG, 3200, 2400, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.YUV_420_888, 3200, 2400, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.YUV_420_888, 3264, 2448, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.RAW_SENSOR, 3280, 2464, /*output*/
    true);
    // Min Frame Durations
    final int DURATION_TUPLE_SIZE = 4;
    for (int i = 0; i < expectedAvailableMinDurations.length; i += DURATION_TUPLE_SIZE) {
        checkStreamConfigurationMapDurationByFormatSize(streamConfigMap, (int) expectedAvailableMinDurations[i], (int) expectedAvailableMinDurations[i + 1], (int) expectedAvailableMinDurations[i + 2], Duration.MinFrame, expectedAvailableMinDurations[i + 3]);
    }
    for (int i = 0; i < expectedAvailableStallDurations.length; i += DURATION_TUPLE_SIZE) {
        checkStreamConfigurationMapDurationByFormatSize(streamConfigMap, (int) expectedAvailableStallDurations[i], (int) expectedAvailableStallDurations[i + 1], (int) expectedAvailableStallDurations[i + 2], Duration.Stall, expectedAvailableStallDurations[i + 3]);
    }
}
Also used : StreamConfigurationMap(android.hardware.camera2.params.StreamConfigurationMap) Point(android.graphics.Point) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 2 with StreamConfigurationDuration

use of android.hardware.camera2.params.StreamConfigurationDuration in project platform_frameworks_base by android.

the class CameraMetadataTest method testReadWriteStreamConfigurationDuration.

@SmallTest
public void testReadWriteStreamConfigurationDuration() {
    // Avoid sign extending ints when converting to a long
    final long MASK_UNSIGNED_INT = 0x00000000ffffffffL;
    // int64 x 4 x n
    checkKeyMarshal("android.scaler.availableMinFrameDurations", new StreamConfigurationDuration[] { new StreamConfigurationDuration(ImageFormat.YUV_420_888, 640, 480, /*duration*/
    123L), new StreamConfigurationDuration(ImageFormat.RGB_565, 320, 240, /*duration*/
    345L) }, toByteArray(ImageFormat.YUV_420_888 & MASK_UNSIGNED_INT, 640L, 480L, /*duration*/
    123L, ImageFormat.RGB_565 & MASK_UNSIGNED_INT, 320L, 240L, /*duration*/
    345L));
}
Also used : StreamConfigurationDuration(android.hardware.camera2.params.StreamConfigurationDuration) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 3 with StreamConfigurationDuration

use of android.hardware.camera2.params.StreamConfigurationDuration in project platform_frameworks_base by android.

the class CameraMetadataNative method getStreamConfigurationMap.

private StreamConfigurationMap getStreamConfigurationMap() {
    StreamConfiguration[] configurations = getBase(CameraCharacteristics.SCALER_AVAILABLE_STREAM_CONFIGURATIONS);
    StreamConfigurationDuration[] minFrameDurations = getBase(CameraCharacteristics.SCALER_AVAILABLE_MIN_FRAME_DURATIONS);
    StreamConfigurationDuration[] stallDurations = getBase(CameraCharacteristics.SCALER_AVAILABLE_STALL_DURATIONS);
    StreamConfiguration[] depthConfigurations = getBase(CameraCharacteristics.DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS);
    StreamConfigurationDuration[] depthMinFrameDurations = getBase(CameraCharacteristics.DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS);
    StreamConfigurationDuration[] depthStallDurations = getBase(CameraCharacteristics.DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS);
    HighSpeedVideoConfiguration[] highSpeedVideoConfigurations = getBase(CameraCharacteristics.CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS);
    ReprocessFormatsMap inputOutputFormatsMap = getBase(CameraCharacteristics.SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP);
    int[] capabilities = getBase(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
    boolean listHighResolution = false;
    for (int capability : capabilities) {
        if (capability == CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE) {
            listHighResolution = true;
            break;
        }
    }
    return new StreamConfigurationMap(configurations, minFrameDurations, stallDurations, depthConfigurations, depthMinFrameDurations, depthStallDurations, highSpeedVideoConfigurations, inputOutputFormatsMap, listHighResolution);
}
Also used : StreamConfigurationDuration(android.hardware.camera2.params.StreamConfigurationDuration) MarshalQueryableStreamConfigurationDuration(android.hardware.camera2.marshal.impl.MarshalQueryableStreamConfigurationDuration) MarshalQueryableStreamConfiguration(android.hardware.camera2.marshal.impl.MarshalQueryableStreamConfiguration) StreamConfiguration(android.hardware.camera2.params.StreamConfiguration) StreamConfigurationMap(android.hardware.camera2.params.StreamConfigurationMap) ReprocessFormatsMap(android.hardware.camera2.params.ReprocessFormatsMap) MarshalQueryableReprocessFormatsMap(android.hardware.camera2.marshal.impl.MarshalQueryableReprocessFormatsMap) MarshalQueryableHighSpeedVideoConfiguration(android.hardware.camera2.marshal.impl.MarshalQueryableHighSpeedVideoConfiguration) HighSpeedVideoConfiguration(android.hardware.camera2.params.HighSpeedVideoConfiguration) Point(android.graphics.Point)

Example 4 with StreamConfigurationDuration

use of android.hardware.camera2.params.StreamConfigurationDuration in project android_frameworks_base by DirtyUnicorns.

the class CameraMetadataNative method getStreamConfigurationMap.

private StreamConfigurationMap getStreamConfigurationMap() {
    StreamConfiguration[] configurations = getBase(CameraCharacteristics.SCALER_AVAILABLE_STREAM_CONFIGURATIONS);
    StreamConfigurationDuration[] minFrameDurations = getBase(CameraCharacteristics.SCALER_AVAILABLE_MIN_FRAME_DURATIONS);
    StreamConfigurationDuration[] stallDurations = getBase(CameraCharacteristics.SCALER_AVAILABLE_STALL_DURATIONS);
    StreamConfiguration[] depthConfigurations = getBase(CameraCharacteristics.DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS);
    StreamConfigurationDuration[] depthMinFrameDurations = getBase(CameraCharacteristics.DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS);
    StreamConfigurationDuration[] depthStallDurations = getBase(CameraCharacteristics.DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS);
    HighSpeedVideoConfiguration[] highSpeedVideoConfigurations = getBase(CameraCharacteristics.CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS);
    ReprocessFormatsMap inputOutputFormatsMap = getBase(CameraCharacteristics.SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP);
    int[] capabilities = getBase(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
    boolean listHighResolution = false;
    for (int capability : capabilities) {
        if (capability == CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE) {
            listHighResolution = true;
            break;
        }
    }
    return new StreamConfigurationMap(configurations, minFrameDurations, stallDurations, depthConfigurations, depthMinFrameDurations, depthStallDurations, highSpeedVideoConfigurations, inputOutputFormatsMap, listHighResolution);
}
Also used : StreamConfigurationDuration(android.hardware.camera2.params.StreamConfigurationDuration) MarshalQueryableStreamConfigurationDuration(android.hardware.camera2.marshal.impl.MarshalQueryableStreamConfigurationDuration) MarshalQueryableStreamConfiguration(android.hardware.camera2.marshal.impl.MarshalQueryableStreamConfiguration) StreamConfiguration(android.hardware.camera2.params.StreamConfiguration) StreamConfigurationMap(android.hardware.camera2.params.StreamConfigurationMap) ReprocessFormatsMap(android.hardware.camera2.params.ReprocessFormatsMap) MarshalQueryableReprocessFormatsMap(android.hardware.camera2.marshal.impl.MarshalQueryableReprocessFormatsMap) MarshalQueryableHighSpeedVideoConfiguration(android.hardware.camera2.marshal.impl.MarshalQueryableHighSpeedVideoConfiguration) HighSpeedVideoConfiguration(android.hardware.camera2.params.HighSpeedVideoConfiguration) Point(android.graphics.Point)

Example 5 with StreamConfigurationDuration

use of android.hardware.camera2.params.StreamConfigurationDuration in project android_frameworks_base by DirtyUnicorns.

the class CameraMetadataTest method testOverrideStreamConfigurationMap.

/**
     * Set the raw native value of the available stream configurations; ensure that
     * the read-out managed value is consistent with what we write in.
     */
@SmallTest
public void testOverrideStreamConfigurationMap() {
    /*
         * First, write all the raw values:
         * - availableStreamConfigurations
         * - availableMinFrameDurations
         * - availableStallDurations
         *
         * Then, read this out as a synthetic multi-key 'streamConfigurationMap'
         *
         * Finally, validate that the map was unmarshaled correctly
         * and is converting the internal formats to public formats properly.
         */
    //
    // android.scaler.availableStreamConfigurations (int x n x 4 array)
    //
    final int OUTPUT = 0;
    final int INPUT = 1;
    int[] rawAvailableStreamConfigs = new int[] { // RAW16
    0x20, // RAW16
    3280, // RAW16
    2464, // RAW16
    OUTPUT, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3264, // YCbCr_420_888
    2448, // YCbCr_420_888
    OUTPUT, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3200, // YCbCr_420_888
    2400, // YCbCr_420_888
    OUTPUT, // BLOB
    0x21, // BLOB
    3264, // BLOB
    2448, // BLOB
    OUTPUT, // BLOB
    0x21, // BLOB
    3200, // BLOB
    2400, // BLOB
    OUTPUT, // BLOB
    0x21, // BLOB
    2592, // BLOB
    1944, // BLOB
    OUTPUT, // BLOB
    0x21, // BLOB
    2048, // BLOB
    1536, // BLOB
    OUTPUT, // BLOB
    0x21, // BLOB
    1920, // BLOB
    1080, // BLOB
    OUTPUT, // IMPLEMENTATION_DEFINED
    0x22, // IMPLEMENTATION_DEFINED
    640, // IMPLEMENTATION_DEFINED
    480, // IMPLEMENTATION_DEFINED
    OUTPUT, // RAW16
    0x20, // RAW16
    320, // RAW16
    240, // RAW16
    INPUT };
    Key<StreamConfiguration[]> configKey = CameraCharacteristics.SCALER_AVAILABLE_STREAM_CONFIGURATIONS.getNativeKey();
    mMetadata.writeValues(configKey.getTag(), toByteArray(rawAvailableStreamConfigs));
    //
    // android.scaler.availableMinFrameDurations (int x n x 4 array)
    //
    long[] expectedAvailableMinDurations = new long[] { // RAW16
    0x20, // RAW16
    3280, // RAW16
    2464, // RAW16
    33333331, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3264, // YCbCr_420_888
    2448, // YCbCr_420_888
    33333332, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3200, // YCbCr_420_888
    2400, // YCbCr_420_888
    33333333, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    3264, // ImageFormat.JPEG
    2448, // ImageFormat.JPEG
    33333334, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    3200, // ImageFormat.JPEG
    2400, // ImageFormat.JPEG
    33333335, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    2592, // ImageFormat.JPEG
    1944, // ImageFormat.JPEG
    33333336, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    2048, // ImageFormat.JPEG
    1536, // ImageFormat.JPEG
    33333337, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    1920, // ImageFormat.JPEG
    1080, // ImageFormat.JPEG
    33333338 };
    long[] rawAvailableMinDurations = new long[] { // RAW16
    0x20, // RAW16
    3280, // RAW16
    2464, // RAW16
    33333331, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3264, // YCbCr_420_888
    2448, // YCbCr_420_888
    33333332, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3200, // YCbCr_420_888
    2400, // YCbCr_420_888
    33333333, // BLOB
    0x21, // BLOB
    3264, // BLOB
    2448, // BLOB
    33333334, // BLOB
    0x21, // BLOB
    3200, // BLOB
    2400, // BLOB
    33333335, // BLOB
    0x21, // BLOB
    2592, // BLOB
    1944, // BLOB
    33333336, // BLOB
    0x21, // BLOB
    2048, // BLOB
    1536, // BLOB
    33333337, // BLOB
    0x21, // BLOB
    1920, // BLOB
    1080, // BLOB
    33333338 };
    Key<StreamConfigurationDuration[]> durationKey = CameraCharacteristics.SCALER_AVAILABLE_MIN_FRAME_DURATIONS.getNativeKey();
    mMetadata.writeValues(durationKey.getTag(), toByteArray(rawAvailableMinDurations));
    //
    // android.scaler.availableStallDurations (int x n x 4 array)
    //
    long[] expectedAvailableStallDurations = new long[] { // RAW16
    0x20, // RAW16
    3280, // RAW16
    2464, // RAW16
    0, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3264, // YCbCr_420_888
    2448, // YCbCr_420_888
    0, // YCbCr_420_888
    0x23, // YCbCr_420_888
    3200, // YCbCr_420_888
    2400, // YCbCr_420_888
    0, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    3264, // ImageFormat.JPEG
    2448, // ImageFormat.JPEG
    33333334, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    3200, // ImageFormat.JPEG
    2400, // ImageFormat.JPEG
    33333335, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    2592, // ImageFormat.JPEG
    1944, // ImageFormat.JPEG
    33333336, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    2048, // ImageFormat.JPEG
    1536, // ImageFormat.JPEG
    33333337, // ImageFormat.JPEG
    0x100, // ImageFormat.JPEG
    1920, // ImageFormat.JPEG
    1080, // ImageFormat.JPEG
    33333338 };
    // Note: RAW16 and YUV_420_888 omitted intentionally; omitted values should default to 0
    long[] rawAvailableStallDurations = new long[] { // BLOB
    0x21, // BLOB
    3264, // BLOB
    2448, // BLOB
    33333334, // BLOB
    0x21, // BLOB
    3200, // BLOB
    2400, // BLOB
    33333335, // BLOB
    0x21, // BLOB
    2592, // BLOB
    1944, // BLOB
    33333336, // BLOB
    0x21, // BLOB
    2048, // BLOB
    1536, // BLOB
    33333337, // BLOB
    0x21, // BLOB
    1920, // BLOB
    1080, // BLOB
    33333338 };
    Key<StreamConfigurationDuration[]> stallDurationKey = CameraCharacteristics.SCALER_AVAILABLE_STALL_DURATIONS.getNativeKey();
    mMetadata.writeValues(stallDurationKey.getTag(), toByteArray(rawAvailableStallDurations));
    //
    // android.scaler.streamConfigurationMap (synthetic as StreamConfigurationMap)
    //
    StreamConfigurationMap streamConfigMap = mMetadata.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
    // Inputs
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.RAW_SENSOR, 320, 240, /*output*/
    false);
    // Outputs
    checkStreamConfigurationMapByFormatSize(streamConfigMap, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, 640, 480, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.JPEG, 1920, 1080, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.JPEG, 2048, 1536, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.JPEG, 2592, 1944, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.JPEG, 3200, 2400, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.YUV_420_888, 3200, 2400, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.YUV_420_888, 3264, 2448, /*output*/
    true);
    checkStreamConfigurationMapByFormatSize(streamConfigMap, ImageFormat.RAW_SENSOR, 3280, 2464, /*output*/
    true);
    // Min Frame Durations
    final int DURATION_TUPLE_SIZE = 4;
    for (int i = 0; i < expectedAvailableMinDurations.length; i += DURATION_TUPLE_SIZE) {
        checkStreamConfigurationMapDurationByFormatSize(streamConfigMap, (int) expectedAvailableMinDurations[i], (int) expectedAvailableMinDurations[i + 1], (int) expectedAvailableMinDurations[i + 2], Duration.MinFrame, expectedAvailableMinDurations[i + 3]);
    }
    for (int i = 0; i < expectedAvailableStallDurations.length; i += DURATION_TUPLE_SIZE) {
        checkStreamConfigurationMapDurationByFormatSize(streamConfigMap, (int) expectedAvailableStallDurations[i], (int) expectedAvailableStallDurations[i + 1], (int) expectedAvailableStallDurations[i + 2], Duration.Stall, expectedAvailableStallDurations[i + 3]);
    }
}
Also used : StreamConfigurationMap(android.hardware.camera2.params.StreamConfigurationMap) Point(android.graphics.Point) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

StreamConfigurationDuration (android.hardware.camera2.params.StreamConfigurationDuration)15 Point (android.graphics.Point)10 StreamConfiguration (android.hardware.camera2.params.StreamConfiguration)10 StreamConfigurationMap (android.hardware.camera2.params.StreamConfigurationMap)10 SmallTest (android.test.suitebuilder.annotation.SmallTest)10 Camera (android.hardware.Camera)5 MarshalQueryableHighSpeedVideoConfiguration (android.hardware.camera2.marshal.impl.MarshalQueryableHighSpeedVideoConfiguration)5 MarshalQueryableReprocessFormatsMap (android.hardware.camera2.marshal.impl.MarshalQueryableReprocessFormatsMap)5 MarshalQueryableStreamConfiguration (android.hardware.camera2.marshal.impl.MarshalQueryableStreamConfiguration)5 MarshalQueryableStreamConfigurationDuration (android.hardware.camera2.marshal.impl.MarshalQueryableStreamConfigurationDuration)5 HighSpeedVideoConfiguration (android.hardware.camera2.params.HighSpeedVideoConfiguration)5 ReprocessFormatsMap (android.hardware.camera2.params.ReprocessFormatsMap)5 Size (android.util.Size)5 ArrayList (java.util.ArrayList)5