ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
HDR ในภาพหน้าจอ Android
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
นับตั้งแต่เปิดตัววิดีโอ High Dynamic Range (HDR) บริการสตรีมมิงก็เริ่มสตรีมวิดีโอ HDR โดยเน้นที่ประสบการณ์การรับชมแบบเต็มหน้าจอ เมื่อเร็วๆ นี้ แอปโซเชียลมีเดียได้เริ่มรองรับวิดีโอ HDR และ Ultra HDR ซึ่งแสดงให้เห็นว่าผู้คนเริ่มให้ความสนใจในการใช้ HDR ในแอปต่างๆ มากขึ้น
การรองรับ HDR ของ Android
ต่อไปนี้คือเหตุการณ์สำคัญในการรองรับเทคโนโลยี HDR ของ Android ในช่วงหลายปีที่ผ่านมา
Android 7
- การรองรับเบื้องต้นสำหรับการถอดรหัสและการแสดงผลวิดีโอ HDR
- การพัฒนาความสามารถของ HDR อย่างต่อเนื่อง
Android 13
- การรองรับจากต้นทางถึงปลายทางสำหรับการจับภาพ การเข้ารหัส และการแสดงผลวิดีโอ HDR
- การเปิดตัวการผสมองค์ประกอบ SDR และ HDR ซึ่งกำหนดช่วงความสว่างที่แสดงได้แตกต่างกันระหว่าง SDR และ HDR
Android 14
การรองรับภาพหน้าจอด้วย HDR ก็มีการพัฒนาและเปลี่ยนแปลงไปหลายอย่างเช่นกันในช่วงหลายปีที่ผ่านมา
ความก้าวหน้าของความสามารถในการถ่ายภาพหน้าจอ HDR
ส่วนนี้จะติดตามความคืบหน้าของความสามารถในการจับภาพหน้าจอ HDR ในการอัปเดต Android ล่าสุด
Android 9
SurfaceFlinger ซึ่งเป็นโปรแกรมคอมโพสิชันกราฟิกของ Android รองรับวิดีโอ HDR แล้ว GPU รองรับการแสดงผลวิดีโอและภาพหน้าจอ HDR ด้วยโปรแกรมแมปโทนสีแบบพหุนามที่ซับซ้อน เส้นโค้งการปรับโทนสีนี้อาจไม่เท่ากับตัวปรับโทนสีของจอแสดงผลเสมอไป ดังนั้นภาพหน้าจอจึงแตกต่างจากเนื้อหาบนหน้าจอ
Android 13
ระบบจะเพิ่มปลั๊กอินการปรับโทนสีลงในบล็อกการแสดงผล GPU ของ SurfaceFlinger ซึ่งช่วยให้ OEM ระบุโปรแกรมเปลี่ยนสี GPU ให้ตรงกับเส้นโค้งการปรับโทนสีของจอแสดงผลได้ ภาพหน้าจอเกือบตรงกับสิ่งที่แสดงบนหน้าจอ แต่มีข้อแตกต่างดังนี้
- ภาพหน้าจอจะยังคงอยู่ในรูปแบบ SDR ดังนั้น เมื่อดูภาพหน้าจอควบคู่ไปกับฉาก HDR บริเวณ HDR ในภาพหน้าจอจะดูสลัวกว่า
- ระบบไม่ได้จัดการความสว่าง SDR ส่งผลให้เนื้อหา SDR ในภาพหน้าจอปรากฏสว่างเท่ากับเนื้อหา HDR
กล่าวคือ ระบบจะแปลงวิดีโอ HDR ที่บันทึกไว้ในภาพหน้าจอเป็นวิดีโอ SDR
Android 14
Ultra HDR เป็นปัญหาที่ท้าทายอย่างยิ่งสำหรับการจับภาพหน้าจอ โดยทั่วไปแล้ว รูปภาพจะแสดงผลภายในเฟรมบัฟเฟอร์ UI ซึ่งแตกต่างจากวิดีโอ โดยมีผลลัพธ์หลัก 2 อย่างดังนี้
- รูปภาพต้องไม่มีการประมวลผลรูปภาพ ซึ่งรวมถึงการปรับโทนสีที่แตกต่างจาก UI รอบๆ
- แอปมีหน้าที่รับผิดชอบในการแมปโทนสีตามแหล่งที่มาเมื่อแสดงผล UI
ในการลดความท้าทายนี้ การใช้งานภาพหน้าจอที่เป็นไปได้มี 3 วิธีดังนี้
- เก็บรายละเอียด HDR ของรูปภาพ Ultra HDR ไว้ ซึ่งจะทำให้ UI ของแอปในภาพหน้าจอมืดลง
- เก็บรายละเอียด UI ของแอปไว้ ซึ่งทำให้ภาพ Ultra HDR มีการครอบตัด
- ประนีประนอมโดยการเพิ่มความสว่างให้กับ UI ของแอปขณะที่ตัดไฮไลต์ HDR
Android 14 ใช้แนวทางที่ 3 ซึ่งก็คือการเพิ่มความสว่างให้กับ UI ของแอปและการครอบตัดไฮไลต์ HDR
Android 15-QPR1
SurfaceFlinger มีอัลกอริทึมการปรับโทนสีในเครื่องสำหรับภาพหน้าจอ กระบวนการนี้ประกอบด้วยขั้นตอนต่อไปนี้
- การแบ่งรูปภาพอินพุตออกเป็นรูปภาพขนาดเล็ก
- การคํานวณความสว่างสูงสุดในแต่ละรูปภาพ และทิ้งค่าความสว่างต่ำภายในแต่ละส่วน
- การปรับค่าความสว่างที่คำนวณแล้วผ่านการเบลอและการสุ่มตัวอย่างอีกครั้ง
- การใช้โทนแมปเปอร์ Reinhard ที่มีพารามิเตอร์กับรูปภาพอินพุต โดยอิงตามค่าความสว่างที่อัตราส่วน
อัลกอริทึมนี้แสดงการปรับปรุงภาพหน้าจอที่สำคัญระหว่าง Android 14 กับ Android 15-QPR1 ดังที่แสดงในตัวอย่างต่อไปนี้
ตัวอย่างที่ 1 คือภาพหน้าจอของวิดีโอ HDR ที่วางซ้อนอยู่ด้านบนหน้า Chrome ที่มี Ultra HDR สีของ UI ส่วนใหญ่จะยังคงเดิมในการใช้งานแบบใหม่ และรูปภาพจะไม่ถูกตัดอีกต่อไป
Android 14 |
Android 15-QPR1 |
|
|
รูปที่ 1 การเปรียบเทียบ Android 14 กับ Android 15-QPR1 สำหรับตัวอย่างที่ 1
ตัวอย่างที่ 2 คือภาพหน้าจอของวิดีโอ HDR ที่วางซ้อนอยู่ด้านบนการตั้งค่าพร้อมภาพหน้าจอที่ตามมา ใน Android 14 สีของภาพหน้าจอจะเข้มขึ้นเรื่อยๆ ใน Android 15-QPR1 เครื่องมือปรับโทนสีจะจำลองและรักษาสีของ UI ได้อย่างถูกต้อง
Android 14 |
Android 15-QPR1 |
|
|
รูปที่ 2 การเปรียบเทียบ Android 14 กับ Android 15-QPR1 สําหรับตัวอย่างที่ 2
Android 16
ภาพหน้าจอ HDR จะจัดเก็บแผนที่การขยายสัญญาณในไฟล์ภาพหน้าจอเพื่อกู้คืนการแสดงผล HDR ในระหว่างการแสดงผล ซึ่งคล้ายกับ Ultra HDR อย่างไรก็ตาม ภาพหน้าจอจะยังคงอยู่ในรูปแบบ PNG เพื่อใช้งานร่วมกับระบบที่นำเข้าภาพหน้าจอ PNG ได้ย้อนหลัง ซึ่งแตกต่างจาก Ultra HDR
รายละเอียดการสร้างภาพหน้าจอมีดังนี้
- เมื่อเนื้อหา HDR แสดงบนอุปกรณ์ ระบบจะสร้างภาพหน้าจอโดยใช้พิกเซล FP16
- โปรแกรมเปลี่ยนโทนระดับท้องถิ่นที่อธิบายไว้ใน Android 15-QPR1 จะสร้างการแสดงผล SDR พื้นฐาน 8 บิต
- แผนที่การขยายสัญญาณ 8 บิตสร้างขึ้นโดยการรวมการแสดงผลพื้นฐาน SDR เข้ากับการแสดงผล HDR
- ระบบจะเข้ารหัสการแสดงผลพื้นฐาน SDR และแผนที่การขยายเป็นไฟล์ PNG ไฟล์เดียว
รายละเอียดการเข้ารหัส PNG มีดังนี้
- แผนที่อัตราขยายจะเข้ารหัสเป็นรูปภาพ PNG ซึ่งประกอบด้วยข้อมูลโค้ด gmAP ที่มีข้อมูลเมตา ISO 21496-1 สำหรับแผนที่อัตราขยาย
- การแสดงผลพื้นฐาน SDR ได้รับการเข้ารหัสเป็นรูปภาพ PNG ซึ่งประกอบด้วยข้อมูลโค้ด gmAP ที่มีข้อมูลเมตา ISO 21496-1 เวอร์ชัน รูปภาพ PNG นี้ยังมีข้อมูล gdAT ที่มีไฟล์ PNG ของแผนที่การขยายสัญญาณที่เข้ารหัสทั้งหมดด้วย
รูปภาพต่อไปนี้แสดงเลย์เอาต์ของข้อมูลโค้ด PNG
รูปที่ 3 เลย์เอาต์ของข้อมูลโค้ด PNG
ใน Android 16 ตัวแปลงรหัส PNG จะรองรับทั้งการเข้ารหัสและการถอดรหัส PNG เหล่านี้ แอปสามารถแสดง PNG ที่มีแผนที่การขยายสัญญาณในลักษณะเดียวกับ Ultra HDR
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","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-27 UTC"],[],[],null,["# HDR in Android screenshots\n\nSince the introduction of high dynamic range (HDR) video, streaming services\nhave started streaming HDR video, focusing on full-screen\nexperiences. Recently, social media apps\nhave launched support for HDR video and Ultra HDR,\nindicating growing interest in HDR adoption across various apps.\n\nAndroid support for HDR\n-----------------------\n\nThe following are the milestones of Android's support for HDR technology over\nseveral years:\n\n### Android 7\n\n- Initial support for HDR video decoding and display.\n- Continued advancements in HDR capabilities.\n\n### Android 13\n\n- End-to-end support for HDR video capture, encoding, and display.\n- Introduction of [Mixed SDR and HDR composition](/docs/core/display/mixed-sdr-hdr), defining different displayable luminance ranges between SDR and HDR.\n\n### Android 14\n\n- Support for HDR images with [Ultra HDR](https://developer.android.com/media/grow/ultra-hdr).\n\nScreenshot support with HDR has also evolved and undergone a number of changes\nover the years.\n\nAdvancements in HDR screenshot capabilities\n-------------------------------------------\n\nThis section tracks the progression of HDR screenshot capability in recent\nAndroid updates.\n\n### Android 9\n\nSurfaceFlinger, Android's graphics compositor, introduces HDR video support. GPU\nrendering of HDR video and screenshots is supported with a complex polynomial\ntone mapper. This tone-mapping curve isn't always equivalent to the display\ntone-mapper, so screenshots differ from the on-screen content.\n\n### Android 13\n\nA [tone mapping](/docs/core/display/tone-mapping) plugin is added to the\nSurfaceFlinger's GPU rendering block, enabling the OEM to provide a GPU shader\nto match their display's tone-mapping curve. Screenshots almost match what is on\nscreen, but with the following differences:\n\n- Screenshots remain in SDR format. Consequently, when viewed alongside an HDR scene, the HDR regions within the screenshot appear dimmer.\n- SDR luminance isn't managed, resulting in SDR content within the screenshot appearing as bright as HDR content.\n\nIn other words, any HDR video captured in the screenshot is converted to SDR\nvideo.\n\n### Android 14\n\nUltra HDR poses a significant challenge to screenshotting. Unlike videos, images\nare typically rendered within the UI framebuffer, which has two main\nimplications:\n\n- Images can't have image processing, including tonemapping, that differs from the surrounding UI.\n- Apps are responsible for source-based tone mapping when rendering their UI.\n\nTo alleviate this challenge, there are three potential screenshotting\nimplementations:\n\n- Preserve the HDR details of an Ultra HDR image, resulting in a darkened app UI in the screenshot.\n- Preserve the app UI details, causing Ultra HDR image clipping.\n- Compromise by brightening the app UI while clipping HDR highlights.\n\nAndroid 14 implements the third approach of brightening the app UI and clipping\nHDR highlights.\n\n### Android 15-QPR1\n\nSurfaceFlinger includes a local tone-mapping algorithm for screenshots. This\nprocess involves:\n\n- Dividing the input image into smaller images.\n- Computing the maximum luminance in each image, and discarding low luminance values within each section.\n- Interpolating the computed luminances through blurring and resampling.\n- Applying a parameterized Reinhard tonemapper to the input image, based on the interpolated luminance values.\n\nThis algorithm shows significant screenshot improvements between Android 14 and\nAndroid 15-QPR1, as shown in the following examples:\n\n- Example 1 is a screenshot of an HDR video overlaid on top of a Chrome\n page containing Ultra HDR. The UI colors are mostly preserved in the new\n implementation, and the image is no longer clipped.\n\n | Android 14 | Android 15-QPR1 |\n |------------|-----------------|\n | | |\n\n **Figure 1.** Comparison of Android 14 and Android 15-QPR1 for Example 1.\n- Example 2 is a screenshot of an HDR video overlaid on top of **Settings**\n with subsequent screenshots. In Android 14, the screenshot colors are\n successively darker. In Android 15-QPR1, the tonemapper correctly replicates and\n preserves the UI colors.\n\n | Android 14 | Android 15-QPR1 |\n |------------|-----------------|\n | | |\n\n **Figure 2.** Comparison of Android 14 and Android 15-QPR1 for Example 2.\n\n### Android 16\n\nSimilar to [Ultra HDR](https://developer.android.com/media/platform/hdr-image-format),\nHDR screenshots store a gainmap in the screenshot file to recover the HDR\nrepresentation during rendering. However, unlike Ultra HDR, the screenshot\nremains in a PNG format for backward compatibility with systems that ingest\nPNG screenshots.\n\nThe screenshot generation details are as follows:\n\n- When HDR content is displayed on the device, a screenshot is generated using FP16 pixels.\n- The local tone-mapper described in [Android 15-QPR1](/docs/core/graphics/hdr-screenshots#android15qpr-hdr-shot) generates an 8-bit base SDR rendition.\n- An 8-bit gainmap is produced by combining the SDR base rendition with the HDR rendition.\n- The SDR base rendition and the gainmap are encoded into a single PNG file.\n\nThe PNG encoding details are as follows:\n\n- The gainmap is encoded as a PNG image, which includes a gmAP chunk, containing the [ISO 21496-1](https://www.iso.org/standard/86775.html) metadata for the gainmap.\n- The SDR base rendition is encoded as a PNG image, which includes a gmAP chunk, containing the version of the [ISO 21496-1](https://www.iso.org/standard/86775.html) metadata. This PNG image also includes a gdAT chunk, containing the entirety of the encoded gainmap PNG.\n\nThe following figure shows the layout of the PNG chunks:\n\n**Figure 3.** Layout of the PNG chunks.\n\nWith Android 16, the PNG codec supports both encoding\nand decoding of these PNGs. Apps can display a PNG with a gainmap in the same\nmanner as [Ultra HDR](https://developer.android.com/media/grow/ultra-hdr/display)."]]