Tuning Visual Quality - 2023.1 English

H.264/H.265 Video Codec Unit v1.2 Solutions LogiCORE IP Product Guide (PG252)

Document ID
Release Date
2023.1 English

Quality of encoded video is primarily a function of target-bit rate and the type of the video content. There few encoder parameters which can be used to adjust the encoder quality. Perform the following steps to debug HEVC/AVC encoder quality issues.

  1. Adjust the number of B-frames (Gop.NumB) according to the amount of motion, e.g. increased to 2 for static scenes or video conference-like of content, or reduced to 0 for sequences with a lot of motion and/or high frame rates
  2. The VBR rate control mode can improve the average quality when some parts of the sequence have lower complexity and/or motion
  3. For video conference or when random access is not needed, replace the IPP... GOP by the LOW_DELAY_P GOP and optionally enable the GDR intra refresh
  4. If there are many scene changes, enable the ScnChgResilience setting to reduce artifacts following scene change transitions
  5. If scene changes can be detected by the system, the encoder's scene change signaling API should be called instead (i.e. with ScnChgResilience disabled) for the encoder to dynamically adapt the encoding parameters and GOP pattern. The scene change information can be provided in a separate input file (CmdFile) when using the control software test application.
    Tip: To improve the video quality, consider using Scene Change Detect hardware.
  6. If the highest PSNR figures are targeted instead of subjective quality, it is recommended to set QPCtrlMode = UNIFORM_QP and ScalingList = FLAT.
  7. Evaluate the valid bit rate range for the given video stream by using CONST_QP rate control algorithm.
  8. Use a QP value of 22, 27, 32, 37 with the CONST_QP rate control algorithm
  9. Using the bit rate range from step 2, evaluate PSNR for CBR/VBR/Low latency rate control algorithms
  10. Run similar experiments for libx264 or libx265 encoders.

    Here is an example pipeline for CBR:

    ffmpeg -s 1280x720 -pix_fmt yuv420p -framerate 50 -I /srv/data1/kvikrama/vcu_video_quality_runs/source/old_town_cross_420_720p50.yuv -c:v libx265 -preset medium -x265-params bframes=0:ref=1:keyint=30:rc lookahead=0:ipratio=1:pbratio=1:trellis=0 -b:v 1M -minrate 1M -maxrate 1M -bufsize 2M  -frames 500  old_town_cross_420_720p50_x265.mp4
  11. Calculate the BD-rate using JCT-VC common test conditions evaluation metric.
  12. If there is difference in PSNR between VCU and libx264/libx265, tune the following parameters to see impact:

MinQP, MaxQP, ScnChgResilience (should be Enabled), NumSlices (set to 1).