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

Commit dfc3b766 authored by Emilian Peev's avatar Emilian Peev
Browse files

Camera: Polish LensIntrinsicsSample API and docs

Add documentation references for lens intrinsic data
as well as further information about the timestamp
time unit and time basis.

Bug: 315495294
Test: Successfull regular and doc builds
Change-Id: I35b4eca88d19ad3d2fa9b9f97e3392e64d0a380e
parent 2ed24ae0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -19712,7 +19712,7 @@ package android.hardware.camera2.params {
  @FlaggedApi("com.android.internal.camera.flags.concert_mode") public final class LensIntrinsicsSample {
    ctor @FlaggedApi("com.android.internal.camera.flags.concert_mode") public LensIntrinsicsSample(long, @NonNull float[]);
    method @FlaggedApi("com.android.internal.camera.flags.concert_mode") @NonNull public float[] getLensIntrinsics();
    method @FlaggedApi("com.android.internal.camera.flags.concert_mode") public long getTimestamp();
    method @FlaggedApi("com.android.internal.camera.flags.concert_mode") public long getTimestampNanos();
  }
  public final class LensShadingMap {
+42 −32
Original line number Diff line number Diff line
@@ -79,6 +79,8 @@ import android.util.Log;
import android.util.Range;
import android.util.Size;

import com.android.internal.camera.flags.Flags;

import dalvik.annotation.optimization.FastNative;
import dalvik.system.VMRuntime;

@@ -1795,10 +1797,11 @@ public class CameraMetadataNative implements Parcelable {
            return false;
        }

        if (Flags.concertMode()) {
            long[] tsArray = new long[samples.length];
            float[] intrinsicsArray = new float[samples.length * 5];
            for (int i = 0; i < samples.length; i++) {
            tsArray[i] = samples[i].getTimestamp();
                tsArray[i] = samples[i].getTimestampNanos();
                System.arraycopy(samples[i].getLensIntrinsics(), 0, intrinsicsArray, 5 * i, 5);

            }
@@ -1806,9 +1809,13 @@ public class CameraMetadataNative implements Parcelable {
            setBase(CaptureResult.STATISTICS_LENS_INTRINSIC_TIMESTAMPS, tsArray);

            return true;
        } else {
            return false;
        }
    }

    private LensIntrinsicsSample[] getLensIntrinsicSamples() {
        if (Flags.concertMode()) {
            long[] timestamps = getBase(CaptureResult.STATISTICS_LENS_INTRINSIC_TIMESTAMPS);
            float[] intrinsics = getBase(CaptureResult.STATISTICS_LENS_INTRINSIC_SAMPLES);

@@ -1838,6 +1845,9 @@ public class CameraMetadataNative implements Parcelable {
                samples[i] = new LensIntrinsicsSample(timestamps[i], currentIntrinsic);
            }
            return samples;
        } else {
            return null;
        }
    }

    private Capability[] getExtendedSceneModeCapabilities() {
+10 −8
Original line number Diff line number Diff line
@@ -37,16 +37,18 @@ public final class LensIntrinsicsSample {
     * Create a new {@link LensIntrinsicsSample}.
     *
     * <p>{@link LensIntrinsicsSample} contains the timestamp and the
     * {@link CaptureResult#LENS_INTRINSIC_CALIBRATION} sample.
     * {@link CaptureResult#LENS_INTRINSIC_CALIBRATION} sample.</p>
     *
     * @param timestamp timestamp of the lens intrinsics sample.
     * @param lensIntrinsics the lens intrinsic calibration for the sample.
     * @param timestampNs timestamp in nanoseconds of the lens intrinsics sample. This uses the
     *                  same time basis as {@link CaptureResult#SENSOR_TIMESTAMP}.
     * @param lensIntrinsics the lens {@link CaptureResult#LENS_INTRINSIC_CALIBRATION intrinsic}
     *                      calibration for the sample.
     *
     * @throws IllegalArgumentException if lensIntrinsics length is different from 5
     */
    @FlaggedApi(Flags.FLAG_CONCERT_MODE)
    public LensIntrinsicsSample(final long timestamp, @NonNull final float[] lensIntrinsics) {
        mTimestampNs = timestamp;
    public LensIntrinsicsSample(final long timestampNs, @NonNull final float[] lensIntrinsics) {
        mTimestampNs = timestampNs;
        Preconditions.checkArgument(lensIntrinsics.length == 5);
        mLensIntrinsics = lensIntrinsics;
    }
@@ -54,18 +56,18 @@ public final class LensIntrinsicsSample {
    /**
     * Get the timestamp in nanoseconds.
     *
     *<p>The timestamps are in the same timebase as and comparable to
     *<p>The timestamps are in the same time basis as and comparable to
     *{@link CaptureResult#SENSOR_TIMESTAMP android.sensor.timestamp}.</p>
     *
     * @return a long value (guaranteed to be finite)
     */
    @FlaggedApi(Flags.FLAG_CONCERT_MODE)
    public long getTimestamp() {
    public long getTimestampNanos() {
        return mTimestampNs;
    }

    /**
     * Get the lens intrinsics calibration
     * Get the lens {@link CaptureResult#LENS_INTRINSIC_CALIBRATION intrinsics} calibration
     *
     * @return a floating point value (guaranteed to be finite)
     * @see CaptureResult#LENS_INTRINSIC_CALIBRATION