Merge "Camera: Register LensShadingMap marshaler" am: 238f1e28fa
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2378869 Change-Id: If2864ffb4cf8df34dfc1c1f26644e4399cb4ad22 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -88,8 +88,8 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -1027,6 +1027,19 @@ public class CameraMetadataNative implements Parcelable {
|
||||
return fixedFaceRectangles;
|
||||
}
|
||||
|
||||
private boolean setLensShadingMap(LensShadingMap lensShadingMap) {
|
||||
if (lensShadingMap == null) {
|
||||
return false;
|
||||
}
|
||||
float[] lsmArray = new float[lensShadingMap.getGainFactorCount()];
|
||||
lensShadingMap.copyGainFactors(lsmArray, 0);
|
||||
setBase(CaptureResult.STATISTICS_LENS_SHADING_MAP, lsmArray);
|
||||
|
||||
Size s = new Size(lensShadingMap.getRowCount(), lensShadingMap.getColumnCount());
|
||||
setBase(CameraCharacteristics.LENS_INFO_SHADING_MAP_SIZE, s);
|
||||
return true;
|
||||
}
|
||||
|
||||
private LensShadingMap getLensShadingMap() {
|
||||
float[] lsmArray = getBase(CaptureResult.STATISTICS_LENS_SHADING_MAP);
|
||||
Size s = get(CameraCharacteristics.LENS_INFO_SHADING_MAP_SIZE);
|
||||
@@ -1851,6 +1864,13 @@ public class CameraMetadataNative implements Parcelable {
|
||||
metadata.setAERegions(value);
|
||||
}
|
||||
});
|
||||
sSetCommandMap.put(CaptureResult.STATISTICS_LENS_SHADING_CORRECTION_MAP.getNativeKey(),
|
||||
new SetCommand() {
|
||||
@Override
|
||||
public <T> void setValue(CameraMetadataNative metadata, T value) {
|
||||
metadata.setLensShadingMap((LensShadingMap) value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean setAvailableFormats(int[] value) {
|
||||
|
||||
1
core/tests/coretests/src/android/hardware/camera2/OWNERS
Normal file
1
core/tests/coretests/src/android/hardware/camera2/OWNERS
Normal file
@@ -0,0 +1 @@
|
||||
include platform/frameworks/av:/camera/OWNERS
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.camera2.impl;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.hardware.camera2.CaptureResult;
|
||||
import android.hardware.camera2.params.LensShadingMap;
|
||||
import android.util.Size;
|
||||
|
||||
import androidx.test.filters.SmallTest;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@SmallTest
|
||||
@RunWith(JUnit4.class)
|
||||
/** Tests for {@link CameraMetadataNative} class. */
|
||||
public class CaptureMetadataNativeTest {
|
||||
|
||||
@Test
|
||||
public void setLensShadingMap() {
|
||||
final Size s = new Size(10, 10);
|
||||
// 4 x rows x columns
|
||||
final float[] elements = new float[400];
|
||||
Arrays.fill(elements, 42);
|
||||
|
||||
final LensShadingMap lensShadingMap =
|
||||
new LensShadingMap(elements, s.getHeight(), s.getWidth());
|
||||
CameraMetadataNative captureResults = new CameraMetadataNative();
|
||||
captureResults.set(CaptureResult.STATISTICS_LENS_SHADING_CORRECTION_MAP, lensShadingMap);
|
||||
|
||||
final LensShadingMap output =
|
||||
captureResults.get(CaptureResult.STATISTICS_LENS_SHADING_CORRECTION_MAP);
|
||||
|
||||
assertThat(output).isEqualTo(lensShadingMap);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user