fix(text): match official bit rate units and precision - #37
Conversation
The three bit rate formatters each used a different rule, and none matched official MediaInfo. Rates below 10 kb/s printed as a rounded "0 kb/s" instead of b/s, rates between 10 and 100 kb/s lost their decimal, and every rate above 10 Mb/s kept a decimal that official drops past 100 Mb/s. Replace all three with one function that follows MediaInfoLib Kilo_Kilo123 (File__Analyze_Streams.cpp): each unit tier keeps one decimal until the source value passes ten times the tier, the division is done in float32, and every boundary is a strict "greater than", so 10 000 000 b/s still prints as "10 000 kb/s". Verified against official v23.04 on 32 real files: 2 better, 30 same, 0 worse, with JSON and --language=raw output byte-identical on every file, including the BDAV and DVD controls.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe shared bitrate formatter now uses MediaInfo-compatible unit tiers, scaling, rounding, and precision. DVD, Matroska, and MPEG-PS reporting paths use it. Unit tests and golden fixtures cover the updated output. ChangesBitrate formatting
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
This continues the default-text parity work in #32, #33, #35, and #36, and fixes the first of the two defects left on the list in
AGENTS.md.The three bit rate formatters each used a different rule and none matched official MediaInfo. They are now one function that follows MediaInfoLib
Kilo_Kilo123: each unit tier keeps one decimal until the source value passes ten times the tier, and every boundary is a strict "greater than", so 10 000 000 b/s still prints as10 000 kb/s. Measured against official v23.04 on 32 real files: 2 better, 30 same, 0 worse, with JSON and--language=rawoutput byte-identical on every file.Summary by CodeRabbit