Skip to content

feat(video): detect HDR Vivid metadata in performance overlay - #86

Merged
qiin2333 merged 2 commits into
masterfrom
codex/hdr-vivid-overlay-detection
Jul 27, 2026
Merged

feat(video): detect HDR Vivid metadata in performance overlay#86
qiin2333 merged 2 commits into
masterfrom
codex/hdr-vivid-overlay-detection

Conversation

@qiin2333

@qiin2333 qiin2333 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

改了啥呀

  • 新增 HEVC Annex-B SEI 扫描器,支持跨 scatter segment 起始码、RBSP 防竞争字节,以及 prefix/suffix SEI
  • 按 CUVA 005.1 的 T.35 标识 0x26 / 0x0004 / 0x0005 判断真实 HDR Vivid 动态元数据
  • 将检测结果通过 native stats、NAPI 和 StreamingSession 送到性能覆盖层
  • 解码器标签现在区分 HDR PQHDR HLGHDR Vivid
  • 补充有效 CUVA、普通 HEVC、HDR10+、分段输入和防竞争字节测试

为啥要改

HLG 配置只能说明传输函数,不能证明码流真的带了 HDR Vivid 动态元数据。现在直接看码流证据,纯 HLG 不用再被杂鱼误判硬塞成 Vivid 啦。

扫描仅发生在 HEVC HLG 会话开始阶段,命中后保持会话状态,避免给正常解码路径增加持续开销。

验证

  • c++ -std=c++17 -Wall -Wextra -Werror -I nativelib/src/main/cpp nativelib/src/main/cpp/hdr_vivid_metadata_scanner.cpp nativelib/src/test/cpp/hdr_vivid_metadata_scanner_test.cpp -o /tmp/moonlight_hdr_vivid_scanner_test && /tmp/moonlight_hdr_vivid_scanner_test
  • npm run check:scripts
  • DEVECO_SDK_HOME=/Users/mac/ohos-sdk-cache/6.1-Release-mac/sdk-ci-shape JAVA_HOME=/Applications/DevEco-Studio.app/Contents/jbr/Contents/Home node hvigorw.js assembleApp --mode project -p product=default -p buildMode=debug --no-daemon
  • Hvigor 完整构建成功;仅有仓库原有的设备类型、签名和 API 弃用警告

Summary by CodeRabbit

  • 新功能

    • 新增 HDR Vivid 内容检测,可在播放统计中显示检测结果。
    • 性能面板中的解码器信息支持更精确区分 HDR Vivid、HDR HLG 和 HDR PQ。
  • 问题修复

    • 优化 HDR 视频解码信息展示,确保其与实际视频元数据保持一致。

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@qiin2333, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d9e58fc3-cebf-4fce-9068-50b3651d1699

📥 Commits

Reviewing files that changed from the base of the PR and between 7cca95c and 10a54a6.

📒 Files selected for processing (3)
  • nativelib/src/main/cpp/video_decoder.cpp
  • nativelib/src/main/cpp/video_decoder.h
  • nativelib/src/test/cpp/hdr_vivid_metadata_scanner_test.cpp
📝 Walkthrough

Walkthrough

新增 HDR Vivid 元数据扫描器,在 HEVC HLG 解码过程中检测 CUVA T.35 SEI,并将结果经 native bridge 与串流统计传递至性能覆盖层,显示 HDR Vivid、HLG 或 PQ 解码器信息。

Changes

HDR Vivid 检测链路

Layer / File(s) Summary
CUVA 元数据扫描器
nativelib/src/main/cpp/hdr_vivid_metadata_scanner.*, nativelib/src/main/cpp/CMakeLists.txt
新增支持分段 Annex-B 数据、SEI/RBSP 解析、CUVA 标识匹配的扫描器,并加入 native 构建。
解码器探测与统计输出
nativelib/src/main/cpp/video_decoder.*, nativelib/src/main/cpp/moonlight_bridge.cpp
VideoDecoder 在限定的 HEVC HLG 解码单元中执行扫描,并将检测结果加入视频统计和 bridge 返回对象。
串流统计与覆盖层展示
entry/src/main/ets/service/streaming/StreamingSession.ets, entry/src/main/ets/components/PerformanceOverlay*.ets
串流统计传递 hdrVivid,覆盖层同步该状态,并生成 HDR Vivid、HLG 或 PQ 解码器文案。
扫描器行为验证
nativelib/src/test/cpp/hdr_vivid_metadata_scanner_test.cpp
测试分段输入、前后缀 SEI、无关 T.35 数据及仿真防护字节场景。

Estimated code review effort: 4 (Complex) | ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次变更:在性能覆盖层中检测并展示 HDR Vivid 元数据。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/hdr-vivid-overlay-detection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@nativelib/src/test/cpp/hdr_vivid_metadata_scanner_test.cpp`:
- Line 28: Replace the sole assert in main’s ScanSegments test with an explicit
failure check that remains active in release builds. When ScanSegments(segments)
returns false, emit an error message and return a nonzero status; retain the
success path only when scanning succeeds.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fc7bc75c-e44e-4a9d-8aaf-7ecb76f5b55b

📥 Commits

Reviewing files that changed from the base of the PR and between de28af2 and 7cca95c.

📒 Files selected for processing (10)
  • entry/src/main/ets/components/PerformanceOverlay.ets
  • entry/src/main/ets/components/PerformanceOverlayManager.ets
  • entry/src/main/ets/service/streaming/StreamingSession.ets
  • nativelib/src/main/cpp/CMakeLists.txt
  • nativelib/src/main/cpp/hdr_vivid_metadata_scanner.cpp
  • nativelib/src/main/cpp/hdr_vivid_metadata_scanner.h
  • nativelib/src/main/cpp/moonlight_bridge.cpp
  • nativelib/src/main/cpp/video_decoder.cpp
  • nativelib/src/main/cpp/video_decoder.h
  • nativelib/src/test/cpp/hdr_vivid_metadata_scanner_test.cpp

Comment thread nativelib/src/test/cpp/hdr_vivid_metadata_scanner_test.cpp Outdated
@qiin2333
qiin2333 merged commit bcde18b into master Jul 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant