Fixed
Status Update
Comments
wu...@google.com <wu...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit ded69ff18456e1501b418d281c562bc4bb215937
Author: leo huang <leohuang@google.com>
Date: Mon Jan 18 16:17:55 2021
Fix ImageCapture performace regression by renaming temporary file instead of copying
In ImageSaver.java on pre-RC version, it saves the image directly to target destination when output option is "save to file". On RC01, it saves the image to a temporary file to avoid concurrent modification issue ( b/173019455 ) and finally copies the temporary file to the target destination, which incurs additional I/O. This can be improved by directly renaming the temporary file to destination file.
"Relnote: Fixed ImageCapture performance regression with "File" type OutputFileOptions."
Bug: b/177061560
Test: Test on Samsung J4+, it can reduce 150~180ms for image saving.
Change-Id: I5164a91c586df0a8dd90f30eda0ce43c1cbe5cd7
M camera/camera-core/src/androidTest/java/androidx/camera/core/ImageSaverTest.java
M camera/camera-core/src/main/java/androidx/camera/core/ImageSaver.java
https://android-review.googlesource.com/1554094
Branch: androidx-main
commit ded69ff18456e1501b418d281c562bc4bb215937
Author: leo huang <leohuang@google.com>
Date: Mon Jan 18 16:17:55 2021
Fix ImageCapture performace regression by renaming temporary file instead of copying
In ImageSaver.java on pre-RC version, it saves the image directly to target destination when output option is "save to file". On RC01, it saves the image to a temporary file to avoid concurrent modification issue (
"Relnote: Fixed ImageCapture performance regression with "File" type OutputFileOptions."
Bug:
Test: Test on Samsung J4+, it can reduce 150~180ms for image saving.
Change-Id: I5164a91c586df0a8dd90f30eda0ce43c1cbe5cd7
M camera/camera-core/src/androidTest/java/androidx/camera/core/ImageSaverTest.java
M camera/camera-core/src/main/java/androidx/camera/core/ImageSaver.java
le...@google.com <le...@google.com> #3
Add discovered information about the performance difference between BETA5 and RC01. By comparing the take picture latency on Samsung J4+, there are 2 main increment for saving image to disk.
- Copy temp file to destination file.
In order to avoid concurrent write to the same file, RC01 will save captured image to a temp file and finally copy to the destination. But the copy will increase the latency about 150-180ms on Samsung J4+.
- Validate the output location
In order to fail fast before actually take picture, RC01 will validate the output location before taking picture. But this will increase the latency, especially on "save to URI" output option. It will spend around 90ms on Samsung J4+.
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 194f428cd5b216b910177940fe9bc44143fa29a4
Author: leo huang <leohuang@google.com>
Date: Fri Jan 22 13:42:12 2021
Remove the validation of image saved location to improve the performance of taking picture
It is a nice feature to quickly fail by verifying the saved location before taking a picture, which can allow users to receive early notifications when the request will eventually fail. However, doing so will increase the latency a bit in taking pictures. Through trade-off considerations, remove the verification for better performance.
Relnote: "Fixed ImageCapture performance regression by removing the validation of image saved location before taking picture. After making this change, if the save destination is invalid, it will take longer to get the failure response because it will try to save the image after the photo is taken."
Bug: 177061560
Test: ./gradlew camera:camera-camera2:connectedAndroidTest
Change-Id: I1fd4ed93d0984668c634c832010901d604cb0dc6
M camera/camera-core/src/main/java/androidx/camera/core/ImageCapture.java
D camera/camera-core/src/main/java/androidx/camera/core/ImageSaveLocationValidator.java
M camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/DeviceQuirksLoader.java
D camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/HuaweiMediaStoreLocationValidationQuirk.java
D camera/camera-core/src/test/java/androidx/camera/core/ImageSaveLocationValidatorTest.java
https://android-review.googlesource.com/1559097
Branch: androidx-main
commit 194f428cd5b216b910177940fe9bc44143fa29a4
Author: leo huang <leohuang@google.com>
Date: Fri Jan 22 13:42:12 2021
Remove the validation of image saved location to improve the performance of taking picture
It is a nice feature to quickly fail by verifying the saved location before taking a picture, which can allow users to receive early notifications when the request will eventually fail. However, doing so will increase the latency a bit in taking pictures. Through trade-off considerations, remove the verification for better performance.
Relnote: "Fixed ImageCapture performance regression by removing the validation of image saved location before taking picture. After making this change, if the save destination is invalid, it will take longer to get the failure response because it will try to save the image after the photo is taken."
Bug: 177061560
Test: ./gradlew camera:camera-camera2:connectedAndroidTest
Change-Id: I1fd4ed93d0984668c634c832010901d604cb0dc6
M camera/camera-core/src/main/java/androidx/camera/core/ImageCapture.java
D camera/camera-core/src/main/java/androidx/camera/core/ImageSaveLocationValidator.java
M camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/DeviceQuirksLoader.java
D camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/HuaweiMediaStoreLocationValidationQuirk.java
D camera/camera-core/src/test/java/androidx/camera/core/ImageSaveLocationValidatorTest.java
wu...@google.com <wu...@google.com>
ju...@google.com <ju...@google.com> #6
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.camera:camera-core:1.2.0
Description
Tested on SM-J106H, beta05: 636 ms, rc01: 753 ms