Methods for image encoding and decoding, encoders, decoders, and non-transitory computer-readable media
By combining dependent quantization and context-adaptive entropy coding, the problem of median rate and distortion balance in existing technologies is solved, which improves coding efficiency and coding quality and optimizes the utilization of information storage space.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- FRAUNHOFER GESELLSCHAFT ZUR FORDERUNG DER ANGEWANDTEN FORSCHUNG EV
- Filing Date
- 2019-09-24
- Publication Date
- 2026-07-31
AI Technical Summary
Existing coding techniques struggle to balance bit rate and distortion when setting quantization parameters, and their reliance on quantization increases coding complexity and reduces the storage space for context modeling information, thus affecting coding efficiency.
The coefficients of the transform block are encoded using a combination of dependent quantization and context-adaptive entropy coding, achieving more efficient encoding through these two methods.
It improves coding efficiency, reduces coding complexity, optimizes the utilization of information storage space, and enhances coding quality.
Smart Images

Figure CN118678074B_ABST
Abstract
Description
Technical Field
[0001] This application is a divisional application of application number 201980077366.X, entitled "Effective Encoding of Transform Coefficients Using or Applicable to Combinations with Scalar-dependent Quantization". This application relates to encoding at the transform coefficient level, such as for encoding images or videos. Background Technology
[0002] When setting quantization parameters, the encoder must make trade-offs. Coarse rendering of quantization reduces bit rate but increases quantization distortion, while finer rendering reduces distortion but increases bit rate. It's advantageous to have a concept at hand that, for a given domain of available quantization levels, it can improve encoding efficiency. One possibility is to use dependent quantization, where it relies on previously quantized and encoded data to stably adapt to quantization. However, dependencies in quantization also introduce problems such as increased encoding complexity and reduced storage space for performing context modeling, because dependencies affect the relationships between the data items to be quantized and encoded, thus impacting the availability of context-derived information for encoding individual syntactic elements. Summary of the Invention
[0003] It would be advantageous to implement a more efficient encoding of the coefficients of the transform block by using dependent quantization and context-adaptive entropy coding, or to set the concept that if a combination of dependent quantization and context-adaptive entropy coding is used, a more efficient encoding method can be achieved for the coefficients of the transform block.
[0004] The purpose of this invention is to provide a concept for encoding transform coefficient blocks.
[0005] This objective is achieved through the subject matter of the independent claims of this application.
[0006] The advantage lies in the subject matter of the dependent claims. Attached Figure Description
[0007] Preferred embodiments of this application are described below with reference to the accompanying drawings, in which: Figure 1 A block diagram of an exemplary video encoder is shown as an example for use as an image encoder, which may be implemented to operate according to any of the embodiments described below or incorporated into the functionality of the embodiments set forth herein.
[0008] Figure 2 shows a block diagram of a transform encoder; and (b) a transform decoder to illustrate the basic approach of block-based transform coding; Figure 3 The histogram of the distribution is shown, which illustrates the uniform reconstruction quantizer.
[0009] Figure 4 shows schematic diagrams of (a) a transform block subdivided into sub-blocks and (b) sub-blocks to illustrate an example of scanning transform coefficient levels, exemplarily used in H.265 | MPEG-H HEVC; specifically, (a) shows the division of a 16×16 transform block into 4×4 sub-blocks and the encoding order of the sub-blocks; (b) shows the encoding order of transform coefficient levels within the 4×4 sub-blocks. Subdivision can be exemplarily used in embodiments of this application for the permutation of coefficients to decode their flags and remainders, and for state transitions during dequantization of their flags and remainders.
[0010] Figure 5 illustrates a schematic diagram of the multidimensional output space spanned by one axis for each transform coefficient, and the positions of the reconstructed vectors allowed in the simple case of two transform coefficients: (a) independent scalar quantization; (b) examples of scalar quantization dependent on scalar quantization.
[0011] Figure 6 A block diagram is shown illustrating an embodiment of a media decoder using a transform decoder that relies on scalar quantization, thereby forming an embodiment of the media decoder according to this application. (Comparison) Figure 2b This allows us to derive a correction relative to conventional transform coding (with an independent scalar quantizer). Similarly, a similar correction can be made. Figure 2a The encoder is used to obtain an embodiment for encoding transform blocks using dependent scalar quantization.
[0012] Figure 7 This is a schematic diagram illustrating two sets of reconstruction levels for a quantization-dependent embodiment, entirely determined by a single quantization step size Δ. Two sets of available reconstruction levels are highlighted, denoted as set 0 (top line) and set 1 (bottom line). The numbers below the circles give examples representing the reconstruction levels within a set for the quantization index. Hollow and solid circles represent two distinct subsets within the set of reconstruction levels; these subsets can be used to determine the set of reconstruction levels for the next transform coefficient in the reconstruction sequence. Both sets include reconstruction levels equal to zero, but are otherwise disjoint, and both sets are symmetric around zero.
[0013] Figure 8 The following pseudocode illustrates an example of the reconstruction process for transform coefficients. `k` represents an index specifying the reconstruction order of the current transform coefficients, the quantization index for the current transform coefficient is denoted by `level[k]`, and the quantization step size `Δ` applied to the current transform coefficient is... k It is denoted by quant_step_size[k], while trec[k] represents the reconstructed transformation coefficients. The value of `setId[k]`. The variable `setId[k]` specifies the set of reconstruction levels applicable to the current transform coefficients. It is determined based on the previous transform coefficients in reconstruction order; the possible values of `setId[k]` are 0 and 1. The variable `n` specifies an integer factor of the quantization step size; it is given by the set of selected reconstruction levels (i.e., the value of `setId[k]`) and the quantization index `level[k]` of the transfer.
[0014] Figure 9 The pseudocode is shown. Figure 8 An alternative implementation of the pseudocode in . The main change is that multiplication with the quantization step is represented using integers for the scale and shift parameters. Typically, the shift parameter (denoted by shift) is constant for the transform block, and only the scaling parameter (given by scale[k]) may depend on the position of the transform coefficients. The addition of variables represents the rounding offset, which is typically set to equal add = (1 << (shift - 1)). In Δ k Given the nominal quantization step size of the transform coefficients, so that we have The parameters shift and scale [k] are selected in this way.
[0015] Figure 10 The following pseudocode illustrates an example of the reconstruction process for the transform coefficients of a transform block. The array level represents the transform coefficient level (quantization index) for the transmission of the transform block, and the array trec represents the corresponding reconstructed transform coefficients. The 2d table state_trans_table specifies the state transition table, and the table setId specifies the quantization set associated with the state.
[0016] Figure 11 This diagram illustrates the state transitions in dependency scalar quantization as a mesh structure. The horizontal axis represents different transformation coefficients in reconstruction order. The vertical axis represents the different states that may occur during dependency quantization and reconstruction. The connections shown specify the available paths between states for different transformation coefficients.
[0017] Figure 12a A schematic diagram of a transform block is shown, which is used for signaling to indicate the position of a first non-zero quantization index in coded order, the position of which is indicated by backfilling. In addition to the position of the first non-zero transform coefficient, only the binary bits of the shaded coefficients are transmitted, and the coefficients marked in white are inferred to be equal to 0.
[0018] Figure 12b A schematic diagram of the transform block is shown, along with a template for selecting the probabilistic model. The black square represents the current scan position, and the shaded square represents the local neighborhood used to derive the context model.
[0019] Figure 13 shows pseudocode based on a first embodiment of encoding transform coefficient blocks; Figure 14 A schematic diagram is shown, illustrating the representation of the quantization index by recursively bisecting the value range of the quantization index and according to the embodiment of FIG13 of the present invention. Figure 15 The diagram illustrates multiple passes of decoding in the example of Figure 13, where the coefficients are transformed in each pass according to the example of Figure 13, and which flags or prompts are encoded in which passes. Figure 16 is pseudocode illustrating a second embodiment of encoding the transform coefficient block; Figure 17 This is a schematic diagram illustrating a representation of the quantization index of the coefficients according to the embodiment of FIG16; Figure 18 is pseudocode illustrating a third embodiment of encoding the transform coefficient block; and Figure 19 shows pseudocode illustrating a fourth embodiment for encoding transform coefficient blocks.
[0020] In the embodiments described below, transform coding is used to transform a set of samples. The resulting transform coefficients are quantized using dependent quantization, and the resulting quantization index is entropy-encoded, i.e., context-adaptive arithmetic coding. On the decoder side, a set of reconstructed samples is obtained by correspondingly decoding the quantization index and dependently reconstructing the transform coefficients, such that the inverse transform yields the samples. The samples can be a portion of an image or video and can describe a patch of an image. Naturally, other possibilities also exist. The following description of the embodiments primarily focuses on lossy coding of blocks of prediction error samples in image and video codecs, but these embodiments can also be applied to other areas of lossy coding. In particular, there is no restriction on the set of samples forming rectangular blocks, nor on the set of samples representing prediction error samples (i.e., the difference between the original signal and the predicted signal).
[0021] All the latest video codecs, such as the international video coding standards H.264 | MPEG-4 AVC and H.265 | MPEG-H HEVC, follow the basic approach of hybrid video coding. The video image is divided into blocks, samples of the blocks are predicted using intra- or inter-image prediction, and transform coding is used to encode samples of the resulting prediction error signal (the difference between the original samples and the predicted samples).
[0022] Figure 1This diagram shows a simplified block diagram of a typical modern video encoder. Video images in a video sequence are encoded in a specific order, called the encoding order. The encoding order of the images may differ from the capture and display order. For actual encoding, each video image is divided into blocks. A block comprises samples of a rectangular region containing specific color components. The entity of a block corresponding to all color components of the same rectangular region is usually called a unit. Depending on the purpose of block partitioning, in H.265 | MPEG-H HEVC, there is a distinction between Code Tree Blocks (CTB), Code Blocks (CB), Prediction Blocks (PB), and Transform Blocks (TB). The associated units are called Code Tree Units (CTU), Code Units (CU), Prediction Units (PU), and Transform Units (TU).
[0023] Typically, video images are initially divided into fixed-size units (i.e., fixed-size blocks aligned for all color components). In H.265 | MPEG-H HEVC, these fixed-size units are called Coding Tree Units (CTUs). Each CTU can be further divided into multiple Coding Units (CUs). A Coding Unit is an entity for which a coding mode (e.g., intra-picture or inter-picture coding) is selected. In H.265 | MPEG-H HEVC, a CTU is broken down into one or more CUs, specified by a Quadtree (QT) syntax and transmitted as part of the bitstream. The CUs of a CTU are processed in a so-called z-scan order. This means that the four blocks resulting from the segmentation are processed in raster scan order; and if any block is further subdivided, the corresponding four blocks (including any smaller blocks included) are processed before the next block at the higher segmentation level is processed.
[0024] If the CU is encoded in an intra-coding mode, an intra-prediction mode is used for the luma signal, and if the video signal includes a chroma component, another intra-prediction mode is transmitted for the chroma signal. In ITU T H.265 | MPEG H HEVC, if the CU size is equal to the minimum CU size (as indicated in the sequence parameter set), the luma block can also be divided into four equal-sized blocks. In this case, for each of these blocks, a separate luma intra-prediction mode is transmitted. The actual intra-prediction and encoding are performed on a transform block basis. For each transform block of an intra-coded CU, a prediction signal is derived using samples of the same color components that have already been reconstructed. The algorithm used to generate the prediction signal for the transform block is determined by the transmitted intra-prediction mode.
[0025] A CU encoded in an inter-image coding mode can be further subdivided into multiple prediction units (PUs). A prediction unit is a luminance entity; for color video, it is two associated chroma blocks (covering the same image area), for which a set of prediction parameters is used. A CU can be encoded as a single prediction unit, or it can be subdivided into two non-square (supporting both symmetric and asymmetric subdivision) or four square prediction units. For each PU, a single set of motion parameters is transmitted. Each set of motion parameters includes the number of motion hypotheses (one or two in H.265 | MPEG-H HEVC), for each motion hypothesis, a reference image (indicated by a reference image index in the reference image list), and an associated motion vector. Furthermore, H.265 | MPEG-H HEVC provides a so-called merge mode where motion parameters are not explicitly transmitted but are derived based on motion parameters from spatially or temporally adjacent blocks. If a CU or PU is encoded in a merge mode, only an index of the list of motion parameter candidates (this list is derived using motion data from spatially and temporally adjacent blocks) is transmitted. This index fully determines the set of motion parameters used. Predictive signals for inter-coded PUs are formed through motion-compensated predictions. For each motion hypothesis (specified by a reference image and a motion vector), the predicted signal is formed from blocks of displacement in the specified reference image, where the displacement relative to the current PU is specified by the motion vector. Displacement is typically specified with subsample precision (in H.265 | MPEG HHEVC, the precision of the motion vector is one-quarter of a luma sample). For non-integer motion vectors, the predicted signal is generated by interpolating and reconstructing the reference image (typically using separable FIR filters). The final predicted signal for a PU with multiple hypothesis predictions is formed by a weighted sum of the predicted signals for each individual motion hypothesis. Typically, the same set of motion parameters is used for both luma and chroma blocks of the PU. Even though the latest video coding standards use translational displacement vectors to specify the motion of the current region (a block of samples) relative to the reference image, higher-order motion models (e.g., affine motion models) can be employed. In this case, additional motion parameters must be transmitted for the motion hypotheses.
[0026] For both intra-image and inter-image encoded CUs, the prediction error signal (also known as the residual signal) is typically transmitted via transform coding. In H.265 | MPEG-H HEVC, blocks of luminance residual samples and blocks of chrominance residual samples (if present) of the CU are divided into transform blocks (TBs). The partitioning of the CU to the transform blocks is indicated by a quadtree syntax, also known as the residual quadtree (RQT). The resulting transform blocks are encoded using transform coding: a 2D transform is applied to the blocks of residual samples, the resulting transform coefficients are quantized using independent scalar quantization, and the resulting transform coefficient levels (quantization indices) are entropy-coded. In P and B slices, at the beginning of the CU syntax, the skip_flag is transmitted. If this flag is equal to 1, it indicates that the corresponding CU is composed of a single prediction unit encoded in merge mode (i.e., the merge_flag is inferred to be 1), and all transform coefficients are equal to zero (i.e., the reconstructed signal is equal to the predicted signal). In this case, only merge_idx is transmitted in addition to the skip_flag. If skip_flag equals 0, a signal for the prediction pattern (intermittent or intra) is emitted, followed by the syntactic features mentioned above.
[0027] Since the encoded image can be used for motion compensation prediction of blocks in subsequent images, the image must be fully reconstructed in the encoder. The prediction error signal for the reconstruction of the block (obtained by reconstructing the transform coefficients of a given quantization index and performing an inverse transform) is added to the corresponding prediction signal, and the result is written to the buffer of the current image. After reconstructing all blocks of the image, one or more loop filters (e.g., deblocking filters and sample adaptive offset filters) can be applied. The final reconstructed image is then stored in the decoded image buffer.
[0028] The embodiments described below propose a concept for encoding blocks of transform coefficients, such as those related to prediction error. This concept applies to blocks encoded within and between images. It also applies to transform coding of non-rectangular sample regions. Unlike traditional transform coding, transform coefficients are not quantized independently. Instead, they are quantized using dependent quantization. According to dependent quantization, the set of available reconstruction levels for a particular transform coefficient depends on the quantization index chosen for the other transform coefficients.
[0029] All major video coding standards (including the latest standard H.265 | MPEG-H HEVC) use the concept of transform coding for coded blocks of prediction error samples. A block's prediction error sample represents the difference between samples of the original signal and samples of the predicted signal for that block. The prediction signal is obtained through intra-image prediction (in this case, based on reconstructed samples from adjacent blocks within the same image) or inter-image prediction (in this case, based on samples from reconstructed images). The original prediction error signal sample is obtained by subtracting the predicted signal sample value from the original signal sample value of the current block.
[0030] The transform coding of the sample blocks includes linear transform, scalar quantization, and entropy coding of the quantization index. On the encoder side (see...) Figure 2a Using linear analysis transformation A Transform N×M blocks of original samples. The result is N×M blocks of transform coefficients. Transform coefficient t k These represent the original prediction error samples in different signal spaces (or different coordinate systems). N×M transform coefficients are quantized using N×M independent scalar quantizers. Each transform coefficient... t k Mapped to quantization index q k Also known as the transform coefficient level. This refers to the obtained quantization index. q k Entropy encoding is performed and the data is written to a bit stream.
[0031] exist Figure 2b The decoder side shown decodes the transform coefficient levels from the received bitstream. q k Each transformation coefficient level q k Transformation coefficients mapped to reconstruction t’ k By using linear synthesis transformation B Transform the transformation coefficient block to obtain N×M blocks of reconstructed samples.
[0032] Even if the video coding standard only specifies the compositing transformation B However, the usual practice is to perform a synthetic transformation. B The reciprocal is used as the analytical transform in the encoder. A ,Right now A = B -1 Furthermore, the transform representation used in practical video coding systems is the orthogonal transform (…). Orthogonal or near-orthogonal transforms. For orthogonal transforms, the mean square error (MSE) distortion in the signal space is equal to the MSE distortion in the transform domain. Orthogonality has the significant advantage of minimizing the MSE distortion between the original and reconstructed sample blocks using independent scalar quantizers. Even though the actual quantization process used in the encoder takes into account the dependencies between transform coefficient levels (introduced by the entropy coding description above), the use of orthogonal transforms significantly simplifies the quantization algorithm.
[0033] For a typical prediction error signal, the transform has the effect of aligning the signal energy set across several transform coefficients. Compared to the original prediction error sample, it reduces the statistical dependence between the resulting transform coefficients.
[0034] The latest video coding standards use the separable discrete cosine transform (Type II) or its integer approximation. However, this transform can be easily replaced without modifying other aspects of the transform coding system. Examples of improvements proposed in literature or standardization documents include: • Use Discrete Sine Transform (DST) for intra-image prediction blocks (this may depend on the intra-prediction mode and / or block size). Note that H.265 | MPEG-H HEVC already includes DST for 4×4 transform blocks for intra-image prediction.
[0035] • Transform switching: The encoder selects the actual transform to use from a predefined set of transforms. The set of available transforms is known to both the encoder and decoder, so it can be efficiently notified by signaling using indicators that indicate which transforms are in the list. The set of available transforms and their order in the list can depend on other encoding parameters for the block, such as the selected intraprediction mode. In special cases, the transform used is determined entirely by encoding parameters such as the intraprediction mode, thus eliminating the need to transmit syntactic elements specifying the transform.
[0036] • Inseparable Transformations: Transformations used in encoders and decoders represent inseparable transformations. Note that the concept of a transformation can include one or more inseparable transformations. Due to complexity, the use of inseparable transformations may be limited to certain block sizes.
[0037] • Multi-level transformation: The actual transformation consists of two or more transformation stages combined. The first transformation stage can be composed of separable transformations with low computational complexity. In the second stage, an inseparable transformation is used to further transform a subset of the resulting transformation coefficients. Compared to an inseparable transformation of the entire transformation block, the two-stage approach has the advantage of applying more complex inseparable transformations to a smaller number of samples. The concept of multi-level transformation can be effectively combined with the concept of transformational transformation.
[0038] The transform coefficients are quantized using a scalar quantizer. As a result of quantization, the set of allowed values for the transform coefficients is reduced. In other words, the transform coefficients are mapped to a countable set (actually a finite set) of so-called reconstruction levels. The set of reconstruction levels represents an appropriate subset of the set of possible transform coefficient values. To simplify subsequent entropy coding, the allowed reconstruction levels are represented by quantization indices (also called transform coefficient levels), which are transmitted as part of the bitstream. On the decoder side, the quantization indices (transform coefficient levels) are mapped to the reconstructed transform coefficients. The possible values of the reconstructed transform coefficients correspond to the set of reconstruction levels. On the encoder side, the result of scalar quantization is a block of transform coefficient levels (quantization indices).
[0039] The latest video coding standard uses the Uniform Reconstruction Quantizer (URQ). Its basic design is as follows: Figure 3 As shown in the diagram, URQ exhibits the characteristic of equidistant distribution of reconstruction levels *s*. The distance Δ between two adjacent reconstruction levels is called the quantization step size. One of the reconstruction levels is equal to 0. Therefore, the complete set of available reconstruction levels is uniquely specified by the quantization step size Δ. Quantization Index q Transformation coefficients to reconstruction t' The mapping of the decoder is given in principle by the following simple formula. .
[0040] In this context, the term "independent scalar quantization" refers to the property that, given any transform coefficients, the quantization index... q In this case, the associated reconstructed transform coefficients can be determined independently of all quantization indices of other transform coefficients. t' .
[0041] Because video decoders typically utilize integer arithmetic with standard precision (e.g., 32-bit), the actual formulas used in the standard may differ slightly from simple multiplication. Ignoring the clipping of the dynamic range supported by the transform coefficients, H.265|MPEG-H HEVC is obtained as follows: , The operators "<<" and ">>" represent left shift and right shift, respectively. When we ignore integer operations, the quantization step size Δ corresponds to... .
[0042] Older video coding standards, such as H.262 | MPEG-2 video, also specify a modified URQ, in which the distance between reconstruction level zero and the first non-zero reconstruction level is increased relative to the nominal quantization step size (e.g., two-thirds of the nominal quantization step size Δ).
[0043] The quantization step size (or scaling and shift parameters) of the transform coefficients is determined by two factors: • Quantization Parameter (QP): The quantization step size can typically be adjusted based on blocks. For this purpose, video coding standards provide a predefined set of quantization step sizes. Indicators from this predefined list of quantization step sizes are used to indicate the quantization step size used (or, equivalently, the parameters "scaling" and "shift" introduced above). These indicators are called the quantization parameter (QP). In H.265 | MPEG-H HEVC, the relationship between QP and quantization step size is approximately as follows: .
[0044] Slice QPs are typically transmitted in the slice header. Generally, the quantization parameters QP can be corrected based on blocks. For this purpose, DQPs (incremental quantization parameters) can be transmitted. The quantization parameters used are determined by the transmitted DQP and the predicted QP value, which is derived using the QPs of the encoded (typically adjacent) blocks.
[0045] • Quantization weighting matrix: Video coding standards typically allow for the use of different quantization step sizes for individual transform coefficients. This is achieved by specifying what is known as a quantization weighting matrix. W This is achieved by the encoder, which typically selects the values at the sequence or image level and transmits them as part of the bitstream. Quantization weighting matrix W It has the same size as the corresponding transform coefficient block. Transform coefficients Quantization step size Given by the following formula , Where Δ block This indicates the quantization step size of the block under consideration (represented by the block quantization parameter QP). i and k w represents the coordinates of the current transform coefficient within the specified transform block. ik Represents the quantization weighted matrix W The corresponding entry in [the database].
[0046] The primary purpose of a quantization weighting matrix is to provide the possibility of introducing quantization noise in a perceptually meaningful way. By using an appropriate weighting matrix, a better trade-off between bit rate and subjective reconstruction quality can be achieved by leveraging the spatial contrast sensitivity of human vision. However, many encoders use a so-called planar quantization matrix (which can be efficiently transmitted using high-level syntactic elements). In this case, the same quantization step size Δ is used for all transform coefficients in the block. The quantization step size is then entirely specified by the quantization parameter QP.
[0047] Transform coefficient level blocks (with quantization indices for the transform coefficients) are entropy-coded (i.e., transmitted as part of the bitstream in a lossless manner). Since linear transforms can only reduce linear dependencies, entropy coding at the transform coefficient level is typically designed in a way that allows efficient coding of the remaining non-linear dependencies between transform coefficient levels within a block. Well-known examples are run-level coding in MPEG-2 video, run-level end coding in H.263 and MPEG-4 Visual, context-adaptive variable-length coding (CAVLC) in H.264 | MPEG-4 AVC, and context-based adaptive bit-wise arithmetic coding (CABAC) in H.264 | MPEG-4 AVC and H.265 | MPEG-H HEVC.
[0048] The latest video coding standard, H.265 | MPEG-H HEVC, specifies CABAC, which follows a general concept applicable to various transform block sizes. Transform blocks larger than 4x4 samples are divided into 4x4 sub-blocks. Figure 4a and Figure 4b The partitioning is illustrated using a 16×16 transform block as an example. Figure 4a The encoding order of the 4×4 sub-blocks shown and Figure 4b The encoding order of transform coefficient levels within the sub-blocks shown is typically specified by the reverse diagonal scan as illustrated in the diagram. For certain specific intra-prediction blocks, either a video or vertical scan mode is used (depending on the actual intra-prediction mode). The encoding order always starts from the high-frequency position.
[0049] In H.265 | MPEG-H HEVC, the transform coefficient level is transmitted based on 4x4 sub-blocks. Lossless encoding at the transform coefficient level includes the following steps: 1. The syntax element `coded_block_flag` is transmitted, indicating whether any non-zero transform coefficient levels exist in the transform block. If `coded_block_flag` equals 0, no other data is encoded for that transform block.
[0050] 2. The x and y coordinates of the first non-zero transform coefficient level are transmitted in encoded order (e.g., the block-by-block reverse diagonal scan order shown in Figure 4). The transmission of coordinates is divided into prefix and suffix parts. The standard uses the syntax elements last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, and last_sig_coeff_x_suffix.
[0051] 3. Starting with a 4x4 sub-block containing the first non-zero transform coefficient level in the encoding order, process the 4x4 sub-blocks in the encoding order, wherein the encoding of the sub-block includes the following main steps: a. Transmit the syntax element `coded_sub_block_flag`, which indicates whether the subblock contains any non-zero transform coefficient level. For the first and last 4x4 subblocks (i.e., subblocks containing the first non-zero transform coefficient level or DC level), this flag is not transmitted, but can be inferred to be equal to 1.
[0052] b. For all transform coefficient levels within a subblock where `coded_sub_block_flag` is equal to 1, the syntactic element `significant_coeff_flag` indicates whether the corresponding transform coefficient level is not equal to zero. This flag is transmitted only if its value cannot be inferred from the transmitted data. In particular, if the DC coefficient is located in a different subblock than the first non-zero coefficient (in encoding order) and all other `significant_coeff_flags` of the last subblock are equal to zero, then the flag is not transmitted for the first valid scan position (specified by the transmitted x and y coordinates), nor is the flag transmitted for the DC coefficient.
[0053] c. For the first eight transform coefficient levels where significant_coeff_flag equals 1 (if any), transfer the flag coeff_abs_level_greater1_flag. It indicates whether the absolute value of the transform coefficient level is greater than 1.
[0054] d. For the first transform coefficient level where coeff_abs_level_greater1_flag equals 1 (if any), the flag coeff_abs_level_greater2_flag will be transmitted. It indicates whether the absolute value of the transform coefficient level is greater than 2.
[0055] e. For all levels where significant_coeff_flag equals 1 (with one exception described below), the syntax element coeff_sign_flag, which specifies the sign of the transformation coefficient level, will be transmitted.
[0056] f. For all transformation coefficient levels whose absolute values have not yet been fully specified via the values of significant_coeff_flag, coeff_abs_level_greater1_flag, and coeff_abs_level_greater2_flag (if any transmitted flag is equal to zero, then the absolute values are fully specified), the remainder of the absolute values is transmitted using the multi-level syntax element coeff_abs_level_remaining.
[0057] In H.265|MPEG-H HEVC, all syntactic elements are encoded using context-based adaptive bit-based arithmetic coding (CABAC). First, all non-bit syntactic elements are mapped to a series of bit decisions, also known as bits. The resulting sequence of bits is then encoded using bit-based arithmetic coding. For this purpose, each bit is associated with a probability model (a probability quality function of the bit), also called the context. For most bits, the context represents an adaptive probability model, meaning that the probability quality function of the associated bit is updated based on the value of the bit actually encoded. Conditional probabilities can be utilized by switching the context of certain specific bits based on the data transmitted. CABAC also includes a so-called bypass mode, where a fixed probability quality function (0.5, 0.5) is used.
[0058] The context chosen for encoding `coded_sub_block_flag` depends on the value of `coded_sub_block_flag` for the already encoded neighboring sub-blocks. The context for `significant_coeff_flag` is selected based on the scan position (x and y coordinates) within the sub-block, the size of the transform block, and the value of `coded_sub_block_flag` in neighboring sub-blocks. For the flags `coeff_abs_level_greater1_flag` and `coeff_abs_level_greater2_flag`, the context selection depends on whether the current sub-block includes DC coefficients and whether any `coeff_abs_level_greater1_flag` equal to 1 has been transmitted for neighboring sub-blocks. For `coeff_abs_level_greater1_flag`, it also depends on the number and value of `coeff_abs_level_greater1_flag` already encoded for the sub-block.
[0059] The remainders of the symbol `coeff_sign_flag` and the absolute value `coeff_abs_level_remaining` are encoded in bypass mode of a bitwise arithmetic encoder. An adaptive binarization scheme is used to map `coeff_abs_level_remaining` onto a series of bits (bitwise decisions). Binarization is controlled by a single parameter that adapts to the encoded values of the sub-blocks.
[0060] H.265 | MPEG-H HEVC also includes a so-called symbol data hiding mode, in which (under certain specific conditions) the transmission of the last non-zero level symbol within a sub-block is omitted. Instead, the symbol at this level is embedded in the parity bit of the sum of the absolute values of the levels of the corresponding sub-block. Note that the encoder must take this into account when determining the appropriate transform coefficient levels.
[0061] Video coding standards only specify the bitstream syntax and reconstruction process. If we consider transform coding on a given raw prediction error sample block and a given quantization step size, the encoder has a great deal of freedom. Given a quantization index q for the transform block... k Entropy coding must follow a uniquely defined algorithm for writing data into a bitstream (i.e., constructing arithmetic codewords). However, given a sample block with the original prediction error, the algorithm used to obtain the quantization index q... k The encoder algorithm is not within the scope of video coding standards. Furthermore, the encoder has degrees of freedom to choose the quantization parameter QP on a block-by-block basis. For the following description, we assume that the quantization parameter QP and the quantization weighting matrix are given. Therefore, the quantization step size for each transform coefficient is known. We further assume that the analytical transform performed by the encoder is the reciprocal (or a number very close to the reciprocal) of the specified synthetic transform to obtain the original transform coefficients t. k Even under these conditions, the encoder is free to choose each original transform coefficient t. k Quantization index q k Since the choice of transform coefficient level determines the distortion (or reconstruction / approximation quality) and bit rate, the quantization algorithm used has a substantial impact on the ratio distortion performance of the resulting bit stream.
[0062] The simplest quantization method is to convert the original transform coefficients t k Round to the nearest reconstruction level. For the commonly used URQ, the corresponding quantization index q can be determined according to the following formula. k : , Here, sgn() is the sign function, and the operators ⌊⋅⌋ return the largest integer less than or equal to its independent variable. This quantization method guarantees MSE distortion. It is minimized, but it completely ignores the level q of the transformation coefficients obtained from the transmission. k The required bit rate. Generally, better results can be obtained by rounding towards zero. .
[0063] If the quantization process minimizes the Lagrangian function D + λ⋅R, then the optimal result for rate distortion sensing can be obtained, where D Indicates the distortion of the transform block (e.g., MSE distortion). R Specifies the number of binary bits required for the transform coefficient level of the transport block, and λ is the Lagrange multiplier.
[0064] Regarding the relationship between QP and quantization step size For codecs such as H.264|MPEG-4 AVC or H.265|MPEG-H HEVC, the relationship between the Lagrange multiplier λ and the block quantization parameter QP is frequently used. , Where c1 and c2 represent constant factors of the slice or image.
[0065] Lagrangian function D+ aimed at minimizing distortion and rate λ ⋅ R The quantization algorithm used is also known as Rate Distortion Optimized Quantization (RDOQ). If we use MSE or weighted MSE to measure distortion, the quantization index q of the transform block should be determined in some way. k To minimize the following cost metrics: .
[0066] At this point, the transformation coefficient index k Specifies the encoding order (or scan order) for the transform coefficient levels. (Item) Indicates the transmission quantization index q k The number of binary bits required (or its estimate). This condition specifies the level q of the particular transform coefficients (due to the use of combined probabilities or conditional probabilities). k The number of binary bits typically depends on the level of previous transform coefficients in the encoding sequence. The chosen value. Factors in the above formula. The contribution of these factors can be used to weight individual transformation coefficients, for example, to simulate contrast sensitivity in human vision. In the following text, we generally assume that all weighting factors... It equals 1 (but the algorithm can be directly modified by considering different weighting factors).
[0067] For transform coefficient encoding in H.265|MPEG-H HEVC, the precise calculation of the rate term is very complex because most bit decisions are made using an adaptive probabilistic model. However, if we ignore certain aspects of the probabilistic model selection and the adaptation of the probabilistic model within the transform block, it may be possible to design an RDOQ algorithm with reasonable complexity. The RDOQ algorithm implemented for H.265|MPEG-H HEVC in the reference software includes the following basic processing steps: 1. For each scanned location k Under the assumption that the level is not inferred to be zero, by using Lagrange costs Minimize to select the level of transformation coefficients . Represents the (weighted) squared error , Represents transmission An estimate of the number of binary bits required.
[0068] 2. The flag coded_sub_block_flag of the 4×4 subblock is determined by comparing the Lagrange cost in the following two cases: (a) using the transform coefficient level selected in step 1; (b) setting the syntax element coded_sub_block_flag to zero, thus setting all transform coefficient levels of the 4×4 subblock to zero.
[0069] 3. The position of the first non-zero transform coefficient level is determined by comparing the Lagrange cost, which is obtained by selecting one of the non-zero transform coefficient levels (after step 1) as the first non-zero transform coefficient level in the encoding order (the preceding transform coefficient levels are set to zero).
[0070] 4. The coded_block_flag is determined by comparing the Lagrangian cost of the sequence of transform coefficient levels obtained after step 1 and setting all transform coefficient levels within the transform block to zero.
[0071] The concept that transform coefficients are not independently quantized and reconstructed is a modified concept in transform coding. Instead, the permissible reconstruction level of transform coefficients depends on the quantization index chosen for the previous transform coefficients in the order of reconstruction. This concept of scalar-dependent quantization is combined with modified entropy coding, where the probabilistic model choice (or, alternatively, codeword table choice) for transform coefficients depends on the set of permissible reconstruction levels.
[0072] The advantage of transform coefficient dependency quantization is that it allows for a wider range of reconstructed vectors. N Dense set stacking in 3D signal space (where N This represents the number of samples or the number of transform coefficients in the transform block. The reconstruction vector for a transform block refers to the ordered reconstruction of the transform coefficients (or, alternatively, the ordered reconstruction of the samples) of the transform block. In the simplest case with two transform coefficients, in... Figure 5a and Figure 5b This effect is explained in the text. Figure 5a This shows the permissible reconstruction vectors (representing points in a two-dimensional plane) for independent scalar quantization. It can be seen that the second transformation coefficients... The set of allowed values does not depend on the transform coefficients of the first reconstruction. The choice of value. Figure 5b An example for dependent scalar quantization is shown. Note the second transform coefficients compared to independent scalar quantization. The optional reconstruction value depends on the first transform coefficients. The selected refactoring level. Figure 5b In the example, for the second transformation coefficient There are two distinct sets of available reconstruction levels (indicated by different colors). If the first transformation coefficients... If the quantization index is even (..., -2, 0, 2, ...), then any reconstruction level of the first set (blue dots) can be the second transform coefficient. Choose. And if the first transformation coefficients If the quantization index is odd (..., -3, -1, 1, 3, ...), then it can be the second transform coefficient. Choose any reconstruction level for the second set (red dots). In the example, the reconstruction levels of the first and second sets are offset by half the quantization step size (any reconstruction level of the second set lies between the two reconstruction levels of the first set).
[0073] Dependency scalar quantization of transform coefficients has the following effects: for each N For a given average number of reconstructed vectors with a given unit volume, the expected distance between a given input vector of the transform coefficients and the nearest available reconstructed vector is reduced. Consequently, for a given average number of bits, the average distortion between the input vector of the transform coefficients and the transform coefficients reconstructed from the vector can be reduced. In vector quantization, this effect is called space-filling gain. Using dependent scalar quantization on the transform block allows the utilization of a major portion of the potential space-filling gain from high-dimensional vector quantization. Furthermore, compared to vector quantization, the implementation complexity of the reconstruction (or decoding) process is comparable to that of conventional transform coding with independent scalar quantizers.
[0074] Figure 6 The diagram shows a block diagram of a transform decoder with dependent scalar quantization. The main changes are related to dependent quantization, causing the arrows to point from top to bottom. As these vertical arrows indicate, the transform coefficients with a reconstruction order index k > 0 are reconstructed. It depends not only on the relevant quantization index q k Furthermore, it depends on the quantization index used for the previous transform coefficients in the reconstruction sequence. Note that in dependent quantization, the reconstruction order of the transform coefficients must be uniquely defined. If entropy coding also utilizes the quantization index q... k Knowledge of the associated set of reconstruction levels can improve the overall performance of the transform codec. This means that it is advantageous to switch contexts (probabilistic models) or codeword tables based on the set of reconstruction levels applied to the transform coefficients.
[0075] As in conventional transform coding, the transform coding according to the embodiments outlined herein includes a quantization algorithm and entropy coding in addition to the analytical transform. As an analytical transform, the inverse (or an approximation of the inverse) of the synthetic transform is typically used, and the entropy coding is usually uniquely specified given the entropy decoding process. However, similar to conventional transform coding, there is considerable freedom in choosing the quantization index given the original transform coefficients.
[0076] Dependent quantization of transform coefficients refers to the concept that the set of available reconstruction levels for transform coefficients depends on the quantization index selected for the previous transform coefficients in the reconstruction order (within the same transform block).
[0077] Multiple sets of reconstruction levels are predefined, and one of the predefined sets is selected to reconstruct the current transform coefficient based on the quantization index of the first transform coefficient in the encoding order.
[0078] From a set (two or more) of predetermined sets of reconstruction levels, a set of permissible reconstruction levels for the current transform coefficient is selected (based on the quantization index of the earlier transform coefficient in the coding order). The values of the reconstruction levels in the set of reconstruction levels are parameterized by block-based quantization parameters (QPs). The block-based quantization parameters (QPs) determine the quantization step size Δ, and all reconstruction levels (in the set of all reconstruction levels) represent integer multiples of the quantization step size Δ. Specific transform coefficients Quantization step size (in k The reconstruction order (indicating the quantization order) can be determined not only by the block quantization parameters QP, but also by using the quantization weighting matrix and the block quantization parameters to determine specific transform coefficients. Quantization step size Typically used for transformation coefficients. Quantization step size From the transformation coefficients Weighting factors (specified by the quantized weighting matrix) and block quantization step size Δ block The product (specified by the block quantization parameter) is given. .
[0079] In this embodiment, the dependency scalar quantization used for the transform coefficients employs two different sets of reconstruction levels, and the transform coefficients t k The two sets of all reconstruction levels represent the quantization step size Δ of this transform coefficient. k An integer multiple of (i.e., at least partially determined by block-based quantization parameters). Note the quantization step size Δ. k This represents only the scaling factor for the allowed reconstructed values in both sets. It is used within the transform block for different transform coefficients t. k Possible single quantization step size Δ k (And, therefore, a single scaling factor) In addition, the same set of two reconstruction levels is used for all transformation coefficients.
[0080] exist Figure 7 The diagram illustrates a preferred configuration of two sets of reconstruction levels. The first quantization set (labeled set 0 in the diagram) contains reconstruction levels that represent even integer multiples of the quantization step size. The second quantization set (labeled set 1 in the diagram) contains all odd integer multiples of the quantization step size, plus reconstruction levels equal to zero. Note that both reconstruction sets are symmetric to zero. Reconstruction levels equal to zero are included in both reconstruction sets; otherwise, the reconstruction sets would not intersect. The union of the two reconstruction sets contains all integer multiples of the quantization step size.
[0081] The reconstruction level selected by the encoder from among the allowed reconstruction levels is indicated or transmitted within the bitstream. As in regular independent scalar quantization, this is achieved using a so-called quantization index, also known as a transform coefficient level. The quantization index (or transform coefficient level) is an integer that uniquely identifies the available reconstruction level within the quantization set (i.e., within the set of reconstruction levels). The quantization index is transmitted to the decoder as part of the bitstream (using any entropy coding technique). On the decoder side, the reconstructed transform coefficients can be uniquely computed based on the current set of reconstruction levels (determined by the previous quantization indexes in the encoding / reconstruction order) and the quantization indexes transmitted for the current transform coefficients.
[0082] Figure 7The refactoring levels are assigned with their corresponding quantization indices (given by the numbers below the circles representing the refactoring levels). A quantization index equal to 0 is assigned to a refactoring level equal to 0. A quantization index equal to 1 is assigned to the smallest refactoring level greater than 0, a quantization index equal to 2 is assigned to the next largest refactoring level greater than 0 (i.e., the second smallest refactoring level greater than 0), and so on. Alternatively, refactoring levels greater than 0 are labeled in ascending order of their integer numbers greater than 0 (i.e., 1, 2, 3, etc.). Similarly, a quantization index -1 is assigned to the largest refactoring level less than 0, a quantization index -2 is assigned to the next largest refactoring level less than 0 (i.e., the second largest), and so on. Alternatively, refactoring levels less than 0 are labeled in descending order of their integer numbers less than 0 (i.e., -1, -2, -3, etc.).
[0083] The use of reconstruction levels representing integer multiples of the quantization step size allows for computationally low-complexity algorithms to reconstruct transform coefficients on the decoder side. The following is based on... Figure 7 A preferred example illustrates this. The first quantization set includes all even integer multiples of the quantization step size, while the second quantization set includes all odd integer multiples of the quantization step size and reconstruction levels equal to 0 (included in both quantization sets). This can be similar to... Figure 8 The algorithm specified in the pseudocode implements the reconstruction process of the transform coefficients.
[0084] exist Figure 8 In the pseudocode, level[k] represents the transformation coefficient t. k The quantization index of the transmission, and setId[k] (equal to 0 or 1) specifies the identifier of the set of the current reconstruction levels (determined based on the previous quantization index in the reconstruction order, as will be described in more detail below). The variable n represents an integer multiple of the quantization step size given by the quantization index level[k] and the set identifier setId[k]. If the transform coefficients are encoded using the set of the first reconstruction level (setId[k] == 0), this reconstruction level contains the quantization step size Δ. k If the value is an even integer multiple of the quantization index, then the variable n is twice the quantization index transmitted. If the transform coefficients are encoded using the set of the second reconstruction level (setId[k] == 1), then there are three cases: (a) if level[k] equals 0, n also equals 0; (b) if level[k] is greater than 0, then n equals twice the quantization index level[k] minus 1; (c) if level[k] is less than 0, then n equals twice the quantization index level[k] plus 1. This can be specified using a sign function. .
[0085] Then, if a second quantization set is used, the variable n is equal to the quantization index level[k] minus twice the sign function sign(level[k]) of the quantization index. Once the variable n (an integer factor specifying the quantization step size) is determined, it is then multiplied by the quantization step size Δ k To obtain the reconstructed transformation coefficients .
[0086] As mentioned above, instead of the quantization step size Δ k Exact multiplication can yield the reconstructed transform coefficients through integer approximation. This is in Figure 8 The pseudocode illustrates this. Here, the variable shift indicates a right shift. Its value typically depends only on the block's quantization parameters (but the shift parameter can also be changed for different transform coefficients within the block). The variable scale[k] represents the value used for transform coefficient t. k The scaling factor; besides the block quantization parameter, it can also depend, for example, on the corresponding entry in the quantization weighting matrix. The variable "add" specifies a rounding offset, typically set to equal add = (1 << (shift - 1)). It should be noted that in Figure 8 The integer arithmetic specified in the pseudocode (last line), excluding rounding, is equivalent to the quantization step size Δ. k Multiplication is represented by the following: .
[0087] Compared to Figure 8 , Figure 9 Another (purely superficial) change is the use of the ternary if-then-else operator (a b:c) Implements switching between two sets of refactoring levels, which is evident from programming languages such as C.
[0088] Besides the selection of the set of reconstruction levels discussed above, another task in transform coding that relies on scalar quantization is the algorithm used to switch between the defined set of quantization levels (the set of reconstruction levels). The algorithm used determines the "compression density" that can be achieved in the N-dimensional space of the transform coefficients (and therefore also in the N-dimensional space of the reconstructed samples). Higher compression density ultimately leads to improved coding efficiency.
[0089] In a preferred embodiment, the transition between quantization sets (set 0 and set 1) is determined by state variables. For the first transform coefficient in the reconstruction order, the state variable is set to a predetermined value. Typically, this predetermined value is equal to 0. The state variables of the following transform coefficients in the encoding order are determined by an update process. The state of a particular transform coefficient depends only on the state and value of the preceding transform coefficient in the reconstruction order.
[0090] The state variable can have four possible values (0, 1, 2, 3). On one hand, the state variable specifies the quantization set used for the current transform coefficients. Quantization set 0 is used only when the state variable is equal to 0 or 1; quantization set 1 is used only when the state variable is equal to 2 or 3. On the other hand, the state variable specifies the possible transitions between quantization sets.
[0091] For example, the state of a particular transform coefficient may depend solely on a binary function of the states of previous transform coefficients in the reconstruction order and the values of the levels of the previous transform coefficients. This binary function is hereinafter referred to as a path. In a particularly preferred embodiment, the following state transition table is used, where "path" refers to the binary function at the levels of the previous transform coefficients in the reconstruction order.
[0092] Table 1: A preferred example of a state transition table for a configuration with 4 states.
[0093] The path can be given by the parity bits of the quantization index. Using level[k] as the transform coefficient level, it can be determined according to the following formula. The operator & represents the bitwise "sum" in arithmetic operations between two two's complement integers.
[0094] The path can also represent other binary functions of level[k]. For example, it can specify whether the transformation coefficient level is equal to or not equal to 0: .
[0095] The concept for state transitions that rely on scalar quantization allows for a low-complexity implementation of reconstructing transform coefficients in the decoder. Figure 10 The diagram shows a preferred example of the reconstruction process of the transform coefficients of a single transform block using C-type pseudocode.
[0096] exist Figure 10 In the pseudocode, the indicator k Specifies the reconstruction order of the transformation coefficients. It should be noted that in the example code, the indicator... k Decrease in reconstruction order. The last transformation coefficient has an index equal to k = 0. First index kstartSpecifies the reconstruction metric (or more precisely, the reciprocal reconstruction metric) of the transformation coefficients of the first reconstruction. Variable kstart It can be set to equal to the number of transform coefficients in the transform block minus 1, or it can be set to equal to the index of the first non-zero quantization index in the encoding / reconstruction order (e.g., if the position of the first non-zero quantization index is transmitted with the applied entropy coding method). In the latter case, all previous transform coefficients (index is...) k>kstart All of them are inferred to be equal to 0. The reconstruction process of each individual transform coefficient is similar to... Figure 9 The example is the same. Figure 9 In the example, the quantization index is represented by level[k], and the associated reconstruction transformation is represented by trec[k]. State variables are represented by states. The 1d table setId[] specifies the set of quantizations associated with different values of the state variables, while the 2d table state_trans_table[][] specifies the state transition given the current state (first parameter) and the path (second parameter). For example, the path can be given by the parity bit of the quantization index (using the bitwise AND operator &), but other concepts are also possible. As another example, the path can specify whether the transformation coefficients are equal to or not equal to zero. Examples of tables are shown below in C-style syntax (these tables are the same as Table 1 shown above). setId[4] = { 0, 0, 1, 1} state_trans_table[4][2]= { {0,2}, {2,0}, {1,3}, {3,1}} Instead of using the `state_trans_table[]` to determine the next state, arithmetic operations that produce the same result can be used. Similarly, the `setId[]` table can also be implemented using arithmetic operations. Alternatively, arithmetic operations can be used to combine table lookups using the 1d `setId[]` table with symbolic functions.
[0097] The main aspect of relying on scalar quantization is that there is a set of different permissible reconstruction levels (also called the quantization set) for the transform coefficients. The quantization set of the current transform coefficients is determined based on the values of the quantization indices of the previous transform coefficients. If we consider Figure 7 The example in the diagram compares two quantization sets. It's clear that the distance between a reconstruction level equal to 0 and its adjacent reconstruction level is larger in set 0 than in set 1. Therefore, the probability of a quantization index equal to 0 is higher when using set 0 and lower when using set 1. This effect can be utilized in entropy coding by basing it on the quantization set, or more generally on a switching probability model of the state used for the current quantization index.
[0098] Note that for proper switching of codeword tables or probability models, when entropy decodes the current quantization index (or the corresponding binary decision of the current quantization index), the paths of all previous quantization indices (binary functions of quantization indices) must be known.
[0099] The quantization index can be encoded using binary arithmetic coding similar to H.264 | MPEG-4 AVC or H.265 | MPEG-H HEVC. To do this, the non-binary quantization index is first mapped to a series of binary decisions (often called bits).
[0100] The following describes various examples of how, i.e., in what order and using what context, the quantization index generated by dependent quantization is binarized and arithmetically encoded. Here, the quantization index is transmitted as an absolute value, and for absolute values greater than 0, the sign is transmitted. When the sign is transmitted as a single binary bit, there are many possibilities for mapping the absolute value to a series of binary decisions, which are manifested in the examples described below. The following description focuses first on the encoding order and binarization scheme, and thus gives various examples. Different examples for context modeling are described below. The latter can be combined with previous embodiments involving encoding order and binarization schemes, but the previous embodiments are not limited to the examples that follow.
[0101] Example 1: Transmit the following binary and non-binary syntax elements: • sig_flag: Specifies whether the absolute value of the transform coefficient level is greater than 0; • If sig_flag equals 1, gt1_flag: specifies whether the absolute value of the transform coefficient level is greater than 1; • If gt1_flag equals 1, gt2_flag: specifies whether the absolute value of the transform coefficient level is greater than 1; • If gt2_flag equals 1, remainder: a non-binary syntax element used to specify the remainder at the absolute level. For example, this syntax element is transmitted in bypass mode of an arithmetic coding engine using Columbus-Less code.
[0102] Existing syntactic elements were not inferred to be equal to 0. On the decoder side, the absolute values at the transform coefficient level are reconstructed as follows: absLevel = sig_flag + gt1_flag + gt2_flag + remainder Additional gtX_flags can be transmitted, or gt2_flag can be omitted, or both gt1_flag and gt2_flag can be omitted. An adaptive context model is used to encode sig_flag and gtx_flags.
[0103] Example 2: Transmit the following binary and non-binary syntax elements: • sig_flag: Specifies whether the absolute value of the transform coefficient level is greater than 0; • If sig_flag equals 1, then gt1_flag: specifies whether the absolute value of the transform coefficient level is greater than 1; • If gt1_flag equals 1, then: o par_flag: Specifies the parity bit for the remainder of the absolute value at the level of the transform coefficients (i.e., absolute value – 2); `o remainder`: A non-binary syntax element used to specify the remainder at the absolute level (i.e., (absolute value – 2 – par_flag) / 2). This syntax element can be transmitted, for example, using Columbus-Less code in a bypass mode of an arithmetic coding engine.
[0104] Existing syntactic elements were not inferred to be equal to 0. On the decoder side, the absolute values at the transform coefficient level are reconstructed as follows: absLevel = sig_flag + gt1_flag + par_flag + 2 * remainder You can transmit additional gtX_flags, or omit gt1_flag. As an example, instead of the remainder above, you can transmit gt2_flag (specifying whether the absolute value is greater than 3) and (if gt2_flag equals 1) the corrected remainder (i.e., (absolute value – 3 – par_flag) / 2). Then, the absolute value is constructed according to the following formula. absLevel = sig_flag + gt1_flag + par_flag + 2 * ( gt2_flag +remainder ) The sig_flag, gtX_flags, and par_flag are encoded using an adaptive context model.
[0105] Example 3: Transmit the following binary and non-binary syntax elements: • sig_flag: Specifies whether the absolute value of the transform coefficient level is greater than 0; If sig_flag equals 1, then o par_flag: Specifies the parity bit for the remainder of the absolute value at the level of the transform coefficients (i.e., absolute value – 1); o gt1_flag: Specifies whether the remainder of the absolute value of the transformation coefficient level (i.e., (absolute value – 1 – par_flag) / 2) is greater than 0; • If gt1_flag equals 1, then gt2_flag: specifies whether the remainder of the absolute value of the transform coefficient level (i.e., (absolute value – 1 – par_flag) / 2) is greater than 1; • If gt2_flag equals 1, then remainder: a non-binary syntax element used to specify the remainder at the absolute level (i.e., (absolute value – 1 – par_flag) / 2 – 2). This syntax element is transmitted, for example, using GolombRice codes in the bypass mode of an arithmetic coding engine.
[0106] Existing syntactic elements were not inferred to be equal to 0. On the decoder side, the absolute values at the transform coefficient level are reconstructed as follows: absLevel = sig_flag + par_flag + 2 * (gt1_flag + gt2_flag +remainder) Additional gtX_flags can be transmitted, or gt2_flag can be omitted. An adaptive context model is used to encode sig_flag, gtx_flags, and par_flag.
[0107] Further binarization is possible.
[0108] Regarding context modeling, the following example illustrates the interplay between binarization, bit / coefficient ordering, and context derivation. In a specific example, the syntax for the quantization index used to transmit the transform block includes bits specifying whether the quantization index is equal to zero or not (sig_flag described above). A probabilistic model for encoding this bit can be selected from a set of two or more probabilistic models. The choice of the probabilistic model used depends on the current state variable (which represents the set of quantizations used). In this case, different sets of probabilistic models can be used for all possible values of the state variable, or the possible values of the state variable can be clustered into two or more clusters, and different sets of probabilistic models can be used for each cluster (e.g., a first set of probabilistic models for states 0 and 1, a second set for state 2, and a third set for state 3; or alternatively, a first set of probabilistic models for states 0 and 1; and a second set for states 2 and 3).
[0109] It is also possible that the probabilistic model chosen for other binary syntax elements (such as gt1_flag or par_flag) also depends on the value of the current state variable.
[0110] Advantageously, the transformation coefficients are combined with entropy coding, where the choice of a probabilistic model for one or more bits (also called quantization levels) of the binary representation of the quantization index depends on the state variable of the current quantization index. The state variable is given by the quantization index of the previous transformation coefficients in the encoding and reconstruction order (or a subset of the bits representing the quantization index).
[0111] In particular, advantageously, the choice of the described probabilistic model is combined with one or more of the following entropy coding aspects: • Transmit a flag for the transform block, the flag specifying whether the quantization index for the transform block is not equal to zero, or whether all quantization indices for the transform block are equal to zero.
[0112] • Divide the coefficients of the transform block (at least for transform blocks exceeding a predefined size given by the block size or the number of samples contained) into multiple sub-blocks. For Figure 12aTransform block 10, exemplarily illustrating this, is shown where the coefficients 12 of the block are subdivided into sub-blocks 14, exemplarily shown here as coefficients of size 4×4. If the transform block is divided into multiple sub-blocks 14, for one or more sub-blocks, a transmission flag (unless inferred based on already transmitted syntax elements) indicates whether the sub-block contains any non-zero quantization index. Sub-blocks can also be used to specify the encoding order of bits. For example, the encoding of bits can be divided into sub-blocks 14 such that all bits of a sub-block are encoded before any bits of the next sub-block 14 are transmitted. However, the bits of a particular sub-block 14 can be encoded multiple times over the transform coefficients within this sub-block. For example, all bits of the absolute value of the quantization index of a specified sub-block can be encoded before any sign bits are encoded. As mentioned above, the bits of the absolute value can also be divided into multiple passes.
[0113] • Transmit the first non-zero position in the encoded order. The position is in... Figure 12a The text is in bold. It can be transmitted as x and y coordinates specifying a position in a 2D array of transform coefficients, as an index for the scan order, or by any other means. For example... Figure 12a As shown, the position of transmission of the first non-zero quantization index (or transform coefficient) in the encoding order is specified, according to the encoding order ( Figure 12a (Marked in white) Infers all transform coefficients 12 before the identified coefficient equals zero. Only coefficients at specified locations (in...) Figure 12a (The text in bold indicates that) the first transmission of further data follows the encoded order, and the transmission follows the encoded order (in... Figure 12a (The winning bid is shaded) Follows the coefficient of this coefficient to transmit further data. Figure 12a The example shown illustrates a 16x16 transform block 10 with 4x4 sub-blocks 14; the encoding order used is the sub-block orientation diagonal scan specified in H.265 | MPEG-H HEVC. It should be noted that the encoding of the quantization index at a specified position (the first non-zero coefficient in the encoding order) can be slightly modified. For example, if the binarization of the absolute value of the quantization index includes a bit specifying whether the quantization index is not equal to 0, this bit will not be sent for the quantization index at the specified position (since the coefficient is already known to be non-zero), but rather the bit will be inferred to be equal to 1.
[0114] The binarization of the absolute value of the quantization index includes adaptively encoded bits that specify whether the quantization index is not equal to 0. The probabilistic model (called the context) used to encode this bit is selected from a set of candidate probabilistic models. The selected candidate probabilistic models can be determined not only by the state variable of the current quantization index, but also by the quantization indexes already transmitted for the transform block. In a preferred embodiment, the state variable determines a subset of available probabilistic models (also called the context set), and the value of the already encoded quantization index determines the probabilistic model used within this subset (context set).
[0115] In a preferred embodiment, the probabilistic model used within the context set is determined based on the value of the encoded quantization index in the local neighborhood 52 of the current transform coefficient 50; that is, one of the coefficients whose binary bits are currently encoded / decoded, thus requiring the determination of the same context. An example of this local neighborhood 52 is... Figure 12b The figure is shown below. In the figure, the current transform coefficient 50 is marked in black, while the local neighborhood 52 is marked in shaded. Below, some exemplary metrics are listed that can be derived based on the values of the quantization indices of the neighboring coefficients 51 within the local neighborhood 52, and can then be used to select a probabilistic model for a predetermined set of contexts.
[0116] In addition, other data available to the decoder can be used (either explicitly or in combination with the metrics listed above) to derive a probabilistic model from a predetermined set of contexts. This data includes: o The position of the current transformation coefficient (x-coordinate, y-coordinate, number of diagonals, or any combination thereof). o The size of the current block (vertical size, horizontal size, number of samples, or any combination thereof). o The aspect ratio of the current transform block.
[0117] Binarizing the absolute value of the quantization index involves adaptively encoding bits specifying whether the absolute value of the quantization index is greater than 1. A probabilistic model (called the context) is selected from a set of candidate probabilistic models for encoding this bit. The selected probabilistic model is determined by the quantization index of the transmitted transform block. To select the probabilistic model, any of the methods described above can be used (for bits specifying whether the quantization index is not equal to 0).
[0118] As mentioned above, the encoding order of the binary bits of the quantization index of coefficient 12 affects the efficiency of encoding block 10. For example, for the binary decision (binary bits), typically sig_flag, at least one of the probabilistic models of choice depends on the value of the current state variable. And since the state variable is determined by the binary function path() at the level of the preceding transform coefficients, the encoding order of the binary bits must be arranged in such a way that when encoding sig_flag for the current transform coefficient (or more generally, the probabilistic model depends on the binary syntax elements of the state variable), the paths of all previous transform coefficients are known.
[0119] For example, all bits of the absolute value of a specified quantization index can be encoded consecutively. This means that all bits of the absolute value at a previous quantization index are encoded before the first bit of the current quantization index in the encoding / reconstruction order. The sign bit may or may not be encoded in a separate second pass of the transform coefficients (in practice, this may depend on the quantization set used). The sign bit for the sub-block may be encoded after the bits used for the absolute value of the sub-block, but before any bits used for the next sub-block.
[0120] In another example, a subset of the bits specifying only the absolute value of the quantization index is encoded consecutively in the first pass of the transform coefficients. However, these bits uniquely identify the state variable. The remaining bits are encoded in one or more additional passes on the transform coefficients. If we assume that the path is specified by the parity bit of the quantization index, then the parity bit bits will be included in the first pass of the transform coefficients. The remaining bits can be transmitted through one or more additional passes. A similar concept is used in other embodiments of the invention. For example, the number of unary bits can be modified or even adjusted based on the symbols already transmitted. Different passes can be used on a sub-block basis, in which case the bits of the sub-block are encoded over multiple passes, but all bits of the sub-block are transmitted before transmitting any bits of the next sub-block.
[0121] Below are some examples of binary decisions made in multiple iterations: Example A: This example uses the binarization of Example 3 above, and the path is given by the parity bit.
[0122] ·Pass 1: sig_flag, par_flag, gt1_flag • Permutation 2: gt2_flag ·Remainder (remainder) 3rd iteration • Permutation 4: Sign bit (sign bit) Example B: This example uses the binarization of Example 3 above, and the path is given by the parity bit.
[0123] • First pass: sig_flag, par_flag • Permutation 2: gt1_flag ·Period 3: gt2_flag ·Remainer 4 • Permutation 5: Sign bit Example C: This example uses the binarization of Example 1 above, and the path specifies whether the absolute value is greater than 0.
[0124] • First pass: sig_flag • Permutation 2: gt1_flag ·Period 3: gt2_flag ·Remainer 4 • Permutation 5: Sign bit Example D: This example uses the binarization of Example 2 above, and the path is given by the parity bit.
[0125] ·Pass 1: sig_flag, gt1_flag, par_flag ·Remainer 2 • Permutation 3: Sign bit Example E: This example uses the binarization from Example 2 above and an additional gt2_flag; the path is given by the parity bit.
[0126] ·Pass 1: sig_flag, gt1_flag, par_flag, gt2_flag ·Remainer 2 • Permutation 3: Sign bit As a slight modification to this example, gt2_flag can also be transmitted in a separate iteration.
[0127] Further encoding sequences or combinations are binarized, and encoding sequences are possible.
[0128] To achieve a high-throughput decoder implementation, it's best to minimize the number of bits used for context encoding (also known as bits used for regular encoding) without compromising performance. This can be achieved by limiting the maximum number of certain bits (similar to HEVC). The remaining information is encoded using a bypass mode of the arithmetic coding engine.
[0129] The methods described below for reducing the maximum number of bits in context encoding can be combined with one or more of the following aspects already taken above: • Multiple reconstruction levels for quantization of transform coefficients. Specifically, there are two sets: the first set includes all even integer multiples of the quantization step size; the second set includes all odd integer multiples of the quantization step size and zero.
[0130] (At least for a subset of the transform coefficients within the transform block) The set of reconstruction levels selected depends on the state variables. For the first coefficient in the reconstruction order, the state variable is set to 0. For all other coefficients, the following condition applies: The value of the state variable for the current transform coefficient is determined by a binary function (path) of the values of the state variables for the previous transform coefficient levels and the values of the previous transform coefficient levels.
[0131] • The transform coefficient levels are binarized using binary arithmetic coding, and the binary bits are entropy-coded. Binarization includes a `sig_flag`, which specifies whether the transform coefficient level is non-zero. This flag is encoded using an adaptive probabilistic model, where the chosen probabilistic model depends on the values of the state variables used for the current transform coefficients (and possibly other parameters).
[0132] The following describes several embodiments for reducing the number of context-coded bits used in scalar quantization-dependent context encoding. For these embodiments, the worst-case decoding complexity is limited based on sub-blocks. Typically, as in HEVC, larger transform blocks are split into 4x4 sub-blocks, with the following conditions applied: The syntax of a transform block includes syntactic elements (e.g., coded_block_flag) that specify whether any non-zero transform coefficient levels exist in the transform block. If coded_block_flag equals 0, all transform coefficient levels are equal to 0, and no further data is transmitted for the transform block; otherwise (coded_block_flag equals 1), the following rules apply; • Transmit the x and y coordinates of the first effective transform coefficients arranged in scan order (sometimes referred to as the last effective coefficients because the actual scan order specifies the scan from high-frequency components to low-frequency components). • The scanning of transform coefficients is performed on a sub-block basis (usually a 4x4 sub-block); all transform coefficient levels of a sub-block are encoded before any transform coefficient level of any other sub-block is encoded; sub-blocks are processed in a predetermined scanning order, starting with the sub-block containing the first valid coefficients in the scanning order and ending with the sub-block containing the DC coefficients; • The syntax includes a coded_subblock_flag, which indicates whether the subblock contains any non-zero transform coefficient levels; this flag is not transmitted for the first and last subblocks in scan order (i.e., the subblock containing the first valid coefficient and the subblock containing the DC coefficient in scan order), but is inferred to be equal to 1; when the coded_subblock_flag is transmitted, it is usually transmitted at the beginning of the subblock; • For each subblock where coded_subblock_flag equals 1, the level of transformation coefficients transmitted in multiple scan passes at the scan position of the subblock; The following examples are applicable to the encoding of transform coefficients at the subblock level with subblocks having a coded_subblock_flag value of 1. However, the examples are not limited to this case. The examples can also be applied to complete transform blocks (without subblock structures). In this case, subblock structures can also be used (as described above), but the worst-case complexity is limited (as described below) to complete the transform block (instead of limiting it to subblocks separately).
[0133] Example 1 In the first embodiment, the transform coefficient levels are encoded across multiple scan passes. It has the following properties: • The quantization-dependent state machine is driven by parity bits at the level of transform coefficients, i.e., the parity bits of the parameters returned by the binary function path (level). • Select the probabilistic model for sig_flag's for the first pass based on the corresponding values of the state variables (and other parameters available to the optional decoder, see above); First time In the first pass of the scan position, the following context-encoded binary bits are transmitted: • sig_flag indicates whether the transform coefficients are not equal to 0; if it can be inferred that sig_flag is equal to 1 (i.e., for example, in the case of the first valid scan position in the transform block (which is explicitly notified by the signal from the x and y coordinates), then sig_flag is not transmitted.
[0134] • If sig_flag equals 1 (encoded or inferred value), then the following additional content is transmitted for the current scan position: o par_flag specifies the absolute parity level minus 1; o gt1_flag specifies whether the remainder (given by (absolute level - 1 - par_flag) / 2) is greater than 0.
[0135] • The first pass terminates if the predefined maximum number of bits for context encoding is reached. Let MAX_REG_BINS be the maximum number of bits that can be transmitted in the first pass, and let regBins represent the number of regular encoded bits still available. Then, apply the following condition: o regBins is initially set to be equal to MAX_REG_BINS; o After encoding any binary bit (sig_flag, gt1_flag, par_flag), regBins will decrease by 1; If the number of available binary bits (regBins) after transmitting the binary bits at the scan position (sig_flag and sig_flag equal to 1, gt1_flag, par_flag) is less than 3 (i.e., sig_flag, par_flag, and gt1_flag cannot be transmitted at the next scan position), then the first scan will terminate.
[0136] Second time In the second pass of the scan position, the following context-encoded binary bits are transmitted: • If the gt1_flag at the scan position is equal to 1, then gt2_flag is transmitted, which specifies whether the remainder (given by (absolute level - 3 - par_flag) / 2) is greater than 0.
[0137] • The second pass will terminate if the maximum predefined number of context-encoded gt2_flags has been transmitted. The second pass will also terminate if a scan position is reached where no data was transmitted in the first pass (i.e., for such scan positions, no data will be transmitted in the second pass).
[0138] Third time In the third pass of the scan positions, the remainder for the absolute value (i.e., the data not yet specified by the transmitted sig_flag, par_flag, gt1_flag, and gt2_flag) is transmitted at all scan positions where sig_flag was encoded in the first pass. The remainders of the non-binary syntax elements are binarized using structured code (such as Columbus-Rice code), and then encoded into binary bits in bypass mode of the arithmetic coding engine. The remainders are transmitted to the following scan positions: • For all scan positions, a gt2_flag of value 1 was transmitted in the second pass: For these scan locations, the non-binary syntactic element remainders transmitted specify the following: (absolute value – 5 – par_flag) / 2 • For all scan positions, gt1_flag equal to 1 was transmitted in the first pass, but gt2_flag was not transmitted in all scan positions in the second pass.
[0139] For these scan locations, the non-binary syntactic element remainders transmitted specify the following: (absolute value – 3 – par_flag) / 2 Fourth time In the fourth pass, the absolute levels of all scan positions are encoded, for which no data was transmitted in the first pass. The absolute levels are first binarized using structured code, the code of which may depend on local activity metrics and the value of the current state variable. The binary bits are transmitted using a bypass mode of the arithmetic coding engine.
[0140] Fifth time Finally, in the fifth pass, all symbols at the transform coefficient level that are not equal to zero are transmitted. Symbols are transmitted in bypass mode of the arithmetic coding engine.
[0141] The advantage of the described embodiment is that it effectively reduces the number of bits in context encoding compared to versions that do not limit the number of bits in the first and second passes. This reduces complexity because encoding and decoding context-encoded bits requires a more complex implementation than bits encoded in bypass mode.
[0142] Let us use the pseudocode shown in Figure 13 as an example to illustrate the above description. Figure 13 shows a method for decoding transform coefficient blocks according to the above embodiment, but by replacing all "decoding" with "encoding", the corresponding encoding embodiment can be easily derived.
[0143] The pseudocode shown in Figure 13 illustrates the encoding / decoding process at the transform coefficient level within sub-block 14. The pseudocode is shown from the decoder's perspective. Decoding from the data stream proceeds along the scan sequence in a sequence of passes 601 to 605 of the transform coefficient positions 12 of scan block 10. In the embodiments described later, the binary representation used is changed, i.e., the flags / binary bits used to define the quantization index of the coefficients, the encoding / decoding of the flags, and the distribution of the remainders across the encoding / decoding passes. Therefore, the generalized or rough description in Figure 13 also applies to the embodiments described later.
[0144] The possibilities of the scan order on which the iteration is based have already been discussed above. Figure 12a and 12bIt was described, and in Figure 12b The example is shown at 62, but note that passes 601 to 605 do not need to scan all the transform coefficient positions 12 of transform block 10, but they all use the scan order 62; in addition, flags for some flag types can be transmitted in the same pass, as described with respect to the embodiment in FIG13, but other possibilities also exist.
[0145] The predefined values MAX_REG_BINS and MAX_GT2_BINS shown in Figure 13 specify the maximum number of normally encoded binary bits in iteration 1 (601) and iteration 2 (602), respectively. The Boolean variable firstSubblock specifies whether the current subblock is the first subblock encoded / decoded in the encoding order for block 10 (within this transform block), such as containing Figure 12a The bold / black coefficient 12 is the subblock in the transform block 10. `firstSigScanIdx` specifies the scan index corresponding to the position of the first valid transform coefficient in transform block 10, i.e., the coefficient explicitly signaled at the beginning of the transform block syntax. This position is now indicated by reference symbol 64. `minSubblockScanIdx` and `maxSubblockScanIdx` represent the minimum and maximum scan indices of the current subblock, i.e., the currently decoded / encoded subblock. Note that the first scan index `startScanIdx` against which any data is transmitted for the current subblock 14 depends on whether the subblock contains the first valid coefficient in scan order. If so, the first scan pass begins at the scan index corresponding to the first valid transform coefficient 64; otherwise, the first scan begins by starting from the smallest scan index of the subblock, such as the lower left coefficient position of subblock 14, or in other words, the subblock furthest from the DC position 66 guided by scan order 62. Note again that although Figure 13 is an embodiment using sub-block encoding, the concept can be readily modified to involve coefficient encoding of blocks or to associate some of the aspects described below with sub-blocks while others are associated with the entire block 10.
[0146] In the sequence of iterations 601 to 604, context-adaptive binary arithmetic encoding / decoding is used to encode / decode flags or bits selected respectively from a set having one or more flag types, such as sig_flag, par_flag, gt1_flag, and gt2_flag in the currently described embodiment 1, and variable-length codes are used to encode / decode the remainder values. That is, using a unified non-adaptive probabilistic model, the bits of the codeword of the variable-length code are encoded / decoded in a bypass mode of the binary arithmetic encoding / decoding engine, resulting in a compression ratio of 1 for a single bit. Therefore, for the transform coefficient positions of the current scan, such as... Figure 12b The one indicated by 50 decodes each flag and each remainder value. In the pseudocode, this current position is indicated by the parameter or index k.
[0147] Decoding from the data stream in the sequence 601 to 605 is performed by encoding / decoding at least one of one flags and one remainder for each transform coefficient position in a set of encoded transform coefficient positions. The "set of encoded transform coefficient positions" extends, for example, between a predefined first transform coefficient position, such as startScanIdx, and a predefined last transform coefficient position, such as endScanIdx, where the predefined first and last transform coefficient positions specify subsets of transform coefficient positions in the transform block; alternatively, the encoding set extends between a first non-zero coefficient 64 and a predefined coefficient such as DC coefficient 66. That is, the encoding set may contain one or more coefficients for which the remainder is encoded / decoded, but without a flag; one or more coefficients for which one or more flags and one remainder are encoded / decoded; and one or more coefficients for which one or more flags but no remainder are encoded / decoded. For each coefficient, the encoding / decoding of its encoded data, i.e., the flags and / or remainder, is performed sequentially to continuously, or in other words, progressively constrain the initial value range in a sequential sense. For example, the absolute value of the quantization index of each coefficient position relative to... Ω = 0 to 2 x -1, e.g. x = 16The initial value range is represented in the x-bit representation, where the absolute value of the quantization index of any transform coefficient position used for the current scan must be contained therein. Through sequential encoding / decoding, this initial value range is progressively restricted to include only the absolute value of the quantization index of the transform coefficient position currently scanned within the value range. That is, finally, for a particular transform coefficient position, at least one of one or more flags and an encoded / decoded remainder uniquely defines the latter outside the initial value range. Each flag restricts the value range of the absolute value of the quantization index of the transform coefficient position used for the current scan to a first sub-part or a second sub-part, where the value range of the absolute value of the quantization index of the transform coefficient position used for the current scan is bisected. More precisely, each flag bisectes a portion of the value range where, due to one or more previous flags, if any, the absolute value of the quantization index of the respective coefficient is known to be in said portion of the value range. For example, sig_flag causes the value range Ω to be bisected. A={0} and Then, par_flag will The number is limited to either odd or even, and so on.
[0148] If the remainder value is encoded / decoded for a transform coefficient position 50 of a certain current scan, the remainder value uniquely indicates the transform coefficient position of the current scan. If at least one flag is decoded for the transform coefficient position of the current scan, the absolute value of the quantization index is outside the value range; or if no flag is decoded for the transform coefficient position of the current scan, it is outside the initial value range. Note that for transform coefficient positions where no remainder value is encoded / decoded, one or more flags encoded / decoded for these transform coefficient positions have already limited the value range to include only one absolute value. Regarding the sign, as taken in this embodiment, if the transform coefficients are signified as a whole, but not necessarily in the modified embodiment, they can be encoded separately in bypass mode. In Figure 13, they are shown as being encoded / decoded separately for any non-zero quantization index in its own pass 605, but this can be modified for further embodiments.
[0149] Dependent quantization is used to sequentially dequantize the quantization indices of the transform coefficient positions in the encoded set of transform coefficient positions. This process yields reconstructed transform coefficients for the set of transform coefficient positions. For example, state transitions as described above can be used. For instance, this can be represented using a state transition table or lattice diagram along scan order 62: that is, through methods such as... Figure 10 As shown, for example, for the current transform coefficient position represented by index k, its quantization index is uniquely encoded / decoded using the above concept, based on the state taken during the transition for the current transform coefficient position. Figure 7The "status" indicator uniquely selects a set of 72+ refactoring levels of 73, i.e. Figure 7 The set of reconstructed levels is set in set 0 and set 1, and the quantization index level[k] is dequantized 74 to the reconstructed level trec[k] pointed to by the quantization index in the set of reconstructed levels, that is, the reconstructed transform coefficients are set to be equal to the reconstructed level, and the state transition is updated 76 for the state transition taken for the current transform coefficient position, that is, the transform coefficient position currently scanned during dependent quantization, so as to generate an updated state 78 for the transform coefficient position following the current transform coefficient in the scan order. The update 76 is completed according to the quantization index level[k] of the current transform coefficient position, as follows. Figure 10 As shown in 80, Table 82 is used for this purpose. Similarly, quantization is performed on the encoder side using the selected level set.
[0150] As illustrated above, state transitions can occur in conjunction with... Figure 10 The vector described herein transitions between four different states corresponding to its four elements. Furthermore, updates can be performed by deciding between the first successor state and the second successor states 841 and 842, based on the following: a binary function 86, such as a parity check function, is applied to the quantization index 80 at the current transform coefficient position, where the first and second successor states depend on the state at the current transform coefficient position, as shown in 88. The encoder and decoder can be configured with a predetermined quantization step size, i.e. Figure 7 In and Figure 10 2 in shift The set of reconstruction levels is parameterized, where information about the predetermined quantization step size is transmitted, for example, in the data stream. Furthermore, as... Figure 7 As shown, each set of reconstruction levels can consist of integer multiples of a predetermined quantization step size, which is constant or valid for all sets of reconstruction levels at the current transform coefficient position. Note that, for example, different step sizes can be used for different coefficients within a block 10 due to the scaling matrix described above. The number of reconstruction level sets in the plurality of reconstruction level sets can be two, and the plurality of reconstruction level sets can include a first reconstruction level set, i.e., set 0, which includes zero and even multiples of the predetermined quantization step size, and a second reconstruction level set, i.e., set 1, which includes zero and odd multiples of the predetermined quantization step size.
[0151] The description in Figure 13 so far also applies to the embodiments described below. However, Embodiment 1 uses the following mechanism to limit the number of flags used with context-adaptive encoding. In particular, in a certain iteration of the iteration sequence, i.e., iteration 601 in Figure 13, flags of type sig_flag can only be reached for encoding / decoding. "Reached" should be understood herein as preceding a position and includes, although any reference to a position "starting from [position 112]" should be understood as indicating a position after position 112, excluding position 112 - the predetermined transform coefficient position, in which the predetermined abort criterion fills the first iteration in scan order. In Figure 13, not only the number of sig_flags is limited in this way, but also the number of par_flag and gt1_flag in iteration 601 and gt2_flag in iteration 602. Note that the limitation also affects binarization: as long as the abort criterion is met, the individual flag types are no longer used for defining coefficient positions after the aforementioned predetermined transform coefficient positions in scan order. That is, the flags of the predetermined flag type, i.e., limited by the number of encoding / decoding operations, are encoded / decoded only for types that precede and include the predetermined transform coefficient positions in the scan order. Therefore, in Figure 13, once the criteria related to iteration 601, i.e., related to MAX_REG_BINS, are met, for each set of encoded transform coefficient positions following the predetermined transform coefficient positions in the scan order, here, in a further iteration of the iteration sequence, i.e., iteration 603 in the iteration case of Figure 13, one of the remainder values is encoded such that the latter uniquely indicates the absolute value of the quantization index of each transform coefficient position beyond the initial value domain, i.e., without any prior restrictions on the initial value domain by any flags of the flag type used to encode / decode the quantization index of the corresponding coefficient.
[0152] To illustrate the concept just outlined for limiting the number of context-adaptive encoding / decoding flags, please refer to [reference needed]. Figures 14 to 15 In addition to Figure 13. Figure 14 This shows the initial range of the absolute values of the quantization indices of the transform coefficients at 90. This initial range can contain all integer values between zero and some maximum value. The initial range can also be an interval open to larger numbers. The number of integer values in the initial range 90 does not necessarily have to be a power of 2. Furthermore, Figure 14 This shows the various flag types that participate in representing each quantization index, i.e., those that participate in representing their absolute values. The `sig_flag` type indicates whether the absolute value of a given quantization index is zero. That is, `sig_flag 92` divides the initial value range 90 into two sub-parts: one containing only zero, and the other containing all other possible values. In other words, if `sig_flag` is already set as described... Figure 14If the bottom of the value is exactly zero, then `sig_flag` has already uniquely indicated the absolute value of the quantization index. The non-zero values of the initial value range 90 form a value range 94, which is further bipartite by the flag type `par_flag`, i.e., one side becomes odd and the other side becomes even. `par_flag 96` is only needed if a quantization index is non-zero. `par_flag 96` does not produce uniqueness with respect to the same bipartite value range 94. It indicates that half is the value range of the next result (recursively defined), therefore, the next flag, `gt1_flag 98`, further bipartites this result value range after `par_flag`, i.e., an odd non-zero value of 100 when the quantization index value is odd, and a non-zero value of 102 when the quantization index value is even. Specifically, the bipartition of `gt1_flag 98` is done in a way that one part includes only the smallest odd value of value range 100 or the smallest non-zero even value of value range 102. The other part includes all other values in the corresponding field 100 / 102. The remaining value range of the latter is further bisected in the same way by the flag gt2_flag 104, that is, the minimum value represents one part, and the other values represent the other part. For example... Figure 14 As shown at the bottom, this means that if a transform coefficient's quantization index happens to be zero, then only sig_flag92 is encoded as the quantization index of that transform coefficient, and sig_flag, par_flag, and gt1_flag 92, 96, and 98 are encoded as the specific quantization index of the transform coefficient if the transform coefficient happens to fall into the value interval 106, which includes absolute values 1 and 2. All flags 92, 96, 98, and 104 are encoded to represent the absolute value of the quantization index of a specific transform coefficient, and if the transform coefficient happens to fall into the immediately following value interval 108, which includes values 3 and 4, then the remainder of the quantization index encoding is the transform coefficient whose absolute value lies in the remaining interval 110 outside the initial value range 90. Flags of flag types 92, 96, and 98 are encoded in the first pass 601. Flag 104 is encoded in the second pass 602. These flags are encoded using a context-adaptive algorithm. However, the number of flags encoded in a pass can be limited and is restricted according to Figure 13. In the example of Figure 13, the number of flags of flag type 601 is limited to max_rec_bins. Flags of flag types 92, 96, and 98 are encoded for the currently accessed transform coefficient position 12 in the first pass along sequence 62 only if it is still possible to encode all three flag types in pass 601 and the total number of flags encoded in pass 601 does not exceed the maximum allowed number of flags to be encoded / decoded in pass 601. Figure 15In the diagram, the last transform coefficient position shown is 112, which does not exceed the maximum number of flags allowed in iteration 601. Similarly, flag encoding for flag type 104 at the currently accessed transform coefficient position 12 along sequence 62 is performed only in the second iteration, provided that the flag can still be encoded in iteration 602 and the total number of encoded flags 104 in iteration 602 does not exceed the maximum number of flags allowed to be encoded / decoded in iteration 602. Figure 15 In the diagram, the last transformation coefficient position is shown as 116, which does not exceed the maximum allowed number of flags in iteration 602.
[0153] Figure 15 The encoding of the transform coefficients or their quantization indices relative to sub-block 14 is shown; however, as mentioned above, the embodiment of Figure 13 can vary within this scope as long as the entire process of Figure 13 is applied as a whole to block 10. Furthermore, Figure 15 This illustrates the case where the set of encoded transform coefficients includes all coefficients, for example, for a sub-block following a sub-block in scan sequence 62 that includes the first non-zero transform coefficient position 64. Therefore, in Figure 15 The positions of the transform coefficients, indicated by shading, are related to the transform coefficients whose quantization indices are represented by flag types 92, 96, and 98. Therefore, in the first pass 601, the flags of these flag types 92, 96, and 98 are encoded for the transform coefficients 12 up to position 112. For some of the transform coefficients 12 up to position 112, only sig_flag 92 needs to be encoded, while for all three other flag types, they are included in pass 601 and encoded / decoded. Figure 15 The data stream is shown to include corresponding portions 114, where flags of flag types 92, 96, and 98 are encoded within pass 601. In the second pass 602, the transform coefficient positions 12 are traversed again along scan order 62 until the maximum number of gt2_flags that can be encoded during pass 602, i.e., the number of these flags does not exceed max_gt2_bins, is reached. Then, gt2_flags are encoded for the transform coefficients, where gt2_flag 98 indicates that the absolute value of the corresponding quantization index lies within the remaining value domain portion including intervals 108 and 118. Figure 15 Show all transformation coefficient positions 12 along scan sequence 62 up to position 116 when the shading lines have been drawn, and distinguish these positions from subsequent transformation coefficient positions 12 up to position 112, which is simply shaded. Figure 15The positions 12 of all transform coefficients following position 112 are not shown in shaded form. The gt2_flag 104, which will be encoded during iteration 602, is encoded as portion 118 of the data stream, immediately following portion 114. No further data is encoded during iteration 602 after position 116. In the next two iterations 603 and 604, which can be interpreted as half of an iteration, the hint is encoded into portion 120 of the data stream, immediately following portion 118. Specifically, in the first sub-part of portion 120, during iteration 603, the hint for transform coefficient positions 12 up to position 112 is encoded. Therefore, these remainders indicate the absolute value of the quantization index for a certain transform coefficient position 12 outside the interval 110 for crossshading transform coefficient positions 12, i.e., transform coefficient positions 12 up to position 116 and a certain quantization coefficient position 12 outside the remainder range, including intervals 108 and 110 for simple shading transform coefficient positions 12, i.e., those intervals following position 116 up to position 112. In subsection 122, the remainders of transform coefficient positions 12 up to position 112, and in another subsection in iteration 604, the remainders of each transform coefficient position 12 after position 112, i.e., each non-shaded transform coefficient position 12, are encoded into the data stream. The subsequent remainders directly indicate the quantization index, i.e., directly indicate that the absolute value exceeds the initial value range 90. In this way, the number of context-adaptive encoding flags 92, 96, 98, and 104 is reduced, and the number of bits encoded using the bypass mode, i.e., using a fixed equal probability mode, is increased, i.e., the binary bits of the remainder binarization.
[0154] That is, in Figure 13, the above-mentioned termination criterion is related to whether the number of flags decoded in the first pass exceeds a predetermined threshold. In addition to sig_flags, flags of types 96 and 98 are also counted.
[0155] It is possible that a variable-length code was selected from a predefined set of variable-length codes, such as Columbus-Less codes, to encode / decode the remainder at the position of the transform coefficient in the current scan. This depends on whether the position of the transform coefficient in the current scan is before the predetermined transform coefficient position 112, i.e., in... Figure 15 The code selected for the shaded position in Figure 13, following the predetermined transform coefficient position 112 in scan order 62, can differ. In the case of Figure 13, the selection can even depend on whether the position is between positions 112 and 116. For example, the encoding / decoding of the remainder can include a VLC code different from that in iteration 604 instead of iteration 603, or a code different from that in iteration 603 at position 128 in Figure 13. Figure 15 Compared to different VLC codes used when encoding / decoding the remainders of simple cross-shading coefficients, at position 130... Figure 15The VLC code used when encoding / decoding the remainder of the shadow coefficients. The parameterization involved in parameterizable VLC codes is selected, such as choosing the order of the exponential Golomb code, or the Rice parameter as described below. Alternatively, the parameter indicating the selected variable-length code can be specified via 60... 3,4 The binarization parameter remains constant and can be incrementally changed as long as the quantization index of the previously scanned transform coefficient position meets a predetermined criterion. Alternatively, the binarization parameter can be selected based on the quantization index of the transform coefficient positions adjacent to the currently scanned transform coefficient position when encoding the remainder. For example, only for Figure 15 The position of all shaded lines can be used with this dependency only if the current transform coefficient position of the remainder before scan order 62 is encoded or if the predetermined transform coefficient position is 112. This aspect will be outlined below.
[0156] The codeword selected from the selected / parameterized code also depends on the position of the coefficients for encoding / decoding the remainders: the absolute value of the quantization index minus the maximum value that can be represented by the flags 92, 96, 98, and 104 of the first and second passes of the parameters, i.e., 4, plus 1, i.e., 5, or represented by the remainder binarization of the quantization index of any coefficient in the case of the coefficients to which the quantization coefficient belongs, or VLC encoded to position 116, the absolute value of the quantization index minus the maximum value that can be represented by the flags 92, 96, and 98 of the first pass of 601, i.e., 2 plus 1, i.e., 3, or represented by the remainder binarization of the quantization index of any coefficient in the case of the coefficients to which the quantization coefficient belongs, or VLC encoded to position 116 after position 112, and the absolute value of the quantization coefficient is directly represented or VLC encoded in the case of the coefficients to which the quantization index belongs, the remainder binarization of the quantization index of any coefficient is located after position 112.
[0157] Several variations of the embodiment in Figure 13 can be applied. For example, gt2_flag might not be encoded / decoded in a separate pass 602, but rather included in the first pass 601. The number of encoded gt2_flag bits might then be included in the count of context-encoded bits in the first pass 601, and the first pass terminates if the number of available context-encoded bits is less than 4. That is, in this case, a single threshold of the number of context-encoded bits is used. Alternatively, gt2_flag may not be transmitted at all, in which case the remainder is encoded if gt1_flag equals 1.
[0158] In another variation of the embodiment, one or more additional gtx_flags are included. Similar to gt2_flag, these flags are encoded only if the previous gty_flag (y = x-1) equals 1. They indicate whether the absolute value of the quantization index is greater than the minimum possible value specified by the previous gtx_flags. The reconstruction of the absolute value is given by the following formula. absLevel = sig_flag + par_flag + 2 * ( gt1_flag + gt2_flag + gt3_flag+ … + remainder ).
[0159] These flags can be encoded in the same pass as gt2_flag (including cases where gt2_flag is included in the first pass), or they can be encoded in one or more additional passes. In the latter case, additional thresholds can be applied to limit the number of gtx_flags.
[0160] The second embodiment described below differs from the first embodiment in one aspect: the order of par_flag and gt1_flag is swapped (and the meaning of these flags changes accordingly). If sig_flag equals 1, gt1_flag, which specifies whether the absolute value of the transform coefficient level is greater than 1, is transmitted first. If gt1_flag equals 1, par_flag specifies the parity bit of the remainder (i.e., absolute level – 2). For the first embodiment, the following applies: • Quantization-dependent state machines are driven by parity bits at the level of transform coefficients, i.e., the binary function path (level) returns the parity bits of its independent variables; • Select the probabilistic model for sig_flag in the first pass based on the corresponding values of the state variables (and other optional parameters that can be used for the decoder, see above); First time: In the first pass of the scan, the following context-encoded binary bits are transmitted: • sig_flag, indicating whether the transform coefficients are not equal to 0; if it can be inferred that sig_flag is equal to 1 (i.e., the case of the first valid scan position in the transform block (a signal explicitly represented by the x and y coordinates), then sig_flag is not transmitted.
[0161] • If sig_flag equals 1 (the encoded or inferred value), then the following additional content is transmitted for the current scan position: o gt1_flag specifies whether the absolute level is greater than 1; o If gt1_flag equals 1, then par_flag specifies the absolute parity level minus 2; • If the maximum number of bits for the predefined context encoding is reached, the first pass will terminate. Let MAX_REG_BINS be the maximum number of bits that can be transmitted in the first pass, and let regBins represent the number of bits of regular encoded bits that are still available. Then, apply the following condition: o regBins is initially set to be equal to MAX_REG_BINS; o After encoding any binary bit (sig_flag, gt1_flag, par_flag), regBins will decrease by one; If, after transmitting the binary bits of the scan position (sig_flag, and if applicable, gt1_flag and par_flag), the number of still available bin regBins is less than 3 (i.e., it is impossible to transmit sig_flag, par_flag, and gt1_flag for the next scan position), the first scan will terminate.
[0162] Second pass: In the second pass of the scan position, the following context-encoded binary bits are transmitted: • If the gt1_flag at the scan position is equal to 1, then gt2_flag is transmitted, which specifies whether the remainder (given by (absolute level - 2 - par_flag) / 2) is greater than 0.
[0163] • The second pass will terminate if the maximum predefined number of context-encoded gt2_flags has been transmitted. The second pass will also terminate if a scan position is reached where no date was transmitted in the first pass (i.e., for such scan positions, no data will be transmitted in the second pass).
[0164] Third time: In the third pass of the scan positions, the remainders for the absolute values (i.e., the data not yet specified by the transmitted sig_flag, par_flag, gt1_flag, and gt2_flag) are transmitted for all scan positions where sig_flag resides, encoded in the first pass. The remainders, which are not part of the binary syntax, are binarized using structured code (such as Columbus-Rice code), and then encoded into binary bits in a bypass mode of the arithmetic coding engine. The remainders are then transmitted to the following scan positions: • For all scan positions, a gt2_flag of value 1 was transmitted in the second pass: For these scan locations, the non-binary syntactic element remainders transmitted specify the following: (absolute value – 4 – par_flag ) / 2 • For all scan positions, gt1_flag equal to 1 was transmitted in the first pass, but gt2_flag was not transmitted in all scan positions in the second pass.
[0165] For these scan locations, the non-binary syntactic element remainders transmitted specify the following: (absolute value – 2 – par_flag ) / 2 Fourth time: In the fourth pass, the absolute levels of all scan positions are encoded, whereas no data was transmitted in the first pass. The absolute levels are first binarized using structured code, the code of which may depend on local activity metrics and the value of the current state variable. The binary bits are transmitted using a bypass mode of the arithmetic coding engine.
[0166] Fifth time: Finally, in the fifth pass, all symbols at the transform coefficient level that are not equal to zero are transmitted. Symbols are transmitted in the bypass mode of the arithmetic coding engine.
[0167] The pseudocode in Figure 16 further illustrates the encoding / decoding process at the transform coefficient level within the sub-block. The same annotations apply as in the first embodiment. Figure 17 Show Figure 14 The revised version applies to Figure 16. Figure 15 This also applies to Figure 16, except for details such as the start of the value range. The remainders related to the coefficients between positions 112 and 116, which can be represented by flags 92, 96, and 98, are the maximum values, which are 2 in the case of Figure 13 and 1 in the case of Figure 16. It can be seen that, unlike the case of Figure 13, the encoding / decoding of the flag par_flag in the first pass 601 specifically targets the transformation coefficient positions where the flag gt1_flag indicates that the quantization index of the corresponding scan transformation coefficient is greater than one at the transformation coefficient position and after the transformation coefficient position. In the case of Figure 13, this encoding / decoding inevitably occurs in the case where the corresponding sig_flag indicates a non-zero value.
[0168] In this variant of the embodiment, gt2_flag is not encoded in a separate pass, but is included in the first pass. The number of encoded gt2_flags is then included in the count of context-encoded bits in the first pass, and the first pass terminates if the number of available context-encoded bits is less than 4. That is, in this case, a single threshold for the number of context-encoded bits is used.
[0169] Alternatively, gt2_flag is not transmitted at all; in this case, the remainder is encoded if gt1_flag equals 1.
[0170] In another variation of the embodiment, one or more additional gtx_flags are included. Similar to gt2_flag, these flags are encoded only if the previous gty_flag (y = x-1) equals 1. They indicate whether the absolute value of the quantization index is greater than the minimum possible value specified by the previous gtx_flags. The reconstruction of the absolute value is given by the following formula. absLevel = sig_flag + gt1_flag + par_flag + 2 * ( gt2_flag + gt3_flag+ … + remainder ) These flags can be encoded in the same pass as gt2_flag (including cases where gt2_flag is included in the first pass), or they can be encoded in one or more other passes. In the latter case, a further threshold can be applied to limit the number of gtx_flags.
[0171] The third embodiment differs from the first embodiment in that: the sig_flag in the first pass is encoded for all scan positions. The existence of only par_flag and gt1_flag is determined by the number of context-coded bits transmitted. For the first embodiment, the following conditions apply: • Quantization-dependent state machines are driven by parity bits at the level of transform coefficients, i.e., the binary function path (level) returns the parity bits of its independent variables; • Select the probabilistic model for sig_flag in the first pass based on the corresponding values of the state variables (and other optional parameters that can be used for the decoder, see above); First time In the first pass of the scan position, the following context-encoded binary bits are transmitted: • sig_flag, indicating whether the transform coefficients are not equal to 0; if it can be inferred that sig_flag is equal to 1 (i.e., the case of the first valid scan position in the transform block (a signal explicitly represented by the x and y coordinates), then sig_flag is not transmitted.
[0172] • If sig_flag equals 1 (encoded or inferred value), then the following additional content is transmitted for the current scan position: o par_flag specifies the absolute parity level minus 1; ogt1_flag specifies whether the remainder (given by (absolute level - 1 - par_flag) / 2) is greater than 0.
[0173] If the maximum predefined number of context-encoded bits (including unencoded sig_flags) is reached, skip the transmission of par_flag and gt1_flag. Let MAX_REG_BINS be the maximum number of bits that can be transmitted in the first pass, and let regBins represent the number of bits of regular encoded bits that are still available. Then, the following applies: o regBins is initially set to MAX_REG_BINS minus the number of sig_flags to be transmitted in the first pass (this number is determined by the first scan index in the first pass, the last scan index of the sub-block, and whether the sub-block contains the first valid coefficient in the scan order). o After encoding any gt1_flag or par_flag, decrement regBins by 1; If, after transmitting the binary bits of the scan position (sig_flag, gt1_flag if sig_flag equals 1, par_flag), the number of still available bin regBins is less than 2 (i.e., par_flag and gt1_flag cannot be transmitted for the next scan position), then for all subsequent scan indices in the first pass, only sig_flag is transmitted.
[0174] Second time In the second pass of the scan position, the following context-encoded binary bits are transmitted: • If gt1_flag at the scan position is equal to 1, then gt2_flag is transmitted, which specifies whether the remainder (given by (absolutelevel - 3 - par_flag) / 2) is greater than 0.
[0175] • The second pass will terminate if the maximum predefined number of context-encoded gt2_flags has already been transmitted. The second pass will also terminate if only a sig_flag equal to the sig_flag is transmitted to the scan position in the first pass (i.e., no data is transmitted in the second pass for such scan positions). Third timeDuring the third pass through the scan positions, the absolute-level remainders of sig_flag, par_flag, gt1_flag, and par_flag encoded in all scan positions in one pass are transmitted (i.e., the data specified by sig_flag, par_flag, gt1_flag, and gt2_flag that were not sent). The remainders of the non-binary syntax elements are binarized using structured code (such as Columbus-Rice code), and then encoded into binary bits in bypass mode of the arithmetic coding engine. The remainders are then transmitted to the following scan positions: • For all scan positions, a gt2_flag of value 1 was transmitted in the second pass: For these scan locations, the non-binary syntactic element remainders transmitted specify the following: (absolute value – 5 – par_flag ) / 2 • For all scan positions, gt1_flag equal to 1 was transmitted in the first pass, but gt2_flag was not transmitted in all scan positions in the second pass.
[0176] For these scan locations, the non-binary syntactic element remainders transmitted specify the following: (absolute value – 3 – par_flag ) / 2 Fourth time: In the fourth pass, the absolute value of all scan positions is subtracted by 1, whereas in the first pass only sig_flag equal to 1 is encoded (but gt1_flag is not transmitted). The remainder (absolute level minus 1) is first binarized using structured code, the code of which may depend on the local activity metric and the value of the current state variable. The binary bits are transmitted using a bypass mode of the arithmetic coding engine.
[0177] Fifth time Finally, in the fifth pass, all symbols at the transform coefficient level that are not equal to zero are transmitted. Symbols are transmitted in the bypass mode of the arithmetic coding engine.
[0178] The pseudocode in Figure 18 further illustrates the encoding process at the transform coefficient level within the sub-block. The same annotations apply as in the first embodiment. Figure 14 and Figure 15The same applies to Figure 18, except that: position 112 indicates the start of scan sequence 62 from that position, and flags 96 and 98 are no longer encoded, while sig_flag is available for the entire position block. Therefore, the remainder of position 112 downstream of the coefficient position, which is not shaded, does not immediately represent the quantization index of the corresponding coefficient, but is only encoded for coefficients after position 112, where only their sig_flag is non-zero and represents only the absolute value of the quantization index minus 1.
[0179] Please note that after encoding the first sig_flag equal to 1, the state variables are unknown, and there are no subsequent gt1_flag / par_flag. Therefore, for subsequent sig_flags, the probabilistic model used must be derived independently of the state variables (for previous sig_flags, it still depends on the state variables).
[0180] The following variations of Example 3 are possible: 1. The state machine is driven by `sig_flag` (i.e., information indicating whether the transformation coefficient level is equal to or not equal to zero). The binary function path specifies whether the level is not equal to zero. In this case, the parity flag does not need to be transmitted; besides `sig_flag`, only the following data is transmitted: • First pass: gt1_flag (transmitted sig_flag equals 1; specifies whether the absolute level is greater than 1); • Second pass: gt2_flag (transmitted gt1_flag equals 1; specifies whether the absolute level is greater than 2).
[0181] This has the following advantages: the state variables are known for all sig_flags, so the probabilistic model used to encode sig_flags can select sig_flags based on the state variables.
[0182] Alternatively, gt1_flag can be removed from the first pass and encoded separately, as shown below: First pass: Transmit sig_flags • Second pass: Transmit gt1_flags (maximum number of gt1_flags); • Third pass: Transmit gt2_flags (maximum number of gt2_flags); • Fourth pass: For the remainder of the scan index, where (a) gt2_flag equal to 1 is transmitted and (b) gt1_flag equal to 1 is transmitted, but gt2_flag is not transmitted; • Fifth pass: The absolute level of the scan position where sig_flag is equal to 1 is reduced by 1, but gt1_flag is not transmitted.
[0183] • Sixth pass: all transformation coefficient levels are non-zero.
[0184] 2. The state machine switches from a parity bit-driven state machine to a validity bit-driven state machine. This means: • For all scan indices where regBins (specified in the pseudocode above) is greater than or equal to 2, the state variables will be updated using parity bits (i.e., parity bits at the level of the transform coefficients specified in the binary function path). • After regBins is less than 2, the state variable will be updated with valid bit information (i.e., whether the binary function path (level) specifies whether the level is not equal to zero).
[0185] The advantage of this approach is that all state variables of the sig_flag are known, allowing the selection of a probabilistic model for encoding the sig_flag based on these state variables. Compared to variant 1 (where the state machine is always driven by the sig-flag), it achieves higher packing density in N-dimensional space, thus enabling higher encoding efficiency.
[0186] That is, the state transition at 76, which has been described so far as purely parity bit driven, can vary to such an extent that the update of the state during the state transition depends on... Figure 10 The current transform coefficient position given by k is either before scan sequence 62 relative to scan 601, or at the predetermined transform coefficient position 112, i.e., at... Figure 15 One of the shaded line positions, or located outside the predetermined transformation coefficient position 112, i.e., located in Figure 15One of the non-shaded positions in the diagram. If the current transform coefficient position does not exceed the predetermined transform coefficient position 112 along the scan order 62, i.e., before or equal to the predetermined transform coefficient position 112, then the flag coefficient position of the second flag type 96 depending on the current transform, i.e., the parity bit, is updated as previously described. However, if the current transform coefficient position is after the predetermined transform coefficient position along the scan order, i.e., beyond the position along the scan order 62, then the flag of the first flag type depending on the current transform coefficient position is updated, i.e., the zero degree depending on the current coefficient. Then, when the context adaptive entropy decodes the flag of the predetermined first flag type, i.e., sig_flag participates, according to this embodiment, even beyond the representation of the quantization index of each coefficient other than the parity flag and gt1 flag encoded at 112, this can be utilized: therefore, the decoder and encoder can determine the context of such sig_flag for all previous transform coefficient positions for the currently scanned transform coefficient, including then, according to the state taken for the currently scanned transform coefficient position, following the predetermined transform coefficient position 112.
[0187] Alternatively, the state update can be performed in any manner, such as being entirely driven by the parity bit and quantizing the state according to the dependency until, after position 112, the context of the sig_flags up to position 112 is completed independently of the state.
[0188] Similar to Example 1, the following changes may be made: ·gt2_flag is included in the first iteration; ·gt2_flag has no encoding at all.
[0189] • The attached gtx_flag is encoded.
[0190] That is, in the case of the third embodiment, there is a flag 92 of a predetermined first flag type, namely sig_flag, and a flag 96 of a predetermined second flag type, namely par_flag. As in other embodiments, they are encoded / decoded in such a way that the flag restricting the range of the absolute value of the quantization index of the first transform coefficient position is encoded / decoded before the flag restricting the range of the absolute value of the quantization index of the second transform coefficient position in the scan order 62. That is, any sig_flag[k] and par_flag[k] are encoded / decoded before any sig_flag[k+1] and par_flag[k+1]. Referring to FIG13, before the encoding / decoding of the flag of the predetermined second flag type, namely par_flag, is performed up to the predetermined transform coefficient position 112, which is indexed by “startIdxBypass-1” in FIG18, the abort criterion is filled for the first time along the scan order 62 in the first pass 601. For example, if the number of encoded flags in the first pass 601 exceeds a certain threshold - the encoding / decoding of a flag of a predetermined first flag type, i.e., sig_flag, is performed in scan order 62 beyond the predetermined transform coefficient position 112, i.e., for all transform coefficients or all positions 64 except the first non-zero quantization index, no abort criterion needs to be investigated.
[0191] The fourth embodiment differs from the third embodiment in one respect: the order of par_flag and gt1_flag is swapped (and the meaning of these flags changes accordingly). If sig_flag equals 1, gt1_flag, which specifies whether the absolute value of the transform coefficient level is greater than 1, is transmitted first. If gt1_flag equals 1, par_flag specifies the parity bit of the remainder (i.e., absolute level – 2). For the first embodiment, the following conditions apply: • For quantization-dependent state machines, parity is driven by the level of transform coefficients, i.e., the binary function path (level) returns the parity of its independent variables; • Based on the values of the state variables (and other optional parameters that can be used for the decoder, see above), a probabilistic model for selecting sig_flag in the first pass is generated; First time In the first pass of the scan position, transmit the binary bits of the following context encoding: • sig_flag indicates whether the transform coefficients are not equal to 0; if it can be inferred that sig_flag is equal to 1 (i.e., the case of the first valid scan position in the transform block (a signal explicitly represented by the x and y coordinates), then sig_flag is not transmitted.
[0192] • If sig_flag equals 1 (encoded or inferred value), then the following additional content is transmitted for the current scan position: o gt1_flag specifies whether the absolute level is greater than 1; o If gt1_flag equals 1, then par_flag specifies the absolute parity level minus 2; If the maximum predefined number of context-encoded bits (including unencoded sig_flags) is reached, skip the transmission of par_flag and gt1_flag. Let MAX_REG_BINS be the maximum number of bits that can be transmitted in the first pass, and let regBins represent the number of bits of regular encoded bits that are still available. Then, apply the following condition: o regBins is initially set to MAX_REG_BINS minus the number of sig_flags to be transmitted in the first pass (this number is determined by the first scan index of the first pass, the last scan index of the sub-block, and whether the sub-block contains the first valid coefficient in the scan order). o After encoding any gt1_flag or par_flag, decrement regBins by 1; If, after transmitting the binary bits of the scan position (sig_flag, gt1_flag if sig_flag equals 1, par_flag), the number of available binary bits regBins is less than 2 (i.e., par_flag and gt1_flag cannot be transmitted for the next scan position), then for all subsequent scan indices in the first pass, only sig_flag is transmitted.
[0193] Second time In the second pass of the scan position, the binary bits following the context encoding are transmitted: • If the gt1_flag at the scan position is equal to 1, then gt2_flag is transmitted, which specifies whether the remainder (given by (absolutelevel-2 - par_flag) / 2) is greater than 0.
[0194] • The second pass will terminate if the predefined maximum number of context-encoded gt2_flags has been transmitted. The second pass will also terminate if a scan position where only skip_flag equals 1 was transmitted in the first pass (i.e., no data is transmitted in the second pass for such scan positions).
[0195] Third timeIn the third pass of the scan positions, remainders for the absolute level (i.e., the data specified by sig_flag, par_flag, gt1_flag, and gt2_flag that have not yet been transmitted) are transmitted for all scan positions where sig_flag, gt1_flag, and par_flag were encoded in the first pass. The remainders of the non-binary syntax elements are binarized using structured code (e.g., Columbus-Rice code), and then encoded into binary bits in the bypass mode of the arithmetic coding engine. The remainders are transmitted to the following scan positions: • For all scan positions, a gt2_flag of value 1 was transmitted in the second pass: For these scan locations, the non-binary syntactic element remainders transmitted specify the following: (absolute value – 4 – par_flag ) / 2 • For all scan positions, gt1_flag equal to 1 was transmitted in the first pass, but gt2_flag was not transmitted in the second pass.
[0196] For these scan locations, the non-binary syntactic element remainders transmitted specify the following: (absolute value – 2 – par_flag ) / 2 Fourth time In the fourth pass, the absolute value of the encoding for all scan positions is subtracted by one, except for sig_flag, which was encoded in the first pass when it equals 1 (but gt1_flag is not transmitted). The remainder (absolute level minus 1) is first binarized using structured code, the code of which may depend on the local activity measure and the value of the current state variable. The binary bits are transmitted using a bypass mode of the arithmetic coding engine.
[0197] Fifth time Finally, in the fifth pass, all symbols at the transform coefficient level that are not equal to zero are transmitted. Symbols are transmitted in bypass mode of the arithmetic coding engine.
[0198] The pseudocode in Figure 19 further illustrates the encoding process at the transform coefficient level within a sub-block. Applicable to... Figure 17 and Figure 15 The same annotations as those in the first and third embodiments also apply to Figure 19, wherein, Figure 15 In the middle, the range of values involved by the remainder of the coefficient between positions 112 and 116 is marked by the symbols 92, 96 and 98, which is 2 in the case of Figure 13 and 1 in the case of Figure 19.
[0199] For Example 4, the same changes as in Example 3 are possible. This includes the following aspects (similar to Example 2): ·gt2_flag is included in the first iteration; ·gt2_flag has no encoding at all.
[0200] • The attached gtx_flag is encoded.
[0201] The following aspects can be combined with any of the above embodiments: Probabilistic model selection for sig_flag Choose an adaptive probabilistic model from the set of probabilistic models to encode the current sig_flag. For simplicity, let's assume the available probabilistic models are organized in a 4-dimensional array. probModelSig [cSig] [sSig] [dSig] [aSig], Where cSig specifies the index dependent on the current color channel, sSig specifies the index dependent on the state variable, dSig specifies the index dependent on the x and y positions within the transform block, and aSig specifies the index dependent on the local activity metric. The actual organization of the probabilistic models is one aspect of the practical implementation. For example, they can be organized as a one-dimensional array, in which case the combined index can be derived based on the values of cSig, sSig, dSig, and aSig.
[0202] Below, we describe example methods for deriving the indices cSig, sSig, dSig, and aSig. However, it should be noted that different methods can be used to derive these indices (or parts of the indices).
[0203] Color Channel Index cSig In a preferred embodiment, the color channel index cSig is set to 0 if and only if the current color channel represents the luminance channel (or more generally, the first color channel). cSig is set to 1 only if the current color channel represents the chroma channel (or more generally, not the first color channel). cSig = (current channel is luma 0 : 1 ) Alternatively, the cSig of the luminance channel can be set to 0, the cSig of the Cb channel can be set to 1, and the cSig of the Cr channel can be set to 2.
[0204] State index sSig In a preferred embodiment, the index sSig is set to equal to This means that one set of probability models is used for state variables that are equal to 0 and 1, the second set is used for state variables that are equal to 2, and the third set is used for state variables that are equal to 3.
[0205] Alternatively, the index sSig can be set to be equal to the state variable (sSig = state), in which case a separate set of probabilistic models will be used for each possible value of the state variable. Or, as another alternative, the index sSig can be set according to sSig = state >> 1, in which case a separate set of context models will be used for each of the two quantizers Q0 and Q1 (note that quantizer Q0 is used when the state is equal to 0 or 1, and quantizer Q1 is used when the state is equal to 2 or 3).
[0206] Location index dSig In a preferred embodiment, the index dSig is set as follows: • If the index cSig equals 0 (i.e., the current color channel represents the luminance channel), then dSig is set according to the following settings. • If the index cSig equals 1 (i.e., the current color channel represents the chroma channel), then the following is based on the setting dSig Here, diag represents the diagonal position given by diag = x + y, where x and y represent the x and y coordinates of the current scan position inside the transform block.
[0207] Alternatively, any other clustering at the diagonal positions is also possible. Or alternatively, the (x, y) positions within the transform block can be divided into multiple categories, and the index dSig can be set to be equal to the corresponding category index.
[0208] Local activity index aSig Finally, in a preferred embodiment of the invention, the index aSig is set according to the following: aSig = min(MAX_ABS1, sumAbs1), Where MAX_ABS1 is a predefined value, and sumAbs1 refers to the sum of the minimum absolute transformation coefficients in the local template, which is given by the data transmitted in the first pass (see above). Alternatively, a function of sumAbs1 or a function of min(MAX_ABS1, sumAbs1) can be used to derive aSig.
[0209] In a preferred embodiment of the present invention, the predefined value MAX_ABS1 is set to equal to 5.
[0210] In a preferred embodiment of the present invention, the following was used: Figure 12b The local template shown is an example. Note that the template includes the adjacent positions encoded before the current position. Other local templates with these attributes (scanning / encoding adjacent positions before the current position) can also be used. Such other templates can be used in two ways... Figure 12b The templates shown are different: (1) the number of transformation coefficient positions included and (b) the positions of the transformation coefficient positions included.
[0211] Let absLevel1[i] be the absolute value of the partial reconstruction of the transformation coefficient level at scan index i. Let T(k) specify the set of scan indices within the template used for the current scan index k. Then, derive sumAbs1 for the changes at the current scan index k according to the following... That is, sumAbs1 represents the sum of the absolute values of the partial reconstructions within the template.
[0212] absLevel1[k] represents the absolute value of the partial reconstruction at the transform coefficient level at scan index k. The partial reconstruction uses only the data transferred in the first pass. Some examples are specified below: • If sig_flag, par_flag, and gt1_flag are transmitted in the first pass according to the definitions in Examples 1 and 3 (see above: par_flag specifies the parity bit of the absolute value minus 1, while gt1_flag specifies whether (absolute level – 1 – par_flag) / 2 is greater than 0), then the partially reconstructed value can be derived according to the following formula. absLevel1[k] = sig_flag[k]+ par_flag[k] + 2 * gt1_flag[k], The values of par_flag and gt1_flag, which are not explicitly encoded, are inferred to be equal to 0.
[0213] When gt2_flag is included in the first pass (a variation of Examples 1 and 3), it can be additionally used to derive the minimum possible absolute value. In this case, the partially reconstructed value can be determined based on... absLevel1 [k] = sig_flag [k] + par_flag [k] + 2 * (gt1_flag [k] + gt2_flag [k]), The inference for gt2_flag, which is not explicitly encoded, is 0.
[0214] • If, according to the definitions in Examples 2 and 4, sig_flag, gt1_flag, and par_flag are transmitted in the first pass (see above: gt1_flag specifies whether the absolute level is greater than 1, and par_flag specifies the parity bit (absolute level - 2), then the partially reconstructed value can be derived according to the following formula. absLevel1 [k] = sig_flag [k] + gt1_flag [k] + par_flag [k], The values of par_flag and gt1_flag, which are not explicitly encoded, are inferred to be equal to 0.
[0215] When gt2_flag is included in the first pass (a variation of Examples 2 and 4), it can be additionally used to derive the minimum possible absolute value. In this case, the partially reconstructed value can be derived according to the following formula. absLevel1[k] = sig_flag[k]+ g1_flag[k] + par_flag[k]+ 2 * gt2_flag[k], The inference for gt2_flag, which is not explicitly encoded, is 0.
[0216] If only sig_flag and par_flag are encoded in the first pass, the partially reconstructed values can be derived using the following formula: absLevel1[k] = sig_flag[k]+ par_flag[k].
[0217] If only sig_flag is encoded in the first pass, the partially reconstructed value can be derived using the following formula: absLevel1[k] = sig_flag[k].
[0218] You can specify partial refactoring for other configurations in a similar way.
[0219] Probabilistic model selection for par_flag, gt1_flag, and gt2_flag Select an adaptive probabilistic model from the set of probabilistic models to encode the current par_flag. Similar to the valid bit flag, let's assume the available probabilistic models are organized in a 4-dimensional array. probModelPar [cPar] [sPar] [dPar] [aPar], Where cPar specifies the index that depends on the current color channel, sPar specifies the index that depends on the state variable, dPar specifies the index that depends on the x and y positions within the transform block, and aPar specifies the index that depends on the local activity metric.
[0220] The same concept is used for gt1_flag and par_flag: probModelGt1 [cGt1] [sGt1] [dGt1] [aGt1], probModelGt2 [cGt2] [sGt2][dGt2] [aGt2] In a preferred embodiment, the same index is used for all three flags: par_flag, gt1_flag, and gt2_flag. The advantage of this is that only the index (or combined index) needs to be computed for each scan index. cGt2 = cGt1 = cPar sGt2 = sGt1 = sPar dGt2 = dGt1 = dPar Gt2 = aGt1 = aPar Even with the same index, different sets of probability models are used for the three flags par-flag, gt1_flag, and gt2_flag. In different implementations, the same set of probability models is used for both gt1_flag and gt2_flag (in this case, gt1_flag and gt2_flag are always encoded using the same probability model for each sample location).
[0221] Different methods can also be used to derive the index of a single flag.
[0222] Below, we describe the derivation of indices cPar, sPar, dPar, and aPar as examples. The same method applies to the corresponding indices of gt1_flag and gt2_flag.
[0223] Color Channel Index cPar Similar to the valid bit flag, in a preferred embodiment, the color channel index cSig is set according to the following steps: cPar = (current channel is luma 0 : 1 ) Alternatively, the alternatives described above for cSig can be used.
[0224] State index sPar In a preferred embodiment, the index sPar is set to 0. This means that the selected probabilistic model does not depend on the state variables. Therefore, the set of probabilistic models can be represented as a 3D array. probModelPar[cPar][dPar][aPar], probModelGt1[cGt1][dGt1][aGt1], probModelGt2 [cGt2] [dGt2][aGt2] Alternatively, a combination of indexes can be used to export the data, which can be derived using three indexes: cPar, dPar, and aPar.
[0225] Alternatively, any of the methods described above for sPar can be used.
[0226] Location index dPar In a preferred embodiment, the index dPar is set as follows: • If index cPar equals 0 (i.e., the current color channel represents the luminance channel), then dPar is set according to the following formula. • If index cPar equals 1 (i.e., the current color channel represents the chroma channel), then dPar is set according to the following formula. Here, `diag` represents the diagonal position given by `diag = x + y`, where `x` and `y` represent the x and y coordinates of the current scan position within the transform block. The Boolean variable `firstNonZero` specifies whether the current scan position represents the first non-zero level scan position in the encoding order (i.e., the position identified by the x and y coordinates (or similar) transmitted after the encoded block flag). Therefore, for the first non-zero level in the encoding order, a different set of probability models (independent of the diagonal position) will be used.
[0227] Alternatively, any other clustering at the diagonal positions is possible. Or alternatively, the (x, y) positions within the transform block can be divided into multiple categories, and the index dPar can be set to be equal to the corresponding category index. Similarly, for such a setup, a specific value of dPar can be used for the first valid scan position.
[0228] Local activity index aPar Finally, in a preferred embodiment of the invention, according to aPar = min(MAX_ABS1_SIG, sumAbs1 − numSig), MAX_ABS1_SIG is a predefined value, sumAbs1 refers to the sum of the smallest absolute transformation coefficient levels in the local template, which is given by the data transmitted in the first pass (see the description above), and numSig specifies the number of non-zero levels in the local template.
[0229] In a preferred embodiment of the invention, the predefined value MAX_ABS1_SIG is set to equal to 4.
[0230] In a preferred embodiment of the present invention, the following was used: Figure 12b The local template shown is an example. Note that the template includes the adjacent positions encoded before the current position. Other local templates with these attributes (scanning / encoding adjacent positions before the current position) can also be used. Such other templates can be used in two ways... Figure 12b The templates shown are different: (1) the number of transformation coefficient positions included and (b) the position of the transformation coefficient positions included.
[0231] Let T(k) specify the set of scan indices within the template used for the current scan index k. The above specifies the variable sumAbs1 for sig_flag(sec.0), and numSig for the current scan index k is obtained according to the following formula. That is, numSig represents the number of non-zero transformation coefficients inside the template (indicated by sig_flag equal to 1).
[0232] Alternatively, different maximum values or different functions can be used for sumAbs1 and numSig.
[0233] Binarization of remainders (excluding coefficients that are completely bypassed) In a preferred embodiment of the invention, the remainder of the syntactic element is encoded in a bypass mode of the arithmetic coding engine. Compression efficiency depends on the binarization used. In HEVC, similar syntactic elements are encoded using a class of binarization codes called Columbus-Less codes. This type of code is parameterized by so-called Less parameters. The Less parameters can be adjusted during encoding so that the binarization used depends on the previous syntactic elements.
[0234] In a preferred embodiment of the present invention, a so-called Columbus-Rice code is used to binarize the syntax element remainder. The Columbus-Rice code consists of a prefix part, and a suffix part if the value to be encoded exceeds a predefined threshold. The prefix part represents a truncated Rice code (see HEVC), and the parameters are parameterized by a Rice parameter (RP) and a maximum symbol value (cMax) parameter. If the value to be encoded (remainder) is greater than or equal to cMax, the suffix binary bit string is added to the prefix binary bit string. The suffix binary bit string is given by an exponential Golomb code of order kEG. To parameterize the concatenated code with a single parameter, the values of cMax and kEG used represent functions of the Rice parameter (RP). In a specific setting, the values of cMax and kEG (the order of the exponential Golomb code) are derived according to the following formula: cMax = ( RP == 1 6 : 7 )<<RP, kEG = RP + 1 Other functional relationships of cMax(RP) and kEG(RP) are also possible. Additionally, other parameterization sets of structured coding can be used.
[0235] Hereinafter, we describe two methods for adjusting the Rice parameter (RP) or similar parameters for different categories of codes: Method 1: If the last encoded value (or the last absolute level) exceeds the threshold, increase RP At the start of a sub-block (or alternatively a transform block), the Rice parameter RP is set equal to a predefined value. In a specific embodiment, the predefined value is equal to 0. After decoding (or encoding) the syntax element remainder, the Rice parameter is updated according to the following formula if( RP<MAX_RP && remainder>Threshold( RP ) ) { RP = RP + 1 } Here, MAX_RP represents a predefined value of the maximum Rice parameter. In a preferred embodiment, MAX_RP is set equal to 3. The function Threshold(RP) represents a threshold depending on the current value of the Rice parameter. In a preferred embodiment, this function is defined by the following formula: Threshold( RP ) = ( 3<<RP ) – 1, where the operator "<< " represents shifting binary bits to the right. That is, "3<<RP" is equivalent to 3 * 2 ^ RP.
[0236] Any other definition of Threshold (RP), such as a lookup table, is possible.
[0237] In a variation of the method, instead of the encoded value remainder, the reconstructed absolute level (absLevel) is used for comparison with a threshold. Then, the Rice parameter is updated according to the following formula. if( RP<MAX_RP && absLevel> Threshold (RP) { RP = RP + 1 } Method 2: Determine RP based on absolute level in local neighborhood In the preferred configuration, the Rice parameter is derived using the absolute sum of adjacent levels covered by the local template. Let sumAbs be the sum of absolute values in the local template. In the preferred embodiment, the same template as the context model used to derive sig_flag is used.
[0238] The Rice parameter RP is derived from sumAbs (i.e., the sum of absolute values in the local template). In a particularly preferred embodiment, the Rice parameter RP is derived according to the following formula: In other configurations, the threshold used to toggle the Rice parameter can be modified. Alternatively, the Rice parameter can be derived based on other activity metrics of the local template. Furthermore, it can be specified that the Rice parameter should not decrease within a sub-block.
[0239] Absolute-level binarization in bypass mode In a preferred embodiment of the invention, different binarizations are used for the absolute level of full encoding in bypass mode (i.e., the fourth pass in embodiments 1 and 2).
[0240] In the preferred configuration, the same Columbus-Rice code category as described above is used, but the Rice parameter is derived in a different manner. In a preferred embodiment of the invention, the Rice parameter depends both on the sum of absolute values in the local neighborhood and on the state variable (used for dependency quantization). The dependency RP(sumAbs, state) can be described by a two-dimensional lookup table. In this case, the sum of absolute values is typically truncated to any maximum value MAX_SUM_ABS before accessing the lookup table. That is, the Rice parameter is derived by the following formula: RP = LookupTable[ state ][ min( MAX_SUM_ABS, sumAbs ) ], LookupTable specifies a predefined lookup table.
[0241] In one variant of this method, the absolute level absLevel is not directly encoded by the code determined by the derived Rice parameter, but is used in the case where the absolute value absLevel is first converted to the value codeValue and then the Columbus-Rice code specified by the Rice parameter RP is transmitted using Golomb.
[0242] As an example, the encoded value codeValue is determined based on the following: The parameter zPos is derived through any of the following methods: • zPos is derived as a function of the sum of the absolute values sumAbs in the local neighborhood; • zPos is derived as a function of the state variables; • Derive zPos from the function of the state variable and the function of the absolute value sumAbs in the local neighborhood.
[0243] The value of sumAbs is the same as the value used when deriving the Rice parameters. The value of sumAbs is also clipped to the same maximum value MAX_SUM_ABS as the Rice parameters are derived. The dependency of zPos on the state variables and / or the clipped value min(MAX_SUM_ABS, sumAbs) can be specified through a predefined lookup table.
[0244] In other words, a variable-length code for encoding / decoding the remainder value at the position of the transform coefficient of the current scan can be selected from a predefined set of variable-length codes, such as the RP being selected from a set different from Columbus-Less codes. The selection can be based on whether the position of the transform coefficient of the current scan to be encoded / decoded is located up to the predetermined transform coefficient position 112 or downstream of it in scan order 62; that is, different RPs can be selected in the former and latter cases. According to methods 1 and 2 outlined above, the RP parameters indicating the selected variable-length code can typically be accessed via 60... 3,4 The quantization index of the transform coefficients that are immediately decoded / encoded and satisfy a predetermined criterion remains constant, but is incrementally changed, such as exceeding a certain limit in Method 1, or changing the quantization index of coefficient positions near the current scan's transform coefficient position that satisfy a certain criterion, such as their sum exceeding a certain limit. For example, this dependent or incremental change can only be used if the current transform coefficient position where the remainder has been encoded is located up to the predetermined transform coefficient position 112, i.e., for Figure 15 The positions of all shaded lines. In addition to the quantization indices of adjacent coefficients, the quantization state can also be used to select binary code parameters.
[0245] The following aspect, although it may be combined with the above embodiments, can optionally be implemented together with the above embodiments to improve coding efficiency. This aspect relates to explicit signaling of blocks / subblocks that do not contain any transform coefficient levels with an absolute value greater than 1.
[0246] To reduce the number of bits used to encode transform coefficient levels, a special flag is introduced on top of the transform block or sub-block to indicate whether any absolute level in the block or sub-block is greater than 1: • For a subblock where coded_subblock_flag equals 1 (encoded or inferred), a second flag will be transmitted for that subblock. This flag (gt1_subblock_flag) specifies whether the subblock contains any transform coefficient levels with an absolute level greater than 1.
[0247] • If gt1_subblock_flag equals 0, then only the valid bit information (sig_flag) and the sign bit used for transform coefficient levels that are not equal to 0 are transmitted.
[0248] • If gt1_subblock_flag equals 1, then the transformation coefficient level encoding is performed as described in Examples 1 to 4. A further condition may be included: when the last scan index in the subblock is reached and all previous absolute levels in the subblock are equal to 1, it can be inferred that the last absolute level is greater than 1. – Therefore, the corresponding gt1_flag can be inferred to be equal to 1. For Examples 1 and 3, in this case, the parity flag par_flag can also be inferred to be equal to 0.
[0249] The flag specifying all levels with absolute values equal to 1 can be transmitted for the entire transform block, not just based on sub-blocks. It is also possible to transmit this flag only for selected sub-blocks (e.g., sub-blocks that include the first effective bit coefficients).
[0250] That is, here the transform coefficient block 10 is encoded / decoded in the following manner. For each of at least one set of sub-blocks 14 into which the transform coefficient block 10 is divided, a sub-block size flag, i.e., gt1_subblock_flag, indicating whether the corresponding sub-block 14 contains any transform coefficient 12 whose absolute value of the quantization coefficient is greater than a predetermined non-zero threshold, such as a threshold, is transmitted. For the transform coefficients of the transform coefficient block within each sub-block 14, where the sub-block size flag indicates that at least one transform coefficient in each sub-block 14 has an absolute value of the quantization index greater than the predetermined non-zero threshold, as described above, they are encoded / decoded, i.e., by sequentially encoding / decoding each transform coefficient within the corresponding sub-block, a series of one or more flags 92, 96, 98, 194, or other flags recursively bisect the value range of the corresponding transform coefficient into two partitions, indicating which partition the quantization index of the corresponding transform coefficient is located in, and immediately stopping decoding when the value range contains only one value, or if the value range is interpreted only as defined signed values, then they are equal in an absolute sense. If the value range still includes more than one value that is absolutely different, then the remainder of the absolute value of the quantization index representing each transform coefficient in the value range is encoded / decoded. However, within each sub-block, the sub-block size flag indicates that there are no transform coefficients in each sub-block whose absolute value of the quantization coefficient is greater than a predetermined non-zero threshold. The sequential decoding of the sequence of one or more flags for each transform coefficient within the corresponding sub-block stops immediately when the value range includes a value not exceeding the non-zero threshold, only one value, or values that are absolutely equal. The first stopping criterion stems from the fact that, based on the fact that the indices of all coefficients in the corresponding sub-block do not exceed the predetermined non-zero threshold, once the remaining value range or remaining value interval determined by the previously encoded / decoded flags for each coefficient includes only one value that satisfies the requirement of the sub-block size flag, then this value in the value range is the quantization index.
[0251] Therefore, among other things, the following embodiments are also described above.
[0252] A1. An apparatus for decoding a block of transform coefficients, the apparatus being configured to decode from a data stream, in a sequence of passes scanning the positions of the transform coefficients of the block in a scanning order, ( Please note these times This step does not require scanning the transform coefficient positions of all transform blocks, but they all use the scan order; in addition, certain flag types Flags can be transmitted in the same pass.Using context-adaptive binary arithmetic decoding, decode 1) flags, each flag coming from a set having one or more flag types (e.g., Example 1: sig_flag, par_flag, gt1_flag, gt2_flag), and using variable-length codes (e.g., using compression ratio 1; transmitted in bypass mode; as mentioned above, the VLC codeword bits may be encoded using an arithmetic coding engine, but instead of using context-adaptive decoding, this is done using (0.5; 0.5) Probabilistic bypass mode to complete – representing binaryization and non-adaptive binary arithmetic decoding or using a bypass mode with a unified probability model for these VCL bits respectively) Decoding 2) Remainder value (remainder), such that for the transform coefficient position of the current scan, each flag and each remainder (e.g., Example 1: index k) is decoded, such that for each transform coefficient position of the encoded set of transform coefficient positions (e.g., extending between a predefined first transform coefficient position and a predefined last transform coefficient position, where the predefined first and last transform coefficient positions specify a subset of transform coefficient positions in the transform block; or, e.g., extending between the last non-zero coefficient and a predefined coefficient, such as a DC coefficient), at least one of one or more flags and a remainder value is sequentially decoded (i.e., a remainder, no flag, one or more flags and a remainder, or one or more flags, no remainder) so that the absolute value of the quantization index for the transform coefficient position of the current scan lies within the initial value range (e.g., x bits represent) continuously (i.e., in a sequential sense) within which the absolute value of the quantization index for the transform coefficient position of the current scan is located. Ω = 0 arrive 2 x -1; for example, x = 16 The domain is restricted to include only the absolute value of the quantization index for the transform coefficient position used in the current scan (i.e., "at least one of one or more flags and a remainder value" uniquely defines the latter outside the initial domain for decoding a given transform coefficient position), where each flag restricts the domain of the absolute value of the quantization index for the transform coefficient position used in the current scan to a first sub-part or a second sub-part that is bisected (e.g., sig_flag: the domain Ω is divided into A = {0} and...). Then, par_flag will (Limited to odd or even numbers...), and, in the case where the remainder is decoded for the transform coefficient position of the current scan, the remainder uniquely indicates (the following two options should be understood as: covering all embodiments, including embodiment 1, where only the remainder is encoded for some transform coefficient positions, and embodiment 3, where such transform coefficient positions do not exist) the absolute value of the quantization index for the transform coefficient position of the current scan in the value domain in the case where at least one flag has been decoded for the transform coefficient position of the current scan, or the absolute value of the quantization index for the transform coefficient position of the current scan in the initial value domain in the case where no flag has been decoded for the transform coefficient position of the current scan (note that for transform coefficient positions where the remainder is not decoded, decoding one or more flags for these transform coefficient positions has already limited the value domain to contain only one absolute value; in terms of symbols, if the TC is fully tagged, it can be encoded separately in bypass mode), wherein, the The apparatus is configured (e.g., embodiments 1 to 4) to perform the following: 1) using the quantization index of the set of transform coefficient positions encoded by dequantizing (i.e., using dependent quantization) sequentially along the scan order (see, for example, a mesh diagram) of the state transitions (see mesh diagram), 1) selecting a set of reconstructing levels from a set of multiple reconstructing levels, uniquely based on the state taken by the state transition to the current transform coefficient position, and performing dequantization to index the quantization index onto the reconstructing level, where the quantization index points to the set of reconstructing levels, and 2) updating the state of the state transition taken by the current transform coefficient position (note that this is the position of the current scan during dependent quantization; "current scan" is used to indicate the content currently decoded in the pass, for (note that this term now indicates the intended purpose or effect of the update) the transform coefficient position after the current transform coefficient in the scan order depends on the quantization index of the current transform coefficient position).
[0253] A2. The apparatus of any one of embodiments B5 or A1 is configured to perform state transition transitions between four different states.
[0254] A3. The apparatus of any of the embodiments B5 or A1-A2 is configured to perform an update during a state transition by deciding between a first successor state and a second successor state based on a binary function of the quantization index applied to the current transform coefficient position, wherein the first successor state and the second successor state depend on the state of the current transform coefficient position.
[0255] A4. The apparatus according to any one of embodiments B5 or A1-A3, wherein the binary function generates a parity bit or a zero bit.
[0256] A5. An apparatus of any one of embodiments B5 or A1-A4 is configured to parameterize a plurality of sets of reconstruction levels by a predetermined quantization step size and to obtain information about the predetermined quantization step size from a data stream.
[0257] A6. The apparatus according to any one of embodiments B5 or A1-A5, wherein each of the plurality of reconstruction level sets consists of a multiple of a predetermined quantization step size, the predetermined quantization step size being constant for the plurality of reconstruction level sets.
[0258] A7. The apparatus according to any one of embodiments B5 or A1-A6, wherein the plurality of quantization level sets comprises two quantization level sets, and the plurality of quantization level sets comprises a first quantization level set, the first quantization level set comprising zero and even multiples of a predetermined quantization step size, and a second quantization level set, the second quantization level set comprising zero and odd multiples of the predetermined quantization step size.
[0259] A8. An apparatus of any one of the foregoing embodiments A1-A7, wherein, in the first pass of the pass sequence, the decoder is configured (e.g., embodiments 3 and 4) to 1) decode (e.g., sig_flag) and a flag of a predetermined second flag type (e.g., par_flag) from a data stream flag of a predetermined first flag type in a certain manner, such that, before the flag restricting the range of the absolute value of the quantization index following the first transform coefficient position in the scan order, the flag restricting the range of the absolute value of the quantization index of the first transform coefficient position is decoded (i.e., before any sig_flag [k] and par_flag [k + 1]). [k]), wherein, the decoding of a flag of a predetermined second flag type is performed until a predetermined transform coefficient position (e.g., Example 3: startIdxBypass-1), wherein a predetermined abort criterion is filled for the first time along the scan order in the first pass (e.g., the number of encoded flags in the first pass exceeds a certain threshold), and the decoding of a flag of a predetermined first flag type is performed outside the predetermined transform coefficient position in the scan order (e.g., for all flags in the encoded set or except the first non-zero quantization index without investigating any abort criterion), wherein the flag of the predetermined first flag type indicates whether the quantization index of the transform coefficient of the current scan is zero (e.g., sig_flag).
[0260] A9. In the apparatus of embodiment A8, wherein the flag of the predetermined second flag type indicates the parity of the quantization index for the transform coefficients of the current scan.
[0261] A10. The apparatus of any of the foregoing embodiments A8-A9 is configured to decode a flag of the second predetermined flag type in the first pass specifically for the position of the transform coefficient, thereafter, a flag of the first predetermined flag type indicating that the quantization index of the transform coefficient of the currently scanned transform coefficient is not zero.
[0262] A11. The apparatus of embodiment A8, wherein the predetermined abort criterion is related to whether the number of flags decoded in the first pass exceeds a predetermined threshold.
[0263] A12. The apparatus of any one of the foregoing embodiments A8 to A11 is configured to decode, in the first pass, a flag having a third predetermined flag type, the third predetermined flag type indicating whether the taken value is the minimum value in the range of the transform coefficient position for the current scan according to absolute value.
[0264] A13. The apparatus of embodiment A12 is configured to decode a flag of the third predetermined flag type in the first pass, the flag of the third predetermined flag type being specifically for transform coefficient positions, wherein, after the transform coefficient positions, a flag of the first predetermined flag type indicates that the quantization index of the transform coefficient of the currently scanned transform coefficient is not zero.
[0265] A14. The apparatus of embodiment A13 (e.g., embodiment 3) is configured to decode the transform coefficient position in a first pass, wherein, for the transform coefficient position, after a first predetermined flag type, a flag of the first predetermined flag type indicates that the quantization index for the transform coefficient position for the current scan is not zero, and a flag of a third predetermined flag type follows a flag of a second predetermined flag type.
[0266] A15. The apparatus of embodiment A13 (e.g., embodiment 4) is configured to decode the transform coefficient position in the first pass, wherein, after the first predetermined flag type, a flag of the first predetermined flag type indicates that the quantization index for the currently scanned transform coefficient position is not zero, a flag of the second predetermined flag type is specifically for the transform coefficient position, and a flag of the third predetermined flag type indicates that the value is at most greater than 1.
[0267] A16. The apparatus of any of the foregoing embodiments A8 to A15 is configured to decode in a second pass after the first pass, wherein a flag of a fourth predetermined flag type also indicates a quantization index for the position of the transform coefficients used for the current scan, the position of the transform coefficients of the current scan being taken as the minimum value in the absolute value range or not limited by the flag decoded in the first pass.
[0268] A17. The apparatus of embodiment A16 is configured to decode the remainder value in one or more additional passes after the second pass.
[0269] A18. The apparatus of any one of the foregoing embodiments A8 to A17 is configured to decode the remainder value in one or more iterations after the first iteration.
[0270] A19. The apparatus of any one of the foregoing embodiments A8-A18 is configured to decode the symbols of the non-zero transform coefficients in the final pass.
[0271] A20. An apparatus of any one of the preceding embodiments A8 to A19, wherein the decoder is configured (e.g., embodiment 3, second alternative "2. The state machine switches from a parity bit-driven state machine to a valid bit-driven state machine") 1) In a state transition, the state of the state transition is updated according to the following: – If the current transform coefficient position is before or equal to a predetermined transform coefficient position in the scan order, for the corresponding transform coefficient position – on the flag of the second flag type of the corresponding transform coefficient position (e.g., embodiment 3: par_flag) – If the corresponding transform coefficient position follows the predetermined transform coefficient position in the scan order, for the corresponding transform coefficient position – on the flag of the first flag type of the corresponding transform coefficient position (e.g., embodiment 3: path (level) produces zero), 2) In context-adaptive entropy decoding, a context for decoding the flag of the predetermined first flag type is determined for the currently scanned transform coefficient, for all transform coefficient positions before, including and after the predetermined transform coefficient position, depending on the state taken by the state transition to the currently scanned transform coefficient position.
[0272] A21. The apparatus of any one of the foregoing embodiments A8 to A19, wherein the decoder is configured (e.g., embodiment 3) in context-adaptive entropy decoding, for the transform coefficient position of the currently scanned, to determine the context for decoding a flag of a predetermined first flag type, wherein for transform coefficient positions preceding and including the predetermined transform coefficient position, the state taken by the state transition for the transform coefficient position of the currently scanned depends on the state taken by the state transition for the transform coefficient position, and for transform coefficient positions following the predetermined transform coefficient position, the state taken by the state transition for the transform coefficient position of the currently scanned is independent of the state taken by the state transition for the transform coefficient position.
[0273] A22. An apparatus of any one of the preceding embodiments A8 to A19, wherein the decoder is configured (e.g., embodiment 3, first alternative) to: 1) in context-adaptive entropy decoding, determine a context for decoding a flag of a predetermined first flag type for the transform coefficient position of the current scan, depending on the state taken by the state transition for the transform coefficient position of the current scan, for all transform coefficient positions before, including and after the predetermined transform coefficient position; 2) in the state transition, update the state of the state transition taken for the current transform coefficient position for each transform coefficient position after the first flag type of the current transform coefficient position in the scan sequence (e.g., embodiment 3: path (level) generates zero).
[0274] B1. An apparatus for decoding a block of transform coefficients, configured to decode from a data stream and scan a sequence of passes of transform coefficient positions in scan order (note that these passes do not need to scan all transform coefficient positions of the transform block, but they all use scan order; furthermore, flags of certain flag types can be transmitted in the same pass), 1) using context-adaptive binary arithmetic decoding, where each flag is not in a set of one or more flag types (e.g., Example 1: sig_flag, par_flag, gt1_flag, gt2_flag) and 2) using variable-length code (e.g., using compression ratio 1; transmitted in bypass mode; also used for annotation A1), and a remainder value (remainder). Therefore, each flag and each remainder value is decoded separately for the transform coefficient position of the current scan (e.g., Example 1: index k), and for each transform coefficient position in the set of encoded transform coefficient positions (e.g., expanding between a predefined first transform coefficient position and a predefined last transform coefficient position, where the predefined first and last transform coefficient positions specify a subset of transform coefficient positions in the transform block; or, for example, expanding between the last non-zero coefficient and predefined coefficients, such as DC coefficients), at least one of one or more flags and a remainder value (i.e., a remainder and no flag, one or more flags and a remainder, or one or more flags and no remainder) is decoded sequentially so that the initial value range (e.g., x binary bits representing Ω = 0 to...) is continuously (i.e., in a sequential sense) restricted. 2 x -1For example, x = 16) where the absolute value of the quantization index for the transform coefficient position of the current scan includes only the absolute value of the quantization index of the transform coefficient position of the previous scan within the value range (i.e., "at least one of one or more flags and a remainder value" for decoding a certain transform coefficient position uniquely defines the latter outside the initial value range), where each flag restricts the value range of the absolute value of the quantization index for the transform coefficient position of the current scan to either a first sub-part or a second sub-part, where the value range of the absolute value of the quantization index for the transform coefficient position of the current scan is bisected (e.g., sig_flag: the value range Ω is divided into A = {0} and Then, par_flag will (Limited to odd or even values...), and, if the remainder is decoded for the transform coefficient position of the current scan, the remainder uniquely indicates (the following two options should be understood as: covering all embodiments, including embodiment 1, where only the remainder is encoded for some transform coefficient positions, and embodiment 3, where such transform coefficient positions do not exist). If at least one flag is decoded for the transform coefficient position of the current scan, the absolute value of the quantization index for the transform coefficient position of the current scan is out of range. If no flag is decoded for the transform coefficient position of the current scan, the transform coefficient position of the current scan is out of the initial range (note that for transform coefficient positions where the remainder is not decoded, decoding one or more flags for these transform coefficient positions has already limited the range to contain only one absolute value; in terms of symbols, if the TC is fully tagged, it can be encoded separately in bypass mode), wherein the apparatus is configured For example, in the first pass of the pass sequence (e.g., Examples 1 and 2), a) from the data stream flag of a predetermined first flag type up to the predetermined transform coefficient position (e.g., in Example 1: the one indexed by startIdxBypass-1), in its first pass, the predetermined abort criterion along the scan order is satisfied for the first time (e.g., in Example 1: the predetermined number of flags has been decoded in the first pass), the flag of the predetermined first flag type indicates whether the quantization index of the transform coefficient position for the current scan is zero (e.g., sig_flag), b) the flag is decoded only for transform coefficient positions located before and including the predetermined transform coefficient position, and the set of codes for each transform coefficient position after the predetermined transform coefficient position is decoded in the scan order such that one of the remaining values uniquely represents the absolute value of the quantization index of the corresponding transform coefficient position outside the initial value domain.
[0275] B2. The apparatus of embodiment B1 is configured to parameterize a variable-length code for decoding the remainder value of the transform coefficient position of the current scan, depending on whether the transform coefficient position of the current scan is before, after, or following the predetermined transform coefficient position in the scan sequence.
[0276] B3. The apparatus of embodiment B1 or B2 is configured to parameterize a variable-length code, the variable-length code being used to incrementally change the remainder value of the decoded current decoded coefficient position by means of the quantization index of the previous transform coefficient position satisfying a predetermined criterion, and / or depending on the quantization index of the transform coefficient position near the currently scanned transform coefficient position if the currently scanned transform coefficient position is earlier (in scan order) or a predetermined transform coefficient position.
[0277] B4. The apparatus of embodiment B1, B2 or B3 is configured to parameterize a variable-length code, which is used to decode the remainder value of the transform coefficient position of the current scan based on the quantization index of the transform coefficient position near the currently scanned transform coefficient position, depending on the state taken when the state transitions to the transform coefficient position of the current scan if the currently scanned transform coefficient position follows a predetermined transform coefficient position in the scanning order.
[0278] B5. An apparatus of any one of embodiments B1 to B4, wherein the decoder is configured (e.g., embodiments 1 to 4) to sequentially quantize (i.e., use dependent quantization) the quantization index of the set of encoded dequantized transform coefficient positions using state transitions (e.g., see trellis diagram), by the following steps: a) for the current transform coefficient position, uniquely selecting a set of reconstruction levels from a plurality of reconstruction levels based on the state transition to the state taken by the current transform coefficient position, and dequantizing the quantization index to the reconstruction level, on which the quantization index points to the set of reconstruction levels, and by b) updating the transition state to the state taken by the current transform coefficient position (note that this is what is currently scanned during dependent quantization; "currently scanned" is used to indicate what is currently decoded in the pass (note that this term now indicates the intended purpose or effect of the update), depending on the quantization index for the current transform coefficient position, used for the transform coefficient positions in scan order after the current transform coefficient position.
[0279] 3. The apparatus of any one of embodiments A1-A22 or B1-B5 is configured (e.g., embodiments 1 to 4) to perform decoding such that for each of a set of one or more flag types, the flag of the respective flag type is decoded in one of the permutation sequences.
[0280] 4. The apparatus of any of the foregoing embodiments (e.g., embodiments 1-4, section 4.5.4), wherein the variable-length code is Columbus-Rice code.
[0281] 5. The apparatus according to any one of the foregoing embodiments, wherein (e.g., embodiments 1 to 4, methods 1 and 2 in 4.5.4), the apparatus is configured to parameterize a variable-length code, the variable-length code being used to incrementally change, by means of a quantization index of a previous transform coefficient position satisfying a predetermined criterion, to decode the remainder of the transform coefficient position of the currently scanned transform coefficient position, and / or depending on the quantization index of the transform coefficient position near the transform coefficient position of the currently scanned transform coefficient position.
[0282] 6. The apparatus of any of the foregoing embodiments is configured (e.g., embodiments 1 to 4) to determine the set of codes for the transform coefficient positions extending along the scan sequence between the position of the first non-zero quantization index and a predefined transform coefficient position, and to locate the position of the first non-zero quantization index based on the data stream.
[0283] 7. The apparatus of any of the foregoing embodiments is configured (e.g., embodiments 1 to 4) to decode sign bits from the data stream of each non-zero quantization index using an equal probability bypass mode.
[0284] 10. The apparatus according to any one of the foregoing embodiments is configured to decode a flag of a first flag type for a predetermined transform coefficient position by using context-adaptive entropy decoding and selecting a context based on the coefficient position of a predetermined transform coefficient.
[0285] 11. The apparatus according to any one of the foregoing embodiments is configured to decode a flag of the first predetermined flag type for a predetermined transform coefficient position by means of context-adaptive entropy decoding: a) decoding a set of flags prior to the flag of the predetermined flag type for the predetermined transform coefficient position based on a set of adjacent transform coefficient positions within a local template around the predetermined transform coefficient position, and b) selecting a context based on local activity.
[0286] 12. The apparatus according to embodiment 11, wherein the set of flags includes (at least; it may also include more, such as four) flags of a predetermined first flag type, flags of a predetermined second flag type, and flags of a predetermined third flag type decoded for the set of adjacent transform coefficient positions, and the apparatus is configured to calculate activity based on the sum of addends for each adjacent transform coefficient position, the addends indicating the minimum absolute value or minimum absolute reconstruction level of the quantization index of adjacent transform coefficient positions determined according to (at least) the flags of the predetermined first flag type, the flags of the predetermined second flag type, and the flags of the predetermined third flag type decoded for adjacent transform coefficient positions.
[0287] 13. According to any one of the preceding embodiments, the decoder is configured (e.g., embodiments 1 to 4) to 1) sequentially dequantize (i.e., using dependent quantization) the quantization index of the transform coefficient position of the encoded set of the transform coefficient position, using state transitions along the scan order (e.g., see the mesh diagram), by the following steps: a) uniquely selecting a set of reconstruction levels from a plurality of reconstruction levels for each transform coefficient position based on the state transition to the state taken by the corresponding transform coefficient position, and then dequantizing the quantization index to the reconstruction level, on which the quantization index points to the set of reconstruction levels, and by b) updating the transition state to the state taken by the current transform coefficient position (note that this is one currently scanned during dependent quantization; "one currently scanned" is used to indicate one currently decoded during the pass) (note that this term now indicates the intended purpose or effect of the update) for transform coefficient positions after the current transform coefficient in the scan order, depending on the quantization index of the current transform coefficient, 2) decoding a flag of a first predetermined flag type for the predetermined transform coefficient position by using context-adaptive entropy decoding, by selecting a context based on the state transition to the state taken by the predetermined transform coefficient position, and / or a set of quantization levels selected for the predetermined transform coefficient position.
[0288] 20. The apparatus according to any of the foregoing embodiments is configured to use context-adaptive entropy decoding to decode a flag of a second flag type for a predetermined transform coefficient position by selecting a context based on the coefficient position of a predetermined transform coefficient.
[0289] 21. The apparatus according to any one of the foregoing embodiments is configured to use context-adaptive entropy decoding to decode a flag of a second predetermined flag type for a predetermined transform coefficient position, by 1) determining local activity and / or the number of transform coefficient positions in the local template near the predetermined transform coefficient position, wherein the quantization index is not zero, for a set of flags previously decoded based on the second predetermined flag type for a set of adjacent transform coefficient positions in a local template around the predetermined transform coefficient position, wherein the quantization index is not zero, and by 2) selecting a context that depends on the local activity and / or the number of non-zero quantization indices.
[0290] 22. The apparatus according to embodiment 21 is configured to select the context based on the difference between the local activity and the number of non-zero quantization indices.
[0291] 23. The apparatus according to embodiment 20 or 21, wherein the set of flags includes (e.g., encoded in a first scan pass as in embodiment 12) flags of a predetermined first flag type, flags of a predetermined second flag type, and flags of a predetermined third flag type decoded for the set of adjacent transform coefficient positions, and the apparatus is configured to calculate activity based on the sum of addends for each adjacent transform coefficient position, the addend indicating the minimum absolute value or minimum absolute quantization index of the quantization index of adjacent transform coefficient positions determined according to (note that if more flags are transmitted in the first pass, more of the following flags may be used) flags of the predetermined first flag type, flags of the predetermined second flag type, and flags of the predetermined third flag type decoded for adjacent transform coefficient positions.
[0292] 30. The apparatus according to any one of the foregoing embodiments is configured to decode a flag of a third predetermined flag type for a predetermined transform coefficient position by using context-adaptive entropy decoding and selecting a context based on the coefficient position of a predetermined transform coefficient.
[0293] 31. The apparatus of any of the foregoing embodiments is configured to use context-adaptive entropy decoding to decode a flag of a third predetermined flag type for a predetermined transform coefficient position by 1) determining local activity and / or the number of transform coefficient positions in the local template near the predetermined transform coefficient position based on a set of flags previously decoded for a set of adjacent transform coefficient positions in a local template surrounding the predetermined transform coefficient position, wherein the quantization index is not zero, and by 2) selecting a context based on local activity and / or the number of non-zero quantization indices.
[0294] 32. The apparatus according to embodiment 31 is configured to select a context based on the difference between local activity and the number of non-zero quantization indices.
[0295] 33. The apparatus according to embodiment 30 or 31, wherein the set of flags includes (see notes on embodiments 12 and 23) flags of a predetermined first flag type, flags of a predetermined second flag type, and flags of a predetermined third flag type decoded for the set of adjacent transform coefficient positions, and the apparatus is configured to calculate activity based on the sum of addends for each adjacent transform coefficient position, the addends indicating the minimum absolute value or minimum absolute quantization index of the quantization index of adjacent transform coefficient positions determined according to (see notes on embodiments 12 and 23) the flags of the predetermined first flag type, the flags of the predetermined second flag type, and the flags of the predetermined third flag type decoded for adjacent transform coefficient positions.
[0296] C1. A decoder for decoding a block of transform coefficients, configured to: 1) decode each of the sets of sub-blocks into which the transform coefficient block is divided, wherein a sub-block size flag indicates whether the corresponding sub-block contains the absolute value of the quantization index of any transform coefficient, where the quantization index is greater than a predetermined non-zero threshold; 2) decode the transform coefficients of the transform coefficient block within each sub-block, wherein in each sub-block, a sub-block size flag indicates that the absolute value of the quantization index of at least one transform coefficient in each sub-block is greater than a predetermined non-zero threshold; (a) recursively divide the value range of the corresponding transform coefficient into two partitions by sequentially decoding each transform coefficient within each sub-block, a sequence of one or more flags, and indicating the absolute value of the quantization index of the corresponding transform coefficient. The quantization index is located in which of the two partitions, and the decoding sequence stops when the value range includes only one or more values that are absolutely equal in an absolute sense. If the value range still includes more than one value that is absolutely different in an absolute sense, the remainder value represents the absolute value of the quantization index of each transform coefficient in the value range. In each sub-block, the sub-block size flag indicates that there are no transform coefficients in the sub-block whose absolute value of the quantization coefficient is greater than a predetermined non-zero threshold. b) By sequentially decoding each transform coefficient in each sub-block, a sequence of one or more flags, the decoding sequence stops immediately once the value range includes only one value that does not exceed the non-zero threshold, only one value, or a value that is absolutely equal in an absolute sense.
[0297] C2. The apparatus of embodiment C1, wherein the first flag in the sequence of flags is a valid bit flag, which indicates whether the transform coefficients for decoding the first flag are zero.
[0298] C3. The apparatus of embodiment C2, wherein a predetermined non-zero threshold is 1, and the apparatus is configured to, within each sub-block, wherein a sub-block size flag indicates that there are no transform coefficients in the sub-block whose absolute value of the quantization coefficient is greater than 1, sequentially decode a first flag for each transform coefficient within each sub-block.
[0299] C4. The apparatus of any of the preceding embodiments C1-C3 is configured to: 1) decode each sub-block in a set of at least another sub-blocks into which the transform coefficient block is divided, wherein another sub-block size flag indicates whether the corresponding sub-block contains any transform coefficients that are not equal to zero; and 2) determine a set of sub-blocks, wherein the sub-block size flag is decoded to include the sub-block, wherein another sub-block size flag of the sub-block indicates that the sub-block contains at least one transform coefficient that is not equal to zero; and 3) infer the transform coefficients of the transform coefficient block in each sub-block, wherein another sub-block size flag indicates that the sub-block does not contain any non-zero transform coefficients and is all zero.
[0300] In the above description, the concept of entropy coding at the quantization and transform coefficient levels (quantization index) for block-based hybrid video coding was proposed. The techniques outlined above can be applied to lossy coding of residual sample blocks. Residual samples can represent the difference between the original sample block and the sample of the predicted signal (which can be obtained through intra-image prediction, inter-image prediction, or a combination of intra-image and inter-image prediction, or any other method; in special cases, the predicted signal can be set to zero).
[0301] The residual blocks of the samples can be transformed using signal transforms. Typically, linear and separable transforms are used (linear means the transform is linear, but additional rounding of the transform coefficients can be incorporated). Integer approximations of DCT-II or other transforms from the DCT / DST series are commonly used. Different transforms can be used in the horizontal or vertical directions. The transform is not limited to linear and separable transforms. Any other transform (linear and non-separable or non-linear) can be used. As a result of the signal transform, a transform coefficient block is obtained, representing the original block of residual samples in different signal spaces. In special cases, the transform can be equal to the recognition transform (i.e., the transform coefficient block can be equal to the block of residual samples). The transform coefficient block is encoded using lossy coding. On the decoder side, the reconstructed transform coefficient block is inversely transformed to obtain a reconstructed block of residual samples. Finally, by adding a prediction signal, a reconstructed block of the image samples is obtained.
[0302] In particular, lossy coding suitable for transform coefficient blocks is employed in the above embodiments in the following aspects: • Dependence of transform coefficients on scalar quantization: On the encoder side, transform coefficient blocks are mapped to blocks of transform coefficient levels (i.e., quantization indices), representing transform coefficients with reduced fidelity. On the decoder side, quantization indices are mapped to reconstructed transform coefficients (different from the original transform coefficients due to quantization). Unlike regular scalar quantization, transform coefficients are not quantized independently. Instead, the set of permissible reconstructible levels for a given transform coefficient depends on the quantization indices chosen for the other transform coefficients.
[0303] • Entropy encoding at the transform coefficient level (quantization index): Binary arithmetic coding is used to entropy code the transform coefficient level (used for dependent scalar quantization) representing the reconstructed transform coefficients. In this case, the property of dependent quantization is utilized to improve the efficiency of entropy coding.
[0304] Different embodiments and aspects have been described above. Explanations relate to various aspects, such as flag / remainder representation, the distribution of flags and remainders over iterations, context derivation, limitations of context-adaptive encoding flags, and so on. These aspects, features, functions, and details described in different sections may optionally be incorporated individually or together into the embodiments described herein.
[0305] Furthermore, the embodiments described herein can be used alone and can be supplemented by any features, functions, and details in another chapter.
[0306] Additionally, it should be noted that the various aspects described herein can be used individually or in combination. Therefore, details can be added to each of the stated aspects without needing to add details to another of the plurality of aspects.
[0307] In particular, embodiments are also described in the claims. The embodiments described in the claims may optionally be supplemented by any features, functions, and details set forth herein, either individually or in combination.
[0308] It should also be noted that this disclosure explicitly or implicitly describes features that can be used in a video encoder (an apparatus for providing an coded representation of an input video signal) and a video decoder (an apparatus for providing a decoded representation of a video signal based on the coded representation of the video signal). Therefore, any feature described herein can be used in the context of a video encoder and in the context of a video decoder.
[0309] Furthermore, the features and functions disclosed herein related to the method can also be used in the apparatus (configured to perform such functions). Additionally, any features and functions disclosed herein regarding the apparatus can also be used in the corresponding method. In other words, the method disclosed herein can be supplemented by any features and functions described regarding the apparatus.
[0310] Additionally, as will be described in the “Implementing Alternatives” section, any features and functions described herein may be implemented in hardware or software, or a combination of hardware and software.
[0311] Although some aspects have been described in the context of the apparatus, it is clear that these aspects also represent a description of the corresponding method, where blocks or devices correspond to method steps or features of method steps. Similarly, aspects described in the context of method steps also represent a description of corresponding blocks or items or features of the corresponding apparatus. Some or all of the method steps may be executed by (or using) hardware devices, such as microprocessors, programmable computers, or electronic circuits. In some embodiments, one or more of the most important method steps may be executed by such devices.
[0312] Depending on certain implementation requirements, embodiments of the present invention can be implemented in hardware or software. This implementation can be performed using a digital storage medium having electronically readable control signals stored, such as a floppy disk, DVD, Blu-ray, CD, ROM, PROM, EPROM, EEPROM, or FLASH memory, which works with (or is capable of working with) a programmable computer system to execute the corresponding methods. Therefore, the digital storage medium can be computer-readable.
[0313] Some embodiments of the invention include a data carrier having electronically readable control signals, which is capable of cooperating with a programmable computer system to perform one of the methods described herein.
[0314] Typically, embodiments of the present invention can be implemented as a computer program product having program code that, when run on a computer, can be used to perform a method. The program code can, for example, be stored on a machine-readable medium.
[0315] Other embodiments include a computer program stored on a machine-readable medium for performing one of the methods described herein.
[0316] In other words, therefore, an embodiment of the method of the present invention is a computer program having program code for performing one of the method operations described herein when the computer program is run on a computer.
[0317] Therefore, a further embodiment of the method of the present invention is a data carrier (or digital storage medium, or computer-readable medium) comprising a computer program recorded thereon for performing one of the methods described herein. The data carrier, digital storage medium, or recorded medium is typically tangible and / or non-transitional.
[0318] Therefore, a further embodiment of the method of the present invention represents a sequence of data streams or signals for performing one of the methods described herein. The sequence of data streams or signals may, for example, be configured to be transmitted via a data communication connection, such as via the Internet.
[0319] Further embodiments include processing means, such as a computer or programmable logic device, configured or adapted to perform one of the methods described herein.
[0320] Further embodiments include a computer on which a computer program is installed for performing one of the methods described herein.
[0321] Further embodiments of the invention include an apparatus or system configured (e.g., electronically or optically) to transmit a computer program for performing one of the methods described herein to a receiver. The receiver may be, for example, a computer, a mobile device, a storage device, etc. The apparatus or system may, for example, include a file server for transmitting the computer program to the receiver.
[0322] In some embodiments, a programmable logic device (e.g., a field-programmable gate array) may be used to perform some or all of the functions of the methods described herein. In some embodiments, the field-programmable gate array may cooperate with a microprocessor to perform one of the methods described herein. Generally, the method is preferably performed by any hardware device.
[0323] The apparatus described herein can be implemented using hardware devices, a computer, or a combination of hardware devices and a computer.
[0324] The apparatus described herein, or any component thereof, may be implemented, at least in part, in hardware and / or software.
[0325] The methods described herein can be performed using hardware devices, computers, or a combination of hardware devices and computers.
[0326] The methods or any components of the apparatus described herein may be performed, at least in part, by hardware and / or software.
[0327] The embodiments described above are merely illustrative of the principles of the invention. It should be understood that modifications and variations to the arrangements and details described herein will be readily apparent to those skilled in the art. Therefore, the intent of the invention is limited only by the scope of the forthcoming patent claims, and not by the specific details given in the description and explanation of the embodiments herein.
Claims
1. A method for decoding an image from a data stream, the method comprising: Identify the number of available context-coded binary bits used to decode the transform block representing a portion of the image; During the decoding process at at least one position, each position corresponds to a transform coefficient in a sub-block of the transform block, proceeding from the starting position along a scan order that sequentially traverses at least one position: Decode at least one context encoding flag at the current position within the sub-block. In response to decoding each of at least one context encoding flag, update the number of available context encoding bits. After decoding all context-coded flags associated with the current position and before moving to the next position immediately following the current position in the scan order, the updated number of available context-coded bits is compared with a predefined value, and The decoding process is terminated based on a comparison showing that the number of available context-encoded binary bits after the update is less than a predefined value. and After the decoding process is terminated and during at least one additional decoding process, for each position from the subsequent position to the end position within the sub-block along the scan sequence: The Rice parameter is derived based on the sum of the absolute levels associated with at least one transform coefficient adjacent to the current transform coefficient at the corresponding position. Decode the remainder value using Golomb Rice code with Rice parameter. The zero-position value zPos is derived at least in part based on the sum of absolute levels, and The absolute level associated with the current transform coefficient at the corresponding position is determined in part based on the zero position value zPos and the remainder value.
2. The method of claim 1, wherein the local template specifies at least one transform coefficient adjacent to the current transform coefficient.
3. The method according to claim 1, wherein deriving the zero position value zPos comprises: Determine the state variables; as well as The zero position value zPos is derived from the sum of the absolute level and the state variables.
4. The method of claim 1, wherein determining the absolute level comprises comparing the remainder value and the zero position value zPos, wherein: In response to a comparison indicating that the remainder value is equal to the zero position value zPos, the method includes setting the absolute level associated with the transformation coefficient at the corresponding position to zero; In response to a comparison indicating that the remainder value is greater than the zero position value zPos, the method includes setting the absolute level associated with the transformation coefficient at the corresponding position to the remainder value; and In response to a comparison indicating that the remainder value is less than the zero position value zPos, the method includes setting the absolute level associated with the transformation coefficient at the corresponding position to the remainder value plus one.
5. A decoder for decoding an image from a data stream, the decoder being configured to: Identify the number of available context-coded binary bits used to decode the transform block representing a portion of the image; During the decoding process at at least one position, each position corresponds to a transform coefficient in a sub-block of the transform block, proceeding from the starting position along a scan order that sequentially traverses at least one position: Decode at least one context encoding flag at the current position within the sub-block. In response to decoding each of at least one context encoding flag, update the number of available context encoding bits. After decoding all context-coded flags associated with the current position and before moving to the next position immediately following the current position in the scan order, the updated number of available context-coded bits is compared with a predefined value, and The decoding process terminates based on a comparison indicating that the number of available context-coded bits after the update is less than a predefined value; and After the decoding process is terminated and during at least one additional decoding process, for each position from the subsequent position to the end position within the sub-block along the scan sequence: The Rice parameter is derived based on the sum of the absolute levels associated with at least one transform coefficient adjacent to the current transform coefficient at the corresponding position. Decode the remainder value using Golomb Rice code with Rice parameter. The zero-position value zPos is derived at least in part based on the sum of absolute levels, and The absolute level associated with the current transform coefficient at the corresponding position is determined in part based on the zero position value zPos and the remainder value.
6. The decoder of claim 5, wherein the local template specifies at least one transform coefficient adjacent to the current transform coefficient.
7. The decoder of claim 5, wherein in order to derive the zero-position value zPos, the decoder is configured as follows: Determine the state variables; and The zero position value zPos is derived from the sum of the absolute level and the state variables.
8. The decoder of claim 5, further configured to compare the remainder value and the zero position value zPos to determine the absolute level, wherein: In response to a comparison indicating that the remainder value is equal to the zero position value zPos, the decoder is further configured to set the absolute level associated with the transform coefficient at the corresponding position to zero; In response to a comparison indicating that the remainder value is greater than the zero position value zPos, the decoder is further configured to set the absolute level associated with the transform coefficients at the corresponding position to the remainder value; and In response to a comparison indicating that the remainder value is less than the zero position value zPos, the decoder is further configured to set the absolute level associated with the transform coefficient at the corresponding position to the remainder value plus one.
9. A non-transitory computer-readable medium comprising instructions that, when executed, cause at least one processor of an electronic device to: Identify the number of available context-coded binary bits used to decode the transform block representing a portion of the image; During the decoding process at at least one position, each position corresponds to a transform coefficient in a sub-block of the transform block, proceeding from the starting position along a scan order that sequentially traverses at least one position: Decode at least one context encoding flag at the current position within the sub-block. In response to decoding each of at least one context encoding flag, update the number of available context encoding bits. After decoding all context-coded flags associated with the current position and before moving to the next position immediately following the current position in the scan order, the updated number of available context-coded bits is compared with a predefined value, and The decoding process terminates when a comparison indicates that the number of available context-coded bits after the update is less than a predefined value; and After the decoding process is terminated and during at least one additional decoding process, for each position from the subsequent position to the end position within the sub-block along the scan sequence: The Rice parameter is derived based on the sum of the absolute levels associated with at least one transform coefficient adjacent to the current transform coefficient at the corresponding position. Decode the remainder value using Golomb Rice code with Rice parameter. The zero-position value zPos is derived at least in part based on the sum of absolute levels, and The absolute level associated with the current transform coefficient at the corresponding position is determined in part based on the zero position value zPos and the remainder value.
10. The non-transitory computer-readable medium of claim 9, wherein the local template specifies at least one transformation coefficient adjacent to the current transformation coefficient.
11. The non-transitory computer-readable medium of claim 9, wherein when the instruction is executed, causing at least one processor to derive the zero-location value zPos comprises, when the instruction is executed, causing at least one processor to: Determine the state variables; and The zero position value zPos is derived from the sum of the absolute level and the state variables.
12. The non-transitory computer-readable medium of claim 9, wherein when the instruction is executed, at least one processor determines the absolute level by comparing the remainder value and the zero position value zPos, wherein: In response to a comparison indicating that the remainder value is equal to the zero position value zPos, when the instruction is executed, at least one processor also causes to set the absolute level associated with the transform coefficient at the corresponding position to zero; In response to a comparison indicating that the remainder value is greater than the zero position value zPos, when the instruction is executed, at least one processor also causes to set the absolute level associated with the transform coefficient at the corresponding position to the remainder value; and In response to a comparison indicating that the remainder value is less than the zero position value zPos, when the instruction is executed, at least one processor also causes to set the absolute level associated with the transform coefficient at the corresponding position to the remainder value plus one.
13. A method for encoding an image, the method comprising: The number of available context-coded bits is determined based on the size of the transform block representing a portion of the image; During the process of encoding at least one position, each position corresponds to a transform coefficient in a sub-block of the transform block, proceeding from the starting position along a scan order that sequentially traverses at least one position: At least one context encoding flag at the current position within the encoded sub-block. In response to encoding each of at least one context encoding flag, update the number of available context encoding bits. After encoding all context-encoded flags related to the current position and before moving to the next position immediately following the current position in the scan order, the updated number of available context-encoded bits is compared with a predefined value, and The encoding process terminates when a comparison indicates that the number of available context-encoded bits after the update is less than a predefined value; and After the termination encoding process and during at least one additional encoding process, for each position from the subsequent position to the end position within the sub-block along the scan sequence: The Rice parameter is derived based on the sum of the absolute levels associated with at least one transform coefficient adjacent to the current transform coefficient at the corresponding position. The zero-position value zPos is derived at least in part based on the sum of absolute levels. The zero-position value zPos is compared with the absolute level associated with the current transform coefficient at the corresponding position. Based on the comparison results, set the remainder value associated with the current transform coefficient at the corresponding position; and The remainder value is encoded using Golomb Rice code with the Rice parameter.
14. The method of claim 13, wherein the local template specifies at least one transform coefficient adjacent to the current transform coefficient.
15. The method of claim 13, wherein deriving the zero position value zPos comprises: Determine the state variables; as well as The zero position value zPos is derived from the sum of the absolute level and the state variables.
16. The method of claim 13, wherein: In response to the comparison indicating that the absolute level associated with the current transform coefficient at the corresponding position is equal to zero, the method includes setting the remainder value to the zero position value zPos; In response to the comparison indicating that the absolute level associated with the current transform coefficient at the corresponding position is greater than zero and less than or equal to the zero position value zPos, the method includes setting the remainder value to the absolute level minus one; and In response to the comparison indicating that the absolute level associated with the current transform coefficient at the corresponding position is greater than zPos, the method includes setting the remainder value as the absolute level.
17. An encoder for encoding images, the encoder being configured to: The number of available context-coded bits is determined based on the size of the transform block representing a portion of the image; During the process of encoding at least one position, each position corresponds to a transform coefficient in a sub-block of the transform block, proceeding from the starting position along a scan order that sequentially traverses at least one position: At least one context encoding flag at the current position within the encoded sub-block. In response to encoding each of at least one context encoding flag, update the number of available context encoding bits. After encoding all context-encoded flags related to the current position and before moving to the next position immediately following the current position in the scan order, the updated number of available context-encoded bits is compared with a predefined value, and The encoding process terminates when a comparison indicates that the number of available context-encoded bits after the update is less than a predefined value; and After the termination encoding process and during at least one additional encoding process, for each position from the subsequent position to the end position within the sub-block along the scan sequence: The Rice parameter is derived based on the sum of the absolute levels associated with at least one transform coefficient adjacent to the current transform coefficient at the corresponding position. The zero-position value zPos is derived at least in part based on the sum of absolute levels. The zero-position value zPos is compared with the absolute level associated with the current transform coefficient at the corresponding position. Based on the comparison results, set the remainder value associated with the current transform coefficient at the corresponding position; and The remainder value is encoded using Golomb Rice code with the Rice parameter.
18. The encoder of claim 17, wherein the local template specifies at least one transform coefficient adjacent to the current transform coefficient.
19. The encoder of claim 17, wherein, in order to derive the zero position value zPos, the encoder is configured to: Determine the state variables; and The zero position value zPos is derived from the sum of the absolute level and the state variables.
20. The encoder of claim 17, wherein: In response to the comparison indicating that the absolute level associated with the current transform coefficient at the corresponding position is equal to zero, the encoder is further configured to set the remainder value to the zero position value zPos; In response to the comparison indicating that the absolute level associated with the current transform coefficient at the corresponding position is greater than zero and less than or equal to the zero position value zPos, the encoder is further configured to set the remainder value to the absolute level minus one; and In response to the comparison indicating that the absolute level associated with the current transform coefficient at the corresponding position is greater than zPos, the encoder is further configured to set the remainder value as the absolute level.
21. A non-transitory computer-readable medium comprising instructions that, when executed, cause at least one processor of an electronic device to: The number of available context-coded bits is determined based on the size of the transform block representing a portion of the image; During the process of encoding at least one position, each position corresponds to a transform coefficient in a sub-block of the transform block, proceeding from the starting position along a scan order that sequentially traverses at least one position: At least one context encoding flag at the current position within the encoded sub-block. In response to encoding each of at least one context encoding flag, update the number of available context encoding bits. After encoding all context-encoded flags related to the current position and before moving to the next position immediately following the current position in the scan order, the updated number of available context-encoded bits is compared with a predefined value, and The encoding process terminates when a comparison indicates that the number of available context-encoded bits after the update is less than a predefined value; and After the termination encoding process and during at least one additional encoding process, for each position from the subsequent position to the end position within the sub-block along the scan sequence: The Rice parameter is derived based on the sum of the absolute levels associated with at least one transform coefficient adjacent to the current transform coefficient at the corresponding position. The zero-position value zPos is derived at least in part based on the sum of absolute levels. The zero-position value zPos is compared with the absolute level associated with the current transform coefficient at the corresponding position. Based on the comparison results, set the remainder value associated with the current transform coefficient at the corresponding position; and The remainder value is encoded using Golomb Rice code with the Rice parameter.
22. The non-transitory computer-readable medium of claim 21, wherein the local template specifies at least one transform coefficient adjacent to the current transform coefficient.
23. The non-transitory computer-readable medium of claim 21, wherein when the instruction is executed, causing at least one processor to derive the zero-location value zPos includes, when the instruction is executed, causing at least one processor to: Determine the state variables; and The zero position value zPos is derived from the sum of the absolute level and the state variables.
24. The non-transitory computer-readable medium according to claim 21, wherein: In response to the comparison indicating that the absolute level associated with the current transform coefficient at the corresponding position is equal to zero, when the instruction is executed, at least one processor also causes the remainder value to be set to the zero position value zPos. In response to the comparison indicating that the absolute level associated with the current transform coefficient at the corresponding position is greater than zero and less than or equal to the zero position value zPos, when the instruction is executed, at least one processor also causes the remainder value to be set to the absolute level minus one; and In response to the comparison indicating that the absolute level associated with the current transform coefficient at the corresponding position is greater than zPos, when the instruction is executed, at least one processor also causes the remainder value to be set to the absolute level.