自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
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,並以與其他相機 HAL 輸出串流相同的方式宣告支援 JPEG_R
輸出內容。在這種情況下,相機 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
建構屬性設為 true
。如果未設定這個建構屬性或設為 false
,在支援10 位元輸出功能和同時擷取 10 位元和 8 位元的裝置上,系統會透過 JpegRCompositeStream
預設啟用 Ultra HDR。
驗證
如要驗證裝置上的 Ultra HDR 功能,請執行下列測試。
CTS 測試
ITS 測試
手動測試
如要執行手動測試,請使用Ultra HDR 圖像擷取範例實作,其中支援使用 JPEG_R
圖像格式設定及擷取 Ultra HDR。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-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."]]