diff options
author | Camera Software Integration <camswint@quicinc.com> | 2019-11-01 13:15:48 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-11-01 13:15:48 -0700 |
commit | d31684c76809c8869f36147170d83113c6596f76 (patch) | |
tree | 84ca1176dcaf8d4495c6035efcdc1f593a803e40 /src | |
parent | a94d420db6ab161ce3879d37c57be432cbb02f72 (diff) | |
parent | 416558c5d8a2a36d78788e9c6772c943b2ccdcbc (diff) | |
download | android_packages_apps_Snap-d31684c76809c8869f36147170d83113c6596f76.tar.gz android_packages_apps_Snap-d31684c76809c8869f36147170d83113c6596f76.tar.bz2 android_packages_apps_Snap-d31684c76809c8869f36147170d83113c6596f76.zip |
Merge "SnapdraongCamera:Filter HEIF size" into camera-SnapdragonCamera.lnx.2.0
Diffstat (limited to 'src')
-rwxr-xr-x | src/com/android/camera/SettingsManager.java | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java index 253108603..88fe2ec53 100755 --- a/src/com/android/camera/SettingsManager.java +++ b/src/com/android/camera/SettingsManager.java @@ -1670,10 +1670,26 @@ public class SettingsManager implements ListMenu.SettingsListener { res.add(getSupportedQcfaDimension(cameraId)); } + VideoCapabilities heifCap = null; + if (isHeifEnabled) { + MediaCodecList list = new MediaCodecList(MediaCodecList.REGULAR_CODECS); + for (MediaCodecInfo info :list.getCodecInfos()) { + if (info.isEncoder() && info.getName().contains("heic")){ + heifCap = info.getCapabilitiesForType( + MediaFormat.MIMETYPE_IMAGE_ANDROID_HEIC).getVideoCapabilities(); + Log.d(TAG,"supported heif height range ="+heifCap.getSupportedHeights().toString() + + " width range ="+heifCap.getSupportedWidths().toString()); + } + } + } + if (sizes != null) { for (int i = 0; i < sizes.length; i++) { - if (isHeifEnabled && (Math.min(sizes[i].getWidth(),sizes[i].getHeight()) < 512)) { - continue; + if (isHeifEnabled && heifCap != null ){ + if (!heifCap.getSupportedWidths().contains(sizes[i].getWidth()) || + !heifCap.getSupportedHeights().contains(sizes[i].getHeight())){ + continue; + } } if (isDeepportrait && (Math.min(sizes[i].getWidth(),sizes[i].getHeight()) < 720 || @@ -1686,8 +1702,15 @@ public class SettingsManager implements ListMenu.SettingsListener { } Size[] highResSizes = map.getHighResolutionOutputSizes(ImageFormat.JPEG); + if (highResSizes != null) { for (int i = 0; i < highResSizes.length; i++) { + if (isHeifEnabled && heifCap != null) { + if (!heifCap.getSupportedWidths().contains(highResSizes[i].getWidth()) || + !heifCap.getSupportedHeights().contains(highResSizes[i].getHeight())){ + continue; + } + } res.add(highResSizes[i].toString()); } } @@ -1735,10 +1758,25 @@ public class SettingsManager implements ListMenu.SettingsListener { CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); Size[] sizes = map.getOutputSizes(MediaRecorder.class); boolean isHeifEnabled = getSavePictureFormat() == HEIF_FORMAT; + VideoCapabilities heifCap = null; + if (isHeifEnabled) { + MediaCodecList list = new MediaCodecList(MediaCodecList.REGULAR_CODECS); + for (MediaCodecInfo info :list.getCodecInfos()) { + if (info.isEncoder() && info.getName().contains("heic")){ + heifCap = info.getCapabilitiesForType( + MediaFormat.MIMETYPE_IMAGE_ANDROID_HEIC).getVideoCapabilities(); + Log.d(TAG,"supported heif height range ="+heifCap.getSupportedHeights().toString() + + " width range ="+heifCap.getSupportedWidths().toString()); + } + } + } List<String> res = new ArrayList<>(); for (int i = 0; i < sizes.length; i++) { - if (isHeifEnabled && (Math.min(sizes[i].getWidth(),sizes[i].getHeight()) < 512)) { - continue; + if (isHeifEnabled && heifCap != null ){ + if (!heifCap.getSupportedWidths().contains(sizes[i].getWidth()) || + !heifCap.getSupportedHeights().contains(sizes[i].getHeight())){ + continue; + } } if (CameraSettings.VIDEO_QUALITY_TABLE.containsKey(sizes[i].toString())) { Integer profile = CameraSettings.VIDEO_QUALITY_TABLE.get(sizes[i].toString()); |