一键导入
codec-rd-eval
Encoder RD evaluation of C ref model: BD-PSNR/BD-rate (VCEG-M33) across sequences/QPs — 'RD eval', 'BD-rate', codec algorithm quality comparison.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Encoder RD evaluation of C ref model: BD-PSNR/BD-rate (VCEG-M33) across sequences/QPs — 'RD eval', 'BD-rate', codec algorithm quality comparison.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Read-only architecture review of RTL vs uArch spec with area/timing/power tradeoffs. Use for post-RTL architecture sign-off or suspected spec mismatch.
Builds Phase 3 SystemC TLM-2.0 bus functional models with AMBA (AXI/AHB/APB) support. Use for 'develop BFM', 'SystemC TLM model', 'bus functional model'.
Validate spec contracts across phase boundaries (P3 uarch to P4 RTL to P5 verify): port widths, memory class, REQ traceability. Use at P4/P5 entry.
Internal reference: p1 spec research policy (agent-loaded; do not invoke).
Full 6-phase RTL pipeline from spec to verified design (P1 research through P6 design note). Triggers: 'design a chip', 'full pipeline', 'autopilot'.
Initialize RTL project workspace: directory structure, coding rules, phase guides. Run once per project. Triggers: 'init project', 'new project'.
| name | codec-rd-eval |
| description | Encoder RD evaluation of C ref model: BD-PSNR/BD-rate (VCEG-M33) across sequences/QPs — 'RD eval', 'BD-rate', codec algorithm quality comparison. |
| user-invocable | true |
This skill automates the full Rate-Distortion evaluation pipeline:
Scope: Encoder RD evaluation only.
This skill evaluates encoder quality metrics (BD-PSNR, BD-rate, optional SSIM/VMAF).
For decoder conformance testing against JVET/JCTVC bitstreams, use /rtl-agent-team:codec-conformance-eval.
Phase-agnostic: While commonly used during rat-dse Step 3b, this skill can be invoked at any Phase where quantitative RD comparison of encoder configurations is needed — Phase 1 (algorithm exploration), Phase 2 (architecture validation), Phase 4 (fixed-point precision impact), or standalone evaluation outside the pipeline.
Execution modes:
Key features:
{encoder}, {cfg}, {input}, {width}, {height}, {fps}, {frames}, {qp}, {bitstream}, {recon}, {bit_depth}, {chroma_format}<Use_When>
<Do_Not_Use_When>
/rtl-agent-team:rtl-model-consistency instead)/rtl-agent-team:codec-conformance-eval)/rtl-agent-team:rtl-conformance-test)<Why_This_Exists> In codec design, algorithm selection has the highest impact on final quality and area. Theoretical complexity analysis (operations/pixel, gate estimates) provides useful guidance but cannot capture the full picture — actual RD performance on representative sequences is the definitive metric.
BD-PSNR/BD-rate (VCEG-M33) is the universally accepted method in the video coding community for comparing codec configurations. It normalizes across different operating points (QP values) to produce a single, meaningful comparison metric.
Without this skill, teams either skip quantitative RD evaluation (risking suboptimal algorithm selection) or manually set up evaluation infrastructure (time-consuming and error-prone). </Why_This_Exists>
<Execution_Policy>
python3 {plugin_root}/skills/codec-rd-eval/scripts/bd_rate.py --test runs built-in unit tests ({plugin_root} = plugin root resolved from .rat/state/spawn-context.json)
</Execution_Policy>Encoder build (build_encoder.sh)
bash {plugin_root}/skills/codec-rd-eval/scripts/build_encoder.sh <src> <binary> [extra_cflags]gcc -std=c11 -O2 -Wall -Wextra -lm (C11 standard per CLAUDE.md)Simulation execution (run_eval.py)
python3 {plugin_root}/skills/codec-rd-eval/scripts/run_eval.py <config.hjson> --mode localpython3 {plugin_root}/skills/codec-rd-eval/scripts/run_eval.py <config.hjson> --mode aws-batch.rat/scratch/rd-eval/results.jsonBD-PSNR/BD-rate calculation (bd_rate.py)
python3 {plugin_root}/skills/codec-rd-eval/scripts/bd_rate.py .rat/scratch/rd-eval/results.json --output .rat/scratch/rd-eval/bd-metrics.json.rat/scratch/rd-eval/bd-metrics.jsonReport generation
<Tool_Usage>
# ============================================================
# Step 1: Prerequisite validation
# ============================================================
Glob("refc/*.c") # Verify encoder source exists
Read("<test-config.hjson>") # Read test configuration
Bash("python3 -c 'import numpy; import hjson; print(\"OK\")'") # Check dependencies
# ============================================================
# Step 2: Encoder build (for each unique encoder_src)
# ============================================================
Bash("bash {plugin_root}/skills/codec-rd-eval/scripts/build_encoder.sh refc .rat/scratch/rd-eval/anchor_encoder")
Bash("bash {plugin_root}/skills/codec-rd-eval/scripts/build_encoder.sh refc .rat/scratch/rd-eval/test_encoder")
# ============================================================
# Step 3: Simulation execution (parallel)
# ============================================================
Bash("python3 {plugin_root}/skills/codec-rd-eval/scripts/run_eval.py <config.hjson> --mode local",
timeout=600000) # Up to 10 min for large evaluations
# ============================================================
# Step 4: BD metric calculation
# ============================================================
Bash("python3 {plugin_root}/skills/codec-rd-eval/scripts/bd_rate.py .rat/scratch/rd-eval/results.json --output .rat/scratch/rd-eval/bd-metrics.json")
# ============================================================
# Step 5: Report generation
# ============================================================
# Read bd-metrics.json and generate markdown report
Read(".rat/scratch/rd-eval/bd-metrics.json")
# Write report to configured output path
</Tool_Usage>
**Example 1: Algorithm comparison during DSE** ``` User: "Compare RD performance of 3 H.264 intra prediction algorithm candidates" → Invoke /rtl-agent-team:codec-rd-eval → Step 1: Verify refc/ exists, generate test-config.hjson (candidates[] mode) → Step 2: Build 3 encoders: SAD, Hadamard, SATD+RDOQ → Step 3: Simulate BasketballDrill, BQTerrace, RaceHorses × QP{22,27,32,37} → Step 4: vs SAD(anchor): Hadamard BD-rate=-3.2%, SATD+RDOQ BD-rate=-5.1% → Step 5: Generate docs/phase-1-research/rd-eval-report.md (with N-candidate matrix) → "SATD+RDOQ achieves best BD-rate -5.1% over SAD. Hadamard gives -3.2%." ```Example 2: Fixed-point precision evaluation with SSIM
User: "Measure quality difference between 12-bit vs 16-bit internal paths including SSIM"
→ quality_metrics: ["psnr", "ssim"] configured
→ anchor: 16-bit internal path encoder
→ test: 12-bit internal path encoder
→ BD-PSNR = -0.02 dB, BD-rate = +0.5%, SSIM delta = -0.0001
→ "12-bit path shows BD-rate +0.5% vs 16-bit, negligible SSIM difference (-0.0001). Recommend 12-bit considering gate count savings."
Example 3: No encoder source available
User: "Run BD-rate comparison"
→ Step 1: refc/*.c not found
→ "No ref C model encoder source found. Run /rtl-agent-team:ref-model first to generate the reference model."
<Escalation_And_Stop_Conditions>
<Final_Checklist> Before reporting completion, verify ALL of the following:
If ANY item is unchecked → DO NOT report completion. Fix the issue first. </Final_Checklist>