关于HM Test Model 16.9中绝对差之和(SAD)的获取与输出配置问询
Hey there! I’ve worked with HM Test Model 16.9 extensively, so I can walk you through how to extract and save SAD values—even though the official manual might not cover this in detail. Here's a step-by-step breakdown:
1. Enable SAD Calculation via Configuration File
HM uses .cfg files for encoder/decoder settings, and you’ll need to tweak a couple of parameters to turn on SAD output:
- First, enable distortion metric output globally:
This flag tells the codec to generate and print all enabled distortion metrics, including SAD.OutputDistortionMetrics=1 - Next, explicitly specify SAD as a metric to calculate (it’s often enabled by default, but setting it manually avoids surprises):
If you want to output other metrics alongside SAD (like SSD or PSNR), just separate them with commas:DistortionMetricList=SADDistortionMetricList=SAD,SSD,PSNR.
2. Redirect Output to a Text File
HM’s encoder/decoder prints logs to the console by default. To save these logs (including SAD values) to a text file, use command-line redirection when you run the tool.
For example, if your encoder command looks like this:
TAppEncoderStatic -c encoder_lowdelay_main.cfg -i input.yuv -o output.bin
Modify it to add redirection:
TAppEncoderStatic -c encoder_lowdelay_main.cfg -i input.yuv -o output.bin > sad_results.log 2>&1
The > sad_results.log part sends standard output to the file, and 2>&1 ensures error messages are also included (useful for debugging if something goes wrong).
3. Extract SAD Values from the Log File
Once the encoding/decoding process finishes, open sad_results.log with any text editor. You’ll find SAD values broken down per frame, plus a total sum at the end, looking something like this:
SAD: total = 98765432, average = 45.67
If you only need the overall total, just search for the final "total" entry in the log.
Quick Extra Tips
- This method works for both the encoder (
TAppEncoderStatic) and decoder (TAppDecoderStatic)—just apply the same config file tweaks and command-line redirection. - Double-check that no other config parameter is overriding
OutputDistortionMetrics(some custom configs might disable this by default to speed up processing).
内容的提问来源于stack exchange,提问作者kaito87

