Quantization Parameter (QP) File Format - 2023.1 English

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

Document ID
PG252
Release Date
2023-05-16
Version
2023.1 English

The QP table modes are enabled by using QpCtrlMode = LOAD_QP or QpCtrlMode = LOAD_QP | RELATIVE_QP.

In this case, the reference model uses the file QPs.hex in working directory to specify the QP values at LCU level. Each line of QPs.hex contains one 8-bit hexadecimal value. For H.264 (AVC), there is one byte per 16×16 MB (in raster scan format): absolute QP in [0;51] or relative QP in [‑32;31]. For H.265 (HEVC), there is one byte per 32×32 LCU (in raster scan format): absolute QP in [0;51] or relative QP in [‑32;31].

Note: Only the 6 LSBs of each byte are used for QP or Segment ID, the 2 MSBs are reserved.

For example, to specify the following relative QP table:

‑1 ‑2 0 1 1 4
‑4 ‑1 1 2 2 1
‑1 0 ‑1 1 1 4
0 0 ‑2 2 2 6
1 ‑2 0 1 4 2

The QPs.hex file for H.265 (HEVC) is:

3F
3E
00
01
01
04
3C
3F
...

If a file with name equal to QP_<frame number>.hex is present in the working folder, the encoder uses it for frame number <frame number> instead of QPs.hex.

For example if you have the following files in the working folder:

  • QP_0.hex
  • QP_4.hex
  • QPs.hex

The encoder uses QP_0.hex for frame #0, QP_4.hex for frame #4 and QPs.hex for all other frames (that is, frame #1, #2, #3, #5, #6 ...).