自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
Ultra HDR
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android 14 提供了对使用 JPEG_R
图片格式拍摄 Ultra HDR 压缩图片的支持。此格式向后兼容 SDR JPEG 图片,并且支持对内容进行 HDR 渲染。
如需详细了解 Ultra HDR 格式规范,请参阅 Ultra HDR 图片格式 v1.0。
实现
本部分介绍如何实现 Ultra HDR 功能。
参考实现
AOSP 相机框架和相机服务包含参考 Ultra HDR 实现。
除了相机框架中的参考功能之外,您还可以在相机 HAL 中实现 Ultra HDR 并通告对 JPEG_R
输出的支持,具体方式与其他相机 HAL 输出流相同。在这种情况下,相机 HAL 必须生成必要的恢复图和最终的 JPEG_R
图片,如 Ultra HDR 规范所定义。您可以根据设备硬件和软件功能优化和调整最终输出。
实现选项
设备制造商可以决定其设备的以下级别 Ultra HDR 支持:
- 极简:在此配置中,通过相机服务复合流功能执行的 Ultra HDR 输出默认处于停用状态。如需启用
JpegRCompositeStream
参考实现,请将 ro.camera.enableCompositeAPI0JpegR
系统属性设置为 true
。由于所有流程和编码都在软件中执行,因此此选项可能会导致延迟时间增加和性能下降。
- 中等:在此选项中,
JpegRCompositeStream
实现会使用 HAL 提供的 SDR JPEG 文件作为基础图片,并使用 P010 帧来计算恢复图。此选项涉及在数据路径中进行软件处理,但与极简选项相比相对较少。
- 丰富:相机 HAL 直接通告并支持
JPEG_R
输出流。通过此选项,设备制造商可以实现设备专用优化,并且可以显著提升图像质量。
如需停用 JpegRCompositeStream
实现,请将 ro.camera.disableJpegR
build 属性设为 true
。如果此 build 属性未设置或设为 false
,在支持 10 位输出功能和并发 10 和 8 位拍摄的设备上,Ultra HDR 会默认通过 JpegRCompositeStream
启用。
验证
如需验证设备上的 UHD 功能,请运行以下测试。
CTS 测试
ITS 测试
手动测试
如需执行手动测试,请使用 Ultra HDR 图片拍摄实现示例,该实现支持使用 JPEG_R
图片格式配置和拍摄 Ultra HDR。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[null,null,["最后更新时间 (UTC):2025-03-26。"],[],[],null,["# Ultra HDR\n\nAndroid 14 provides support for capturing Ultra HDR\ncompressed images using the\n[`JPEG_R`](https://developer.android.com/reference/kotlin/android/graphics/ImageFormat#jpeg_r)\nimage format. This format is backward compatible with SDR JPEG images and\nsupports HDR rendering of content.\nFor details about the Ultra HDR format specification, see\n[Ultra HDR Image Format v1.0](https://developer.android.com/guide/topics/media/hdr-image-format).\n\nImplementation\n--------------\n\nThis section describes how to implement the Ultra HDR feature.\n\n### Reference implementation\n\nThe AOSP camera framework and camera service includes a reference Ultra HDR\nimplementation.\n\nIn addition to the reference functionality in the camera framework, you can\nimplement Ultra HDR within the camera HAL and advertise support for `JPEG_R`\noutput in the same way as other camera HAL output streams. In this scenario,\nthe camera HAL must generate the necessary recovery map and the final `JPEG_R`\nimage as defined by the\n[Ultra HDR specification](https://developer.android.com/guide/topics/media/hdr-image-format#introduction).\nYou can optimize and tune the final output depending on the device hardware\nand software capabilities.\n\n### Implementation options\n\nDevice manufacturers can decide on the following levels of Ultra HDR support for\ntheir devices:\n\n- **Minimal:** In this configuration, Ultra HDR output through the camera service composite stream functionality is disabled by default. To enable the `JpegRCompositeStream` reference implementation, set the `ro.camera.enableCompositeAPI0JpegR` system property to `true`. Because all processes and encoding is performed in software, this option can result in increased latency and decreased performance.\n- **Moderate:** With this option, the `JpegRCompositeStream` implementation uses a HAL-provided SDR JPEG file as a base image and a P010 frame to calculate a recovery map. This option involves software processing within the data path but is relatively minor compared to the minimal option.\n- **Extensive:** The camera HAL advertises and supports the `JPEG_R` output stream directly. This option lets device manufacturers implement device-specific optimizations and can provide significant image quality improvements.\n\nTo disable the `JpegRCompositeStream` implementation, set the\n`ro.camera.disableJpegR` build property to `true`. If this build property isn't\nset or is set to `false`, Ultra HDR is enabled by default through\n`JpegRCompositeStream` on devices supporting\n[10-bit output capability](https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT)\nand\n[concurrent 10 and 8-bit capture](https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles#getProfileCaptureRequestConstraints(long)).\n\nValidation\n----------\n\nTo validate the Ultra HDR feature on your device, run the following tests.\n\n### CTS tests\n\n- [`ImageReaderTest.java#testImageReaderBuilderWithBLOBAndJpegR`](https://android.googlesource.com/platform/cts/+/refs/heads/android16-release/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java#815)\n- [`ImageReaderTest.java#testJpegR`](https://android.googlesource.com/platform/cts/+/refs/heads/android16-release/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java#503)\n- [`ImageReaderTest.java#testJpegRDisplayP3`](https://android.googlesource.com/platform/cts/+/refs/heads/android16-release/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java#526)\n- [`PerformanceTest.java#testSingleCapture`](https://android.googlesource.com/platform/cts/+/refs/heads/android16-release/tests/camera/src/android/hardware/camera2/cts/PerformanceTest.java#313)\n- [`StillCaptureTest.java# testJpegRCapture`](https://android.googlesource.com/platform/cts/+/refs/heads/android16-release/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java#192)\n\n### ITS tests\n\n- [`scene4#test_aspect_ratio_and_crop`](https://android.googlesource.com/platform/cts/+/refs/heads/android16-release/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py)\n\n### Manual tests\n\nTo perform manual tests, use the\n[sample implementation for Ultra HDR image capture](https://github.com/android/platform-samples/pull/56),\nwhich includes support for the configuration and capture of Ultra HDR using the\n`JPEG_R` image format."]]