Image Encoding / Decoding Method and Non-Transitory Computer Readable Recording Medium
By deriving the scaling factor according to the block type in the image decoding method and scaling the image block based on this factor, the problem of low image encoding/decoding efficiency in the prior art is solved, and a more efficient encoding and decoding process is realized.
Patent Information
- Application Number
- CN202210015288.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2012-07-02
- Filing Date
- 2013-07-02
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2033-07-02
AI Technical Summary
In the prior art, it is difficult to effectively improve the encoding/decoding efficiency in the process of image encoding and decoding, especially when processing scaling transformation coefficients and quantization/inverse quantization transformation jump blocks.
In the image decoding method, a scaling factor is derived based on whether the current block is a transform skip block, and the current block is scaled based on the scaling factor. Specifically, if the current block is a transform jump block or does not use a quantization matrix, the basic scaling factor is used without considering the location of the transform coefficient; if the current block is not a transform jump block, the scaling factor is derived using the quantization matrix based on the location of the transform coefficient.
The efficiency of image encoding and decoding is improved, especially when processing transform skip blocks, and the reduction in encoding efficiency due to inappropriate scaling methods is avoided.
Smart Images

Figure CN115052157B_ABST
Abstract
Description
[0001] This application is a divisional application of the invention patent application with the application date of July 2, 2013, application number 201380042182.2, and invention name "Methods and Devices for Encoding / Decoding Images". Technical Field
[0002] The present invention relates to the encoding / decoding of images, and more particularly, to methods and devices for scaling transform coefficients. Background Art
[0003] Broadcast services with high definition (HD) resolution (1280x1024 or 1920x1080) are expanding nationwide and worldwide. Therefore, many users are accustomed to videos with high resolution and high picture quality. As a result, many institutions are promoting the development of next-generation image devices. In addition, because there is a growing interest in ultra-high definition (UHD) with a resolution four times higher than HDTV and the growth of HDTV, the Moving Picture Experts Group (MPEG) and the Video Coding Experts Group (VCEG) have recognized the need for compression technologies for images with higher resolution and higher picture quality. In addition, there is an urgent need for a new standard that can maintain the same picture quality and has many advantages in terms of bandwidth or storage with a higher compression efficiency than the H.264 / AVC currently used in HDTVs, mobile phones, and Blu-ray players.
[0004] Nowadays, the Moving Picture Experts Group (MPEG) and the Video Coding Experts Group (VCEG) are jointly standardizing High Efficiency Video Coding (HEVC) (i.e., the next-generation video codec), and the aim is to encode images including UHD images with a compression efficiency twice that of H.264 / AVC. This can provide images with lower frequencies and higher picture quality than current images even in 3D broadcasts and mobile communication networks, as well as HD and UHD images. Summary of the Invention
[0005]
Technical Problem
[0006] The present invention provides methods and devices for encoding and decoding images that can improve encoding / decoding efficiency.
[0007] The present invention provides methods and devices for scaling transform coefficients (or residual signals) that can improve encoding / decoding efficiency.
[0008] The present invention provides methods and devices for quantizing / inverse quantizing transform skip blocks that can improve encoding / decoding efficiency.
[0009]
Technical Solution
[0010] According to one aspect of the present invention, an image decoding method is provided. The image decoding method includes: deriving a scaling factor for a current block depending on whether the current block is a transform skip block, and performing scaling on the current block based on the scaling factor.
[0011] Deriving the scaling factor for the current block based on the location of transform coefficients within the current block, and the transform skip block is a block to which no transform has been applied to the current block and is defined based on information indicating whether an inverse transform is applied to the current block.
[0012] In the step of deriving the scaling factor for the current block, if the current block is a transform skip block, a basic scaling factor may be derived regardless of the location of transform coefficients within the current block.
[0013] The basic scaling factor may have a specific scaling factor value, and the specific scaling factor value may be 16.
[0014] The basic scaling factor may have different scaling factor values depending on whether the current block uses a quantization matrix.
[0015] The basic scaling factor may have different scaling factor values depending on whether the current block is a luminance block or a chrominance block.
[0016] A flag indicating whether a transform skip algorithm is used in a picture including the current block may be signaled through a picture parameter set (PPS).
[0017] The basic scaling factor may include information on scaling factors for luminance signals and chrominance signals.
[0018] In the step of deriving the scaling factor for the current block, if the current block is a transform skip block or the current block does not use a quantization matrix, a basic scaling factor may be derived regardless of the location of transform coefficients within the current block.
[0019] In the step of deriving the scaling factor for the current block, if the current block is not a transform skip block, the scaling factor for the current block may be derived using a quantization matrix based on the location of transform coefficients within the current block.
[0020] According to another aspect of the present invention, an image decoding device is provided. The image decoding device includes: an inverse quantization unit for deriving a scaling factor for a current block depending on whether the current block is a transform skip block, and performing scaling on the current block based on the scaling factor.
[0021] The scaling factor for the current block may be derived based on the location of transform coefficients within the current block, and the transform skip block may be a block to which no transform has been applied to the current block and is defined based on information indicating whether an inverse transform is applied to the current block.
[0022] According to another aspect of the present invention, there is provided an image encoding method. The image encoding method includes the following steps: deriving a scaling factor for a current block depending on whether the current block is a transform skip block, and performing scaling on the current block based on the scaling factor.
[0023] The scaling factor for the current block may be derived based on the locations of transform coefficients within the current block, and the transform skip block may be a block to which no transform has been applied to the current block, and is specified based on information indicating whether an inverse transform is applied to the current block.
[0024] In the step of deriving the scaling factor for the current block, if the current block is a transform skip block, a basic scaling factor may be derived regardless of the locations of transform coefficients within the current block.
[0025] The basic scaling factor may have a specific scaling factor value, and the specific scaling factor value may be 16.
[0026] The basic scaling factor may have different scaling factor values depending on whether the current block uses a quantization matrix.
[0027] The basic scaling factor may have different scaling factor values depending on whether the current block is a luminance block or a chrominance block.
[0028] A flag indicating whether a transform skip algorithm is used in a picture including the current block is signaled by a picture parameter set (PPS).
[0029] The basic scaling factor may include information on scaling factors for luminance signals and chrominance signals.
[0030] In the step of deriving the scaling factor for the current block, if the current block is a transform skip block or the current block does not use a quantization matrix, a basic scaling factor may be derived regardless of the locations of transform coefficients within the current block.
[0031] In the step of deriving the scaling factor for the current block, if the current block is not a transform skip block, the scaling factor for the current block may be derived using a quantization matrix based on the locations of transform coefficients within the current block.
[0032] According to another aspect of the present invention, there is provided an image encoding apparatus. The image encoding apparatus includes a quantization unit configured to derive a scaling factor for a current block depending on whether the current block is a transform skip block, and perform scaling on the current block based on the scaling factor.
[0033] The scaling factor for the current block may be derived based on the locations of the transform coefficients within the current block, and the transform skip block may be a block to which a transform has not yet been applied to the current block, and is specified based on information indicating whether an inverse transform is applied to the current block.
[0034]
Advantageous Effects
[0035] Blocks to which the transform skip algorithm has been applied and existing blocks for which transform / inverse transform processing has been performed have different transform coefficient characteristics because transform / inverse transform processing is not performed on blocks to which the transform skip algorithm has been applied. That is, if the scaling method applied to existing blocks for which transform / inverse transform processing has been performed is applied to transform skip blocks, the coding / decoding efficiency can be reduced. Therefore, by applying the scaling factor to transform skip blocks as well, regardless of the locations of the transform coefficients within the blocks, the coding and decoding efficiencies can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 is a block diagram showing the configuration of an image coding device to which an embodiment of the present invention is applied;
[0037] Figure 2 is a block diagram showing the configuration of an image decoding device to which an embodiment of the present invention is applied;
[0038] Figure 3 is a diagram schematically showing the partition structure of an image when encoding the image;
[0039] Figure 4 is a diagram showing the forms of PUs that may be included in a CU;
[0040] Figure 5 is a diagram showing the forms of TUs that may be included in a CU;
[0041] Figure 6 is a flowchart illustrating a method of scaling a residual signal (or transform coefficients) according to an embodiment of the present invention; and
[0042] Figure 7 is a flowchart illustrating a method of scaling a residual signal (or transform coefficients) according to another embodiment of the present invention. DETAILED DESCRIPTION
[0043] Thereafter, some exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings. In addition, when describing the embodiments of this specification, detailed descriptions of known functions and configurations will be omitted if they are considered to unnecessarily obscure the gist of the present invention.
[0044] In this specification, when an element is considered to be connected or coupled to another element, this may mean that the one element may be directly connected or coupled to the other element, or a third element may be connected or coupled between the two elements. Further, in this specification, when an element is considered to include a specific element, this may mean that elements other than the specific element are not excluded, and additional elements may be included within the scope of embodiments of the present invention or the technical spirit of the present invention.
[0045] Terms such as first and second may be used to describe various elements, but these elements are not limited to these terms. Using these terms only differentiates one element from another element. For example, a first element may be referred to as a second element without departing from the scope of the present invention. Similarly, a second element may be referred to as a first element.
[0046] In addition, the element units described in embodiments of the present invention are shown independently to indicate differences and characteristic functions, and this does not mean that each element unit is formed by a single piece of hardware or a single piece of software. That is, for ease of description, these element units are arranged and included, and at least two of these element units may form one element unit, or one element may be divided into multiple element units, and the multiple divided element units may perform functions. Embodiments in which elements are integrated or some elements are separated therefrom are also included within the scope of the present invention unless they depart from the essence of the present invention.
[0047] In addition, in the present invention, some elements are not essential elements for performing necessary functions, but may be optional elements only for improving performance. The present invention may be implemented using only the essential elements for realizing the essence of the present invention rather than elements only for improving performance, and a structure that includes only essential elements and does not include optional elements only for improving functions is included within the scope of the present invention.
[0048] First, for the convenience of improving the description and helping the understanding of the present invention, the terms used in this specification are briefly described.
[0049] A unit means an image encoding or decoding unit. In other words, when encoding or decoding an image, the encoding or decoding unit represents a division unit of an image when the image is sub-divided and encoded or decoded. The unit may also be referred to as a block, a macroblock (MB), a coding unit (CU), a prediction unit (PU), a transform unit (TU), a coding block (CB), a prediction block (PB), or a transform block (TB). A unit can be divided into smaller sub-units.
[0050] A block represents an MxN array of samples. M and N have positive integer values. A block may collectively mean a 2-D form of array.
[0051] A transform unit (TU) is a basic unit when encoding / decoding a residual signal, such as transformation, inverse transformation, quantization, dequantization, and encoding / decoding of transform coefficients. A TU can be partitioned into multiple smaller TUs. Here, if there is a residual signal in block form, the residual signal can be referred to as a residual block.
[0052] The quantization matrix means a matrix used in quantization or dequantization processing to improve the subjective or objective picture quality of an image. The quantization matrix is also referred to as a scaling list.
[0053] The quantization matrix can be divided into a default matrix, a non-default matrix, and a flat matrix. The default matrix can mean a specific quantization matrix predetermined in the encoder and decoder. The non-default matrix may not be predetermined in the encoder and decoder, but can mean a quantization matrix transmitted or received by the user. The flat matrix can mean a matrix in which all elements have the same value.
[0054] Scaling represents the process of multiplying the transform coefficient level by a factor. As a result of this process, transform coefficients are generated. Scaling is also referred to as dequantization.
[0055] The transform coefficient represents the coefficient value generated after performing a transformation. In this specification, the quantized transform coefficient level obtained by applying quantization to the transform coefficient is also referred to as the transform coefficient.
[0056] The quantization parameter represents the value used to scale the transform coefficient level in quantization and dequantization. Here, the quantization parameter can be a value mapped to the quantization step size.
[0057] The parameter set corresponds to information about the headers in the structure of the bitstream. The parameter set has the meaning of collectively specifying a sequence parameter set, a picture parameter set, and an adaptive parameter set.
[0058] Figure 1 is a block diagram showing the configuration of an image coding device to which an embodiment of the present invention is applied.
[0059] Refer to Figure 1 , the image coding device 100 includes a motion estimation module 111, a motion compensation module 112, an intra prediction module 120, a switch 115, a subtractor 125, a transform module 130, a quantization module 140, an entropy coding module 150, a dequantization module 160, an inverse transform module 170, an adder 175, a filter module 180, and a reference picture buffer 190.
[0060] The image encoding device 100 can perform encoding on an input image in an intra mode or an inter mode and output a bitstream. In the case of the intra mode, the switch 115 can be switched to the intra mode. In the case of the inter mode, the switch 115 can be switched to the inter mode. Intra prediction means prediction within a frame, and inter prediction means between frames. The image encoding device 100 can generate a prediction block for an input block of the input image and then encode the difference between the input block and the prediction block. Here, the input image can mean the original picture.
[0061] In the case of the intra mode, the intra prediction module 120 can generate a prediction block by performing spatial prediction using the pixel values of the encoded blocks adjacent to the current block.
[0062] In the case of the inter mode, the motion estimation module 111 can obtain a motion vector by searching for the region in the reference picture stored in the reference picture buffer 190 that best matches the input block in a motion prediction process. The motion compensation module 112 can generate a prediction block by performing motion compensation using the motion vector and the reference picture stored in the reference picture buffer 190. Here, the motion vector is a two-dimensional (2-D) vector used in inter prediction, and the motion vector can indicate the offset between the picture to be encoded / decoded now and the reference picture.
[0063] The subtractor 125 can generate a residual block based on the difference between the input block and the generated prediction block.
[0064] The transform module 130 can perform a transform on the residual block and output transform coefficients according to the transformed block. In addition, the quantization module 140 can output quantized coefficients by quantizing the received transform coefficients according to quantization parameters.
[0065] The entropy encoding module 150 can perform entropy encoding on symbols according to a probability distribution based on the values calculated by the quantization module 140, the encoding parameter values calculated in the encoding process, etc., and output a bitstream according to the entropy-encoded symbols. If entropy encoding is applied, the size of the bitstream for the symbols to be encoded can be reduced because symbols are represented by allocating a small number of bits to symbols with a high occurrence frequency and a large number of bits to symbols with a low occurrence frequency. Therefore, the compression performance of image encoding can be improved by entropy encoding. The entropy encoding module 150 can use encoding methods such as exponential Golomb, context-adaptive variable-length coding (CAVLC), and context-adaptive binary arithmetic coding (CABAC) for entropy encoding.
[0066] According to Figure 1The image encoding device 100 of an embodiment performs inter-frame prediction encoding (i.e., prediction encoding between frames), and thus the encoded pictures need to be decoded and stored for use as reference pictures. Therefore, the quantized coefficients are dequantized by the dequantization module 160 and inverse-transformed by the inverse transformation module 170. The dequantized and inverse-transformed coefficients are added to the prediction block by the adder 175, thereby generating a reconstructed block.
[0067] The reconstructed block passes through the filter module 180. The filter module 180 can apply one or more of a deblocking filter, sample adaptive offset (SAO), and adaptive loop filter (ALF) to the reconstructed block or the reconstructed picture. The filter module 180 may also be referred to as an adaptive in-loop filter. The deblocking filter can remove block distortion generated at the boundaries of blocks. SAO can add an appropriate offset value to pixel values to compensate for encoding errors. ALF can perform filtering based on values obtained by comparing the reconstructed picture with the original picture. The reconstructed block that has passed through the filter module 180 can be stored in the reference picture buffer 190.
[0068] Figure 2 is a block diagram showing the configuration of an image decoding device to which an embodiment of the present invention is applied.
[0069] Reference Figure 2 As shown in, the image decoding device 200 includes an entropy decoding module 210, a dequantization module 220, an inverse transformation module 230, an intra-frame prediction module 240, a motion compensation module 250, a filter module 260, and a reference picture buffer 270.
[0070] The image decoding device 200 can receive a bitstream output from an encoder, perform decoding on the bitstream in an intra-frame mode or an inter-frame mode, and output a reconstructed image (i.e., a reconstructed picture). In the case of the intra-frame mode, the switch can be switched to the intra-frame mode. In the case of the inter-frame mode, the switch can be switched to the inter-frame mode.
[0071] The image decoding device 200 can obtain a reconstructed residual block from the received bitstream, generate a prediction block, and generate a reconstructed block (i.e., a restored block) by adding the reconstructed residual block to the prediction block.
[0072] The entropy decoding module 210 can generate symbols including symbols in the form of quantized coefficients by performing entropy decoding on the received bitstream according to a probability distribution.
[0073] If an entropy decoding method is applied, the size of the bitstream for each symbol can be reduced because symbols are represented by allocating a small number of bits to symbols with a high occurrence frequency and a large number of bits to symbols with a low occurrence frequency.
[0074] The quantized coefficients are inverse quantized by the inverse quantization module 220 and inverse transformed by the inverse transform module 230. As a result of the inverse quantization / inverse transform of the quantized coefficients, a reconstructed residual block can be generated.
[0075] In the case of the intra mode, the intra prediction module 240 can generate a prediction block by performing spatial prediction using the pixel values of the encoded blocks around the current block. In the case of the inter mode, the motion compensation module 250 can generate a prediction block by performing motion compensation using the motion vector and the reference pictures stored in the reference picture buffer 270.
[0076] The adder 255 adds the residual block and the prediction block together. The added block passes through the filter module 260. The filter module 260 can apply at least one of a deblocking filter, SAO, and ALF to the reconstructed block or the reconstructed picture. The filter module 260 outputs a reconstructed image (i.e., the reconstructed picture). The reconstructed image can be stored in the reference picture buffer 270 and can be used for inter prediction.
[0077] Figure 3 is a diagram schematically showing the partitioning structure of an image when encoding an image.
[0078] In High Efficiency Video Coding (HEVC), encoding is performed in a coding unit to partition an image effectively.
[0079] Reference Figure 3 , in HEVC, the image 300 is sequentially partitioned in a largest coding unit (hereinafter referred to as LCU), and the partitioning structure is determined based on the LCU. The partitioning structure means the distribution of coding units (hereinafter referred to as CUs) for effectively encoding the image within the LCU 310. The distribution can be determined based on whether a CU will be partitioned into four CUs, each of which has a width size and a height size reduced by half from one CU. Similarly, a partitioned CU can be recursively partitioned into four CUs, each of which has a width size and a height size reduced by half from the partitioned CU.
[0080] Here, the partitioning of the CU can be recursively performed up to a predetermined depth. The information about the depth is information indicating the size of the CU, and the information about the depth of each CU is stored. For example, the depth of the LCU can be 0, and the depth of the smallest coding unit (SCU) can be the predetermined maximum depth. Here, the LCU is a CU having the above-mentioned maximum CU size, and the SCU is a CU having the smallest CU size.
[0081] As long as the partitioning of the width dimension and half of the height dimension is performed from the LCU 310, the depth of the CU is increased by 1. The CU for which partitioning has not been performed yet has a size of 2N×2N for each depth, and the CU for which partitioning has been performed is partitioned from the CU having a size of 2N×2N into four CUs each having a size of N×N. As long as the depth is increased by 1, the size of N is reduced by half.
[0082] Reference Figure 3 , the size of the LCU with the minimum depth 0 can be 64×64 pixels, and the size of the SCU with the maximum depth 3 can be 8×8 pixels. Here, the LCU with 64×64 pixels can be represented by depth 0, the CU with 32×32 pixels can be represented by depth 1, the CU with 16×16 pixels can be represented by depth 2, and the SCU with 8×8 pixels can be represented by depth 3.
[0083] In addition, information on whether a specific CU will be partitioned can be represented by 1-bit partitioning information for each CU. This partitioning information can be included in all CUs except the SCU. For example, if the CU is not partitioned, the partitioning information 0 can be stored. If the CU is partitioned, the partitioning information 1 can be stored.
[0084] Meanwhile, the CU partitioned from the LCU can include a prediction unit (PU) (or prediction block (PB)) (i.e., the basic unit for prediction), and a transform unit (TU) (or transform block (TB)) (i.e., the basic unit for transform).
[0085] Figure 4 is a diagram showing the form of the PU that can be included in the CU.
[0086] Among the CUs partitioned from the LCU, the CU that is no longer partitioned is partitioned into one or more PUs. This behavior itself is also called partitioning. The prediction unit (hereinafter referred to as PU) is the basic unit for which prediction is performed and is encoded in any one of the skip mode, inter-frame mode, and intra-frame mode. The PU can be partitioned in various forms depending on each mode.
[0087] Reference Figure 4 , in the case of the skip mode, the 2Nx2N mode 410 having the same size as the CU can be supported without partitioning within the CU.
[0088] In the case of the inter-frame mode, 8 forms of partitioning can be supported within the CU, for example, the 2Nx2N mode 410, the 2NxN mode 415, the Nx2N mode 420, the NxN mode 425, the 2NxnU mode 430, the 2NxnD mode 435, the nLx2N mode 440, and the nRx2N mode 445.
[0089] In the case of the intra mode, the 2Nx2N mode 410 and the NxN mode 425 can be supported within a CU.
[0090] Figure 5 FIG. is a diagram showing the form of TUs that can be included in a CU.
[0091] A transform unit (hereinafter referred to as a TU) is a basic unit used for spatial transformation and quantization / inverse quantization (scaling) processing within a CU. A TU can have a rectangular or square form. A CU that is not further partitioned among the CUs partitioned from an LCU partition can be partitioned into one or more TUs.
[0092] Here, the partitioning structure of the TU can be a quadtree structure. For example, as Figure 5 shown, one CU 510 can be partitioned into one or more depending on the quadtree structure, thereby forming TUs having various sizes.
[0093] Meanwhile, in HEVC, as in H.264 / AVC, intra prediction (hereinafter referred to as intra prediction) coding can be performed. Here, coding can be performed by deriving an intra prediction mode (or prediction directionality) for the current block from adjacent blocks located near the current block.
[0094] As described above, the predicted image of the signal obtained by performing prediction based on the intra prediction mode can have a difference from the original image. The residual image having the difference between the predicted image and the original image can be entropy-coded after undergoing frequency-domain transformation and quantization. Here, in order to increase the coding efficiency of the frequency-domain transformation, integer transformation, discrete cosine transform (DCT), discrete sine transform (DST), or DCT / DST depending on the intra prediction mode can be selectively and adaptively applied depending on the size of the block.
[0095] In addition, in order to increase the coding efficiency in screen content such as document images or presentation images in PowerPoint, a transform skip algorithm can be used.
[0096] If the transform skip algorithm is used, the encoder directly quantizes the residual image (or residual block) having the difference between the predicted image and the original image without frequency transformation processing, and performs entropy coding on the residual block. In addition, the decoder performs entropy decoding on the residual block and generates a reconstructed residual block by performing inverse quantization (scaling) on the entropy-coded block. Therefore, the block to which the transform skip algorithm has been applied skips the frequency transformation / inverse transformation processing.
[0097] In quantization / anti - quantization processing, the scaling factor can be applied differently depending on the location of the transform coefficients within a block in order to improve the main picture quality of the image. On the contrary, there is a method of applying the scaling factor equally regardless of the location of the transform coefficients within a block when performing quantization / anti - quantization. Whether to apply this method can be signaled through the sequence parameter set (SPS) or the picture parameter set (PPS) of the bitstream.
[0098] As an example of this processing, the scaling process for transform coefficients can be performed as follows.
[0099] Scaling process for transform coefficients
[0100] In this case, the inputs are as follows.
[0101] - The width of the current transform block; nW
[0102] - The height of the current transform block; nH
[0103] - An array of transform coefficients with elements c ij ; (nW x nH) array d
[0104] - Indexes for the luminance signal and chrominance signal of the current block; cIdx
[0105] If cIdx is 0, this means the luminance signal. If cIdx is 1 or cIdx is 2, this means the chrominance signal. Further, if cIdx is 1, this means Cb in the chrominance signal. If cIdx is 2, this means Cr in the chrominance signal.
[0106] - Quantization parameter; qP
[0107] In this case, the outputs are as follows.
[0108] - An array of scaled transform coefficients: (nW x nH) array d ij
[0109] The parameter "log2TrSize" is derived by log2TrSize = (Log2(nW) + Log2(nH)) >> 1. The parameter shift is derived differently depending on cIdx. If cIx is 0 (in the case of the luminance signal), the parameter shift is derived from "shift = BitDepth Y + log2TrSize – 5". If cIx is not 0 (in the case of the chrominance signal), the parameter shift is derived from "shift = BitDepth C + log2TrSize – 5". Here, BitDepth Y and BitDepth CMeans the number of bits of the sample for the current image (e.g., 8 bits).
[0110] The array "levelScale[]" for the scaling parameter is the same as the following Equation 1.
[0111]
Equation 1
[0112] levelScale[k] = {40, 45, 51, 57, 64, 72} where k = 0..5
[0113] The scaled transform coefficient is calculated by the following process.
[0114] First, the scaling factor m is derived by the following process ij .
[0115] - If the scaling_list_enable_flag is 0, the scaling factor m is derived as in the following Equation 2 ij .
[0116]
Equation 2
[0117] m ij = 16
[0118] - If the scaling_list_enable_flag is not 0, the scaling factor m is derived as in the following Equation 3 ij .
[0119]
Equation 3
[0120] m ij = ScalingFactor[SizeID][RefMatrixID][trafoType][i * nW + j]
[0121] In Equation 3, SizeID is derived from the size of the transform block by the following Table 1, and RefMatrixID and trafoType are derived from the following Equations 4 and 5 respectively. In addition, in Equation 4, scaling_list_pred_matrix_id_delta is signaled by the sequence parameter set (SPS) or picture parameter set (PPS) of the bitstream.
[0122]
Equation 4
[0123] RefMatrixID = MatrixID - scaling_list_pred_matrix_id_delta
[0124]
Equation 5
[0125] trafoType = ((nW == nH)? 0 : ((nW > nH)? 1 : 2))
[0126] Table 1 shows an example of SizeID values according to the size of the transform block
[0127]
Table 1
[0128] Size of quantization matrix SizeID 4x4 0 8x8 (16x4, 4x16) 1 16x16 (32x8, 8x32) 2 32x32 3
[0129] Next, the scaled transform coefficient d is derived from the following Equation 6 ij .
[0130]
Equation 6
[0131] d ij = Clip3(-32768, 32767, ((c ij * m ij * levelScale[qP % 6] << (qP / 6)) + (1 << (shift - 1))) >> shift)
[0132] Meanwhile, frequency transform processing is not performed on the blocks (hereinafter referred to as transform skip blocks) to which the transform skip algorithm has been applied as described above. Therefore, the existing blocks and transform skip blocks on which frequency transform processing has been performed can have different transform coefficient characteristics. That is, if the scaling method applied to the existing blocks on which frequency transform processing has been performed is applied to the transform skip blocks without change, the coding efficiency can be reduced.
[0133] Therefore, the present invention provides a method of performing scaling by considering the case where the block is a transform skip block.
[0134] If quantization matrices (default matrix and non - default matrix) are used in the encoder and decoder to improve the subjective picture quality of the image, the scaling factors derived from the quantization matrix can be applied differently depending on the location of the transform coefficients within the block. In this method, when transforming the block, by using the characteristic of compressing the energy of the residual block to the upper left of the block (i.e., the low - frequency region), quantization with a larger quantization step size is performed on the high - frequency region (instead of the low - frequency region which is more sensitive to the human eye) which is less sensitive to the human eye. According to this method, when encoding an image, the subjective picture quality of the region sensitive to the human eye can be improved.
[0135] However, if the transform skip algorithm is applied, the residual block is not compressed toward the low-frequency region within the residual block because the frequency domain transform / inverse transform is not performed on the residual block. In this case, if the quantization / anti-quantization method used in the existing frequency domain is applied, there is a drawback that the distortion within the image or block becomes severe. Therefore, if a quantization matrix is used within an image, there is a need for a scaling (quantization / anti-quantization) method that can reduce the distortion within the image or block in blocks (i.e., transform skip blocks) for which the frequency domain transform / inverse transform is not performed. For example, there is a method of not applying the quantization matrix to transform skip blocks. In this method, the basic scaling factor can be equivalently applied regardless of the location of the transform coefficients within the block.
[0136] [Example 1] Method and apparatus for equally applying a scaling factor to a transform skip block regardless of the location of transform coefficients within a block Figure 6
[0137] Figure 6 is a flowchart illustrating a scaling method for a residual signal (or transform coefficients) according to an embodiment of the present invention.
[0138] Figure 1 The scaling method of Figure 2 can be performed in an Figure 6 encoding device or Figure 1 in a Figure 6 quantization unit or an inverse quantization unit of 2. In an Figure 6 embodiment of Figure 6 although for ease of description Figure 6 the scaling method of
[0139] is illustrated as being performed in an encoding device, Figure 6 the scaling method of ij can be equivalently applied in a decoding device.
[0140] The encoding device determines whether the current block is a transform skip block in step S600.
[0141] Based on the information indicating whether the current block is a transform skip block, it can be determined whether the current block is a transform skip block. For example, the information indicating whether the current block is a transform skip block can be a flag "transSkipFlag". The value of the flag "transSkipFlag" can be derived by performing entropy decoding on the information about the transform skip block in the bitstream. If the current block is a transform skip block, the value of the flag "transSkipFlag" can be 1. If the current block is not a transform skip block, the value of the flag "transSkipFlag" can be 0.
[0142] If it is determined as a determination result that the current block is a transform skip block (e.g., the value of the flag "transSkipFlag" is 1), the encoding device derives a scaling factor m in step S610 ij regardless of the location of the residual signal (or transform coefficients) within the current block.
[0143] Here, as Figure 6 shown in ij the scaling factor m can be set to a specific basic scaling factor value T. For example, the specific basic scaling factor value T can be 16.
[0144] If it is determined as a determination result that the current block is not a transform skip block (e.g., the value of the flag "transSkipFlag" is 0), the encoding device derives a scaling factor m based on the location of the residual signal (or transform coefficients) within the current block in step S620 ij .
[0145] Here, the quantization matrix can be used to set the scaling factor m differently depending on the residual signal (or transform coefficients) within the current block ij . As Figure 7 shown in ij .
[0146]
Equation 7
[0147] m ij = ScalingFactor[SizeID][RefMatrixID][trafoType][i * nW + j]
[0148] In Equation 7, ScalingFactor is an array that stores the scaling factor. SizeID can be a value indicating the size of the current block (transform block or quantization matrix), and the value of SizeID can be derived depending on the size of the current block (transform block) as in Table 1 above. RefMatrixID and trafoType can be derived from Equation 8 and Equation 9 below, respectively. nW is the width of the current block.
[0149]
Equation 8
[0150] RefMatrixID = MatrixID - scaling_list_pred_matrix_id_delta
[0151] In Equation 8, the value of MatrixID can mean the type of quantization matrix according to the prediction mode and color component. For example, the value of MatrixID can be derived as shown in Table 2 below. The scaling_list_pred_matrix_id_delta is signaled through the sequence parameter set (SPS) or picture parameter set (PPS) in the bitstream.
[0152]
Equation 9
[0153] trafoType = ((nW == nH)? 0 : ((nW > nH)? 1 : 2))
[0154] In Equation 9, nW means the width of the current block, and nH means the height of the current block.
[0155] Table 2 shows the MatrixID values according to the prediction mode and color component.
[0156]
Table 2
[0157]
[0158] Figure 7 is a flowchart illustrating a scaling method for a residual signal (or transform coefficient) according to another embodiment of the present invention.
[0159] Figure 1 The scaling method of can be performed in Figure 2 the encoding device of or Figure 7 the decoding device of. More specifically, Figure 1 the scaling method of can be performed in Figure 7 the quantization unit or inverse quantization unit of or 2. In the embodiment of, although for ease of description Figure 7 the scaling method of is illustrated as being performed in the encoding device, however Figure 7 the scaling method of can be equivalently applied in the decoding device. Figure 7 the scaling method of can be equivalently applied in the decoding device.
[0160] Referring to Figure 7 , the scaling factor m applied when scaling (quantizing or inverse quantizing) the residual signal (or transform coefficient) of the current block can be derived depending on whether the current block is a transform skip block and whether a quantization matrix is used ij .
[0161] The encoding device determines in step S700 whether the current block uses a quantization matrix and whether the current block is a transform skip block.
[0162] It is possible to determine whether the current block uses a quantization matrix based on information indicating whether the current block uses a quantization matrix. For example, the information indicating whether the current block uses a quantization matrix can be the flag "scaling_list_enable_flag". The value of the flag "scaling_list_enable_flag" can be derived by performing entropy decoding on the information about the use of the quantization matrix in the bitstream. If the current block uses a quantization matrix, the value of the flag "scaling_list_enable_flag" can be 1. If the current block does not use a quantization matrix, the value of the flag "scaling_list_enable_flag" can be 0.
[0163] In addition, it is possible to determine whether the current block is a transform skip block based on information indicating whether the current block is a transform skip block. For example, the information indicating whether the current block is a transform skip block can be the flag "transSkipFlag". The value of the flag "transSkipFlag" can be derived by performing entropy decoding on the information about the transform skip block in the bitstream. If the current block is a transform skip block, the value of the flag "transSkipFlag" can be 1. If the current block is not a transform skip block, the value of the flag "transSkipFlag" can be 0.
[0164] If it is determined as a determination result that the current block is a transform skip block or the current block does not use a quantization matrix (for example, transSkipFlag == 1 or scaling_list_enable_flag == 0), the encoding device derives the scaling factor m in step S710 ij , regardless of the location of the residual signal (or transform coefficients) within the current block.
[0165] As Figure 7 shown, the scaling factor m ij can be set to a specific basic scaling factor value T. For example, the specific basic scaling factor value T can be 16.
[0166] If it is determined as a determination result that the current block is not a transform skip block and the current block uses a quantization matrix, the encoding device derives the scaling factor m based on the location of the residual signal (or transform coefficients) within the current block in step S720 ij .
[0167] The scaling factor m ij can be set differently depending on the location of the residual signal (or transform coefficients) within the current block using the quantization matrix, and can be derived as in the equation shown in step S720 of Figure 6 . The scaling factor m derived from the equation shown in step S720 ij has been referred toFigure 6 Step S620 has been described and its description is omitted.
[0168] As described above with reference to Scaling process for transform coefficients and 7 If the current block (i.e., the target block to be encoded or decoded now) is a transform skip block, a scaling factor with a specific value T has been applied to the current block (i.e., the transform skip block), regardless of the location of the coefficients (or signals) within the current block. Here, the value of the scaling factor according to an embodiment of the present invention can be set differently depending on the respective encoding parameters applied to the corresponding block.
[0169] For example, the value of the scaling factor to be applied to the corresponding block can be set as follows depending on the value of a parameter (e.g., scaling_list_enable_flag) indicating whether a quantization matrix is used.
[0170] - If a quantization matrix is used (e.g., scaling_list_enable_flag == 1), the basic scaling factor value is set to "T1" (m ij = T1)
[0171] - If a quantization matrix is not used (e.g., scaling_list_enable_flag == 0), the basic scaling factor value is set to "T2" (m ij = T2)
[0172] The values of T1 and / or T2 can be determined by the encoder and signaled, or predetermined values of T1 and / or T2 can be used. If the values of T1 and / or T2 are signaled via a bitstream, the decoder can obtain the values of T1 and / or T2 by parsing the bitstream.
[0173] As another example, the value of the scaling factor to be applied to the corresponding block can be set as follows based on information (e.g., color component index cIdx) regarding the color characteristics from which a signal for the corresponding block can be derived. The color component index cIdx indicates a luminance signal (i.e., Y signal) or a chrominance signal (i.e., Cb signal or Cr signal) depending on its value.
[0174] - Example 1: The basic scaling factor value is set to "Ty" or "Tc" depending on whether the signal of the corresponding block is a luminance signal. For example, if the signal of the corresponding block is a luminance signal, the basic scaling factor value is set to "Ty". If the signal of the corresponding block is not a luminance signal (i.e., a chrominance signal), the basic scaling factor value is set to "Tc".
[0175] - Example 2: Set the basic scaling factor value according to each color component of the corresponding block. For example, if the color component of the corresponding block is the luminance signal (i.e., the Y signal), the basic scaling factor value is set to "Ty". If the chrominance signal is the Cb signal, the basic scaling factor value is set to "Tcb". If the chrominance signal is the Cr signal, the basic scaling factor value is set to "Tcr".
[0176] Here, the Ty, Tc, Tcb, and / or Tcr values can be determined and signaled by the encoder, or predetermined Ty, Tc, Tcb, and / or Tcr values can be used. If the Ty, Tc, Tcb, and / or Tcr values are signaled via the bitstream, the decoder can obtain the Ty, Tc, Tcb, and / or Tcr values by parsing the bitstream.
[0177] The location for determining the basic scaling factor depending on the coding unit according to an embodiment of the present invention can be applied independently or in combination, but it is necessary to always apply the same scaling factor value to the same transform skip block, regardless of the location of the coefficients (or signals) within the block (i.e., the target block to be coded or decoded).
[0178] The scaling process for transform coefficients, in which an embodiment of the present invention is incorporated, can be performed as follows.
[0179] Transform process for scaled transform coefficients
[0180] In this case, the inputs are as follows.
[0181] - The width of the current transform block; nW
[0182] - The height of the current transform block; nH
[0183] - An array of transform coefficients having elements c ij ; (nW x nH) array d
[0184] - Information indicating whether the transform skip algorithm has been applied to the current transform block
[0185] - Indexes for the luminance signal and chrominance signal for the current transform block; cIdx
[0186] If cIdx is 0, this means the luminance signal. If cIdx is 1 or cIdx is 2, this means the chrominance signal. Further, if cIdx is 1, this means Cb in the chrominance signal. If cIdx is 2, this means Cr in the chrominance signal.
[0187] - Quantization parameter; qP
[0188] In this case, the outputs are as follows.
[0189] - Array of transformed coefficients after scaling: (nW x nH) array d ij
[0190] Derive the parameter "log2TrSize" by "log2TrSize = (Log2(nW) + Log2(nH)) >> 1". Derive the parameter shift differently according to cIdx. If cIx is 0 (i.e., in the case of the luminance signal), then derive the parameter shift from "shift = BitDepth Y + log2TrSize – 5". If cIx is not 0 (i.e., in the case of the chrominance signal), then derive the parameter shift from "shift = BitDepth C + log2TrSize – 5". Here, BitDepth Y and BitDepth C mean the number of bits of the samples for the current image (e.g., 8 bits).
[0191] The array "levelScale[]" for the scaling parameter is the same as Equation 10.
[0192]
Equation 10
[0193] levelScale[k] = {40, 45, 51, 57, 64, 72} where k = 0..5
[0194] Calculate the transformed coefficients after scaling through the following process.
[0195] First, derive the scaling factor m through the following process ij .
[0196] - If scaling_list_enable_flag is 0 or the current transform block is a transform skip block, then derive the scaling factor m as in the following Equation 11 ij .
[0197]
Equation 11
[0198] m ij = 16
[0199] - If not, then derive the scaling factor m as in the following Equation 12 ij .
[0200]
Equation 12
[0201] m ij = ScalingFactor[SizeID][RefMatrixID][trafoType][i * nW + j]
[0202] In Equation 12, SizeID is derived from Table 1 above according to the size of the transform block, and RefMatrixID and trafoType are derived from the following Equation 13 and Equation 14 respectively. Additionally, in Equation 13, scaling_list_pred_matrix_id_delta is signaled through the sequence parameter set (SPS) of the bitstream.
[0203]
Equation 13
[0204] RefMatrixID = MatrixID - scaling_list_pred_matrix_id_delta
[0205]
Equation 14
[0206] trafoType = ((nW == nH)? 0 : ((nW > nH)? 1 : 2))
[0207] Next, the scaled transform coefficient d is derived from the following Equation 15 ij 。
[0208]
Equation 15
[0209] d ij = Clip3(-32768, 32767, ((c ij * m ij * levelScale[qP % 6] << (qP / 6)) + (1 << (shift - 1))) >> shift)
[0210] Meanwhile, the inverse transform process is performed on the transform coefficients scaled through the scaling process as described above. Here, instead of performing the inverse transform process, only the following shift operation process is performed on the current transform block to which the transform skip algorithm has been applied.
[0211] 1. If cIdx of the current block is 0 (in the case of the luminance signal), then shift = 13 - BitDepth Y 。If cIdx of the current block is not 0 (in the case of the chrominance signal), then shift = 13 - BitDepth C 。
[0212] 2. The array r for the residual block is set as follows ij (i = 0…(nW) - 1, j = 0..(nH) - 1).
[0213] If the shift is greater than 0, then r ij = (d ij+(1<<(shift - 1)))>>shift. If the shift is not greater than 0, then r ij =(d ij <<(-shift).
[0214] Here, d ij is an array of scaled transform coefficients, and r ij means an array of residual blocks obtained by performing an inverse transform on the scaled transform coefficients.
[0215] As an example in which the inverse transform process of the scaled transform coefficients is incorporated, the transform process for the scaled transform coefficients can be performed as follows.
[0216] IntraPredMode
[0217] In this case, the inputs are as follows.
[0218] - Width of the current transform block; nW
[0219] - Height of the current transform block; nH
[0220] - Array of transform coefficients having elements d ij ; (nW x nH) array d
[0221] - Information indicating whether the transform skip algorithm has been applied to the current transform block
[0222] - Index for the luminance signal and chrominance signal of the current transform block; cIdx
[0223] If cIdx is 0, this means the luminance signal. If cIdx is 1 or cIdx is 2, this means the chrominance signal. Further, if cIdx is 1, this means Cb in the chrominance signal. If cIdx is 2, this means Cr in the chrominance signal.
[0224] - Quantization parameter; qP
[0225] In this case, the outputs are as follows.
[0226] - Array of residual blocks obtained by performing an inverse transform on the scaled transform coefficients; (nW x nH) array r
[0227] If the coding mode "PredMode" for the current block is the intra prediction mode, the value of Log2(nW * nH) is 4, and the value of cIdx is 0, then the parameters "horizTrType" and "vertTrType" are obtained from Table 3 below depending on the intra prediction mode of the luminance signal. Otherwise, the parameters "horizTrType" and "vertTrType" are set to 0.
[0228] Table 3 shows an example of the values of the parameters "horizTrType" and "vertTrType" according to the intra prediction mode.
[0229]
Table 3
[0230] vertTrType 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 horizTrType 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 IntraPredMode 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[0231] vertTrType 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 horizTrType 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Scaling process for transform coefficients 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0
[0232] The residual signal for the current block is obtained in the following order.
[0233] First, if the transform skip algorithm for the current block has been applied, the following processing is performed.
[0234] 1. If cIdx is 0, then shift = 13 - BitDepth Y . If cIdx is not 0, then shift = 13 - BitDepth C .
[0235] 2. Set the array r for the residual block as follows ij (i = 0..(nW)-1, j = 0..(nH)-1).
[0236] - If the shift is greater than 0, then r ij = (d ij + (1 << (shift - 1))) >> shift. If the shift is not greater than 0, then r ij = (d ij << (-shift).
[0237] If the transform skip algorithm for the current block has not been applied, the following processing is performed.
[0238] 1. Use the values of the parameters "horizTrType" and "vertTrType" to perform an inverse transform process on the scaled transform coefficients. First, receive the size (nW, nH) of the current block, the array "(nWxnH) array d" for the scaled transform coefficients, and the parameter "horizTrType", and output the array "(nWxnH) array e" by horizontally performing a 1D inverse transform.
[0239] 2. Next, receive the array "(nWxnH) array e", and derive the array "(nWxnH) array g" as in Equation 16.
[0240]
Equation 16
[0241] g ij= Clip3(-32768, 32767, (e ij + 64) >> 7)
[0242] 3. Next, receive the size (nW, nH) of the current block, the array "(nW x nH) array g", and the parameter "vertTrType", and perform a 1D inverse transform horizontally.
[0243] 4. Next, depending on cIdx, set the array "(nW x nH) array r" for the residual block as in Equation 17 below.
[0244]
Equation 17
[0245] r ij = (f ij + (1 << (shift - 1))) >> shift
[0246] In Equation 17, when cIdx is 0, shift = 20 – BitDepth Y . If not, then shift = 20 – BitDepth C . BitDepth means the number of bits of the samples for the current image (e.g., 8 bits).
[0247] By performing the above scaling process on the transform coefficients and the above transform process on the scaled transform coefficients, a reconstructed residual block can be generated. In addition, a reconstructed block can be generated by adding a predicted block generated by intra prediction or inter prediction to the reconstructed residual block. Here, the reconstructed block can be a block to which a loop filter has been applied or a block to which a loop filter has not been applied yet.
[0248] Thereafter, the present invention provides a method of signaling a basic scaling factor derived depending on whether the current block is a transform skip block.
[0249] According to an embodiment of the present invention, the basic scaling factor derived depending on whether the current block is a transform skip block can be signaled by a sequence parameter set (SPS).
[0250] Table 4 shows an example of the SPS syntax for signaling information about the basic scaling factor according to an embodiment of the present invention.
[0251]
Table 4
[0252]
[0253] Referring to Table 4, the transform_skip_enabled_flag indicates whether the transform skip algorithm will be used in the current sequence.
[0254] If the transform skip algorithm is used in the current sequence, flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16 are signaled. Each value can be coded in a form with a positive or negative sign (se(v)). Alternatively, each value can be coded in a form with a 0 and a positive sign (ue(v)).
[0255] flat_scale_factor_y_minus16 means the scaling factor for the luma signal. For example, if the value of flat_scale_factor_y_minus16 is 0, the scaling factor for the luma signal has the value 16, where 16 is added to 0.
[0256] flat_scale_factor_cb_minus16 means the scaling factor for the chroma signal Cb. flat_scale_factor_cr_minus16 means the scaling factor for the chroma signal Cr.
[0257] The scaling factor for the luma signal or chroma signal can be derived as in equations 18 to 20.
[0258] Here, the base scaling factor FlatScalingFactor[cIdx] stores the scaling factors for the luma signal and chroma signals. For example, if the color component index cIdx is 0, the base scaling factor can indicate the luma (Y) signal. If the color component index cIdx is 1, the base scaling factor can indicate the Cb chroma signal. If the color component index cIdx is 2, the base scaling factor can indicate the Cr chroma signal. In addition, the value of the base scaling factor "FlatScalingFactor[cIdx]" can have a specific value range. For example, an 8-bit signal can have values from -15 to "255 - 16".
[0259] The base scaling factor for the luma signal can be derived as in equation 18.
[0260]
Equation 18
[0261] FlatScalingFactor[0] = 16 + (transform_skip_enabled_flag == 1)? flat_scale_factor_y_minus16 : 0
[0262] The base scaling factor for the Cb chroma signal can be derived as in equation 19.
[0263]
Equation 19
[0264] FlatScalingFactor[1] = 16 + (transform_skip_enabled_flag == 1)? flat_scale_factor_cb_minus16 : 0
[0265] The basic scaling factor for the Cr chrominance signal can be derived as in Equation 20.
[0266]
Equation 20
[0267] FlatScalingFactor[2] = 16 + (transform_skip_enabled_flag == 1)? flat_scale_factor_cr_minus16 : 0
[0268] By incorporating the method of signaling the basic scaling factor derived depending on whether the current block is a transform skip block according to an embodiment of the present invention into the scaling process, the scaling process for the transform coefficients can be performed as follows.
[0269] Depth of a CU (or TU) indicating the range of application
[0270] In this case, the inputs are as follows.
[0271] - The width of the current transform block; nW
[0272] - The height of the current transform block; nH
[0273] - An array of transform coefficients having elements c ij ; (nW x nH) array d
[0274] - Information indicating whether the transform skip algorithm has been applied to the current transform block; transSkipFlag
[0275] If the value of transSkipFlag is 1, it indicates that the transform skip algorithm has been applied to the current block. If the value of transSkipFlag is 0, it indicates that the transform skip algorithm has not been applied to the current block.
[0276] - Index for the luminance and chrominance signals of the current block; cIdx
[0277] If cIdx is 0, this means the luminance signal. If cIdx is 1 or cIdx is 2, this means the chrominance signal. Further, if cIdx is 1, this means Cb in the chrominance signal. If cIdx is 2, this means Cr in the chrominance signal.
[0278] - Quantization parameter; qP
[0279] In this case, the output is as follows.
[0280] - Array of scaled transform coefficients: (nW x nH) array d ij
[0281] The parameter log2TrSize is derived by log2TrSize = (Log2(nW) + Log2(nH)) >> 1. The parameter shift is derived differently depending on cIdx. If cIx is 0 (in the case of the luminance signal), the parameter shift is derived from "shift = BitDepth Y + log2TrSize – 5". If cIx is not 0 (i.e., in the case of the chrominance signal), the parameter shift is derived from "shift = BitDepth C + log2TrSize – 5". Here, BitDepth Y and BitDepth C mean the number of bits for the samples of the current image (e.g., 8 bits).
[0282] The array "levelScale[]" for the scaling parameter is the same as Equation 21.
[0283]
Equation 21
[0284] levelScale[k] = {40, 45, 51, 57, 64, 72} where k = 0..5
[0285] The scaled transform coefficients are calculated by the following process.
[0286] First, the scaling factor m is derived by the following process ij .
[0287] - If scaling_list_enable_flag is 0, the scaling factor m is derived as in the following Equation 22 ij .
[0288]
Equation 22
[0289] m ij = (transSkipFlag == 1)? FlatScaleFactor[cIdx] : 16
[0290] - If not (i.e., if scaling_list_enable_flag is 1), the scaling factor m is derived as in the following Equation 23 ij .
[0291]
Equation 23
[0292] m ij = (transSkipFlag == 1)? FlatScaleFactor[cIdx] : ScalingFactor[SizeID][ReMatrixID][trafoType][i * nW + j]
[0293] In Equation 23, SizeID is derived from the block size through Table 1 above. RefMatrixID and trafoType are derived from Equation 24 and Equation 25 below respectively. In Equation 24, scaling_list_pred_matrix_id_delta is signaled through the sequence parameter set (SPS) of the bitstream.
[0294]
Equation 24
[0295] RefMatrixID = MatrixID - scaling_list_pred_matrix_id_delta
[0296]
Equation 25
[0297] trafoType = ((nW == nH)? 0 : ((nW > nH)? 1 : 2))
[0298] Next, the scaled transform coefficient dij is derived from Equation 26 below.
[0299]
Equation 26
[0300] d ij = Clip3(-32768, 32767, ((c ij * m ij * levelScale[qP % 6] << (qP / 6)) + (1 << (shift - 1))) >> shift)
[0301] Meanwhile, in addition to the above SPS, the basic scaling factor derived according to whether the current block is a transform skip block according to the embodiments of the present invention can be signaled through the picture parameter set (PPS) or the slice header "SliceHeader". In addition, the basic scaling factor can be signaled in the CU unit or the TU unit.
[0302] The values flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16 signaled through the above SPS can be updated and used in the PPS (or SliceHeader, CU, or TU).
[0303] Table 5 shows an example of the PPS syntax for signaling information regarding the basic scaling factors according to another embodiment of the present invention.
[0304] [Table 5]
[0305]
[0306] Referring to Table 5, the transform_skip_enabled_flag indicates whether the transform skip algorithm will be used in the current picture. If the transform skip algorithm is used, the pps_flat_scaling_factor_present_flag is signaled.
[0307] For example, if the value of pps_flat_scaling_factor_present_flag is 0, the flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16 applied to the above SPS are used as the scaling factors for the transform skip blocks. If the value of pps_flat_scaling_factor_present_flag is 1, the corresponding values are signaled to update the values of flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16 applied in the above SPS.
[0308] The signaled values "flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16" are used as the scaling factors for the transform skip blocks of the current picture. Here, these values are continuously used until they are changed again. Alternatively, these values can be applied only to the current picture, and the scaling factor values used in the SPS can be applied to the next picture.
[0309] Here, each of the values "flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16" can be coded (se(v)) in a form with a positive or negative sign. Alternatively, each of these values can be coded (ue(v)) in a form with a 0 and a positive sign.
[0310] The values "flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16" can be signaled using different values for each luminance signal and each chrominance signal. For example, the value "flat_scale_factor_y_minus16" can be used to signal the scaling factor for the luminance signal, the value "flat_scale_factor_cb_minus16" can be used to signal the scaling factor for the Cb chrominance signal, and the value "flat_scale_factor_cr_minus16" can be used to signal the scaling factor for the Cr chrominance signal. Alternatively, flat_scale_factor_y_minus16 can be used to signal the scaling factor for the luminance signal, and flat_scale_factor_cb_cr_minus16 can be used to signal the scaling factor for the chrominance signal. Alternatively, a single value "flat_scale_factor_y_cb_cr_minus16" can be used to signal the scaling factor for the luminance signal and the chrominance signal.
[0311] As described above, the values "flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16" signaled in the SPS or PPS can be updated and used in the SliceHeader (or CU or TU).
[0312] Table 6 shows an example of the "SliceHeader" syntax for signaling information about the basic scaling factor according to another embodiment of the present invention.
[0313] [Table 6]
[0314]
[0315] Referring to Table 6, the transform_skip_enabled_flag indicates whether the transform skip algorithm will be used in the current slice. If the transform skip algorithm will be used, the value of flat_scaling_factor_override_flag is signaled.
[0316] For example, if the value of flat_scaling_factor_override_flag is 0, the flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16 applied in the above SPS or PPS are used as the scaling factors for the transform skip blocks. If the value of flat_scaling_factor_override_flag is 1, the corresponding values are signaled to update the values of flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16 applied in the above SPS or PPS.
[0317] The values "flat_scale_factor_y_delta, flat_scale_factor_cb_delta, and flat_scale_factor_cr_delta" are used as the scaling factors for the transform skip blocks of the current slice.
[0318] Here, each of the values "flat_scale_factor_y_delta, flat_scale_factor_cb_delta, and flat_scale_factor_cr_delta" can be coded in a form with a positive or negative sign (se(v)). Alternatively, each value can be coded in a form with 0 and a positive sign (ue(v)).
[0319] The values "flat_scale_factor_y_delta, flat_scale_factor_cb_delta, and flat_scale_factor_cr_delta" can be signaled using different values according to each luminance signal and each chrominance signal. For example, the value flat_scale_factor_y_delta can be used to signal the scaling factor for the luminance signal, the value flat_scale_factor_cb_delta can be used to signal the scaling factor for the Cb chrominance signal, and the value flat_scale_factor_cr_delta can be used to signal the scaling factor for the Cr chrominance signal. Alternatively, flat_scale_factor_y_delta can be used to signal the scaling factor for the luminance signal, and flat_scale_factor_cb_cr_delta can be used to signal the scaling factor for the chrominance signal. Alternatively, a single value flat_scale_factor_y_cb_cr_delta can be used to signal the scaling factor for the luminance signal and the chrominance signal.
[0320] The basic scaling factors can be derived as in the following equations 27 to 29 using the signaled values "flat_scale_factor_y_delta, flat_scale_factor_cb_delta, and flat_scale_factor_cr_delta" as described above.
[0321] Here, the basic scaling factor "FlatScalingFactor[cIdx]" stores the scaling factors for the luminance signal and the chrominance signal. For example, if the color component index cIdx is 0, the basic scaling factor can indicate the luminance (Y) signal. If the color component index cIdx is 1, the basic scaling factor can indicate the Cb chrominance signal. If the color component index cIdx is 2, the basic scaling factor can indicate the Cr chrominance signal. In addition, the value of the basic scaling factor "FlatScalingFactor[cIdx]" can indicate a range of specific values. For example, an 8-bit signal can have a range from -15 to "255 - 16".
[0322] The basic scaling factor for the luminance signal can be derived using flat_scale_factor_y_delta as in equation 27.
[0323]
Equation 27
[0324] FlatScalingFactor[0] = 16 + (transform_skip_enabled_flag == 1)? (flat_scale_factor_y_minus16 + flat_scale_factor_y_delta) : 0
[0325] The flat_scale_factor_cb_delta can be used to derive the basic scaling factor for the Cb chrominance signal as in Equation 28.
[0326]
Equation 28
[0327] FlatScalingFactor[1] = 16 + (transform_skip_enabled_flag == 1)? (flat_scale_factor_cb_minus16 + flat_scale_factor_cb_delta) : 0
[0328] The flat_scale_factor_cr_delta can be used to derive the basic scaling factor for the Cr chrominance signal as in Equation 29.
[0329]
Equation 29
[0330] FlatScalingFactor[2] = 16 + (transform_skip_enabled_flag == 1)? (flat_scale_factor_cr_minus16 + flat_scale_factor_cr_delta) : 0
[0331] Meanwhile, the above embodiments can have different application scopes depending on the size of the block, the depth of the CU, or the depth of the TU. The parameters for determining the application scope (e.g., information about the size or depth of the block) can be set by the encoder and decoder such that the parameter has a predetermined value, or can be set to have a predetermined value according to a distribution map or level. When the encoder writes the parameter value in the bitstream, the decoder can obtain the value from the bitstream and use it.
[0332] If the application scope varies depending on the depth of the CU, the following three methods can be applied to the above embodiments as illustrated in Table 7. Method A is applied only to a specific depth or a higher depth, Method B is applied only to a specific depth or a lower depth, and Method C is applied only to a specific depth.
[0333] Table 7 shows an example of a method for determining the scope in which the method of the present invention is applied depending on the depth of a CU (or TU). In Table 7, the mark "O" means applying the corresponding method to the corresponding depth of the CU (or TU), while the mark "X" means not applying the corresponding method to the corresponding depth of the CU (or TU).
[0334]
Table 7
[0335] Method A Method B Method C 4 or higher 0 X O X 1 X O X 2 O O O 3 O X X O X X
[0336] Referring to Table 7, if the depth of the CU (or TU) is 2, then all of Method A, Method B, and Method C can be applied to the embodiments of the present invention.
[0337] If the embodiments of the present invention are not applied to all depths of the CU (or TU), it can be indicated by using a specific indicator (e.g., a flag), or can be represented by using the value of the depth of the CU indicating the application range and signaling a value that is 1 greater than the maximum value of the depth of the CU.
[0338] In addition, the method for determining the scope in which the method of the present invention is applied depending on the above-mentioned depth of the CU (or TU) can be applied differently depending on the sizes of the luminance block and the chrominance block, and can be applied differently depending on the luminance image and the chrominance image.
[0339] Table 8 shows an example schematically showing a combination of methods for determining the application range depending on the sizes of the luminance block and the chrominance block.
[0340]
Table 8
[0341]
[0342] In the case of Method "G1" among the methods listed in Table 8, if the size of the luminance block is 8 (8x8, 8x4, 2x8, etc.) and the size of the chrominance block is 4 (4x4, 4x2, 2x4), then Embodiment 1 of the present invention (G1 - Embodiment 1) can be applied to the luminance signal, the chrominance signal, the horizontal signal, and the vertical signal.
[0343] In the above exemplary system, although these methods have been described based on a flowchart in the form of a series of steps or blocks, the present invention is not limited to the order of these steps, and some steps can be executed in a different order from other steps, or can be executed simultaneously with other steps. In addition, those skilled in the art will understand that the steps shown in the flowchart are not exclusive, and these steps can include additional steps, or one or more steps in the flowchart can be deleted without affecting the scope of the present invention.
[0344] The above description is only an example of the technical spirit of the present invention, and those skilled in the art can change and modify the present invention in various ways without departing from the essential characteristics of the present invention. Therefore, the disclosed embodiments should not be construed as limiting the technical spirit of the present invention, but should be construed as illustrating the technical spirit of the present invention. The scope of the technical spirit of the present invention is not limited by these embodiments, and the scope of the present invention should be construed based on the appended claims. Therefore, the present invention should be construed as covering all modifications or variations derived from the appended claims and their equivalent meanings and scopes.
Claims
1. An image decoding method using a decoding device, comprising: Determining whether a current block is a transform skip block; Deriving a scaling factor for the current block depending on whether the current block is the transform skip block; Performing inverse quantization by scaling the quantized transform coefficients of the current block based on the scaling factor; Obtaining residual samples of the current block by selectively performing an inverse transform on the scaled transform coefficients; Performing prediction on the current block to generate prediction samples of the current block; And Reconstructing the current block based on the residual samples and the prediction samples, wherein, when the current block is not the transform skip block, the scaling factor of the current block is derived based on a quantization matrix defined at the decoding device, locations of transform coefficients within the current block, and a prediction mode of the current block, wherein, when the current block is the transform skip block, the scaling factor of the current block is derived to be equal to a fixed constant value regardless of locations of the transform coefficients within the current block and the prediction mode of the current block, and wherein the transform skip block is specified based on a transform skip flag and a transform skip enable flag, wherein the transform skip enable flag indicates whether a current picture including the current block is allowed to skip transformation, and wherein the transform skip flag indicates whether the current block is the transform skip block.
2. The image decoding method according to claim 1, wherein, The fixed constant value is 16.
3. The image decoding method according to claim 1, wherein, Deriving the scaling factor depending on whether the current block uses the quantization matrix defined at the decoding device.
4. The image decoding method according to claim 1, wherein, Deriving the scaling factor depending on whether the current block is a luminance block or a chrominance block.
5. The image decoding method according to claim 1, wherein, The transform skip enable flag is signaled through a picture parameter set (PPS).
6. An image encoding method using an encoding device, comprising: Determining whether a current block is a transform skip block; Deriving a scaling factor for the current block depending on whether the current block is the transform skip block; Performing inverse quantization by scaling the quantized transform coefficients of the current block based on the scaling factor; Obtaining residual samples of the current block by selectively performing an inverse transform on the scaled transform coefficients; Performing prediction on the current block to generate prediction samples of the current block; And Reconstructing the current block based on the residual samples and the prediction samples, wherein, when the current block is not the transform skip block, the scaling factor of the current block is derived based on a quantization matrix defined at the encoding device, locations of transform coefficients within the current block, and a prediction mode of the current block, wherein, when the current block is the transform skip block, the scaling factor of the current block is derived to be equal to a fixed constant value regardless of locations of the transform coefficients within the current block and the prediction mode of the current block, and wherein the transform skip block is specified based on a transform skip flag and a transform skip enable flag, wherein the transform skip enable flag indicates whether a current picture including the current block is allowed to skip transformation, and wherein the transform skip flag indicates whether the current block is the transform skip block.