codec/h264/h264dec: implement CAVLC parsing process

Issue #142 on hold
Saxon Milton created an issue

We will not have all components of this process (will be done in later PRs) therefore stubs will be used for the time being. Specification section is as follows:

9.2 CAVLC parsing process for transform coefficient levels
This process is invoked for the parsing of syntax elements with descriptor equal to ce(v) in clause 7.3.5.3.2 when
entropy_coding_mode_flag is equal to 0.
Inputs to this process are bits from slice data, a maximum number of non-zero transform coefficient levels maxNumCoeff,
the luma block index luma4x4BlkIdx or the chroma block index chroma4x4BlkIdx, cb4x4BlkIdx or cr4x4BlkIdx of the
current block of transform coefficient levels.
Output of this process is the list coeffLevel containing transform coefficient levels of the luma block with block index
luma4x4BlkIdx or the chroma block with block index chroma4x4BlkIdx, cb4x4BlkIdx or cr4x4BlkIdx.
The process is specified in the following ordered steps:

  1. All transform coefficient level values coeffLevel[ i ], with indices i ranging from 0 to maxNumCoeff − 1, in the
    list coeffLevel are set equal to 0.
  2. The total number of non-zero transform coefficient levels TotalCoeff( coeff_token ) and the number of trailing one
    transform coefficient levels TrailingOnes( coeff_token ) are derived by parsing coeff_token as specified in
    clause 9.2.1.
  3. The following then applies:
    – If the number of non-zero transform coefficient levels TotalCoeff( coeff_token ) is equal to 0, the list
    coeffLevel (in which all transform coefficient level values are equal to 0) is returned and no further steps are
    carried out.
    – Otherwise, the following steps are carried out:
    a. The non-zero transform coefficient levels are derived by parsing trailing_ones_sign_flag, level_prefix,
    and level_suffix as specified in clause 9.2.2.
    b. The runs of zero transform coefficient levels before each non-zero transform coefficient level are derived
    by parsing total_zeros and run_before as specified in clause 9.2.3.
    c. The level and run information are combined into the list coeffLevel as specified in clause 9.2.4.

Comments (2)

  1. Log in to comment