Log in Try for free
◀Back to blog

VQ Analyzer — Guided Tour. “YUV Diff” functionality.

2020-04-10
Roman Guskov
Written by Roman Guskov Follow on Medium

Welcome to the third part of our VQ Analyzer (Video Codec Analyzer) Guided Tour! Delighted to have you along.

Before we go any further, it’s worth taking a quick look at our previous tours of the “YUV Viewer” and “Frame View” functions.

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. Overview.

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. Overview.

pic 1. VQ Analyzer ver.4.2. Overview.

And before we get going properly, a few words about the VQ Analyzer itself…

The VQ Analyzer is just the tool you need for deep diving into video coding standards: it supports HEVC/H.265, AV1, VP9, AVC/H.264, MPEG2 and VVC/H.266

This Analyzer allows you to inspect each step of the decoding process. You can monitor any syntax element, and explore each individual structure of the coded image — invaluable features if you’re a lover of stats and details. These tools can then be used, in professional settings, for debugging and for codec development. If you’re a researcher or student, it is a great source and reference tool for studying any video codec standard. While we’re on the subject, we have special rates if you’re after an Analyzer for academic uses!

General info

The titular YUV mode is there to help you inspect the final decoded sample values without any additional overlay data. This mode also has the YUVDiff feature.

Opening the bitstream file.

Just drag and drop your YUV file into the Analyzer, or go through the File -> Open Bitstream if you prefer the old-fashioned way.

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. Opening the bitstream file.

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. Opening the bitstream file.

pic 2. VQ Analyzer ver.4.2. Opening the bitstream file.

Debug YUV lets you compare an external decoded YUV file with the decoded bitstream. Supported formats are as follows:

  • HEVC: (ISO/IEC 23008–2 MPEG-H Part 2 or ITU-T H.265), 8/10-bit
  • HEVC: RExt extension, 8/10/12-bit, 4:0:0/4:2:0/4:2:2/4:4:4
  • HEVC: SCC extension, conform to HM + SCM 8.6 in reference code
  • HEVC Scalable/Multiview Extension
  • AV1, SHA-1 (Version 1.0.0 Errata.1): add4b15580e410c00c927ee366fa65545045a5d9
  • Google’s VP9, profiles 0,1,2,3, 4:2:0/4:2:2/4:4:0/4:4:4, 8/10/12-bit
  • AVC: (H.264/AVC, ISO/IEC 14496–10, MPEG-4 Part 10)

When the bitstream is loaded, click YUVDiff -> Open Debug YUV:

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. Opening a YUVDiff menu.

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. Opening a YUVDiff menu.

pic 3. VQ Analyzer ver.4.2. Opening a YUVDiff menu.

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. Opening a Debug YUV.

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. Opening a Debug YUV.

pic 4. VQ Analyzer ver.4.2. Opening a Debug YUV.

Debug YUV

When a YUV file is loaded, any mismatches will be pointed out for you with a red dot (as below), which will be inside the CU containing the mismatch. This should help you to quickly identify the nature of any mismatch, which can in turn help with debugging, should any pesky bugs show themselves.

VQ Analyzer(AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. YUV Viewer default mode, when a debug YUV file is loaded.

VQ Analyzer(AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. YUV Viewer default mode, when a debug YUV file is loaded.

pic 5. VQ Analyzer ver.4.2. YUV Viewer default mode, when a debug YUV file is loaded.

Click “Diff YUV” to see the difference between your Original frame and Debug frame. Identical Original and Debug images are just a flat gray. Areas where the debug YUV has a lower value are darker, and areas where the debug YUV has a higher value are lighter and brighter.

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. YUV Viewer, when a Diff YUV mode is chosen.

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. YUV Viewer, when a Diff YUV mode is chosen.

pic 6. VQ Analyzer ver.4.2. YUV Viewer, when a Diff YUV mode is chosen.

Click “Rel” to check the YUV difference plane as relative between reference and debug pixelm or “Abs” to check absolute difference values. This will prove to be very useful if you’re looking to identify particular pixels that show some kind of difference.

VQ Analyzer(AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. YUV Viewer. Diff YUV: Rel (relative) and Abs (absolute) mode

VQ Analyzer(AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. YUV Viewer. Diff YUV: Rel (relative) and Abs (absolute) mode

pic 7. VQ Analyzer ver.4.2. YUV Viewer. Diff YUV: Rel (relative) and Abs (absolute) modes.

YUVDiff Menu

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. Opening a YUVDiff menu.

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. Opening a YUVDiff menu.

pic 8. VQ Analyzer ver.4.2. Opening a YUVDiff menu.

  • Open: Brings up a file chooser to open a YUV file. The VQ Analyzer counts the YUV stream as having the same frame size, per frame bitdepth and color format as the encoded bitstream.
  • Close: Closes the currently opened YUV file, of course. Any mismatch indicators will disappear.
  • Planar: Makes the VQ Analyzer interpret the loaded YUV file as Planar.
  • Interleaved: Makes the VQ Analyzer interpret the loaded YUV file as Y values followed by interleaved U and V values. This option is chosen automatically by default when the loaded YUV file has the file extension “.nv12”.
  • Display order: Makes the VQ Analyzer use display order picture numbers when determining how far to dig into the YUV file to extract the image that it can then compare with the current picture.
  • Decode order: Makes the VQ Analyzer use decode order picture numbers when determining how far to dig into the YUV file to extract the image to compare with the current picture.
  • Use stream crop values: When this is checked or selected, YUV files are assumed to contain samples only within the cropping window as defined by the loaded bitstream. Samples outside this window are not compared, and are assumed 0 when viewing the loaded YUV image directly.
  • Set picture offset here: a handy shortcut for setting the picture offset to the current picture number.
  • Use 16 bit YUV: this option allow you to load aYUV file with both Luma and Chrome written in 16 bit (they could be normalized from actual bitdepth to 16 bit during encoding). This is useful when you have bitdepth that changes across the stream. The VQ Analyzer will shift values to the appropriate bitdepth on the current frame.
  • Picture offset: This brings up a dialog allowing the user to enter the picture number of the first picture in the YUV file. For example if a 100-picture bitstream is loaded but the YUV file only contains pictures 80–99, you would enter 80 to properly line up the YUV file with the decoded bitstream.
  • Check for file changes: When checked or selected, this option makes the VQ Analyzer periodically check whether the loaded YUV file has changed on disk since it was last loaded. If the file has indeed changed in some way, a dialog box pops up offering you the chance to reload the YUV file.

Find first difference with Debug YUV

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. “Searching for first difference” mode.

VQ Analyzer (AVC/H.264, HEVC/H.265, VP9, AV1, VVC/H.266) ver.4.2. “Searching for first difference” mode.

pic 9. VQ Analyzer ver.4.2. “Searching for first difference” mode.

This feature works for all codecs - VP9, HEVC, AVC, MPEG2 and AV1. By pressing on the button with the magnifier icon, you start the sequential search in decode order for the difference between reconstructed YUV and reference YUV that should be preloaded via YUVDiff menu. The search will run on till the first difference is found, or to the end of the stream. If you suddenly find yourself overcome with a wave of impatience and you don’t want to wait for search completion, the process can be cancelled it at any time with the ‘cancel’ button in the info modal dialog. The search always starts from the first picture in the decoder order.

Well, there you have it!

Don’t stray away, the next part of the VQ Analyzer tour is already in the works…

Thanks to Alexander Dydychkin.