Image encoding / decoding method and non-transitory computer-readable recording medium

By selecting the appropriate scaling factor according to the block type during image encoding and decoding, the problem of low coding efficiency of high-resolution images is solved, the coding efficiency is improved, the image distortion is reduced, and the picture quality is improved.

CN114786016BActive Publication Date: 2025-09-09ELECTRONICS & TELECOMM RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210024647.2
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-09-09
Estimated Expiration
2033-07-02

AI Technical Summary

Technical Problem

When encoding and decoding high-resolution images, especially ultra-high-definition images, existing technologies have low encoding efficiency and are unable to meet the requirements of high compression efficiency.

Method used

By determining whether the current block is a transform skip block, deriving a corresponding scaling factor, and performing scaling on the current block based on the scaling factor, a fixed scaling factor is used for the transform skip block regardless of the location of the transform coefficient, and a scaling factor derived from a quantization matrix is ​​used for the non-transform skip block.

Benefits of technology

It improves the encoding and decoding efficiency, reduces image distortion, and improves the subjective picture quality of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114786016B_ABST
    Figure CN114786016B_ABST
Patent Text Reader

Abstract

Disclosed are an image encoding / decoding method and a non-transitory computer-readable recording medium. The image decoding method includes: determining whether transform skipping can be applied to a current block; determining whether the current block is a transform skipping block based on the above determination; deriving a scaling factor of the current block depending on whether the current block is a transform skipping block; performing inverse quantization by scaling quantized transform coefficients of the current block based on the scaling factor; obtaining residual samples of the current block by selectively performing 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. When the current block is not a transform skipping block, the scaling factor is derived based on a quantization matrix and locations of transform coefficients within the current block. When the current block is a transform skipping block, the scaling factor is derived to be equal to a fixed constant value. The transform skipping block is specified based on information indicating whether an inverse transform is applied to the current block.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with application date of July 2, 2013, application number 201380042182.2, and invention name “Method and device for encoding / decoding images”. Technical Field

[0002] The present invention relates to encoding / decoding of images, and more particularly, to a method and apparatus for scaling transform coefficients. Background Art

[0003] Broadcast services with high definition (HD) resolution (1280x1024 or 1920x1080) are expanding across the country and around the world. As a result, many users are accustomed to videos with high resolution and high picture quality. Therefore, many organizations are promoting the development of next-generation image devices. In addition, because there is a growing interest in ultra-high definition (UHD) and HDTV, which have a resolution four times higher than that of HDTV, mobile image standardization organizations have become aware of the need for compression technology 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 through higher compression efficiency than that of H.264 / AVC currently used in HDTV, mobile phones, and Blu-ray players.

[0004] Currently, the Moving Picture Experts Group (MPEG) and the Video Coding Experts Group (VCEG) are jointly standardizing High Efficiency Video Coding (HEVC), a next-generation video codec, with the goal of encoding images, including UHD images, with compression efficiency twice that of H.264 / AVC. This enables the provision of images with lower frequencies and higher picture quality than current images, as well as HD and UHD images, even in 3D broadcasting and mobile communication networks. Summary of the Invention

[0005]

Technical Issues

[0006] The present invention provides a method and apparatus for encoding and decoding an image, capable of improving encoding / decoding efficiency.

[0007] The present invention provides a method and apparatus for scaling a transform coefficient (or a residual signal), which can improve encoding / decoding efficiency.

[0008] The present invention provides a method and apparatus for quantizing / dequantizing a transform skip block, which can improve encoding / decoding efficiency.

[0009]

Technical solution

[0010] According to one aspect of the present invention, there is provided an image decoding method comprising 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] The scaling factor for the current block is derived based on locations of transform coefficients within the current block, and the transform skip block is a block in which transform has not been applied to the current block and is specified based on information indicating whether 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 the transform coefficient 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 luma block or a chroma block.

[0016] A flag indicating whether a transform skip algorithm is used in a picture including a current block may be signaled through a picture parameter set (PPS).

[0017] The basic scaling factor may include information on scaling factors for a luminance signal and a chrominance signal.

