Dynamic image decoder and dynamic image encoder
The video decoding device optimizes sign prediction by using adjacent block pixels and parameter-dependent adjustments, addressing the complexity issues in existing methods and reducing computational requirements.
Patent Information
- Application Number
- JP2023062712
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-04-07
- Publication Date
- 2024-10-18
AI Technical Summary
Existing video encoding methods, such as those described in Non-Patent Documents 1 and 2, face an exponential increase in calculation complexity due to the number of predicted codes and additional cycles required for sign prediction, especially in quantization and conversion processes.
A video decoding device that includes a parameter decoding unit and a sign prediction unit, which predicts the sign of transformation coefficients using boundary pixels from adjacent blocks without code information, and adjusts the sign prediction operation based on parameters like quantization parameters and block positions, thereby reducing the number of codes to be predicted.
This approach reduces the computational burden and cycles required for sign prediction in video encoding/decoding, optimizing processing efficiency.
Smart Images

Figure 2024149048000001_ABST
Abstract
Description
[Technical field]
[0001] An embodiment of the present invention relates to a video decoding device and a video encoding device. [Background technology]
[0002] In order to efficiently transmit or record moving images, a moving image encoding device is used that generates encoded data by encoding the moving images, and a moving image decoding device is used that generates a decoded image by decoding the encoded data.
[0003] Specific examples of video coding methods include H.264 / AVC, High-Efficiency Video Coding (HEVC), and Versatile Video Coding (VVC).
[0004] In such a video coding method, images (pictures) constituting a video are managed in a hierarchical structure consisting of slices obtained by dividing images, coding tree units (CTUs) obtained by dividing slices, coding units (sometimes called coding units: CUs) obtained by dividing coding tree units, and transform units (TUs) obtained by dividing coding units, and are coded / decoded for each CU.
[0005] In such a video coding method, a predicted image is usually generated based on a locally decoded image obtained by encoding / decoding an input image, and a prediction error (sometimes called a "difference image" or "residual image") obtained by subtracting the predicted image from the input image (original image) is coded. Methods for generating a predicted image include inter-prediction and intra-prediction.
[0006] Furthermore, HEVC / H.265 and VVC / H.266 disclose a technique for encoding a code for each transform coefficient. Non-Patent Document 1 discloses a technique called sign prediction for predicting the code of a transform coefficient and encoding a predicted code error. Non-Patent Document 2 discloses a technique for sorting transform coefficients for selecting transform coefficients to be subjected to sign prediction, a block size restriction for performing sign prediction, and performing sign prediction during non-separable transform. [Prior art documents] [Non-patent literature]
[0007] [Non-Patent Document 1] "Residual Coefficient Sign Prediction", JVET-D0031, Joint Video Exploration Team (JVET) of ITU-T SG 16 WP 3 and ISO / IEC JTC 1 / SC 29 / WG 11, 4th Meeting, Chengdu, CN, Oct, 2016 [Non-Patent Document 2] "EE2-4.3 related: More combined test results for sign prediction", JVET-Y0141, Joint Video Experts Team (JVET) of ITU-T SG 16 WP 3 and ISO / IEC JTC 1 / SC 29, 25th Meeting, by teleconference, January 2022 Summary of the Invention [Problem to be solved by the invention]
[0008] The methods described in Non-Patent Document 1 and Non-Patent Document 2 have the problem that the amount of calculation increases because the number of combinations increases exponentially as the number of codes to be predicted increases. Also, there is a problem that the number of cycles required to derive the residual increases because sign prediction is added to the quantization and transformation processes. [Means for solving the problem]
[0009] In order to solve the above problems, a video decoding device according to one embodiment of the present invention includes a parameter decoding unit that decodes transform coefficients and code prediction parameters from encoded data, and a sign prediction unit that predicts the signs of the transform coefficients, wherein the sign prediction unit derives a cost by referring to boundary pixels with adjacent blocks for candidate code combinations of transform coefficients without code information, predicts the codes based on the cost, and modifies the predicted transform coefficient code using the code prediction parameters decoded by the parameter decoding unit.
[0010] The sign prediction unit changes the operation of the sign prediction depending on a parameter used for decoding the transform coefficients of the current block.
[0011] The parameter used in decoding the transform coefficients is a quantization parameter.
[0012] The parameter used in decoding the transform coefficient is the last position of the transform coefficient.
[0013] The parameter used for decoding the transform coefficient is a syntax element indicating whether the transform coefficient is greater than a predetermined value.
[0014] The sign prediction unit determines whether or not to perform sign prediction depending on parameters used for decoding transform coefficients of a current block.
[0015] The sign prediction unit changes the number of codes to be predicted depending on a parameter used for decoding the transform coefficients of the current block. Effect of the Invention
[0016] According to an aspect of the present invention, in a video encoding / decoding process, it is possible to reduce the amount of calculation required for predicting the sign of a transform coefficient, and also to reduce the number of cycles required for deriving a residual in the video encoding / decoding process. [Brief description of the drawings]
[0017] [Figure 1] 1 is a schematic diagram showing a configuration of an image transmission system according to an embodiment of the present invention. [Diagram 2] FIG. 2 is a diagram showing a hierarchical structure of data in an encoded stream. [Diagram 3] FIG. 1 is a schematic diagram showing a configuration of a video decoding device. [Figure 4] 11 is a flowchart illustrating a schematic operation of the video decoding device. [Diagram 5] FIG. 2 is a functional block diagram showing an example of the configuration of an inverse quantization and inverse transform unit. [Figure 6] 13 is an example of a syntax table regarding sign prediction in a slice header, SPS. [Figure 7] 13 is a part of a syntax table relating to a TU decoding unit. [Figure 8] 13 is a part of a syntax table relating to a TU decoding unit. [Figure 9] 13 is an example of another syntax table for sign prediction. [Figure 10] 13 is a flowchart illustrating an example of a process for signature prediction. [Figure 11] 1 is a diagram illustrating sign prediction, in which (a) is a diagram illustrating an example of coefficients to be predicted, and (b) to (d) are diagrams illustrating mutually different templates; [Figure 12] FIG. 13 is a diagram illustrating a boundary residual and surrounding pixels in sign prediction. [Figure 13]13 is an example of a syntax table in an embodiment in which sign prediction and non-separable transformation are performed exclusively. [Figure 14] FIG. 1 is a block diagram showing a configuration of a video encoding device. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0018] (First embodiment) Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
[0019] FIG. 1 is a schematic diagram showing the configuration of an image transmission system 1 according to this embodiment.
[0020] The image transmission system 1 is a system that transmits an encoded stream obtained by encoding a target image, decodes the transmitted encoded stream, and displays an image. The image transmission system 1 includes a video encoding device (image encoding device) 11, a network 21, a video decoding device (image decoding device) 31, and a video display device (image display device) 41.
[0021] An image T is input to the video encoding device 11 .
[0022] The network 21 transmits the encoded stream Te generated by the video encoding device 11 to the video decoding device 31. The network 21 is the Internet, a wide area network (WAN), a local area network (LAN), or a combination of these. The network 21 is not necessarily limited to a bidirectional communication network, and may be a unidirectional communication network that transmits broadcast waves such as terrestrial digital broadcasting and satellite broadcasting. The network 21 may also be replaced by a storage medium on which the encoded stream Te is recorded, such as a DVD (Digital Versatile Disc: registered trademark) or a BD (Blue-ray Disc: registered trademark).
[0023] The moving image decoding device 31 decodes each of the encoded streams Te transmitted by the network 21 and generates one or more decoded images Td that have been decoded.
[0024] The moving image display device 41 displays all or part of the one or more decoded images Td generated by the moving image decoding device 31. The moving image display device 41 includes, for example, a display device such as a liquid crystal display or an organic EL (Electro-luminescence) display. Examples of the form of the display include a stationary type, a mobile type, and an HMD. Also, when the moving image decoding device 31 has high processing power, an image with high image quality is displayed, and when it has only lower processing power, an image that does not require high processing power or display ability is displayed.
[0025] <Operator> The operators used in this specification are described below.
[0026] >> is a right bit shift, << is a left bit shift, & is a bitwise AND, | is a bitwise OR, |= is an OR assignment operator, and || indicates a logical OR.
[0027] x?y:z is a ternary operator that takes y when x is true (non-zero) and z when x is false (0).
[0028] Clip3(a,b,c) is a function that clips c to a value between a and b (inclusive). If c < a, it returns a; if c > b, it returns b; otherwise, it returns c (where a <= b).
[0029] abs(a) is a function that returns the absolute value of a.
[0030] Int(a) is a function that returns the integer value of a.
[0031] Floor(a) is a function that returns the largest integer less than or equal to a.
[0032] Ceil(a) is a function that returns the smallest integer greater than or equal to a.
[0033] Sign( x ) = (x>0) ? 1 : (x==0) ? 0 : -1 Round( x ) = Sign( x ) * Floor( Abs( x ) + 0.5 ) Log2(a) is a function that returns the base 2 logarithm.
[0034] min(a,b) is a function that returns the smaller of a and b.
[0035] a / d represents the division of a by d (truncated to an integer).
[0036] <Structure of the coding stream Te> Before describing in detail the video encoding device 11 and the video decoding device 31 according to this embodiment, the data structure of the encoded stream Te generated by the video encoding device 11 and decoded by the video decoding device 31 will be described.
[0037] Fig. 2 is a diagram showing a hierarchical structure of data in an encoded stream Te. The encoded stream Te illustratively includes a sequence and a plurality of pictures constituting the sequence. Fig. 2 shows diagrams showing an encoded video sequence that defines a sequence SEQ, an encoded picture that defines a picture PICT, an encoded slice that defines a slice S, encoded slice data that defines slice data, an encoding tree unit included in the encoded slice data, and an encoding unit included in the encoding tree unit.
[0038] (Coded Video Sequence) In the coded video sequence, a set of data that the video decoding device 31 refers to in order to decode the sequence SEQ is specified. As shown in Fig. 2, the sequence SEQ includes a video parameter set, a sequence parameter set SPS (Sequence Parameter Set), a picture parameter set PPS (Picture Parameter Set), an adaptation parameter set (APS), a picture PICT, and supplemental enhancement information SEI (Supplemental Enhancement Information).
[0039] The video parameter set VPS specifies a set of coding parameters common to multiple videos composed of multiple layers, as well as a set of coding parameters related to multiple layers and each individual layer included in the video.
[0040] The sequence parameter set SPS specifies a set of coding parameters that the video decoding device 31 refers to in order to decode the target sequence. For example, the width and height of a picture are specified. Note that there may be multiple SPSs. In that case, one of the multiple SPSs is selected from the PPS.
[0041] The picture parameter set PPS specifies a set of coding parameters that the video decoding device 31 refers to in order to decode each picture in the target sequence. For example, the picture parameter set PPS includes a reference value of the quantization width (pic_init_qp_minus26) used in decoding the picture and a flag (weighted_pred_flag) indicating the application of weighted prediction. Note that there may be multiple PPSs. In that case, one of the multiple PPSs is selected for each picture in the target sequence.
[0042] (Encoded Picture) A coded picture defines a set of data to be referenced by the video decoding device 31 in order to decode the picture PICT. As shown in Fig. 2, the picture PICT includes slices 0 to NS-1 (NS is the total number of slices included in the picture PICT).
[0043] In the following description, when there is no need to distinguish between slices 0 to NS-1, the subscripts of the symbols may be omitted. The same applies to other data that are included in the coded stream Te and that are to be described below and that are to be given subscripts.
[0044] (Coded Slice) An encoded slice defines a set of data to be referenced by the video decoding device 31 in order to decode a slice S. As shown in Fig. 2, a slice includes a slice header and slice data.
[0045] The slice header includes a group of coding parameters to be referred to by the video decoding device 31 in order to determine a decoding method for the current slice. Slice type designation information (slice_type) that designates the slice type is an example of a coding parameter included in the slice header.
[0046] Slice types that can be specified by the slice type specification information include (1) an I slice that uses only intra prediction when encoding, (2) a P slice that uses unidirectional prediction or intra prediction when encoding, and (3) a B slice that uses unidirectional prediction, bidirectional prediction, or intra prediction when encoding. Note that inter prediction is not limited to uni-prediction or bi-prediction, and a predicted image may be generated using more reference pictures. Hereinafter, when referring to P or B slice, it refers to a slice including a block that can use inter prediction.
[0047] In addition, the slice header may include a reference to a picture parameter set PPS (pic_parameter_set_id).
[0048] (Encoded slice data) The coded slice data defines a set of data to be referred to by the video decoding device 31 in order to decode the slice data. As shown in Fig. 2(d), the slice data includes a CTU. A CTU is a block of a fixed size (e.g., 128x128) that constitutes a slice.
[0049] (coding tree unit) 2 specifies a set of data that the video decoding device 31 refers to in order to decode a CTU. A CTU is divided into coding units CU, which are basic units of encoding processing, by recursive quad tree division (QT (Quad Tree) division), binary tree division (BT (Binary Tree) division), or ternary tree division (TT (Ternary Tree) division). BT division and TT division are collectively called multi tree division (MT (Multi Tree) division). A node of a tree structure obtained by recursive quad tree division is called a coding node. Intermediate nodes of a quad tree, binary tree, and ternary tree are coding nodes, and the CTU itself is specified as the top coding node. The lowest coding node is specified as a coding unit.
[0050] (Encoding Unit) 2 specifies a set of data to be referred to by the video decoding device 31 in order to decode a coding unit. Specifically, a CU is composed of a CU header CUH, prediction parameters, transformation parameters, quantization transformation coefficients, etc. The CU header specifies a prediction mode, etc.
[0051] The prediction process may be performed on a CU basis, or on a sub-CU basis by further dividing a CU. If the size of a CU and a sub-CU are the same, there is one sub-CU in the CU. If the size of a CU is larger than that of a sub-CU, the CU is divided into sub-CUs. For example, if the CU is 8x8 and the sub-CU is 4x4, the CU is divided into 2 parts horizontally and 2 parts vertically, into 4 sub-CUs.
[0052] Prediction types (prediction modes) include intra prediction (MODE_INTRA), inter prediction (MODE_INTER), and intra block copy (MODE_IBC). Intra prediction is a prediction within the same picture, and inter prediction refers to a prediction process performed between different pictures (for example, between display times or between layer images).
[0053] The transform and quantization processes are performed in units of CUs, but the quantized transform coefficients may be entropy coded in units of sub-blocks (sub-TUs) such as 4x4.
[0054] (Prediction parameters) Prediction parameters include intra prediction and inter prediction parameters. Inter prediction parameters include a prediction mode predMode, etc. Intra prediction parameters include a luminance prediction mode IntraPredModeY and a color difference prediction mode IntraPredModeC, etc. In addition, when a "flag indicating whether or not XX" is written in this specification, a flag other than 0 (for example, 1) is XX, and 0 is not XX, and in logical negation, logical product, etc., 1 is treated as true and 0 is treated as false (same below). However, in an actual device or method, other values can be used as true and false values.
[0055] (Configuration of a video decoding device) The configuration of a video decoding device 31 (FIG. 3) according to this embodiment will be described.
[0056] The video decoding device 31 includes an entropy decoding unit 301, a parameter decoding unit (prediction image decoding device) 302, a loop filter 305, a reference picture memory 306, a prediction parameter memory 307, a prediction image generating unit (prediction image generating device) 308, an inverse quantization and inverse transform unit 311, an adder 312, and a prediction parameter derivation unit 320. Note that, in accordance with the video encoding device 11 described below, the video decoding device 31 may also be configured not to include the loop filter 305.
[0057] The parameter decoding unit 302 further includes a header decoding unit 3020, a CT information decoding unit 3021, and a CU decoding unit 3022 (prediction mode decoding unit), and the CU decoding unit 3022 further includes a TU decoding unit 3024. These may be collectively referred to as a decoding module. The header decoding unit 3020 decodes parameter set information such as VPS, SPS, PPS, and APS, and slice headers (slice information) from the encoded data. The CT information decoding unit 3021 decodes CTU and CT from the encoded data. The CU decoding unit 3022 decodes CU from the encoded data.
[0058] Furthermore, the CU decoding unit 3022 decodes a parameter lfnst_idx indicating whether or not non-separable transform is used and a non-separable transform matrix from the encoded data. Specifically, the CU decoding unit 3022 decodes lfnst_idx when the width and height of the CU are 4 or more and the prediction mode is an intra prediction mode. When lfnst_idx is 0, it indicates non-application of non-separable transform, when it is 1, it indicates one transform matrix of a set (pair) of non-separable transform matrices, and when it is 2, it indicates the other transform matrix of the pair. The CU decoding unit 3022 derives a parameter ApplyLfnstFlag indicating whether to perform non-separable transform on the current block from lfnst_idx.
[0059] ApplyLfnstFlag = lfnst_idx The CU decoding unit 3022 may derive ApplyLfnstFlag[cIdx] for each color component cIdx as follows. If treeType==SINGLE_TREE or DUAL_TREE_LUMA, the following processing is performed.
[0060] ApplyLfnstFlag[0] = (lfnst_idx>0) ? 1 : 0 Then, the following processing is performed for cIdx=1,2.
[0061] ApplyLfnstFlag[cIdx] = (lfnst_idx>0 && treeType==DUAL_TREE_CHROMA) ? 1 : 0 In addition, lfnst_idx may be 0 or 1. In addition, lfnst_idx may be derived from the mode number of intra prediction.
[0062] Furthermore, the CU decoding unit 3022 decodes a value mts_idx indicating a transform matrix of Multiple Transform Selection (MTS) from the encoded data. Specifically, the CU decoding unit 3022 decodes mts_idx when the width and height of the CU are 32 or less and lfnst_idx is 0. The MTS selects and uses one transform matrix from multiple transform matrix candidates.
[0063] If the size of the transform unit (tbWidth and tbHeight) is equal to or smaller than a predetermined maximum size (tbWidth<=MaxTsSize && tbHeight<=MaxTsSize), the TU decoding unit 3024 decodes transform_skip_flag[x0][y0][cIdx].
[0064] When a prediction error is included in a TU (for example, when tu_cbf_luma[x0][y0] is 1), the TU decoding unit 3024 decodes the QP update information and the quantized transform coefficient from the encoded data. The QP update information is a difference value from the quantization parameter predicted value qPpred, which is a predicted value of the quantization parameter QP.
[0065] In addition, although an example in which CTU and CU are used as processing units will be described below, the present invention is not limited to this example, and processing may be performed in sub-CU units. Alternatively, CTU and CU may be read as blocks, and sub-CU as sub-blocks, and processing may be performed in block or sub-block units.
[0066] The entropy decoding unit 301 performs entropy decoding on the externally input coded stream Te to decode individual codes (syntax elements). Entropy coding includes a method of variable-length coding the syntax elements using a context (probability model) adaptively selected according to the type of syntax element or surrounding circumstances, and a method of variable-length coding the syntax elements using a predetermined table or formula.
[0067] The entropy decoding unit 301 outputs the decoded code to the parameter decoding unit 302. Control of which code to decode is performed based on an instruction from the parameter decoding unit 302.
[0068] (Basic flow) FIG. 4 is a flowchart illustrating a schematic operation of the video decoding device 31.
[0069] (S1100: Decode Parameter Set Information) The header decoding unit 3020 decodes parameter set information such as the VPS, SPS, and PPS from the encoded data.
[0070] (S1200: Decode slice information) The header decoding unit 3020 decodes the slice header (slice information) from the encoded data.
[0071] Thereafter, the video decoding device 31 repeats the processes from S1300 to S5000 for each CTU included in the target picture to derive a decoded image of each CTU.
[0072] (S1300: Decode CTU Information) The CT information decoding unit 3021 decodes the CTU from the encoded data.
[0073] (S1400: Decode CT Information) The CT information decoding unit 3021 decodes the CT from the encoded data.
[0074] (S1500: CU Decoding) The CU decoding unit 3022 performs S1510 and S1520 to decode the CU from the encoded data.
[0075] (S1510: Decode CU Information) The CU decoding unit 3022 decodes the CU information, prediction information, TU division flag, CU residual flag, and the like from the encoded data.
[0076] (S1520: Decode TU information) When a prediction error is included in a TU, the TU decoding unit 3024 decodes the quantized prediction error, the transform index lfnst_idx, and the like from the encoded data.
[0077] (S2000: Generation of predicted image) The predicted image generation unit 308 generates a predicted image for each block included in the current CU based on the prediction information.
[0078] (S3000: Inverse Quantization and Inverse Transformation) The inverse quantization and inverse transform unit 311 executes inverse quantization and inverse transform processing for each TU included in the target CU. Two quantization methods are provided: scalar quantization and dependent quantization. Dependent quantization has multiple quantizers with different levels. Four or eight QState states are switched using the parity of the intermediate values of the quantized transform coefficients. Then, quantization and inverse quantization are performed according to the QState.
[0079] (S4000: Generate decoded image) The adder 312 adds the predicted image supplied from the predicted image generation unit 308 and the prediction error supplied from the inverse quantization and inverse transform unit 311 to generate a decoded image of the current CU.
[0080] (S5000: Loop Filter) The loop filter 305 applies a loop filter such as a deblocking filter, SAO, or ALF to the decoded image to generate a decoded image.
[0081] The loop filter 305 is a filter provided in the encoding loop, which removes block distortion and ringing distortion to improve image quality. The loop filter 305 applies a filter such as a deblocking filter, a sample adaptive offset (SAO), and an adaptive loop filter (ALF) to the decoded image of the CU generated by the adder 312.
[0082] The reference picture memory 306 stores the decoded image of the CU generated by the adder 312 in a location that is determined in advance for each current picture and current CU.
[0083] The prediction parameter memory 307 stores prediction parameters at a predetermined position for each CTU or CU to be decoded.
[0084] Prediction parameters and the like are input to the prediction image generating unit 308. In addition, the prediction image generating unit 308 reads a reference picture from the reference picture memory 306. The prediction image generating unit 308 generates a prediction image of a block or sub-block using the prediction parameters and the read reference picture (reference picture block) in a prediction mode indicated by the prediction mode predMode. Here, the reference picture block is a set of pixels on the reference picture (usually rectangular, so called a block), and is an area to be referenced for generating a prediction image.
[0085] The prediction parameter derivation unit 320 derives prediction parameters by referring to the prediction parameters stored in the prediction parameter memory 307 based on the syntax elements input from the parameter decoding unit 302. The prediction parameter derivation unit 320 also outputs the prediction parameters to the prediction image generation unit 308. The predicted image generation unit 308 generates a predicted image of a block or sub-block by inter prediction or intra prediction using the prediction parameters and reference pictures input from the prediction parameter derivation unit 320. The predicted image generation unit 308 outputs the generated predicted image of the block to the addition unit 312.
[0086] The inverse quantization and inverse transform unit 311 inverse quantizes the quantized transform coefficients input from the parameter decoding unit 302 to obtain transform coefficients.
[0087] A technique that does not perform a transform is called a transform skip. The transform skip only scales the transform coefficient according to the quantization parameter. The transform skip is notified using the syntax element transform_skip_flag. The transform_skip_flag may be notified for each color component (cIdx) of Y, Cb, and Cr.
[0088] As shown in FIG. 6(a), the parameter decoding unit 302 may decode a parameter sps_sign_prediction_enabled_flag of sign prediction from the encoded data (e.g., SPS). sps_sign_prediction_enabled_flag is a flag indicating whether or not sign prediction is used in CLVS. When sps_sign_prediction_enabled_flag is 1, it indicates that sign prediction is used in CLVS. When sps_sign_prediction_enabled_flag is 0, it indicates that sign prediction is not used in CLVS. A Coded Layer Video Sequence (CLVS) refers to a series of access units (AUs) of the same layer. When sign prediction is used (sps_sign_prediction_enabled_flag is 1), the parameter decoding unit 302 may decode sps_num_pred_signs. sps_num_pred_signs indicates the number of codes (sign, code information) to be predicted.
[0089] In Figure 6 (a), sps_lfnst_enabled_flag is a parameter indicating whether lfnst_idx is present in the syntax related to intra coding. When sps_lfnst_enabled_flag is 1, it indicates that lfnst_idx is present in the syntax related to intra coding. When sps_lfnst_enabled_flag is 0, it indicates that lfnst_idx is not present in the syntax related to intra coding. sps_explicit_scaling_list_enabled_flag is a parameter indicating whether to use an explicit scaling list notified in the scaling list APS.
[0090] As shown in Fig. 6(b), when sps_sign_prediction_enabled_flag is 1, the parameter decoding unit 302 may decode a flag sh_sign_prediction_used_flag related to sign prediction. sh_sign_prediction_used_flag is a flag indicating whether or not sign prediction is used in the current slice. When sh_sign_prediction_used_flag is 1, it indicates that sign prediction is used in the current slice. When sh_sign_prediction_used_flag is 0, it indicates that sign prediction is not used in the current slice.
[0091] 7 and 8 show syntax showing a method for encoding transform coefficients (prediction errors).
[0092] In a normal prediction error coding method without transform skip (FIGS. 7 and 8), the TU decoding unit 3024 decodes a syntax element (not shown) indicating the LAST position to derive the LAST position (LastSignificantCoeffX, LastSignificantCoeffY). The LAST position is the position of the last non-zero coefficient when the transform coefficients of the TU are scanned in the direction from low frequency components to high frequency components. When transform coefficients (coefficients) are coded and decoded in order from high frequency components, the LAST position indicates the position of the quantized transform coefficient to be decoded first. Next, the TU decoding unit 3024 refers to the LAST position and decodes sb_coded_flag. sb_coded_flag is a flag indicating whether or not a non-zero coefficient is included in the sub-block. The sub-block is an area obtained by dividing the TU into 4x4 units. If sb_coded_flag=1 (the sub-block includes a non-zero coefficient), the TU decoding unit 3024 decodes sig_coeff_flag. sig_coeff_flag is a flag indicating whether the coefficient value is non-zero. If sig_coeff_flag=1 (coefficient value is non-zero), the TU decoding unit 3024 decodes abs_level_gtx_flag, par_level_flag, abs_remainder, and dec_abs_level. These are syntax elements indicating the absolute value of the coefficient. abs_level_gtx_flag[n][j] is a flag indicating whether the absolute value of the coefficient at scan position n is greater than (j<<1)+1. If abs_level_gtx_flag[n][j] is not notified, it is estimated to be 0. par_level_flag[n] is the parity of the coefficient at scan position n. If par_level_flag[n][j] is not notified, it is estimated to be 0. abs_remainder[n] represents the remainder of the absolute value of the coefficient at scan position n, decoded by the Golomb-Rice code. If abs_remainder[n] is not signaled, it is assumed to be 0. dec_abs_level[n] is the absolute value of the residual used to derive the absolute value of the coefficient at scan position n. If dec_abs_level[n] is not signaled, it is assumed to be 0.The TU decoding unit 3024 derives the absolute value of the coefficient from these syntax elements. Hereinafter, the parameters used for decoding the transform coefficients are syntax elements in the encoded data or variables decoded from the syntax elements, and are used to derive the transform coefficients. For example, the quantization parameter, the last position (LastSignificantCoeffX, LastSignificantCoeffY), the flags (sig_coeff_flag, abs_level_gtx_flag) indicating whether the transform coefficient is greater than a predetermined value, par_level_flag, and the residuals (abs_remainder, dec_abs_level) are parameters used for decoding the transform coefficients. The parameters used for decoding the transform coefficients are not limited to these.
[0093] The TU decoding unit 3024 sets a variable numPredSigns indicating the number of predicted signs to 0. When sign prediction is not applied to a non-zero coefficient that does not use sign hiding, or when the current number of predicted signs, numPredSigns, is equal to or greater than the maximum number of predicted signs, maxNumPredSigns, the TU decoding unit 3024 decodes a syntax element coeff_sign_flag[n] indicating the sign. When sign prediction is not applied to a TU, isSignPredictedTU=0 is represented. When sign prediction is applied to a TU, isSignPredictedTU=1 is represented. When the number of predicted signs is equal to or greater than the maximum number of predicted signs, is numPredSigns>=maxNumPredSigns is represented. The maximum number of predicted signs is, for example, 8. Alternatively, the maximum number of predicted signs is sps_num_pred_signs. coeff_sign_flag[n] indicates the sign of a coefficient at scan position n. On the other hand, when sign prediction is applied to a non-zero coefficient, the TU decoding unit 3024 decodes the sign prediction parameters (coeff_sign_resi_flag[n], coefficient sign prediction error, coefficient prediction syntax). coeff_sign_resi_flag[n] indicates a prediction error (whether the prediction was correct or not) of the sign of the coefficient at the scan position n. Every time the TU decoding unit 3024 decodes the sign prediction parameters, it increments the number of predicted signs, numPredSigns, by 1.
[0094] When sign prediction is not applied, the TU decoding unit 3024 decodes the code of the transform coefficient from the encoded data, and derives the transform coefficient from the absolute value of the coefficient and the decoded code. On the other hand, when sign prediction is applied, the TU decoding unit 3024 derives a code from the predicted value of the code derived in the sign prediction unit 31110 and the decoded code prediction parameter, and derives the transform coefficient from the absolute value of the coefficient and the derived code. The sign prediction and the sign prediction unit 31110 will be described later.
[0095] (An example of an alternative syntax for sign prediction) The parameter decoding unit 302 may use the configuration shown in Fig. 9 for decoding the syntax for sign prediction. Fig. 9(a) is an example of syntax showing a TU decoding unit 3024 different from that of Fig. 9. After decoding the absolute value of the coefficient, the TU decoding unit 3024 decodes a syntax element coeff_sign_flag[n] indicating the sign of the coefficient at scan position n when sign prediction is not applied (isSignPredictedSubTU is 0). When sign prediction is not applied to a sub-TU, it is expressed as isSignPredictedSubTU=0. When sign prediction is applied to a sub-TU, it is expressed as isSignPredictedSubTU=1. isSignPredictedSubTU may be set to 1 when all of the following conditions are satisfied. -isSignPredictedTU is 1 - The target sub-block size is greater than or equal to a certain size (for example, width is greater than or equal to 4, height is greater than or equal to 4) The target subblock is within the range of (spRange) x (spRange) from the top left of the target block. In addition, isSignPredictedTU may be set to 1 if all of the following conditions are met: sps_num_pred_signs is greater than 0 - Conversion skip is not used in the target block - The width of the TU block size is greater than or equal to a certain size (for example, width is greater than or equal to 4, height is greater than or equal to 4) TU block size width is less than maxSize, height is less than maxSize maxSize is the maximum TU size for which sign prediction is possible, and is, for example, 32 or 128. Alternatively, maxSize may be determined as follows depending on whether the current block is intra-coded or inter-coded.
[0096] maxSize = predMode == MODE_INTRA ? maxSizeIntra : maxSizeInter For example, maxSizeIntra may be 32, and maxSizeInter may be 128. Furthermore, spRange represents the applicable range of sign prediction. spRange is, for example, 4, 32.
[0097] When the TU decoding unit 3024 applies sign hiding (signHiddenFlag is 1), it sets signHiddenCoeff[x0][y0][cIdx][x][y] to 1. signHiddenCoeff[x0][y0][cIdx][x][y] is a variable indicating whether sign hiding is used for the coefficient of color component cIdx and position (x, y) in a TU whose upper left position is (x0, y0).
[0098] FIG. 9B shows an example of syntax related to sign prediction. The CU decoding unit 3022 derives the width spAreaWidth and height spAreaHeight of the range to which sign prediction is applied from the block sizes tbWidth and tbHeight and the applicable range spRange of sign prediction. After that, the CU decoding unit 3022 performs the following process on coefficients that are non-zero and do not use sign hiding (AbsLevel[x][y]>0 and signHiddenCoeff[x0][y0][cIdx][x][y] are 0). When sign prediction is not applied to the target block (isSignPredictedTU is 0) or when sign prediction is not applied to the target scan position, the CU decoding unit 3022 decodes the syntax element coeff_sign_flag[n] indicating the sign. When sign prediction is not applied to the target scan position, for example, the current number of predicted codes is equal to or greater than the maximum code prediction number, and can be expressed as numPredSigns>=maxNumPredSigns. coeff_sign_flag[n] indicates the sign of the coefficient at scan position n. Conversely, when sign prediction is applied to the current block and scan position n, the CU decoding unit 3022 decodes the sign prediction parameter (coeff_sign_resi_flag[n], coefficient sign prediction error). coeff_sign_resi_flag[n] indicates a prediction error (whether or not the prediction was correct) of the sign of the coefficient at scan position n. The TU decoding unit 3024 increments numPredSigns by 1 each time it decodes the sign prediction parameter. Here, isSignPredictedTU=isSignPredictedSubTU may be set.
[0099] (inverse quantization and inverse transformation) 5 is a block diagram showing the configuration of the inverse quantization and inverse transform unit 311 of this embodiment. The inverse quantization and inverse transform unit 311 is made up of a scaling unit 31111, a sign prediction unit 31110, an inverse non-separable transform unit 31121, and an inverse separate transform unit 31123.
[0100] The inverse quantization and inverse transform unit 311 scales (inverse quantizes) the quantized transform coefficients qd[][] input from the entropy decoding unit 301 using a scaling unit 31111 to obtain transform coefficients without code information. The quantized transform coefficients qd[][] are coefficients obtained by performing a transform such as DCT (Discrete Cosine Transform) or DST (Discrete Sine Transform) on the prediction error in the encoding process and quantizing it, or by further performing a non-separable transform on the transformed coefficients and quantizing it. The sign prediction unit 31110 obtains transform coefficients d[][] using the absolute value of the transform coefficient, the code prediction parameter, or the coefficient code. When lfnst_idx!=0, the inverse quantization and inverse transform unit 311 performs an inverse non-separable transform using an inverse non-separable transform unit 31121. Furthermore, an inverse separable transform such as inverse DCT or inverse DST is performed on the transform coefficients to calculate the prediction error. Also, when lfnst_idx==0, the inverse non-separable transform is not performed, and the inverse separable transform such as inverse DCT and inverse DST is performed on the transform coefficients scaled by the scaling unit 31111 to calculate a prediction error. The inverse quantization / inverse transform unit 311 outputs the prediction error to the addition unit 312.
[0101] In addition, since the inverse transformation and the transformation are paired processes, the transformation and the inverse transformation may be interpreted as being interchangeable. Alternatively, when the inverse transformation is called the transformation, the transformation may be called the forward transformation. For example, when the inverse non-separable transformation is called the non-separable transformation, the non-separable transformation may be called the forward non-separable transformation. Moreover, the separable transformation is simply called the transformation.
[0102] (Sign prediction unit 31110, sign prediction) When the TU decoding unit 3024 decodes the signs of all coefficients of the transform block without using sign prediction (isSignPredictedTU is 0), the scaled transform coefficients qd[][] and coefficient signs are input to the scaling unit 31111. On the other hand, when the TU decoding unit 3024 derives the signs of all or some of the coefficients of the transform block using prediction (isSignPredictedTU is 1), qd[][] and sign prediction parameters are input to the sign prediction unit 31110.
[0103] The sign prediction unit 31110 may set the maximum number of codes to be predicted, maxNumPredSigns. maxNumPredSigns is, for example, 0 to 8. If the value is 0, sign prediction is not performed. Furthermore, the parameter decoding unit 302 may decode the maximum number of codes to be predicted as sps_num_pred_signs and set it as maxNumPredSigns.
[0104] The sign prediction unit 31110 predicts the sign of a transform coefficient without sign information by using the absolute value of the transform coefficient. Then, the sign prediction unit 31110 corrects a predicted value (prediction code) of the code of the transform coefficient based on the code prediction parameter (coefficient code prediction error) decoded by the parameter decoding unit 302. Specifically, the sign prediction unit 31110 corrects the prediction code by using the XOR of the value of the prediction code and the value of the code prediction parameter to derive a code.
[0105] sign = predicted sign XOR sign prediction parameter Here, the above correction may be performed on the prediction code and the code prediction parameter of one transform coefficient. In this case, the prediction code and the code prediction parameter are both 0 or 1. Alternatively, the above correction may be performed on the prediction code and the code prediction parameter of a string of multiple transform coefficients. In this case, the prediction code and the code prediction parameter are both strings containing 0 or 1.
[0106] The sign prediction unit 31110 may derive the code by inverting the predicted code signPred[n] depending on whether the code prediction parameter is 0 or 1. signPred[n] indicates the coefficient code at the scan position n, and is 0 for positive and 1 for negative.
[0107] coeff_sign_flag[n] = coeff_sign_resi_flag[n]!=0 ? 1 - signPred[n] : signPred[n] Furthermore, the sign prediction unit 31110 may derive the transform coefficient TransCoeffLevel using the derived sign.
[0108] TransCoeffLevel = (1 - 2 * coeff_sign_flag[n]) * AbsLevel Alternatively, the sign prediction unit 31110 may invert the sign of the absolute value AbsLevel[n] of the transform coefficient at the scan position n to derive the transform coefficient coeff. coeff[n] = AbsLevel[n], tmpCoef = AbsLevel[n] if (coeff_sign_resi_flag[n]!=0) coeff[n] = -tmpCoef The transform coefficients d[x][y] whose signs have been predicted and corrected are output to the inverse separating transform unit 31123 or the inverse non-separating transform unit 31121 .
[0109] (Sign prediction process flow) FIG. 10 is a flowchart showing sign prediction. The sign prediction unit 31110 sets the value of the variable minCost to a predetermined positive number, for example, the upper limit of an integer (MAXINT) (SA1). Next, the sign prediction unit 31110 derives pixels R located at the boundary of the target block in the left and upper adjacent blocks (SA2). The sign prediction unit 31110 derives the value of the residual (border residual) when the code is used for all combinations of the codes of the transformation coefficients to be predicted. That is, the candidate value of the transformation coefficient is derived from the combination of the candidate codes and the absolute value of the transformation coefficient. The transformation coefficient candidate is inversely transformed to derive the boundary residual r (provisional prediction residual) (SA3). Furthermore, the sum of the boundary residual r and the prediction image P of the target block may be derived as a temporary provisional decoded image at the boundary. The sign prediction unit 31110 calculates the cost in the upward direction and the cost in the leftward direction using the pixel values of adjacent pixel R in the upward and leftward directions and the pixel values obtained in SA2 and SA3 (SA4).
[0110] Furthermore, the sign predictor 31110 predicts the sign using the upward cost and the leftward cost. Specifically, the sign predictor 31110 determines whether the value of cost, which is the sum of the upward cost and the leftward cost, is smaller than the current optimal cost minCost (SA5). If the value of cost is smaller than the value of minCost (Y in SA5), the sign predictor 31110 updates the value of minCost with the value of cost and stores (updates) the combination of the signs of the transform coefficients corresponding to minCost (SA6). On the other hand, if the value of cost is equal to or larger than the value of minCost (N in SA5), the sign predictor 31110 does not perform the process of step SA6.
[0111] The sign prediction unit 31110 repeats the process of steps SA3 to SA6 for a predetermined combination of the codes of the transform coefficients to be predicted. The sign prediction unit 31110 sets the combination of the codes of the transform coefficients corresponding to the value of minCost at the end of the loop as the predicted code of the transform coefficients. Here, the predetermined combination may be all combinations of the codes of the transform coefficients whose codes have not been decoded from the encoded data.
[0112] Finally, the sign prediction unit 31110 corrects the derived prediction code of the transform coefficient based on the code prediction parameter (coefficient code prediction error) input from the parameter decoding unit 302 (SA7).
[0113] (Generating boundary residuals using templates) An example of a method for calculating the cost (e.g., residual) at the boundary of the target block by the sign prediction unit 31110 will be described below. The sign prediction unit 31110 calculates the cost using provisional decoded pixel values of the top and leftmost pixels of the target block and a pixel R adjacent to the top or left side of the target block. The cost may be calculated using a method (cost calculation) described later. The provisional decoded pixel value of the target block is derived from the sum of a residual prediction value r and a predicted image P of the target block.
[0114] The sign prediction unit 31110 may generate the boundary residual by performing an inverse transform process for all combinations of signs of the transform coefficients to be predicted. However, the sign prediction unit 31110 can efficiently generate the boundary residual by performing calculations using a template.
[0115] Fig. 11(a) is a diagram showing an example of coefficients to be predicted. Fig. 11(b) to (d) are diagrams for explaining templates different from each other. A calculation method using the templates will be described below with reference to Fig. 11(a) to (d).
[0116] In the following example, c(x,y) indicates a conversion coefficient at coordinates (x,y) (x=0..3, y=0..3). In the following example, c(2,2) = -1 c(1,2) = -5 c(1,0) = +2 For these three transform coefficients, the codes are predicted from the state in which the absolute values are known. Note that prediction is not performed for transform coefficients other than c(2,2), c(1,2), and c(1,0), so the codes of the decoded syntax elements are used for the transform coefficients.
[0117] In the following example, the boundary residual is represented as Habc, where a, b, and c correspond to the signs of c(2,2), c(1,2), and c(1,0), respectively, and are each 0 or 1. When a, b, and c are 0, the corresponding transform coefficient is positive, and when they are 1, the corresponding transform coefficient is negative.
[0118] In this case, the sign prediction unit 31110 generates a boundary residual in the following procedure: First, when all sign coefficients are positive, that is, for the following, the sign prediction unit 31110 generates a boundary residual H000 by inverse transform processing. c(2,2) = +1 c(1,2) = +5 c(1,0) = +2 Next, as shown in FIG. 11B to FIG. 11D, when the sign of only one of the transform coefficients to be predicted is positive and the absolute value of the other coefficients is 0, that is, when each of the following coefficients is used, the sign prediction unit 31110 generates a boundary residual by inverse transform processing:
[0119] (A) c(1,0) = +2, c(1,2) = 0, c(2,2) = 0 (see Figure 11(b)
[0120] (B) c(1,0) = 0, c(1,2) = +5, c(2,2) = 0 (see (c) in Figure 11)
[0121] (C) c(1,0) = 0, c(1,2) = 0, c(2,2) = +1 (see Figure 11 (d)) Here, the boundary residuals in the above cases (A) to (C) are expressed as templates T001, T010, and T100. In this case, the sign prediction unit 31110 can calculate the boundary residual Habc other than H000 by the following formula. H001 = H000 - 2 * T001 H010 = H000 - 2 * T010 H011 = H010 - 2 * T001 H100 = H000 - 2 * T100 H101 = H100 - 2 * T001 H110 = H100 - 2 * T010 H111 = H110 - 2 * T001 According to the above procedure, the sign prediction unit 31110 can generate the boundary residual H000 and the templates T001, T010, and T100 by inverse transform processing, and then generate other boundary residuals by subtraction processing. Therefore, the amount of processing for the boundary residuals corresponding to all combinations (8 combinations) of signs of the coefficients to be predicted can be reduced compared to the case where each is generated by inverse transform processing.
[0122] Similarly, even if the number of transform coefficients to be predicted is 1, 2, or 4 or more, it is possible to generate boundary residuals by generating only the following combinations by inverse transform processing without performing inverse transform processing for other combinations. Boundary residual when all transform coefficients to be predicted have positive signs The residuals at the boundaries of each transform coefficient (template) when the sign of one of the transform coefficients to be predicted is positive and the absolute values of the other transform coefficients are 0.
[0123] (Calculating the cost) The following describes a method for calculating boundary residuals by the sign prediction unit 31110. In the following description, "up" refers to the direction in which the y coordinate decreases, and "left" refers to the direction in which the x coordinate decreases.
[0124] 12 is a diagram illustrating the boundary residual and the surrounding pixels. In each temporary decoded image, as shown in FIG. 12, the top left coordinate of the target block is set to (0, 0), and the following pixel values are referenced. Pixel P(x, 0) of the predicted image with coordinates (0,0)~(3,0) located at the top of the target block Pixel P(0,y) of the predicted image with coordinates (0,0)~(0,3) located at the left edge of the target block Pixel r(x, 0) of the boundary residual between coordinates (0,0) and (3,0) located at the top of the target block The pixel r(0,y) of the boundary residual between coordinates (0,0) and (0,3) located at the left edge of the target block Pixels R(x, -1) and R(x, -2) at coordinates (0, -1) to (3, -1) and (0, -2) to (3, -2) of the blocks adjacent to the target block above Pixels R(-1,y) and R(-2,y) at coordinates (-1,0)~(-1,3) and (-2,0)~(-2,3) in the block adjacent to the left of the target block Here, x=0..tbWidth-1, y=0..tbHeight-1. In Fig. 12, the block has tbWidth=4, tbHeight=4, but the same is true for all block sizes.
[0125] The sign prediction unit 31110 calculates the cost by the following formula:<F_COST1> It is calculated as follows. <F_COST1> cost = costU + costL costU = Σ|(- R(x,-2) + 2 * R(x,-1) - P(x,0)) - r(x,0)| (x = 0..tbWidth-1) costL = Σ|(- R(-2,y) + 2 * R(-1,x) - P(0,y)) - r(0,y)| (y = 0..tbHeight-1) Here, cost is as follows:<F_COST2> Formulas may also be used. <F_COST2> cost = costU + costL costU = Σ| R(x,-1) - (P(x,0) + r(x,0)) | (x = 0..tbWidth-1) costL = Σ| R(-1,x) - (P(0,y) + r(0,y)) | (y = 0..tbHeight-1) costU indicates the cost for the adjacent pixel above (cost in the upward direction), and costL indicates the cost for the adjacent pixel on the left (cost in the left direction). R(x,y) indicates the decoded pixel value at coordinates (x,y) of the adjacent block, P(x,y) indicates the predicted pixel value at coordinates (x,y) of the target block, and r(x,y) indicates the residual value at coordinates (x,y) of the target block. The predicted pixel value P(x,y) plus the residual value r(x,y) becomes the decoded pixel value of the target block (R'(x,y) in FIG. 12).
[0126] (Another embodiment of sign prediction: transform coefficient sorting) The sign prediction unit 31110 may predict the code in descending order of the absolute value AbsLevel of the transform coefficients. Specifically, the sign prediction unit 31110 may perform descending sorting on the AbsLevel[n] at the position n decoded by the TU decoding unit 3024, and perform prediction in descending order.
[0127] Furthermore, when dependent quantization is used (sh_dep_quant_used_flag is 1), the sign prediction unit 31110 performs temporary inverse quantization on AbsCoeff. sh_dep_quant_used_flag is a flag indicating whether dependent quantization is used in the current slice, and when it is 1, it indicates that dependent quantization is used. The temporary inverse quantization updates the state state for each scan position n according to the update equation of state. Then, an offset according to state is added / subtracted to / from the left shift value of AbsLevel[n]. The sign prediction unit 31110 may perform the following process as temporary inverse quantization. n is the scan position of the transform coefficient. state = 0 for each n / / for (n = lastScanIdx; n >= 0; n--) level = AbsLevel[n] qIdx = (level << 1) - (state & 1) state = ((stateTransTab >> ((state << 3) + ((level & 1) << 2))) & 15) stateTransTab is one of 0, 587280912, and 6274468666787591456, and the parameter decoding unit 302 may decode information on which one to use. The sign prediction unit 31110 may sort the transform coefficients (qIdx) that have been subjected to temporary inverse quantization, and perform sign prediction in descending order of the transform coefficients with the largest values. When the dependent quantization has four or eight stages, the following processing may be performed, respectively. qIdx = (level << 3) - (state & 3) qIdx = (level << 4) - (state & 7) Since code candidates are predicted in order of transform coefficients that have a greater influence on boundary residuals, more accurate sign prediction is possible, resulting in improved coding efficiency.
[0128] (Another embodiment of signature prediction: LFNST) The sign predictor 31110 may change the maximum number of codes to be predicted, maxNumPredSigns, depending on whether or not a non-separable transform (LFNST) is used. Specifically, the sign predictor 31110 may set maxNumPredSigns as follows.
[0129] maxNumPredSigns = ApplyLfnstFlag[cIdx] == 0 ? sps_num_pred_signs : 4 Note that maxNumPredSigns is not limited to the above numbers.
[0130] (Another embodiment of signature prediction: Block size limit) The parameter decoding unit 302 may apply sign prediction using the block size. Specifically, the parameter decoding unit 302 decodes the maximum block size spArea for which sign prediction is possible, and the sign predictor 31110 derives signPredWidth and signPredHeight as follows. signPredWidth = min(tbWidth, spArea) signPredHeight = min(tbHeight, spArea) tbWidht and tbHeight are the width and height of the target block size. The sign prediction unit 31110 performs sign prediction on transform coefficients within a range indicated by (signPredWidth) x (signPredHeight) from the top left of the target TU block.
[0131] (Another embodiment of sign prediction: block size dependent) In sign prediction, as the number of predicted codes increases, the number of pixels in the boundary residuals rises exponentially, and the amount of calculation required also increases. For example, if there are eight predicted codes, 2^8=256 calculations are required. Since the amount of calculation per pixel (the number of pixels in the boundary residuals) determines the throughput, it is preferable to keep the number of predicted codes below a certain value.
[0132] In this embodiment, the maximum number of codes to be predicted, maxNumPredSigns, is changed according to the block size. The sign prediction unit 31110 may derive maxNumPredSigns as follows according to the width tbWidth and height tbHeight of the block. maxNumPredSigns = log2(tbWidth) + log2(tbHeight) - 2 According to the above formula, for example, when the block size is 4x4, maxNumPredSigns is 2, and when the block size is 16x16, maxNumPredSigns is 6. In this case, the following formula is established. Complexity = 2^(log2(tbWidth) + log2(tbHeight) - 2) / (tbWidth * tbHeight) = (2^log2(tbWidth) * 2^log2(tbHeight) / 2^2) / (tbWidth * tbHeight) = tbWidth * tbHeight / 4 / (tbWidth * tbHeight) = 1 / 4 From the above formula, the number of boundary residuals (calculation amount) per pixel is 0.25 for all tbWidth and tbHeight.
[0133] The signature predictor 31110 may derive maxNumPredSigns as follows: maxNumPredSigns = log2(tbWidth) + log2(tbHeight) - NPbase Here, NPbase is a predetermined constant equal to or greater than 0, such as 2. For example, if the amount of calculation for one pixel value is NP, then maxNumPredSigns can be derived using the following formula. 2^maxNumPredSigns / (tbWidth*tbHeight) = NP 2^maxNumPredSigns = NP * (tbWidth*tbHeight) maxNumPredSigns = log2(NP) + log2(tbWidth) + log2(tbHeight) Here, the above formula is obtained by setting NPbase = -log2(NP). If NP=1 / 4, then NPbase=2. It can also be derived as follows using the restricted width and height mentioned above. maxNumPredSigns = log2(signPredWidth) + log2(signPredHeight) - NPbase According to the above formula, the amount of calculation for one pixel value is NP regardless of the block size.
[0134] The signature prediction unit 31110 may derive maxNumPredSigns as follows.
[0135] maxNumPredSigns = NPW * min(log2(tbWidth), log2(tbHeight)) - NPbase2 Here, NPW and NPbase2 are predetermined constants equal to or greater than 0, such as 2. Note that min and log2 have the same value even if their orders are different.
[0136] maxNumPredSigns = NPW * log2(min(tbWidth, tbHeight)) - NPbase2 According to the above formula, the worst case complexity is NP.
[0137] Also, the signature prediction unit 31110 may derive maxNumPredSigns by referring to a table. For example, maxNumPredSigns may be as follows:
[0138] idx = log2(tbWidth) + log2(tbHeight) - NPbase MaxNumPredSignsTable[] = { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, …} maxNumPredSigns = MaxNumPredSignTable[idx] idx can be calculated as follows:
[0139] idx = log2(NP) + log2(tbWidth) + log2(tbHeight) Also, the number of maxNumPredSigns may be reduced according to the target block size. For example, the following may be used.
[0140] maxNumPredSigns = 4 (block size is less than or equal to a given size) maxNumPredSigns = 8 (otherwise) Also, multiple stages may be switched.
[0141] maxNumPredSigns = 4 (block size is less than or equal to the given size 1) maxNumPredSigns = 6 (other than the above, block size is less than or equal to the given size 2) maxNumPredSigns = 8 (otherwise) The predetermined size of the block size is 4x4, 8x8, etc. Alternatively, the predetermined size may be set as a minimum block size, and the number of maxNumPredSigns may be reduced when the size of the target block is the minimum block size.
[0142] According to the present embodiment, the video decoding device and the video encoding device are characterized in that the maximum number of codes of transform coefficients to be predicted in sign prediction is changed according to the block size, thereby achieving the effect of not increasing the worst-case calculation amount regardless of the block size.
[0143] (Another embodiment of signature prediction: QP dependent) The sign prediction unit 31110 may change the operation of sign prediction according to parameters used for decoding transform coefficients of a target block. For example, the maximum number of codes to be predicted, maxNumPredSigns, may be changed according to a quantization parameter (currQP) of the target block. Specifically, the sign prediction unit 31110 may set a larger value of maxNumPredSigns as the currQP increases, as follows:
[0144] maxNumPredSigns = Clip3(0, 8, currQP - NPbaseQP) NPbaseQP is a number for offsetting currQP. For example, 18 or 22 may be used, but is not limited to these. As a result, the smaller the currQP, the smaller the maxNumPredSigns, and the less computational effort is required. In general, the smaller the quantization parameter, the more computational effort is required. Therefore, it is more effective to reduce the computational effort of sign prediction as the quantization parameter becomes smaller.
[0145] Alternatively, it may be derived by multiplying currQP by a factor NPfactor as follows:
[0146] maxNumPredSigns = Clip3(0, 8, Round(NPfactor*(currQP - NPbaseQP))) NPfactor is a coefficient for adjusting the offset quantization parameter value. In combination with NPbaseQP, the relationship between currQP and maxNumPredSigns can be expressed linearly. For example, 0.5 (1 / 2), 1, 2, etc. can be used, but this is not limited to these. Here, the value is converted to an integer using Round(), but rounding down Floor() or rounding up Ceil() can also be used instead of rounding.
[0147] Or you can reference the table as follows:
[0148] maxNumPredSigns = TableMaxNumPredSignsFromQP[currQP] Here, TableMaxNumPredSignsFromQP is a table for converting currQP to maxNumPredSigns. Each element of the table is a possible value of maxNumPredSigns. By using this method, currQP and maxNumPredSigns can be nonlinearly mapped. For example, each element of the table may be set so that a relatively large maxNumPredSigns is derived in the central part of the value range of the quantization parameter.
[0149] According to the present embodiment, the video decoding device and the video coding device change the maximum number of codes of the transform coefficients predicted in the sign prediction according to the quantization parameter (QP), thereby achieving the effect of not increasing the amount of calculations that depend on the quantization parameter.
[0150] (Another embodiment of sign prediction: transform coefficient dependent) The sign prediction unit 31110 may change the operation of the sign prediction according to the parameters used for decoding the transform coefficients. In particular, whether or not to perform the sign prediction may be switched according to the state of the transform coefficients of the target block. In addition, the maximum number of codes to be predicted, maxNumPredSigns, may be changed according to the state of the transform coefficients of the target block. When the transform coefficients become large, the processing amount of encoding and decoding increases, so the processing amount by the sign prediction and the processing amount of the coefficient encoding and decoding increase. The worst case can be reduced by the following operation. Also, when the transform coefficients increase, the relative code amount of the code itself decreases, so the sign prediction processing amount does not match up. Therefore, it is appropriate to turn off the sign prediction in terms of coding efficiency. Note that the state of the transform coefficients may be the last position, the number of transform coefficients, the number of values of sig_coeff_flag, gt1 flag (or abs_level_gtx_flag[n][0]), gt2 flag (or abs_level_gtx_flag[n][1]), or the number of values derived from the values. sig_coeff_flag is a flag indicating whether the coefficient is non-zero. The gt1 flag is a flag indicating whether the absolute value of the coefficient is greater than 1. The gt2 flag is a flag indicating whether the absolute value of the coefficient is greater than 2. The abs_level_gtx_flag[n][1] is a flag indicating whether the absolute value of the coefficient is greater than 3. As shown in FIG. 7, in a configuration in which the value (remBinPass1) is decremented by 1 each time the flag is decoded, it is complicated when remBinPass1 becomes 0. Therefore, a configuration in which no sign prediction is performed or a configuration in which maxNumPredSigns is reduced may be used. Alternatively, instead of decrementing, a configuration in which a variable is incremented each time the flag is decoded and, when the variable exceeds a predetermined number, no sign prediction is performed or maxNumPredSigns is reduced may be used.
[0151] (Another embodiment of sign prediction: transform coefficient last dependency) The sign prediction unit 31110 may use the LAST position as the state of the transform coefficient, and set maxNumPredSigns to be smaller as the position of the LAST coefficient is in a higher frequency region (as the coordinate is larger).
[0152] maxNumPredSigns = Clip3(0, 8, 8 - (LastSignificantCoeffX + LastSignificantCoeffY)>>3) Here, LastSignificantCoeffX and LastSignificantCoeffY are the positions (X, Y) of the last coefficient, with the top left corner of the target block being the reference (0, 0).
[0153] In addition, maxNumPredSigns may be switched according to a predetermined threshold value TH as follows.
[0154] maxNumPredSigns = LastSignificantCoeffX + LastSignificantCoeffY > TH ? M : N M and N are predetermined constants (M < N). For example, M=2, N=4.
[0155] Furthermore, when the position of the LAST coefficient is in a high frequency region, the sign prediction may not be performed.
[0156] if (LastSignificantCoeffX + LastSignificantCoeffY > TH) { Make a sign prediction } else { No sign prediction } The following is also acceptable.
[0157] maxNumPredSigns = LastSignificantCoeffX + LastSinificantCoeffY > TH ? 0 : N Furthermore, the following may be done:
[0158] if (LastSignificantCoeffX >= TH || LastSignificantCoeffY >= TH) { Make a sign prediction } else { No sign prediction } For example, if the sub-block size of the transform unit is 4x4, TH may be set to 4.
[0159] Alternatively, it may be derived by calculation.
[0160] maxNumPredSigns = (LastSignificantCoeffX + LastSinificantCoeffY) / NPLastDiv maxNumPredSigns = (LastSignificantCoeffX + LastSinificantCoeffY) >> NPLastShift Here, NPLastDiv and NPLastShift are predetermined constants or values derived from the block size.
[0161] (Alternative embodiment of sign prediction: number of transform coefficients, number of transform coefficients larger than a given value) The sign prediction unit 31110 may control the sign prediction process according to the number of non-zero transform coefficients of the current block or the number of transform coefficients greater than a predetermined value. For example, the sign prediction unit 31110 may switch on and off the sign prediction according to the value of levelCodedCoeff as follows:
[0162] if (levelCodedCoeff > NPth) { Make a sign prediction } else { No sign prediction } Here, levelCodedCoeff may be the number of non-zero transform coefficients, numCodedCoeff, or levelCodedCoeff may be the sum of abs_level_gtx_flag[n][0], the sum of abs_level_gtx_flag[n][1], the sum of abs_level_gtx_flag[n][0] and abs_level_gtx_flag[n][1], or the decoded number of each of the syntax elements.
[0163] NPth is a predetermined threshold value, and may be a constant, a value derived from maxNumPredSigns, or a value derived from the block size.
[0164] Furthermore, the sign predictor 31110 may set maxNumPredSigns to be smaller as the number of non-zero transform coefficients numCodedCoeff is smaller, as follows: numCodedCoeff may be derived from the total value of sig_coeff_flag.
[0165] maxNumPredSigns = levelCodedCoeff / NPNumDiv maxNumPredSigns = levelCodedCoeff >> NPNumShift NPNumDiv and NPNumShift are predetermined constants or values derived from the block size. Furthermore, the sign prediction unit 31110 may change the number of sign predictions when levelCodedCoeff exceeds a predetermined number NPth.
[0166] if (levelCodedCoeff > NPth) { maxNumPredSigns = maxNumPredSigns / NPdiv } For example, NPth=maxNumPredSigns*4 may be used, where NPdiv is a constant such as 2. Alternatively, NPsub may be subtracted as follows, where NPsub is a constant such as 1 or 2.
[0167] if (levelCodedCoeff > NPth) { maxNumPredSigns = maxNumPredSigns - NPsub } Alternatively, maxNumPredSigns may be made smaller in proportion to levelCodedCoeff as follows:
[0168] maxNumPredSigns = Clip3(0, 8, maxNumPredSigns * levelCodedCoeff / NPdiv) According to the present embodiment, the maximum number of signs of transform coefficients to be predicted in sign prediction is changed depending on the state of the transform coefficients, which has the effect of preventing an increase in the amount of calculation depending on the state of the transform coefficients.
[0169] (Another embodiment of signature prediction: exclusive) Since the sign prediction uses the results of the inverse quantization and inverse transform of the transform coefficients, the inverse quantization and inverse transform cannot be parallelized. That is, the inverse quantization and inverse transform processes are added to the sign prediction, which increases the number of cycles required to derive the residual. In this embodiment, the sign prediction, the non-separable transform, and the scaling using the scaling matrix are performed exclusively, thereby suppressing the increase in the number of cycles.
[0170] (Sign prediction and non-separable transformation exclusion
[0171] (Sequence-level exclusive) 13(a), the parameter decoding unit 302 decodes sps_lfnst_enabled_flag from the encoded data, and decodes sps_sign_prediction_enabled_flag only if sps_lfnst_enabled_flag is 0. If sps_lfnst_enabled_flag is 1, sps_sign_prediction_enabled_flag is not decoded and is inferred to be 0.
[0172] The following order may also be reversed:
[0173] 13(b), the parameter decoding unit 302 decodes sps_sign_prediction_enabled_flag from the encoded data, and decodes sps_lfnst_enabled_flag only if sps_sign_prediction_enabled_flag is 0. If sps_sign_prediction_enabled_flag is 1, sps_lfnst_enabled_flag is not decoded and is inferred to be 0.
[0174] Although the above describes the exclusive processing performed between SPS parameters, a similar decoding process may be performed between the non-separable transform flag of the SPS and the sign prediction flag sh_sign_prediction_enabled_flag of the slice header to operate exclusively.
[0175] (Target block level exclusive) The sign prediction unit 31110 does not perform sign prediction on the current block when a non-separable transform is used on the current block, that is, when ApplyLfstFlag !=0 (lfnst_idx !=0) on the current block. In addition, when a non-separable transform is used on the current block, the parameter decoding unit 302 decodes a code instead of a code prediction parameter.
[0176] In this case, isSignPredictedTU may be set to 1 if all of the following conditions are met: sps_num_pred_signs is greater than 0 - Conversion skip is not used in the target block TU block size width 4 or more, height 4 or more TU block size width is less than maxSize, height is less than maxSize - The target sub-block size is 4 or more in width and 4 or more in height The target sub-block is within the range of (spRange) x (spRange) from the top left position of the target block. Do not use non-separable transformation on the target block (ApplyLfnstFlag[cIdx]==0) Alternatively, isSignPredictedTU may be set to 1 if all of the following conditions are met: · isSignPredictedSubTU is 1 Do not use non-separable transformation on the target block (ApplyLfnstFlag[cIdx]==0) According to the above configuration, since the non-separable transform and the sign prediction are not performed simultaneously, an increase in latency can be avoided.
[0177] (Configuration of a video encoding device) Next, the configuration of the video encoding device 11 according to this embodiment will be described. Fig. 14 is a block diagram showing the configuration of the video encoding device 11 according to this embodiment. The video encoding device 11 includes a prediction image generating unit 101, a subtraction unit 102, a transformation and quantization unit 103, an inverse quantization and inverse transformation unit 105, an addition unit 106, a loop filter 107, a prediction parameter memory (prediction parameter storage unit, frame memory) 108, a reference picture memory (reference image storage unit, frame memory) 109, an encoding parameter determining unit 110, a parameter encoding unit 111, a prediction parameter derivation unit 120, and an entropy encoding unit 104.
[0178] The predicted image generating unit 101 generates a predicted image for each CU.
[0179] The subtraction unit 102 generates a prediction error by subtracting the pixel values of the predicted image of the block input from the predicted image generation unit 101 from the pixel values of the image T. The subtraction unit 102 outputs the prediction error to the transformation and quantization unit 103.
[0180] The transform / quantization unit 103 calculates transform coefficients by frequency transforming the prediction errors input from the subtraction unit 102, and derives quantized transform coefficients by quantizing the prediction errors. The transform / quantization unit 103 outputs the quantized transform coefficients to the parameter coding unit 111 and the inverse quantization / inverse transform unit 105.
[0181] The transform / quantization unit 103 includes a separation transform unit (first transform unit), a non-separation transform unit (second transform unit), and a scaling unit.
[0182] The separate transform unit applies a separate transform to the prediction error. The non-separable transform unit performs a non-separable transform if ApplyLfnstFlag is not 0. The scaling unit scales the transform coefficients using a quantization matrix.
[0183] Specifically, the transformation and quantization unit 103 performs the following processes.
[0184] S1: The separation conversion unit performs separation conversion.
[0185] S2: The non-separable transformation unit determines whether the non-separable transformation is enabled (ApplyLfnstFlag!=0).
[0186] S3: If the non-separable transform is valid, the non-separable transform unit performs a non-separable transform (forward non-separable transform).
[0187] S3B: If the non-separable transformation is not valid, the non-separable transformation unit does not perform the non-separable transformation (forward non-separable transformation).
[0188] S4: The scaling unit performs scaling on the transform coefficients using a quantization matrix.
[0189] The (forward) non-separable transform performs approximately the same processing as the inverse non-separable transform.
[0190] The inverse quantization and inverse transform unit 105 is the same as the inverse quantization and inverse transform unit 311 in the video decoding device 31, and a description thereof will be omitted.
[0191] The parameter coding unit 111 includes a header coding unit 1110, a CT information coding unit 1111, and a CU coding unit 1112 (prediction mode coding unit). The CU coding unit 1112 further includes a TU coding unit 1114. The following describes an outline of the operation of each module.
[0192] The header encoding unit 1110 performs encoding processing of parameters such as header information, division information, prediction information, and quantized transform coefficients.
[0193] The CT information encoding unit 1111 encodes the QT, MT (BT, TT) division information and the like.
[0194] The CU encoding unit 1112 encodes the CU information, prediction information, division information, and so on.
[0195] When a prediction error is included in a TU, the TU encoding unit 1114 encodes the QP update information and the quantized prediction error.
[0196] The CT information encoding unit 1111 and the CU encoding unit 1112 supply syntax elements such as inter prediction parameters, intra prediction parameters, and quantized transform coefficients to the parameter encoding unit 111.
[0197] The entropy coding unit 104 receives the quantized transform coefficients and coding parameters (division information, prediction parameters) from the parameter coding unit 111. The entropy coding unit 104 entropy codes these to generate and output a coded stream Te.
[0198] The prediction parameter derivation unit 120 derives intra prediction parameters and inter prediction parameters from the parameters input from the encoding parameter determination unit 110. The derived intra prediction parameters and inter prediction parameters are output to the parameter encoding unit 111.
[0199] The adder 106 generates a decoded image by adding, for each pixel, the pixel value of the predicted block input from the predicted image generation unit 101 and the prediction error input from the inverse quantization and inverse transform unit 105. The adder 106 stores the generated decoded image in a reference picture memory 109.
[0200] The loop filter 107 performs deblocking filtering, SAO, and ALF on the decoded image generated by the adder 106. Note that the loop filter 107 does not necessarily have to include the above three types of filters, and may be configured, for example, as only a deblocking filter.
[0201] The prediction parameter memory 108 stores the prediction parameters generated by the coding parameter determination unit 110 in a predetermined location for each current picture and CU.
[0202] The reference picture memory 109 stores the decoded image generated by the loop filter 107 at a predetermined position for each current picture and CU.
[0203] The coding parameter determination unit 110 selects one set from among a plurality of sets of coding parameters. The coding parameters are the above-mentioned QT, BT or TT division information, prediction parameters, or parameters to be coded that are generated in relation to these. The predicted image generation unit 101 generates a predicted image using these coding parameters.
[0204] The coding parameter determination unit 110 calculates an RD cost value indicating the magnitude of the information amount and the coding error for each of the multiple sets. The RD cost value is, for example, the sum of the code amount and the value obtained by multiplying the squared error by a coefficient λ. The code amount is the information amount of the coding stream Te obtained by entropy coding the quantization error and the coding parameters. The squared error is the sum of the squares of the prediction errors calculated in the subtraction unit 102. The coefficient λ is a real number greater than zero that is set in advance. The coding parameter determination unit 110 selects a set of coding parameters that minimizes the calculated cost value. The coding parameter determination unit 110 outputs the determined coding parameters to the parameter coding unit 111 and the prediction parameter derivation unit 120.
[0205] In addition, a part of the video encoding device 11 and the video decoding device 31 in the above-mentioned embodiment, for example, the entropy decoding unit 301, the parameter decoding unit 302, the loop filter 305, the predicted image generating unit 308, the inverse quantization and inverse transform unit 311, the addition unit 312, the prediction parameter derivation unit 320, the predicted image generating unit 101, the subtraction unit 102, the transform and quantization unit 103, the entropy coding unit 104, the inverse quantization and inverse transform unit 105, the loop filter 107, the coding parameter determination unit 110, the parameter coding unit 111, and the prediction parameter derivation unit 120 may be realized by a computer. In this case, a program for realizing this control function may be recorded in a computer-readable recording medium, and the program recorded in the recording medium may be read into and executed by a computer system. In addition, the "computer system" referred to here is a computer system built into either the video encoding device 11 or the video decoding device 31, and includes hardware such as an OS and peripheral devices. In addition, "computer-readable recording medium" refers to portable media such as flexible disks, optical magnetic disks, ROMs, and CD-ROMs, and storage devices such as hard disks built into computer systems. Furthermore, "computer-readable recording medium" may also include devices that dynamically hold a program for a short period of time, such as a communication line when transmitting a program via a network such as the Internet or a communication line such as a telephone line, and devices that hold a program for a certain period of time, such as volatile memory inside a computer system that serves as a server or client in such cases. Furthermore, the above program may be one that realizes part of the above-mentioned functions, or may be one that can realize the above-mentioned functions in combination with a program already recorded in the computer system.
[0206] In addition, a part or the whole of the video encoding device 11 and the video decoding device 31 in the above-mentioned embodiment may be realized as an integrated circuit such as an LSI (Large Scale Integration). Each functional block of the video encoding device 11 and the video decoding device 31 may be individually made into a processor, or a part or the whole may be integrated into a processor. The integrated circuit method is not limited to LSI, and may be realized by a dedicated circuit or a general-purpose processor. Furthermore, when an integrated circuit technology that replaces LSI appears due to the progress of semiconductor technology, an integrated circuit based on that technology may be used.
[0207] Although one embodiment of the present invention has been described in detail above with reference to the drawings, the specific configuration is not limited to the above, and various design changes, etc. are possible within the scope that does not deviate from the gist of the present invention.
[0208] The present invention is not limited to the above-described embodiment, and various modifications are possible within the scope of the claims. In other words, the technical scope of the present invention also includes embodiments obtained by combining technical means that are appropriately modified within the scope of the claims. [Industrial Applicability]
[0209] The embodiments of the present invention can be suitably applied to a video decoding device that decodes coded data in which image data is coded, and a video coding device that generates coded data in which image data is coded, and can also be suitably applied to the data structure of coded data that is generated by a video coding device and referenced by the video decoding device. [Explanation of symbols]
[0210] 31 Video Decoding Device 301 Entropy Decoding Unit 302 Parameter Decoding Unit 3022 CU Decoding Unit 3024 TU Decoding Unit 305, 107 Loop Filter 306, 109 Reference Picture Memory 307, 108 Prediction parameter memory 308, 101 Prediction image generation unit 309 Inter-prediction image generation unit 311, 105 Inverse quantization and inverse transformation unit 31110 Sign Prediction Unit 312, 106 Addition section 320 Prediction parameter derivation part 11 Video Encoding Device 102 Subtraction section 103 Transformation and Quantization Section 104 Entropy coding unit 110 Encoding parameter determination unit 111 Parameter Encoding Unit 120 Prediction parameter derivation part
Claims
1. A video decoding device comprising: a parameter decoding unit that decodes a transform coefficient and a sign prediction parameter from encoded data; and a sign prediction unit that predicts a sign of the transform coefficient, the sign prediction unit derives a cost for a candidate combination of signs of a transform coefficient having no sign information by referring to a boundary pixel with an adjacent block, and predicts the sign based on the cost; A video decoding device, comprising: a parameter decoding unit that decodes a code prediction parameter; and a parameter decoding unit that decodes a code prediction parameter.
2. 2 . The video decoding device according to claim 1 , wherein the sign prediction unit changes an operation of the sign prediction depending on a parameter used for decoding the transform coefficients of a current block.
3. 3. The video decoding device according to claim 2, wherein the parameter used in decoding the transform coefficients is a quantization parameter.
4. 3. The video decoding device according to claim 2, wherein the parameter used in decoding the transform coefficients is the last position of the transform coefficients.
5. 3. The video decoding device according to claim 2, wherein the parameter used in decoding the transform coefficient is a syntax element indicating whether the transform coefficient is greater than a predetermined value.
6. 2 . The video decoding device according to claim 1 , wherein the sign prediction unit determines whether or not to perform sign prediction depending on parameters used in decoding transform coefficients of a current block.
7. 2. The video decoding device according to claim 1, wherein the sign prediction unit changes the number of codes to be predicted in accordance with a parameter used in decoding the transform coefficients of a current block.
8. A video encoding device comprising: a parameter encoding unit that encodes a transform coefficient and a sign prediction parameter; and a sign prediction unit that predicts a sign of the transform coefficient, the sign prediction unit derives a cost for a candidate combination of signs of a transform coefficient having no sign information by referring to a boundary pixel with an adjacent block, and predicts the sign based on the cost; A video coding apparatus comprising: a code prediction parameter indicating whether a predicted code is the same as a code of the transform coefficient;
9. 9. The video encoding device according to claim 8, wherein the sign prediction section changes the number of codes to be predicted depending on a quantization parameter of a current block.
Citation Information
Patent Citations
Low-complexity sign prediction for video coding
US20180176556A1
Residual sign prediction of transform coefficients in video coding
US20230093994A1