[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 a location of a transform coefficient 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 locations of transform coefficients within the current block.

[0020] According to another aspect of the present invention, an image decoding apparatus is provided, comprising: an inverse quantization unit configured to derive a scaling factor for a current block depending on whether the current block is a transform skip block, and scale the current block based on the scaling factor.

[0021] The scaling factor for the current block may be derived based on locations of transform coefficients within the current block, and the transform skip block may be a block to which transform has not yet been applied and specified based on information indicating whether inverse transform is applied to the current block.

[0022] According to another aspect of the present invention, there is provided an image encoding method comprising the steps of 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 locations of transform coefficients within the current block, and the transform skip block may be a block to which transform has not yet been applied and specified based on information indicating whether 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 location of the transform coefficient 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 luma block or a chroma block.

[0028] A flag indicating whether a transform skip algorithm is used in a picture including a current block is signaled through a picture parameter set (PPS).

[0029] The basic scaling factor may include information on scaling factors for a luminance signal and a chrominance signal.

[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 a location of a transform coefficient 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 locations of transform coefficients within the current block.

[0032] According to another aspect of the present invention, there is provided an image encoding apparatus including a 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.

[0033] The scaling factor for the current block may be derived based on locations of transform coefficients within the current block, and the transform skip block may be a block to which transform has not yet been applied and specified based on information indicating whether inverse transform is applied to the current block.

[0034]

Beneficial effects

[0035] Because the transform / inverse transform process is not performed on the block to which the transform skip algorithm has been applied, the block to which the transform skip algorithm has been applied has different transform coefficient characteristics from the existing block to which the transform skip algorithm has been applied. That is, if the scaling method applied to the existing block to which the transform / inverse transform process has been performed is applied to the transform skip block, encoding / decoding efficiency can be reduced. Therefore, by uniformly applying the scaling factor to the transform skip block regardless of the location of the transform coefficients within the block, encoding and decoding efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 is a block diagram showing the configuration of an image encoding 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 a partition structure of an image when encoding the image;

[0039] Figure 4 is a diagram showing the form of PUs that can be included in a CU;

[0040] Figure 5 is a diagram showing the form of TUs that can be included in a CU;

[0041] Figure 6 is a flowchart illustrating a scaling method for a residual signal (or transform coefficient) according to an embodiment of the present invention; and

[0042] Figure 7 is a flowchart illustrating a scaling method for a residual signal (or transform coefficient) according to another embodiment of the present invention. DETAILED DESCRIPTION

[0043] Hereinafter, 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 it is deemed that they make the gist of the present invention unnecessarily obscure.

[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. In addition, in this specification, when a specific element is considered to be included, this may mean that elements other than the specific element are not excluded, and additional elements may be included within the scope of the embodiments of the present invention or the technical spirit of the present invention.

[0045] Terms such as first and second can be used to describe various elements, but these elements are not limited to these terms. Use these terms only to distinguish one element from another element. For example, a first element can be referred to as a second element without departing from the scope of the present invention. Similarly, a second element can be referred to as a first element.

[0046] In addition, the component units described in the embodiments of the present invention are shown independently to indicate differences and characteristic functions, and this does not mean that each component unit is formed by a separate hardware or software. That is, for ease of description, these component units are arranged and included, and at least two of these component units can form one component unit, or one element can be divided into multiple component units, and the multiple divided component units can perform functions. Embodiments in which components are integrated or embodiments in which some components are separated therefrom are also included in 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 essential functions, but may be optional elements for only improving performance. The present invention can be implemented using only essential elements for realizing the essence of the present invention rather than elements for only improving performance, and a structure including only essential elements and not including optional elements for only improving functions is included in the scope of the present invention.

[0048] First, in order to improve convenience of description and aid understanding of the present invention, 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, a coding or decoding unit represents a division unit of an image when the image is subdivided and encoded or decoded. The unit may also be called a block, macroblock (MB), coding unit (CU), prediction unit (PU), transform unit (TU), coding block (CB), prediction block (PB), or transform block (TB). A unit can be divided into smaller subunits.

[0050] A block represents an MxN array of samples. M and N have positive integer values. A block can collectively mean an array in 2-D form.

[0051] A transform unit (TU) is a basic unit when performing encoding / decoding on a residual signal, such as transform, inverse transform, quantization, inverse quantization, and encoding / decoding of transform coefficients. One TU can be partitioned into multiple smaller TUs. Here, if the residual signal exists in block form, the residual signal can be called a residual block.

[0052] The quantization matrix means a matrix used in a quantization or inverse quantization process in order to improve the subjective or objective picture quality of an image. The quantization matrix is ​​also called a scaling list.

[0053] Quantization matrices can be divided into default matrices, non-default matrices, and flat matrices. The default matrix can refer to a specific quantization matrix predetermined in the encoder and decoder. The non-default matrix may not be predetermined in the encoder and decoder, but may refer to a quantization matrix transmitted or received by the user. A flat matrix may refer to a matrix in which all elements have the same value.

[0054] Scaling refers to the process of multiplying the transform coefficient level by a factor. As a result of this process, transform coefficients are generated. Scaling is also called inverse quantization.

[0055] The transform coefficient represents a coefficient value generated after performing transform. In this specification, a quantized transform coefficient level obtained by applying quantization to a transform coefficient is also referred to as a transform coefficient.

[0056] The quantization parameter represents a value used to scale the transform coefficient level in quantization and inverse quantization. Here, the quantization parameter may be a value mapped to a quantization step size.

[0057] The parameter set corresponds to information about a header in a structure in a bitstream. The parameter set has the meaning of collectively designating a sequence parameter set, a picture parameter set, and an adaptation parameter set.

[0058] Figure 1 is a block diagram showing the configuration of an image encoding device to which an embodiment of the present invention is applied.

[0059] refer to Figure 1 The image encoding device 100 includes a motion estimation module 111, a motion compensation module 112, an intra-frame prediction module 120, a switch 115, a subtractor 125, a transform module 130, a quantization module 140, an entropy encoding module 150, an inverse quantization 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 encode an input image in intra mode or inter mode and output a bitstream. In the case of intra mode, the switch 115 can switch to intra mode. In the case of inter mode, the switch 115 can switch to 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 case of the intra mode, the intra prediction module 120 can generate a predicted block by performing spatial prediction using values ​​of pixels of an encoded block adjacent to a current block.

[0062] In the case of the inter-frame mode, the motion estimation module 111 can obtain a motion vector by searching for an area that best matches the input block in the reference picture stored in the reference picture buffer 190 in the 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-frame prediction, and the motion vector can indicate an offset between a picture to be currently encoded / decoded and a 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 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 coding module 150 can perform entropy coding on the codewords according to the probability distribution based on the values ​​calculated by the quantization module 140, the coding parameter values ​​calculated in the coding process, etc., and output a bitstream based on the codewords after entropy coding. If entropy coding is applied, the size of the bitstream for the codewords to be encoded can be reduced because the codewords are represented by allocating a small number of bits to codewords with a high frequency of occurrence and a large number of bits to codewords with a low frequency of occurrence. Therefore, the compression performance of image coding can be improved by entropy coding. The entropy coding module 150 can use coding methods such as exponential Golomb, context-adaptive variable length coding (CAVLC), and context-adaptive binary arithmetic coding (CABAC) for entropy coding.

[0066] according to Figure 1The image encoding apparatus 100 of the embodiment of the present invention performs inter-frame prediction encoding (i.e., inter-frame prediction encoding), and thus the encoded picture needs to be decoded and stored in order to be used as a reference picture. Therefore, the quantized coefficients are dequantized by the dequantization module 160 and inversely transformed by the inverse transform module 170. The dequantized and inversely transformed coefficients are added to the prediction block by the adder 175, thereby generating a reconstructed block.

[0067] The reconstructed block experiences a filter module 180. The filter module 180 can apply one or more of a deblocking filter, sample adaptive offset (SAO), and an adaptive loop filter (ALF) to the reconstructed block or reconstructed picture. The filter module 180 may also be referred to as an adaptive loop filter. The deblocking filter can remove block distortion generated at block boundaries. The SAO can add an appropriate offset value to pixel values ​​to compensate for coding errors. The ALF can perform filtering based on a value 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 a 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] refer to Figure 2 , the image decoding apparatus 200 includes an entropy decoding module 210 , an inverse quantization module 220 , an inverse transform module 230 , an intra 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 bit stream output from an encoder, decode the bit stream according to an intra-frame mode or an inter-frame mode, and output a reconstructed image (i.e., a reconstructed image). In the case of the intra-frame mode, the switch can switch to the intra-frame mode. In the case of the inter-frame mode, the switch can switch to the inter-frame mode.

[0071] The image decoding apparatus 200 can obtain a reconstructed residual block from a received bitstream, generate a prediction block, and generate a reconstructed block (ie, 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 a received bitstream according to probability distribution.

[0073] If the entropy decoding method is applied, the size of a bit stream for each symbol can be reduced because symbols are represented by allocating a small number of bits to symbols with a high frequency of occurrence and a large number of bits to symbols with a low frequency of occurrence.

[0074] The quantized coefficients are dequantized by the dequantization module 220 and inversely transformed by the inverse transformation module 230. As a result of the dequantization / inverse transformation of the quantized coefficients, a reconstructed residual block can be generated.

[0075] In the case of intra mode, the intra prediction module 240 can generate a prediction block by performing spatial prediction using the values ​​of pixels of the encoded blocks around the current block. In the case of inter mode, the motion compensation module 250 can generate a prediction block by performing motion compensation using a motion vector and a reference picture 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 reconstructed picture. The filter module 260 outputs a reconstructed image (i.e., a reconstructed image). The reconstructed image can be stored in the reference picture buffer 270 and can be used for inter-frame prediction.

[0077] Figure 3 is a diagram schematically showing a partition structure of an image when encoding the image.

[0078] In High Efficiency Video Coding (HEVC), encoding is performed in coding units in order to efficiently partition an image.

[0079] refer to Figure 3 In HEVC, an image 300 is sequentially partitioned in a largest coding unit (hereinafter referred to as an LCU), and a partition structure is determined based on the LCU. The partition structure means the distribution of coding units (hereinafter referred to as CUs) for efficiently encoding an image within an LCU 310. The distribution can be determined based on whether one CU is to be partitioned into four CUs (each of which has a width and 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 and 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 stores information about the depth of each CU. For example, the depth of the LCU can be 0, and the depth of the smallest coding unit (SCU) can be a predetermined maximum depth. Here, the LCU is a CU with the above-mentioned maximum CU size, and the SCU is a CU with the minimum CU size.

[0081] Whenever partitioning is performed on the LCU 310 with half the width and height, the depth of the CU increases by 1. A CU for which partitioning has not yet been performed has a size of 2N×2N for each depth, and a CU for which partitioning is performed is partitioned from a CU having a size of 2N×2N into four CUs each having a size of N×N. Whenever the depth increases by 1, the size of N decreases by half.

[0082] refer to Figure 3 , the size of an LCU with a minimum depth of 0 can be 64×64 pixels, and the size of an SCU with a maximum depth of 3 can be 8×8 pixels. Here, an LCU with 64×64 pixels can be represented by a depth of 0, a CU with 32×32 pixels can be represented by a depth of 1, a CU with 16×16 pixels can be represented by a depth of 2, and an SCU with 8×8 pixels can be represented by a depth of 3.

[0083] In addition, information about whether a specific CU is partitioned can be represented by 1 bit of partition information for each CU. This partition information can be included in all CUs except the SCU. For example, if the CU is not partitioned, partition information 0 can be stored. If the CU is partitioned, partition information 1 can be stored.

[0084] Meanwhile, a CU partitioned from an LCU can include a prediction unit (PU) (or prediction block (PB)), ie, a basic unit for prediction, and a transform unit (TU) (or transform block (TB)), ie, a basic unit for transform.

[0085] Figure 4 is a diagram showing the form of PUs that can be included in a CU.

[0086] A CU that is no longer partitioned from the LCU partition is partitioned into one or more PUs. This behavior itself is also called partitioning. A prediction unit (hereinafter referred to as a PU) is a basic unit for performing prediction and is encoded in any of skip mode, inter mode, and intra mode. A PU can be partitioned in various ways depending on each mode.

[0087] refer to Figure 4 In the case of skip mode, a 2Nx2N mode 410 having the same size as the CU can be supported without partitioning within the CU.

[0088] In the case of inter mode, 8 types of partitioning can be supported within the CU, for example, 2Nx2N mode 410, 2NxN mode 415, Nx2N mode 420, NxN mode 425, 2NxnU mode 430, 2NxnD mode 435, nLx2N mode 440, and nRx2N mode 445.

[0089] In case of intra mode, 2Nx2N mode 410 and NxN mode 425 can be supported within a CU.

[0090] Figure 5 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 transform and quantization / inverse quantization (scaling) processing within a CU. A TU can have a rectangular or square form. A CU that is no longer partitioned from a CU partitioned from an LCU can be partitioned into one or more TUs.

[0092] Here, the partition structure of TU can be a quadtree structure. Figure 5 As shown in , one CU 510 can be partitioned into one or more partitions depending on a quadtree structure, thereby forming TUs having various sizes.

[0093] Meanwhile, in HEVC, as in H.264 / AVC, inter-frame prediction (hereinafter referred to as intra-frame prediction) encoding can be performed. Here, encoding can be performed by deriving an intra-frame prediction mode (or prediction directionality) for the current block from neighboring blocks located near the current block.

[0094] As described above, the predicted image of the signal obtained by performing prediction based on the intra-frame prediction mode can have a difference with the original image. The residual image having the difference between the predicted image and the original image can be subjected to entropy coding 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-frame prediction mode can be selectively and adaptively applied depending on the block size.

[0095] Furthermore, in order to increase the coding efficiency in screen contents such as document images or lecture 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 transform processing, and performs entropy encoding 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-encoded block. Therefore, the block to which the transform skip algorithm has been applied skips the frequency transform / inverse transform processing.

[0097] During quantization / inverse quantization, scaling factors can be applied differently depending on the location of transform coefficients within a block to improve the overall image quality. Alternatively, there is a method that applies the same scaling factor regardless of the location of transform coefficients within a block when performing quantization / inverse quantization. Whether this method is applied can be signaled via the Sequence Parameter Set (SPS) or Picture Parameter Set (PPS) of the bitstream.

[0098] As an example of this process, scaling processing for transform coefficients can be performed as follows.

[0099] Scaling of transform coefficients

[0100] In this case, the input is as follows.

[0101] -The width of the current transform block; nW

[0102] -The height of the current transform block; nH

[0103] - has element c ij Array of transform coefficients; (nWxnH) array d

[0104] -Index of the luminance signal and chrominance signal of the current block; cIdx

[0105] If cIdx is 0, it means the luminance signal. If cIdx is 1 or cIdx is 2, it means the chrominance signal. Also, if cIdx is 1, it means Cb in the chrominance signal. If cIdx is 2, it means Cr in the chrominance signal.

[0106] -Quantization parameter; qP

[0107] In this case, the output is as follows.

[0108] - Array of scaled transform coefficients: (nWxnH) 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 a luminance signal), then from "shift=BitDepth Y +log2TrSize-5” to derive the parameter shift. If cIx is not 0 (in the case of chroma signals), then from “shift=BitDepth C +log2TrSize–5” to derive the parameter shift. Here, BitDepth Y and BitDepth Cmeans the number of bits used for samples of the current picture (eg, 8 bits).

[0110] The array "levelScale[]" for scaling parameters 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 coefficients are calculated through the following process.

[0114] First, the scaling factor m is derived by the following process ij .

[0115] If scaling_list_enable_flag is 0, the scaling factor m is derived as in Equation 2 below ij .

[0116] Equation 2

[0117] m ij =16

[0118] If scaling_list_enable_flag is not 0, the scaling factor m is derived as in Equation 3 below ij .

[0119] Equation 3

[0120] m ij =ScalingFactor[SizeID][RefMatrixID][trafoType][i*nW+j]

[0121] In Equation 3, SizeID is derived by the following Table 1 according to the size of the transform block, 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 through a sequence parameter set (SPS) or a picture parameter set (PPS) of a 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] The size of the 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, the frequency transform process is not performed on the block to which the transform skip algorithm has been applied as described above (hereinafter referred to as a transform skip block). Therefore, the existing block to which the frequency transform process has been performed and the transform skip block can have different transform coefficient characteristics. In other words, if the scaling method applied to the existing block to which the frequency transform process has been performed is applied unchanged to the transform skip block, encoding efficiency can be reduced.

[0133] Therefore, the present invention provides a method of performing scaling by considering a case in which a block is a transform skip block.

[0134] If a quantization matrix (default matrix and non-default matrix) is used in an encoder and decoder to improve the subjective picture quality of an image, the scaling factor derived from the quantization matrix can be applied differently depending on the location of the transform coefficient within the block. In this method, when transforming the block, by utilizing the characteristic that the energy of the residual block is compressed to the upper left of the block (i.e., the low-frequency region), quantization with a larger quantization step size is performed for high-frequency regions to which the human eye is less sensitive (rather than for low-frequency regions to which the human eye is sensitive). According to this method, when encoding an image, the subjective picture quality of regions to which the human eye is sensitive can be improved.

[0135] However, if a 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 / inverse quantization method used in the existing frequency domain is applied, there is a disadvantage in 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 / inverse quantization) method that can reduce the distortion within the image or block in a block (i.e., a transform skip block) on which a frequency domain transform / inverse transform is not performed. For example, there is a method in which a quantization matrix is ​​not applied to a transform skip block. In this method, the basic scaling factor can be applied equally regardless of the location of the transform coefficient within the block.

[0136] [Embodiment 1] For applying scaling factors uniformly to transform skip blocks regardless of the location of transform coefficients within the block Method and apparatus

[0137] Figure 6 is a flowchart illustrating a scaling method for a residual signal (or transform coefficient) according to an embodiment of the present invention.

[0138] Figure 6 The scaling method can be Figure 1 Encoding device or Figure 2 More specifically, Figure 6 The scaling method can be Figure 1 or 2 is executed in the quantization unit or inverse quantization unit. Figure 6 In the embodiment, although for the convenience of description Figure 6 The scaling method is shown as being performed in the encoding device, but Figure 6 The scaling method can be applied identically in the decoding device.

[0139] refer to Figure 6 , the scaling factor m applied when performing scaling (quantization or inverse quantization) on the residual signal (or transform coefficient) within the current block can be derived depending on whether the current block is a transform skip block. ij .

[0140] The encoding apparatus determines whether a current block is a transform skip block in step S600.

[0141] Whether the current block is a transform skip block can be determined 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 a flag "transSkipFlag". The value of the flag "transSkipFlag" can be derived by performing entropy decoding on 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 result of the determination that the current block is a transform skip block (for example, the value of the flag 'transSkipFlag' is 1), the encoding apparatus derives a scaling factor m in step S610. ij Regardless of the location of the residual signal (or transform coefficient) within the current block.

[0143] Here, as Figure 6 As shown in ij 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 result of the determination that the current block is not a transform skip block (for example, the value of the flag 'transSkipFlag' is 0), the encoding apparatus derives a scaling factor m based on the location of the residual signal (or transform coefficient) within the current block in step S620. ij .

[0145] Here, the scaling factor m can be set differently depending on the residual signal (or transform coefficient) within the current block using the quantization matrix ij .like Figure 6 As shown in , the scaling factor m can be derived as in Equation 7 below ij .

[0146] Equation 7

[0147] m ij =ScalingFactor[SizeID][RefMatrixID][trafoType][i*nW+j]

[0148] In Equation 7, ScalingFactor is an array in which the scaling factor is stored. 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 Equations 8 and 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 in Table 2 below. scaling_list_pred_matrix_id_delta is signaled through a sequence parameter set (SPS) or a 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 MatrixID values ​​according to prediction modes and color components.

[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 7 The scaling method can be Figure 1 Encoding device or Figure 2 More specifically, Figure 7 The scaling method can be Figure 1 or 2 is executed in the quantization unit or inverse quantization unit. Figure 7 In the embodiment, although for the convenience of description Figure 7 The scaling method is shown as being performed in the encoding device, but Figure 7 The scaling method can be applied identically in the decoding device.

[0160] refer to Figure 7 , the scaling factor m applied when performing scaling (quantization or inverse quantization) on 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 apparatus determines whether a current block uses a quantization matrix and whether the current block is a transform skip block in step S700 .

[0162] Whether the current block uses a quantization matrix can be determined 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 a flag "scaling_list_enable_flag". The value of the flag "scaling_list_enable_flag" can be derived by performing entropy decoding on information about the use of a quantization matrix in a 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, whether the current block is a transform skip block can be determined 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 a flag "transSkipFlag". The value of the flag "transSkipFlag" can be derived by performing entropy decoding on information about transform skip blocks 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 result of the determination 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 apparatus derives a scaling factor m in step S710. ij , regardless of the location of the residual signal (or transform coefficient) within the current block.

[0165] like Figure 7 As shown in 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 result of the determination that the current block is not a transform skip block and the current block uses a quantization matrix, the encoding apparatus derives a scaling factor m based on the location of the residual signal (or transform coefficient) within the current block in step S720. ij .

[0167] Scaling factor m ij The quantization matrix can be set differently depending on the location of the residual signal (or transform coefficient) in the current block, and can be used as Figure 7 The scaling factor m derived from the equation shown in step S720 is ij Referenced Figure 6 The step S620 is described above, and its description is omitted.

[0168] As referenced above Figure 6 and 7 As described above, if the current block (i.e., the target block to be encoded or decoded) is a transform skip block, a scaling factor having a specific value T is applied to the current block (i.e., the transform skip block), regardless of the location of the coefficient (or signal) within the current block. Here, the value of the scaling factor according to an embodiment of the present invention may 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 (eg, scaling_list_enable_flag) indicating whether a quantization matrix is ​​used.

[0170] - If the quantization matrix is ​​used (eg, scaling_list_enable_flag == 1), the basic scaling factor value is set to "T1" (m ij =T1)

[0171] If the quantization matrix is ​​not used (eg, scaling_list_enable_flag == 0), the basic scaling factor value is set to "T2" (m ij =T2)

[0172] The T1 and / or T2 values ​​may be determined and signaled by the encoder, or predetermined T1 and / or T2 values ​​may be used. If the T1 and / or T2 values ​​are signaled via a bitstream, the decoder can obtain the T1 and / or T2 values ​​by parsing the bitstream.

[0173] For another example, the value of the scaling factor to be applied to the corresponding block can be set as follows based on the value of information about color characteristics of a signal from which the corresponding block can be derived (e.g., a color component index cIdx). The color component index cIdx indicates a luminance signal (i.e., a Y signal) or a chrominance signal (i.e., a Cb signal or a 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 luma signal. For example, if the signal of the corresponding block is a luma signal, the basic scaling factor value is set to "Ty". If the signal of the corresponding block is not a luma signal (i.e., a chroma signal), the basic scaling factor value is set to "Tc".

[0175] Example 2: A basic scaling factor value is set according to each color component of a corresponding block. For example, if the color component of the corresponding block is a luminance signal (i.e., a Y signal), the basic scaling factor value is set to "Ty". If the chrominance signal is a Cb signal, the basic scaling factor value is set to "Tcb". If the chrominance signal is a Cr signal, the basic scaling factor value is set to "Tcr".

[0176] Here, the Ty, Tc, Tcb and / or Tcr values ​​may be determined by the encoder and signaled, or predetermined Ty, Tc, Tcb and / or Tcr values ​​may be used. If the Ty, Tc, Tcb and / or Tcr values ​​are signaled via a bitstream, the decoder can obtain the Ty, Tc, Tcb and / or Tcr values ​​by parsing the bitstream.

[0177] The locations 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 coefficient (or signal) within the block (i.e., the target block to be encoded or decoded).

[0178] The scaling process for transform coefficients into which embodiments of the present invention have been incorporated can be performed as follows.

[0179] Scaling of transform coefficients

[0180] In this case, the input is as follows.

[0181] -The width of the current transform block; nW

[0182] -The height of the current transform block; nH

[0183] - has element c ij Array of transform coefficients; (nWxnH) array d

[0184] - Information indicating whether a transform skip algorithm has been applied to the current transform block

[0185] -Index of the luminance signal and chrominance signal for the current transform block; cIdx

[0186] If cIdx is 0, it means the luminance signal. If cIdx is 1 or cIdx is 2, it means the chrominance signal. Also, if cIdx is 1, it means Cb in the chrominance signal. If cIdx is 2, it means Cr in the chrominance signal.

[0187] -Quantization parameter; qP

[0188] In this case, the output is as follows.

[0189] - Array of scaled transform coefficients: (nWxnH) array d ij

[0190] The parameter "log2TrSize" is derived by "log2TrSize=(Log2(nW)+Log2(nH))>>1". The parameter shift is derived differently according to cIdx. If cIx is 0 (ie, in the case of a luminance signal), then from "shift=BitDepth Y +log2TrSize-5” to derive the parameter shift. If cIx is not 0 (ie, in the case of a chroma signal), then from “shift=BitDepth C +log2TrSize–5” to derive the parameter shift. Here, BitDepth Y and BitDepth C means the number of bits used for samples of the current picture (eg, 8 bits).

[0191] The array "levelScale[]" for scaling parameters is the same as Equation 10.

[0192] Equation 10

[0193] levelScale[k] = {40, 45, 51, 57, 64, 72} where k = 0..5

[0194] The scaled transform coefficients are calculated through the following process.

[0195] First, the scaling factor m is derived by the following process ij .

[0196] If scaling_list_enable_flag is 0 or the current transform block is a transform skip block, the scaling factor m is derived as in Equation 11 below ij .

[0197] Equation 11

[0198] m ij =16

[0199] If not, the scaling factor m is derived as in Equation 12 below ij .

[0200] Equation 12

[0201] m ij =ScalingFactor[SizeID][RefMatrixID][trafoType][i*nW+j]

[0202] In Equation 12, SizeID is derived through the above Table 1 according to the size of the transform block, and RefMatrixID and trafoType are derived from the following Equations 13 and 14, respectively. Also, in Equation 13, scaling_list_pred_matrix_id_delta is signaled through a sequence parameter set (SPS) of a 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 by the scaling process as described above.Here, the inverse transform process is not performed, but the following shift operation process is performed only on the current transform block to which the transform skip algorithm has been applied.

[0211] 1. If the cIdx of the current block is 0 (in the case of a luminance signal), then shift = 13-BitDepth Y If the cIdx of the current block is not 0 (in the case of chroma signal), shift = 13-BitDepth C .

[0212] 2. Set the array r for the residual block 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 the array of scaled transform coefficients, and r ij means an array of residual blocks obtained by performing inverse transform on the scaled transform coefficients.

[0215] As an embodiment to which the inverse transform process of the scaled transform coefficients has been incorporated, the transform process for the scaled transform coefficients can be performed as follows.

[0216] Transform processing for scaled transform coefficients

[0217] In this case, the input is as follows.

[0218] -The width of the current transform block; nW

[0219] -The height of the current transform block; nH

[0220] - has element d ij Array of transform coefficients; (nWxnH) array d

[0221] - Information indicating whether a transform skip algorithm has been applied to the current transform block

[0222] -Index of the luminance signal and chrominance signal for the current transform block; cIdx

[0223] If cIdx is 0, it means the luminance signal. If cIdx is 1 or cIdx is 2, it means the chrominance signal. Also, if cIdx is 1, it means Cb in the chrominance signal. If cIdx is 2, it means Cr in the chrominance signal.

[0224] -Quantization parameter; qP

[0225] In this case, the output is as follows.

[0226] - an array of residual blocks obtained by performing inverse transform on the scaled transform coefficients; an (nW x nH) array r

[0227] If the coding mode "PredMode" for the current block is an intra prediction mode, the value of Log2(nW*nH) is 4, and the value of cIdx is 0, the intra prediction mode depending on the luma signal is obtained by using the following Table 3 to obtain the parameters "horizTrType" and "vertTrType". If not, the parameters "horizTrType" and "vertTrType" are set to 0.

[0228] Table 3 shows examples of values ​​of parameters "horizTrType" and "vertTrType" according to the intra prediction mode.

[0229]

Table 3

[0230] IntraPredMode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 vertTrType 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 horizTrType 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

[0231] IntraPredMode 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 vertTrType 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 horizTrType 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 according to the following sequence.

[0233] First, if the transform skip algorithm for the current block has been applied, the following process is performed.

[0234] 1. If cIdx is 0, then shift = 13 – BitDepth Y If cIdx is not 0, 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 process is performed.

[0238] 1. Perform inverse transform processing on the scaled transform coefficients using the values ​​of the parameters "horizTrType" and "vertTrType". 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 performing a horizontal 1-dimensional inverse transform.

[0239] 2. Next, receive the array "(nWxnH)Arraye" and derive the array "(nWxnH)Arrayg" as in Equation 16.

[0240] Equation 16

[0241] g ij=Clip3(-32768,32767,(e ij +64)>>7)

[0242] 3. Next, the size (nW, nH) of the current block, the array "(nWxnH) array g", and the parameter "vertTrType" are received, and a 1-dimensional inverse transform is performed horizontally.

[0243] 4. Next, the array "(nW x nH) array r" for the residual block is set as in Equation 17 below, depending on cIdx.

[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 used for samples of the current image (e.g., 8 bits).

[0247] By performing the above-described scaling process on the transform coefficients and performing the above-described transform process on the scaled transform coefficients, a reconstructed residual block can be generated. Furthermore, a reconstructed block can be generated by adding a prediction block generated by intra prediction or inter prediction to the reconstructed residual block. Here, the reconstructed block may be a block to which a loop filter has been applied or a block to which a loop filter has not yet been applied.

[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, a basic scaling factor derived depending on whether a current block is a transform skip block can be signaled through a sequence parameter set (SPS).

[0250] Table 4 shows an example of an SPS syntax for signaling information about a basic scaling factor according to an embodiment of the present invention.

[0251]

Table 4

[0252]

[0253] Referring to Table 4, 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 with a positive or negative sign (se(v)). Alternatively, each value can be coded with 0 and a positive sign (ue(v)).

[0255] flat_scale_factor_y_minus16 means a scaling factor for a luma signal. For example, if the value of flat_scale_factor_y_minus16 is 0, the scaling factor for a luma signal has a value of 16, where 16 has been added to 0.

[0256] flat_scale_factor_cb_minus16 means a scaling factor for the chrominance signal Cb. flat_scale_factor_cr_minus16 means a scaling factor for the chrominance signal Cr.

[0257] The scaling factor for the luminance signal or the chrominance signal can be derived as in Equations 18 to 20.

[0258] Here, the basic scaling factor FlatScalingFactor[cIdx] stores 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 have a specific value range. For example, an 8-bit signal can have a value from -15 to "255-16".

[0259] The basic 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 basic scaling factor for the Cb chrominance 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 a method of signaling a basic scaling factor derived depending on whether a current block is a transform skip block according to an embodiment of the present invention into a scaling process, a scaling process for transform coefficients can be performed as follows.

[0269] Scaling of transform coefficients

[0270] In this case, the input is as follows.

[0271] -The width of the current transform block; nW

[0272] -The height of the current transform block; nH

[0273] - has element c ij Array of transform coefficients; (nWxnH) array d

[0274] - Information indicating whether a 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 of the luminance signal and chrominance signal of the current block; cIdx

[0277] If cIdx is 0, it means the luminance signal. If cIdx is 1 or cIdx is 2, it means the chrominance signal. Also, if cIdx is 1, it means Cb in the chrominance signal. If cIdx is 2, it 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: (nWxnH) 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 a luminance signal), then from "shift=BitDepth Y +log2TrSize-5” to derive the parameter shift. If cIx is not 0 (ie, in the case of a chroma signal), then from “shift=BitDepth C +log2TrSize–5” to derive the parameter shift. Here, BitDepth Y and BitDepth C means the number of bits used for samples of the current picture (eg, 8 bits).

[0282] The array "levelScale[]" used for scaling parameters 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 through 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 Equation 22 below ij .

[0288] Equation 22

[0289] m ij =(transSkipFlag==1)? FlatScaleFactor[cIdx]:16

[0290] If no (ie, if scaling_list_enable_flag is 1), the scaling factor m is derived as in Equation 23 below 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 by the above Table 1 depending on the size of the block. RefMatrixID and trafoType are derived from the following Equations 24 and 25, respectively. In Equation 24, scaling_list_pred_matrix_id_delta is signaled through a sequence parameter set (SPS) of a 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 the following equation 26.

[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-mentioned SPS, a basic scaling factor derived depending on whether the current block is a transform skip block according to an embodiment of the present invention can be signaled through a picture parameter set (PPS) or a slice header "SliceHeader". In addition, the basic scaling factor can be signaled in a CU unit or a 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-described SPS can be updated and used in the PPS (or Slice Header, CU, or TU).

[0303] Table 5 shows an example of a PPS syntax for signaling information about a basic scaling factor according to another embodiment of the present invention.

[0304]

Table 5

[0305]

[0306] Referring to Table 5, transform_skip_enabled_flag indicates whether the transform skip algorithm will be used in the current picture. If the transform skip algorithm is used, pps_flat_scaling_factor_present_flag is signaled.

[0307] For example, if the value of pps_flat_scaling_factor_present_flag is 0, flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16 applied to the above SPS are used as scaling factors for transform skip blocks. If the value of pps_flat_scaling_factor_present_flag is 1, 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 scale factors for the transform skip block of the current picture. Here, these values ​​continue to be used until they do not change again. Alternatively, these values ​​can be applied only to the current picture, and the scale 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 encoded in a form having a positive or negative sign (se(v)). Alternatively, each of these values ​​can be encoded in a form having 0 and a positive sign (ue(v)).

[0310] The values ​​of “flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16” can be signaled using different values ​​according to each luma signal and each chroma signal. For example, the scaling factor for the luma signal can be signaled using the value “flat_scale_factor_y_minus16,” the scaling factor for the Cb chroma signal can be signaled using the value “flat_scale_factor_cb_minus16,” and the scaling factor for the Cr chroma signal can be signaled using the value “flat_scale_factor_cr_minus16.” Alternatively, the scaling factor for the luma signal may be signaled using flat_scale_factor_y_minus16, and the scaling factors for the chroma signals may be signaled using flat_scale_factor_cb_cr_minus16. Alternatively, one value "flat_scale_factor_y_cb_cr_minus16" may be used to signal the scaling factors for both luma and chroma signals.

[0311] As described above, the values ​​of “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 in the SliceHeader (or CU or TU) and used.

[0312] Table 6 shows an example of a slice header 'SliceHeader' syntax for signaling information about a basic scaling factor according to another embodiment of the present invention.

[0313]

Table 6

[0314]

[0315] Referring to Table 6, transform_skip_enabled_flag indicates whether the transform skip algorithm will be used in the current segment. 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, 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 scaling factors for transform skip blocks. If the value of flat_scaling_factor_override_flag is 1, 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 scaling factors for the transform skip blocks of the current fragment.

[0318] Here, each of the values ​​"flat_scale_factor_y_delta, flat_scale_factor_cb_delta, and flat_scale_factor_cr_delta" can be encoded in a form having a positive or negative sign (se(v)). Alternatively, each value can be encoded in a form having 0 and a positive sign (ue(v)).

[0319] The values ​​of “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 luma signal and each chroma signal. For example, the scaling factor for the luma signal can be signaled using the value flat_scale_factor_y_delta, the scaling factor for the Cb chroma signal can be signaled using the value flat_scale_factor_cb_delta, and the scaling factor for the Cr chroma signal can be signaled using the value flat_scale_factor_cr_delta. Alternatively, the scaling factor for the luma signal can be signaled using flat_scale_factor_y_delta, and the scaling factor for the chroma signals can be signaled using flat_scale_factor_cb_cr_delta. Alternatively, the scaling factor for the luma signal can be signaled using flat_scale_factor_y_delta, and the scaling factor for the chroma signals can be signaled using flat_scale_factor_cb_cr_delta. Alternatively, the scaling factors for the luma signal and the chroma signals can be signaled using one value flat_scale_factor_y_cb_cr_delta.

[0320] The basic scaling factors can be derived as in the following Equations 27 to 29 using the values ​​“flat_scale_factor_y_delta, flat_scale_factor_cb_delta, and flat_scale_factor_cr_delta” signaled as described above.

[0321] Here, the basic scaling factor "FlatScalingFactor[cIdx]" stores 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 luma signal can be derived as in Equation 27 using flat_scale_factor_y_delta.

[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 basic scaling factor for the Cb chroma signal can be derived as in Equation 28 using flat_scale_factor_cb_delta.

[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 basic scaling factor for the Cr chroma signal can be derived as in Equation 29 using flat_scale_factor_cr_delta.

[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 ranges depending on the size of the block, the depth of the CU, or the depth of the TU. The parameter that determines the application range (for example, information about the size or depth of the block) can be set by the encoder and the decoder so 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 range differs depending on the depth of the CU, the following three methods can be applied to the above embodiment as illustrated in Table 7. Method A is applied only to a depth of a specific depth or higher, method B is applied only to a depth of a specific depth or lower, and method C is applied only to a specific depth.

[0333] Table 7 shows an example of a method for determining the range in which the method of the present invention is applied depending on the depth of the CU (or TU). In Table 7, the mark "O" means that the corresponding method is applied to the corresponding depth of the CU (or TU), and the mark "X" means that the corresponding method is not applied to the corresponding depth of the CU (or TU).

[0334]

Table 7

[0335] Indicates the depth of the CU (or TU) to which the scope applies Method A Method B Method C 0 X O X 1 X O X 2 O O O 3 O X X 4 or higher O X X

[0336] Referring to Table 7, if the depth of a CU (or TU) is 2, all of Method A, Method B, and Method C can be applied to the embodiment of the present invention.

[0337] If an embodiment of the present invention is not applied to all depths of a CU (or TU), it may be indicated using a specific indicator (e.g., a flag), or may be represented by using a value of the depth of the CU indicating the application range, or by signaling a value that is 1 greater than the maximum value of the depth of the CU.

[0338] Furthermore, a method for determining a range in which the method of the present invention is applied depending on the above-described depth of a CU (or TU) can be applied differently depending on the sizes of luminance blocks and chrominance blocks, and can be applied differently depending on luminance images and chrominance images.

[0339] Table 8 shows an example schematically illustrating a combination of methods of determining an application range depending on the sizes of a luminance block and a chrominance block.

[0340]

Table 8

[0341]

[0342] In the case of method "G 1" 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), embodiment 1 (G1-embodiment 1) of the present invention can be applied to the luminance signal and the chrominance signal as well as the horizontal signal and the vertical signal.

[0343] In the above exemplary systems, although the 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 may be performed in a different order than other steps, or may be performed simultaneously with other steps. In addition, it will be understood by those skilled in the art that the steps shown in the flowchart are not exclusive, and the steps may include additional steps, or one or more steps in the flowchart may 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 interpreted as limiting the technical spirit of the present invention, but should be interpreted 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 interpreted based on the appended claims. Therefore, the present invention should be interpreted as covering all modifications or variations derived from the appended claims and their equivalent meanings and scopes.

Claims

1. A method for decoding an image using a decoding device, comprising: determining whether a current picture including the current block is allowed to be skipped; determining whether the current block is a transform skip block based on the determination of whether the current picture is allowed to skip transform; deriving a scaling factor for the current block depending on whether the current block is the transform skip block; performing inverse quantization by performing scaling on 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 based on the prediction mode of the current block to generate a prediction sample 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 and locations of transform coefficients within the current block and the 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 the location of the transform coefficients within the current block and the prediction mode of the current block, and The transform skip block is specified by a bitstream based on information indicating 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: The scaling factor is derived 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: The scaling factor is derived depending on whether the current block is a luma block or a chroma block.

5. The image decoding method according to claim 1, wherein a flag indicating whether the current picture is allowed to be skipped is signaled through a picture parameter set (PPS).

6. An image encoding method using an encoding device, comprising: determining whether a current picture including the current block is allowed to be skipped; determining whether the 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 performing scaling on 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 based on the prediction mode of the current block to generate a prediction sample 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 and locations of transform coefficients within the current block and the 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 the location of the transform coefficients within the current block and the prediction mode of the current block, and The transform skip block is specified based on information indicating whether to apply inverse transform to the current block.