WO2021118310A1 - Video signal processing method and device - Google Patents

Video signal processing method and device Download PDF

Info

Publication number
WO2021118310A1
WO2021118310A1 PCT/KR2020/018201 KR2020018201W WO2021118310A1 WO 2021118310 A1 WO2021118310 A1 WO 2021118310A1 KR 2020018201 W KR2020018201 W KR 2020018201W WO 2021118310 A1 WO2021118310 A1 WO 2021118310A1
Authority
WO
WIPO (PCT)
Prior art keywords
flag
block
value
pixel
palette
Prior art date
Application number
PCT/KR2020/018201
Other languages
French (fr)
Korean (ko)
Inventor
임성원
Original Assignee
주식회사 케이티
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 주식회사 케이티 filed Critical 주식회사 케이티
Publication of WO2021118310A1 publication Critical patent/WO2021118310A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/105Selection of the reference unit for prediction within a chosen coding or prediction mode, e.g. adaptive choice of position and number of pixels used for prediction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/117Filters, e.g. for pre-processing or post-processing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/129Scanning of coding units, e.g. zig-zag scan of transform coefficients or flexible macroblock ordering [FMO]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • H04N19/137Motion inside a coding unit, e.g. average field, frame or block difference
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/593Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving spatial prediction techniques
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/625Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using discrete cosine transform [DCT]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/70Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
    • H04N19/91Entropy coding, e.g. variable length coding [VLC] or arithmetic coding

Definitions

  • the present disclosure relates to a video signal processing method and apparatus.
  • HD High Definition
  • UHD Ultra High Definition
  • Interprediction technology that predicts pixel values included in the current picture from pictures before or after the current picture as an image compression technology
  • intra prediction technology that predicts pixel values included in the current picture using pixel information in the current picture
  • Various technologies exist such as entropy encoding technology in which a short code is assigned to a value with a high frequency and a long code is allocated to a value with a low frequency of occurrence, and the image data can be effectively compressed and transmitted or stored using these image compression techniques.
  • An object of the present disclosure is to provide a method and apparatus for efficiently encoding/decoding a residual coefficient in encoding/decoding a video signal.
  • An object of the present disclosure is to provide a method and apparatus for adaptively determining an encoding method of a residual coefficient according to whether lossless encoding is applied in encoding/decoding a video signal.
  • An object of the present disclosure is to provide an encoding/decoding method and apparatus using a palette table in encoding/decoding a video signal.
  • An image decoding method includes the steps of determining whether lossless encoding is applied to a current image, decoding a residual coefficient for a current block in the current image, and deriving a residual sample based on the residual coefficient may include the step of In this case, when decoding the residual coefficient, one of a first method using a maximum of m comparison flags and a second method using a maximum of n comparison flags is selected based on whether lossless encoding is applied to the current image, and , the comparison flag may indicate whether an absolute value of the residual coefficient exceeds a predetermined value.
  • a syntax indicating the absolute value of the residual coefficient as it is instead of the comparison flag may be decoded.
  • the number of bins decoded using the context information increases.
  • the first syntax when the first syntax is decoded and the first syntax indicates that the residual coefficient has a value other than 0, whether the absolute value of the residual coefficient has a value greater than 1 gt_1_flag indicating whether or not can be further decoded.
  • gt_1_flag indicates that the absolute value has a value greater than 1
  • a parity flag indicating whether the absolute value is an even number and gt_2_flag indicating whether the absolute value is greater than 3 may be further decoded.
  • the threshold value may be determined based on the size of the current block.
  • An image encoding method includes determining whether lossless encoding is applied to a current image, deriving a residual coefficient based on a residual sample of a current block, and encoding the residual coefficient of the current block may include steps.
  • the comparison flag when encoding the residual coefficient, one of a first method using a maximum of m comparison flags and a second method using a maximum of n comparison flags is selected based on whether lossless encoding is applied to the current image, , the comparison flag may indicate whether an absolute value of the residual coefficient exceeds a predetermined value.
  • encoding/decoding efficiency can be improved by differently setting the encoding method of a residual coefficient according to the number of bins to be encoded using context information.
  • coding/decoding efficiency can be improved by adaptively determining a coding method for residual coefficients according to whether lossless coding is applied.
  • encoding/decoding efficiency can be improved by using the palette table.
  • FIG. 1 is a block diagram illustrating an image encoding apparatus according to an embodiment of the present disclosure.
  • FIG. 2 is a block diagram illustrating an image decoding apparatus according to an embodiment of the present disclosure.
  • 3 and 4 illustrate a lossless encoding method according to the present disclosure.
  • FIG 5 illustrates an intra prediction method according to the present disclosure.
  • FIG. 7 illustrates a method of encoding an intra prediction mode according to the present disclosure.
  • FIG 9 illustrates an intra prediction method based on a planar mode according to the present disclosure.
  • FIG. 10 illustrates an intra prediction method based on a DC mode according to the present disclosure.
  • 11 to 13 illustrate an improved intra prediction method according to the present disclosure.
  • FIG. 14 is an exemplary diagram for explaining an application aspect of DPCM.
  • FIG. 15 illustrates a search order when a zigzag scan is applied, according to an embodiment of the present disclosure.
  • 16 is a flowchart illustrating a process of encoding residual coefficients in an encoder.
  • 17 is a flowchart illustrating a process of encoding size information of residual coefficients.
  • 18 is a flowchart illustrating a process of decoding a residual coefficient in a decoder.
  • 19 is a diagram illustrating a decoding process of size information of residual coefficients.
  • 20 to 24 are diagrams illustrating examples of counting the number of bins using context information.
  • 25 and 26 show the surrounding restoration area referenced to determine context information.
  • FIGS 27 to 29 are diagrams for explaining the concept of the palette mode (palette mode) according to the present disclosure.
  • FIG. 30 illustrates a method of performing intra prediction based on a palette mode according to the present disclosure.
  • 31 and 32 show a method of configuring a pallet table according to the present disclosure.
  • 33 is a diagram illustrating an example in which palette entries are added to the palette entry candidate list.
  • 35 is a diagram illustrating a method of signaling a palette prediction flag in the form of a binary vector based on run length encoding as an embodiment to which the present disclosure is applied.
  • 36 illustrates a method of encoding/decoding a palette index according to a scan order according to the present disclosure.
  • 37 is an exemplary diagram for describing a pixel adjacent to a current pixel.
  • 39 is an example showing the range of the context information index.
  • index-related information is encoded in units of a region having a preset size.
  • 41 shows an example in which index-related information is encoded using inter-block dependency.
  • 45 is an example for describing a neighboring block of the current block.
  • first, second, etc. may be used to describe various elements, but the elements should not be limited by the terms. The above terms are used only for the purpose of distinguishing one component from another. For example, without departing from the scope of the present disclosure, a first component may be referred to as a second component, and similarly, a second component may also be referred to as a first component. and/or includes a combination of a plurality of related listed items or any of a plurality of related listed items.
  • FIG. 1 is a block diagram illustrating an image encoding apparatus according to an embodiment of the present disclosure.
  • the image encoding apparatus 100 includes a picture division unit 110 , prediction units 120 and 125 , a transform unit 130 , a quantization unit 135 , a rearrangement unit 160 , and an entropy encoding unit ( 165 ), an inverse quantization unit 140 , an inverse transform unit 145 , a filter unit 150 , and a memory 155 .
  • each of the constituent units shown in FIG. 1 is independently illustrated to represent different characteristic functions in the image encoding apparatus, and does not mean that each constituent unit is composed of separate hardware or one software constituent unit. That is, each component is listed as each component for convenience of description, and at least two components of each component are combined to form one component, or one component can be divided into a plurality of components to perform a function, and each of these components Integrated embodiments and separate embodiments of the components are also included in the scope of the present disclosure without departing from the essence of the present disclosure.
  • components are not essential components to perform an essential function in the present disclosure, but may be optional components for merely improving performance.
  • the present disclosure may be implemented by including only essential components to implement the essence of the present disclosure, except for components used for performance improvement, and a structure including only essential components excluding optional components used for performance improvement Also included in the scope of the present disclosure.
  • the picture divider 110 may divide the input picture into at least one processing unit.
  • the processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU).
  • the picture splitter 110 divides one picture into a combination of a plurality of coding units, prediction units, and transformation units, and combines one coding unit, prediction unit, and transformation unit based on a predetermined criterion (eg, a cost function). can be selected to encode the picture.
  • a predetermined criterion eg, a cost function
  • one picture may be divided into a plurality of coding units.
  • a recursive tree structure such as a quad tree structure can be used.
  • a unit may be divided having as many child nodes as the number of divided coding units.
  • a coding unit that is no longer split according to certain restrictions becomes a leaf node. That is, when it is assumed that only square splitting is possible for one coding unit, one coding unit may be split into up to four different coding units.
  • a coding unit may be used as a unit for performing encoding or may be used as a meaning for a unit for performing decoding.
  • a prediction unit may be split in the form of at least one square or rectangle of the same size within one coding unit, and one prediction unit among the split prediction units within one coding unit is a prediction of another. It may be divided to have a shape and/or size different from that of the unit.
  • intra prediction may be performed without dividing the prediction unit into a plurality of prediction units NxN.
  • the prediction units 120 and 125 may include an inter prediction unit 120 performing inter prediction and an intra prediction unit 125 performing intra prediction. Whether to use inter prediction or to perform intra prediction for a prediction unit may be determined, and specific information (eg, intra prediction mode, motion vector, reference picture, etc.) according to each prediction method may be determined. In this case, a processing unit in which prediction is performed and a processing unit in which a prediction method and specific content are determined may be different. For example, a prediction method and a prediction mode may be determined in a prediction unit, and prediction may be performed in a transformation unit. A residual value (residual block) between the generated prediction block and the original block may be input to the transform unit 130 . Also, prediction mode information, motion vector information, etc.
  • the entropy encoder 165 may be encoded by the entropy encoder 165 together with the residual value and transmitted to the decoding apparatus.
  • a specific encoding mode it is also possible to encode the original block as it is without generating the prediction block through the prediction units 120 and 125 and transmit it to the decoder.
  • the inter prediction unit 120 may predict a prediction unit based on information on at least one of a picture before or after a picture of the current picture, and in some cases, prediction based on information of a partial region in the current picture that has been encoded Units can also be predicted.
  • the inter prediction unit 120 may include a reference picture interpolator, a motion prediction unit, and a motion compensator.
  • the reference picture interpolator may receive reference picture information from the memory 155 and generate pixel information of integer pixels or less in the reference picture.
  • a DCT-based 8-tap interpolation filter (DCT-based Interpolation Filter) with different filter coefficients may be used to generate pixel information of integer pixels or less in units of 1/4 pixels.
  • a DCT-based 4-tap interpolation filter in which filter coefficients are different to generate pixel information of integer pixels or less in units of 1/8 pixels may be used.
  • the motion prediction unit may perform motion prediction based on the reference picture interpolated by the reference picture interpolator.
  • various methods such as Full search-based Block Matching Algorithm (FBMA), Three Step Search (TSS), and New Three-Step Search Algorithm (NTS) may be used.
  • the motion vector may have a motion vector value of 1/2 or 1/4 pixel unit based on the interpolated pixel.
  • the motion prediction unit may predict the current prediction unit by using a different motion prediction method.
  • Various methods such as a skip method, a merge method, an AMVP (Advanced Motion Vector Prediction) method, an intra block copy method, etc., may be used as the motion prediction method.
  • the intra prediction unit 125 may generate a prediction unit based on reference pixel information around the current block, which is pixel information in the current picture.
  • reference pixel information around the current block which is pixel information in the current picture.
  • a neighboring block of the current prediction unit is a block on which inter prediction is performed, and thus a reference pixel is a pixel on which inter prediction is performed
  • a reference pixel included in the block on which inter prediction is performed is a reference pixel of the block on which intra prediction has been performed. information can be used instead. That is, when the reference pixel is not available, the unavailable reference pixel information may be replaced with at least one reference pixel among the available reference pixels.
  • the prediction mode may have a directional prediction mode that uses reference pixel information according to a prediction direction and a non-directional mode that does not use directional information when prediction is performed.
  • a mode for predicting luminance information and a mode for predicting chrominance information may be different, and intra prediction mode information used for predicting luminance information or predicted luminance signal information may be utilized to predict chrominance information.
  • intra prediction When intra prediction is performed, if the size of the prediction unit and the size of the transformation unit are the same, intra prediction for the prediction unit based on the pixel present on the left side, the pixel present on the upper left side, and the pixel present on the upper side of the prediction unit can be performed. However, when the size of the prediction unit is different from the size of the transformation unit when performing intra prediction, intra prediction may be performed using a reference pixel based on the transformation unit. In addition, intra prediction using NxN splitting may be used only for the smallest coding unit.
  • the intra prediction method may generate a prediction block after applying an adaptive intra smoothing (AIS) filter to a reference pixel according to a prediction mode.
  • AIS adaptive intra smoothing
  • the intra prediction mode of the current prediction unit may be predicted from the intra prediction mode of the prediction unit existing around the current prediction unit.
  • the prediction mode of the current prediction unit is predicted using the mode information predicted from the neighboring prediction unit, if the intra prediction mode of the current prediction unit and the neighboring prediction unit are the same, the current prediction unit and the neighboring prediction unit are used using predetermined flag information It is possible to transmit information that the prediction modes of . , and if the prediction modes of the current prediction unit and the neighboring prediction units are different from each other, entropy encoding may be performed to encode prediction mode information of the current block.
  • a residual block including residual information which is a difference value between a prediction unit and an original block of the prediction unit, in which prediction is performed based on the prediction unit generated by the prediction units 120 and 125 may be generated.
  • the generated residual block may be input to the transform unit 130 .
  • the transform unit 130 converts the original block and the residual block including residual information of the prediction unit generated by the prediction units 120 and 125 to DCT (Discrete Cosine Transform), DST (Discrete Sine Transform), KLT and It can be converted using the same conversion method. Whether to apply DCT, DST, or KLT to transform the residual block may be determined based on intra prediction mode information of a prediction unit used to generate the residual block.
  • DCT Discrete Cosine Transform
  • DST Discrete Sine Transform
  • KLT Discrete Sine Transform
  • the quantizer 135 may quantize the values transformed by the transform unit 130 into the frequency domain.
  • the quantization coefficient may change according to blocks or the importance of an image.
  • the value calculated by the quantization unit 135 may be provided to the inverse quantization unit 140 and the rearrangement unit 160 .
  • the rearrangement unit 160 may rearrange the coefficient values on the quantized residual values.
  • the reordering unit 160 may change the two-dimensional block form coefficient into a one-dimensional vector form through a coefficient scanning method.
  • the rearranging unit 160 may use a Zig-Zag Scan method to scan from DC coefficients to coefficients in a high-frequency region and change them into a one-dimensional vector form.
  • a vertical scan that scans a two-dimensional block shape coefficient in a column direction and a horizontal scan that scans a two-dimensional block shape coefficient in a row direction may be used instead of a zig-zag scan according to a size of a transform unit and an intra prediction mode. That is, it may be determined whether any of the zig-zag scan, the vertical scan, and the horizontal scan is used according to the size of the transform unit and the intra prediction mode.
  • the entropy encoding unit 165 may perform entropy encoding based on the values calculated by the reordering unit 160 .
  • various encoding methods such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC) may be used.
  • the entropy encoding unit 165 receives the residual value coefficient information and block type information, prediction mode information, division unit information, prediction unit information and transmission unit information, motion of the coding unit from the reordering unit 160 and the prediction units 120 and 125 .
  • Various information such as vector information, reference frame information, interpolation information of a block, and filtering information may be encoded.
  • the entropy encoder 165 may entropy-encode the coefficient values of the coding units input from the reordering unit 160 .
  • the inverse quantizer 140 and the inverse transform unit 145 inversely quantize the values quantized by the quantizer 135 and inversely transform the values transformed by the transform unit 130 .
  • the residual values generated by the inverse quantizer 140 and the inverse transform unit 145 are combined with the prediction units predicted through the motion estimation unit, the motion compensator, and the intra prediction unit included in the prediction units 120 and 125 and restored. You can create a Reconstructed Block.
  • the filter unit 150 may include at least one of a deblocking filter, an offset correcting unit, and an adaptive loop filter (ALF).
  • a deblocking filter may include at least one of a deblocking filter, an offset correcting unit, and an adaptive loop filter (ALF).
  • ALF adaptive loop filter
  • the deblocking filter may remove block distortion caused by the boundary between blocks in the reconstructed picture.
  • it may be determined whether to apply the deblocking filter to the current block based on pixels included in several columns or rows included in the block.
  • a strong filter or a weak filter can be applied according to the required deblocking filtering strength.
  • horizontal filtering and vertical filtering may be concurrently processed when performing vertical filtering and horizontal filtering.
  • the offset corrector may correct the offset of the deblocked image with respect to the original image in units of pixels.
  • a method of dividing pixels included in an image into a certain number of regions, determining the region to be offset and applying the offset to the region, or taking edge information of each pixel into consideration can be used to apply
  • Adaptive loop filtering may be performed based on a value obtained by comparing the filtered reconstructed image and the original image. After dividing the pixels included in the image into a predetermined group, one filter to be applied to the corresponding group is determined, and filtering can be performed differentially for each group.
  • the luminance signal may be transmitted for each coding unit (CU), and the shape and filter coefficients of the ALF filter to be applied may vary according to each block.
  • the ALF filter of the same type may be applied regardless of the characteristics of the target block.
  • the memory 155 may store the reconstructed block or picture calculated through the filter unit 150 , and the stored reconstructed block or picture may be provided to the predictors 120 and 125 when inter prediction is performed.
  • FIG. 2 is a block diagram illustrating an image decoding apparatus according to an embodiment of the present disclosure.
  • the image decoding apparatus 200 includes an entropy decoding unit 210, a reordering unit 215, an inverse quantization unit 220, an inverse transform unit 225, prediction units 230 and 235, and a filter unit ( 240) and a memory 245 may be included.
  • the input bitstream may be decoded by a procedure opposite to that of the image encoding apparatus.
  • the entropy decoding unit 210 may perform entropy decoding in a procedure opposite to that performed by the entropy encoding unit of the image encoding apparatus. For example, various methods such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC) may be applied corresponding to the method performed by the image encoding apparatus.
  • various methods such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC) may be applied corresponding to the method performed by the image encoding apparatus.
  • CAVLC Context-Adaptive Variable Length Coding
  • CABAC Context-Adaptive Binary Arithmetic Coding
  • the entropy decoding unit 210 may decode information related to intra prediction and inter prediction performed by the encoding apparatus.
  • the reordering unit 215 may perform reordering based on a method of rearranging the entropy-decoded bitstream by the entropy decoding unit 210 by the encoder. Coefficients expressed in the form of a one-dimensional vector may be restored and rearranged as coefficients in the form of a two-dimensional block.
  • the reordering unit 215 may receive information related to coefficient scanning performed by the encoder and perform the reordering by performing a reverse scanning method based on the scanning order performed by the corresponding encoder.
  • the inverse quantization unit 220 may perform inverse quantization based on the quantization parameter provided by the encoding apparatus and the reordered coefficient values of the blocks.
  • the inverse transform unit 225 may perform inverse transforms, ie, inverse DCT, inverse DST, and inverse KLT, on the transforms performed by the transform unit, ie, DCT, DST, and KLT, on the quantization result performed by the image encoding apparatus. Inverse transform may be performed based on a transmission unit determined by the image encoding apparatus.
  • the inverse transform unit 225 of the image decoding apparatus may selectively perform a transformation technique (eg, DCT, DST, KLT) according to a plurality of pieces of information such as a prediction method, a size of a current block, and a prediction direction.
  • a transformation technique eg, DCT, DST, KLT
  • the prediction units 230 and 235 may generate a prediction block based on the prediction block generation related information provided from the entropy decoding unit 210 and previously decoded block or picture information provided from the memory 245 .
  • intra prediction when intra prediction is performed in the same manner as in the operation in the image encoding apparatus, when the size of the prediction unit and the size of the transformation unit are the same, the pixel present on the left side of the prediction unit, the pixel present on the upper left side, and the upper Intra prediction is performed on the prediction unit based on the existing pixel, but when the size of the prediction unit and the size of the transformation unit are different when performing intra prediction, intra prediction is performed using the reference pixel based on the transformation unit can do. Also, intra prediction using NxN splitting may be used only for the smallest coding unit.
  • the prediction units 230 and 235 may include a prediction unit determiner, an inter prediction unit, and an intra prediction unit.
  • the prediction unit determining unit receives various information such as prediction unit information input from the entropy decoder 210, prediction mode information of the intra prediction method, and motion prediction related information of the inter prediction method, and divides the prediction unit from the current coding unit, and predicts It may be determined whether the unit performs inter prediction or intra prediction.
  • the inter prediction unit 230 uses information required for inter prediction of the current prediction unit provided from the image encoding apparatus based on information included in at least one of a picture before or after the current picture including the current prediction unit. Inter prediction may be performed on the prediction unit. Alternatively, inter prediction may be performed based on information of a pre-restored partial region in the current picture including the current prediction unit.
  • a motion prediction method of a prediction unit included in a corresponding coding unit based on a coding unit is selected from among skip mode, merge mode, AMVP mode, and intra block copy mode. You can decide which way to go.
  • the intra prediction unit 235 may generate a prediction block based on pixel information in the current picture.
  • intra prediction may be performed based on intra prediction mode information of the prediction unit provided by the image encoding apparatus.
  • the intra prediction unit 235 may include an Adaptive Intra Smoothing (AIS) filter, a reference pixel interpolator, and a DC filter.
  • the AIS filter is a part that performs filtering on the reference pixel of the current block, and may be applied by determining whether to apply the filter according to the prediction mode of the current prediction unit.
  • AIS filtering may be performed on the reference pixel of the current block by using the prediction mode and AIS filter information of the prediction unit provided by the image encoding apparatus.
  • the prediction mode of the current block is a mode in which AIS filtering is not performed, the AIS filter may not be applied.
  • the reference pixel interpolator may interpolate the reference pixel to generate a reference pixel of a pixel unit having an integer value or less.
  • the prediction mode of the current prediction unit is a prediction mode that generates a prediction block without interpolating the reference pixel
  • the reference pixel may not be interpolated.
  • the DC filter may generate the prediction block through filtering when the prediction mode of the current block is the DC mode.
  • the reconstructed block or picture may be provided to the filter unit 240 .
  • the filter unit 240 may include a deblocking filter, an offset correction unit, and an ALF.
  • the deblocking filter of the image decoding apparatus may receive deblocking filter-related information provided from the image encoding apparatus, and the image decoding apparatus may perform deblocking filtering on the corresponding block.
  • the offset correction unit may perform offset correction on the reconstructed image based on the type of offset correction applied to the image during encoding, information on the offset value, and the like.
  • ALF may be applied to a coding unit based on information on whether ALF is applied, ALF coefficient information, etc. provided from the encoding apparatus. Such ALF information may be provided by being included in a specific parameter set.
  • the memory 245 may store the reconstructed picture or block to be used as a reference picture or reference block, and may also provide the reconstructed picture to an output unit.
  • a coding unit is used as a term for a coding unit for convenience of description, but it may also be a unit for performing decoding as well as coding.
  • the current block denotes an encoding/decoding target block, and depending on the encoding/decoding step, a coding tree block (or coding tree unit), a coding block (or a coding unit), a transform block (or a transform unit), or a prediction block (or prediction unit) and the like.
  • a 'unit' may indicate a basic unit for performing a specific encoding/decoding process
  • a 'block' may indicate a pixel array of a predetermined size.
  • 'block' and 'unit' may be used interchangeably.
  • the coding block (coding block) and the coding unit (coding unit) are mutually equivalent.
  • 3 and 4 illustrate a lossless encoding method according to the present disclosure.
  • Image compression can be broadly classified into lossy coding and lossless coding.
  • the biggest difference between the two encodings is the presence or absence of a quantization process.
  • lossy coding greater compression efficiency than lossless coding can be obtained through a quantization process, but data loss may occur.
  • lossless encoding the original data can be maintained as it is, but compression efficiency is lower than in lossy encoding.
  • reconstructed data different from the original data may be generated (ie, loss occurs). Accordingly, in lossless coding, a quantization process and an in-loop filtering process may be skipped. In this case, if the quantization process is omitted, the transform process for transforming the residual data into frequency domain components becomes meaningless, so that the transform process can be further omitted when lossless encoding is applied.
  • information indicating whether lossless encoding is applied must be transmitted to the decoder.
  • information indicating whether lossless encoding is performed may be encoded through an upper header (eg, SPS, PPS, or slice header). If the upper header indicates that lossless encoding has been performed using 1-bit information (flag), the decoder determines that lossless encoding has been performed using the 1-bit information. When it is determined that lossless encoding has been performed, the decoder may omit the quantization and in-loop filtering processes and decode the image.
  • a flag for determining a variable lossless_coding for determining whether to use lossless encoding may be signaled through a bitstream.
  • a value of the variable lossless_coding being true indicates that lossless encoding is applied, and a value of the variable lossless_coding being false indicates that lossless encoding is not applied.
  • Variables indicating whether transform, quantization, deblocking filter, SAO, or ALF are used may be defined as t_skip, q_skip, d_skip, s_skip, and a_skip. A value of true of the variables indicates that a corresponding coding process is omitted, and a value of false indicates that a corresponding coding process is not omitted.
  • variable lossless_coding it may be determined whether a flag for determining the values of the variables is signaled through the bitstream. For example, when the value of the variable lossless_coding is true, signaling of a flag for determining the variables t_skip, q_skip, d_skip, s_skip, and a_skip may be omitted. Variables whose encoding is omitted may be estimated as pre-defined values. A pre-defined value may be true.
  • flags for determining variables t_skip, q_skip, d_skip, s_skip, and a_skip may be decoded. Based on whether the value of each variable is true or false, it is possible to determine whether to skip the corresponding coding process.
  • t_skip when the value of lossless_coding is false, at least one of t_skip, q_skip, d_skip, s_skip, and a_skip may be set to true. Accordingly, when values of variables other than the first variable are false, signaling of a flag for determining the value of the first variable may be omitted and the value of the first variable may be set to true. For example, when values of t_skip, q_skip, d_skip, and s_skip are false, encoding of a flag for determining a_skip may be omitted and the variable a_skip may be set to true.
  • lossless_coding may be defined as an internal variable.
  • the value of the internal variable lossless_coding may be determined based on the variables t_skip, q_skip, d_skip, s_skip, and a_skip.
  • a flag for determining a value of each of variables t_skip, q_skip, d_skip, s_skip, and a_skip may be signaled through a bitstream.
  • the variable lossless_coding may be set to true.
  • the variable lossless_coding may be determined to be false.
  • blk_lossless_coding the value of blk_lossless_coding may be set to the value of the variable lossless_coding set in FIG. 3 or FIG. 4 .
  • blk_lossless_coding may be encoded for each block to determine whether lossless encoding is performed on a block-by-block basis.
  • FIG 5 illustrates an intra prediction method according to the present disclosure.
  • a reference pixel line for intra prediction of a currently encoded/decoded block (hereinafter, referred to as a current block) may be determined ( S500 ).
  • the reference pixel line according to the present disclosure may belong to a neighboring block adjacent to the current block.
  • the neighboring block may include at least one of a left block, an upper block, an upper left block, a lower left block, an upper right block, a right block, a lower right block, and a lower block.
  • the reference pixel line may belong to a spatial block belonging to the same picture as the current block but not adjacent to the current block, or may belong to a temporal block belonging to a picture different from the current block.
  • the temporal block may be a block in the same position as a neighboring block of the aforementioned current block.
  • the reference pixel line may be limited to belong only to a block pre-encoded/decoded before the current block, or may belong to a block encoded/decoded after the current block. In this case, a separate padding process may be involved, which will be described later.
  • the reference pixel line may be determined as any one of a plurality of reference pixel line candidates.
  • the plurality of reference pixel line candidates include a first reference pixel line adjacent to the current block, a second reference pixel line adjacent to the first reference pixel line, . , at least one of an n-th reference pixel line adjacent to the (n-1)-th reference pixel line.
  • n may be an integer of 2, 3, 4, or more.
  • the plurality of reference pixel line candidates may include first to fourth reference pixel lines, only first to third reference pixel lines, or only first and third reference pixel lines. .
  • any one of the above-described first to nth reference pixel lines may be selectively used, and for this purpose, information for specifying a position of the reference pixel line may be used.
  • the information may be signaled by the encoding apparatus or may be derived from the decoding apparatus based on a predetermined encoding parameter.
  • the encoding parameter may include at least one of a block size, a shape, a position, a component type (Y/Cb/Cr), a prediction mode (intra/inter), an intra prediction mode, or a non-directional mode.
  • a block may mean a current block and/or a neighboring block, or a coding block, a prediction block, and/or a transform block.
  • the number of reference pixel line candidates available for the current block may be variably determined based on the above-described encoding parameter, and information for specifying the number may be separately signaled.
  • an intra prediction mode of the current block may be determined ( S510 ).
  • the intra prediction mode of the current block may be determined as any one of intra prediction modes pre-defined in the encoding/decoding apparatus.
  • the pre-defined intra prediction mode may be composed of two non-directional modes and 65 directional modes, as shown in FIG. 6 .
  • the directional mode includes at least one of a planar mode or a DC mode
  • the non-directional mode includes a mode (eg, vertical mode, horizontal mode, diagonal mode, etc.) having a predetermined angle/direction.
  • a method of determining the intra prediction mode will be described in detail with reference to FIGS. 7 and 8 .
  • intra prediction of the current block may be performed based on the determined reference pixel line and the intra prediction mode ( S520 ).
  • a pixel corresponding to the determined intra prediction mode among pixels of the reference pixel line may be specified as a reference pixel, and intra prediction may be performed using the specified reference pixel.
  • FIG. 7 illustrates a method of encoding an intra prediction mode according to the present disclosure.
  • the reference pixel line index for intra prediction of the current block may be encoded.
  • the reference pixel line index may be information for specifying the position of the aforementioned reference pixel line, and may be encoded in units of blocks.
  • the MPM flag may be encoded.
  • the MPM flag may indicate whether the intra prediction mode of the current block is determined based on the MPM.
  • a plane mode flag indicating whether the plane mode is used may be coded.
  • the encoding process of the intra prediction mode is terminated. If the planar mode is not used, an index specifying the same MPM candidate as the intra prediction mode used for the current block may be encoded.
  • the MPM flag may be omitted and the value of the MPM flag may be set to true. That is, it is possible to encode the MPM index without encoding the MPM flag.
  • the MPM flag is false, one of the remaining modes except for the MPM candidate among intra prediction modes pre-defined in the encoding apparatus may be encoded.
  • the reference pixel line index for intra prediction of the current block may be decoded.
  • the MPM flag may be decoded.
  • the plane mode flag indicating whether the plane mode is used may be decoded.
  • the intra prediction mode of the current block may be set to the planar mode.
  • the MPM index specifying the same MPM candidate as the intra prediction mode used for the current block is decoded. can do.
  • the intra prediction mode of the current block may be determined based on the pre-configured MPM candidate and the decoded MPM index. A method of configuring the MPM candidate will be described in detail with reference to FIG. 8 .
  • decoding of the MPM flag may be omitted and the value of the MPM flag may be set to true. have. That is, the MPM index can be decoded without decoding the MPM flag.
  • the intra prediction mode of the current block may be determined based on the pre-configured MPM candidate and the decoded MPM index.
  • the remaining mode information specifying one of the remaining modes except for the planar mode and the pre-configured MPM candidate among intra prediction modes pre-defined in the decoding apparatus may be decoded.
  • the mode specified by the decoded remaining mode information may be set as the intra prediction mode of the current block.
  • an MPM candidate may be constructed using an intra prediction mode used in a neighboring block of the current block. If the intra prediction mode of the current block is the same as the MPM candidate included in the MPM candidate list, the same MPM candidate as the intra prediction mode of the current block may be specified using the MPM index. If the same MPM candidate as the intra prediction mode of the current block does not exist, the intra prediction mode of the current block may be encoded/decoded after reassigning indexes of the remaining intra prediction modes except for the MPM candidates. For convenience of description, it is assumed that the number of MPM candidates included in the MPM candidate list is 5.
  • the neighboring block may include at least one of an upper neighboring block, a left neighboring block, an upper left neighboring block, an upper right neighboring block, or a lower left neighboring block.
  • LB denotes a pixel located at the lower left of the block
  • RT denotes a pixel located at the upper right of the block
  • L denotes a position of a restored pixel that exists immediately to the left of LB
  • A denotes a position of a restored pixel that exists immediately above RT.
  • the reconstructed block existing on the left is a block including L
  • the reconstructed block existing above is a block including A
  • an MPM candidate may be derived from a reconstructed block including a reconstructed pixel (g or h) positioned in the middle left or a block including a reconstructed pixel (c or d) positioned in the upper middle.
  • the intra prediction mode used in the left reconstruction block is called Left, and the intra prediction mode used in the upper reconstruction block is defined as Above.
  • Left may be set to the planar mode.
  • the upper reconstructed block is unavailable, if the upper reconstructed block is not encoded by intra prediction, if matrix-based prediction (MIP) is used for the upper reconstructed block, or if the upper reconstructed block is the CTU ( coding tree unit), Above can be set to flat mode. If it does not correspond to the above-mentioned case, Left and Above may be respectively set to the intra prediction mode used by the left reconstructed block and the intra prediction mode used by the upper reconstructed block.
  • BDPCM is applied to the left or upper restoration block
  • Left or Above may be set to horizontal mode or vertical mode depending on the BDPCM application direction.
  • MPM candidates can be composed of [Left, Left-1, Left+1, Left-2, Left+2].
  • the candidate composition method will be different depending on whether both Left and Above are directional modes or only one of them is a directional mode.
  • the mode with the largest value among the two modes is defined as Max, and the mode with the smallest value is defined as Min.
  • MPM candidates can be configured in the following way. If the value of (Max - Min) is 1, the MPM candidate may be composed of [Left, Above, Min-1, Max +1, Min-2]. Rather, if the value of (Max - Min) is 62 or higher, the MPM candidate can be composed of [Left, Above, Min+1, Max -1, Min+2]. Rather, if the value of (Max - Min) is 2, the MPM candidate can be composed of [Left, Above, Min+1, Min -1, Max+1]. Otherwise, the MPM candidate can consist of [Left, Above, Min-1, Min +1, Max-1].
  • MPM candidates can be composed of [Max, Max-1, Max+1, Max -2, Max+2].
  • MPM candidates can consist of [DC mode, 50 (vertical mode), 18 (horizontal mode), vertical-4, vertical+4].
  • FIG 9 illustrates an intra prediction method based on a planar mode according to the present disclosure.
  • a prediction pixel may be generated as shown in FIG. 9 under the planar mode (planar mode) allocated to mode 0.
  • T and L are examples of neighboring reconstructed pixels used when generating a prediction block in a planar mode.
  • T denotes a reconstructed pixel located in the upper right corner.
  • L denotes a reconstructed pixel located in the lower left corner.
  • P1 is a prediction pixel for the horizontal direction.
  • P1 may be generated by linearly interpolating the reconstructed pixel and T located at the same position along the Y axis as P1.
  • P2 is a prediction pixel for the vertical direction.
  • P2 may be generated by linearly interpolating the reconstructed pixel and L located at the same position along the X axis as P2.
  • Equation 1 a final prediction pixel is generated by weighting P1 and P2.
  • the weights ⁇ and ⁇ may have the same value.
  • the weights ⁇ and ⁇ may be determined in consideration of the shape, width, height, or aspect ratio of the block.
  • FIG. 10 illustrates an intra prediction method based on a DC mode according to the present disclosure.
  • the prediction pixel may be generated as shown in FIG. 10 .
  • the size of a block is 4x4.
  • reconstructed pixels existing around the block are set as reference pixels, and after calculating the average value of the reference pixels, the calculated values are set as all prediction pixels in the prediction block.
  • the reference pixels used to calculate the average value may include at least one of upper reconstructed pixels B to E, left reconstructed pixels F to I, or upper left reconstructed pixel A.
  • the average value may be calculated using only the upper restored pixels and the left restored pixels.
  • the average value may be calculated by selectively using only one of the upper restored pixels or the left restored pixels according to the shape of the block.
  • the weighted average value derived by performing a weighted sum operation on the upper average and the left mean is finally predicted It can be set in pixels.
  • pixels in a block may be sequentially reconstructed. For example, the upper left pixel is restored first and the lower right pixel is restored last, but based on a raster scan, a horizontal scan, a vertical scan, a diagonal scan, an inverse raster scan, an inverse horizontal scan, an inverse vertical scan, or an inverse diagonal scan. to determine the restoration order.
  • various restoration orders can be defined, such as restoring the lower left pixel first and restoring the upper right pixel last.
  • the reconstruction order may be determined based on the size, shape, or intra prediction mode of the current block. For example, when the value of the intra prediction mode is smaller than the value of the horizontal mode, the lower left pixel is initially reconstructed, whereas when the value of the intra prediction mode is greater than or equal to the value of the horizontal mode, the upper left pixel may be initially reconstructed .
  • the restoration order may be determined for each predetermined unit.
  • the predetermined unit may be a row, a column, or a sub-block.
  • the restoration order for each predetermined unit and the above-described restoration order for each pixel may be set to be the same as each other. For example, pixels may be sequentially restored from an upper row to a lower row, or pixels may be sequentially restored from a left column to a right column. In the drawings to be described later, a number indicated on each pixel indicates a restoration order.
  • Improved intra prediction using prediction/reconstruction pixels in a block as reference pixels, may be applied.
  • the improved intra prediction may be applied only when lossless coding is applied.
  • the improved intra prediction according to the present disclosure will be described in detail below with reference to FIGS. 11 to 13 .
  • 11 to 13 illustrate an improved intra prediction method according to the present disclosure.
  • the prediction pixel of the current block may be derived based on a previously reconstructed pixel located in the vicinity of the corresponding prediction pixel.
  • the previously reconstructed pixel may include at least one of an upper reconstructed pixel, a left reconstructed pixel, and an upper left reconstructed pixel.
  • the prediction pixel adjacent to the boundary of the current block may be derived using the reconstructed pixel included in the neighboring block adjacent to the current block.
  • the prediction pixel for a0 may be derived based on the average value of A, B, and F adjacent to the current block.
  • a prediction pixel that is not adjacent to the boundary of the current block may be derived using a pixel belonging to the current block and reconstructed before the corresponding prediction pixel.
  • the prediction pixel for a6 may be derived based on the average value of a1, a2, and a5 reconstructed before a6.
  • the prediction pixels corresponding to the pixels a0 to a15 in the current block are p0 to p15
  • the prediction pixels may be derived based on Equation 2 below.
  • cL n , cU n , and cUL n mean pixels that exist immediately to the left, immediately above, and immediately above p n , respectively, and wL, wU and wUL are applied to cL n , cU n , and cUL n , respectively.
  • Other prediction pixels may be generated in the same manner.
  • a weight applied to each pixel may be determined based on at least one of a location of a prediction pixel, a size of a current block, a shape of a current block, or whether a neighboring reconstruction pixel is included in the current block.
  • restored pixels A to Q are set as reference pixels and are positioned in a direction corresponding to the directional mode
  • a prediction pixel is generated using at least one reference pixel.
  • 12 is an example of prediction pixels generated by a directional mode. Assuming that mode 66 is used, each prediction pixel may be set as a reference pixel located in a diagonal direction from the upper right. For example, p0 is C, p1 and p4 are D, ... , p15 is set to I.
  • each prediction pixel may be set as a reference pixel located in the left direction.
  • p0 to p3 are J
  • ... , p12 to p15 are set to M.
  • intra prediction based on an improved directional mode may be applied.
  • a pixel in the current block may be used as a reference pixel. That is, a pixel included in the upper row of the prediction pixel or the left column of the prediction pixel may be used as the reference pixel.
  • the pixel in the current block may mean a prediction pixel or a reconstructed pixel.
  • each prediction pixel may be set as a reconstructed pixel located to the left of the prediction pixel.
  • p0 to p3 are set to J, a0, a1, and a2, respectively.
  • p4 to p7 are set to K, a4, a5, a6, respectively,
  • p8 to p11 are set to L, a8, a9, a10, respectively,
  • p12 to p15 are set to M, a12, a13, and a14, respectively.
  • a prediction/reconstruction pixel included in an upper row or a left column of a prediction pixel is to be used as a reference pixel
  • additional padding may be required depending on the number of the intra prediction mode of the current block. For example, since the reconstructed pixels included in the right neighboring block or the lower neighboring block of the current block are unavailable, padding for the reconstructed pixels included in the right neighboring block or the lower neighboring block of the current block needs to be performed.
  • the intra prediction mode used in FIG. 13 is mode 67 and will be described.
  • Prediction pixels p0 to p3 adjacent to the upper boundary of the current block are generated by using reconstructed pixels on the current block as reference pixels, respectively.
  • Prediction pixels p4 to p7 not adjacent to the upper boundary of the current block may set prediction/reconstruction pixels included in the upper row as reference pixels.
  • the reference pixel included in the right neighboring block of the current block may be generated by padding the pixel located at the right boundary of the current block. For example, for prediction of p4 to p7, padding is performed using a3.
  • padding may be performed using pixels in the current block (hereinafter, referred to as a first pixel) adjacent to the right boundary of the current block and reconstructed pixels existing in the upper right corner of the current block.
  • the padding pixel may be generated based on a restored pixel having the same x-axis coordinate as the padding pixel and a first pixel having the same y-axis coordinate as the padding pixel.
  • the first padded pixel may be generated by weighting a3 and F according to the distance.
  • the padding pixel may be generated using the first pixel and the padding pixel of the current block, the restored pixel located at the upper right (eg, the restored pixel located on the angular line in the directional prediction mode).
  • the number of pixels to be padded may be determined according to the size of the block and the number of the intra prediction mode. For example, if the number of the intra prediction mode is 66, only one pixel per line is padded to the right of the block because the upper right angle is 45 degrees. Alternatively, in the case of mode 50, padding may not be performed because padding is not required.
  • a method of matching the same number of reference pixels as the number of reference pixels set using reconstructed pixels to the same when padding using original pixels in a block is also possible. For example, in the upper part of the current block of FIG. 13 , if B to I are set as reference pixels using reconstructed pixels, 4 pixels may be padded in the lower row as well.
  • the intra prediction mode in the upper right direction is described as a reference, but a similar concept may be applied to the prediction mode in the lower left direction.
  • reference pixels included in the lower neighboring block of the current block may be generated through padding using pixels adjacent to the lower boundary of the current block and belonging to the current block.
  • Whether or not intra prediction using pixels in the block described above is applied can be always performed when lossless coding is performed.
  • lossless encoding it is also possible to encode information indicating whether the corresponding technology is applied in block units and transmit the encoded information to the decoder.
  • whether the corresponding technology is supported or not may be encoded through the upper header. In this way, it is possible to control whether the corresponding technology is used in lossless encoding through a higher header.
  • a residual pixel may be derived by differentiating the prediction pixel from the original pixel, and transform and/or quantization may be applied to the residual pixel.
  • a difference value between the residual data may be generated and then the generated difference value may be encoded.
  • DPCM Delta Pulse Coded Modulation
  • the residual data may represent a residual pixel or a residual coefficient.
  • the residual coefficient may include at least one of a transform coefficient obtained by transforming the residual pixel, a quantized transform coefficient obtained by quantizing the transform coefficient, or a quantized coefficient obtained by quantizing the residual pixel.
  • the residual coefficient may represent at least one of a transform coefficient, a quantized transform coefficient, or a quantized coefficient.
  • the decoder may derive a transform coefficient by applying an inverse quant to the quantized transform coefficient, and may derive a residual pixel by applying an inverse transform to the transform coefficient.
  • FIG. 14 is an exemplary diagram for explaining an application aspect of DPCM.
  • rX (X is an integer including 0) represents a residual pixel that is a difference between an original pixel and a predicted pixel. Quantization may be applied to the residual pixels to generate quantized coefficients. As an example, the residual pixels (ie, r0 to r15) may be quantized to generate quantized coefficients (ie, Q(r0) to Q(r15)). Here, Q represents a quantized coefficient.
  • a difference value (ie, s0 to s15) for the quantized coefficients may be generated.
  • a difference value sX with respect to the quantized coefficient Q(rX) may be derived by differentiating the adjacent quantized coefficient Q(rY) from Q(rX).
  • the position of the adjacent quantized coefficient Q(rY) may be determined based on the DPCM direction.
  • the DPCM direction may indicate at least one of vertical, horizontal, diagonal, or zigzag.
  • the horizontal DPCM direction indicates that adjacent quantized coefficients are selected according to the order in which the quantized coefficients are one-dimensionally arranged by applying a horizontal scan. Specifically, when the DPCM direction is horizontal, the adjacent quantized coefficient Q(rY) may be located before the quantized coefficient Q(rX) when the quantized coefficients are arranged in one dimension along the horizontal direction. have. For the first quantized coefficient Q(r0), since there is no previously positioned quantized coefficient, the quantized coefficient is set as a difference value as it is. For example, when the DPCM is in the horizontal direction, the difference values s0 to s4 with respect to the quantized coefficients Q(r0) to Q(r4) may be derived as follows.
  • the difference value sX with respect to the quantized coefficient Q(rX) except for the first quantized transform coefficient Q(r0) is the quantized coefficient Q(rX) and the adjacent quantized coefficient Q(r(X-1)) can be derived from the difference between
  • the vertical DPCM direction indicates that adjacent quantized coefficients are selected according to the order in which the quantized coefficients are one-dimensionally arranged by applying a vertical scan. Specifically, when the DPCM direction is vertical, the adjacent quantized coefficient Q(rY) may be located before the quantized coefficient Q(rX) when the quantized coefficients are arranged in one dimension along the vertical direction. have. For the first quantized coefficient Q(r0), since there is no previously positioned quantized coefficient, the quantized coefficient is set as a difference value as it is.
  • the difference values s0, s4, s8, and s12 for the quantized coefficients Q(r0), Q(r4), Q(r8), and Q(r12) can be derived as follows. have.
  • the difference value sX with respect to the quantized coefficient Q(rX) except for the first quantized transform coefficient Q(r0) is the quantized coefficient Q(rX) and the adjacent quantized coefficient Q(r(X-(block_width)) ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
  • block_width indicates the width of the current block.
  • the DPCM direction is diagonal indicates that adjacent quantized coefficients are selected according to the order in which the quantized coefficients are one-dimensionally arranged by applying a diagonal scan.
  • the adjacent quantized coefficient Q(rY) can be located before the quantized coefficient Q(rX) when the quantized coefficients are arranged in one dimension along the diagonal direction.
  • the diagonal direction may be any one of an upper left diagonal direction, an upper right diagonal direction, a lower left diagonal direction, or a lower right diagonal direction.
  • a difference value sX with respect to the quantized coefficient Q(rX) may be derived based on a difference value from the previous quantized coefficient Q(rY) located in the upper-left diagonal direction.
  • the quantized coefficient is set as a difference value as it is.
  • the difference values s0, s5, s10, and s15 for the quantized coefficients Q(r0), Q(r5), Q(r10), and Q(r15) can be derived as follows.
  • the fact that the DPCM direction is zigzag indicates that adjacent quantized coefficients are selected according to the order in which the quantized coefficients are one-dimensionally arranged by applying a zigzag scan.
  • FIG. 15 illustrates a search order when a zigzag scan is applied, according to an embodiment of the present disclosure.
  • the difference value with respect to the quantized coefficient Q(rX) using the quantized coefficient Q(rY) located before the quantized coefficient Q(rX) sX can be induced.
  • the difference values for the quantized coefficients Q(r0), Q(r1), Q(r8), and Q(15) are as follows. can be induced.
  • the difference value may be encoded instead of the quantized coefficient to be signaled.
  • the difference value sX is derived by using the quantized coefficient Q(rY) located before the quantized coefficient Q(rX). Unlike the described example, a difference value sX may be derived using a quantized coefficient located next to the quantized coefficient Q(rX).
  • the difference value sX is derived by differentiating the adjacent quantized coefficient Q(rY) from the quantized coefficient Q(rX). Unlike the described example, a difference value sX may be derived by differentiating the quantized coefficient Q(rX) from the adjacent quantized coefficient Q(rY).
  • the DPCM direction may be predefined in the encoder and the decoder. For example, one of horizontal, vertical, diagonal, and zigzag may be fixedly used. Alternatively, information (eg, index) specifying one of a plurality of DPCM directions may be encoded and signaled. The index may be signaled at a block level, a slice level, or a picture level.
  • one of a plurality of DPCM directions may be selected based on at least one of the size, shape, and intra prediction mode of the current block. For example, when a horizontal intra prediction mode (eg, Mode_18 of FIG. 5 ) is applied to the current block, the DPCM direction may be determined horizontally. On the other hand, when a vertical intra prediction mode (eg, Mode_50 of FIG. 5 ) is applied to the current block, the DPCM direction may be determined vertically.
  • a horizontal intra prediction mode eg, Mode_18 of FIG. 5
  • a vertical intra prediction mode eg, Mode_50 of FIG. 5
  • the number or type of DPCM direction candidates may be set differently based on at least one of the size, shape, intra prediction mode, and encoding mode of the current block. For example, when inter prediction is applied to the current block, the DPCM modes in the horizontal direction and the vertical direction may be set to be unavailable. In this case, the DPCM mode in the diagonal direction or the zigzag direction may be applied, or an index specifying one of a plurality of zigzag direction candidates may be encoded and signaled.
  • the intra prediction mode of the current block may be determined based on the DPCM direction.
  • the DPCM modes in the vertical direction, the horizontal direction, and the diagonal direction may correspond to the intra prediction modes in the vertical direction, the horizontal direction, and the diagonal direction, respectively. That is, a vertical DPCM direction for the current block indicates that the vertical intra prediction mode is applied to the current block, and a horizontal DPCM direction for the current block indicates that the horizontal intra prediction mode is applied to the current block. and that the DPCM direction for the current block is diagonal (or zigzag) indicates that the intra prediction mode in the diagonal direction is applied to the current block.
  • each of the DPCM modes in the vertical direction and the horizontal direction corresponds to the intra prediction mode in the vertical direction and the horizontal direction
  • the DPCM mode in the diagonal direction corresponds to the non-directional intra prediction mode (eg, DC or planar).
  • a vertical DPCM direction for the current block indicates that the vertical intra prediction mode is applied to the current block
  • a horizontal DPCM direction for the current block indicates that the horizontal intra prediction mode is applied to the current block.
  • the DPCM direction for the current block is diagonal (or zigzag) indicates that DC or planar mode is applied to the current block.
  • the encoder and the decoder may generate a difference value using a predefined search order.
  • information eg, an index
  • the index may specify one of the zigzag scan orders shown in FIG. 15 .
  • one of a plurality of zigzag scan orders may be specified based on at least one of the size, shape, and intra prediction mode of the current block.
  • the intra prediction mode of the current block may be determined based on the MPM candidate.
  • an MPM candidate of the current block may be derived in consideration of the DPCM direction applied to the neighboring block.
  • an MPM candidate may be derived by estimating that the intra prediction mode of the neighboring block is the intra prediction mode corresponding to the DPCM direction.
  • an MPM candidate may be derived by estimating that the intra prediction mode of the neighboring block is in the horizontal direction.
  • an MPM candidate may be derived by estimating that the intra prediction mode of the neighboring block is vertical.
  • an MPM candidate may be derived by estimating that the intra prediction mode of the neighboring block is a diagonal or non-directional intra prediction mode (eg, DC or planar). .
  • context information of a neighboring block or a previous block may be referred to.
  • the neighboring block or previous block which is the reference target of the context information, may include at least one of a left neighboring block or an upper neighboring block of the current block.
  • the context information accumulation (or update) method of the current block may be different.
  • a DPCM method based on quantized coefficients has been described.
  • DPCM based on residual pixels transform coefficients, or quantized transform coefficients may be applied.
  • a difference value sX with respect to the residual pixel rX may be derived by differentiating the previous residual pixel rY from the residual pixel rX.
  • DPCM When lossless coding is applied, DPCM may be applied to residual data in which quantization is omitted. That is, when lossless coding is applied, DPCM based on residual pixels or transform coefficients may be applied.
  • information eg, a flag
  • DPCM DPCM is performed on the quantized transform coefficients. For example, when the flag indicates that quantization is applied, it may be determined that DPCM is performed on a quantized coefficient or a quantized transform coefficient. On the other hand, when the flag indicates that quantization is not applied, it may be determined that DPCM is performed on the residual pixel or transform coefficient.
  • DPCM may be applied to the reconstructed pixel.
  • the decoder may decode the difference value and reconstruct the residual data using the decoded difference value.
  • the residual data may be reconstructed by adding adjacent residual data and difference values.
  • a residual pixel may be obtained by applying at least one of inverse quantization or inverse transform to the reconstructed residual data according to the type of residual data.
  • residual data are residual coefficients.
  • a residual coefficient encoding/decoding method described later may be used for encoding/decoding the residual pixel.
  • a residual data encoding/decoding method described later may be used for encoding/decoding a difference value.
  • a flag indicating whether a non-zero residual coefficient exists in the current block may be encoded and signaled.
  • the position of the last non-zero residual coefficient in the scan order may be encoded.
  • the syntax last_x indicating the x-coordinate of the last non-zero residual coefficient and the syntax last_y indicating the y-coordinate may be encoded and signaled.
  • a sub-block flag indicating whether a non-zero residual coefficient exists in a sub-block may be encoded in units of sub-blocks in the current block. For example, after encoding information indicating the position of the last non-zero residual coefficient, the syntax sub_blk_flag indicating whether a non-zero residual coefficient exists for each sub-block may be encoded and signaled.
  • information on each residual coefficient may be additionally encoded according to a scan order.
  • encoding of the subblock flag may be omitted. Since non-zero residual coefficients are not included in the sub-block, the value of the sub-block flag may be regarded as zero.
  • encoding of the subblock flag may be omitted. Since a non-zero residual coefficient is necessarily included in the sub-block, the value of the sub-block flag may be regarded as 1.
  • encoding of location information of the last non-zero residual coefficient may be omitted.
  • sub-block flags may be encoded for all sub-blocks in the current block.
  • Information indicating whether position information of the last non-zero coefficient is encoded may be additionally encoded.
  • the value of the information may be set to 1.
  • the sub-block flag may be coded from the sub-block in which the last non-zero coefficient exists.
  • the value of the information may be set to 0.
  • the sub-block flag may be coded from the sub-block having the first scan order.
  • encoding of information indicating the position of the last residual coefficient may be omitted.
  • transform coefficients may be encoded starting from the subblock including the last residual coefficient.
  • both information indicating the position of the last residual coefficient and the sub-block flag may not be encoded.
  • the information on each residual coefficient may include at least one of a flag indicating whether the residual coefficient has a non-zero value, information indicating a size of the residual coefficient, and information indicating a sign of the residual coefficient.
  • Residual coefficients may be encoded according to a predetermined scan order.
  • the encoding order of the residual coefficients may be different based on whether the transform is skipped in the current block. For example, when a transform is not skipped in the current block, a residual coefficient located at the lower right of the subblock may be encoded first, and the residual coefficient located at the upper left of the subblock may be encoded last. That is, a scan order between residual coefficients may be determined according to an inverse-diagonal scan, an inverse-horizontal scan, or an inverse-vertical scan.
  • the residual coefficient located at the upper left of the subblock may be encoded first, and the residual coefficient located at the lower right of the subblock may be encoded last. That is, a scan order between residual coefficients may be determined along a diagonal scan, a horizontal scan, or a vertical scan.
  • a scan order between residual coefficients may be determined according to an inverse-diagonal scan, an inverse-horizontal scan, or an inverse-vertical scan.
  • the scan order of the residual coefficients may be predefined in the encoder and the decoder. Alternatively, information indicating a scan order of residual coefficients may be encoded and signaled. Alternatively, the scan order may be determined based on at least one of the size, shape, intra prediction mode, whether the transform is skipped, whether the secondary transform is performed, or the DPCM direction of the current block.
  • 16 is a flowchart illustrating a process of encoding residual coefficients in an encoder.
  • a flag indicating whether the residual coefficient has a non-zero value, sig_flag may be coded ( S1610 ).
  • encoding may be performed by setting the value of the flag sig_flag to 0.
  • encoding may be performed by setting the value of the flag sig_flag to 1.
  • information on the magnitude of the residual coefficient may be further encoded (S1620).
  • 17 is a flowchart illustrating a process of encoding size information of residual coefficients.
  • An absolute value of the residual coefficient may be encoded using at least one or more gt_N_flags.
  • N may be a natural number of 1 or more.
  • the flag gt_N_flag may indicate whether the absolute value of the residual coefficient has a value greater than 2 (N-1).
  • the number of gt_N_flags used to encode the absolute value of the residual coefficient may be determined based on whether a transform is skipped in the current block. For example, when a transform is not skipped in the current block, two gt_N_flags (N is 1 to 2) may be used. On the other hand, when the transform is skipped in the current block, three or more gt_N_flags (eg, three, four, or five) may be used.
  • the maximum number of gt_N_flags of 2 indicates that the syntax rem_level indicating the residual size from the residual coefficient whose absolute value exceeds 3 is encoded.
  • the fact that the maximum number of gt_N_flags is 5 indicates that the syntax rem_level indicating the residual size from the residual coefficient whose absolute value exceeds 9 is encoded.
  • a flag gt1_flag indicating whether the absolute value of the residual coefficient is greater than 1 may be encoded ( S1710 ).
  • encoding can be performed by setting the value of the flag gt1_flag to 0.
  • encoding can be performed by setting the value of the flag gt1_flag to 1.
  • a flag par_flag indicating whether the absolute value of the residual coefficient is an even number or an odd number may be encoded (S1720).
  • the absolute value of the residual coefficient is an even number, it can be encoded by setting the flag par_flag to 0.
  • encoding may be performed by setting the flag par_flag to 1.
  • the flag par_flag may be set to 1
  • the flag par_flag may be set to 0.
  • a flag gt_2_flag indicating whether the absolute value of the residual coefficient is greater than 3 may be encoded ( S1730 ).
  • the value of the flag gt_2_flag may be set to 0.
  • the value of the flag gt_2_flag may be set to 1.
  • rem_level indicating the residual size may be coded (S1740).
  • the syntax rem_level may be derived by shifting a value derived by subtracting 4 from the absolute value of the residual coefficient to the right by 1.
  • gt_N_flag such as gt_3_flag, gt_4_flag or gt_5_flag, may be further encoded.
  • gt_N_flag when the value of gt_(N-1)_flag is 1, gt_N_flag may be additionally encoded.
  • gt_N_flag may indicate whether the absolute value of the residual coefficient has a value greater than (2N-1).
  • rem_level may be derived by shifting a value derived by subtracting 2N from the absolute value of the residual coefficient to the right by 1.
  • sig_flag when sig_flag is 1, sign_flag and gt_1_flag may be encoded and signaled. Also, when gt_1_flag is 1, parity_flag and gt_2_flag may be additionally encoded and signaled.
  • rem_level indicating the residual coefficient may be encoded and signaled.
  • the syntax rem_level may indicate a difference from the absolute value of the residual coefficient with a value obtained by adding 1 to the maximum value indicated by gt_N_flag (ie, 2N).
  • the absolute value of the residual coefficient is encoded using sig_flag, gt_1_flag, par_flag, gt_2_flag, and rem_level.
  • the absolute value of the residual coefficient may be encoded as it is.
  • the syntax abs_level indicating the absolute value of the residual coefficient may be encoded. A method of selecting the encoding method of the absolute value of the residual coefficient will be described later.
  • a flag sign_flag indicating the sign of the residual coefficient may be encoded (S1630).
  • a value of the flag sign_flag of 0 indicates that the residual coefficient is positive.
  • the value of the flag sign_flag being 1 indicates that the residual coefficient is negative.
  • Table 1 shows the values assigned to each syntax when the value of the residual coefficient is -21 and two gt_N_flags are used.
  • coeff represents the value of the residual coefficient
  • 'Formula' item represents the formula used to derive the value of each syntax.
  • Table 2 shows values assigned to each syntax when the value of the residual coefficient is -21 and five gt_N_flags are used.
  • FIG. 18 is a flowchart illustrating a process of decoding a residual coefficient in a decoder.
  • the residual coefficients may be reconstructed based on a predetermined scan order.
  • a flag indicating whether the residual coefficient has a non-zero value, sig_flag may be decoded ( S1810 ).
  • a value of the flag sig_flag of 0 indicates that the value of the residual coefficient is 0.
  • the value of the flag sig_flag being 1 indicates that the value of the residual coefficient is not 0.
  • information on the magnitude of the residual coefficient may be further decoded (S1820).
  • 19 is a diagram illustrating a decoding process of size information of residual coefficients.
  • a flag gt1_flag indicating whether the absolute value of the residual coefficient is greater than 1 may be decoded ( S1910 ).
  • a value of the flag gt_1_flag of 0 indicates that the absolute value of the residual coefficient is 1.
  • the value of the flag gt_1_flag being 1 indicates that the absolute value of the residual coefficient is greater than 1.
  • the flag par_flag indicating whether the absolute value of the residual coefficient is an even number or an odd number may be decoded ( S1920 ).
  • a value of the flag par_flag of 0 indicates that the absolute value of the residual coefficient is an even number
  • a value of the flag par_flag of 1 indicates that the absolute value of the residual coefficient is an odd number.
  • a flag gt_2_flag indicating whether the absolute value of the residual coefficient is greater than 3 may be decoded ( S1930 ).
  • a value of the flag gt_2_flag equal to 0 indicates that the absolute value of the residual coefficient is less than 3.
  • the absolute value of the residual coefficient may be determined to be 2 or 3 according to the value of the flag par_flag.
  • a value of the flag gt_2_flag of 1 indicates that the absolute value of the residual coefficient is greater than 3.
  • rem_level indicating the residual size may be decoded (S1940).
  • An absolute value of the residual coefficient may be derived by adding 3 or 4 to a value derived by shifting the value representing the syntax rem_level to the left by 1.
  • gt_N_flag such as gt_3_flag, gt_4_flag, or gt_5_flag, may be further decoded. In this case, when the value of gt_(N-1)_flag is 1, gt_N_flag may be further decoded.
  • gt_N_flag may indicate whether the absolute value of the residual coefficient has a value greater than (2N-1).
  • rem_level may be set to a value derived by shifting a value derived by differentiating 2N from the absolute value of the residual coefficient by 1 to the right.
  • the absolute value of the residual coefficient is decoded using sig_flag, gt_1_flag, par_flag, gt_2_flag, and rem_level.
  • the absolute value of the residual coefficient may be decoded as it is.
  • the syntax abs_level indicating the absolute value of the residual coefficient may be decoded. A method of selecting a decoding method for the absolute value of the residual coefficient will be described later.
  • a flag sign_flag indicating the sign of the residual coefficient may be decoded (S1830).
  • a value of the flag sign_flag of 0 indicates that the residual coefficient is positive.
  • the value of the flag sign_flag being 1 indicates that the residual coefficient is negative.
  • Table 3 shows an example of decoding a residual coefficient with a value of -21 using two gt_N_flags.
  • the variable tmp_coeff represents a temporary restoration coefficient.
  • the temporary restoration coefficient tmp_coeff may be set as an absolute value of the residual coefficient.
  • the absolute value of the residual coefficient can be derived by updating the temporary restoration coefficient tmp_coeff based on the syntax rem_level.
  • Table 4 shows an example of decoding a residual coefficient having a value of -21 using five gt_N_flags.
  • the variable tmp_coeff represents a temporary restoration coefficient.
  • the temporary restoration coefficient tmp_coeff may be set as an absolute value of the residual coefficient.
  • the residual coefficient may be encoded by at least one syntax.
  • a residual coefficient may be changed into a plurality of bins through a binarization process of the syntax(s), and the changed bins may be encoded through entropy encoding.
  • Entropy encoding may be divided into encoding using context information and encoding not using context information.
  • the context indicates the probability that the value of the bin is 0 or 1.
  • a threshold may be set.
  • the threshold value may be individually set for each block.
  • a bin having a count value smaller than a threshold value is encoded using context information.
  • the count value is greater than or equal to the threshold, encoding using context information may no longer be used.
  • the threshold value may be determined based on the number of non-zero residual coefficients in the current block. For example, a value obtained by multiplying the number of non-zero residual coefficients in the current block by a real number or by adding or subtracting an offset may be set as the threshold value.
  • the threshold value may be determined based on the number of pixels included in the current block. For example, a value obtained by multiplying the number of pixels in the current block by a real number or by adding or subtracting an offset may be set as the threshold value.
  • information indicating a threshold value may be signaled through a bitstream.
  • the information may be encoded through an upper header such as a sequence, picture header, or slice header.
  • the threshold value may be determined based on at least one of the size and shape of the current block. For example, after a threshold value is previously defined for each size or shape of a block, a threshold value corresponding to the size or shape of the current block may be called and used. Alternatively, information specifying one of a plurality of threshold value candidates corresponding to the size or shape of the current block may be encoded and signaled.
  • the threshold value may be determined based on at least one of whether transform skip is applied, a transform kernel applied to the current block, or a quantization parameter.
  • the counter When counting the number of bins to be encoded using context information, when information indicating the position of the last non-zero residual coefficient is encoded, the counter may be set not to operate. That is, the information may be excluded from counting.
  • the counter when encoding a flag indicating whether a non-zero residual coefficient exists for each subblock in the current block, the counter may be set not to operate. That is, the flag may be excluded from counting.
  • gt_N_flag in order to limit the residual coefficient, when the number of bins encoded using context information is greater than or equal to a threshold value, gt_N_flag or the like is used to limit the residual coefficient.
  • the absolute value of the residual coefficient may be encoded as it is.
  • At least one of sig_flag, sign_flag, gt_1_flag, par_flag, gt_2_flag, gt_3_flag, gt_4_flag, gt_5_flag, or rem_level illustrated in Tables 1 to 4 can be used to encode the absolute value of the residual coefficient.
  • the syntax abs_level indicating the absolute value of the residual coefficient and sign_flag indicating the sign of the residual coefficient may be encoded.
  • a counter may be operated whenever an encoded bin is decoded using context information.
  • the absolute value of the residual coefficient may be reconstructed using at least one of sig_flag, sign_flag, gt_1_flag, par_flag, gt_2_flag, gt_3_flag, gt_4_flag, gt_5_flag, or rem_level.
  • the residual coefficient may be restored using the syntax abs_level and sign_flag.
  • 20 is a diagram illustrating an example of counting the number of bins using context information.
  • each of the coefficients is C0 to C15.
  • C15 denotes a residual coefficient located in the lower right corner in the subblock
  • C0 denotes a residual coefficient located in the upper left corner in the subblock.
  • one pass indicates syntaxes encoded using context information. Except for pass 1, passes 2 and 3 indicate syntaxes that are encoded without using context information.
  • a path indicates an encoding order and a decoding order. For example, when the residual coefficient cannot be completely encoded using only syntaxes belonging to N-paths, syntaxes belonging to (N+1) may be encoded.
  • the decoder may decode as many syntaxes as coded using context information in one pass, and then decode syntaxes belonging to the second pass. Also, after all syntaxes belonging to the 2nd pass are decoded, the syntaxes belonging to the 3-1 path may be decoded.
  • a 3-2 pass represents a path for a residual coefficient in which syntaxes belonging to pass 1 are not coded. That is, when a coefficient of a bin encoded using context information is smaller than a threshold value, the residual coefficient may be encoded through at least one of one pass, two passes, and three-1 passes. On the other hand, when a coefficient of a bin encoded using context information is equal to or greater than a threshold value, a residual coefficient may be encoded through 3-2 passes.
  • syntaxes belonging to one pass for a corresponding residual coefficient may be encoded.
  • FIG. 20 it is exemplified that syntaxes belonging to one pass are encoded for C0 to C7.
  • the syntaxes belonging to the second pass may be encoded.
  • the syntaxes belonging to the 3-1 path may be coded.
  • syntax belonging to the 3-2 pass may be encoded from residual coefficients thereafter.
  • the syntax abs_level and sign_flag belonging to the 3-2 pass may be encoded.
  • the context can be set so that abs_level is encoded without using information.
  • the syntaxes may be encoded only when the difference between the number and the threshold is greater than 4.
  • the syntaxes can be encoded only when the difference between the number and the threshold is greater than 3.
  • the syntax can be encoded only when the difference between the number and the threshold value is greater than 1.
  • the counter may increase by the number of bins allocated to the syntax rem_level.
  • the flag par_flag may be set not to be coded using context information. 21 shows an example of this.
  • one pass indicates syntaxes encoded using context information. Except for pass 1, passes 2, 3, and 4 indicate syntaxes that are encoded without using context information.
  • the syntax par_flag may be classified into two passes different from one pass to which the encoded syntaxes belong by using context information. Accordingly, based on the syntax par_flag, the number of coded bins is not counted using context information.
  • the absolute value of the residual coefficient may be encoded through one pass, two passes, three passes, or 4-1 passes.
  • the absolute value of the residual coefficient may be encoded through 4-2 passes.
  • the counter may be set not to increase with respect to the number of bins (ie, one) allocated to the flag par_flag. Accordingly, for each residual coefficient, the counter is incremented only for the bins assigned to the three syntaxes, sig_flag, gt_1_flag and gt_2_flag.
  • syntaxes belonging to the 4-2 pass may be encoded from the next residual coefficient.
  • the absolute value of the residual coefficient may be encoded using the syntax abs_level belonging to the 4-2 path, and the sign of the residual coefficient may be encoded using the syntax sign_flag.
  • Residual coefficients may be encoded using a smaller number or a larger number of gt_N_flags than the illustrated example. 22 is an example of this.
  • 22 is a diagram illustrating an encoding mode using two gt_N_flags.
  • sig_flag, gt_1_flag, par_flag, and gt_2_flag are included in one pass.
  • syntaxes belonging to the 2-1 pass and the 3rd pass may be encoded.
  • a syntax abs_level indicating an absolute value of the residual coefficient and a syntax sign_flag indicating a sign of the residual coefficient may be encoded.
  • the flag par_flag may be set not to be coded using context information. 23 shows an example of this.
  • one pass represents syntaxes encoded using context information. Except for pass 1, passes 2, 3-1, 3-2, and 4 indicate syntaxes that are encoded without using context information.
  • passes 2, 3-1, 3-2, and 4 indicate syntaxes that are encoded without using context information.
  • the absolute value of the residual coefficient may be encoded through one pass, two passes, and a 3-1 pass.
  • the absolute value of the residual coefficient may be encoded through 3-2 passes.
  • the counter may be set not to increase with respect to the number of bins (ie, one) allocated to the flag par_flag.
  • the counter is incremented only for the bins assigned to the three syntaxes, sig_flag, gt_1_flag and gt_2_flag.
  • the residual coefficient is set to 24 equal to the threshold value after encoding the syntaxes for C8 in 1 pass.
  • the absolute value of the residual coefficient C7 can be encoded as it is through the syntax abs_level included in the 3-2 path. That is, for the residual coefficients C7 to C0, the absolute values of the residual coefficients may be encoded using the syntax abs_level belonging to the 3-2 pass instead of the syntaxes belonging to the 1st pass and the 2-1 pass.
  • sig_flag, gt_1_flag, par_flag, and gt_2_flag are configured in one pass (ie, one pass), and rem_level indicating the absolute difference and sign_flag indicating the sign are configured in one path (ie, 2). -1 pass).
  • abs_level indicating the absolute value of the residual coefficient and sign_flag indicating a sign may be configured as one pass (ie, 2-2 passes).
  • each path it is also possible to set the number of paths and the configuration of each path to be different from the illustrated example. For example, instead of configuring all gt_N_flags as one pass, some gt_N_flags may be configured as one pass, and the remaining gt_N_flags may be configured as two passes.
  • residual coefficient encoding may be divided into a method using a maximum of m gt_N_flags and a method using a maximum of n gt_N_flags.
  • m and n are different natural numbers, m may have a value greater than n, m may be a natural number such as 3, 4, 5 or 6, and n may be a natural number such as 2, 3 or 4.
  • the first method may be a residual coefficient encoding method using a maximum of five gt_N_flags, and the second method may be a residual coefficient encoding method using a maximum of two gt_N_flags.
  • Information indicating whether to apply the first scheme using up to m gt_N_flags or the second scheme using up to n gt_N_flags may be signaled through the bitstream.
  • whether the first scheme or the second scheme is applied may be determined based on transform_skip_flag indicating whether transform skip is applied. For example, when a transform is skipped in the current block (eg, when transform_skip_flag is 1), residual coefficients are encoded using the first method, whereas when a transform is not skipped in the current block (eg, when transform_skip_flag is 0) case), the residual coefficients may be encoded using the second method.
  • information for specifying an encoding method of a residual coefficient may be encoded and signaled.
  • information for specifying an encoding method of a residual coefficient may be encoded and signaled at a slice, picture, or sequence level.
  • the encoding method of the residual coefficient may be determined based on at least one of the size, shape, encoding mode, and intra prediction mode of the current block.
  • residual coefficients may be encoded based on the first method using a maximum of m gt_N_flags.
  • residual coefficients may be encoded based on the second method using a maximum of n gt_N_flags.
  • the encoding method of the residual coefficient may be determined according to whether lossless encoding is applied.
  • residual coefficients may be encoded based on the second method using a maximum of n gt_N_flags.
  • residual coefficients may be coded based on the first scheme using a maximum of m gt_N_flags.
  • the second scheme is fixedly applied, and when lossless coding is not applied, either the first scheme or the second scheme can be adaptively selected.
  • the encoding method of the residual coefficient may be determined based on the bit-depth of the current image. For example, when the bit depth of the current image is 10 bits or less, the residual coefficients may be encoded based on the first method using a maximum of m gt_N_flags. On the other hand, when the bit depth of the current image is 10 bits, the residual coefficients may be encoded based on the first method using a maximum of m gt_N_flags. On the other hand, when the bit depth of the current image is greater than 10 bits, the residual coefficients may be encoded based on the second method using a maximum of n gt_N_flags.
  • the flipped residual coefficients may be encoded.
  • Flipping may mean changing the positions of the residual coefficients to symmetric positions based on at least one of a horizontal direction or a vertical direction.
  • the flipping mode may be determined as one of a horizontal mode, a vertical mode, or a mode in which vertical and horizontal are mixed.
  • Information for specifying whether flipping is applied or not or a flipping mode may be signaled through a bitstream. For example, a flag indicating whether flipping is applied may be encoded and signaled. When the flag indicates that flipping is applied, an index specifying one of a plurality of flipping modes may be encoded and signaled.
  • At least one of whether flipping is allowed to be applied, whether flipping is applied, or a flipping mode may be determined based on at least one of the size, shape, encoding mode, and intra prediction mode of the current block.
  • intra prediction when intra prediction is applied to the current block, it may be allowed to apply flipping to the current block.
  • a flag indicating whether flipping is applied to the current block may be encoded and signaled.
  • inter prediction when inter prediction is applied to the current block, it may not be allowed to apply flipping to the current block.
  • encoding of a flag indicating whether flipping is applied to the current block may be omitted.
  • At least one of whether flipping is allowed to be applied, whether flipping is applied, or a flipping mode may be determined based on whether lossless encoding is applied. For example, when lossless coding is applied, it may be allowed to apply flipping to the current block. When it is allowed to apply flipping to the current block, a flag indicating whether flipping is applied to the current block may be encoded and signaled. On the other hand, when lossless coding is not applied, it may not be allowed to apply flipping to the current block. When it is not permitted to apply flipping to the current block, encoding of a flag indicating whether flipping is applied to the current block may be omitted.
  • the flipped residual coefficients may be encoded. Specifically, the flipped residual coefficients may be encoded based on at least one of a first scheme using at most m gt_N_flags or a second scheme using at most n gt_N_flags. As another example, when the residual coefficients are flipped, the first method may be fixedly applied or the second method may be fixedly applied. When at least one of the first scheme or the second scheme is fixedly applied, encoding of information indicating whether an encoding scheme is applied may be omitted.
  • the scan order may be different when the first scheme using up to m gt_N_flags is applied and when the second scheme using up to n gt_N_flags is applied. For example, when the first method is applied, the scan order of the residual coefficients and when the second method is applied, the scan order of the residual coefficients may be reversed.
  • a first scan direction in which residual coefficients positioned at the lower right end of the block are first scanned and the residual coefficients positioned at the upper left end of the block are last scanned may be applied.
  • a second scan direction in which the residual coefficients located at the upper left end of the block are first scanned and the residual coefficients located at the lower right end of the block are last scanned may be applied.
  • the absolute value of the residual coefficient may be encoded using at least one of sig_flag, par_flag, gt_N_flag, and rem_level.
  • the remaining syntaxes except for rem_level may be coded with reference to various context information according to the properties of the surrounding coefficients.
  • the number of referenceable context information may be determined according to the position of the pixel.
  • 25 and 26 show the surrounding restoration area referenced to determine context information.
  • FIG. 25 is an example of a case in which residual coefficients are encoded according to a scan order from the lower right residual coefficient to the upper left residual coefficient.
  • FIG. 25 may be applied to the second scheme using a maximum of n gt_N_flags.
  • FIG. 26 is an example of a case in which residual coefficients are encoded according to a scan order from the upper left residual coefficient to the lower right residual coefficient.
  • FIG. 26 may be applied to the first scheme using a maximum of m gt_N_flags.
  • a maximum of two or a maximum of five restoration coefficients may be referred to.
  • a region including restoration coefficients having an absolute value of 1 or less of the sum of the x-coordinate difference with the residual coefficient and the y-coordinate difference or the restoration coefficient having an absolute value of 2 or less A region including the ? may be set as a peripheral restoration region.
  • the unavailable reconstruction coefficients may be excluded from the reference target.
  • values of syntaxes for reconstruction coefficients around residual coefficients or temporary reconstruction coefficients may be referred to.
  • values of sig_flag of reconstructed coefficients included in a reconstructed area around the residual coefficient may be summed.
  • an absolute value of a reconstructed coefficient or a partially reconstructed coefficient included in a reconstructed area around the residual coefficient may be calculated.
  • the absolute value of the partially reconstructed coefficient may mean a temporary reconstructed coefficient derived based on syntaxes included in one pass, for example, (sig_flag + gt_1_flag + par_flag + (gt_2_flag ⁇ 1)).
  • One of a plurality of context information may be specified using the derived value.
  • whether to use context information of a neighboring reconstruction region may be determined according to a residual coefficient encoding method.
  • context information of the surrounding reconstruction area is used, whereas in the other method, context information of the surrounding reconstruction area is not used.
  • context information of the surrounding reconstruction area is not used.
  • syntaxes are encoded with reference to a neighboring reconstruction region, whereas under an encoding method using a maximum of five gt_N_flags, syntaxes may be encoded without referring to a neighboring reconstruction region.
  • ⁇ _flag In addition to the sig_flag described above, other syntaxes may be encoded/decoded with reference to a neighboring reconstruction block. For example, when encoding rem_level or abs_level, the encoding may be performed with reference to a neighboring reconstruction block.
  • the surrounding reconstruction block may be referred to when determining a binarization parameter (eg, a Rice parameter).
  • a binarization parameter is determined by referring to a neighboring reconstruction block, while in the other, binarization is performed without referring to the neighboring reconstruction block. You can set parameters.
  • the binarization parameter may be set to a value predefined in the encoder and the decoder.
  • the predefined value may be an integer such as 0, 1, or 2.
  • information for determining a binarization parameter may be signaled through an upper header. For example, the information may be encoded and signaled at a slice, picture, or sequence level.
  • FIGS 27 to 29 are diagrams for explaining the concept of the palette mode (palette mode) according to the present disclosure.
  • a current block pixels occurring a lot in a block to be encoded (hereinafter referred to as a current block) are displayed with a specific index, and then the specific index is encoded instead of the pixel and transmitted to the decoding device.
  • a flag indicating whether the palette mode is permitted may be encoded and transmitted to the decoding apparatus. In this case, the flag may be coded only when the size of the current block is less than or equal to a preset size.
  • the preset size may be determined based on the slice type of the slice to which the current block belongs, the encoding mode or the prediction mode of the current block. For example, when the current block belongs to the I slice, the palette mode may be used only when the size of the current block is 4x4.
  • FIG. 27 is an example of a process of generating a palette table. For convenience of explanation, it is assumed that the size of the current block is 4x4.
  • a histogram of 16 pixels existing in the current block is shown in FIG. 27 .
  • the horizontal axis indicates a pixel value (for example, a value from 0 to 255 in the case of a pixel quantized to 8 bits), and the vertical axis indicates the frequency of the pixel value.
  • a quantization zone is set based on pixels that occur frequently.
  • Pixels existing in the quantization zone are replaced with the pixel with the highest frequency, and one index is assigned to the pixel with the highest frequency.
  • Information indicating the size of the quantization zone may be encoded and transmitted to a decoding apparatus. Alternatively, the size of the quantization zone may be determined based on at least one of the size, shape, and bit depth of the current block.
  • a part represented by a thick solid line in the quantization zone means pixels a3, a8, a10, a11 having the highest frequency, and a part represented by a thin solid line means other pixels.
  • pixels not included in the quantization zone are expressed as escape values, and in this case, they are quantized and encoded in addition to encoding by index.
  • Figure 28 shows an example for the palette table set in Figure 27.
  • each row of the palette table is expressed as a palette entry, and a different index is assigned to each entry. That is, the size of the palette table may mean the number of entries.
  • An entry is formed using pixels a3, a8, a10, and a11 having the highest frequency in each quantization zone, and an index is assigned to each entry. If an escape value exists, an escape can be placed in the last entry and an index can be assigned. That is, the last index in the palette can mean an escape value.
  • FIG. 29 is an example of a process in which pixels in a block are allocated as indexes using a set palette table.
  • the allocated indexes are expressed as palette indexes.
  • Pixels existing in the block are replaced with indexes according to the set palette table, and the indexes are encoded and transmitted to the decoding device.
  • the indexes are encoded and transmitted to the decoding device.
  • quantized a5' and a15' in addition to the index are encoded.
  • the used palette table is also encoded and transmitted to the decoding device.
  • FIG. 30 illustrates a method of performing intra prediction based on a palette mode according to the present disclosure.
  • the palette mode may be applied on a block-by-block basis (eg, a coding unit, a prediction unit), and for this, flag information (pred_mode_plt_flag) indicating whether to use the palette mode may be signaled on a block-by-block basis. That is, when the value of the flag is 1, the palette mode is applied to the current block, and when the value of the flag is 0, the palette mode is not applied to the current block.
  • a block-by-block basis eg, a coding unit, a prediction unit
  • the flag may be adaptively encoded/decoded based on at least one of a prediction mode of the current block and a size of the current block. For example, the flag may be encoded/decoded only when the prediction mode of the current block is the intra mode. The flag may be encoded/decoded only when the prediction mode of the current block is not a skip mode. The flag may be encoded/decoded only when at least one of a width or a height of the current block is less than or equal to a predetermined first threshold size.
  • the first threshold size is a pre-defined value in the encoding/decoding apparatus, and may be any one of 16, 32, or 64.
  • the flag may be encoded/decoded only when the product of the width and height of the current block is greater than a predetermined second threshold size.
  • the second threshold size is a value pre-defined in the encoding/decoding apparatus, and may be any one of 16, 32, or 64.
  • the first threshold size and the second threshold size may be different values. If any one of the above conditions is not satisfied, the flag is not encoded/decoded, and in this case, the value of the flag may be set to 0.
  • palette table palette table
  • the palette table may consist of at least one palette entry and a palette index identifying each palette entry.
  • the palette table of the current block may be determined using the palette table of the previous block (hereinafter referred to as the previous palette table).
  • the previous block may mean a block coded or decoded before the current block.
  • the palette entry of the current block may include at least one of a predicted palette entry or a signaled palette entry.
  • the current block may use all or part of the palette entries used by the previous block, and among the palette entries used in the previous block, the palette entry reused in the current block is called a predicted palette entry.
  • the current block can use all of the palette entries in the previous palette table.
  • the current block may use some of the palette entries of the previous palette table, and for this, a flag (PalettePredictorEntryReuseFlag, hereinafter referred to as a palette prediction flag) for specifying whether to reuse the palette entry may be used.
  • the value of the palette prediction flag is assigned to each palette entry of the previous palette table, and the palette prediction flag (PalettePredictorEntryReuseFlag[i]) determines whether the palette entry corresponding to the palette index i in the previous palette table is reused in the palette table of the current block.
  • a palette table of the current block may be constructed by extracting a palette entry having a value of the palette prediction flag of 1 from the previous palette table, and arranging them sequentially.
  • the palette table of the current block may be initialized in units of a predetermined area.
  • the predetermined region may mean a parallel processing region or a CTU row of the current picture.
  • the palette table of the current block may be initialized with the palette table of the neighboring CTU of the CTU to which the current block belongs.
  • the neighboring CTU may mean a CTU located above the CTU to which the current block belongs. That is, the palette table for the first CTU of the N-th CTU row may be initialized based on the palette table for the first CTU of the (N-1)-th CTU row.
  • the initialized palette table may be updated based on the palette table of the previous block belonging to the same CTU row.
  • the palette prediction flag may be signaled in the form of an encoded/decoded flag for each palette entry.
  • the palette prediction flag may be encoded/decoded in the form of a binary vector based on run length encoding. That is, in the palette prediction flag array that specifies whether to reuse the previous palette entry, a syntax palette_predictor_run that specifies the number of palette prediction flags that is 0 between non-zero palette prediction flags may be encoded/decoded. This will be described later.
  • the palette prediction flag values may be directly encoded. This will be described later.
  • the palette table of the current block may further include a palette entry signaled through a bitstream, wherein the signaled palette entry is a palette entry that is not included in the previous palette table among the palette entries used by the current block can mean
  • the signaled palette entry may be added after the predicted palette entry of the palette table.
  • a palette index may be determined in units of pixels of the current block ( S3010 ).
  • the current block may determine the palette index using at least one of an index mode (INDEX MODE) or a copy mode (COPY MODE).
  • the index mode may mean a method of encoding the palette index information (palette_idx_idc) in the encoding apparatus to specify the palette index used in the current block.
  • the decoding apparatus may derive the palette index of the current pixel based on the encoded palette index information.
  • the palette index information has a value between 0 and (MaxPaletteIndex-1), where MaxPaletteIndex may mean the size of the palette table of the current block or the number of palette entries constituting the palette table.
  • MaxPaletteIndex may mean the size of the palette table of the current block or the number of palette entries constituting the palette table.
  • the value of the palette index information signaled through the bitstream may be allocated as the palette index of the current pixel.
  • the copy mode may refer to a method of determining the palette index of the current pixel by using the palette index of the neighboring pixel according to a predetermined scan order.
  • a horizontal scan, a vertical scan, a diagonal scan, etc. may be used, and any one of them may be selectively used.
  • a predetermined flag or index may be encoded/decoded.
  • the encoding apparatus encodes the flag as 0 when horizontal scan is applied as the scan order of the current block, and codes the flag as 1 when vertical scan is applied as the scan order of the current block. can do.
  • the decoding apparatus may adaptively determine the scan order of the current block according to the coded flag.
  • the present invention is not limited thereto, and a method of encoding/decoding the palette index according to the scan order will be described later.
  • the palette index of the current pixel may be predicted based on the palette index of the neighboring pixel, or the palette index of the neighboring pixel may be copied and set as the palette index of the current pixel as it is.
  • the neighboring pixel may mean a pixel adjacent to the top, bottom, left, or right of the current pixel.
  • the neighboring pixel may be located on the same horizontal line or the same vertical line as the current pixel.
  • the copy mode is the first copy mode in which the palette index used by the pixel adjacent to the top or bottom of the current pixel is identically used as the palette index of the current pixel, the palette index used by the pixel adjacent to the left or right of the current pixel At least one of a second copy mode that uses the same as the palette index of the current pixel, or a third copy mode that uses the palette index used by diagonally adjacent pixels of the current pixel equally as the palette index of the current pixel can
  • any one of the above-described first to third copy modes may be selectively used according to the scan order of the current block.
  • the first copy mode may be applied when the scan order of the current block is a vertical scan
  • the second copy mode may be applied when the scan order of the current block is a horizontal scan.
  • the scan start position of the current block is not limited to the upper-left pixel of the current block, and other corner pixels of the current block (eg, lower-left pixel, upper-right pixel, and lower-right pixel) may be used as the scan start position.
  • other corner pixels of the current block eg, lower-left pixel, upper-right pixel, and lower-right pixel
  • the same palette index as the pixel adjacent to the top or left may be used as described above, or the same palette index as the pixel adjacent to the bottom or right may be used.
  • the encoding apparatus may encode a flag (run_copy_flag) indicating whether the copy mode is used.
  • the encoding apparatus may encode the flag as 1, otherwise (ie, if the index mode is used), the encoding apparatus may encode the flag as 0.
  • the value of the palette entry extracted from the palette table may be set as the predicted value or the restored value of the pixel of the current block.
  • the pixel when the palette index indicates the last palette entry among the palette entries in the palette table of the current block, the pixel may be inferred as being encoded in the escape mode (ESCAPE MODE).
  • the escape mode does not use the palette entry of the pre-configured palette table, but instead predicts / restores the pixel based on the additionally signaled palette escape value It can mean a method.
  • a pixel having a palette index equal to (the number of palette entries - 1) may be predicted/restored using the additionally signaled palette escape value.
  • 31 and 32 show a method of configuring a pallet table according to the present disclosure.
  • the same palette table used in the encoding apparatus must also exist in the decoding apparatus. Therefore, it is necessary to encode the palette table in the encoding device. Therefore, it is possible to encode the number of palette entries existing in the palette table, and to encode the pixel value assigned to each entry.
  • the palette mode was used in the previous block, the amount of bits required to encode the palette table can be greatly reduced by generating the palette table of the current block based on the palette table used in the previous block.
  • the previous block means a block that has been encoded/decoded before the current block. Specifically, at least one of a flag indicating whether to configure the palette table of the current block based on the previous palette table or a palette prediction flag indicating whether to add an entry included in the palette table of the previous block to the palette table of the current block is available.
  • 31 is a method of reducing the bit amount of a palette table to be currently encoded by using a palette prediction flag.
  • the palette table A may mean a palette table existing in a block encoded using the palette mode before the current block.
  • the previous block may be a neighboring block adjacent to the current block.
  • the neighboring block may include at least one of an upper neighboring block, a left neighboring block, an upper left neighboring block, an upper right neighboring block, or a lower left neighboring block.
  • the palette table A it is possible to specify whether or not to be used as it is in the current palette table by using a palette prediction flag for each entry. For example, if the palette prediction flag is 1, it may mean that the corresponding entry is used as it is in the current palette table, and if 0, it may mean that the corresponding entry is not used in the current palette table.
  • the index allocated to the entries predicted from the palette table A may be set to be the same as the index allocated to the palette table A. Alternatively, the index of each entry in the ascending/descending order of the indexes allocated to each entry in the palette table A may be reassigned.
  • the first entry, the third entry, and the fifth entry are used in the current palette table, so you can put them in order from the first entry to the third entry of the current palette table, and configure a new entry only from the fourth entry to the fifth entry.
  • the palette prediction flag is encoded first, and the number of remaining entries (two in the example of FIG. 31: the fourth entry and the fifth entry of the current palette table) can be encoded. After that, the remaining entries may be encoded as much as the number of remaining entries.
  • the decoding device can also generate the same palette table as the coding device and predict/restore the current block.
  • information related to the palette table may be encoded and signaled.
  • the size of the palette table may indicate the maximum number of palette entries that the palette table can contain.
  • the size of the palette table may have a fixed value in the encoder and decoder.
  • the bit depth of the current image, the color component of the current block eg, whether it is a luminance component or a chrominance component
  • the size of the current block or Based on at least one of the shapes, the size of the pallet table may be determined.
  • the palette table of the current block may consist of palette entries reused in the previous palette table and palette entries newly added. Information about the reused palette entries constituting the palette table and the newly added palette entries may be encoded and signaled.
  • a palette prediction flag indicating whether a palette entry included in a previous palette table is reused may be encoded.
  • the number of palette entries to be newly added to the palette table may be a value obtained by subtracting the number of palette entries reused from the size of the palette table. For example, if the maximum number of palette entries that the palette table can contain is 40, the sum of the number of reused palette entries and the number of new palette entries cannot exceed 40.
  • the number of palette prediction flags may be set so as not to exceed a threshold value. For example, if the threshold value is 10, for up to 10 of the palette entries included in the previous palette table, it can be determined whether to reuse. Accordingly, a maximum of 10 palette prediction flags may be generated.
  • the number of reused palette entries may be set so that the number of reused palette entries does not exceed a threshold value. That is, the number of palette prediction flags having a value of True may be set so as not to exceed a threshold value.
  • the threshold value may be encoded through an upper header such as a slice, a picture, or a sequence. Alternatively, information for specifying a threshold value for each block may be encoded and signaled.
  • an encoder and a decoder may use a fixed value threshold.
  • the threshold value may be determined based on at least one of a size, a shape, a color component (eg, a luminance component or a chrominance component) of the block, or a bit depth.
  • a size e.g., a size, a shape, a color component (eg, a luminance component or a chrominance component) of the block, or a bit depth.
  • the maximum number of predictions it is possible to limit the number of entries (hereinafter, referred to as the maximum number of predictions) that can be brought by using the palette prediction flag.
  • information on the maximum number of predictions may be signaled through a bitstream.
  • the maximum number of predictions may be determined based on at least one of the size of the palette table, the size/shape of the current block, the size/shape of the previous block, or the size of the previous palette table.
  • only a certain percentage of the size of the current palette table may be obtained by using the palette prediction flag to bring an entry from the previous palette table, and the remaining ratio may be unconditionally generated from the current palette table. For example, if the size of the current palette table is 6 and the ratio is set to 50%, up to 3 entries from the previous palette table are fetched using the palette prediction flag, and the remaining 3 entries can be created unconditionally from the current palette table. have. Accordingly, when the number of entries having the value of the palette prediction flag of 1 reaches three, encoding of the palette prediction flag may be omitted for subsequent entries.
  • the size of the previous block when the size of the previous block is smaller than a preset threshold, it may be set so that the palette entries included in the palette table of the previous block are not added to the palette table of the current block. That is, when the size of the previous block is smaller than a preset threshold, encoding of the palette entry prediction flag for the palette entries of the previous block may be omitted, and the value may be regarded as 0.
  • the palette entry of the previous block may not be added to the palette table of the current block.
  • the threshold value may be encoded in an upper header and transmitted to a decoder.
  • the encoder and the decoder may use a fixed threshold.
  • the number of palette entries that can be added to the palette table of the current block from the palette table of the previous block may be determined.
  • a method of continuously allocating palette prediction flags using a second previous palette table that is earlier than the first previous palette table is also possible.
  • the encoding order of the palette prediction flag may be determined by considering the indexes of the entries included in the first previous palette table and the entries included in the second previous palette table.
  • the palette prediction flag may be encoded for the entry with index 0 included in the second previous palette table. Then, after encoding the palette prediction flag for the entry with index 1 included in the first previous palette table, it is possible to encode the palette prediction flag for the entry with index 1 included in the second previous palette table.
  • the palette table candidate list may be configured, and at least one of a plurality of previous palette table candidates included in the palette table candidate list may be used when encoding the current palette table.
  • RT denotes a pixel located at the upper right of the block
  • LB denotes a pixel located at the bottom left of the block.
  • reference may be made to at least one of five neighboring blocks, that is, blocks including pixels A to E in FIG. 32 .
  • the referenced block may be encoded as an index and transmitted to a decoding apparatus.
  • only blocks at positions pre-defined in the encoding/decoding apparatus may be referred to among the blocks each including the pixels A to E described above.
  • the pre-defined position may be the upper block (B) or the left block (A). In this case, encoding of an index specifying the referenced block may be omitted.
  • the palette table to be currently encoded can be filled by additionally designating a block based on an additional index.
  • the encoding/decoding apparatus may refer to a pre-promised fixed number of blocks, and information specifying the number of referenced blocks may be transmitted through an upper header.
  • a method in which the encoding/decoding apparatus refers to the same fixed number of neighboring blocks according to the size/form of the block and the size of the palette table is also possible.
  • a method of fetching the palette table from the block by designating M blocks encoded in the palette mode before the current block in the encoding order as indexes is also possible.
  • a method of fetching the palette table from the block by designating the block included in the collocated picture as an index is also possible.
  • a method of constructing a palette table candidate list is also possible. All used palette tables are stored in the candidate list starting from the block existing in the first position of the image until just before the current block. Alternatively, after setting the number N of tables to be stored in the candidate list, the N palette tables are stored in the candidate list. That is, when the encoding of the block is completed, the palette table of the encoded block may be stored in the candidate list. In this case, if the same palette table candidate as the palette table to be added to the candidate list exists, the palette table may not be added to the candidate list. Alternatively, the palette table may be added to the candidate list, and the same palette table candidate as the palette table may be deleted from the candidate list.
  • the method in which the palette table candidates in the candidate list are stored has a higher priority as it is closer to the current block, and may have a lower priority as it is further away from the current block.
  • the priority may be set according to the size or reference frequency of the palette table. According to this priority, when the number of stored tables exceeds N, it can be deleted from the candidate list starting from the palette table with a lower priority.
  • the preset initial palette table may be a palette table derived from the entire image, not a palette table derived for each block.
  • each entry value of the palette table derived from the entire image may be encoded through a higher header along with the number of entries.
  • a method of configuring the entries included in the palette table as a palette entry candidate list is also possible. Entries included in the palette table of the encoded block can be added to the entry candidate list. In this case, among the entries included in the palette table, only entries having an index smaller than the threshold may be included in the entry candidate list. When the number of entries included in the palette table of the current block is less than the maximum number, the palette table may be configured with reference to the candidate entries included in the palette entry candidate list.
  • Palette entries included in the palette table of the encoded/decoded block may be added to the palette entry candidate list.
  • the smallest index may be assigned to the newly added palette entries.
  • the existing palette entries may be removed from the palette entry candidate list in the order of the highest index.
  • 33 is a diagram illustrating an example in which palette entries are added to the palette entry candidate list.
  • blocks may be encoded/decoded using the configured palette table.
  • the palette entry candidate list may add palette entries included in the palette table.
  • the above palette entries may be added to the palette entry candidate list.
  • the duplicate palette entry may not be added to the palette entry candidate list.
  • the same palette entry as the palette entry to be added to the palette entry candidate list is already stored in the palette entry candidate list, the previously stored palette entry is removed from the palette entry candidate list, and the duplicate palette entry is removed from the palette entry candidate list can be added to
  • the palette entries included in the palette table may not be added to the palette entry candidate list.
  • the palette entries included in the palette table of the block may not be added to the palette entry candidate list. Accordingly, the palette entry included in the palette table of the block in which the number of pixels included in the block is less than or equal to the threshold value cannot be utilized as a prediction palette entry in constructing the palette table of the next block.
  • the palette entries included in the palette table may be added to the palette entry candidate list.
  • the threshold value may be encoded in an upper header and transmitted to a decoder.
  • the encoder and the decoder may use a fixed threshold.
  • the threshold may be a natural number such as 4, 8, 16, or 32.
  • the number of palette entries that can be added to the palette entry candidate list may be determined. For example, if the size of the block is less than or equal to the threshold, a maximum of n palette entries may be added to the palette entry candidate list, whereas if the size of the block is greater than the threshold, a maximum of m palette entries are palette entry candidates can be added to the list.
  • n may be a natural number smaller than m.
  • a palette table predefined in the encoder and the decoder may be used.
  • the predefined palette table means that the size of the palette table and/or pixel values allocated to palette entries are predefined in the encoder and the decoder.
  • an index specifying one of the plurality of palette tables may be encoded and transmitted to the decoder.
  • palette entries after defining only pixel values allocated to each palette entry, only information indicating an index allocation order between palette entries may be encoded.
  • index 0 is assigned to a palette entry having a pixel value of -3
  • index 1 is assigned to a palette entry having a pixel value of +4
  • a pixel value of -4 Index 2 can be assigned to the in-palette entry.
  • the minimum value m in the block may be encoded and transmitted to the decoding apparatus, and an index of each of the palette entries may be determined based on the minimum value m.
  • index 0 may be allocated to the palette entry equal to the minimum value m, and indexes may be allocated in an order similar to the minimum value m.
  • an index assigned to a palette entry having a small difference from the minimum value m may have a smaller value than an index assigned to a palette entry having a large difference from the minimum value m.
  • Whether to use the predefined palette table may be determined based on whether lossless encoding is applied. For example, when lossless encoding is applied, a predefined palette table is used, and when lossless encoding is not applied, the decoder may configure and use the palette table in the same way as the encoder.
  • the method of configuring the palette table may be set differently depending on whether lossless encoding is applied.
  • the above-described palette table may be used to derive a predicted value, a reconstructed value, or a residual value of a sample.
  • a run length encoding method may be used.
  • a continuous sequence of identical data is called a run, and the continuous length is expressed as a run length.
  • a run length For example, if there is a string aaaaaabbccccccc, 6 a, 2 B, and 7 c, so it can be expressed as 6a2b7c.
  • Such an encoding method is called a run-length encoding method.
  • run-length encoding method When encoding the palette prediction flags using run-length encoding, the number of 0's, the number of 1's, etc. can be expressed. Alternatively, run-length encoding may be performed only on 0, and conversely, run-length encoding may be performed on only 1 as well.
  • 35 is a diagram illustrating a method of signaling a palette prediction flag in the form of a binary vector based on run length encoding as an embodiment to which the present disclosure is applied.
  • the palette table of the previous block uses 8 palette entries with palette indexes of 0 to 7.
  • the image encoding apparatus determines whether the corresponding palette entry is reused as the palette entry of the current block for each of the palette entries 0 to 7 of the previous block, and if the palette entry is reused as the palette entry of the current block, the corresponding palette
  • the value of the palette prediction flag for the entry can be set to 1, otherwise 0, respectively. For example, as shown in FIG. 35, among the palette entries of the previous block, the palette entries 0, 1, 3, and 7 are reused as the palette entries of the current block, and the remaining palette entries are not reused, A binary vector represented by 11010001 may be generated.
  • encoding at least one of the number of 1s in the binary vector (that is, the number of palette entries reused as the palette entry of the current block among the palette entries of the previous block) or the number of 0s preceding 1 in the binary vector Signaling may be performed by a decoding device.
  • the number of 1s in the binary vector is 4, 4 can be encoded as the number of palette entries of the previous block that is reused as the palette entry of the current block.
  • the number of 0s preceding 1 in the binary vector that is, 0, 0, 1, 3 may be sequentially encoded.
  • the decoding apparatus receives at least one of information (palette_entry_run) about the number of 0's preceding 1 in the binary vector or information about the number of palette entries of the previous block reused as the palette entry of the current block from the encoding device, and It can be used to compose the palette table of the current block.
  • information palette_entry_run
  • the decoding apparatus sequentially extracts information (palette_entry_run), that is, 0, 0, 1, 3 about the number of 0s before 1 in the binary vector, from the bitstream, and using this, the palette entry of the previous block A binary vector indicating whether to reuse or not, that is, 11010001 may be restored. If a value of 1 occurs in the process of restoring a binary vector, the palette entry of the previous block corresponding to the value of 1 may be inserted into the palette table of the current block. Through this process, the palette table of the current block can be configured by selectively reusing some palette entries from the palette table of the previous block.
  • 36 illustrates a method of encoding/decoding a palette index according to a scan order according to the present disclosure.
  • the palette index assigned to each pixel of the current block must also be encoded. 36 is an example of a scan order performed in a current block.
  • the main purpose of the scan sequence shown in FIG. 36 is to perform scanning in consideration of directionality. As shown in FIG. 36(a) , if characteristics of pixels existing in the current block have similar values in the horizontal or vertical direction, the possibility of clustering among the same indexes increases if scanning is performed as shown in FIG. 36(a). Alternatively, if characteristics of pixels existing in a block have similar values in the z-direction or diagonal direction as shown in FIG. 36(b), the possibility of clustering among the same indices increases when scanning is performed as shown in FIG. 36(b).
  • the encoding apparatus may indicate which scan method is used as an index, encode it, and transmit it to the decoding apparatus.
  • the scan order may be determined according to the size and shape of the current block.
  • the index for each pixel may be encoded.
  • the index of the current pixel may be derived using run merge encoding.
  • the run merge encoding method represents a method of deriving an index of a current pixel from an index of an adjacent pixel.
  • the adjacent pixel may include at least one of left and right adjacent pixels, an upper adjacent pixel, a lower adjacent pixel, or diagonally adjacent pixels of the current pixel, and the location of the adjacent pixel is determined by the scan applied to the current block. It may be adaptively determined according to the direction.
  • 37 is an exemplary diagram for describing a pixel adjacent to a current pixel.
  • A indicates a current pixel to be encoded
  • B indicates a pixel immediately preceding the current pixel in a scan order
  • C indicates a neighboring pixel adjacent to the current pixel among pixels included in an adjacent line (row/column).
  • the adjacent line may be one of a top row, a bottom row, a left column, or a right column, depending on the scan direction.
  • the run type flag may be set.
  • the run type is 'ABOVE' indicating that the index of the current pixel A is the same as the index of the neighboring pixel (ie, the neighboring pixel C) included in the adjacent line, or 'INDEX' indicating that the index of the current pixel A is encoded as it is. can point to one of them.
  • the value of the run merge flag may be set based on the run type of the previous pixel B and whether the index of the current pixel A is the same as that of the adjacent pixel B or C.
  • the run type of the previous pixel B is 'ABOVE'
  • the value of the run merge flag may be set to 1 (true).
  • the run type of the previous pixel B is 'INDEX' and the indexes of the current pixel A and the previous pixel B are the same
  • the value of the run merge flag may be set to true.
  • the decoder may derive the index of the current pixel with reference to the run type of the previous pixel B.
  • the run type of the previous pixel B is 'ABOVE'
  • the run type 'ABOVE' may be applied to the current pixel A to derive the index of the neighboring pixel C as the index of the current pixel A.
  • the index of the previous pixel B may be derived as the index of the current pixel A.
  • the value of the run merge flag may be set to 0 (false).
  • run type information indicating the run type of the current pixel A may be encoded/decoded.
  • the run type may indicate either 'ABOVE' indicating that the index of the current pixel A is the same as the index of the neighboring pixel C or 'INDEX' in which the index of the current pixel A is encoded as it is.
  • the run type information may be a 1-bit flag or an index specifying one of a plurality of run types. For example, when the syntax run_type indicating the run type indicates 'ABOVE', it indicates that the index of the current pixel A is the same as the index of the neighboring pixel C. In this case, the index of the neighboring pixel C may be derived as the index of the current pixel A.
  • the syntax run_type indicating the run type indicates 'INDEX'
  • palette_idx specifying one of a plurality of palette entries included in the palette table may be encoded/decoded.
  • information for deriving an escape value may be additionally encoded.
  • a pixel located at the top row in the current block does not have a pixel adjacent to the top. Accordingly, with respect to the pixel located in the uppermost row, encoding of run type information may be omitted and it may be estimated that the run type is 'INDEX'.
  • the decoder may derive the index of the current pixel A using the run type information. For example, when the run type information indicates 'ABOVE', the index of the neighboring pixel C may be derived as the index of the current pixel A. On the other hand, when the run type information indicates 'INDEX', index information may be additionally parsed, and the index information of the current pixel A may be derived based on the parsed index information.
  • encoding/decoding of the run merge flag may be omitted. This is because, for the first pixel, there is no previous pixel whose index is coded.
  • the encoding of the run merge flag is omitted, it can be estimated that the value is 0 (false).
  • the index of the current pixel may be derived based on at least one of the syntax run_merge_flag, run_type, and palette_idx.
  • the above syntaxes may be encoded without using context information.
  • a coding method that does not use context information may be defined as bypass coding.
  • At least one of the above syntaxes may be set to be encoded using context information.
  • context information may be referred to.
  • the probability that the value of the run merge flag is 1 or the probability that the value of the run merge flag is 0 may be determined based on the value of the previous run merge flag.
  • a variable PREV_POS indicating the scan order of a pixel having the highest scan order among pixels in which the value of the run merge flag is set to 0 may be used.
  • a context information index value may be derived by differentiating variables PREV_POS and 1, and a run merge flag may be encoded using the derived context information index value.
  • the value of the variable PREV_POS may be set to an initial value (eg, 0). Accordingly, for the first palette prediction flag, the context information index value may be set to -1.
  • variable PREV_POS may be updated.
  • the run merge flag having a value of 1 is encoded, the variable PREV_POS may be maintained as it is.
  • a context information index for a pixel having a scan order of 6 may be set to 2.
  • the probability of the run merge flag may be determined according to the value of the context information index, and the palette prediction flag may be encoded based on the determined probability.
  • variable PREV_POS has been described as indicating the position of a pixel having the run merge flag having a value of 0, but the variable PREV_POS may be set to indicate the position of a pixel having the run merge flag having a value of 1.
  • 39 is an example showing the range of the context information index.
  • the maximum value of the context information index may be set not to exceed a predefined threshold.
  • the value of the context information index may be set to the maximum value. In FIG. 39 , it is illustrated that the maximum value is 4.
  • the minimum value of the context information index may be set to the minimum value.
  • the minimum value is zero. Accordingly, the context information index for the first pixel may be changed from -1 to 0.
  • the maximum and/or minimum values of the context information index may be defined in the encoder and the decoder. Alternatively, information indicating the maximum and/or minimum values of the context information index may be signaled through the bitstream. For example, the information may be encoded and signaled at a higher level such as a slice, a picture, or a sequence.
  • index-related information may be encoded for each region.
  • index-related information is encoded in units of a region having a preset size.
  • FIG. 40(a) shows a case where the block size is 16x4, and the example of FIG. 40(b) shows a case where the block size is 8x8.
  • a horizontal scan is applied to a block.
  • a block may be divided into regions of a predefined size. For example, when the predefined size is 16, the block may be divided into a plurality of regions in units of 16 pixels. For example, in the example of FIG. 40A , the block is divided into 16x1 sized regions, and in the example of FIG. 40B , the block is divided into 8x2 sized regions.
  • Index-related information may be encoded for each region. For example, after encoding of the index-related information in the N-th region (eg, at least one of run_merge_flag, run_type, or palette_idx) is completed, the index-related information in the N+1 th region may be encoded. Alternatively, the encoding of index-related information may be parallel-processed between regions.
  • Index-related information may be coded independently between regions. For example, when encoding index-related information within a predetermined region, other regions may not be referred. For example, when the first pixel of the region 2 is encoded, information on the last pixel of the region 1 may not be referenced. Accordingly, encoding of the run merge flag may be omitted for the first pixel in each region. Since index-related information is coded independently between regions, a scan order may also be independently assigned between regions. For example, by assigning scan order numbers 0 to 15 for each area, pixels may be distinguished.
  • encoding of run type information may be omitted for pixels located in the uppermost row in each region.
  • index-related information may be encoded by providing inter-region dependency.
  • index-related information of pixels positioned in the uppermost row of region 2 may be encoded with reference to index-related information of pixels positioned in the lowermost row of region 1.
  • the pixels may be distinguished by assigning a continuous scan order between the regions. For example, scan orders 0 to 15 may be allocated to pixels belonging to region 1, while scan orders 16 to 31 may be allocated to pixels belonging to region 2 .
  • the value of the run merge flag may be coded for the first pixel in the remaining area except for the first area.
  • the run merge flag of the first pixel of region 2 may be encoded with reference to the last pixel of region 1 (eg, a pixel having a scan order of 15).
  • Information indicating whether inter-region index-related information is independently encoded or dependently encoded may be encoded and signaled. Alternatively, based on at least one of the size or shape of the current block, it may be determined whether the inter-region index-related information is independently coded or dependently coded.
  • index-related information can be encoded by dividing one block into a plurality of regions and then providing dependencies between regions. By extending this, inter-block dependency may be given to encode index-related information.
  • 41 shows an example in which index-related information is encoded using inter-block dependency.
  • index-related information may be coded with reference to the neighboring block.
  • the run merge flag for the first pixel in the current block may be encoded with reference to the neighboring block.
  • the run merge flag for the first pixel of the current block is set by referring to the pixel having the last scan order in the upper neighboring block or the left neighboring block, or the pixel adjacent to the first pixel of the current block in the upper neighboring block or the left neighboring block. can be encoded.
  • the run merge flag for the first pixel C in the current block may be encoded with reference to the pixel A neighboring to the top or the pixel B neighboring to the left.
  • run type information may be coded with reference to a neighboring block even for pixels located in the uppermost row in the current block.
  • the upper neighboring block may be referred to when the left neighboring block is unavailable. That is, when the run-type flag encoding for the first pixel C in the current block is performed, the pixel B is preferentially referenced, but when the pixel B is unavailable, the pixel A may be referenced.
  • the escape value must be additionally encoded. You can quantize escape values and encode quantized escape values. In this case, quantization may be performed using an initial quantization parameter (QP) defined at the SLAS level. Through the SLAS header, an initial quantization parameter may be signaled.
  • QP initial quantization parameter
  • an offset value indicating a difference between a quantization parameter defined at the slice level and a quantization parameter applied to the current block may be encoded.
  • the offset may be coded in units of blocks.
  • an offset having a value of 4 may be encoded and signaled.
  • the size of the palette table (ie, the maximum number of palette entries) and/or the binarization method of the index may be different. Accordingly, information indicating whether an escape value exists in the current palette table can be encoded and signaled.
  • the information may be a 1-bit flag.
  • the size of the current palette table may be increased by one.
  • the flag indicates that the escape value does not exist, it is possible to maintain the size of the current palette table.
  • the difference between the escape value and the predicted value derived through intra prediction may be encoded.
  • Figure 42 (a) shows the current block and reference pixels adjacent to the current block
  • Figure 42 (b) shows the palette entry for the current block.
  • the pixel assigned with the index 4 is encoded as an escape value.
  • a difference value derived by differentiating a prediction value obtained through intra prediction from the value A of the pixel may be encoded.
  • a difference value (ie, A-R2) derived by differentiating the upper reference pixel R2 from the pixel value A may be encoded.
  • the quantized difference value may be encoded.
  • the intra prediction mode used to derive the difference value may be at least one of planar, DC, vertical direction, horizontal direction, upper right diagonal direction, upper left diagonal direction, or lower left diagonal direction.
  • An escape value can be derived by using a fixed intra-picture prediction mode in the encoder and decoder.
  • information specifying an intra prediction mode for deriving an escape value among a plurality of intra prediction modes may be encoded and signaled.
  • the information when there are two available intra prediction modes, the information may be a 1-bit flag.
  • the intra prediction mode used to derive the escape value may be determined based on the flag.
  • the intra prediction mode used to derive the escape value may be determined based on at least one of the size and shape of the current block and the intra prediction mode of the neighboring block.
  • a difference value may be derived using an adjacent pixel in the current block.
  • the adjacent pixel indicates a pixel whose index is determined before the current pixel in the scan order.
  • FIG. 43 (a) is an example of deriving a difference value with respect to an escape value using a reference pixel
  • FIG. 43 (b) is an example of deriving a difference value with respect to an escape value using an adjacent pixel.
  • the scan order is in the horizontal direction.
  • a difference value between the value of the current pixel and the reference pixel located in the vertical or horizontal direction of the current pixel may be derived.
  • a difference value may be derived by differentiating the reference pixel R2 or the reference pixel R6 from the value A of the pixel having the index 4 .
  • the difference value can be derived using the reference pixel in the horizontal direction.
  • a difference value between the value of the current pixel and a neighboring pixel adjacent to the current pixel may be derived.
  • a difference value may be derived by differentiating the value of the right neighboring pixel or the value of the upper neighboring pixel from the value A of the pixel having the index 4 .
  • the vertical intra prediction mode when the vertical intra prediction mode is applied, a difference value is derived using the neighboring pixels in the vertical direction, and when the horizontal intra prediction mode is applied, the difference value can be derived using the neighboring pixels in the horizontal direction. have.
  • a method of deriving a difference value may be determined. For example, when lossless encoding is not applied, as in the example shown in FIG. 43A , a difference value may be derived using a reference pixel outside the current block. On the other hand, when lossless coding is applied, as in the example shown in (b) of FIG. 43 , a difference value can be derived using neighboring pixels in the current block.
  • the decoder may derive an escape value for the current pixel by summing the difference value and the predicted value. For example, when a difference value is derived using a reference pixel outside the current block, an escape value may be derived by adding the difference value decoded from the bitstream and the upper reference pixel or the left reference pixel. On the other hand, when the difference value is encoded using the reference pixel in the current block, the escape value is derived by adding the difference value decoded from the bitstream and the value of the restored neighboring pixel (eg, the upper neighboring pixel or the right neighboring pixel). can do.
  • a prediction value for an escape value may be generated using a block vector.
  • the reference block specified through the block vector may be specified.
  • the value of the pixel at the same position as the current pixel to which the escape value is assigned may be set as the predicted value.
  • a difference value may be derived by differentiating A5, which is a pixel at the same position as the pixel in the reference block, from the value A of the pixel to which the escape value is assigned.
  • the quantized difference value may be encoded by encoding the difference value or quantizing the difference value.
  • Whether to generate a prediction value for an escape value using a block vector may be determined based on whether lossless coding is applied. As an example, only when lossless encoding is applied to the current image, a prediction value for an escape value may be generated using a block vector.
  • information specifying a method of generating a predicted value for an escape value may be signaled through a bitstream.
  • the information may specify at least one of an intra prediction mode and a block vector use mode.
  • the intra prediction mode or block vector of the current block may be derived with reference to a neighboring block adjacent to the current block.
  • the neighboring block may include at least one of an upper neighboring block, a left neighboring block, an upper left neighboring block, an upper right neighboring block, or a lower left neighboring block of the current block.
  • 45 is an example for describing a neighboring block of the current block.
  • RT indicates a pixel located at the upper right of the block
  • LB indicates a pixel located at the bottom left of the block.
  • a block vector candidate list may be constructed by searching for neighboring blocks according to a predefined priority. For example, an upper neighboring block including a pixel at position A, a left neighboring block including a pixel at position L, an upper right neighboring block including a pixel at position e, a lower left neighboring block including a pixel at position i, and position a
  • the neighboring blocks may be searched in the order of the upper left neighboring blocks including the pixel of .
  • a block vector candidate list may be constructed based on the block vector of the searched block.
  • index information specifying one of the plurality of block vector candidates may be encoded and signaled.
  • a block vector of a first found block ie, a first block encoded as a block vector
  • a block vector of the current block may be set as a block vector of the current block.
  • each of the components (eg, unit, module, etc.) constituting the block diagram in the above-described embodiment may be implemented as a hardware device or software, or a plurality of components may be combined to form one hardware device or software. may be implemented.
  • the above-described embodiment may be implemented in the form of program instructions that can be executed through various computer components and recorded in a computer-readable recording medium.
  • the computer-readable recording medium may include program instructions, data files, data structures, etc. alone or in combination.
  • Examples of the computer-readable recording medium include a hard disk, a magnetic medium such as a floppy disk and a magnetic tape, an optical recording medium such as a CD-ROM, a DVD, and a magneto-optical medium such as a floppy disk. media), and hardware devices specially configured to store and execute program instructions, such as ROM, RAM, flash memory, and the like.
  • the hardware device may be configured to operate as one or more software modules to perform processing according to the present disclosure, and vice versa.
  • the present disclosure may be used to encode/decode a video signal.

Abstract

An image decoding method according to the present disclosure may comprise the steps of: determining whether lossless encoding is applied to a current image; decoding residual coefficients for a current block in the current image; and deriving a residual sample on the basis of the residual coefficients.

Description

비디오 신호 처리 방법 및 장치Video signal processing method and apparatus
본 개시는 비디오 신호 처리 방법 및 장치에 관한 것이다.The present disclosure relates to a video signal processing method and apparatus.
최근 HD(High Definition) 영상 및 UHD(Ultra High Definition) 영상과 같은 고해상도, 고품질의 영상에 대한 수요가 다양한 응용 분야에서 증가하고 있다. 영상 데이터가 고해상도, 고품질이 될수록 기존의 영상 데이터에 비해 상대적으로 데이터량이 증가하기 때문에 기존의 유무선 광대역 회선과 같은 매체를 이용하여 영상 데이터를 전송하거나 기존의 저장 매체를 이용해 저장하는 경우, 전송 비용과 저장 비용이 증가하게 된다. 영상 데이터가 고해상도, 고품질화 됨에 따라 발생하는 이러한 문제들을 해결하기 위해서는 고효율의 영상 압축 기술들이 활용될 수 있다.Recently, demand for high-resolution and high-quality images such as HD (High Definition) images and UHD (Ultra High Definition) images is increasing in various application fields. As the image data becomes higher resolution and higher quality, the amount of data increases relative to the existing image data. Therefore, when transmitting image data using a medium such as an existing wired or wireless broadband line or storing it using an existing storage medium, the transmission cost and storage costs will increase. High-efficiency image compression techniques can be used to solve these problems that occur as image data becomes high-resolution and high-quality.
영상 압축 기술로 현재 픽쳐의 이전 또는 이후 픽쳐로부터 현재 픽쳐에 포함된 화소값을 예측하는 화면 간 예측 기술, 현재 픽쳐 내의 화소 정보를 이용하여 현재 픽쳐에 포함된 화소값을 예측하는 인트라 예측 기술, 출현 빈도가 높은 값에 짧은 부호를 할당하고 출현 빈도가 낮은 값에 긴 부호를 할당하는 엔트로피 부호화 기술 등 다양한 기술이 존재하고 이러한 영상 압축 기술을 이용해 영상 데이터를 효과적으로 압축하여 전송 또는 저장할 수 있다.Interprediction technology that predicts pixel values included in the current picture from pictures before or after the current picture as an image compression technology, intra prediction technology that predicts pixel values included in the current picture using pixel information in the current picture, emergence Various technologies exist, such as entropy encoding technology in which a short code is assigned to a value with a high frequency and a long code is allocated to a value with a low frequency of occurrence, and the image data can be effectively compressed and transmitted or stored using these image compression techniques.
한편, 고해상도 영상에 대한 수요가 증가함과 함께, 새로운 영상 서비스로서 입체 영상 컨텐츠에 대한 수요도 함께 증가하고 있다. 고해상도 및 초고해상도의 입체 영상 콘텐츠를 효과적으로 제공하기 위한 비디오 압축 기술에 대하여 논의가 진행되고 있다.Meanwhile, as the demand for high-resolution images increases, the demand for stereoscopic image content as a new image service is also increasing. A video compression technique for effectively providing high-resolution and ultra-high-resolution stereoscopic image content is being discussed.
본 개시는 비디오 신호를 부호화/복호화함에 있어서, 잔차 계수의 효율적으로 부호화/복호화하는 방법 및 장치를 제공하는 것을 목적으로 한다.An object of the present disclosure is to provide a method and apparatus for efficiently encoding/decoding a residual coefficient in encoding/decoding a video signal.
본 개시는 비디오 신호를 부호화/복호화함에 있어서, 무손실 부호화가 적용되는지 여부에 따라, 잔차 계수의 부호화 방법을 적응적으로 결정하는 방법 및 장치를 제공하는 것을 목적으로 한다.An object of the present disclosure is to provide a method and apparatus for adaptively determining an encoding method of a residual coefficient according to whether lossless encoding is applied in encoding/decoding a video signal.
본 개시는 비디오 신호를 부호화/복호화함에 있어서, 팔레트 테이블을 이용한 부호화/복호화 방법 및 장치를 제공하는 것을 목적으로 한다.An object of the present disclosure is to provide an encoding/decoding method and apparatus using a palette table in encoding/decoding a video signal.
본 개시에서 이루고자 하는 기술적 과제들은 이상에서 언급한 기술적 과제들로 제한되지 않으며, 언급하지 않은 또 다른 기술적 과제들은 아래의 기재로부터 본 개시가 속하는 기술분야에서 통상의 지식을 가진 자에게 명확하게 이해될 수 있을 것이다.The technical problems to be achieved in the present disclosure are not limited to the technical problems mentioned above, and other technical problems not mentioned will be clearly understood by those of ordinary skill in the art to which the present disclosure belongs from the description below. will be able
본 개시에 따른 영상 복호화 방법은, 현재 영상에 무손실 부호화가 적용되는지 여부를 결정하는 단계, 상기 현재 영상 내 현재 블록에 대한 잔차 계수를 복호화하는 단계, 및 상기 잔차 계수에 기초하여, 잔차 샘플을 유도하는 단계를 포함할 수 있다. 이때, 상기 잔차 계수 복호화시, 상기 현재 영상에 무손실 부호화가 적용되었는지 여부에 기초하여, 최대 m개의 비교 플래그가 이용되는 제1 방법 및 최대 n개의 비교 플래그가 이용되는 제2 방법 중 하나가 선택되고, 상기 비교 플래그는, 상기 잔차 계수의 절대값이 소정의 값을 초과하는지 여부를 나타낼 수 있다. An image decoding method according to the present disclosure includes the steps of determining whether lossless encoding is applied to a current image, decoding a residual coefficient for a current block in the current image, and deriving a residual sample based on the residual coefficient may include the step of In this case, when decoding the residual coefficient, one of a first method using a maximum of m comparison flags and a second method using a maximum of n comparison flags is selected based on whether lossless encoding is applied to the current image, and , the comparison flag may indicate whether an absolute value of the residual coefficient exceeds a predetermined value.
본 개시에 따른 영상 복호화 방법에 있어서, 문맥 정보를 이용하여 복호화된 빈의 개수와 임계값을 비교하여, 상기 잔차 계수에 대해 적어도 하나의 비교 플래그가 복호화되는지 여부가 결정될 수 있다.In the image decoding method according to the present disclosure, it may be determined whether at least one comparison flag is decoded with respect to the residual coefficient by comparing the number of decoded bins and a threshold value using context information.
본 개시에 따른 영상 복호화 방법에 있어서, 문맥 정보를 이용하여 복호화된 빈의 개수가 상기 임계값 이상인 경우, 상기 비교 플래그 대신 상기 잔차 계수의 절대값을 그대로 나타내는 신택스가 복호화될 수 있다.In the image decoding method according to the present disclosure, when the number of bins decoded using context information is equal to or greater than the threshold value, a syntax indicating the absolute value of the residual coefficient as it is instead of the comparison flag may be decoded.
본 개시에 따른 영상 복호화 방법에 있어서, 상기 비교 플래그 또는 상기 잔차 계수의 절대값이 짝수인지 여부를 나타내는 패리티 플래그 중 적어도 하나가 복호화되는 경우, 상기 문맥 정보를 이용하여 복호화된 빈의 개수가 증가할 수 있다.In the image decoding method according to the present disclosure, when at least one of the comparison flag or a parity flag indicating whether the absolute value of the residual coefficient is an even number is decoded, the number of bins decoded using the context information increases. can
본 개시에 따른 영상 복호화 방법에 있어서, 상기 제1 신택스가 복호화되고, 상기 제1 신택스가 상기 잔차 계수가 0이 아닌 값을 가짐을 나타내는 경우, 상기 잔차 계수의 절대값이 1보다 큰 값을 갖는지 여부를 나타내는 gt_1_flag가 추가 복호화될 수 있다.In the image decoding method according to the present disclosure, when the first syntax is decoded and the first syntax indicates that the residual coefficient has a value other than 0, whether the absolute value of the residual coefficient has a value greater than 1 gt_1_flag indicating whether or not can be further decoded.
본 개시에 따른 영상 복호화 방법에 있어서, 상기 gt_1_flag가 상기 절대값이 1보다 큰 값을 가짐을 나타내는 경우, 상기 절대값이 짝수인지 여부를 나타내는 패리티 플래그 및 상기 절대값이 3보다 큰지 여부를 나타내는 gt_2_flag가 추가 복호화될 수 있다.In the video decoding method according to the present disclosure, when the gt_1_flag indicates that the absolute value has a value greater than 1, a parity flag indicating whether the absolute value is an even number and gt_2_flag indicating whether the absolute value is greater than 3 may be further decoded.
본 개시에 따른 영상 복호화 방법에 있어서, 상기 임계값은 상기 현재 블록의 크기에 기초하여 결정될 수 있다. In the image decoding method according to the present disclosure, the threshold value may be determined based on the size of the current block.
본 개시에 따른 영상 부호화 방법은, 현재 영상에 무손실 부호화가 적용되는지 여부를 결정하는 단계, 현재 블록의 잔차 샘플에 기초하여, 잔차 계수를 유도하는 단계, 및 상기 현재 블록의 상기 잔차 계수를 부호화하는 단계를 포함할 수 있다. 이때, 상기 잔차 계수 부호화시, 상기 현재 영상에 무손실 부호화가 적용되었는지 여부에 기초하여, 최대 m개의 비교 플래그가 이용되는 제1 방법 및 최대 n개의 비교 플래그가 이용되는 제2 방법 중 하나가 선택되고, 상기 비교 플래그는, 상기 잔차 계수의 절대값이 소정의 값을 초과하는지 여부를 나타낼 수 있다. An image encoding method according to the present disclosure includes determining whether lossless encoding is applied to a current image, deriving a residual coefficient based on a residual sample of a current block, and encoding the residual coefficient of the current block may include steps. In this case, when encoding the residual coefficient, one of a first method using a maximum of m comparison flags and a second method using a maximum of n comparison flags is selected based on whether lossless encoding is applied to the current image, , the comparison flag may indicate whether an absolute value of the residual coefficient exceeds a predetermined value.
본 개시에 의하면, 문맥 정보를 이용하여 부호화되는 빈의 개수에 따라, 잔차 계수의 부호화 방법을 상이하게 설정함으로써, 부호화/복호화 효율을 향상시킬 수 있다. According to the present disclosure, encoding/decoding efficiency can be improved by differently setting the encoding method of a residual coefficient according to the number of bins to be encoded using context information.
본 개시에 의하면, 무손실 부호화의 적용 여부에 따라, 잔차 계수의 부호화 방법을 적응적으로 결정함으로써, 부호화/복호화 효율을 향상할 수 있다.According to the present disclosure, coding/decoding efficiency can be improved by adaptively determining a coding method for residual coefficients according to whether lossless coding is applied.
본 개시에 의하면, 팔레트 테이블을 이용함으로써, 부호화/복호화 효율을 향상시킬 수 있다.According to the present disclosure, encoding/decoding efficiency can be improved by using the palette table.
본 개시에서 얻을 수 있는 효과는 이상에서 언급한 효과들로 제한되지 않으며, 언급하지 않은 또 다른 효과들은 아래의 기재로부터 본 개시가 속하는 기술분야에서 통상의 지식을 가진 자에게 명확하게 이해될 수 있을 것이다.Effects obtainable in the present disclosure are not limited to the above-mentioned effects, and other effects not mentioned may be clearly understood by those of ordinary skill in the art to which the present disclosure belongs from the description below. will be.
도 1은 본 개시의 일실시예에 따른 영상 부호화 장치를 나타낸 블록도이다. 1 is a block diagram illustrating an image encoding apparatus according to an embodiment of the present disclosure.
도 2는 본 개시의 일실시예에 따른 영상 복호화 장치를 나타낸 블록도이다.2 is a block diagram illustrating an image decoding apparatus according to an embodiment of the present disclosure.
도 3 및 도 4는 본 개시에 따른 무손실 부호화 방법을 도시한 것이다.3 and 4 illustrate a lossless encoding method according to the present disclosure.
도 5는 본 개시에 따른 인트라 예측 방법을 도시한 것이다.5 illustrates an intra prediction method according to the present disclosure.
도 6은 기-정의된 인트라 예측 모드를 도시한 것이다.6 shows a pre-defined intra prediction mode.
도 7은 본 개시에 따른, 인트라 예측 모드를 부호화하는 방법을 도시한 것이다.7 illustrates a method of encoding an intra prediction mode according to the present disclosure.
도 8은 본 개시에 따른 MPM 후보를 구성하는 방법에 관한 것이다.8 relates to a method of constructing an MPM candidate according to the present disclosure.
도 9는 본 개시에 따른 평면 모드에 기반한 인트라 예측 방법을 도시한 것이다.9 illustrates an intra prediction method based on a planar mode according to the present disclosure.
도 10은 본 개시에 따른 DC 모드에 기반한 인트라 예측 방법을 도시한 것이다.10 illustrates an intra prediction method based on a DC mode according to the present disclosure.
도 11 내지 도 13은 본 개시에 따른 개선된 인트라 예측 방법을 도시한 것이다. 11 to 13 illustrate an improved intra prediction method according to the present disclosure.
도 14는 DPCM의 적용 양상을 설명하기 위한 예시도이다.14 is an exemplary diagram for explaining an application aspect of DPCM.
도 15는 본 개시의 일 실시예에 따른, 지그재그 스캔 적용시 탐색 순서를 나타낸 것이다.15 illustrates a search order when a zigzag scan is applied, according to an embodiment of the present disclosure.
도 16은 부호화기에서 잔차 계수를 부호화하는 과정을 나타낸 흐름도이다.16 is a flowchart illustrating a process of encoding residual coefficients in an encoder.
도 17은 잔차 계수의 크기 정보의 부호화 과정을 나타낸 흐름도이다.17 is a flowchart illustrating a process of encoding size information of residual coefficients.
도 18은 복호화기에서 잔차 계수를 복호화하는 과정을 나타낸 흐름도이다.18 is a flowchart illustrating a process of decoding a residual coefficient in a decoder.
도 19는 잔차 계수의 크기 정보의 복호화 과정을 나타낸 도면이다.19 is a diagram illustrating a decoding process of size information of residual coefficients.
도 20 내지 도 24는 문맥 정보를 이용하는 빈의 개수를 카운팅하는 예를 나타낸 도면이다.20 to 24 are diagrams illustrating examples of counting the number of bins using context information.
도 25 및 도 26은 문맥 정보를 결정하기 위해 참조되는 주변 복원 영역을 나타낸 것이다.25 and 26 show the surrounding restoration area referenced to determine context information.
도 27 내지 도 29는, 본 개시에 따른 팔레트 모드(palette mode)의 개념을 설명하기 위한 도면이다.27 to 29 are diagrams for explaining the concept of the palette mode (palette mode) according to the present disclosure.
도 30은 본 개시에 따른 팔레트 모드(palette mode)에 기반하여 인트라 예측을 수행하는 방법을 도시한 것이다.30 illustrates a method of performing intra prediction based on a palette mode according to the present disclosure.
도 31 및 도 32는 본 개시에 따른 팔레트 테이블을 구성하는 방법을 도시한 것이다.31 and 32 show a method of configuring a pallet table according to the present disclosure.
도 33은 팔레트 엔트리 후보 리스트에 팔레트 엔트리들이 추가되는 예를 나타낸 도면이다.33 is a diagram illustrating an example in which palette entries are added to the palette entry candidate list.
도 34는 부호화기 및 복호화기에서 기 정의된 팔레트 테이블이 이용되는 예를 나타낸다.34 shows an example in which a palette table predefined in an encoder and a decoder is used.
도 35는 본 개시가 적용되는 일실시예로서, 런 렝스 부호화 기반의 바이너리 벡터의 형태로 팔레트 예측 플래그를 시그날링하는 방법을 도시한 것이다.35 is a diagram illustrating a method of signaling a palette prediction flag in the form of a binary vector based on run length encoding as an embodiment to which the present disclosure is applied.
도 36은 본 개시에 따른 스캔 순서에 따라 팔레트 인덱스를 부호화/복호화하는 방법을 도시한 것이다.36 illustrates a method of encoding/decoding a palette index according to a scan order according to the present disclosure.
도 37은 현재 화소의 인접 화소를 설명하기 위한 예시도이다.37 is an exemplary diagram for describing a pixel adjacent to a current pixel.
도 38은 문맥 정보를 이용하여 런 머지 플래그를 부호화하는 예를 나타낸 것이다.38 shows an example of encoding a run merge flag using context information.
도 39는 문맥 정보 인덱스의 범위를 나타낸 예시이다.39 is an example showing the range of the context information index.
도 40은 기 설정된 크기의 영역 단위로 인덱스 관련 정보가 부호화되는 예를 나타낸 것이다.40 shows an example in which index-related information is encoded in units of a region having a preset size.
도 41은 블록간 종속성을 이용하여 인덱스 관련 정보가 부호화되는 예를 나타낸 것이다.41 shows an example in which index-related information is encoded using inter-block dependency.
도 42는 escape 값의 부호화 양상을 설명하기 위한 예시도이다.42 is an exemplary diagram for explaining an encoding aspect of an escape value.
도 43은 인트라 예측 모드에 기초하여, escape 값에 대한 차분값을 유도하는 예를 나타낸다.43 shows an example of deriving a difference value with respect to an escape value based on the intra prediction mode.
도 44는 블록 벡터를 이용하여, escape 값에 대한 차분값을 유도하는 예를 나타낸다.44 shows an example of deriving a difference value with respect to an escape value using a block vector.
도 45은 현재 블록의 이웃 블록을 설명하기 위한 예시이다.45 is an example for describing a neighboring block of the current block.
본 개시는 다양한 변경을 가할 수 있고 여러 가지 실시예를 가질 수 있는 바, 특정 실시예들을 도면에 예시하고 상세한 설명에 상세하게 설명하고자 한다. 그러나, 이는 본 개시를 특정한 실시 형태에 대해 한정하려는 것이 아니며, 본 개시의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다. 각 도면을 설명하면서 유사한 참조부호를 유사한 구성요소에 대해 사용하였다.Since the present disclosure can make various changes and can have various embodiments, specific embodiments are illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the present disclosure to specific embodiments, and it should be understood to include all modifications, equivalents and substitutes included in the spirit and scope of the present disclosure. In describing each figure, like reference numerals have been used for like elements.
제1, 제2 등의 용어는 다양한 구성요소들을 설명하는데 사용될 수 있지만, 상기 구성요소들은 상기 용어들에 의해 한정되어서는 안 된다. 상기 용어들은 하나의 구성요소를 다른 구성요소로부터 구별하는 목적으로만 사용된다. 예를 들어, 본 개시의 권리 범위를 벗어나지 않으면서 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소도 제1 구성요소로 명명될 수 있다. 및/또는 이라는 용어는 복수의 관련된 기재된 항목들의 조합 또는 복수의 관련된 기재된 항목들 중의 어느 항목을 포함한다.Terms such as first, second, etc. may be used to describe various elements, but the elements should not be limited by the terms. The above terms are used only for the purpose of distinguishing one component from another. For example, without departing from the scope of the present disclosure, a first component may be referred to as a second component, and similarly, a second component may also be referred to as a first component. and/or includes a combination of a plurality of related listed items or any of a plurality of related listed items.
어떤 구성요소가 다른 구성요소에 "연결되어" 있다거나 "접속되어"있다고 언급된 때에는, 그 다른 구성요소에 직접적으로 연결되어 있거나 또는 접속되어 있을 수도 있지만, 중간에 다른 구성요소가 존재할 수도 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소가 다른 구성요소에 "직접 연결되어"있다거나 "직접 접속되어"있다고 언급된 때에는, 중간에 다른 구성요소가 존재하지 않는 것으로 이해되어야 할 것이다.When a component is referred to as being “connected” or “connected” to another component, it is understood that the other component may be directly connected or connected to the other component, but other components may exist in between. it should be On the other hand, when it is mentioned that a certain element is "directly connected" or "directly connected" to another element, it should be understood that no other element is present in the middle.
본 출원에서 사용한 용어는 단지 특정한 실시예를 설명하기 위해 사용된 것으로, 본 개시를 한정하려는 의도가 아니다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다. 본 출원에서, "포함하다" 또는 "가지다" 등의 용어는 명세서상에 기재된 특징, 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것이 존재함을 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.The terms used in the present application are used only to describe specific embodiments, and are not intended to limit the present disclosure. The singular expression includes the plural expression unless the context clearly dictates otherwise. In the present application, terms such as “comprise” or “have” are intended to designate that a feature, number, step, operation, component, part, or combination thereof described in the specification exists, but one or more other features It should be understood that this does not preclude the existence or addition of numbers, steps, operations, components, parts, or combinations thereof.
이하, 첨부한 도면들을 참조하여, 본 개시의 바람직한 실시예를 보다 상세하게 설명하고자 한다. 이하, 도면상의 동일한 구성요소에 대해서는 동일한 참조부호를 사용하고 동일한 구성요소에 대해서 중복된 설명은 생략한다.Hereinafter, preferred embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings. Hereinafter, the same reference numerals are used for the same components in the drawings, and repeated descriptions of the same components are omitted.
도 1은 본 개시의 일실시예에 따른 영상 부호화 장치를 나타낸 블록도이다. 1 is a block diagram illustrating an image encoding apparatus according to an embodiment of the present disclosure.
도 1을 참조하면, 영상 부호화 장치(100)는 픽쳐 분할부(110), 예측부(120, 125), 변환부(130), 양자화부(135), 재정렬부(160), 엔트로피 부호화부(165), 역양자화부(140), 역변환부(145), 필터부(150) 및 메모리(155)를 포함할 수 있다.Referring to FIG. 1 , the image encoding apparatus 100 includes a picture division unit 110 , prediction units 120 and 125 , a transform unit 130 , a quantization unit 135 , a rearrangement unit 160 , and an entropy encoding unit ( 165 ), an inverse quantization unit 140 , an inverse transform unit 145 , a filter unit 150 , and a memory 155 .
도 1에 나타난 각 구성부들은 영상 부호화 장치에서 서로 다른 특징적인 기능들을 나타내기 위해 독립적으로 도시한 것으로, 각 구성부들이 분리된 하드웨어나 하나의 소프트웨어 구성단위로 이루어짐을 의미하지 않는다. 즉, 각 구성부는 설명의 편의상 각각의 구성부로 나열하여 포함한 것으로 각 구성부 중 적어도 두 개의 구성부가 합쳐져 하나의 구성부로 이루어지거나, 하나의 구성부가 복수개의 구성부로 나뉘어져 기능을 수행할 수 있고 이러한 각 구성부의 통합된 실시예 및 분리된 실시예도 본 개시의 본질에서 벗어나지 않는 한 본 개시의 권리범위에 포함된다.Each of the constituent units shown in FIG. 1 is independently illustrated to represent different characteristic functions in the image encoding apparatus, and does not mean that each constituent unit is composed of separate hardware or one software constituent unit. That is, each component is listed as each component for convenience of description, and at least two components of each component are combined to form one component, or one component can be divided into a plurality of components to perform a function, and each of these components Integrated embodiments and separate embodiments of the components are also included in the scope of the present disclosure without departing from the essence of the present disclosure.
또한, 일부의 구성 요소는 본 개시에서 본질적인 기능을 수행하는 필수적인 구성 요소는 아니고 단지 성능을 향상시키기 위한 선택적 구성 요소일 수 있다. 본 개시는 단지 성능 향상을 위해 사용되는 구성 요소를 제외한 본 개시의 본질을 구현하는데 필수적인 구성부만을 포함하여 구현될 수 있고, 단지 성능 향상을 위해 사용되는 선택적 구성 요소를 제외한 필수 구성 요소만을 포함한 구조도 본 개시의 권리범위에 포함된다.In addition, some components are not essential components to perform an essential function in the present disclosure, but may be optional components for merely improving performance. The present disclosure may be implemented by including only essential components to implement the essence of the present disclosure, except for components used for performance improvement, and a structure including only essential components excluding optional components used for performance improvement Also included in the scope of the present disclosure.
픽쳐 분할부(110)는 입력된 픽쳐를 적어도 하나의 처리 단위로 분할할 수 있다. 이때, 처리 단위는 예측 단위(Prediction Unit: PU)일 수도 있고, 변환 단위(Transform Unit: TU)일 수도 있으며, 부호화 단위(Coding Unit: CU)일 수도 있다. 픽쳐 분할부(110)에서는 하나의 픽쳐에 대해 복수의 부호화 단위, 예측 단위 및 변환 단위의 조합으로 분할하고 소정의 기준(예를 들어, 비용 함수)으로 하나의 부호화 단위, 예측 단위 및 변환 단위 조합을 선택하여 픽쳐를 부호화 할 수 있다.The picture divider 110 may divide the input picture into at least one processing unit. In this case, the processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). The picture splitter 110 divides one picture into a combination of a plurality of coding units, prediction units, and transformation units, and combines one coding unit, prediction unit, and transformation unit based on a predetermined criterion (eg, a cost function). can be selected to encode the picture.
예를 들어, 하나의 픽쳐는 복수개의 부호화 단위로 분할될 수 있다. 픽쳐에서 부호화 단위를 분할하기 위해서는 쿼드 트리 구조(Quad Tree Structure)와 같은 재귀적인 트리 구조를 사용할 수 있는데 하나의 영상 또는 최대 크기 부호화 단위(largest coding unit)를 루트로 하여 다른 부호화 단위로 분할되는 부호화 유닛은 분할된 부호화 단위의 개수만큼의 자식 노드를 가지고 분할될 수 있다. 일정한 제한에 따라 더 이상 분할되지 않는 부호화 단위는 리프 노드가 된다. 즉, 하나의 코딩 유닛에 대하여 정방형 분할만이 가능하다고 가정하는 경우, 하나의 부호화 단위는 최대 4개의 다른 부호화 단위로 분할될 수 있다.For example, one picture may be divided into a plurality of coding units. In order to split a coding unit in a picture, a recursive tree structure such as a quad tree structure can be used. A coding in which one image or a largest coding unit is used as a root and is divided into other coding units. A unit may be divided having as many child nodes as the number of divided coding units. A coding unit that is no longer split according to certain restrictions becomes a leaf node. That is, when it is assumed that only square splitting is possible for one coding unit, one coding unit may be split into up to four different coding units.
이하, 본 개시의 실시예에서는 부호화 단위는 부호화를 수행하는 단위의 의미로 사용할 수도 있고, 복호화를 수행하는 단위의 의미로 사용할 수도 있다.Hereinafter, in an embodiment of the present disclosure, a coding unit may be used as a unit for performing encoding or may be used as a meaning for a unit for performing decoding.
예측 단위는 하나의 부호화 단위 내에서 동일한 크기의 적어도 하나의 정사각형 또는 직사각형 등의 형태를 가지고 분할된 것일 수도 있고, 하나의 부호화 단위 내에서 분할된 예측 단위 중 어느 하나의 예측 단위가 다른 하나의 예측 단위와 상이한 형태 및/또는 크기를 가지도록 분할된 것일 수도 있다.A prediction unit may be split in the form of at least one square or rectangle of the same size within one coding unit, and one prediction unit among the split prediction units within one coding unit is a prediction of another. It may be divided to have a shape and/or size different from that of the unit.
부호화 단위를 기초로 인트라 예측을 수행하는 예측 단위를 생성시 최소 부호화 단위가 아닌 경우, 복수의 예측 단위 NxN으로 분할하지 않고 인트라 예측을 수행할 수 있다.When a prediction unit for performing intra prediction based on a coding unit is generated, if it is not the smallest coding unit, intra prediction may be performed without dividing the prediction unit into a plurality of prediction units NxN.
예측부(120, 125)는 인터 예측을 수행하는 인터 예측부(120)와 인트라 예측을 수행하는 인트라 예측부(125)를 포함할 수 있다. 예측 단위에 대해 인터 예측을 사용할 것인지 또는 인트라 예측을 수행할 것인지를 결정하고, 각 예측 방법에 따른 구체적인 정보(예컨대, 인트라 예측 모드, 모션 벡터, 참조 픽쳐 등)를 결정할 수 있다. 이때, 예측이 수행되는 처리 단위와 예측 방법 및 구체적인 내용이 정해지는 처리 단위는 다를 수 있다. 예컨대, 예측의 방법과 예측 모드 등은 예측 단위로 결정되고, 예측의 수행은 변환 단위로 수행될 수도 있다. 생성된 예측 블록과 원본 블록 사이의 잔차값(잔차 블록)은 변환부(130)로 입력될 수 있다. 또한, 예측을 위해 사용한 예측 모드 정보, 모션 벡터 정보 등은 잔차값과 함께 엔트로피 부호화부(165)에서 부호화되어 복호화 장치에 전달될 수 있다. 특정한 부호화 모드를 사용할 경우, 예측부(120, 125)를 통해 예측 블록을 생성하지 않고, 원본 블록을 그대로 부호화하여 복호화부에 전송하는 것도 가능하다.The prediction units 120 and 125 may include an inter prediction unit 120 performing inter prediction and an intra prediction unit 125 performing intra prediction. Whether to use inter prediction or to perform intra prediction for a prediction unit may be determined, and specific information (eg, intra prediction mode, motion vector, reference picture, etc.) according to each prediction method may be determined. In this case, a processing unit in which prediction is performed and a processing unit in which a prediction method and specific content are determined may be different. For example, a prediction method and a prediction mode may be determined in a prediction unit, and prediction may be performed in a transformation unit. A residual value (residual block) between the generated prediction block and the original block may be input to the transform unit 130 . Also, prediction mode information, motion vector information, etc. used for prediction may be encoded by the entropy encoder 165 together with the residual value and transmitted to the decoding apparatus. When a specific encoding mode is used, it is also possible to encode the original block as it is without generating the prediction block through the prediction units 120 and 125 and transmit it to the decoder.
인터 예측부(120)는 현재 픽쳐의 이전 픽쳐 또는 이후 픽쳐 중 적어도 하나의 픽쳐의 정보를 기초로 예측 단위를 예측할 수도 있고, 경우에 따라서는 현재 픽쳐 내의 부호화가 완료된 일부 영역의 정보를 기초로 예측 단위를 예측할 수도 있다. 인터 예측부(120)는 참조 픽쳐 보간부, 모션 예측부, 움직임 보상부를 포함할 수 있다. The inter prediction unit 120 may predict a prediction unit based on information on at least one of a picture before or after a picture of the current picture, and in some cases, prediction based on information of a partial region in the current picture that has been encoded Units can also be predicted. The inter prediction unit 120 may include a reference picture interpolator, a motion prediction unit, and a motion compensator.
참조 픽쳐 보간부에서는 메모리(155)로부터 참조 픽쳐 정보를 제공받고 참조 픽쳐에서 정수 화소 이하의 화소 정보를 생성할 수 있다. 휘도 화소의 경우, 1/4 화소 단위로 정수 화소 이하의 화소 정보를 생성하기 위해 필터 계수를 달리하는 DCT 기반의 8탭 보간 필터(DCT-based Interpolation Filter)가 사용될 수 있다. 색차 신호의 경우 1/8 화소 단위로 정수 화소 이하의 화소 정보를 생성하기 위해 필터 계수를 달리하는 DCT 기반의 4탭 보간 필터(DCT-based Interpolation Filter)가 사용될 수 있다.The reference picture interpolator may receive reference picture information from the memory 155 and generate pixel information of integer pixels or less in the reference picture. In the case of luminance pixels, a DCT-based 8-tap interpolation filter (DCT-based Interpolation Filter) with different filter coefficients may be used to generate pixel information of integer pixels or less in units of 1/4 pixels. In the case of the color difference signal, a DCT-based 4-tap interpolation filter in which filter coefficients are different to generate pixel information of integer pixels or less in units of 1/8 pixels may be used.
모션 예측부는 참조 픽쳐 보간부에 의해 보간된 참조 픽쳐를 기초로 모션 예측을 수행할 수 있다. 모션 벡터를 산출하기 위한 방법으로 FBMA(Full search-based Block Matching Algorithm), TSS(Three Step Search), NTS(New Three-Step Search Algorithm) 등 다양한 방법이 사용될 수 있다. 모션 벡터는 보간된 화소를 기초로 1/2 또는 1/4 화소 단위의 모션 벡터값을 가질 수 있다. 모션 예측부에서는 모션 예측 방법을 다르게 하여 현재 예측 단위를 예측할 수 있다. 모션 예측 방법으로 스킵(Skip) 방법, 머지(Merge) 방법, AMVP(Advanced Motion Vector Prediction) 방법, 인트라 블록 카피(Intra Block Copy) 방법 등 다양한 방법이 사용될 수 있다.The motion prediction unit may perform motion prediction based on the reference picture interpolated by the reference picture interpolator. As a method for calculating the motion vector, various methods such as Full search-based Block Matching Algorithm (FBMA), Three Step Search (TSS), and New Three-Step Search Algorithm (NTS) may be used. The motion vector may have a motion vector value of 1/2 or 1/4 pixel unit based on the interpolated pixel. The motion prediction unit may predict the current prediction unit by using a different motion prediction method. Various methods, such as a skip method, a merge method, an AMVP (Advanced Motion Vector Prediction) method, an intra block copy method, etc., may be used as the motion prediction method.
인트라 예측부(125)는 현재 픽쳐 내의 화소 정보인 현재 블록 주변의 참조 픽셀 정보를 기초로 예측 단위를 생성할 수 있다. 현재 예측 단위의 주변 블록이 인터 예측을 수행한 블록이어서, 참조 픽셀이 인터 예측을 수행한 픽셀일 경우, 인터 예측을 수행한 블록에 포함되는 참조 픽셀을 주변의 인트라 예측을 수행한 블록의 참조 픽셀 정보로 대체하여 사용할 수 있다. 즉, 참조 픽셀이 가용하지 않는 경우, 가용하지 않은 참조 픽셀 정보를 가용한 참조 픽셀 중 적어도 하나의 참조 픽셀로 대체하여 사용할 수 있다.The intra prediction unit 125 may generate a prediction unit based on reference pixel information around the current block, which is pixel information in the current picture. When a neighboring block of the current prediction unit is a block on which inter prediction is performed, and thus a reference pixel is a pixel on which inter prediction is performed, a reference pixel included in the block on which inter prediction is performed is a reference pixel of the block on which intra prediction has been performed. information can be used instead. That is, when the reference pixel is not available, the unavailable reference pixel information may be replaced with at least one reference pixel among the available reference pixels.
인트라 예측에서 예측 모드는 참조 픽셀 정보를 예측 방향에 따라 사용하는 방향성 예측 모드와 예측을 수행시 방향성 정보를 사용하지 않는 비방향성 모드를 가질 수 있다. 휘도 정보를 예측하기 위한 모드와 색차 정보를 예측하기 위한 모드가 상이할 수 있고, 색차 정보를 예측하기 위해 휘도 정보를 예측하기 위해 사용된 인트라 예측 모드 정보 또는 예측된 휘도 신호 정보를 활용할 수 있다.In intra prediction, the prediction mode may have a directional prediction mode that uses reference pixel information according to a prediction direction and a non-directional mode that does not use directional information when prediction is performed. A mode for predicting luminance information and a mode for predicting chrominance information may be different, and intra prediction mode information used for predicting luminance information or predicted luminance signal information may be utilized to predict chrominance information.
인트라 예측을 수행할 때 예측 단위의 크기와 변환 단위의 크기가 동일할 경우, 예측 단위의 좌측에 존재하는 픽셀, 좌측 상단에 존재하는 픽셀, 상단에 존재하는 픽셀을 기초로 예측 단위에 대한 인트라 예측을 수행할 수 있다. 그러나 인트라 예측을 수행할 때 예측 단위의 크기와 변환 단위의 크기가 상이할 경우, 변환 단위를 기초로 한 참조 픽셀을 이용하여 인트라 예측을 수행할 수 있다. 또한, 최소 부호화 단위에 대해서만 NxN 분할을 사용하는 인트라 예측을 사용할 수 있다.When intra prediction is performed, if the size of the prediction unit and the size of the transformation unit are the same, intra prediction for the prediction unit based on the pixel present on the left side, the pixel present on the upper left side, and the pixel present on the upper side of the prediction unit can be performed. However, when the size of the prediction unit is different from the size of the transformation unit when performing intra prediction, intra prediction may be performed using a reference pixel based on the transformation unit. In addition, intra prediction using NxN splitting may be used only for the smallest coding unit.
인트라 예측 방법은 예측 모드에 따라 참조 화소에 AIS(Adaptive Intra Smoothing) 필터를 적용한 후 예측 블록을 생성할 수 있다. 참조 화소에 적용되는 AIS 필터의 종류는 상이할 수 있다. 인트라 예측 방법을 수행하기 위해 현재 예측 단위의 인트라 예측 모드는 현재 예측 단위의 주변에 존재하는 예측 단위의 인트라 예측 모드로부터 예측할 수 있다. 주변 예측 단위로부터 예측된 모드 정보를 이용하여 현재 예측 단위의 예측 모드를 예측하는 경우, 현재 예측 단위와 주변 예측 단위의 인트라 예측 모드가 동일하면 소정의 플래그 정보를 이용하여 현재 예측 단위와 주변 예측 단위의 예측 모드가 동일하다는 정보를 전송할 수 있고, 만약 현재 예측 단위와 주변 예측 단위의 예측 모드가 상이하면 엔트로피 부호화를 수행하여 현재 블록의 예측 모드 정보를 부호화할 수 있다.The intra prediction method may generate a prediction block after applying an adaptive intra smoothing (AIS) filter to a reference pixel according to a prediction mode. The type of AIS filter applied to the reference pixel may be different. In order to perform the intra prediction method, the intra prediction mode of the current prediction unit may be predicted from the intra prediction mode of the prediction unit existing around the current prediction unit. When the prediction mode of the current prediction unit is predicted using the mode information predicted from the neighboring prediction unit, if the intra prediction mode of the current prediction unit and the neighboring prediction unit are the same, the current prediction unit and the neighboring prediction unit are used using predetermined flag information It is possible to transmit information that the prediction modes of . , and if the prediction modes of the current prediction unit and the neighboring prediction units are different from each other, entropy encoding may be performed to encode prediction mode information of the current block.
또한, 예측부(120, 125)에서 생성된 예측 단위를 기초로 예측을 수행한 예측 단위와 예측 단위의 원본 블록과 차이값인 잔차값(Residual) 정보를 포함하는 잔차 블록이 생성될 수 있다. 생성된 잔차 블록은 변환부(130)로 입력될 수 있다. In addition, a residual block including residual information, which is a difference value between a prediction unit and an original block of the prediction unit, in which prediction is performed based on the prediction unit generated by the prediction units 120 and 125 may be generated. The generated residual block may be input to the transform unit 130 .
변환부(130)에서는 원본 블록과 예측부(120, 125)를 통해 생성된 예측 단위의 잔차값(residual)정보를 포함한 잔차 블록을 DCT(Discrete Cosine Transform), DST(Discrete Sine Transform), KLT와 같은 변환 방법을 사용하여 변환시킬 수 있다. 잔차 블록을 변환하기 위해 DCT를 적용할지, DST를 적용할지 또는 KLT를 적용할지는 잔차 블록을 생성하기 위해 사용된 예측 단위의 인트라 예측 모드 정보를 기초로 결정할 수 있다. The transform unit 130 converts the original block and the residual block including residual information of the prediction unit generated by the prediction units 120 and 125 to DCT (Discrete Cosine Transform), DST (Discrete Sine Transform), KLT and It can be converted using the same conversion method. Whether to apply DCT, DST, or KLT to transform the residual block may be determined based on intra prediction mode information of a prediction unit used to generate the residual block.
양자화부(135)는 변환부(130)에서 주파수 영역으로 변환된 값들을 양자화할 수 있다. 블록에 따라 또는 영상의 중요도에 따라 양자화 계수는 변할 수 있다. 양자화부(135)에서 산출된 값은 역양자화부(140)와 재정렬부(160)에 제공될 수 있다.The quantizer 135 may quantize the values transformed by the transform unit 130 into the frequency domain. The quantization coefficient may change according to blocks or the importance of an image. The value calculated by the quantization unit 135 may be provided to the inverse quantization unit 140 and the rearrangement unit 160 .
재정렬부(160)는 양자화된 잔차값에 대해 계수값의 재정렬을 수행할 수 있다.The rearrangement unit 160 may rearrange the coefficient values on the quantized residual values.
재정렬부(160)는 계수 스캐닝(Coefficient Scanning) 방법을 통해 2차원의 블록 형태 계수를 1차원의 벡터 형태로 변경할 수 있다. 예를 들어, 재정렬부(160)에서는 지그-재그 스캔(Zig-Zag Scan)방법을 이용하여 DC 계수부터 고주파수 영역의 계수까지 스캔하여 1차원 벡터 형태로 변경시킬 수 있다. 변환 단위의 크기 및 인트라 예측 모드에 따라 지그-재그 스캔 대신 2차원의 블록 형태 계수를 열 방향으로 스캔하는 수직 스캔, 2차원의 블록 형태 계수를 행 방향으로 스캔하는 수평 스캔이 사용될 수도 있다. 즉, 변환 단위의 크기 및 인트라 예측 모드에 따라 지그-재그 스캔, 수직 방향 스캔 및 수평 방향 스캔 중 어떠한 스캔 방법이 사용될지 여부를 결정할 수 있다.The reordering unit 160 may change the two-dimensional block form coefficient into a one-dimensional vector form through a coefficient scanning method. For example, the rearranging unit 160 may use a Zig-Zag Scan method to scan from DC coefficients to coefficients in a high-frequency region and change them into a one-dimensional vector form. A vertical scan that scans a two-dimensional block shape coefficient in a column direction and a horizontal scan that scans a two-dimensional block shape coefficient in a row direction may be used instead of a zig-zag scan according to a size of a transform unit and an intra prediction mode. That is, it may be determined whether any of the zig-zag scan, the vertical scan, and the horizontal scan is used according to the size of the transform unit and the intra prediction mode.
엔트로피 부호화부(165)는 재정렬부(160)에 의해 산출된 값들을 기초로 엔트로피 부호화를 수행할 수 있다. 엔트로피 부호화는 예를 들어, 지수 골롬(Exponential Golomb), CAVLC(Context-Adaptive Variable Length Coding), CABAC(Context-Adaptive Binary Arithmetic Coding)과 같은 다양한 부호화 방법을 사용할 수 있다. The entropy encoding unit 165 may perform entropy encoding based on the values calculated by the reordering unit 160 . For entropy encoding, various encoding methods such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC) may be used.
엔트로피 부호화부(165)는 재정렬부(160) 및 예측부(120, 125)로부터 부호화 단위의 잔차값 계수 정보 및 블록 타입 정보, 예측 모드 정보, 분할 단위 정보, 예측 단위 정보 및 전송 단위 정보, 모션 벡터 정보, 참조 프레임 정보, 블록의 보간 정보, 필터링 정보 등 다양한 정보를 부호화할 수 있다. The entropy encoding unit 165 receives the residual value coefficient information and block type information, prediction mode information, division unit information, prediction unit information and transmission unit information, motion of the coding unit from the reordering unit 160 and the prediction units 120 and 125 . Various information such as vector information, reference frame information, interpolation information of a block, and filtering information may be encoded.
엔트로피 부호화부(165)에서는 재정렬부(160)에서 입력된 부호화 단위의 계수값을 엔트로피 부호화할 수 있다.The entropy encoder 165 may entropy-encode the coefficient values of the coding units input from the reordering unit 160 .
역양자화부(140) 및 역변환부(145)에서는 양자화부(135)에서 양자화된 값들을 역양자화하고 변환부(130)에서 변환된 값들을 역변환한다. 역양자화부(140) 및 역변환부(145)에서 생성된 잔차값(Residual)은 예측부(120, 125)에 포함된 움직임 추정부, 움직임 보상부 및 인트라 예측부를 통해서 예측된 예측 단위와 합쳐져 복원 블록(Reconstructed Block)을 생성할 수 있다. The inverse quantizer 140 and the inverse transform unit 145 inversely quantize the values quantized by the quantizer 135 and inversely transform the values transformed by the transform unit 130 . The residual values generated by the inverse quantizer 140 and the inverse transform unit 145 are combined with the prediction units predicted through the motion estimation unit, the motion compensator, and the intra prediction unit included in the prediction units 120 and 125 and restored. You can create a Reconstructed Block.
필터부(150)는 디블록킹 필터, 오프셋 보정부, ALF(Adaptive Loop Filter)중 적어도 하나를 포함할 수 있다.The filter unit 150 may include at least one of a deblocking filter, an offset correcting unit, and an adaptive loop filter (ALF).
디블록킹 필터는 복원된 픽쳐에서 블록 간의 경계로 인해 생긴 블록 왜곡을 제거할 수 있다. 디블록킹을 수행할지 여부를 판단하기 위해 블록에 포함된 몇 개의 열 또는 행에 포함된 픽셀을 기초로 현재 블록에 디블록킹 필터 적용할지 여부를 판단할 수 있다. 블록에 디블록킹 필터를 적용하는 경우 필요한 디블록킹 필터링 강도에 따라 강한 필터(Strong Filter) 또는 약한 필터(Weak Filter)를 적용할 수 있다. 또한 디블록킹 필터를 적용함에 있어 수직 필터링 및 수평 필터링 수행시 수평 방향 필터링 및 수직 방향 필터링이 병행 처리되도록 할 수 있다.The deblocking filter may remove block distortion caused by the boundary between blocks in the reconstructed picture. In order to determine whether to perform deblocking, it may be determined whether to apply the deblocking filter to the current block based on pixels included in several columns or rows included in the block. When a deblocking filter is applied to a block, a strong filter or a weak filter can be applied according to the required deblocking filtering strength. In addition, in applying the deblocking filter, horizontal filtering and vertical filtering may be concurrently processed when performing vertical filtering and horizontal filtering.
오프셋 보정부는 디블록킹을 수행한 영상에 대해 픽셀 단위로 원본 영상과의 오프셋을 보정할 수 있다. 특정 픽쳐에 대한 오프셋 보정을 수행하기 위해 영상에 포함된 픽셀을 일정한 수의 영역으로 구분한 후 오프셋을 수행할 영역을 결정하고 해당 영역에 오프셋을 적용하는 방법 또는 각 픽셀의 에지 정보를 고려하여 오프셋을 적용하는 방법을 사용할 수 있다.The offset corrector may correct the offset of the deblocked image with respect to the original image in units of pixels. In order to perform offset correction on a specific picture, a method of dividing pixels included in an image into a certain number of regions, determining the region to be offset and applying the offset to the region, or taking edge information of each pixel into consideration can be used to apply
ALF(Adaptive Loop Filtering)는 필터링한 복원 영상과 원래의 영상을 비교한 값을 기초로 수행될 수 있다. 영상에 포함된 픽셀을 소정의 그룹으로 나눈 후 해당 그룹에 적용될 하나의 필터를 결정하여 그룹마다 차별적으로 필터링을 수행할 수 있다. ALF를 적용할지 여부에 관련된 정보는 휘도 신호는 부호화 단위(Coding Unit, CU) 별로 전송될 수 있고, 각각의 블록에 따라 적용될 ALF 필터의 모양 및 필터 계수는 달라질 수 있다. 또한, 적용 대상 블록의 특성에 상관없이 동일한 형태(고정된 형태)의 ALF 필터가 적용될 수도 있다. Adaptive loop filtering (ALF) may be performed based on a value obtained by comparing the filtered reconstructed image and the original image. After dividing the pixels included in the image into a predetermined group, one filter to be applied to the corresponding group is determined, and filtering can be performed differentially for each group. As for information on whether to apply ALF, the luminance signal may be transmitted for each coding unit (CU), and the shape and filter coefficients of the ALF filter to be applied may vary according to each block. In addition, the ALF filter of the same type (fixed type) may be applied regardless of the characteristics of the target block.
메모리(155)는 필터부(150)를 통해 산출된 복원 블록 또는 픽쳐를 저장할 수 있고, 저장된 복원 블록 또는 픽쳐는 인터 예측을 수행 시 예측부(120, 125)에 제공될 수 있다.The memory 155 may store the reconstructed block or picture calculated through the filter unit 150 , and the stored reconstructed block or picture may be provided to the predictors 120 and 125 when inter prediction is performed.
도 2는 본 개시의 일실시예에 따른 영상 복호화 장치를 나타낸 블록도이다.2 is a block diagram illustrating an image decoding apparatus according to an embodiment of the present disclosure.
도 2를 참조하면, 영상 복호화 장치(200)는 엔트로피 복호화부(210), 재정렬부(215), 역양자화부(220), 역변환부(225), 예측부(230, 235), 필터부(240), 메모리(245)가 포함될 수 있다.Referring to FIG. 2 , the image decoding apparatus 200 includes an entropy decoding unit 210, a reordering unit 215, an inverse quantization unit 220, an inverse transform unit 225, prediction units 230 and 235, and a filter unit ( 240) and a memory 245 may be included.
영상 부호화 장치에서 영상 비트스트림이 입력된 경우, 입력된 비트스트림은 영상 부호화 장치와 반대의 절차로 복호화될 수 있다.When an image bitstream is input by the image encoding apparatus, the input bitstream may be decoded by a procedure opposite to that of the image encoding apparatus.
엔트로피 복호화부(210)는 영상 부호화 장치의 엔트로피 부호화부에서 엔트로피 부호화를 수행한 것과 반대의 절차로 엔트로피 복호화를 수행할 수 있다. 예를 들어, 영상 부호화 장치에서 수행된 방법에 대응하여 지수 골롬(Exponential Golomb), CAVLC(Context-Adaptive Variable Length Coding), CABAC(Context-Adaptive Binary Arithmetic Coding)과 같은 다양한 방법이 적용될 수 있다. The entropy decoding unit 210 may perform entropy decoding in a procedure opposite to that performed by the entropy encoding unit of the image encoding apparatus. For example, various methods such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC) may be applied corresponding to the method performed by the image encoding apparatus.
엔트로피 복호화부(210)에서는 부호화 장치에서 수행된 인트라 예측 및 인터 예측에 관련된 정보를 복호화할 수 있다.The entropy decoding unit 210 may decode information related to intra prediction and inter prediction performed by the encoding apparatus.
재정렬부(215)는 엔트로피 복호화부(210)에서 엔트로피 복호화된 비트스트림을 부호화부에서 재정렬한 방법을 기초로 재정렬을 수행할 수 있다. 1차원 벡터 형태로 표현된 계수들을 다시 2차원의 블록 형태의 계수로 복원하여 재정렬할 수 있다. 재정렬부(215)에서는 부호화부에서 수행된 계수 스캐닝에 관련된 정보를 제공받고 해당 부호화부에서 수행된 스캐닝 순서에 기초하여 역으로 스캐닝하는 방법을 통해 재정렬을 수행할 수 있다.The reordering unit 215 may perform reordering based on a method of rearranging the entropy-decoded bitstream by the entropy decoding unit 210 by the encoder. Coefficients expressed in the form of a one-dimensional vector may be restored and rearranged as coefficients in the form of a two-dimensional block. The reordering unit 215 may receive information related to coefficient scanning performed by the encoder and perform the reordering by performing a reverse scanning method based on the scanning order performed by the corresponding encoder.
역양자화부(220)는 부호화 장치에서 제공된 양자화 파라미터와 재정렬된 블록의 계수값을 기초로 역양자화를 수행할 수 있다. The inverse quantization unit 220 may perform inverse quantization based on the quantization parameter provided by the encoding apparatus and the reordered coefficient values of the blocks.
역변환부(225)는 영상 부호화 장치에서 수행한 양자화 결과에 대해 변환부에서 수행한 변환 즉, DCT, DST, 및 KLT에 대해 역변환 즉, 역 DCT, 역 DST 및 역 KLT를 수행할 수 있다. 역변환은 영상 부호화 장치에서 결정된 전송 단위를 기초로 수행될 수 있다. 영상 복호화 장치의 역변환부(225)에서는 예측 방법, 현재 블록의 크기 및 예측 방향 등 복수의 정보에 따라 변환 기법(예를 들어, DCT, DST, KLT)이 선택적으로 수행될 수 있다.The inverse transform unit 225 may perform inverse transforms, ie, inverse DCT, inverse DST, and inverse KLT, on the transforms performed by the transform unit, ie, DCT, DST, and KLT, on the quantization result performed by the image encoding apparatus. Inverse transform may be performed based on a transmission unit determined by the image encoding apparatus. The inverse transform unit 225 of the image decoding apparatus may selectively perform a transformation technique (eg, DCT, DST, KLT) according to a plurality of pieces of information such as a prediction method, a size of a current block, and a prediction direction.
예측부(230, 235)는 엔트로피 복호화부(210)에서 제공된 예측 블록 생성 관련 정보와 메모리(245)에서 제공된 이전에 복호화된 블록 또는 픽쳐 정보를 기초로 예측 블록을 생성할 수 있다. The prediction units 230 and 235 may generate a prediction block based on the prediction block generation related information provided from the entropy decoding unit 210 and previously decoded block or picture information provided from the memory 245 .
전술한 바와 같이 영상 부호화 장치에서의 동작과 동일하게 인트라 예측을 수행시 예측 단위의 크기와 변환 단위의 크기가 동일할 경우, 예측 단위의 좌측에 존재하는 픽셀, 좌측 상단에 존재하는 픽셀, 상단에 존재하는 픽셀을 기초로 예측 단위에 대한 인트라 예측을 수행하지만, 인트라 예측을 수행시 예측 단위의 크기와 변환 단위의 크기가 상이할 경우, 변환 단위를 기초로 한 참조 픽셀을 이용하여 인트라 예측을 수행할 수 있다. 또한, 최소 부호화 단위에 대해서만 NxN 분할을 사용하는 인트라 예측을 사용할 수도 있다.As described above, when intra prediction is performed in the same manner as in the operation in the image encoding apparatus, when the size of the prediction unit and the size of the transformation unit are the same, the pixel present on the left side of the prediction unit, the pixel present on the upper left side, and the upper Intra prediction is performed on the prediction unit based on the existing pixel, but when the size of the prediction unit and the size of the transformation unit are different when performing intra prediction, intra prediction is performed using the reference pixel based on the transformation unit can do. Also, intra prediction using NxN splitting may be used only for the smallest coding unit.
예측부(230, 235)는 예측 단위 판별부, 인터 예측부 및 인트라 예측부를 포함할 수 있다. 예측 단위 판별부는 엔트로피 복호화부(210)에서 입력되는 예측 단위 정보, 인트라 예측 방법의 예측 모드 정보, 인터 예측 방법의 모션 예측 관련 정보 등 다양한 정보를 입력 받고 현재 부호화 단위에서 예측 단위를 구분하고, 예측 단위가 인터 예측을 수행하는지 아니면 인트라 예측을 수행하는지 여부를 판별할 수 있다. 인터 예측부(230)는 영상 부호화 장치에서 제공된 현재 예측 단위의 인터 예측에 필요한 정보를 이용해 현재 예측 단위가 포함된 현재 픽쳐의 이전 픽쳐 또는 이후 픽쳐 중 적어도 하나의 픽쳐에 포함된 정보를 기초로 현재 예측 단위에 대한 인터 예측을 수행할 수 있다. 또는, 현재 예측 단위가 포함된 현재 픽쳐 내에서 기-복원된 일부 영역의 정보를 기초로 인터 예측을 수행할 수도 있다.The prediction units 230 and 235 may include a prediction unit determiner, an inter prediction unit, and an intra prediction unit. The prediction unit determining unit receives various information such as prediction unit information input from the entropy decoder 210, prediction mode information of the intra prediction method, and motion prediction related information of the inter prediction method, and divides the prediction unit from the current coding unit, and predicts It may be determined whether the unit performs inter prediction or intra prediction. The inter prediction unit 230 uses information required for inter prediction of the current prediction unit provided from the image encoding apparatus based on information included in at least one of a picture before or after the current picture including the current prediction unit. Inter prediction may be performed on the prediction unit. Alternatively, inter prediction may be performed based on information of a pre-restored partial region in the current picture including the current prediction unit.
인터 예측을 수행하기 위해 부호화 단위를 기준으로 해당 부호화 단위에 포함된 예측 단위의 모션 예측 방법이 스킵 모드(Skip Mode), 머지 모드(Merge 모드), AMVP 모드(AMVP Mode), 인트라 블록 카피 모드 중 어떠한 방법인지 여부를 판단할 수 있다.In order to perform inter prediction, a motion prediction method of a prediction unit included in a corresponding coding unit based on a coding unit is selected from among skip mode, merge mode, AMVP mode, and intra block copy mode. You can decide which way to go.
인트라 예측부(235)는 현재 픽쳐 내의 화소 정보를 기초로 예측 블록을 생성할 수 있다. 예측 단위가 인트라 예측을 수행한 예측 단위인 경우, 영상 부호화 장치에서 제공된 예측 단위의 인트라 예측 모드 정보를 기초로 인트라 예측을 수행할 수 있다. 인트라 예측부(235)에는 AIS(Adaptive Intra Smoothing) 필터, 참조 화소 보간부, DC 필터를 포함할 수 있다. AIS 필터는 현재 블록의 참조 화소에 필터링을 수행하는 부분으로써 현재 예측 단위의 예측 모드에 따라 필터의 적용 여부를 결정하여 적용할 수 있다. 영상 부호화 장치에서 제공된 예측 단위의 예측 모드 및 AIS 필터 정보를 이용하여 현재 블록의 참조 화소에 AIS 필터링을 수행할 수 있다. 현재 블록의 예측 모드가 AIS 필터링을 수행하지 않는 모드일 경우, AIS 필터는 적용되지 않을 수 있다.The intra prediction unit 235 may generate a prediction block based on pixel information in the current picture. When the prediction unit is a prediction unit on which intra prediction is performed, intra prediction may be performed based on intra prediction mode information of the prediction unit provided by the image encoding apparatus. The intra prediction unit 235 may include an Adaptive Intra Smoothing (AIS) filter, a reference pixel interpolator, and a DC filter. The AIS filter is a part that performs filtering on the reference pixel of the current block, and may be applied by determining whether to apply the filter according to the prediction mode of the current prediction unit. AIS filtering may be performed on the reference pixel of the current block by using the prediction mode and AIS filter information of the prediction unit provided by the image encoding apparatus. When the prediction mode of the current block is a mode in which AIS filtering is not performed, the AIS filter may not be applied.
참조 화소 보간부는 예측 단위의 예측 모드가 참조 화소를 보간한 화소값을 기초로 인트라 예측을 수행하는 예측 단위일 경우, 참조 화소를 보간하여 정수값 이하의 화소 단위의 참조 화소를 생성할 수 있다. 현재 예측 단위의 예측 모드가 참조 화소를 보간하지 않고 예측 블록을 생성하는 예측 모드일 경우 참조 화소는 보간되지 않을 수 있다. DC 필터는 현재 블록의 예측 모드가 DC 모드일 경우 필터링을 통해서 예측 블록을 생성할 수 있다.When the prediction mode of the prediction unit is a prediction unit in which intra prediction is performed based on a pixel value obtained by interpolating the reference pixel, the reference pixel interpolator may interpolate the reference pixel to generate a reference pixel of a pixel unit having an integer value or less. When the prediction mode of the current prediction unit is a prediction mode that generates a prediction block without interpolating the reference pixel, the reference pixel may not be interpolated. The DC filter may generate the prediction block through filtering when the prediction mode of the current block is the DC mode.
복원된 블록 또는 픽쳐는 필터부(240)로 제공될 수 있다. 필터부(240)는 디블록킹 필터, 오프셋 보정부, ALF를 포함할 수 있다.The reconstructed block or picture may be provided to the filter unit 240 . The filter unit 240 may include a deblocking filter, an offset correction unit, and an ALF.
영상 부호화 장치로부터 해당 블록 또는 픽쳐에 디블록킹 필터를 적용하였는지 여부에 대한 정보 및 디블록킹 필터를 적용하였을 경우, 강한 필터를 적용하였는지 또는 약한 필터를 적용하였는지에 대한 정보를 제공받을 수 있다. 영상 복호화 장치의 디블록킹 필터에서는 영상 부호화 장치에서 제공된 디블록킹 필터 관련 정보를 제공받고 영상 복호화 장치에서 해당 블록에 대한 디블록킹 필터링을 수행할 수 있다. Information on whether a deblocking filter is applied to a corresponding block or picture and information on whether a strong filter or a weak filter is applied when the deblocking filter is applied may be provided from the image encoding apparatus. The deblocking filter of the image decoding apparatus may receive deblocking filter-related information provided from the image encoding apparatus, and the image decoding apparatus may perform deblocking filtering on the corresponding block.
오프셋 보정부는 부호화시 영상에 적용된 오프셋 보정의 종류 및 오프셋 값 정보 등을 기초로 복원된 영상에 오프셋 보정을 수행할 수 있다.The offset correction unit may perform offset correction on the reconstructed image based on the type of offset correction applied to the image during encoding, information on the offset value, and the like.
ALF는 부호화 장치로부터 제공된 ALF 적용 여부 정보, ALF 계수 정보 등을 기초로 부호화 단위에 적용될 수 있다. 이러한 ALF 정보는 특정한 파라메터 셋에 포함되어 제공될 수 있다.ALF may be applied to a coding unit based on information on whether ALF is applied, ALF coefficient information, etc. provided from the encoding apparatus. Such ALF information may be provided by being included in a specific parameter set.
메모리(245)는 복원된 픽쳐 또는 블록을 저장하여 참조 픽쳐 또는 참조 블록으로 사용할 수 있도록 할 수 있고 또한 복원된 픽쳐를 출력부로 제공할 수 있다. The memory 245 may store the reconstructed picture or block to be used as a reference picture or reference block, and may also provide the reconstructed picture to an output unit.
전술한 바와 같이 이하, 본 개시의 실시예에서는 설명의 편의상 코딩 유닛(Coding Unit)을 부호화 단위라는 용어로 사용하지만, 부호화 뿐만 아니라 복호화를 수행하는 단위가 될 수도 있다.As described above, hereinafter, in the embodiments of the present disclosure, a coding unit is used as a term for a coding unit for convenience of description, but it may also be a unit for performing decoding as well as coding.
또한, 현재 블록은, 부호화/복호화 대상 블록을 나타내는 것으로, 부호화/복호화 단계에 따라, 코딩 트리 블록(또는 코딩 트리 유닛), 부호화 블록(또는 부호화 유닛), 변환 블록(또는 변환 유닛) 또는 예측 블록(또는 예측 유닛) 등을 나타내는 것일 수 있다. 본 명세서에서, '유닛'은 특정 부호화/복호화 프로세스를 수행하기 위한 기본 단위를 나타내고, '블록'은 소정 크기의 화소 어레이를 나타낼 수 있다. 별도의 구분이 없는 한, '블록'과 '유닛'은 동등한 의미로 사용될 수 있다. 예컨대, 후술되는 실시예에서, 부호화 블록(코딩 블록) 및 부호화 유닛(코딩 유닛)은 상호 동등한 의미인 것으로 이해될 수 있다.In addition, the current block denotes an encoding/decoding target block, and depending on the encoding/decoding step, a coding tree block (or coding tree unit), a coding block (or a coding unit), a transform block (or a transform unit), or a prediction block (or prediction unit) and the like. In this specification, a 'unit' may indicate a basic unit for performing a specific encoding/decoding process, and a 'block' may indicate a pixel array of a predetermined size. Unless otherwise specified, 'block' and 'unit' may be used interchangeably. For example, in the embodiments to be described below, it may be understood that the coding block (coding block) and the coding unit (coding unit) are mutually equivalent.
도 3 및 도 4는 본 개시에 따른 무손실 부호화 방법을 도시한 것이다.3 and 4 illustrate a lossless encoding method according to the present disclosure.
영상 압축은 크게 손실 부호화와 무손실 부호화로 분류될 수 있다. 두 부호화 간 가장 큰 차이점은 양자화 과정의 유무이다. 손실 부호화에서는 양자화 과정을 통해 비손실 부호화 대비 큰 압축 효율을 얻을 수 있지만, 데이터의 손실이 발생할 수 있다. 무손실 부호화에서는 원본 데이터를 그대로 유지할 수 있지만, 손실 부호화 대비 압축 효율이 떨어진다.Image compression can be broadly classified into lossy coding and lossless coding. The biggest difference between the two encodings is the presence or absence of a quantization process. In lossy coding, greater compression efficiency than lossless coding can be obtained through a quantization process, but data loss may occur. In lossless encoding, the original data can be maintained as it is, but compression efficiency is lower than in lossy encoding.
도 1에서 살펴본 부호화 과정들 중에서, 양자화 및 인루프 필터링 과정을 이용함에 따라, 원본 데이터와는 다른 복원 데이터가 생성(즉, 손실이 발생)될 수 있다. 따라서, 무손실 부호화(lossless coding)에서는 양자화 과정 및 인루프 필터링 과정을 생략(skip)할 수 있다. 이때, 양자화 과정이 생략된다면, 잔차 데이터를 주파수 도메인 성분들로 변환하는 변환 과정이 무의미해지므로, 무손실 부호화 적용시 변환 과정을 더 생략할 수 있다. Among the encoding processes illustrated in FIG. 1 , by using the quantization and in-loop filtering processes, reconstructed data different from the original data may be generated (ie, loss occurs). Accordingly, in lossless coding, a quantization process and an in-loop filtering process may be skipped. In this case, if the quantization process is omitted, the transform process for transforming the residual data into frequency domain components becomes meaningless, so that the transform process can be further omitted when lossless encoding is applied.
손실 부호화 및 무손실 부호화의 과정들이 상이한 바, 무손실 부호화의 적용 여부를 알려주는 정보를 복호화기로 전송하여야 한다. 일 예로, 상위 헤더(SPS, PPS 또는 슬라이스 헤더 등)를 통해 무손실 부호화의 수행 여부를 나타내는 정보를 부호화할 수 있다. 상위 헤더에서 1비트 정보(플래그)를 이용하여 무손실 부호화가 수행되었다는 것을 표시하였다면, 복호화기에서는 상기 1비트 정보를 이용하여 무손실 부호화가 수행되었다는 것을 판단한다. 무손실 부호화가 수행된 것으로 판단된 경우, 복호화기는 양자화 및 인루프 필터링 과정을 생략하고, 영상을 복호화할 수 있다. Since the processes of lossless encoding and lossless encoding are different, information indicating whether lossless encoding is applied must be transmitted to the decoder. For example, information indicating whether lossless encoding is performed may be encoded through an upper header (eg, SPS, PPS, or slice header). If the upper header indicates that lossless encoding has been performed using 1-bit information (flag), the decoder determines that lossless encoding has been performed using the 1-bit information. When it is determined that lossless encoding has been performed, the decoder may omit the quantization and in-loop filtering processes and decode the image.
일 예로, 무손실 부호화의 사용 여부를 결정하기 위한 변수 lossless_coding를 결정하기 위한 플래그가 비트스트림을 통해 시그날링될 수 있다. 변수 lossless_coding의 값이 true인 것은, 무손실 부호화가 적용됨을 나타내고, 변수 lossless_coding의 값이 false인 것은, 무손실 부호화가 적용되지 않음을 나타낸다.As an example, a flag for determining a variable lossless_coding for determining whether to use lossless encoding may be signaled through a bitstream. A value of the variable lossless_coding being true indicates that lossless encoding is applied, and a value of the variable lossless_coding being false indicates that lossless encoding is not applied.
변환, 양자화, 디블로킹 필터, SAO 또는 ALF의 사용 여부를 알려주는 변수들을 t_skip, q_skip, d_skip, s_skip, a_skip이라 정의할 수 있다. 상기 변수들의 값이 true인 것은 대응되는 코딩 과정이 생략됨을 나타내고, 상기 변수들의 값이 false인 것은 대응되는 코딩 과정이 생략되지 않음을 나타낸다.Variables indicating whether transform, quantization, deblocking filter, SAO, or ALF are used may be defined as t_skip, q_skip, d_skip, s_skip, and a_skip. A value of true of the variables indicates that a corresponding coding process is omitted, and a value of false indicates that a corresponding coding process is not omitted.
변수 lossless_coding의 값에 따라, 상기 변수들의 값을 결정하기 위한 플래그가 비트스트림을 통해 시그날링되는지 여부가 결정될 수 있다. 일 예로, 변수 lossless_coding의 값이 true인 경우, 변수 t_skip, q_skip, d_skip, s_skip, a_skip를 결정하기 위한 플래그의 시그날링이 생략될 수 있다. 부호화가 생략된 변수들은 기-정의된 값으로 추정될 수 있다. 기-정의된 값은 true일 수 있다. lossless_coding의 값이 true인 경우, 변수 t_skip, q_skip, d_skip, s_skip, a_skip들의 값과는 무관하게, 변환, 양자화 디블로킹 필터, SAO, ALF의 적용이 스킵될 수 있다.According to the value of the variable lossless_coding, it may be determined whether a flag for determining the values of the variables is signaled through the bitstream. For example, when the value of the variable lossless_coding is true, signaling of a flag for determining the variables t_skip, q_skip, d_skip, s_skip, and a_skip may be omitted. Variables whose encoding is omitted may be estimated as pre-defined values. A pre-defined value may be true. When the value of lossless_coding is true, application of the transform, quantization deblocking filter, SAO, and ALF may be skipped regardless of the values of the variables t_skip, q_skip, d_skip, s_skip, and a_skip.
변수 lossless_coding의 값이 false인 경우, t_skip, q_skip, d_skip, s_skip, a_skip 변수를 결정하기 위한 플래그를 복호화할 수 있다. 각 변수의 값이 true인지 또는 false인지 여부에 기초하여, 대응하는 코딩 과정의 스킵 여부를 결정할 수 있다. When the value of the variable lossless_coding is false, flags for determining variables t_skip, q_skip, d_skip, s_skip, and a_skip may be decoded. Based on whether the value of each variable is true or false, it is possible to determine whether to skip the corresponding coding process.
도 3을 참조하면, lossless_coding의 값이 false인 경우, t_skip, q_skip, d_skip, s_skip, a_skip 중 적어도 하나는 true로 설정될 수 있다. 이에 따라, 제1 변수를 제외한 나머지 변수들의 값이 false인 경우, 제1 변수의 값을 결정하기 위한 플래그의 시그날링을 생략하고, 제1 변수의 값을 true로 설정할 수 있다. 일 예로, t_skip, q_skip, d_skip, s_skip의 값이 false인 경우, a_skip을 결정하기 위한 플래그의 부호화를 생략하고, 변수 a_skip을 true로 설정할 수 있다.Referring to FIG. 3 , when the value of lossless_coding is false, at least one of t_skip, q_skip, d_skip, s_skip, and a_skip may be set to true. Accordingly, when values of variables other than the first variable are false, signaling of a flag for determining the value of the first variable may be omitted and the value of the first variable may be set to true. For example, when values of t_skip, q_skip, d_skip, and s_skip are false, encoding of a flag for determining a_skip may be omitted and the variable a_skip may be set to true.
또는, 변수 lossless_coding의 값을 결정하기 위한 플래그를 시그날링하는 대신, lossless_coding을 내부 변수로 정의할 수 있다. 내부 변수 lossless_coding의 값은, 변수 t_skip, q_skip, d_skip, s_skip, a_skip에 기초하여 결정될 수 있다. Alternatively, instead of signaling a flag for determining the value of the variable lossless_coding, lossless_coding may be defined as an internal variable. The value of the internal variable lossless_coding may be determined based on the variables t_skip, q_skip, d_skip, s_skip, and a_skip.
도 4를 참조하면, 변수 t_skip, q_skip, d_skip, s_skip, a_skip 각각의 값을 결정하기 위한 플래그가 비트스트림을 통해 시그날링될 수 있다. 이때, 변수, t_skip, q_skip, d_skip, s_skip, a_skip의 값이 모두 true인 경우, 변수 lossless_coding이 true로 설정될 수 있다. 반면, t_skip, q_skip, d_skip, s_skip, a_skip 중 적어도 하나가 false인 경우, 변수 lossless_coding이 false로 결정될 수 있다.Referring to FIG. 4 , a flag for determining a value of each of variables t_skip, q_skip, d_skip, s_skip, and a_skip may be signaled through a bitstream. In this case, when the values of the variables, t_skip, q_skip, d_skip, s_skip, and a_skip are all true, the variable lossless_coding may be set to true. On the other hand, when at least one of t_skip, q_skip, d_skip, s_skip, and a_skip is false, the variable lossless_coding may be determined to be false.
그런 다음, 블록 단위로 무손실 부호화와 관련된 내부 변수를 정의할 수 있다. 이 변수를 blk_lossless_coding이라 정의 할 때, blk_lossless_coding의 값을 도 3 또는 도 4에서 설정된 변수 lossless_coding의 값으로 설정할 수 있다. Then, it is possible to define internal variables related to lossless coding in units of blocks. When this variable is defined as blk_lossless_coding, the value of blk_lossless_coding may be set to the value of the variable lossless_coding set in FIG. 3 or FIG. 4 .
혹은 lossless_coding이 true로 설정된 경우, 블록마다 blk_lossless_coding를 부호화하여, 블록 단위로 무손실 부호화의 수행 여부를 결정할 수도 있다. Alternatively, when lossless_coding is set to true, blk_lossless_coding may be encoded for each block to determine whether lossless encoding is performed on a block-by-block basis.
위 예시에서는 설명의 편의성을 위해 변환, 양자화, 디블로킹 필터, SAO, ALF에 대해서만 예를 들었지만, joint_CbCr 부호화 방법과 LMCS(luma mapping with chroma scaling)과 같은, 무손실 부호화를 불가능하게 하는 모든 기술들에 대해 전술한 방식이 동일/유사하게 적용될 수 있다.In the above example, for convenience of explanation, only transform, quantization, deblocking filter, SAO, and ALF are given as examples, but for all techniques that make lossless coding impossible, such as the joint_CbCr coding method and LMCS (luma mapping with chroma scaling), The above-described method may be applied in the same/similar manner.
도 5는 본 개시에 따른 인트라 예측 방법을 도시한 것이다.5 illustrates an intra prediction method according to the present disclosure.
도 5를 참조하면, 현재 부호화/복호화되는 블록(이하, 현재 블록이라 함)의 인트라 예측을 위한 참조 화소 라인을 결정할 수 있다(S500).Referring to FIG. 5 , a reference pixel line for intra prediction of a currently encoded/decoded block (hereinafter, referred to as a current block) may be determined ( S500 ).
본 개시에 따른 참조 화소 라인은, 현재 블록에 인접한 주변 블록에 속할 수 있다. 상기 주변 블록은 좌측 블록, 상단 블록, 좌상단 블록, 좌하단 블록, 우상단 블록, 우측 블록, 우하단 블록, 또는 하단 블록 중 적어도 하나를 포함할 수 있다. 또한, 참조 화소 라인은, 현재 블록과 동일한 픽쳐에 속하나, 현재 블록에 인접하지 않은 공간적 블록에 속할 수도 있고, 현재 블록과는 다른 픽쳐에 속한 시간적 블록에 속할 수도 있다. 여기서, 시간적 블록은, 전술한 현재 블록의 주변 블록과 동일 위치의 블록일 수 있다.The reference pixel line according to the present disclosure may belong to a neighboring block adjacent to the current block. The neighboring block may include at least one of a left block, an upper block, an upper left block, a lower left block, an upper right block, a right block, a lower right block, and a lower block. Also, the reference pixel line may belong to a spatial block belonging to the same picture as the current block but not adjacent to the current block, or may belong to a temporal block belonging to a picture different from the current block. Here, the temporal block may be a block in the same position as a neighboring block of the aforementioned current block.
상기 참조 화소 라인은, 현재 블록 이전에 기-부호화/복호화된 블록에만 속하도록 제한될 수도 있고, 현재 블록 이후에 부호화/복호화되는 블록에 속할 수도 있다. 이 경우 별도의 패딩 과정이 수반될 수도 있고, 이에 대해서는 후술하도록 한다.The reference pixel line may be limited to belong only to a block pre-encoded/decoded before the current block, or may belong to a block encoded/decoded after the current block. In this case, a separate padding process may be involved, which will be described later.
상기 참조 화소 라인은, 복수의 참조 화소 라인 후보 중 어느 하나로 결정될 수 있다. 복수의 참조 화소 라인 후보는, 현재 블록에 인접한 제1 참조 화소 라인, 상기 제1 참조 화소 라인에 인접한 제2 참조 화소 라인, …, 상기 제(n-1) 참조 화소 라인에 인접한 제n 참조 화소 라인 중 적어도 하나를 포함할 수 있다. 여기서, n은 2, 3, 4, 또는 그 이상의 정수일 수 있다.The reference pixel line may be determined as any one of a plurality of reference pixel line candidates. The plurality of reference pixel line candidates include a first reference pixel line adjacent to the current block, a second reference pixel line adjacent to the first reference pixel line, . , at least one of an n-th reference pixel line adjacent to the (n-1)-th reference pixel line. Here, n may be an integer of 2, 3, 4, or more.
일 예로, 복수의 참조 화소 라인 후보는, 제1 내지 제4 참조 화소 라인으로 구성될 수도 있고, 제1 내지 제3 참조 화소 라인만으로 구성되거나, 제1 및 제3 참조 화소 라인만으로 구성될 수도 있다. For example, the plurality of reference pixel line candidates may include first to fourth reference pixel lines, only first to third reference pixel lines, or only first and third reference pixel lines. .
전술한 제1 내지 제n 참조 화소 라인 중 어느 하나가 선택적으로 이용될 수 있으며, 이를 위해 참조 화소 라인의 위치를 특정하기 위한 정보가 이용될 수 있다. 상기 정보는 부호화 장치에서 시그날링될 수도 있고, 소정의 부호화 파라미터에 기반하여 복호화 장치에서 유도될 수도 있다. 상기 부호화 파라미터는, 블록의 크기, 형태, 위치, 성분 타입(Y/Cb/Cr), 예측 모드(intra/inter), 인트라 예측 모드, 또는 비방향성 모드인지 여부 중 적어도 하나를 포함할 수 있다. 여기서, 블록은, 현재 블록 및/또는 주변 블록을 의미할 수도 있고, 코딩 블록, 예측 블록 및/또는 변환 블록을 의미할 수도 있다. 또한, 현재 블록이 이용 가능한 참조 화소 라인 후보의 개수도 전술한 부호화 파라미터에 기초하여 가변적으로 결정될 수도 있고, 상기 개수를 특정하기 위한 정보가 별도로 시그날링될 수도 있다. Any one of the above-described first to nth reference pixel lines may be selectively used, and for this purpose, information for specifying a position of the reference pixel line may be used. The information may be signaled by the encoding apparatus or may be derived from the decoding apparatus based on a predetermined encoding parameter. The encoding parameter may include at least one of a block size, a shape, a position, a component type (Y/Cb/Cr), a prediction mode (intra/inter), an intra prediction mode, or a non-directional mode. Here, a block may mean a current block and/or a neighboring block, or a coding block, a prediction block, and/or a transform block. Also, the number of reference pixel line candidates available for the current block may be variably determined based on the above-described encoding parameter, and information for specifying the number may be separately signaled.
도 5를 참조하면, 현재 블록의 인트라 예측 모드를 결정할 수 있다(S510).Referring to FIG. 5 , an intra prediction mode of the current block may be determined ( S510 ).
현재 블록의 인트라 예측 모드는, 부호화/복호화 장치에 기-정의된 인트라 예측 모드들 중 어느 하나로 결정될 수 있다. 상기 기-정의된 인트라 예측 모드는, 도 6에 도시된 바와 같이, 2개의 비방향성 모드와 65개의 방향성 모드로 구성될 수 있다.The intra prediction mode of the current block may be determined as any one of intra prediction modes pre-defined in the encoding/decoding apparatus. The pre-defined intra prediction mode may be composed of two non-directional modes and 65 directional modes, as shown in FIG. 6 .
방향성 모드는, 평면 모드(Planar mode) 또는 DC 모드 중 적어도 하나를 포함하고, 비방향성 모드는, 소정의 각도/방향성을 가진 모드(e.g., 수직 모드, 수평 모드, 대각석 모드 등)를 포함할 수 있다.The directional mode includes at least one of a planar mode or a DC mode, and the non-directional mode includes a mode (eg, vertical mode, horizontal mode, diagonal mode, etc.) having a predetermined angle/direction. can
인트라 예측 모드를 결정하는 방법에 대해서는 도 7 및 도 8을 참조하여 자세히 살펴보도록 한다.A method of determining the intra prediction mode will be described in detail with reference to FIGS. 7 and 8 .
도 5를 참조하면, 상기 결정된 참조 화소 라인과 인트라 예측 모드에 기반하여, 현재 블록의 인트라 예측을 수행할 수 있다(S520).Referring to FIG. 5 , intra prediction of the current block may be performed based on the determined reference pixel line and the intra prediction mode ( S520 ).
즉, 참조 화소 라인의 화소 중 상기 결정된 인트라 예측 모드에 대응하는 화소가 참조 화소로 특정되고, 특정된 참조 화소를 이용하여 인트라 예측이 수행될 수 있다. That is, a pixel corresponding to the determined intra prediction mode among pixels of the reference pixel line may be specified as a reference pixel, and intra prediction may be performed using the specified reference pixel.
도 7은 본 개시에 따른, 인트라 예측 모드를 부호화하는 방법을 도시한 것이다.7 illustrates a method of encoding an intra prediction mode according to the present disclosure.
우선, 현재 블록이 예측 모드가 인트라 모드인 경우, 현재 블록의 인트라 예측을 위한 참조 화소 라인 인덱스를 부호화할 수 있다. 여기서, 참조 화소 라인 인덱스는 전술한 참조 화소 라인의 위치를 특정하기 위한 정보일 수 있고, 블록 단위로 부호화될 수 있다.First, when the prediction mode of the current block is the intra mode, the reference pixel line index for intra prediction of the current block may be encoded. Here, the reference pixel line index may be information for specifying the position of the aforementioned reference pixel line, and may be encoded in units of blocks.
참조 화소 라인 인덱스에 의해 제1 참조 화소 라인이 선택된 경우, MPM 플래그를 부호화할 수 있다. 여기서, MPM 플래그는, 현재 블록의 인트라 예측 모드가 MPM에 기반하여 결정되는지 여부를 나타낼 수 있다.When the first reference pixel line is selected by the reference pixel line index, the MPM flag may be encoded. Here, the MPM flag may indicate whether the intra prediction mode of the current block is determined based on the MPM.
만일, MPM 플래그가 true라면, 평면 모드가 사용되는지 여부를 알려주는 평면 모드 플래그를 부호화할 수 있다.If the MPM flag is true, a plane mode flag indicating whether the plane mode is used may be coded.
MPM으로 평면 모드가 사용되는 경우, 인트라 예측 모드의 부호화 과정을 종료한다. 만약 평면 모드가 사용되지 않은 경우, 현재 블록에 사용된 인트라 예측 모드와 동일한 MPM 후보를 특정하는 인덱스를 부호화할 수 있다.When the planar mode is used as the MPM, the encoding process of the intra prediction mode is terminated. If the planar mode is not used, an index specifying the same MPM candidate as the intra prediction mode used for the current block may be encoded.
만약, 참조 화소 라인 인덱스에 의해 인접 참조 화소 라인(즉, 제1 참조 화소 라인)이 아닌 비인접 참조 화소 라인(즉, 제2 참조 화소 라인, 제3 참조 화소 라인 등)이 선택된 경우, MPM 플래그의 부호화를 생략하고, MPM 플래그의 값을 true로 설정할 수 있다. 즉, MPM 플래그의 부호화없이 MPM 인덱스를 부호화할 수 있다. If a non-adjacent reference pixel line (ie, a second reference pixel line, a third reference pixel line, etc.) rather than an adjacent reference pixel line (ie, the first reference pixel line) is selected by the reference pixel line index, the MPM flag may be omitted and the value of the MPM flag may be set to true. That is, it is possible to encode the MPM index without encoding the MPM flag.
한편, MPM 플래그가 false라면, 부호화 장치에 기-정의된 인트라 예측 모드들 중에서 MPM 후보를 제외한 나머지 모드 중 하나를 부호화할 수 있다.Meanwhile, if the MPM flag is false, one of the remaining modes except for the MPM candidate among intra prediction modes pre-defined in the encoding apparatus may be encoded.
복호화 관점에서 살펴보면, 현재 블록의 인트라 예측을 위한 참조 화소 라인 인덱스를 복호화할 수 있다. 참조 화소 라인 인덱스에 의해 제1 참조 화소 라인이 선택된 경우, MPM 플래그를 복호화할 수 있다. From a decoding point of view, the reference pixel line index for intra prediction of the current block may be decoded. When the first reference pixel line is selected by the reference pixel line index, the MPM flag may be decoded.
만일, MPM 플래그가 true라면, 평면 모드가 사용되는지 여부를 알려주는 평면 모드 플래그를 복호화할 수 있다. 평면 모드 플래그가 true인 경우, 현재 블록의 인트라 예측 모드는 평면 모드로 설정될 수 있고, 평면 모드 플래그가 false인 경우, 현재 블록에 사용된 인트라 예측 모드와 동일한 MPM 후보를 특정하는 MPM 인덱스를 복호화할 수 있다. 기-구성된 MPM 후보와 상기 복호화된 MPM 인덱스에 기초하여 현재 블록의 인트라 예측 모드를 결정할 수 있다. 상기 MPM 후보를 구성하는 방법에 대해서는 도 8을 참조하여 자세히 살펴보도록 한다.If the MPM flag is true, the plane mode flag indicating whether the plane mode is used may be decoded. When the plane mode flag is true, the intra prediction mode of the current block may be set to the planar mode. When the plane mode flag is false, the MPM index specifying the same MPM candidate as the intra prediction mode used for the current block is decoded. can do. The intra prediction mode of the current block may be determined based on the pre-configured MPM candidate and the decoded MPM index. A method of configuring the MPM candidate will be described in detail with reference to FIG. 8 .
만약, 참조 화소 라인 인덱스에 의해 비인접 참조 화소 라인(즉, 제2 참조 화소 라인, 제3 참조 화소 라인 등)이 선택된 경우, MPM 플래그의 복호화를 생략하고, MPM 플래그의 값을 true로 설정할 수 있다. 즉, MPM 플래그의 복호화없이 MPM 인덱스를 복호화할 수 있다. 기-구성된 MPM 후보와 상기 복호화된 MPM 인덱스에 기초하여 현재 블록의 인트라 예측 모드를 결정할 수 있다. If a non-adjacent reference pixel line (ie, a second reference pixel line, a third reference pixel line, etc.) is selected by the reference pixel line index, decoding of the MPM flag may be omitted and the value of the MPM flag may be set to true. have. That is, the MPM index can be decoded without decoding the MPM flag. The intra prediction mode of the current block may be determined based on the pre-configured MPM candidate and the decoded MPM index.
한편, MPM 플래그가 false라면, 복호화 장치에 기-정의된 인트라 예측 모드들 중에서 평면 모드 및 기-구성된 MPM 후보를 제외한 나머지 모드 중 하나를 특정하는 나머지 모드 정보를 복호화할 수 있다. 복호화된 나머지 모드 정보에 의해 특정된 모드가 현재 블록의 인트라 예측 모드로 설정될 수 있다.On the other hand, if the MPM flag is false, the remaining mode information specifying one of the remaining modes except for the planar mode and the pre-configured MPM candidate among intra prediction modes pre-defined in the decoding apparatus may be decoded. The mode specified by the decoded remaining mode information may be set as the intra prediction mode of the current block.
도 8은 본 개시에 따른 MPM 후보를 구성하는 방법에 관한 것이다.8 relates to a method of constructing an MPM candidate according to the present disclosure.
인트라 예측 모드를 부호화/복호화하기 위해, 현재 블록의 주변 블록에서 사용된 인트라 예측 모드를 이용하여 MPM 후보를 구성할 수 있다. 현재 블록의 인트라 예측 모드가 MPM 후보 리스트에 포함된 MPM 후보와 동일하다면, MPM 인덱스를 이용하여, 현재 블록의 인트라 예측 모드와 동일한 MPM 후보를 특정할 수 있다. 만약 현재 블록의 인트라 예측 모드와 동일한 MPM 후보가 존재하지 않는다면 MPM 후보들을 제외하고 남은 인트라 예측 모드들의 인덱스를 재 할당한 후 현재 블록의 인트라 예측 모드를 부호화/복호화할 수 있다. 설명의 편의성을 위해, MPM 후보 리스트가 포함하는 MPM 후보의 개수는 5라고 가정한다. In order to encode/decode the intra prediction mode, an MPM candidate may be constructed using an intra prediction mode used in a neighboring block of the current block. If the intra prediction mode of the current block is the same as the MPM candidate included in the MPM candidate list, the same MPM candidate as the intra prediction mode of the current block may be specified using the MPM index. If the same MPM candidate as the intra prediction mode of the current block does not exist, the intra prediction mode of the current block may be encoded/decoded after reassigning indexes of the remaining intra prediction modes except for the MPM candidates. For convenience of description, it is assumed that the number of MPM candidates included in the MPM candidate list is 5.
우선 현재 블록의 주변 블록에서 사용된 인트라 예측 모드를 가져온다. 여기서, 주변 블록은, 상단 이웃 블록, 좌측 이웃 블록, 좌상단 이웃 블록, 우상단 이웃 블록 또는 좌하단 이웃 블록 중 적어도 하나를 포함할 수 있다. First, the intra prediction mode used in the neighboring block of the current block is brought. Here, the neighboring block may include at least one of an upper neighboring block, a left neighboring block, an upper left neighboring block, an upper right neighboring block, or a lower left neighboring block.
도 8은 주변 블록의 위치를 나타내는 예시이다. 도 8을 참조하면, LB는 블록 내에서 가장 왼쪽 아래에 위치한 화소를 의미하고, RT는 블록 내에서 가장 오른쪽 위에 위치한 화소를 의미한다. L은 LB의 바로 왼쪽에 존재하는 복원 화소의 위치를 의미하고, A는 RT의 바로 위쪽에 존재하는 복원 화소의 위치를 의미한다. 현재 블록의 MPM 후보를 구성하기 위해, 현재 블록의 왼쪽에 존재하는 복원 블록에서 사용된 인트라 예측 모드와 현재 블록의 위쪽에 존재하는 복원 블록에서 사용된 인트라 예측 모드를 이용할 수 있다. 이때, 왼쪽에 존재하는 복원 블록은 L을 포함하고 있는 블록이며, 위쪽에 존재하는 복원 블록은 A를 포함하고 있는 블록을 의미한다. 또는, 좌측 중간에 위치하는 복원 화소(g 또는 h)을 포함하는 복원 블록, 또는 상단 중간에 위치하는 복원 화소(c 또는 d)을 포함하는 블록으로부터 MPM 후보를 유도할 수도 있다.8 is an example showing the location of a neighboring block. Referring to FIG. 8 , LB denotes a pixel located at the lower left of the block, and RT denotes a pixel located at the upper right of the block. L denotes a position of a restored pixel that exists immediately to the left of LB, and A denotes a position of a restored pixel that exists immediately above RT. In order to construct an MPM candidate of the current block, an intra prediction mode used in a reconstructed block existing to the left of the current block and an intra prediction mode used in a reconstructed block existing above the current block may be used. In this case, the reconstructed block existing on the left is a block including L, and the reconstructed block existing above is a block including A. Alternatively, an MPM candidate may be derived from a reconstructed block including a reconstructed pixel (g or h) positioned in the middle left or a block including a reconstructed pixel (c or d) positioned in the upper middle.
왼쪽 복원 블록에서 사용된 인트라 예측 모드를 Left라 하고 위쪽 복원 블록에서 사용된 인트라 예측 모드를 Above라 정의한다.The intra prediction mode used in the left reconstruction block is called Left, and the intra prediction mode used in the upper reconstruction block is defined as Above.
만약, 왼쪽 복원 블록이 이용 불가능한 경우, 왼쪽 복원 블록이 인트라 예측으로 부호화되지 않은 경우, 또는 왼쪽 복원 블록에 매트릭스 기반 의 예측(MIP)이 적용된 경우, Left는 평면 모드로 설정될 수 있다. 그리고 만약, 위쪽 복원 블록이 이용 불가능한 경우, 위쪽 복원 블록이 인트라 예측으로 부호화되지 않은 경우, 위쪽 복원 블록에 매트릭스 기반의 예측(MIP)이 사용된 경우, 또는 위쪽 복원 블록이 현재 블록이 속한 CTU(coding tree unit) 경계 바깥에 존재하는 경우, Above는 평면 모드로 설정될 수 있다. 전술한 경우에 해당하지 않는다면, Left와 Above은 왼쪽 복원 블록이 사용한 인트라 예측 모드와 위쪽 복원 블록이 사용한 인트라 예측 모드로 각각 설정될 수 있다. 왼쪽 복원 블록 또는 위쪽 복원 블록에 BDPCM이 적용된 경우, BDPCM 적용 방향에 따라, Left 또는 Above를 수평 모드 또는 수직 모드로 설정할 수도 있다. If the left reconstructed block is unavailable, the left reconstructed block is not encoded by intra prediction, or when matrix-based prediction (MIP) is applied to the left reconstructed block, Left may be set to the planar mode. And, if the upper reconstructed block is unavailable, if the upper reconstructed block is not encoded by intra prediction, if matrix-based prediction (MIP) is used for the upper reconstructed block, or if the upper reconstructed block is the CTU ( coding tree unit), Above can be set to flat mode. If it does not correspond to the above-mentioned case, Left and Above may be respectively set to the intra prediction mode used by the left reconstructed block and the intra prediction mode used by the upper reconstructed block. When BDPCM is applied to the left or upper restoration block, Left or Above may be set to horizontal mode or vertical mode depending on the BDPCM application direction.
만약 Left와 Above 두 모드가 같고, 방향성 모드라면, MPM 후보는 [Left, Left-1, Left+1, Left-2, Left+2]로 구성될 수 있다.If both Left and Above modes are the same and are directional mode, MPM candidates can be composed of [Left, Left-1, Left+1, Left-2, Left+2].
그게 아니라 만약 Left와 Above 두 모드가 다르고, Left 혹은 Above가 방향성 모드라면, Left와 Above가 전부 방향성 모드인지 혹은 하나만 방향성 모드인지 여부에 따라 후보 구성 방식이 달라진다. 우선, 두 모드 중 큰 값을 가진 모드를 Max로 정의하고 작은 값을 가진 모드를 Min으로 정의한다. Rather, if the two modes of Left and Above are different, and Left or Above is a directional mode, the candidate composition method will be different depending on whether both Left and Above are directional modes or only one of them is a directional mode. First, the mode with the largest value among the two modes is defined as Max, and the mode with the smallest value is defined as Min.
Left와 Above가 전부 방향성 모드인 경우, 다음의 방식대로 MPM 후보가 구성될 수 있다. 만약 (Max - Min)의 값이 1이라면 MPM 후보는 [Left, Above, Min-1, Max +1, Min-2]로 구성될 수 있다. 그게 아니라 만약 (Max - Min)의 값이 62 이상이라면 MPM 후보는 [Left, Above, Min+1, Max -1, Min+2]로 구성될 수 있다. 그게 아니라 만약 (Max - Min)의 값이 2라면 MPM 후보는 [Left, Above, Min+1, Min -1, Max+1]로 구성될 수 있다. 그게 아니라면 MPM 후보는 [Left, Above, Min-1, Min +1, Max-1]로 구성될 수 있다.When both Left and Above are directional modes, MPM candidates can be configured in the following way. If the value of (Max - Min) is 1, the MPM candidate may be composed of [Left, Above, Min-1, Max +1, Min-2]. Rather, if the value of (Max - Min) is 62 or higher, the MPM candidate can be composed of [Left, Above, Min+1, Max -1, Min+2]. Rather, if the value of (Max - Min) is 2, the MPM candidate can be composed of [Left, Above, Min+1, Min -1, Max+1]. Otherwise, the MPM candidate can consist of [Left, Above, Min-1, Min +1, Max-1].
만약 Left와 Above 중 하나만 방향성 모드라면 MPM 후보는 [Max, Max-1, Max+1, Max -2, Max+2]로 구성될 수 있다.If only one of Left and Above is a directional mode, MPM candidates can be composed of [Max, Max-1, Max+1, Max -2, Max+2].
그게 아니라면(즉, Left와 Above가 모두 방향성 모드가 아니라면), MPM 후보는 [DC 모드, 50(수직 모드), 18(수평 모드), 수직-4, 수직+4]로 구성될 수 있다.Otherwise (ie, both Left and Above are not in directional mode), MPM candidates can consist of [DC mode, 50 (vertical mode), 18 (horizontal mode), vertical-4, vertical+4].
도 9는 본 개시에 따른 평면 모드에 기반한 인트라 예측 방법을 도시한 것이다.9 illustrates an intra prediction method based on a planar mode according to the present disclosure.
0번 모드로 할당된 Planar 모드(평면 모드) 하에서 예측 화소는 도 9와 같이 생성될 수 있다. A prediction pixel may be generated as shown in FIG. 9 under the planar mode (planar mode) allocated to mode 0.
도 9를 참조하면, T와 L은 평면 모드로 예측 블록을 생성할 때 사용되는 주변 복원 화소에 대한 예시이다. T는 우측 상단 코너에 위치하는 복원 화소를 내타낸다. L은 좌측 하단 코너에 위치하는 복원 화소를 나타낸다. 이 복원 화소들을 참조 화소로 설정하여 예측에 사용한다. 여기서 P1은 수평 방향에 대한 예측 화소이다. P1은 P1과 Y축으로 동일 위치에 있는 복원 화소와 T를 선형 보간하여 생성될 수 있다. P2는 수직 방향에 대한 예측 화소이다. P2는 P2와 X축으로 동일 위치에 있는 복원 화소와 L을 선형 보간하여 생성될 수 있다. 그 후, 다음의 수학식 1과 같이, P1과 P2를 가중치합하여 최종적인 예측 화소를 생성한다. Referring to FIG. 9 , T and L are examples of neighboring reconstructed pixels used when generating a prediction block in a planar mode. T denotes a reconstructed pixel located in the upper right corner. L denotes a reconstructed pixel located in the lower left corner. These restored pixels are set as reference pixels and used for prediction. Here, P1 is a prediction pixel for the horizontal direction. P1 may be generated by linearly interpolating the reconstructed pixel and T located at the same position along the Y axis as P1. P2 is a prediction pixel for the vertical direction. P2 may be generated by linearly interpolating the reconstructed pixel and L located at the same position along the X axis as P2. Thereafter, as in Equation 1 below, a final prediction pixel is generated by weighting P1 and P2.
Figure PCTKR2020018201-appb-M000001
Figure PCTKR2020018201-appb-M000001
이 때, 수학식 1에서 가중치 α와 β는 동일한 값일 수 있다. 혹은 블록의 형태, 너비, 높이 또는 종횡비를 고려하여 가중치 α와 β를 결정할 수 있다.In this case, in Equation 1, the weights α and β may have the same value. Alternatively, the weights α and β may be determined in consideration of the shape, width, height, or aspect ratio of the block.
도 10은 본 개시에 따른 DC 모드에 기반한 인트라 예측 방법을 도시한 것이다.10 illustrates an intra prediction method based on a DC mode according to the present disclosure.
1번 모드로 할당된 DC 모드 하에서 예측 화소는 도 10과 같이 생성될 수 있다. 도 10에서 블록의 크기는 4x4이라 가정한다. Under the DC mode allocated to the first mode, the prediction pixel may be generated as shown in FIG. 10 . In FIG. 10, it is assumed that the size of a block is 4x4.
도 10을 참조하면, 블록 주변에 존재하는 복원 화소를 참조 화소로 설정하고, 참조 화소들의 평균 값을 계산한 후에, 계산된 값을 예측 블록 내 모든 예측 화소로 설정한다. 평균값을 계산하는데 이용되는 참조 화소들은 상단 복원 화소들(B~E), 좌측 복원 화소들(F~I) 또는 좌상단 복원 화소(A) 중 적어도 하나를 포함할 수 있다. 또는, 상단 복원 화소들 및 좌측 복원 화소들만을 이용하여 평균값을 계산할 수도 있다. Referring to FIG. 10 , reconstructed pixels existing around the block are set as reference pixels, and after calculating the average value of the reference pixels, the calculated values are set as all prediction pixels in the prediction block. The reference pixels used to calculate the average value may include at least one of upper reconstructed pixels B to E, left reconstructed pixels F to I, or upper left reconstructed pixel A. Alternatively, the average value may be calculated using only the upper restored pixels and the left restored pixels.
혹은, 블록의 형태에 따라, 상단 복원 화소들 또는 좌측 복원 화소들 중 어느 하나만을 선택적으로 이용하여 평균값을 계산할 수도 있다.Alternatively, the average value may be calculated by selectively using only one of the upper restored pixels or the left restored pixels according to the shape of the block.
혹은, 블록의 형태에 따라, 상단 복원 화소들 또는 좌측 복원 화소들 중 어느 한쪽에 더 큰 가중치를 적용하는 것 또한 가능하다. 예를 들어, 위쪽 복원 화소들에 대한 상단 평균과 왼쪽 복원 화소들에 대한 좌측 평균을 계산한 후, 상단 평균 및 좌측 평균에 대한 가중치합(weighted sum) 연산을 수행하여 도출된 가중 평균값을 최종 예측 화소로 설정할 수 있다. Alternatively, it is also possible to apply a greater weight to either the upper restored pixels or the left restored pixels according to the shape of the block. For example, after calculating the upper average of the upper reconstructed pixels and the left average of the left reconstructed pixels, the weighted average value derived by performing a weighted sum operation on the upper average and the left mean is finally predicted It can be set in pixels.
무손실 부호화가 수행되는 경우, 블록 내 화소들은 순차적으로 복원될 수 있다. 일 예로, 좌측 상단 화소를 최초로 복원하고, 우측 하단 화소를 마지막으로 복원하되, 래스터 스캔, 수평 스캔, 수직 스캔, 대각 스캔, 역 래스터 스캔, 역 수평 스캔, 역 수직 스캔, 또는 역 대각 스캔에 기초하여 복원 순서를 결정할 수 있다. 또는, 좌측 하단 화소를 최초로 복원하고, 우측 상단 화소를 마지막으로 복원하는 등 다양한 복원 순서의 정의가 가능하다.When lossless encoding is performed, pixels in a block may be sequentially reconstructed. For example, the upper left pixel is restored first and the lower right pixel is restored last, but based on a raster scan, a horizontal scan, a vertical scan, a diagonal scan, an inverse raster scan, an inverse horizontal scan, an inverse vertical scan, or an inverse diagonal scan. to determine the restoration order. Alternatively, various restoration orders can be defined, such as restoring the lower left pixel first and restoring the upper right pixel last.
복원 순서는, 현재 블록의 크기, 형태 또는 인트라 예측 모드에 기초하여 결정될 수 있다. 일 예로, 인트라 예측 모드의 값이 수평 모드의 값보다 작은 경우에는, 좌측 하단 화소를 최초로 복원하는 반면, 인트라 예측 모드의 값이 수평 모드의 값 이상인 경우에는, 좌측 상단 화소를 최초로 복원할 수 있다. The reconstruction order may be determined based on the size, shape, or intra prediction mode of the current block. For example, when the value of the intra prediction mode is smaller than the value of the horizontal mode, the lower left pixel is initially reconstructed, whereas when the value of the intra prediction mode is greater than or equal to the value of the horizontal mode, the upper left pixel may be initially reconstructed .
또는, 소정의 단위 별로 복원 순서가 결정될 수 있다. 소정의 단위는, 행, 열 또는 서브 블록일 수 있다. 소정의 단위 별 복원 순서와 전술한 화소 별 복원 순서는 서로 동일하게 설정될 수도 있다. 일예로, 상단 행을 시작으로 하단 행까지 순차적으로 화소들을 복원하거나, 좌측 열을 시작으로 우측 열까지 순차적으로 화소들을 복원할 수 있다. 후술되는 도면에서, 각 화소에 표기된 번호는, 복원 순서를 나타낸다.Alternatively, the restoration order may be determined for each predetermined unit. The predetermined unit may be a row, a column, or a sub-block. The restoration order for each predetermined unit and the above-described restoration order for each pixel may be set to be the same as each other. For example, pixels may be sequentially restored from an upper row to a lower row, or pixels may be sequentially restored from a left column to a right column. In the drawings to be described later, a number indicated on each pixel indicates a restoration order.
블록 내의 예측/복원 화소를 참조 화소로 사용하는, 개선된 인트라 예측이 적용될 수도 있다. 개선된 인트라 예측은 무손실 부호화가 적용되는 경우에 한하여 적용될 수도 있다. 본 개시에 따른 개선된 인트라 예측에 대해서는 이하 도 11 내지 도 13을 참조하여 자세히 살펴보도록 한다.Improved intra prediction, using prediction/reconstruction pixels in a block as reference pixels, may be applied. The improved intra prediction may be applied only when lossless coding is applied. The improved intra prediction according to the present disclosure will be described in detail below with reference to FIGS. 11 to 13 .
도 11 내지 도 13은 본 개시에 따른 개선된 인트라 예측 방법을 도시한 것이다. 11 to 13 illustrate an improved intra prediction method according to the present disclosure.
도 11을 참조하면, 개선된 DC 모드에서, 현재 블록의 예측 화소는 해당 예측 화소의 주변에 위치한 기 복원된 화소를 기초로 유도될 수 있다. 여기서, 기 복원된 화소는, 상단 복원 화소, 좌측 복원 화소 또는 좌상단 복원 화소 중 적어도 하나를 포함할 수 있다. 이때, 현재 블록의 경계에 인접하는 예측 화소는 현재 블록에 인접하는 이웃 블록에 포함된 복원 화소를 이용하여 유도될 수 있다. 일 예로, a0에 대한 예측 화소는 현재 블록에 인접하는 A, B 및 F의 평균값을 기초로 유도될 수 있다. 반면, 현재 블록의 경계에 인접하지 않는 예측 화소는, 현재 블록에 속하고 해당 예측 화소보다 이전에 복원된 화소를 이용하여 유도될 수 있다. 일 예로, a6에 대한 예측 화소는 a6 이전에 복원된 a1, a2 및 a5의 평균값을 기초로 유도될 수 있다. Referring to FIG. 11 , in the improved DC mode, the prediction pixel of the current block may be derived based on a previously reconstructed pixel located in the vicinity of the corresponding prediction pixel. Here, the previously reconstructed pixel may include at least one of an upper reconstructed pixel, a left reconstructed pixel, and an upper left reconstructed pixel. In this case, the prediction pixel adjacent to the boundary of the current block may be derived using the reconstructed pixel included in the neighboring block adjacent to the current block. As an example, the prediction pixel for a0 may be derived based on the average value of A, B, and F adjacent to the current block. On the other hand, a prediction pixel that is not adjacent to the boundary of the current block may be derived using a pixel belonging to the current block and reconstructed before the corresponding prediction pixel. As an example, the prediction pixel for a6 may be derived based on the average value of a1, a2, and a5 reconstructed before a6.
현재 블록 내 화소 a0~a15에 대응하는 예측 화소를 p0~p15라고 가정하면, 예측 화소는 다음의 수학식 2를 기초로 유도될 수 있다.Assuming that the prediction pixels corresponding to the pixels a0 to a15 in the current block are p0 to p15, the prediction pixels may be derived based on Equation 2 below.
Figure PCTKR2020018201-appb-M000002
Figure PCTKR2020018201-appb-M000002
수학식 2에서 cLn, cUn, cULn은 각각 pn의 바로 왼쪽, 바로 위쪽, 바로 왼쪽 위에 존재하는 화소를 의미하며, wL, wU, wUL은 각각 cLn, cUn, cULn에 적용되는 가중치를 의미한다. 예를 들어, wL, wU, wUL이 각각 1, 1, 0으로 설정되어 있다고 가정하면, p0은 F와 B의 평균 값이 되며, p6의 경우 a2과 a5의 평균 값이 된다. 그 외 예측 화소들도 동일한 방식으로 생성될 수 있다. In Equation 2, cL n , cU n , and cUL n mean pixels that exist immediately to the left, immediately above, and immediately above p n , respectively, and wL, wU and wUL are applied to cL n , cU n , and cUL n , respectively. means the weight to be For example, assuming that wL, wU, and wUL are set to 1, 1, and 0, respectively, p0 becomes the average value of F and B, and in the case of p6, it becomes the average value of a2 and a5. Other prediction pixels may be generated in the same manner.
각 화소에 적용되는 가중치는, 예측 화소의 위치, 현재 블록의 크기, 현재 블록의 형태 또는 이웃 복원 화소가 현재 블록에 포함되는지 여부 중 적어도 하나를 기초로 결정될 수 있다. A weight applied to each pixel may be determined based on at least one of a location of a prediction pixel, a size of a current block, a shape of a current block, or whether a neighboring reconstruction pixel is included in the current block.
도 12를 참조하면, 0번 모드(평면 모드)와 1번 모드(DC 모드)를 제외한 방향성 모드 하에서는, 복원 화소(A~Q)를 참조 화소로 설정한 후, 방향성 모드에 대응되는 방향에 위치하는 적어도 하나의 참조 화소를 이용하여 예측 화소를 생성한다. 도 12는 방향성 모드에 의해 생성된 예측 화소들에 대한 예시이다. 66번 모드가 사용되었다고 가정할 때, 각 예측 화소는 우상단 대각 방향에 위치하는 참조 화소로 설정될 수 있다. 일 예로, p0은 C, p1과 p4는 D, … , p15는 I로 설정된다.Referring to FIG. 12 , in directional modes except for mode 0 (planar mode) and mode 1 (DC mode), restored pixels A to Q are set as reference pixels and are positioned in a direction corresponding to the directional mode A prediction pixel is generated using at least one reference pixel. 12 is an example of prediction pixels generated by a directional mode. Assuming that mode 66 is used, each prediction pixel may be set as a reference pixel located in a diagonal direction from the upper right. For example, p0 is C, p1 and p4 are D, ... , p15 is set to I.
또 다른 예시로, 만약 66번 모드가 아닌 18번(Horizontal) 모드가 사용되었다면, 각 예측 화소는 좌측 방향에 위치하는 참조 화소로 설정될 수 있다. 일 예로, p0~p3은 J, … , p12~p15는 M으로 설정된다.As another example, if the 18th (horizontal) mode is used instead of the 66th mode, each prediction pixel may be set as a reference pixel located in the left direction. For example, p0 to p3 are J, ... , p12 to p15 are set to M.
무손실 부호화에서는 개선된 방향성 모드에 기반한 인트라 예측이 적용될 수 있다. 개선된 방향성 모드에 기반한 인트라 예측에서는, 현재 블록 내의 화소를 참조 화소로 사용할 수 있다. 즉, 예측 화소의 상단 행 또는 예측 화소의 좌측 열에 포함된 화소를 참조 화소로 사용할 수 있다. 여기서, 현재 블록 내의 화소는 예측 화소를 의미할 수도 있고, 복원 화소를 의미할 수도 있다.In lossless coding, intra prediction based on an improved directional mode may be applied. In intra prediction based on the enhanced directional mode, a pixel in the current block may be used as a reference pixel. That is, a pixel included in the upper row of the prediction pixel or the left column of the prediction pixel may be used as the reference pixel. Here, the pixel in the current block may mean a prediction pixel or a reconstructed pixel.
일 예로, 도 12에 도시된 현재 블록에 18번(Horizontal) 모드에 기초한 인트라 예측이 적용된다고 가정할 경우, 각 예측 화소는 예측 화소의 좌측에 위치하는 복원 화소로 설정될 수 있다. 일 예로, p0~p3은 각각 J, a0, a1, a2로 설정된다. p4~p7은 각각 K, a4, a5, a6으로 설정되며 p8~p11은 각각 L, a8, a9, a10로 설정되고 p12~p15는 각각 M, a12, a13, a14로 설정된다. For example, if it is assumed that intra prediction based on the 18th mode is applied to the current block shown in FIG. 12 , each prediction pixel may be set as a reconstructed pixel located to the left of the prediction pixel. For example, p0 to p3 are set to J, a0, a1, and a2, respectively. p4 to p7 are set to K, a4, a5, a6, respectively, p8 to p11 are set to L, a8, a9, a10, respectively, and p12 to p15 are set to M, a12, a13, and a14, respectively.
예측 화소의 상단 행 또는 좌측 열에 포함된 예측/복원 화소를 참조 화소로 이용하고자 하는 경우, 현재 블록의 인트라 예측 모드의 번호에 따라, 추가 패딩이 필요한 경우가 발생할 수 있다. 일 예로, 현재 블록의 우측 이웃 블록 또는 하단 이웃 블록에 포함된 복원 화소들은 이용 불가능하므로, 현재 블록의 우측 이웃 블록 또는 하단 이웃 블록에 포함된 복원 화소들을 위한 패딩이 수행되어야 할 필요가 있다. When a prediction/reconstruction pixel included in an upper row or a left column of a prediction pixel is to be used as a reference pixel, additional padding may be required depending on the number of the intra prediction mode of the current block. For example, since the reconstructed pixels included in the right neighboring block or the lower neighboring block of the current block are unavailable, padding for the reconstructed pixels included in the right neighboring block or the lower neighboring block of the current block needs to be performed.
도 13을 참조하면, 도 13에서 사용된 인트라 예측 모드는 67번 모드라고 가정하고 설명한다.Referring to FIG. 13 , it is assumed that the intra prediction mode used in FIG. 13 is mode 67 and will be described.
현재 블록의 상단 경계에 인접하는 예측 화소 p0~p3은 각각 현재 블록 위의 복원된 화소들을 참조 화소로 설정한 후 이 화소들을 이용하여 생성된다. 현재 블록의 상단 경계에 인접하지 않는 예측 화소 p4~p7는 상단 행에 포함된 예측/복원 화소들을 참조 화소들로 설정할 수 있다. 이때, p6과 p7의 경우, 블록의 오른편에는 부호화 순서상 화소가 존재하지 않는다. 이처럼, 복원 화소가 존재하지 않는 위치에 대해서는 기 복원 화소를 이용하여 패딩을 수행할 수 있다. 이때, 현재 블록의 우측 이웃 블록에 포함된 참조 화소는 현재 블록의 우측 경계에 위치하는 화소를 패딩하여 생성될 수 있다. 일 예로, p4~p7에 대한 예측을 위해, a3을 이용하여 패딩을 수행한다. 또는, 현재 블록의 우측 경계에 인접하는 현재 블록 내 화소(이하, 제1 화소라 함)와 현재 블록의 우측 상단에 존재하는 존재하는 복원 화소들을 이용하여 패딩을 수행할 수도 있다. 일 예로, 패딩 화소는 패딩 화소와 x축 좌표가 동일한 복원 화소 및 패딩 화소와 y축 좌표가 동일한 제1 화소를 기초로 생성될 수 있다. 일 예로, a3과 F를 거리에 따라 가중치합하여 첫 번째 패딩 된 화소를 생성할 수도 있다. 마찬가지로 a3과 G를 이용하여 두 번째 패딩 된 화소를 생성하는 것 또한 가능하다. 또는 현재 블록의 제1 화소와 패딩 화소로부터 우측 상단에 위치하는 복원 화소(예컨대, 방향성 예측 모드의 Angular line 상에 위치하는 복원 화소)를 이용하여 패딩 화소를 생성할 수 있다.Prediction pixels p0 to p3 adjacent to the upper boundary of the current block are generated by using reconstructed pixels on the current block as reference pixels, respectively. Prediction pixels p4 to p7 not adjacent to the upper boundary of the current block may set prediction/reconstruction pixels included in the upper row as reference pixels. In this case, in the case of p6 and p7, there is no pixel on the right side of the block in the coding order. In this way, padding may be performed using the previously restored pixel for a position where the restored pixel does not exist. In this case, the reference pixel included in the right neighboring block of the current block may be generated by padding the pixel located at the right boundary of the current block. For example, for prediction of p4 to p7, padding is performed using a3. Alternatively, padding may be performed using pixels in the current block (hereinafter, referred to as a first pixel) adjacent to the right boundary of the current block and reconstructed pixels existing in the upper right corner of the current block. As an example, the padding pixel may be generated based on a restored pixel having the same x-axis coordinate as the padding pixel and a first pixel having the same y-axis coordinate as the padding pixel. As an example, the first padded pixel may be generated by weighting a3 and F according to the distance. Similarly, it is also possible to create a second padded pixel using a3 and G. Alternatively, the padding pixel may be generated using the first pixel and the padding pixel of the current block, the restored pixel located at the upper right (eg, the restored pixel located on the angular line in the directional prediction mode).
이 때, 패딩될 화소의 개수는 블록의 크기, 인트라 예측 모드의 번호에 따라 정해질 수 있다. 예를 들어, 인트라 예측 모드의 번호가 66번이라면, 오른쪽 위 45도의 각도이기 때문에 블록의 오른쪽으로 라인마다 하나의 화소씩만 패딩한다. 혹은 50번 모드인 경우 패딩이 필요하지 않으므로 패딩을 수행하지 않을 수 있다. In this case, the number of pixels to be padded may be determined according to the size of the block and the number of the intra prediction mode. For example, if the number of the intra prediction mode is 66, only one pixel per line is padded to the right of the block because the upper right angle is 45 degrees. Alternatively, in the case of mode 50, padding may not be performed because padding is not required.
혹은, 복원 화소들을 이용하여 설정된 참조 화소의 개수와 동일하게, 블록내의 원본 화소를 이용하여 패딩할 시에도 동일하게 맞추는 방식 또한 가능하다. 예를 들어 도 13의 현재 블록 위쪽에서, 복원 화소를 이용하여 B~I까지 참조 화소로 설정되었다면 그 아래 줄에서도 4개 화소씩 패딩할 수 있다.Alternatively, a method of matching the same number of reference pixels as the number of reference pixels set using reconstructed pixels to the same when padding using original pixels in a block is also possible. For example, in the upper part of the current block of FIG. 13 , if B to I are set as reference pixels using reconstructed pixels, 4 pixels may be padded in the lower row as well.
본 예시에서는 설명의 편의성을 위해 오른쪽 위 방향의 인트라 예측 모드를 기준으로 설명하였지만 왼쪽 아래 방향의 예측 모드에도 유사한 개념이 적용될 수 있다. 일 예로, 현재 블록의 하단 이웃 블록에 포함되는 참조 화소들은, 현재 블록의 하단 경계에 인접하고 현재 블록에 속한 화소를 이용한 패딩을 통해 생성될 수 있다. In this example, for convenience of explanation, the intra prediction mode in the upper right direction is described as a reference, but a similar concept may be applied to the prediction mode in the lower left direction. For example, reference pixels included in the lower neighboring block of the current block may be generated through padding using pixels adjacent to the lower boundary of the current block and belonging to the current block.
위에서 설명한 블록 내 화소를 이용한 인트라 예측의 적용 여부는 무손실 부호화가 수행된 경우 항상 수행되도록 할 수 있다. 혹은 무손실 부호화가 수행된 경우, 해당 기술의 적용 여부를 알려주는 정보를 블록 단위로 부호화하여 복호화기로 전송하는 것 또한 가능하다. 혹은 상위 헤더를 통해 해당 기술의 지원 여부를 부호화할 수 있다. 이러한 방식을 통해 무손실 부호화에서 해당 기술의 사용 여부를 상위 헤더를 통해 조절할 수도 있다.Whether or not intra prediction using pixels in the block described above is applied can be always performed when lossless coding is performed. Alternatively, when lossless encoding is performed, it is also possible to encode information indicating whether the corresponding technology is applied in block units and transmit the encoded information to the decoder. Alternatively, whether the corresponding technology is supported or not may be encoded through the upper header. In this way, it is possible to control whether the corresponding technology is used in lossless encoding through a higher header.
원본 화소에서 예측 화소를 차분하여 잔차 화소를 유도하고, 잔차 화소를 변환 및/또는 양자화를 적용할 수 있다. 이때, 잔차 데이터를 그대로 부호화하는 대신, 잔차 데이터간 차분값을 생성한 뒤, 생성된 차분값을 부호화할 수 있다. 위와 같이, 잔차 데이터를 그대로 부호화하는 대신 잔차 데이터간의 차분값을 부호화/복호화하는 방법을 DPCM (Delta Pulse Coded Modulation)이라 호칭할 수 있다.A residual pixel may be derived by differentiating the prediction pixel from the original pixel, and transform and/or quantization may be applied to the residual pixel. In this case, instead of encoding the residual data as it is, a difference value between the residual data may be generated and then the generated difference value may be encoded. As described above, a method of encoding/decoding a difference value between residual data instead of encoding the residual data as it is may be referred to as DPCM (Delta Pulse Coded Modulation).
여기서, 잔차 데이터는, 잔차 화소 또는 잔차 계수를 나타낼 수 있다. 잔차 계수는, 잔차 화소를 변환하여 획득된 변환 계수, 변환 계수를 양자화하여 획득된 양자화된 변환 계수, 또는 잔차 화소를 양자화하여 획득된 양자화된 계수 중 적어도 하나를 포함할 수 있다. 현재 블록에 변환 및/또는 양자화가 적용되었는지 여부에 따라, 잔차 계수가, 변환 계수, 양자화된 변환 계수 또는 양자화된 계수 중 적어도 하나를 나타낼 수 있다. 복호화기에서는, 양자화된 변환 계수에 역양자를 적용하여 변환 계수를 유도하고, 변환 계수에 역변환을 적용하여 잔차 화소를 유도할 수 있다. Here, the residual data may represent a residual pixel or a residual coefficient. The residual coefficient may include at least one of a transform coefficient obtained by transforming the residual pixel, a quantized transform coefficient obtained by quantizing the transform coefficient, or a quantized coefficient obtained by quantizing the residual pixel. Depending on whether transform and/or quantization is applied to the current block, the residual coefficient may represent at least one of a transform coefficient, a quantized transform coefficient, or a quantized coefficient. The decoder may derive a transform coefficient by applying an inverse quant to the quantized transform coefficient, and may derive a residual pixel by applying an inverse transform to the transform coefficient.
도 14는 DPCM의 적용 양상을 설명하기 위한 예시도이다.14 is an exemplary diagram for explaining an application aspect of DPCM.
도 14에서, rX (X는 0을 포함하는 정수)는, 원본 화소와 예측 화소의 차분인 잔차 화소를 나타낸다. 잔차 화소들에 대해 양자화를 적용하여, 양자화된 계수를 생성할 수 있다. 일 예로, 잔차 화소들(즉, r0 내지 r15)를 양자화하여, 양자화된 계수들(즉, Q(r0) 내지 Q(r15))를 생성할 수 있다. 여기서, Q는 양자화된 계수를 나타낸다.14 , rX (X is an integer including 0) represents a residual pixel that is a difference between an original pixel and a predicted pixel. Quantization may be applied to the residual pixels to generate quantized coefficients. As an example, the residual pixels (ie, r0 to r15) may be quantized to generate quantized coefficients (ie, Q(r0) to Q(r15)). Here, Q represents a quantized coefficient.
이후, DPCM을 적용하여, 양자화된 계수에 대한 차분값(즉, s0 내지 s15)를 생성할 수 있다. 양자화된 계수 Q(rX)에 대한 차분값 sX는, Q(rX)에서, 인접하는 양자화된 계수 Q(rY)를 차분하여 유도될 수 있다. 여기서, 인접하는 양자화된 계수 Q(rY)의 위치는, DPCM 방향을 기초로 결정될 수 있다.Thereafter, by applying DPCM, a difference value (ie, s0 to s15) for the quantized coefficients may be generated. A difference value sX with respect to the quantized coefficient Q(rX) may be derived by differentiating the adjacent quantized coefficient Q(rY) from Q(rX). Here, the position of the adjacent quantized coefficient Q(rY) may be determined based on the DPCM direction.
DPCM 방향은, 수직, 수평, 대각 또는 지그재그 중 적어도 하나를 가리킬 수 있다.The DPCM direction may indicate at least one of vertical, horizontal, diagonal, or zigzag.
DPCM 방향이 수평인 것은, 양자화된 계수들을 수평 방향 스캔을 적용하여 1차원 배열하였을 때의 순서를 따라, 인접하는 양자화된 계수가 선택됨을 나타낸다. 구체적으로, DPCM 방향이, 수평인 경우, 인접하는 양자화된 계수 Q(rY)는, 양자화된 계수들을 수평 방향을 따라 1차원으로 배열하였을 때, 양자화된 계수 Q(rX)의 이전에 위치할 수 있다. 첫번째 양자화된 계수 Q(r0)에 대해서는, 이전에 위치하는 양자화된 계수가 존재하지 않으므로, 양자화된 계수가 그대로 차분값으로 설정된다. 일 예로, DPCM이 수평 방향인 경우, 양자화된 계수 Q(r0) 내지 Q(r4)에 대한 차분값 s0 내지 s4는 다음과 같이 유도될 수 있다.The horizontal DPCM direction indicates that adjacent quantized coefficients are selected according to the order in which the quantized coefficients are one-dimensionally arranged by applying a horizontal scan. Specifically, when the DPCM direction is horizontal, the adjacent quantized coefficient Q(rY) may be located before the quantized coefficient Q(rX) when the quantized coefficients are arranged in one dimension along the horizontal direction. have. For the first quantized coefficient Q(r0), since there is no previously positioned quantized coefficient, the quantized coefficient is set as a difference value as it is. For example, when the DPCM is in the horizontal direction, the difference values s0 to s4 with respect to the quantized coefficients Q(r0) to Q(r4) may be derived as follows.
s0 = Q(r0), s1 = Q(r1)-Q(r0), s2 = Q(r2)-Q(r1), s3 = Q(r3)-Q(r2), s4 = Q(r4)-Q(r3)s0 = Q(r0), s1 = Q(r1)-Q(r0), s2 = Q(r2)-Q(r1), s3 = Q(r3)-Q(r2), s4 = Q(r4)- Q(r3)
즉, 첫번째 양자화된 변환 계수 Q(r0)를 제외한, 양자화된 계수 Q(rX)에 대한 차분값 sX는, 양자화된 계수 Q(rX) 및 인접하는 양자화된 계수 Q(r(X-1)) 사이의 차분으로 유도될 수 있다.That is, the difference value sX with respect to the quantized coefficient Q(rX) except for the first quantized transform coefficient Q(r0) is the quantized coefficient Q(rX) and the adjacent quantized coefficient Q(r(X-1)) can be derived from the difference between
DPCM 방향이 수직인 것은, 양자화된 계수들을 수직 방향 스캔을 적용하여 1차원 배열하였을 때의 순서를 따라, 인접하는 양자화된 계수가 선택됨을 나타낸다. 구체적으로, DPCM 방향이, 수직인 경우, 인접하는 양자화된 계수 Q(rY)는, 양자화된 계수들을 수직 방향을 따라 1차원으로 배열하였을 때, 양자화된 계수 Q(rX)의 이전에 위치할 수 있다. 첫번째 양자화된 계수 Q(r0)에 대해서는, 이전에 위치하는 양자화된 계수가 존재하지 않으므로, 양자화된 계수가 그대로 차분값으로 설정된다. 일 예로, DPCM이 수직 방향인 경우, 양자화된 계수 Q(r0), Q(r4), Q(r8), Q(r12)에 대한 차분값 s0, s4, s8, s12는 다음과 같이 유도될 수 있다.The vertical DPCM direction indicates that adjacent quantized coefficients are selected according to the order in which the quantized coefficients are one-dimensionally arranged by applying a vertical scan. Specifically, when the DPCM direction is vertical, the adjacent quantized coefficient Q(rY) may be located before the quantized coefficient Q(rX) when the quantized coefficients are arranged in one dimension along the vertical direction. have. For the first quantized coefficient Q(r0), since there is no previously positioned quantized coefficient, the quantized coefficient is set as a difference value as it is. For example, when the DPCM is in the vertical direction, the difference values s0, s4, s8, and s12 for the quantized coefficients Q(r0), Q(r4), Q(r8), and Q(r12) can be derived as follows. have.
s0 = Q(r0), s4 = Q(r4)-Q(r0), s10 = Q(r8)-Q(r4), s12 = Q(r12)-Q(r8)s0 = Q(r0), s4 = Q(r4)-Q(r0), s10 = Q(r8)-Q(r4), s12 = Q(r12)-Q(r8)
즉, 첫번째 양자화된 변환 계수 Q(r0)를 제외한, 양자화된 계수 Q(rX)에 대한 차분값 sX는, 양자화된 계수 Q(rX) 및 인접하는 양자화된 계수 Q(r(X-(block_width))) 사이의 차분으로 유도될 수 있다. 여기서, block_width는 현재 블록의 너비를 나타낸다. That is, the difference value sX with respect to the quantized coefficient Q(rX) except for the first quantized transform coefficient Q(r0) is the quantized coefficient Q(rX) and the adjacent quantized coefficient Q(r(X-(block_width)) )) can be derived from the difference between Here, block_width indicates the width of the current block.
DPCM 방향이 대각인 것은, 양자화된 계수들을 대각 방향 스캔을 적용하여 1차원 배열하였을 때의 순서를 따라, 인접하는 양자화된 계수가 선택됨을 나타낸다. 구체적으로, DPCM 방향이, 대각인 경우, 인접하는 양자화된 계수 Q(rY)는, 양자화된 계수들을 대각 방향을 따라 1차원으로 배열하였을 때, 양자화된 계수 Q(rX)의 이전에 위치할 수 있다. 이때, 대각 방향은, 좌상단 대각 방향, 우상단 대각 방향, 좌하단 대각 방향 또는 우하단 대각 방향 중 어느 하나일 수 있다. The fact that the DPCM direction is diagonal indicates that adjacent quantized coefficients are selected according to the order in which the quantized coefficients are one-dimensionally arranged by applying a diagonal scan. Specifically, when the DPCM direction is diagonal, the adjacent quantized coefficient Q(rY) can be located before the quantized coefficient Q(rX) when the quantized coefficients are arranged in one dimension along the diagonal direction. have. In this case, the diagonal direction may be any one of an upper left diagonal direction, an upper right diagonal direction, a lower left diagonal direction, or a lower right diagonal direction.
DPCM 방향이 좌상단 대각 방향인 경우, 양자화된 계수 Q(rX)에 대한 차분값 sX는 좌상단 대각 방향에 위치하는 이전 양자화된 계수 Q(rY)와의 차분값을 기초로 유도될 수 있다. 이때, 첫번째 양자화된 계수 Q(r0)에 대해서는, 좌상단 대각 방향에 위치하는 양자화된 계수가 존재하지 않으므로, 양자화된 계수가 그대로 차분값으로 설정된다. 일 예로, DPCM이 좌상단 대각 방향인 경우, 양자화된 계수 Q(r0), Q(r5), Q(r10), Q(r15)에 대한 차분값 s0, s5, s10, s15는 다음과 같이 유도될 수 있다.When the DPCM direction is the upper-left diagonal direction, a difference value sX with respect to the quantized coefficient Q(rX) may be derived based on a difference value from the previous quantized coefficient Q(rY) located in the upper-left diagonal direction. At this time, with respect to the first quantized coefficient Q(r0), since there is no quantized coefficient located in the upper left diagonal direction, the quantized coefficient is set as a difference value as it is. For example, when the DPCM is in the upper left diagonal direction, the difference values s0, s5, s10, and s15 for the quantized coefficients Q(r0), Q(r5), Q(r10), and Q(r15) can be derived as follows. can
s0 = Q(r0), s5 = Q(r5)-Q(r0), s10 = Q(r10)-Q(r5), s15 = Q(r15)-Q(r10)s0 = Q(r0), s5 = Q(r5)-Q(r0), s10 = Q(r10)-Q(r5), s15 = Q(r15)-Q(r10)
DPCM 방향이 지그재그인 것은, 양자화된 계수들을 지그재그 스캔을 적용하여 1차원 배열하였을 때의 순서를 따라, 인접하는 양자화된 계수가 선택됨을 나타낸다.The fact that the DPCM direction is zigzag indicates that adjacent quantized coefficients are selected according to the order in which the quantized coefficients are one-dimensionally arranged by applying a zigzag scan.
도 15는 본 개시의 일 실시예에 따른, 지그재그 스캔 적용시 탐색 순서를 나타낸 것이다. 15 illustrates a search order when a zigzag scan is applied, according to an embodiment of the present disclosure.
지그재그 스캔 순서에 따라 양자화된 계수들을 1차열로 배열하였을 때, 양자화된 계수 Q(rX)의 이전에 위치하는 양자화된 계수 Q(rY)를 이용하여, 양자화된 계수 Q(rX)에 대한 차분값 sX를 유도할 수 있다. 일 예로, 도 15에 도시된 '지그재그3'이 적용되는 것으로 가정할 때, 양자화된 계수 Q(r0), Q(r1), Q(r8), Q(15)에 대한 차분값은 다음과 같이 유도될 수 있다. When the quantized coefficients are arranged in a primary column according to the zigzag scan order, the difference value with respect to the quantized coefficient Q(rX) using the quantized coefficient Q(rY) located before the quantized coefficient Q(rX) sX can be induced. As an example, assuming that 'zigzag 3' shown in FIG. 15 is applied, the difference values for the quantized coefficients Q(r0), Q(r1), Q(r8), and Q(15) are as follows. can be induced.
s0 = Q(r0), s4 = Q(r4)-Q(r0), s1 = Q(r1)-Q(r4), s15 = Q(r8)-Q(r1)s0 = Q(r0), s4 = Q(r4)-Q(r0), s1 = Q(r1)-Q(r4), s15 = Q(r8)-Q(r1)
각 양자화된 계수에 대한 차분값을 유도한 뒤, 양자화된 계수 대신 차분값을 부호화하여 시그날링할 수 있다.After deriving a difference value for each quantized coefficient, the difference value may be encoded instead of the quantized coefficient to be signaled.
상술한 실시예에서는, 양자화된 계수 Q(rX)의 이전에 위치하는 양자화된 계수 Q(rY)를 이용하여, 차분값 sX가 유도되는 것으로 설명되었다. 설명된 예와 달리, 양자화된 계수 Q(rX)의 다음에 위치하는 양자화된 계수를 이용하여, 차분값 sX를 유도할 수도 있다.In the above-described embodiment, it has been described that the difference value sX is derived by using the quantized coefficient Q(rY) located before the quantized coefficient Q(rX). Unlike the described example, a difference value sX may be derived using a quantized coefficient located next to the quantized coefficient Q(rX).
또한, 상술한 실시예에서는, 양자화된 계수 Q(rX)로부터 인접하는 양자화된 계수 Q(rY)를 차분하여, 차분값 sX를 유도하는 것으로 설명되었다. 설명된 예와 달리, 인접하는 양자화된 계수 Q(rY)로부터 양자화된 계수 Q(rX)를 차분하여, 차분값 sX를 유도할 수도 있다. In addition, in the above-described embodiment, it has been explained that the difference value sX is derived by differentiating the adjacent quantized coefficient Q(rY) from the quantized coefficient Q(rX). Unlike the described example, a difference value sX may be derived by differentiating the quantized coefficient Q(rX) from the adjacent quantized coefficient Q(rY).
부호화기 및 복호화기에서 DPCM 방향이 기 정의되어 있을 수 있다. 일 예로, 수평, 수직, 대각 또는 지그재그 중 하나가 고정적으로 이용될 수 있다. 또는, 복수개의 DPCM 방향들 중 하나를 특정하는 정보(예컨대, 인덱스)가 부호화되어 시그날링될 수 있다. 상기 인덱스는 블록 레벨, 슬라이스 레벨 또는 픽처 레벨에서 시그날링될 수 있다.The DPCM direction may be predefined in the encoder and the decoder. For example, one of horizontal, vertical, diagonal, and zigzag may be fixedly used. Alternatively, information (eg, index) specifying one of a plurality of DPCM directions may be encoded and signaled. The index may be signaled at a block level, a slice level, or a picture level.
또는, 현재 블록의 크기, 형태 또는 인트라 예측 모드 중 적어도 하나에 기초하여, 복수개의 DPCM 방향들 중 하나를 선택할 수 있다. 일 예로, 현재 블록에 수평 방향의 인트라 예측 모드(예컨대, 도 5의 Mode_18)가 적용된 경우, DPCM 방향이 수평으로 결정될 수 있다. 반면, 현재 블록에 수직 방향의 인트라 예측 모드(예컨대, 도 5의 Mode_50)가 적용된 경우, DPCM 방향이 수직으로 결정될 수 있다. Alternatively, one of a plurality of DPCM directions may be selected based on at least one of the size, shape, and intra prediction mode of the current block. For example, when a horizontal intra prediction mode (eg, Mode_18 of FIG. 5 ) is applied to the current block, the DPCM direction may be determined horizontally. On the other hand, when a vertical intra prediction mode (eg, Mode_50 of FIG. 5 ) is applied to the current block, the DPCM direction may be determined vertically.
또는, 현재 블록의 크기, 형태, 인트라 예측 모드 또는 부호화 모드 중 적어도 하나에 기초하여, DPCM 방향 후보의 개수 또는 종류가 상이하게 설정될 수 있다. 일 예로, 현재 블록에 인터 예측이 적용된 경우, 수평 방향 및 수직 방향의 DPCM 모드는 이용 불가능한 것으로 설정될 수 있다. 이 경우, 대각 방향 또는 지그재그 방향의 DPCM 모드가 적용되거나, 복수의 지그재그 방향 후보들 중 하나를 특정하는 인덱스가 부호화되어 시그날링될 수 있다.Alternatively, the number or type of DPCM direction candidates may be set differently based on at least one of the size, shape, intra prediction mode, and encoding mode of the current block. For example, when inter prediction is applied to the current block, the DPCM modes in the horizontal direction and the vertical direction may be set to be unavailable. In this case, the DPCM mode in the diagonal direction or the zigzag direction may be applied, or an index specifying one of a plurality of zigzag direction candidates may be encoded and signaled.
반대로, DPCM 방향을 결정한 뒤, DPCM 방향에 기초하여, 현재 블록의 인트라 예측 모드를 결정할 수도 있다. 일 예로, 수직 방향, 수평 방향 및 대각 방향(또는 지그재그)의 DPCM 모드는 각각 수직 방향, 수평 방향 및 대각 방향의 인트라 예측 모드에 대응할 수 있다. 즉, 현재 블록에 대한 DPCM 방향이 수직인 것은, 현재 블록에 수직 방향의 인트라 예측 모드가 적용됨을 나타내고, 현재 블록에 대한 DPCM 방향이 수평인 것은, 현재 블록에 수평 방향의 인트라 예측 모드가 적용됨을 나타내고, 현재 블록에 대한 DPCM 방향이 대각(또는, 지그재그)인 것은, 현재 블록에 대각 방향의 인트라 예측 모드가 적용됨을 나타낸다.Conversely, after determining the DPCM direction, the intra prediction mode of the current block may be determined based on the DPCM direction. For example, the DPCM modes in the vertical direction, the horizontal direction, and the diagonal direction (or zigzag) may correspond to the intra prediction modes in the vertical direction, the horizontal direction, and the diagonal direction, respectively. That is, a vertical DPCM direction for the current block indicates that the vertical intra prediction mode is applied to the current block, and a horizontal DPCM direction for the current block indicates that the horizontal intra prediction mode is applied to the current block. and that the DPCM direction for the current block is diagonal (or zigzag) indicates that the intra prediction mode in the diagonal direction is applied to the current block.
또는, 수직 방향 및 수평 방향의 DPCM 모드 각각을 수직 방향 및 수평 방향의 인트라 예측 모드에 대응시키고, 대각 방향(또는 지그재그)의 DPCM 모드를 비방향성 인트라 예측 모드(예컨대, DC 또는 플래너)에 대응시킬 수도 있다. 즉, 현재 블록에 대한 DPCM 방향이 수직인 것은, 현재 블록에 수직 방향의 인트라 예측 모드가 적용됨을 나타내고, 현재 블록에 대한 DPCM 방향이 수평인 것은, 현재 블록에 수평 방향의 인트라 예측 모드가 적용됨을 나타내고, 현재 블록에 대한 DPCM 방향이 대각(또는, 지그재그)인 것은, 현재 블록에 DC 또는 플래너 모드가 적용됨을 나타낸다. Alternatively, each of the DPCM modes in the vertical direction and the horizontal direction corresponds to the intra prediction mode in the vertical direction and the horizontal direction, and the DPCM mode in the diagonal direction (or zigzag) corresponds to the non-directional intra prediction mode (eg, DC or planar). may be That is, a vertical DPCM direction for the current block indicates that the vertical intra prediction mode is applied to the current block, and a horizontal DPCM direction for the current block indicates that the horizontal intra prediction mode is applied to the current block. and that the DPCM direction for the current block is diagonal (or zigzag) indicates that DC or planar mode is applied to the current block.
DPCM 방향이 지그재그로 결정된 경우, 부호화기 및 복호화기에서는 기 정의된 탐색 순서를 이용하여 차분값을 생성할 수 있다. 또는, 복수개의 지그재그 스캔 순서 중 적어도 하나를 특정하는 정보(예컨대, 인덱스)가 부호화되어 시그날링될 수 있다. 일 예로, 상기 인덱스는 도 15에 도시된 지그재그 스캔 순서들 중 하나를 특정하는 것일 수 있다. 또는, 현재 블록의 크기, 형태 또는 인트라 예측 모드 중 적어도 하나에 기초하여, 복수개의 지그재그 스캔 순서 중 하나가 특정될 수 있다.When the DPCM direction is determined to be zigzag, the encoder and the decoder may generate a difference value using a predefined search order. Alternatively, information (eg, an index) specifying at least one of a plurality of zigzag scan orders may be encoded and signaled. For example, the index may specify one of the zigzag scan orders shown in FIG. 15 . Alternatively, one of a plurality of zigzag scan orders may be specified based on at least one of the size, shape, and intra prediction mode of the current block.
현재 블록의 인트라 예측 모드는 MPM 후보를 기초로 결정될 수 있다. 이때, 이웃 블록에 DPCM이 적용된 경우, 이웃 블록에 적용된 DPCM 방향을 고려하여, 현재 블록의 MPM 후보를 유도할 수 있다. 구체적으로, 이웃 블록의 인트라 예측 모드가 DPCM 방향에 대응하는 인트라 예측 모드인 것으로 추정하여, MPM 후보를 유도할 수 있다. 일 예로, 이웃 블록에 수평 방향의 DPCM이 적용된 경우, 이웃 블록의 인트라 예측 모드가 수평 방향인 것으로 추정하여 MPM 후보를 유도할 수 있다. 또는, 이웃 블록에 수직 방향의 DPCM이 적용된 경우, 이웃 블록의 인트라 예측 모드가 수직 방향인 것으로 추정하여 MPM 후보를 유도할 수 있다. 또는, 이웃 블록에 대각 방향(또는 지그재그)의 DPCM이 적용된 경우, 이웃 블록의 인트라 예측 모드가 대각 방향 또는 비방향성 인트라 예측 모드(예컨대, DC 또는 플래너)인 것으로 추정하여 MPM 후보를 유도할 수 있다. The intra prediction mode of the current block may be determined based on the MPM candidate. In this case, when DPCM is applied to a neighboring block, an MPM candidate of the current block may be derived in consideration of the DPCM direction applied to the neighboring block. Specifically, an MPM candidate may be derived by estimating that the intra prediction mode of the neighboring block is the intra prediction mode corresponding to the DPCM direction. For example, when DPCM in the horizontal direction is applied to a neighboring block, an MPM candidate may be derived by estimating that the intra prediction mode of the neighboring block is in the horizontal direction. Alternatively, when vertical DPCM is applied to a neighboring block, an MPM candidate may be derived by estimating that the intra prediction mode of the neighboring block is vertical. Alternatively, when diagonal (or zigzag) DPCM is applied to a neighboring block, an MPM candidate may be derived by estimating that the intra prediction mode of the neighboring block is a diagonal or non-directional intra prediction mode (eg, DC or planar). .
현재 블록의 DPCM 방향을 부호화할 때, 이웃 블록 또는 이전 블록의 문맥 정보를 참조할 수 있다. 여기서, 문맥 정보의 참조 대상이 되는 이웃 블록 또는 이전 블록은, 현재 블록의 좌측 이웃 블록 또는 상단 이웃 블록 중 적어도 하나를 포함할 수 있다. 일 예로, 좌측 이웃 블록 및 상단 이웃 블록의 DPCM 방향이 동일한 경우, 좌측 이웃 블록 및 상단 이웃 블록의 DPCM 방향이 상이한 경우, 좌측 이웃 블록 및 상단 이웃 블록에 모두 DPCM이 적용된 경우, 좌측 이웃 블록 및 상단 이웃 블록 중 어느 하나에만 DPCM이 적용된 경우 또는 좌측 이웃 블록 및 상단 이웃 블록에 모두 DPCM이 적용되지 않은 경우 중 적어도 하나를 고려하여, 현재 블록의 문맥 정보 축적(또는, 갱신) 방법이 상이할 수 있다.When encoding the DPCM direction of the current block, context information of a neighboring block or a previous block may be referred to. Here, the neighboring block or previous block, which is the reference target of the context information, may include at least one of a left neighboring block or an upper neighboring block of the current block. For example, when the DPCM directions of the left neighboring block and the upper neighboring block are the same, when the DPCM directions of the left neighboring block and the upper neighboring block are different, when DPCM is applied to both the left neighboring block and the upper neighboring block, the left neighboring block and the upper In consideration of at least one of a case in which DPCM is applied to only one of the neighboring blocks or a case in which DPCM is not applied to both the left neighboring block and the upper neighboring block, the context information accumulation (or update) method of the current block may be different. .
상술한 실시 예에서는, 양자화된 계수에 기초한 DPCM 방법이 설명되었다. 설명한 예에서, 양자화된 계수 대신, 잔차 픽셀, 변환 계수 또는 양자화된 변환 계수에 기초한 DPCM을 적용할 수도 있다. 일 예로, 잔차 픽셀에 기초한 DPCM이 적용되는 경우, 잔차 픽셀 rX에 대한 차분값 sX는, 잔차 픽셀 rX로부터 이전 잔차 픽셀 rY을 차분하여 유도될 수 있다.In the above-described embodiment, a DPCM method based on quantized coefficients has been described. In the described example, instead of quantized coefficients, DPCM based on residual pixels, transform coefficients, or quantized transform coefficients may be applied. For example, when DPCM based on the residual pixel is applied, a difference value sX with respect to the residual pixel rX may be derived by differentiating the previous residual pixel rY from the residual pixel rX.
무손실 부호화가 적용된 경우, 양자화가 생략된 잔차 데이터에 DPCM이 적용될 수 있다. 즉, 무손실 부호화가 적용된 경우, 잔차 픽셀 또는 변환 계수에 기초한, DPCM이 적용될 수 있다. When lossless coding is applied, DPCM may be applied to residual data in which quantization is omitted. That is, when lossless coding is applied, DPCM based on residual pixels or transform coefficients may be applied.
무손실 부호화가 적용되지 않은 경우, 현재 블록에 양자화가 적용되었는지 여부를 나타내는 정보(예컨대, 플래그)가 부호화되어 시그날링될 수 있다. 상기 정보에 따라, DPCM이 양자화된 변환 계수를 대상으로 수행되었는지 여부가 결정될 수 있다. 일 예로, 상기 플래그가 양자화가 적용되었음을 가리키는 경우, 양자화된 계수 또는 양자화된 변환 계수를 대상으로 DPCM이 수행된 것으로 결정될 수 있다. 반면, 상기 플래그가 양자화가 적용되지 않았음을 가리키는 경우, 잔차 픽셀 또는 변환 계수를 대상으로 DPCM이 수행된 것으로 결정될 수 있다.When lossless encoding is not applied, information (eg, a flag) indicating whether quantization is applied to the current block may be encoded and signaled. Based on the information, it may be determined whether DPCM is performed on the quantized transform coefficients. For example, when the flag indicates that quantization is applied, it may be determined that DPCM is performed on a quantized coefficient or a quantized transform coefficient. On the other hand, when the flag indicates that quantization is not applied, it may be determined that DPCM is performed on the residual pixel or transform coefficient.
다른 예로, 복원 픽셀에 대해 DPCM을 적용할 수도 있다.As another example, DPCM may be applied to the reconstructed pixel.
DPCM이 적용된 경우, 복호화기는 차분값을 복호화하고, 복호화된 차분값을 이용하여 잔차 데이터를 복원할 수 있다. 일 예로, 인접하는 잔차 데이터 및 차분값을 가산하여, 잔차 데이터를 복원할 수 있다. 잔차 데이터의 종류에 따라, 복원된 잔차 데이터에 역양자화 또는 역변환 중 적어도 하나를 적용하여, 잔차 픽셀이 획득될 수도 있다. When DPCM is applied, the decoder may decode the difference value and reconstruct the residual data using the decoded difference value. As an example, the residual data may be reconstructed by adding adjacent residual data and difference values. A residual pixel may be obtained by applying at least one of inverse quantization or inverse transform to the reconstructed residual data according to the type of residual data.
다음으로, 잔차 데이터를 부호화/복호화하는 방법에 대해 상세히 설명하기로 한다. 후술되는 실시예 에서는, 잔차 데이터가 잔차 계수인 것으로 가정한다. 현재 블록에 변환 및 양자화가 적용되지 않는 경우, 후술되는 잔차 계수 부호화/복호하 방법은 잔차 픽셀을 부호화/복호화하는 것에 이용될 수 있다. 또한, 현재 블록에 DPCM이 적용된 경우, 후술되는 잔차 데이터 부호화/복호화 방법은, 차분값을 부호화/복호화하는 것에 이용될 수 있다. Next, a method of encoding/decoding residual data will be described in detail. In an embodiment to be described later, it is assumed that residual data are residual coefficients. When transform and quantization are not applied to the current block, a residual coefficient encoding/decoding method described later may be used for encoding/decoding the residual pixel. In addition, when DPCM is applied to the current block, a residual data encoding/decoding method described later may be used for encoding/decoding a difference value.
현재 블록 내 0이 아닌 잔차 계수가 존재하는지 여부를 나타내는 플래그가 부호화되어 시그날링될 수 있다. 현재 블록 내 0이 아닌 잔차 계수가 존재하는 경우, 스캔 순서 상 마지막 0이 아닌 잔차 계수의 위치를 부호화할 수 있다. 일 예로, 마지막 0이 아닌 잔차 계수의 x 좌표를 나타내는 신택스 last_x 및 y좌표를 나타내는 신택스 last_y가 부호화되어 시그날링될 수 있다. A flag indicating whether a non-zero residual coefficient exists in the current block may be encoded and signaled. When a non-zero residual coefficient exists in the current block, the position of the last non-zero residual coefficient in the scan order may be encoded. As an example, the syntax last_x indicating the x-coordinate of the last non-zero residual coefficient and the syntax last_y indicating the y-coordinate may be encoded and signaled.
또한, 현재 블록 내 서브 블록 단위로, 서브 블록 내 0이 아닌 잔차 계수가 존재하는지 여부를 나타내는 서브 블록 플래그를 부호화할 수 있다. 일 예로, 마지막 0이 아닌 잔차 계수의 위치를 나타내는 정보를 부호화한 뒤, 서브 블록 별로, 0이 아닌 잔차 계수가 존재하는지 여부를 나타내는 신택스 sub_blk_flag를 부호화하여 시그날링할 수 있다. In addition, a sub-block flag indicating whether a non-zero residual coefficient exists in a sub-block may be encoded in units of sub-blocks in the current block. For example, after encoding information indicating the position of the last non-zero residual coefficient, the syntax sub_blk_flag indicating whether a non-zero residual coefficient exists for each sub-block may be encoded and signaled.
서브 블록 내 0이 아닌 잔차 계수가 존재하는 경우, 스캔 순서에 따라, 각 잔차 계수에 대한 정보가 추가 부호화될 수 있다.When a non-zero residual coefficient exists in a subblock, information on each residual coefficient may be additionally encoded according to a scan order.
이때, 마지막 0이 아닌 잔차 계수를 포함하는 서브 블록보다 스캔 순번이 빠른 서브 블록에 대해서는, 서브 블록 플래그의 부호화가 생략될 수 있다. 상기 서브 블록에는, 0이 아닌 잔차 계수가 포함되지 않는 바, 서브 블록 플래그의 값이 0으로 간주될 수 있다.In this case, for a subblock having a scan order earlier than that of the subblock including the last non-zero residual coefficient, encoding of the subblock flag may be omitted. Since non-zero residual coefficients are not included in the sub-block, the value of the sub-block flag may be regarded as zero.
또한, 마지막 0이 아닌 잔차 계수를 포함하는 서브 블록에 대해서는, 서브 블록 플래그의 부호화를 생략할 수도 있다. 상기 서브 블록에는 0이 아닌 잔차 계수가 반드시 포함되는 바, 서브 블록 플래그의 값이 1로 간주될 수 있다. Also, for a subblock including the last non-zero residual coefficient, encoding of the subblock flag may be omitted. Since a non-zero residual coefficient is necessarily included in the sub-block, the value of the sub-block flag may be regarded as 1.
다른 예로, 마지막 0이 아닌 잔차 계수의 위치 정보의 부호화를 생략할 수 있다. 마지막 0이 아닌 잔차 계수의 위치 정보의 부호화가 생략되는 경우, 현재 블록 내 모든 서브 블록들에 대해 서브 블록 플래그가 부호화될 수 있다. As another example, encoding of location information of the last non-zero residual coefficient may be omitted. When the encoding of the position information of the last non-zero residual coefficient is omitted, sub-block flags may be encoded for all sub-blocks in the current block.
이때, 스캔 순번이 마지막 서브 블록을 제외한 잔여 서브 블록들에 0이 아닌 잔차 계수가 포함되지 않은 것으로 결정되는 경우, 마지막 서브 블록에는 0이 아닌 잔차 계수가 반드시 포함되는 것으로 이해될 수 있다. 이에 따라, 마지막 서브 블록에 대해서는 서브 블록 플래그의 부호화를 생략하고, 그 값이 1인 것으로 간주할 수 있다. In this case, when it is determined that non-zero residual coefficients are not included in the remaining sub-blocks except for the last sub-block in the scan order, it may be understood that the non-zero residual coefficients are necessarily included in the last sub-block. Accordingly, for the last sub-block, encoding of the sub-block flag may be omitted and the value may be regarded as 1.
마지막 0이 아닌 계수의 위치 정보가 부호화었는지 여부를 나타내는 정보가 추가 부호화될 수도 있다. 마지막 0이 아닌 계수의 위치 정보가 부호화되는 경우, 상기 정보의 값은 1로 설정될 수 있다. 이 경우, 마지막 0이 아닌 계수가 존재하는 서브 블록부터 서브 블록 플래그가 부호화될 수 있다. 반면, 마지막 0이 아닌 계수의 위치 정보가 부호화되지 않는 경우, 상기 정보의 값은 0으로 설정될 수 있다. 이 경우, 스캔 순서가 첫번째인 서브 블록부터 서브 블록 플래그가 부호화될 수 있다.Information indicating whether position information of the last non-zero coefficient is encoded may be additionally encoded. When the location information of the last non-zero coefficient is encoded, the value of the information may be set to 1. In this case, the sub-block flag may be coded from the sub-block in which the last non-zero coefficient exists. On the other hand, when the location information of the last non-zero coefficient is not encoded, the value of the information may be set to 0. In this case, the sub-block flag may be coded from the sub-block having the first scan order.
무손실 부호화가 적용되는 경우에는, 마지막 잔차 계수의 위치를 나타내는 정보(예컨대, 신택스 last_x 및 last_y)의 부호화를 생략할 수 있다.When lossless encoding is applied, encoding of information indicating the position of the last residual coefficient (eg, syntax last_x and last_y) may be omitted.
또는, 무손실 부호화가 적용되는 경우, 마지막 잔차 계수의 위치를 나타내는 정보를 부호화하되, 서브 블록 플래그의 부호화를 생략할 수 있다. 이 경우, 마지막 잔차 계수를 포함하는 서브 블록부터 변환 계수들을 부호화할 수 있다. Alternatively, when lossless encoding is applied, information indicating the position of the last residual coefficient may be encoded, but encoding of the sub-block flag may be omitted. In this case, transform coefficients may be encoded starting from the subblock including the last residual coefficient.
또는, 무손실 부호화가 적용되는 경우, 마지막 잔차 계수의 위치를 나타내는 정보 및 서브 블록 플래그를 모두 부호화하지 않을 수도 있다. 이 경우, 모든 서브 블록이 0이 아닌 잔차 계수를 포함하는 것으로 추정할 수 있다. 이에 따라, 스캔 순서 상 첫번째 서브 블록부터 마지막 서브 블록까지 순차적으로 잔차 계수가 부호화될 수 있다. Alternatively, when lossless encoding is applied, both information indicating the position of the last residual coefficient and the sub-block flag may not be encoded. In this case, it can be estimated that all sub-blocks include non-zero residual coefficients. Accordingly, residual coefficients may be sequentially encoded from the first sub-block to the last sub-block in the scan order.
현재 블록에 0이 아닌 잔차 계수가 존재하는 경우, 상기 현재 블록 내 첫번째 서브 블록에 대해서는, 0이 아닌 잔차 계수가 반드시 포함되는 것으로 가정할 수 있다. 이에 따라, 첫번째 서브 블록에 대해서는 0이 아닌 잔차 계수가 존재하는지 여부를 나타내는 서브 블록 플래그의 부호화를 생략할 수 있다. When a non-zero residual coefficient exists in the current block, it may be assumed that a non-zero residual coefficient is necessarily included in the first sub-block in the current block. Accordingly, encoding of a sub-block flag indicating whether a non-zero residual coefficient exists in the first sub-block may be omitted.
각 잔차 계수에 관한 정보는, 잔차 계수가 0이 아닌 값을 갖는지 여부를 나타내는 플래그, 잔차 계수의 크기를 나타내는 정보 및 잔차 계수의 부호를 나타내는 정보 중 적어도 하나를 포함할 수 있다.The information on each residual coefficient may include at least one of a flag indicating whether the residual coefficient has a non-zero value, information indicating a size of the residual coefficient, and information indicating a sign of the residual coefficient.
소정의 스캔 순서에 따라 잔차 계수들을 부호화할 수 있다. 이때, 현재 블록에 변환이 스킵되었는지 여부에 기초하여, 잔차 계수들의 부호화 순서가 상이할 수 있다. 일 예로, 현재 블록에 변환이 스킵되지 않은 경우, 서브 블록 내 우측 하단에 위치하는 잔차 계수가 첫번째로 부호화되고, 좌측 상단에 위치하는 잔차 계수가 마지막으로 부호화될 수 있다. 즉, 역-대각 스캔, 역-수평 스캔 또는 역-수직 스캔을 따라 잔차 계수들 간 스캔 순번이 결정될 수 있다. 반면, 현재 블록에 변환이 스킵된 경우, 서브 블록 내 좌측 상단에 위치하는 잔차 계수가 첫번째로 부호화되고, 우측 하단에 위치하는 잔차 계수가 마지막으로 부호화될 수 있다. 즉, 대각 스캔, 수평 스캔 또는 수직 스캔을 따라 잔차 계수들 간 스캔 순번이 결정될 수 있다. Residual coefficients may be encoded according to a predetermined scan order. In this case, the encoding order of the residual coefficients may be different based on whether the transform is skipped in the current block. For example, when a transform is not skipped in the current block, a residual coefficient located at the lower right of the subblock may be encoded first, and the residual coefficient located at the upper left of the subblock may be encoded last. That is, a scan order between residual coefficients may be determined according to an inverse-diagonal scan, an inverse-horizontal scan, or an inverse-vertical scan. On the other hand, when the transform is skipped in the current block, the residual coefficient located at the upper left of the subblock may be encoded first, and the residual coefficient located at the lower right of the subblock may be encoded last. That is, a scan order between residual coefficients may be determined along a diagonal scan, a horizontal scan, or a vertical scan.
또는, 현재 블록에 변환이 스킵된 경우에도, 역-대각 스캔, 역-수평 스캔 또는 역-수직 스캔을 따라 잔차 계수들 간 스캔 순번을 결정할 수도 있다. Alternatively, even when a transform is skipped in the current block, a scan order between residual coefficients may be determined according to an inverse-diagonal scan, an inverse-horizontal scan, or an inverse-vertical scan.
잔차 계수들의 스캔 순서는 부호화기 및 복호화기에서 기 정의되어 있을 수 있다. 또는, 잔차 계수들의 스캔 순서를 나타내는 정보가 부호화되어 시그날링될 수 있다. 또는, 현재 블록의 크기, 형태, 인트라 예측 모드, 변환이 스킵되었는지 여부, 2차 변환이 수행되었는지 여부 또는 DPCM 방향 중 적어도 하나에 기초하여 스캔 순서가 결정될 수 있다. The scan order of the residual coefficients may be predefined in the encoder and the decoder. Alternatively, information indicating a scan order of residual coefficients may be encoded and signaled. Alternatively, the scan order may be determined based on at least one of the size, shape, intra prediction mode, whether the transform is skipped, whether the secondary transform is performed, or the DPCM direction of the current block.
도 16은 부호화기에서 잔차 계수를 부호화하는 과정을 나타낸 흐름도이다. 16 is a flowchart illustrating a process of encoding residual coefficients in an encoder.
먼저, 잔차 계수가 0이 아닌 값을 갖는지 여부를 나타내는 플래그, sig_flag를 부호화할 수 있다(S1610). 잔차 계수의 값이 0인 경우, 플래그 sig_flag의 값을 0으로 설정하여 부호화할 수 있다. 반면, 잔차 계수의 값이 0이 아닌 경우, 플래그 sig_flag의 값을 1로 설정하여 부호화할 수 있다. 잔차 계수의 값이 0이 아닌 경우, 잔차 계수의 크기 정보가 더 부호화될 수 있다(S1620).First, a flag indicating whether the residual coefficient has a non-zero value, sig_flag, may be coded ( S1610 ). When the value of the residual coefficient is 0, encoding may be performed by setting the value of the flag sig_flag to 0. On the other hand, when the value of the residual coefficient is not 0, encoding may be performed by setting the value of the flag sig_flag to 1. When the value of the residual coefficient is not 0, information on the magnitude of the residual coefficient may be further encoded (S1620).
도 17은 잔차 계수의 크기 정보의 부호화 과정을 나타낸 흐름도이다.17 is a flowchart illustrating a process of encoding size information of residual coefficients.
적어도 하나 이상의 gt_N_flag를 이용하여, 잔차 계수의 절대값을 부호화할 수 있다. 여기서, N은, 1 이상의 자연수일 수 있다. 플래그 gt_N_flag는 잔차 계수의 절대값이 2(N-1) 보다 큰 값을 갖는지 여부를 나타낼 수 있다. 잔차 계수의 절대값을 부호화하는데 이용되는 gt_N_flag의 개수는, 현재 블록에 변환이 스킵되었는지 여부에 기초하여 결정될 수 있다. 일 예로, 현재 블록에 변환이 스킵되지 않은 경우, 2개의 gt_N_flag(N은 1부터 2)가 이용될 수 있다. 반면, 현재 블록에 변환이 스킵된 경우, 3개 이상의 gt_N_flag (예컨대, 3개, 4개, 또는 5개)가 이용될 수 있다. 일 예로, gt_N_flag의 최대 개수가 2개인 것은, 절대값이 3을 초과하는 잔차 계수부터 잔여 크기를 나타내는 신택스 rem_level이 부호화됨을 나타낸다. 반면, gt_N_flag의 최대 개수가 5개인 것은, 절대값이 9를 초과하는 잔차 계수부터 잔여 크기를 나타내는 신택스 rem_level이 부호화됨을 나타낸다. 후술되는 실시예에서는, 2개의 gt_N_flag가 이용되는 것으로 가정한다. An absolute value of the residual coefficient may be encoded using at least one or more gt_N_flags. Here, N may be a natural number of 1 or more. The flag gt_N_flag may indicate whether the absolute value of the residual coefficient has a value greater than 2 (N-1). The number of gt_N_flags used to encode the absolute value of the residual coefficient may be determined based on whether a transform is skipped in the current block. For example, when a transform is not skipped in the current block, two gt_N_flags (N is 1 to 2) may be used. On the other hand, when the transform is skipped in the current block, three or more gt_N_flags (eg, three, four, or five) may be used. As an example, the maximum number of gt_N_flags of 2 indicates that the syntax rem_level indicating the residual size from the residual coefficient whose absolute value exceeds 3 is encoded. On the other hand, the fact that the maximum number of gt_N_flags is 5 indicates that the syntax rem_level indicating the residual size from the residual coefficient whose absolute value exceeds 9 is encoded. In the embodiment described below, it is assumed that two gt_N_flags are used.
잔차 계수의 절대값이 1보다 큰지 여부를 나타내는 플래그 gt1_flag를 부호화할 수 있다(S1710). 잔차 계수의 절대값이 1인 경우, 플래그 gt1_flag의 값을 0으로 설정하여 부호화할 수 있다. 반면, 잔차 계수의 절대값이 1보다 큰 경우, 플래그 gt1_flag의 값을 1로 설정하여 부호화할 수 있다. A flag gt1_flag indicating whether the absolute value of the residual coefficient is greater than 1 may be encoded ( S1710 ). When the absolute value of the residual coefficient is 1, encoding can be performed by setting the value of the flag gt1_flag to 0. On the other hand, when the absolute value of the residual coefficient is greater than 1, encoding can be performed by setting the value of the flag gt1_flag to 1.
잔차 계수의 절대값이 1보다 큰 경우, 잔차 계수의 절대값이 짝수인지 또는 홀수인지 여부를 나타내는 플래그 par_flag를 부호화할 수 있다(S1720). 잔차 계수의 절대값이 짝수인 경우, 플래그 par_flag를 0으로 설정하여 부호화할 수 있다. 반면, 잔차 계수의 절대값이 홀수인 경우, 플래그 par_flag를 1로 설정하여 부호화할 수 있다. 또는, 이와 반대로, 잔차 계수의 절대값이 짝수인 경우, 플래그 par_flag를 1로 설정하고, 잔차 계수의 절대값이 홀수인 경우, 플래그 par_flag를 0으로 설정할 수도 있다. When the absolute value of the residual coefficient is greater than 1, a flag par_flag indicating whether the absolute value of the residual coefficient is an even number or an odd number may be encoded (S1720). When the absolute value of the residual coefficient is an even number, it can be encoded by setting the flag par_flag to 0. On the other hand, when the absolute value of the residual coefficient is an odd number, encoding may be performed by setting the flag par_flag to 1. Alternatively, conversely, when the absolute value of the residual coefficient is an even number, the flag par_flag may be set to 1, and when the absolute value of the residual coefficient is an odd number, the flag par_flag may be set to 0.
다음으로, 잔차 계수의 절대값이 3보다 큰지 여부를 나타내는 플래그 gt_2_flag를 부호화할 수 있다(S1730). 잔차 계수의 절대값이 3 이하인 경우, 플래그 gt_2_flag의 값을 0으로 설정할 수 있다. 반면, 잔차 계수의 절대값이 3보다 큰 경우, 플래그 gt_2_flag의 값을 1로 설정할 수 있다.Next, a flag gt_2_flag indicating whether the absolute value of the residual coefficient is greater than 3 may be encoded ( S1730 ). When the absolute value of the residual coefficient is 3 or less, the value of the flag gt_2_flag may be set to 0. On the other hand, when the absolute value of the residual coefficient is greater than 3, the value of the flag gt_2_flag may be set to 1.
잔차 계수의 절대값이 3보다 큰 경우, 잔여 크기를 나타내는 rem_level을 부호화할 수 있다(S1740). 신택스 rem_level은, 잔차 계수의 절대값에서 4를 차분하여 유도된 값을 오른쪽으로 1만큼 시프팅하여 유도될 수 있다.When the absolute value of the residual coefficient is greater than 3, rem_level indicating the residual size may be coded (S1740). The syntax rem_level may be derived by shifting a value derived by subtracting 4 from the absolute value of the residual coefficient to the right by 1.
도 17에 도시된, gt_1_flag 및 gt_2_flag 플래그 이외에도, gt_3_flag, gt_4_flag 또는 gt_5_flag 등과 같은, gt_N_flag가 추가 부호화될 수 있다. 이때, gt_(N-1)_flag의 값이 1인 경우, gt_N_flag가 추가 부호화될 수 있다.In addition to the gt_1_flag and gt_2_flag flags shown in FIG. 17, gt_N_flag, such as gt_3_flag, gt_4_flag or gt_5_flag, may be further encoded. In this case, when the value of gt_(N-1)_flag is 1, gt_N_flag may be additionally encoded.
gt_N_flag는, 잔차 계수의 절대값이, (2N-1)보다 큰 값을 갖는지 여부를 나타낼 수 있다. gt_N_flag가 추가 이용되는 경우, rem_level은, 잔차 계수의 절대값에서 2N을 차분하여 유도된 값을 오른쪽으로 1만큼 시프팅하여 유도될 수 있다. gt_N_flag may indicate whether the absolute value of the residual coefficient has a value greater than (2N-1). When gt_N_flag is additionally used, rem_level may be derived by shifting a value derived by subtracting 2N from the absolute value of the residual coefficient to the right by 1.
설명한 예에서와 같이, sig_flag가 1인 경우, sign_flag 및 gt_1_flag가 부호화되어 시그날링될 수 있다. 또한, gt_1_flag가 1인 경우, parity_flag 및 gt_2_flag가 추가 부호화되어 시그날링될 수 있다. As in the described example, when sig_flag is 1, sign_flag and gt_1_flag may be encoded and signaled. Also, when gt_1_flag is 1, parity_flag and gt_2_flag may be additionally encoded and signaled.
마지막 gt_N_flag가 참인 경우, 잔여 계수를 나타내는 rem_level이 부호화되어 시그날링될 수 있다. 신택스 rem_level은, 잔차 계수의 절대값에서, gt_N_flag에 의해 지시 가능한 최대값에 1을 가산한 값(즉, 2N)과의 차분을 나타낼 수 있다.When the last gt_N_flag is true, rem_level indicating the residual coefficient may be encoded and signaled. The syntax rem_level may indicate a difference from the absolute value of the residual coefficient with a value obtained by adding 1 to the maximum value indicated by gt_N_flag (ie, 2N).
상술한 예에서는, sig_flag, gt_1_flag, par_flag, gt_2_flag 및 rem_level을 이용하여, 잔차 계수의 절대값이 부호화되는 것으로 예시되었다. 다른 예로, 잔차 계수의 절대값을 그대로 부호화할 수도 있다. 일 예로, 잔차 계수의 절대값을 나타내는 신택스 abs_level가 부호화될 수 있다. 잔차 계수의 절대값의 부호화 방법을 선택하는 방법에 대해서는 후술하기로 한다. In the above example, it has been exemplified that the absolute value of the residual coefficient is encoded using sig_flag, gt_1_flag, par_flag, gt_2_flag, and rem_level. As another example, the absolute value of the residual coefficient may be encoded as it is. As an example, the syntax abs_level indicating the absolute value of the residual coefficient may be encoded. A method of selecting the encoding method of the absolute value of the residual coefficient will be described later.
잔차 계수의 크기 정보를 부호화한 이후, 잔차 계수의 부호를 나타내는 플래그 sign_flag를 부호화할 수 있다(S1630). 플래그 sign_flag의 값이 0인 것은, 잔차 계수가 양수임을 나타낸다. 반면, 플래그 sign_flag의 값이 1인 것은, 잔차 계수가 음수임을 나타낸다.After encoding the size information of the residual coefficient, a flag sign_flag indicating the sign of the residual coefficient may be encoded (S1630). A value of the flag sign_flag of 0 indicates that the residual coefficient is positive. On the other hand, the value of the flag sign_flag being 1 indicates that the residual coefficient is negative.
표 1은, 잔차 계수의 값이 -21이고, 2개의 gt_N_flag가 이용된 경우, 각 신택스들에 할당되는 값을 나타낸 것이다. Table 1 shows the values assigned to each syntax when the value of the residual coefficient is -21 and two gt_N_flags are used.
구분division 수식Equation value
잔차 계수(Coeff)Residual Coefficient (Coeff) coeffcoeff -21-21
sig_flagsig_flag coeff != 0coeff != 0 1One
gt_1_flaggt_1_flag !! (|coeff|-1)!! (|coeff|-1) 1One
par_flag par_flag (|coeff|-2) & 1(|coeff|-2) & 1 1One
gt_2_flaggt_2_flag (|coeff|-2) >> 1(|coeff|-2) >> 1 1One
rem_levelrem_level (|coeff|-4) >> 1(|coeff|-4) >> 1 88
sign_flagsign_flag 1One
표 1에서, coeff는 잔차 계수의 값을 나타내고, '수식' 항목은 각 신택스들의 값을 유도하기 위해 사용되는 수식을 나타낸다. 표 2는, 잔차 계수의 값이 -21이고, 5개의 gt_N_flag가 이용된 경우, 각 신택스들에 할당되는 값을 나타낸 것이다. In Table 1, coeff represents the value of the residual coefficient, and the 'Formula' item represents the formula used to derive the value of each syntax. Table 2 shows values assigned to each syntax when the value of the residual coefficient is -21 and five gt_N_flags are used.
구분division 수식Equation value
잔차 계수(Coeff)Residual Coefficient (Coeff) coeffcoeff -21-21
sig_flagsig_flag coeff != 0coeff != 0 1One
gt_1_flaggt_1_flag !! (|coeff|-1)!! (|coeff|-1) 1One
par_flag par_flag (|coeff|-2) & 1(|coeff|-2) & 1 1One
gt_2_flaggt_2_flag |coeff| >= 4|coeff| >= 4 1One
gt_3_flaggt_3_flag |coeff| >= 6|coeff| >= 6 1One
gt_4_flaggt_4_flag |coeff| >= 8|coeff| >= 8 1One
gt_5_flaggt_5_flag |coeff| >= 10|coeff| >= 10 1One
rem_levelrem_level (|coeff|-10) >> 1(|coeff|-10) >> 1 55
sign_flagsign_flag 1One
도 18은 복호화기에서 잔차 계수를 복호화하는 과정을 나타낸 흐름도이다. 서브 블록 내 0이 아닌 잔차 계수가 포함되는 것으로 결정된 경우, 소정 스캔 순서에 기초하여, 잔차 계수들을 복원할 수 있다.18 is a flowchart illustrating a process of decoding a residual coefficient in a decoder. When it is determined that non-zero residual coefficients are included in the subblock, the residual coefficients may be reconstructed based on a predetermined scan order.
먼저, 잔차 계수가 0이 아닌 값을 갖는지 여부를 나타내는 플래그, sig_flag를 복호화할 수 있다(S1810). 플래그 sig_flag의 값이 0인 것은, 잔차 계수의 값이 0임을 나타낸다. 반면, 플래그 sig_flag의 값이 1인 것은, 잔차 계수의 값이 0이 아님을 나타낸다. 플래그 sig_flag의 값이 1인 경우, 잔차 계수의 크기 정보가 더 복호화될 수 있다(S1820).First, a flag indicating whether the residual coefficient has a non-zero value, sig_flag, may be decoded ( S1810 ). A value of the flag sig_flag of 0 indicates that the value of the residual coefficient is 0. On the other hand, the value of the flag sig_flag being 1 indicates that the value of the residual coefficient is not 0. When the value of the flag sig_flag is 1, information on the magnitude of the residual coefficient may be further decoded (S1820).
도 19는 잔차 계수의 크기 정보의 복호화 과정을 나타낸 도면이다.19 is a diagram illustrating a decoding process of size information of residual coefficients.
설명의 편의를 위해, 잔차 계수는 최대 2개의 gt_N_flag를 이용하여 부호화된 것으로 가정한다. For convenience of description, it is assumed that the residual coefficients are coded using a maximum of two gt_N_flags.
잔차 계수의 절대값이 1보다 큰지 여부를 나타내는 플래그 gt1_flag를 복호화할 수 있다(S1910). 플래그 gt_1_flag의 값이 0인 것은, 잔차 계수의 절대값이 1임을 나타낸다. 반면, 플래그 gt_1_flag의 값이 1인 것은, 잔차 계수의 절대값이 1보다 큼을 나타낸다.A flag gt1_flag indicating whether the absolute value of the residual coefficient is greater than 1 may be decoded ( S1910 ). A value of the flag gt_1_flag of 0 indicates that the absolute value of the residual coefficient is 1. On the other hand, the value of the flag gt_1_flag being 1 indicates that the absolute value of the residual coefficient is greater than 1.
플래그 gt_1_flag의 값이 1인 경우, 잔차 계수의 절대값이 짝수인지 또는 홀수인지 여부를 나타내는 플래그 par_flag를 복호화할 수 있다(S1920). 플래그 par_flag의 값이 0인 것은, 잔차 계수의 절대값이 짝수임을 나타내고, 플래그 par_flag의 값이 1인 것은, 잔차 계수의 절대값이 홀수임을 나타낸다.When the value of the flag gt_1_flag is 1, the flag par_flag indicating whether the absolute value of the residual coefficient is an even number or an odd number may be decoded ( S1920 ). A value of the flag par_flag of 0 indicates that the absolute value of the residual coefficient is an even number, and a value of the flag par_flag of 1 indicates that the absolute value of the residual coefficient is an odd number.
다음으로, 잔차 계수의 절대값이 3보다 큰지 여부를 나타내는 플래그 gt_2_flag를 복호화할 수 있다(S1930). 플래그 gt_2_flag의 값이 0인 것은, 잔차 계수의 절대값이 3보다 작음을 나타낸다. 플래그 gt_2_flag의 값이 0인 경우, 플래그 par_flag의 값에 따라, 잔차 계수의 절대값이 2 또는 3으로 결정될 수 있다.Next, a flag gt_2_flag indicating whether the absolute value of the residual coefficient is greater than 3 may be decoded ( S1930 ). A value of the flag gt_2_flag equal to 0 indicates that the absolute value of the residual coefficient is less than 3. When the value of the flag gt_2_flag is 0, the absolute value of the residual coefficient may be determined to be 2 or 3 according to the value of the flag par_flag.
플래그 gt_2_flag의 값이 1인 것은, 잔차 계수의 절대값이 3보다 큼을 나타낸다. A value of the flag gt_2_flag of 1 indicates that the absolute value of the residual coefficient is greater than 3.
플래그 gt_2_flag의 값이 1인 경우, 잔여 크기를 나타내는 rem_level을 복호화할 수 있다(S1940). 신택스 rem_level를 나타내는 값을 왼쪽으로 1만큼 시프팅하여 유도된 값에, 3 또는 4를 더하여, 잔차 계수의 절대값을 유도할 수 있다.When the value of the flag gt_2_flag is 1, rem_level indicating the residual size may be decoded (S1940). An absolute value of the residual coefficient may be derived by adding 3 or 4 to a value derived by shifting the value representing the syntax rem_level to the left by 1.
도 19에 도시된, gt_1_flag 및 gt_2_flag 플래그 이외에도, gt_3_flag, gt_4_flag 또는 gt_5_flag 등과 같은, gt_N_flag가 추가 복호화될 수 있다. 이때, gt_(N-1)_flag의 값이 1인 경우, gt_N_flag가 추가 복호화될 수 있다.In addition to the gt_1_flag and gt_2_flag flags shown in FIG. 19, gt_N_flag, such as gt_3_flag, gt_4_flag, or gt_5_flag, may be further decoded. In this case, when the value of gt_(N-1)_flag is 1, gt_N_flag may be further decoded.
gt_N_flag는, 잔차 계수의 절대값이, (2N-1)보다 큰 값을 갖는지 여부를 나타낼 수 있다. gt_N_flag가 추가 이용되는 경우, rem_level은, 잔차 계수의 절대값에서 2N을 차분하여 유도된 값을 오른쪽으로 1만큼 시프팅하여 유도되는 값으로 설정될 수 있다. gt_N_flag may indicate whether the absolute value of the residual coefficient has a value greater than (2N-1). When gt_N_flag is additionally used, rem_level may be set to a value derived by shifting a value derived by differentiating 2N from the absolute value of the residual coefficient by 1 to the right.
상술한 예에서는, sig_flag, gt_1_flag, par_flag, gt_2_flag 및 rem_level을 이용하여, 잔차 계수의 절대값이 복호화되는 것으로 예시되었다. 다른 예로, 잔차 계수의 절대값을 그대로 복호화할 수도 있다. 일 예로, 잔차 계수의 절대값을 나타내는 신택스 abs_level가 복호화될 수 있다. 잔차 계수의 절대값의 복호화 방법을 선택하는 방법에 대해서는 후술하기로 한다. In the above-described example, it is exemplified that the absolute value of the residual coefficient is decoded using sig_flag, gt_1_flag, par_flag, gt_2_flag, and rem_level. As another example, the absolute value of the residual coefficient may be decoded as it is. As an example, the syntax abs_level indicating the absolute value of the residual coefficient may be decoded. A method of selecting a decoding method for the absolute value of the residual coefficient will be described later.
잔차 계수의 크기 정보를 복호화한 이후, 잔차 계수의 부호를 나타내는 플래그 sign_flag를 복호화할 수 있다(S1830). 플래그 sign_flag의 값이 0인 것은, 잔차 계수가 양수임을 나타낸다. 반면, 플래그 sign_flag의 값이 1인 것은, 잔차 계수가 음수임을 나타낸다.After decoding the size information of the residual coefficient, a flag sign_flag indicating the sign of the residual coefficient may be decoded (S1830). A value of the flag sign_flag of 0 indicates that the residual coefficient is positive. On the other hand, the value of the flag sign_flag being 1 indicates that the residual coefficient is negative.
표 3은, 2개의 gt_N_flag가 이용하여, 값이 -21인 잔차 계수를 복호화하는 예를 나타낸 것이다. Table 3 shows an example of decoding a residual coefficient with a value of -21 using two gt_N_flags.
구분division value 수식Equation
sig_flagsig_flag 1One --
gt_1_flaggt_1_flag 1One --
par_flag par_flag 1One --
gt_2_flaggt_2_flag 1One --
tmp_coeff tmp_coeff 55 1+gt_1_flag+par_flag+(gt_2_flag <<1)1+gt_1_flag+par_flag+(gt_2_flag <<1)
rem_levelrem_level 88
sign_flagsign_flag 1One sign = (sign_flag == 1 ? -1 : 1)sign = (sign_flag == 1 ? -1 : 1)
잔차계수(coeff)residual coefficient (coeff) -21-21 tmp_coeff + (rem_level<<1) * signtmp_coeff + (rem_level<<1) * sign
표 3에서, 변수 tmp_coeff는 임시 복원 계수를 나타낸다. gt_2_flag의 값이 0인 경우, 임시 복원 계수 tmp_coeff가 잔차 계수의 절대값으로 설정될 수 있다. 반면, gt_2_flag의 값이 1인 경우, 신택스 rem_level에 기초하여 임시 복원 계수 tmp_coeff를 업데이트함으로서, 잔차 계수의 절대값을 유도할 수 있다. 표 4는, 5개의 gt_N_flag를 이용하여, 값이 -21인 잔차 계수를 복호화하는 예를 나타낸 것이다. In Table 3, the variable tmp_coeff represents a temporary restoration coefficient. When the value of gt_2_flag is 0, the temporary restoration coefficient tmp_coeff may be set as an absolute value of the residual coefficient. On the other hand, when the value of gt_2_flag is 1, the absolute value of the residual coefficient can be derived by updating the temporary restoration coefficient tmp_coeff based on the syntax rem_level. Table 4 shows an example of decoding a residual coefficient having a value of -21 using five gt_N_flags.
구분division value 수식Equation
sig_flagsig_flag 1One --
gt_1_flaggt_1_flag 1One --
par_flag par_flag 1One --
tmp_coeff tmp_coeff 55 1+gt_1_flag+par_flag1+gt_1_flag+par_flag
gt_2_flaggt_2_flag 1One tmp_coeff += (sig_2_flag <<1)tmp_coeff += (sig_2_flag <<1)
gt_3_flaggt_3_flag 1One tmp_coeff += (sig_3_flag <<1)tmp_coeff += (sig_3_flag <<1)
gt_4_flaggt_4_flag 1One tmp_coeff += (sig_4_flag <<1)tmp_coeff += (sig_4_flag <<1)
gt_5_flaggt_5_flag 1One tmp_coeff += (sig_5_flag <<1)tmp_coeff += (sig_5_flag <<1)
rem_levelrem_level 55 tmp_coeff += (rem_level << 1)tmp_coeff += (rem_level << 1)
sign_flagsign_flag 1One sign = (sign_flag == 1 ? -1 : 1)sign = (sign_flag == 1 ? -1 : 1)
잔차계수(coeff)residual coefficient (coeff) -21-21 tmp_coeff + (rem_level<<1) * signtmp_coeff + (rem_level<<1) * sign
표 3에서, 변수 tmp_coeff는 임시 복원 계수를 나타낸다. gt_N_flag가 0인 경우, 임시 복원 계수 tmp_coeff가 잔차 계수의 절대값으로 설정될 수 있다. 반면, gt_N_flag가 1인 경우, 임시 복원 계수를 업데이트(예컨대, tmp_coeff += sig_N_flag <<1) 하고, 다음 신택스를 파싱할 수 있다. 설명한 바와 같이, 잔차 계수는 적어도 하나의 신택스에 의해 부호화될 수 있다. 신택스(들)의 이진화 과정을 거쳐 잔차 계수가 다수의 빈(bin)으로 변경될 수 있고, 변경된 빈들이 엔트로피 부호화를 통해 부호화될 수 있다. In Table 3, the variable tmp_coeff represents a temporary restoration coefficient. When gt_N_flag is 0, the temporary restoration coefficient tmp_coeff may be set as an absolute value of the residual coefficient. On the other hand, when gt_N_flag is 1, the temporary restoration coefficient may be updated (eg, tmp_coeff += sig_N_flag << 1), and the following syntax may be parsed. As described, the residual coefficient may be encoded by at least one syntax. A residual coefficient may be changed into a plurality of bins through a binarization process of the syntax(s), and the changed bins may be encoded through entropy encoding.
엔트로피 부호화는, 문맥(context) 정보를 이용한 부호화 및 문맥 정보를 이용하지 않는 부호화로 구분될 수 있다. 문맥은, 빈의 값이 0일 확률 또는 1일 확률을 나타낸다.Entropy encoding may be divided into encoding using context information and encoding not using context information. The context indicates the probability that the value of the bin is 0 or 1.
문맥 정보를 이용하여 부호화되는 빈들의 개수를 제한하기 위해, 임계값을 설정할 수 있다. 상기 임계값은, 블록 마다 개별적으로 설정될 수 있다. 생성된 빈들 중 카운트 값이 임계값보다 작은 빈은 문맥 정보를 이용한 부호화가 수행된다. 카운트 값이 임계값 이상이 되는 경우, 더 이상 문맥 정보를 이용한 부호화를 사용하지 않을 수 있다.In order to limit the number of bins to be encoded using context information, a threshold may be set. The threshold value may be individually set for each block. Among the generated bins, a bin having a count value smaller than a threshold value is encoded using context information. When the count value is greater than or equal to the threshold, encoding using context information may no longer be used.
임계값은 현재 블록 내, 0이 아닌 잔차 계수들의 개수에 기초하여 결정될 수 있다. 일 예로, 현재 블록 내 0이 아닌 잔차 계수들의 개수에 실수를 곱한 값 또는 오프셋을 가산 또는 감산한 값이 임계값으로 설정될 수 있다.The threshold value may be determined based on the number of non-zero residual coefficients in the current block. For example, a value obtained by multiplying the number of non-zero residual coefficients in the current block by a real number or by adding or subtracting an offset may be set as the threshold value.
또는, 현재 블록이 포함하는 화소들의 개수에 기초하여 임계값이 결정될 수 있다. 일 예로, 현재 블록 내 화소들의 개수에 실수를 곱한 값 또는 오프셋을 가산 또는 감산한 값을 임계값으로 설정될 수 있다. Alternatively, the threshold value may be determined based on the number of pixels included in the current block. For example, a value obtained by multiplying the number of pixels in the current block by a real number or by adding or subtracting an offset may be set as the threshold value.
또는, 임계값을 나타내는 정보가 비트스트림을 통해 시그날링될 수 있다. 상기 정보는, 시퀀스, 픽처 헤더 또는 슬라이스 헤더와 같은 상위 헤더를 통해 부호화될 수 있다. Alternatively, information indicating a threshold value may be signaled through a bitstream. The information may be encoded through an upper header such as a sequence, picture header, or slice header.
또는, 현재 블록의 크기 또는 형태 중 적어도 하나에 기초하여, 임계값이 결정될 수 있다. 일 예로, 블록의 크기 또는 형태별로 임계값을 기 정의한 뒤, 현재 블록의 크기 또는 형태에 대응하는 임계값을 호출하여 사용할 수 있다. 또는, 현재 블록의 크기 또는 형태에 대응하는 복수개의 임계값 후보들 중 하나를 특정하는 정보를 부호화여 시그날링할 수 있다. Alternatively, the threshold value may be determined based on at least one of the size and shape of the current block. For example, after a threshold value is previously defined for each size or shape of a block, a threshold value corresponding to the size or shape of the current block may be called and used. Alternatively, information specifying one of a plurality of threshold value candidates corresponding to the size or shape of the current block may be encoded and signaled.
또는, 변환 스킵이 적용되었는지 여부, 현재 블록에 적용되는 변환 커널 또는 양자화 파라미터 중 적어도 하나에 기초하여, 임계값이 결정될 수 있다. Alternatively, the threshold value may be determined based on at least one of whether transform skip is applied, a transform kernel applied to the current block, or a quantization parameter.
문맥 정보를 이용하여 부호화되는 빈의 개수를 카운팅할 때, 마지막 0이 아닌 잔차 계수의 위치를 나타내는 정보를 부호화할 시, 카운터가 동작하지 않도록 설정할 수 있다. 즉, 상기 정보는 카운팅 대상에서 제외될 수 있다.When counting the number of bins to be encoded using context information, when information indicating the position of the last non-zero residual coefficient is encoded, the counter may be set not to operate. That is, the information may be excluded from counting.
또는, 현재 블록 내 서브 블록 별 0이 아닌 잔차 계수가 존재하는지 여부를 나타내는 플래그를 부호화할 시, 카운터가 동작하지 않도록 설정할 수도 있다. 즉, 상기 플래그는 카운팅 대상에서 제외될 수 있다. Alternatively, when encoding a flag indicating whether a non-zero residual coefficient exists for each subblock in the current block, the counter may be set not to operate. That is, the flag may be excluded from counting.
본 개시의 일 실시예에 따르면, 문맥 정보를 이용하여 부호화되는 빈들의 개수를 제한하기 위해, 문맥 정보를 이용하여 부호화된 빈들의 개수가 임계값 이상이 되는 경우, gt_N_flag 등을 이용하여, 잔차 계수를 단계적으로 부호화하는 대신, 잔차 계수의 절대값을 그대로 부호화할 수 있다. 일 예로, 문맥 정보를 이용하여 부호화된 빈의 개수가, 임계값보다 작은 경우에는, 표 1 내지 표 4에 예시된 sig_flag, sign_flag, gt_1_flag, par_flag, gt_2_flag, gt_3_flag, gt_4_flag, gt_5_flag 또는 rem_level 중 적어도 하나를 이용하여, 잔차 계수의 절대값을 부호화할 수 있다. 반면, 문맥 정보를 이용하여 부호화된 빈의 개수가 임계값 이상인 경우, 잔차 계수의 절대값을 나타내는 신택스 abs_level 및 잔차 계수의 부호를 나타내는 sign_flag를 부호화할 수 있다. According to an embodiment of the present disclosure, in order to limit the number of bins encoded using context information, when the number of bins encoded using context information is greater than or equal to a threshold value, gt_N_flag or the like is used to limit the residual coefficient. Instead of stepwise encoding , the absolute value of the residual coefficient may be encoded as it is. For example, when the number of bins encoded using context information is smaller than a threshold value, at least one of sig_flag, sign_flag, gt_1_flag, par_flag, gt_2_flag, gt_3_flag, gt_4_flag, gt_5_flag, or rem_level illustrated in Tables 1 to 4 can be used to encode the absolute value of the residual coefficient. On the other hand, when the number of bins encoded using context information is equal to or greater than a threshold value, the syntax abs_level indicating the absolute value of the residual coefficient and sign_flag indicating the sign of the residual coefficient may be encoded.
복호화기에서도, 문맥 정보를 이용하여 부호화된 빈을 복호화할 때마다 카운터를 작동할 수 있다. 카운터의 값이 임계값 보다 작은 경우에는, sig_flag, sign_flag, gt_1_flag, par_flag, gt_2_flag, gt_3_flag, gt_4_flag, gt_5_flag 또는 rem_level 중 적어도 하나를 이용하여, 잔차 계수의 절대값을 복원할 수 있다. 반면, 카운터의 값이 임계값 이상인 경우, 신택스 abs_level 및 sign_flag를 이용하여, 잔차 계수를 복원할 수 있다. Even in the decoder, a counter may be operated whenever an encoded bin is decoded using context information. When the value of the counter is smaller than the threshold value, the absolute value of the residual coefficient may be reconstructed using at least one of sig_flag, sign_flag, gt_1_flag, par_flag, gt_2_flag, gt_3_flag, gt_4_flag, gt_5_flag, or rem_level. On the other hand, when the value of the counter is equal to or greater than the threshold, the residual coefficient may be restored using the syntax abs_level and sign_flag.
도 20은 문맥 정보를 이용하는 빈의 개수를 카운팅하는 예를 나타낸 도면이다.20 is a diagram illustrating an example of counting the number of bins using context information.
설명의 편의를 위해, 서브 블록 내에는, 16개의 잔차 계수가 존재하는 것으로 가정하고, 계수들 각각이 C0 내지 C15인 것으로 가정한다. 여기서, C15는 서브 블록 내 우측 하단에 위치하는 잔차 계수를 의미하고, C0는, 서브 블록 내 좌측 상단에 위치하는 잔차 계수를 의미한다.For convenience of explanation, it is assumed that there are 16 residual coefficients in the sub-block, and it is assumed that each of the coefficients is C0 to C15. Here, C15 denotes a residual coefficient located in the lower right corner in the subblock, and C0 denotes a residual coefficient located in the upper left corner in the subblock.
도 20에서, 1패스(pass)는, 문맥 정보를 이용하여 부호화되는 신택스들을 나타낸 것이다. 1패스를 제외한, 2 및 3패스는 문맥 정보를 이용하지 않고 부호화되는 신택스들을 나타낸 것이다. In FIG. 20 , one pass indicates syntaxes encoded using context information. Except for pass 1, passes 2 and 3 indicate syntaxes that are encoded without using context information.
패스는, 부호화 순서 및 복호화 순서를 나타낸다. 일 예로, N패스에 속한 신택스들 만으로 잔차 계수를 완전히 부호화할 수 없는 경우, (N+1)에 속한 신택스들을 부호화할 수 있다. 복호화기에서는, 문맥 정보를 이용하여 부호화된 개수 만큼의 신택스들을 1패스에서 복호화한 뒤, 2패스에 속하는 신택스들을 복호화할 수 있다. 또한, 2패스에 속하는 신택스들을 모두 복호화한 뒤, 3-1패스에 속한 신택스들이 복호화될 수 있다. A path indicates an encoding order and a decoding order. For example, when the residual coefficient cannot be completely encoded using only syntaxes belonging to N-paths, syntaxes belonging to (N+1) may be encoded. The decoder may decode as many syntaxes as coded using context information in one pass, and then decode syntaxes belonging to the second pass. Also, after all syntaxes belonging to the 2nd pass are decoded, the syntaxes belonging to the 3-1 path may be decoded.
도시된 예에서, 3-2 패스는, 1패스에 속한 신택스들이 부호화되지 않는 잔차 계수에 대한 경로를 나타낸다. 즉, 문맥 정보를 이용하여 부호화되는 빈의 계수가 임계값보다 작은 경우, 1 패스, 2 또는 3-1패스 중 적어도 하나를 거쳐 잔차 계수가 부호화될 수 있다. 반면, 문맥 정보를 이용하여 부호화되는 빈의 계수가 임계값과 같거나 큰 경우, 3-2 패스를 거처, 잔차 계수가 부호화될 수 있다. In the illustrated example, a 3-2 pass represents a path for a residual coefficient in which syntaxes belonging to pass 1 are not coded. That is, when a coefficient of a bin encoded using context information is smaller than a threshold value, the residual coefficient may be encoded through at least one of one pass, two passes, and three-1 passes. On the other hand, when a coefficient of a bin encoded using context information is equal to or greater than a threshold value, a residual coefficient may be encoded through 3-2 passes.
신택스들의 부호화/복호화 순서는 도 20의 화살표를 따를 수 있다. 먼저, 문맥 정보를 이용하여 부호화된 빈의 개수가 임계값보다 작은 경우, 해당 잔차 계수에 대한, 1패스에 속한 신택스들을 부호화할 수 있다. 일 예로, 도 20에서는, C0 내지 C7에 대해, 1패스에 속한 신택스들이 부호화되는 것으로 예시되었다. C0 내지 C7 중 적어도 하나가, 1패스에 속한 신택스들 만으로 완전히 부호화되지 않는 경우, 2패스에 속한 신택스를 부호화할 수 있다. 마찬가지로, 2패스에 속한 신택스들 만으로 잔차 계수가 완전히 부호화되지 않는 경우, 3-1패스에 속한 신택스를 부호화할 수 있다. The encoding/decoding order of syntax may follow an arrow of FIG. 20 . First, when the number of bins encoded using context information is less than a threshold value, syntaxes belonging to one pass for a corresponding residual coefficient may be encoded. As an example, in FIG. 20 , it is exemplified that syntaxes belonging to one pass are encoded for C0 to C7. When at least one of C0 to C7 is not completely encoded only with syntaxes belonging to one pass, the syntaxes belonging to the second pass may be encoded. Similarly, when the residual coefficients are not completely coded only with syntaxes belonging to the 2nd pass, the syntaxes belonging to the 3-1 path may be coded.
문맥 정보를 이용하여 부호화된 빈의 개수가 임계값에 다다른 경우, 이후 잔차 계수 부터는 3-2 패스에 속하는 신택스를 부호화할 수 있다. 예컨대, 잔차 계수 C8 내지 C15에 대해서는, 3-2 패스에 속한 신택스 abs_level 및 sign_flag를 부호화할 수 있다. When the number of bins encoded using context information reaches a threshold, syntax belonging to the 3-2 pass may be encoded from residual coefficients thereafter. For example, for the residual coefficients C8 to C15, the syntax abs_level and sign_flag belonging to the 3-2 pass may be encoded.
이때, 문맥 정보를 이용하여 부호화된 빈의 개수가 임계값보다 작은 경우라 하더라도, 상기 개수 및 임계값의 차분이, 해당 잔차 계수에 대한, 1패스에 속한 신택스들을 부호화하는데 충분하지 않은 경우, 문맥 정보를 이용함이 없이 abs_level이 부호화되도록 설정할 수 있다. 예컨대, sig_flag, gt_1_flag, par_flag 및 gt_2_flag가 문맥 정보를 이용하여 부호화되도록 설정된 경우에는, 상기 개수 및 임계값의 차분이 4보다 큰 경우에 한하여, 상기 신택스들이 부호화될 수 있다. 또는, 잔차 계수의 절대값이 1인 경우에는, gt_2_flag를 제외한 sig_flag, gt_1_flag 및 par_flag 만으로 잔차 계수를 부호화할 수 있으므로, 상기 개수 및 임계값의 차분이 3보다 큰 경우에 한하여, 상기 신택스들을 부호화할 수 있다. 또는, 잔차 계수의 절대값이 0인 경우에는, sig_flag 만으로 잔차 계수를 부호화할 수 있으므로, 상기 개수 및 임계값의 차분이 1보다 큰 경우에 한하여, 상기 신택스를 부호화할 수 있다. In this case, even when the number of bins encoded using the context information is smaller than the threshold value, when the difference between the number and the threshold value is not sufficient to encode syntaxes belonging to one pass with respect to the residual coefficient, the context It can be set so that abs_level is encoded without using information. For example, when sig_flag, gt_1_flag, par_flag, and gt_2_flag are set to be encoded using context information, the syntaxes may be encoded only when the difference between the number and the threshold is greater than 4. Alternatively, when the absolute value of the residual coefficient is 1, since the residual coefficient can be encoded only with sig_flag, gt_1_flag, and par_flag excluding gt_2_flag, the syntaxes can be encoded only when the difference between the number and the threshold is greater than 3. can Alternatively, when the absolute value of the residual coefficient is 0, since the residual coefficient can be encoded using only sig_flag, the syntax can be encoded only when the difference between the number and the threshold value is greater than 1.
도시된 예에서는, 1패스에 속하는 4개의 신택스들만이 문맥 정보를 이용하여 부호화되는 것으로 도시되었다. 설명한 예와 달리, 2-1패스에 속하는 신택스 rem_level 또는 3패스에 속하는 신택스 sign_flag 중 적어도 하나도 문맥 정보를 이용하여 부호화될 수 있다. 일 예로, rem_level이 문맥 정보를 이용하여 부호화되는 경우, 신택스 rem_level에 할당되는 빈의 개수만큼 카운터가 증가할 수 있다. In the illustrated example, it is shown that only four syntaxes belonging to one pass are encoded using context information. Unlike the described example, at least one of the syntax rem_level belonging to the 2-1 path and the syntax sign_flag belonging to the 3rd path may be encoded using context information. For example, when rem_level is encoded using context information, the counter may increase by the number of bins allocated to the syntax rem_level.
도 20에 도시된 예에서, 플래그 par_flag가 문맥 정보를 이용하여 부호화되지 않도록 설정할 수도 있다. 도 21은 이에 대한 예시를 나타낸다.In the example shown in FIG. 20 , the flag par_flag may be set not to be coded using context information. 21 shows an example of this.
도 21에서, 1패스는, 문맥 정보를 이용하여 부호화되는 신택스들을 나타낸 것이다. 1패스를 제외한, 2, 3 및 4패스는 문맥 정보를 이용하지 않고 부호화되는 신택스들을 나타낸 것이다. In FIG. 21 , one pass indicates syntaxes encoded using context information. Except for pass 1, passes 2, 3, and 4 indicate syntaxes that are encoded without using context information.
도시된 예에서와 같이, 신택스 par_flag를 문맥 정보를 이용하여 부호화되는 신택스들이 속한 1패스와 상이한 2패스로 분류할 수 있다. 이에 따라, 신택스 par_flag에 기초하여서는, 문맥 정보를 이용하여 부호화된 빈의 개수를 카운팅하지 않는다.As in the illustrated example, the syntax par_flag may be classified into two passes different from one pass to which the encoded syntaxes belong by using context information. Accordingly, based on the syntax par_flag, the number of coded bins is not counted using context information.
문맥 정보를 이용하여 부호화되는 빈의 계수가 임계값보다 작은 경우, 1패스, 2패스, 3 패스 또는 4-1 패스를 거쳐 잔차 계수의 절대값이 부호화될 수 있다. 반면, 문맥 정보를 이용하여 부호화되는 빈의 계수가 임계값보다 같거나 큰 경우, 4-2 패스를 거처, 잔차 계수의 절대값이 부호화될 수 있다.When a coefficient of a bin encoded using context information is smaller than a threshold value, the absolute value of the residual coefficient may be encoded through one pass, two passes, three passes, or 4-1 passes. On the other hand, when the coefficient of the bin encoded using the context information is equal to or greater than the threshold value, the absolute value of the residual coefficient may be encoded through 4-2 passes.
플래그 par_flag가 문맥 정보를 이용하지 않고 부호화되도록 설정되는 경우, 플래그 par_flag에 할당되는 빈의 개수(즉, 1개)에 대해서는, 카운터가 증가하지 않도록 설정될 수 있다. 이에 따라, 각 잔차 계수에 대해, 3개의 신택스, sig_flag, gt_1_flag 및 gt_2_flag에 할당되는 빈에 대해서만 카운터가 증가하게 된다. When the flag par_flag is set to be encoded without using context information, the counter may be set not to increase with respect to the number of bins (ie, one) allocated to the flag par_flag. Accordingly, for each residual coefficient, the counter is incremented only for the bins assigned to the three syntaxes, sig_flag, gt_1_flag and gt_2_flag.
문맥 정보를 이용하여 부호화된 빈의 계수가 임계값에 다다른 경우, 다음 잔차 계수부터는, 4-2 패스에 속한 신택스들을 부호화할 수 있다. 일 예로, C8 부터 C15에 대해서는, 4-2패스에 속한 신택스 abs_level을 이용하여, 잔차 계수 절대값을 부호화하고, 신택스 sign_flag를 이용하여, 잔차 계수의 부호를 부호화할 수 있다. When the coefficient of a bin encoded using context information reaches a threshold, syntaxes belonging to the 4-2 pass may be encoded from the next residual coefficient. For example, with respect to C8 to C15, the absolute value of the residual coefficient may be encoded using the syntax abs_level belonging to the 4-2 path, and the sign of the residual coefficient may be encoded using the syntax sign_flag.
도 20 및 도 21의 예에서는, 최대 5개의 gt_N_flag가 이용 가능한 것으로 예시되었다. 도시된 예보다 더 적은 수 또는 더 많은 수의 gt_N_flag를 이용하여, 잔차 계수들을 부호화할 수도 있다. 도 22는 이에 대한 예시이다. In the examples of FIGS. 20 and 21 , it is illustrated that a maximum of 5 gt_N_flags are available. Residual coefficients may be encoded using a smaller number or a larger number of gt_N_flags than the illustrated example. 22 is an example of this.
도 22는 2개의 gt_N_flag를 이용한 부호화 양상을 예시한 도면이다. 22 is a diagram illustrating an encoding mode using two gt_N_flags.
도 22에 도시된 예에서는, 1패스에 sig_flag, gt_1_flag, par_flag 및 gt_2_flag가 포함되는 것으로 예시되었다. 문맥 정보를 이용하여 부호화된 빈의 개수와 임계값을 비교하여, 각 잔차 계수에 대해 위 4개의 신택스들을 부호화할 것인지 여부를 결정할 수 있다. In the example shown in FIG. 22 , it is exemplified that sig_flag, gt_1_flag, par_flag, and gt_2_flag are included in one pass. By comparing the number of encoded bins and a threshold value using context information, it is possible to determine whether to encode the above four syntaxes for each residual coefficient.
도 22에 도시된 예에서, C15 내지 C0의 순서로 잔차 계수가 부호화되는 것으로 가정한다. 도 22에 도시된 예에서는, C15 내지 C8에 대해 1패스에 속한 신택스들이 부호화되는 것으로 예시되었다. 이때, 위 잔차 계수가 1패스에 속한 신택스들에 의해, 완전히 부호화될 수 없는 경우, 2-1패스 및 3 패스에 속한 신택스들을 부호화할 수 있다.In the example shown in Fig. 22, it is assumed that residual coefficients are encoded in the order of C15 to C0. In the example shown in FIG. 22 , it is exemplified that syntaxes belonging to one pass are encoded for C15 to C8. In this case, when the residual coefficient cannot be completely encoded by the syntaxes belonging to the first pass, the syntaxes belonging to the 2-1 pass and the third pass may be encoded.
문맥 정보를 이용하여 부호화된 빈의 개수가 임계값 이상인 경우, 2-1 패스 및 3패스에 속한 신택스들을 부호화할 수 있다. 일 예로, 잔차 계수 C7 내지 C0에 대해서는, 잔차 계수의 절대값을 나타내는 신택스 abs_level 및 잔차 계수의 부호를 나타내는 신택스 sign_flag가 부호화될 수 있다. When the number of bins encoded using context information is equal to or greater than a threshold value, syntaxes belonging to the 2-1 pass and the 3rd pass may be encoded. For example, for the residual coefficients C7 to C0, a syntax abs_level indicating an absolute value of the residual coefficient and a syntax sign_flag indicating a sign of the residual coefficient may be encoded.
도 22에 도시된 예에서, 플래그 par_flag가 문맥 정보를 이용하여 부호화되지 않도록 설정할 수도 있다. 도 23은 이에 대한 예시를 나타낸다.In the example shown in FIG. 22 , the flag par_flag may be set not to be coded using context information. 23 shows an example of this.
도 23에서, 1패스는, 문맥 정보를 이용하여 부호화되는 신택스들을 나타낸 것이다. 1패스를 제외한, 2, 3-1, 3-2 및 4패스는 문맥 정보를 이용하지 않고 부호화되는 신택스들을 나타낸 것이다. 문맥 정보를 이용하여 부호화되는 빈의 계수가 임계값보다 작은 경우, 1패스, 2패스 및 3-1 패스를 거쳐 잔차 계수의 절대값이 부호화될 수 있다. 반면, 문맥 정보를 이용하여 부호화되는 빈의 계수가 임계값보다 같거나 큰 경우, 3-2 패스를 거처, 잔차 계수의 절대값이 부호화될 수 있다.In FIG. 23 , one pass represents syntaxes encoded using context information. Except for pass 1, passes 2, 3-1, 3-2, and 4 indicate syntaxes that are encoded without using context information. When the coefficient of a bin encoded using context information is smaller than a threshold value, the absolute value of the residual coefficient may be encoded through one pass, two passes, and a 3-1 pass. On the other hand, when the coefficient of the bin encoded using the context information is equal to or greater than the threshold value, the absolute value of the residual coefficient may be encoded through 3-2 passes.
플래그 par_flag가 문맥 정보를 이용하지 않고 부호화되도록 설정되는 경우, 플래그 par_flag에 할당되는 빈의 개수(즉, 1개)에 대해서는, 카운터가 증가하지 않도록 설정될 수 있다.When the flag par_flag is set to be encoded without using context information, the counter may be set not to increase with respect to the number of bins (ie, one) allocated to the flag par_flag.
이에 따라, 각 잔차 계수에 대해, 3개의 신택스, sig_flag, gt_1_flag 및 gt_2_flag에 할당되는 빈에 대해서만 카운터가 증가하게 된다. Accordingly, for each residual coefficient, the counter is incremented only for the bins assigned to the three syntaxes, sig_flag, gt_1_flag and gt_2_flag.
도 23에서는 임계값이 24로 설정되있다고 가정한다.In FIG. 23, it is assumed that the threshold value is set to 24.
잔차 계수 C15 내지 C8 각각에 대해, 신택스 sig_flag, gt_1_flag 및 gt_2_flag가 부호화되는 것으로 가정할 경우, 잔차 계수를 C8에 대한 신택스들을 1 pass에서 부호화한 뒤, 카운터가 임계값과 동일한 24으로 설정된다. Assuming that for each of the residual coefficients C15 to C8, the syntax sig_flag, gt_1_flag and gt_2_flag are encoded, the residual coefficient is set to 24 equal to the threshold value after encoding the syntaxes for C8 in 1 pass.
이에 따라, 잔차 계수 C7의 부호화시에는, 3-2패스에 포함된 신택스 abs_level을 통해 잔차 계수 C7의 절대값을 그대로 부호화할 수 있다. 즉, 잔차 계수 C7 내지 C0에 대해서는, 1패스 및 2-1패스에 속하는 신택스들 대신, 3-2패스에 속하는 신택스 abs_level을 이용하여 잔차 계수 절대값이 부호화될 수 있다. Accordingly, when encoding the residual coefficient C7, the absolute value of the residual coefficient C7 can be encoded as it is through the syntax abs_level included in the 3-2 path. That is, for the residual coefficients C7 to C0, the absolute values of the residual coefficients may be encoded using the syntax abs_level belonging to the 3-2 pass instead of the syntaxes belonging to the 1st pass and the 2-1 pass.
도 22에 예시된 3개의 패스들을 2개의 패스들로 간소화하여 구성하는 것도 가능하다. 도 24는 이에 대한 예시이다.It is also possible to simplify the three passes illustrated in FIG. 22 into two passes. 24 is an example of this.
도 24에 도시된 예에서와 같이, sig_flag, gt_1_flag, par_flag, gt_2_flag를 하나의 패스(즉, 1패스)로 구성하고, 절대값 차분을 나타내는 rem_level 및 부호를 나타내는 sign_flag를 하나의 패스(즉, 2-1패스)로 구성할 수 있다. 또한, 1패스에 속한 신택스들이 부호화되지 않는 잔차 계수들을 위해, 잔차 계수의 절대값을 나타내는 abs_level 및 부호를 나타내는 sign_flag를 하나의 패스(즉, 2-2패스)로 구성할 수 있다. As in the example shown in FIG. 24 , sig_flag, gt_1_flag, par_flag, and gt_2_flag are configured in one pass (ie, one pass), and rem_level indicating the absolute difference and sign_flag indicating the sign are configured in one path (ie, 2). -1 pass). Also, for residual coefficients in which syntaxes belonging to one pass are not encoded, abs_level indicating the absolute value of the residual coefficient and sign_flag indicating a sign may be configured as one pass (ie, 2-2 passes).
패스의 개수 및 각 패스의 구성을 도시된 예와 상이하게 설정하는 것도 가능하다. 일 예로, 모든 gt_N_flag를 하나의 패스로 구성하는 대신, 일부 gt_N_flag는 1패스로 구성하고, 나머지 gt_N_flag는 2패스로 구성할 수 있다. It is also possible to set the number of paths and the configuration of each path to be different from the illustrated example. For example, instead of configuring all gt_N_flags as one pass, some gt_N_flags may be configured as one pass, and the remaining gt_N_flags may be configured as two passes.
상술한 예에서와 같이, 잔차 계수 부호화는, 최대 m개의 gt_N_flag를 이용하는 방식 및 최대 n개의 gt_N_flag를 이용하는 방식으로 구분될 수 있다. m과 n은 상이한 자연수이고, m은 n보다 큰 값을 가질 수 있고, m은, 3, 4, 5 또는 6과 같은 자연수, n은 2, 3 또는 4와 같은 자연수일 수 있다. 일 예로, 제1 방식은 최대 5개의 gt_N_flag를 이용하는 잔차 계수 부호화 방법이고, 제2 방식은 최대 2개의 gt_N_flag를 이용하는 잔차 계수 부호화 방법일 수 있다. As in the above example, residual coefficient encoding may be divided into a method using a maximum of m gt_N_flags and a method using a maximum of n gt_N_flags. m and n are different natural numbers, m may have a value greater than n, m may be a natural number such as 3, 4, 5 or 6, and n may be a natural number such as 2, 3 or 4. As an example, the first method may be a residual coefficient encoding method using a maximum of five gt_N_flags, and the second method may be a residual coefficient encoding method using a maximum of two gt_N_flags.
최대 m개의 gt_N_flag를 이용하는 제1 방식을 적용할 것인지 또는 최대 n개의 gt_N_flag를 이용하는 제2 방식을 적용할 것인지를 나타내는 정보가 비트스트림을 통해 시그날링될 수 있다. 일 예로, 변환 스킵의 적용 여부를 나타내는 transform_skip_flag에 기초하여, 제1 방식 또는 제2 방식의 적용 여부가 결정될 수 있다. 일 예로, 현재 블록에 변환이 스킵되는 경우(예컨대, transform_skip_flag가 1인 경우), 제1 방식을 이용하여 잔차 계수가 부호화되는 반면, 현재 블록에 변환이 스킵되지 않는 경우(예컨대, transform_skip_flag가 0인 경우), 제2 방식을 이용하여 잔차 계수가 부호화될 수 있다.Information indicating whether to apply the first scheme using up to m gt_N_flags or the second scheme using up to n gt_N_flags may be signaled through the bitstream. As an example, whether the first scheme or the second scheme is applied may be determined based on transform_skip_flag indicating whether transform skip is applied. For example, when a transform is skipped in the current block (eg, when transform_skip_flag is 1), residual coefficients are encoded using the first method, whereas when a transform is not skipped in the current block (eg, when transform_skip_flag is 0) case), the residual coefficients may be encoded using the second method.
또는, 블록 또는 서브 블록 레벨에서, 잔차 계수의 부호화 방법을 특정하기 위한 정보가 부호화되어 시그날링될 수 있다.Alternatively, at a block or sub-block level, information for specifying an encoding method of a residual coefficient may be encoded and signaled.
또는, 슬라이스, 픽처 또는 시퀀스 레벨에서, 잔차 계수의 부호화 방법을 특정하기 위한 정보가 부호화되어 시그날링될 수 있다. Alternatively, information for specifying an encoding method of a residual coefficient may be encoded and signaled at a slice, picture, or sequence level.
다른 예로, 현재 블록의 크기, 형태, 부호화 모드 또는 인트라 예측 모드 중 적어도 하나에 기초하여, 잔차 계수의 부호화 방식을 결정할 수 있다. 일 예로, 현재 블록이 인트라 예측으로 부호화된 경우, 최대 m개의 gt_N_flag를 이용하는 제1 방식에 기초하여 잔차 계수들이 부호화될 수 있다. 반면, 현재 블록이 인터 예측으로 부호화된 경우, 최대 n개의 gt_N_flag를 이용하는 제2 방식에 기초하여 잔차 계수들이 부호화될 수 있다. As another example, the encoding method of the residual coefficient may be determined based on at least one of the size, shape, encoding mode, and intra prediction mode of the current block. As an example, when the current block is encoded by intra prediction, residual coefficients may be encoded based on the first method using a maximum of m gt_N_flags. On the other hand, when the current block is encoded by inter prediction, residual coefficients may be encoded based on the second method using a maximum of n gt_N_flags.
다른 예로, 무손실 부호화의 적용 여부에 따라, 잔차 계수의 부호화 방식이 결정될 수 있다. 일 예로, 무손실 부호화가 적용된 경우, 최대 n개의 gt_N_flag를 이용하는 제2 방식에 기초하여, 잔차 계수들이 부호화될 수 있다. 반면, 무손실 부호화가 적용되지 않는 경우, 최대 m개의 gt_N_flag를 이용하는 제1 방식에 기초하여 잔차 계수들이 부호화될 수 있다. 또는, 무손실 부호화가 적용된 경우, 제2 방식을 고정적으로 적용하고, 무손실 부호화가 적용되지 않은 경우, 제1 방식 또는 제2 방식 중 하나를 적응적으로 선택할 수 있다. As another example, the encoding method of the residual coefficient may be determined according to whether lossless encoding is applied. As an example, when lossless encoding is applied, residual coefficients may be encoded based on the second method using a maximum of n gt_N_flags. On the other hand, when lossless coding is not applied, residual coefficients may be coded based on the first scheme using a maximum of m gt_N_flags. Alternatively, when lossless coding is applied, the second scheme is fixedly applied, and when lossless coding is not applied, either the first scheme or the second scheme can be adaptively selected.
다른 예로, 현재 영상의 비트 심도(Bit-depth)에 기초하여, 잔차 계수의 부호화 방식을 결정할 수 있다. 일 예로, 현재 영상의 비트 심도가 10비트 이하인 경우, 최대 m개의 gt_N_flag를 이용하는 제1 방식에 기초하여, 잔차 계수들이 부호화될 수 있다. 반면, 현재 영상의 비트 심도가 10비트인 경우, 최대 m개의 gt_N_flag를 이용하는 제1 방식에 기초하여, 잔차 계수들이 부호화될 수 있다. 반면, 현재 영상의 비트 심도가 10비트보다 큰 경우, 최대 n개의 gt_N_flag를 이용하는, 제2 방식에 기초하여, 잔차 계수들이 부호화될 수 있다. As another example, the encoding method of the residual coefficient may be determined based on the bit-depth of the current image. For example, when the bit depth of the current image is 10 bits or less, the residual coefficients may be encoded based on the first method using a maximum of m gt_N_flags. On the other hand, when the bit depth of the current image is 10 bits, the residual coefficients may be encoded based on the first method using a maximum of m gt_N_flags. On the other hand, when the bit depth of the current image is greater than 10 bits, the residual coefficients may be encoded based on the second method using a maximum of n gt_N_flags.
잔차 계수들을 플리핑한 뒤, 플리핑된 잔차 계수들을 부호화할 수도 있다. 플리핑은, 잔차 계수들의 위치를 수평 방향 또는 수직 방향 중 적어도 하나에 기초하는 대칭 위치로 변경하는 것을 의미할 수 있다. 플리핑 모드는, 수평 모드, 수직 모드 또는 수직과 수평이 혼합된 모드 중 하나로 결정될 수 있다. After flipping the residual coefficients, the flipped residual coefficients may be encoded. Flipping may mean changing the positions of the residual coefficients to symmetric positions based on at least one of a horizontal direction or a vertical direction. The flipping mode may be determined as one of a horizontal mode, a vertical mode, or a mode in which vertical and horizontal are mixed.
플리핑의 적용 여부 또는 플리핑 모드를 특정하기 위한 정보가 비트스트림을 통해 시그날링될 수 있다. 일 예로, 플리핑이 적용되는지 여부를 나타내는 플래그가 부호화되어 시그날링될 수 있다. 상기 플래그가 플리핑이 적용되었음을 나타내는 경우, 복수개의 플리핑 모드 중 하나를 특정하는 인덱스가 부호화되어 시그날링될 수 있다.Information for specifying whether flipping is applied or not or a flipping mode may be signaled through a bitstream. For example, a flag indicating whether flipping is applied may be encoded and signaled. When the flag indicates that flipping is applied, an index specifying one of a plurality of flipping modes may be encoded and signaled.
또는, 현재 블록의 크기, 형태, 부호화 모드 또는 인트라 예측 모드 중 적어도 하나에 기초하여, 플리핑을 적용하는 것이 허용되는지 여부, 플리핑의 적용 여부 또는 플리핑 모드 중 적어도 하나가 결정될 수 있다. 일 예로, 현재 블록에 인트라 예측이 적용되는 경우, 현재 블록에 플리핑을 적용하는 것이 허용될 수 있다. 현재 블록에 플리핑을 적용하는 것이 허용되는 경우, 현재 블록에 플리핑이 적용되었는지 여부를 나타내는 플래그가 부호화되어 시그날링될 수 잇다. 반면, 현재 블록에 인터 예측이 적용되는 경우, 현재 블록에 플리핑을 적용하는 것이 허용되지 않을 수 있다. 현재 블록에 플리핑을 적용하는 것이 허용되지 않는 경우, 현재 블록에 플리핑이 적용되었는지 여부를 나타내는 플래그의 부호화가 생략될 수 있다.Alternatively, at least one of whether flipping is allowed to be applied, whether flipping is applied, or a flipping mode may be determined based on at least one of the size, shape, encoding mode, and intra prediction mode of the current block. As an example, when intra prediction is applied to the current block, it may be allowed to apply flipping to the current block. When it is allowed to apply flipping to the current block, a flag indicating whether flipping is applied to the current block may be encoded and signaled. On the other hand, when inter prediction is applied to the current block, it may not be allowed to apply flipping to the current block. When it is not permitted to apply flipping to the current block, encoding of a flag indicating whether flipping is applied to the current block may be omitted.
또는, 무손실 부호화의 적용 여부에 기초하여, 플리핑을 적용하는 것이 허용되는지 여부, 플리핑의 적용 여부 또는 플리핑 모드 중 적어도 하나가 결정될 수 있다. 일 예로, 무손실 부호하가 적용되는 경우, 현재 블록에 플리핑을 적용하는 것이 허용될 수 있다. 현재 블록에 플리핑을 적용하는 것이 허용되는 경우, 현재 블록에 플리핑이 적용되었는지 여부를 나타내는 플래그가 부호화되어 시그날링될 수 잇다. 반면, 무손실 부호화가 적용되지 않는 경우, 현재 블록에 플리핑을 적용하는 것이 허용되지 않을 수 있다. 현재 블록에 플리핑을 적용하는 것이 허용되지 않는 경우, 현재 블록에 플리핑이 적용되었는지 여부를 나타내는 플래그의 부호화가 생략될 수 있다.Alternatively, at least one of whether flipping is allowed to be applied, whether flipping is applied, or a flipping mode may be determined based on whether lossless encoding is applied. For example, when lossless coding is applied, it may be allowed to apply flipping to the current block. When it is allowed to apply flipping to the current block, a flag indicating whether flipping is applied to the current block may be encoded and signaled. On the other hand, when lossless coding is not applied, it may not be allowed to apply flipping to the current block. When it is not permitted to apply flipping to the current block, encoding of a flag indicating whether flipping is applied to the current block may be omitted.
블록 단위 또는 서브 블록 단위로 플리핑을 수행한 뒤, 플리핑된 잔차 계수들을 부호화할 수 있다. 구체적으로, 플리핑된 잔차 계수들은 최대 m개의 gt_N_flag를 이용하는 제1 방식 또는 최대 n개의 gt_N_flag를 이용하는 제2 방식 중 적어도 하나에 기초하여, 플리핑된 잔차 계수들을 부호화할 수 있다. 다른 예로, 잔차 계수들이 플리핑된 경우에는, 제1 방식을 고정적으로 적용하거나, 제2 방식을 고정적으로 적용할 수 있다. 제1 방식 또는 제2 방식 중 적어도 하나가 고정적으로 적용되는 경우, 어떠한 부호화 방식이 적용되었는지 여부를 나타내는 정보의 부호화가 생략될 수 있다. After flipping is performed on a block-by-block or sub-block basis, the flipped residual coefficients may be encoded. Specifically, the flipped residual coefficients may be encoded based on at least one of a first scheme using at most m gt_N_flags or a second scheme using at most n gt_N_flags. As another example, when the residual coefficients are flipped, the first method may be fixedly applied or the second method may be fixedly applied. When at least one of the first scheme or the second scheme is fixedly applied, encoding of information indicating whether an encoding scheme is applied may be omitted.
최대 m개의 gt_N_flag를 이용한 제1 방식이 적용되는 경우와 최대 n개의 gt_N_flag를 이용한 제2 방식이 적용되는 경우에 있어서, 스캔 순서가 상이할 수 있다. 일 예로, 제1 방식이 적용되는 경우, 잔차 계수들의 스캔 순서와 제2 방식이 적용되는 경우, 잔차 계수들의 스캔 순서가 반대일 수 있다.The scan order may be different when the first scheme using up to m gt_N_flags is applied and when the second scheme using up to n gt_N_flags is applied. For example, when the first method is applied, the scan order of the residual coefficients and when the second method is applied, the scan order of the residual coefficients may be reversed.
일 예로, 제1 방식이 적용되는 경우에는, 블록의 우하단에 위치하는 잔차 계수를 첫번째로 스캔하고, 블록의 좌상단에 위치하는 잔차 계수를 마지막으로 스캔하는 제1 스캔 방향이 적용될 수 있다. 반면, 제2 방식이 적용되는 경우에는, 블록의 좌상단에 위치하는 잔차 계수를 첫번째로 스캔하고, 블록의 우하단에 위치하는 잔차 계수를 마지막으로 스캔하는 제2 스캔 방향이 적용될 수 있다.For example, when the first method is applied, a first scan direction in which residual coefficients positioned at the lower right end of the block are first scanned and the residual coefficients positioned at the upper left end of the block are last scanned may be applied. On the other hand, when the second method is applied, a second scan direction in which the residual coefficients located at the upper left end of the block are first scanned and the residual coefficients located at the lower right end of the block are last scanned may be applied.
상술한 예에서와 같이, 잔차 계수의 절대값은, sig_flag, par_flag, gt_N_flag 또는 rem_level 중 적어도 하나를 이용하여 부호화될 수 있다. 이때, 상술한 바와 같이, rem_level을 제외한 잔여 신택스들은, 주변 계수들의 성질에 따라, 다양한 문맥 정보를 참조하여 부호화될 수 있다. 이때, 참조 가능한 문맥 정보의 개수는 화소의 위치에 따라 결정될 수 있다. As in the above example, the absolute value of the residual coefficient may be encoded using at least one of sig_flag, par_flag, gt_N_flag, and rem_level. In this case, as described above, the remaining syntaxes except for rem_level may be coded with reference to various context information according to the properties of the surrounding coefficients. In this case, the number of referenceable context information may be determined according to the position of the pixel.
도 25 및 도 26은 문맥 정보를 결정하기 위해 참조되는 주변 복원 영역을 나타낸 것이다.25 and 26 show the surrounding restoration area referenced to determine context information.
도 25는, 우측 하단 잔차 계수에서부터 좌측 상단 잔차 계수로 이어지는 스캔 순서에 따라 잔차 계수가 부호화되는 경우의 예시이다. 일 예로, 도 25는, 최대 n개의 gt_N_flag를 이용하는 제2 방식에 대해 적용될 수 있다. 25 is an example of a case in which residual coefficients are encoded according to a scan order from the lower right residual coefficient to the upper left residual coefficient. As an example, FIG. 25 may be applied to the second scheme using a maximum of n gt_N_flags.
도 26은, 좌측 상단 잔차 계수에서부터 우측 하단 잔차 계수로 이어지는 스캔 순서에 따라 잔차 계수가 부호화되는 경우의 예시이다. 일 예로, 도 26은, 최대 m개의 gt_N_flag를 이용하는, 제1 방식에 대해 적용될 수 있다. 26 is an example of a case in which residual coefficients are encoded according to a scan order from the upper left residual coefficient to the lower right residual coefficient. As an example, FIG. 26 may be applied to the first scheme using a maximum of m gt_N_flags.
도 25 및 도 26의 예를 참조하면, 최대 2개 또는 최대 5개의 복원 계수들을 참조할 수 있다. 일 예로, 잔차 계수의 위치를 (x, y)라 할 경우, 잔차 계수와의 x 좌표 차분 및 y 좌표 차분의 합의 절대값이 1이하인 복원 계수들을 포함하는 영역 또는 상기 절대값이 2 이하인 복원 계수들을 포함하는 영역이 주변 복원 영역으로 설정될 수 있다. 25 and 26 , a maximum of two or a maximum of five restoration coefficients may be referred to. For example, when the position of the residual coefficient is (x, y), a region including restoration coefficients having an absolute value of 1 or less of the sum of the x-coordinate difference with the residual coefficient and the y-coordinate difference or the restoration coefficient having an absolute value of 2 or less A region including the ? may be set as a peripheral restoration region.
또는, 잔차 계수와의 복원 영역 내 복원 계수들 중 블록 경계를 벗어나거나, 스캔 순서상 아직 복원되지 않은 복원 계수가 존재하는 경우, 위 이용 불가능한 복원 계수는 참조 대상에서 제외할 수 있다. Alternatively, if the reconstruction coefficients in the reconstruction area with the residual coefficients are out of a block boundary or there is a reconstruction coefficient that has not yet been restored in the scan order, the unavailable reconstruction coefficients may be excluded from the reference target.
문맥 정보를 이용하여 신택스를 부호화하는 경우, 잔차 계수 주변의 복원 계수들에 대한 신택스들의 값 또는 임시 복원 계수를 참조할 수 있다. 일 예로, sig_flag 부호화/복호화시, 잔차 계수 주변의 복원 영역에 포함된, 복원된 계수들의 sig_flag의 값을 합산할 수 있다. When syntax is encoded using context information, values of syntaxes for reconstruction coefficients around residual coefficients or temporary reconstruction coefficients may be referred to. For example, during sig_flag encoding/decoding, values of sig_flag of reconstructed coefficients included in a reconstructed area around the residual coefficient may be summed.
또는, 잔차 계수 주변의 복원 영역에 포함된, 복원된 계수 또는 부분적으로 복원된 계수의 절대값을 계산할 수 있다. 여기서, 부분적으로 복원된 계수의 절대값은, 1패스에 포함된 신택스들에 기초하여 유도되는 임시 복원 계수, 예컨대, (sig_flag + gt_1_flag + par_flag + (gt_2_flag<<1))을 의미할 수 있다.Alternatively, an absolute value of a reconstructed coefficient or a partially reconstructed coefficient included in a reconstructed area around the residual coefficient may be calculated. Here, the absolute value of the partially reconstructed coefficient may mean a temporary reconstructed coefficient derived based on syntaxes included in one pass, for example, (sig_flag + gt_1_flag + par_flag + (gt_2_flag<<1)).
유도된 값을 이용하여, 복수개의 문맥 정보들 중 하나를 특정할 수 있다. One of a plurality of context information may be specified using the derived value.
다른 예로, 잔차 계수의 부호화 방법에 따라, 주변 복원 영역의 문맥 정보를 이용할 것인지 여부를 결정할 수도 있다. 일 예로, 최대 n개의 gt_N_flag를 이용하는 제1 방식 및 최대 m개의 gt_N_flag를 이용하는 제2 방식 중 적어도 하나에서는, 주변 복원 영역의 문맥 정보를 이용하는 반면, 다른 하나에서는, 주변 복원 영역의 문맥 정보를 이용하지 않을 수 있다. 일 예로, 최대 2개의 gt_N_flag를 이용하는 부호화 방법하에서는, 주변 복원 영역을 참조하여 신택스들을 부호화하는 반면, 최대 5개의 gt_N_flag를 이용하는 부호화 방법하에서는, 주변 복원 영역을 참조하지 않고 신택스들을 부호화할 수 있다. 설명한 sig_flag뿐만 아니라, 다른 신택스들도 주변 복원 블록을 참조하여 부호화/복호화될 수 있다. 일 예로, rem_level 또는 abs_level 등을 부호화할 때, 주변 복원 블록을 참조하여 부호화할 수 있다. 위 신택스들을 지수 골룸 방법 또는 절삭된 라이스 방법으로 이진화하는 경우, 이진화 파라미터(예컨대, 라이스 파라미터) 결정시 주변 복원 블록을 참조할 수 있다. As another example, whether to use context information of a neighboring reconstruction region may be determined according to a residual coefficient encoding method. As an example, in at least one of the first method using up to n gt_N_flags and the second method using up to m gt_N_flags, context information of the surrounding reconstruction area is used, whereas in the other method, context information of the surrounding reconstruction area is not used. may not be For example, under an encoding method using a maximum of two gt_N_flags, syntaxes are encoded with reference to a neighboring reconstruction region, whereas under an encoding method using a maximum of five gt_N_flags, syntaxes may be encoded without referring to a neighboring reconstruction region. In addition to the sig_flag described above, other syntaxes may be encoded/decoded with reference to a neighboring reconstruction block. For example, when encoding rem_level or abs_level, the encoding may be performed with reference to a neighboring reconstruction block. When the above syntaxes are binarized by the exponential Gollum method or the truncated Rice method, the surrounding reconstruction block may be referred to when determining a binarization parameter (eg, a Rice parameter).
또는, 전술한 바와 같이, 잔차 계수의 부호화 방법에 따라, 이진화 파라미터 결정시 주변 복원 블록을 참조할 것인지 여부를 결정할 수도 있다. 일 예로, 최대 n개의 gt_N_flag를 이용하는 제1 방식 및 최대 m개의 gt_N_flag를 이용하는 제2 방식 중 하나에서는 주변 복원 블록을 참조하여 이진화 파라미터를 결정하는 반면, 다른 하나에서는 주변 복원 블록을 참조함이 없이 이진화 파라미터를 설정할 수 있다. 주변 블록을 참조하지 않는 경우, 이진화 파라미터는 부호화기 및 복호화기에서 기 정의된 값으로 설정될 수 있다. 일 예로, 기 정의된 값은, 0, 1 또는 2와 같은 정수일 수 있다. 또는, 이진화 파라미터를 결정하기 위한 정보가 상위 헤더를 통해 시그날링될 수 있다. 일 예로, 슬라이스, 픽처 또는 시퀀스 레벨에서 상기 정보가 부호화되어 시그날링될 수 있다. Alternatively, as described above, it may be determined whether to refer to the neighboring reconstruction block when determining the binarization parameter according to the encoding method of the residual coefficient. As an example, in one of the first scheme using up to n gt_N_flags and the second scheme using up to m gt_N_flags, a binarization parameter is determined by referring to a neighboring reconstruction block, while in the other, binarization is performed without referring to the neighboring reconstruction block. You can set parameters. When not referring to the neighboring block, the binarization parameter may be set to a value predefined in the encoder and the decoder. For example, the predefined value may be an integer such as 0, 1, or 2. Alternatively, information for determining a binarization parameter may be signaled through an upper header. For example, the information may be encoded and signaled at a slice, picture, or sequence level.
도 27 내지 도 29는, 본 개시에 따른 팔레트 모드(palette mode)의 개념을 설명하기 위한 도면이다.27 to 29 are diagrams for explaining the concept of the palette mode (palette mode) according to the present disclosure.
팔레트 모드는 부호화 대상 블록(이하, 현재 블록이라 함) 내에 많이 발생하는 화소를 특정 인덱스로 표시한 후, 화소 대신 그 특정 인덱스를 부호화 하여 복호화 장치로 전송하는 방식이다. 팔레트 모드가 허용되는지 여부를 나타내는 플래그를 부호화하여 복호화 장치로 전송할 수 있다. 이때, 상기 플래그는 현재 블록의 크기가 기-설정된 크기 이하인 경우에 한하여 부호화될 수 있다. 기-설정된 크기는 현재 블록이 속한 슬라이스의 슬라이스 타입, 현재 블록의 부호화 모드 또는 예측 모드에 기초하여 결정될 수 있다. 일 예로, 현재 블록이 I 슬라이스에 속한 경우, 현재 블록의 크기가 4x4인 경우에 한하여, 팔레트 모드가 이용될 수 있다. 현재 블록이 B 또는 P 슬라이스에 속한 경우, 현재 블록의 크기가 4x4보다 크고, 64x64 보다 작은 경우에 한하여, 팔레트 모드가 이용될 수 있다.도 27은 팔레트 테이블을 생성하는 과정에 대한 예시이다. 설명의 편의성을 위해 현재 블록의 크기는 4x4라고 가정하고 설명한다. 우선 현재 블록 안에 존재하는 16개의 화소들에 대한 히스토그램은 도 27과 같다. 도 27에서, 가로축은 화소 값(예를 들어 8 비트로 양자화된 화소인 경우 0~255 중 하나의 값)을 의미하며, 세로축은 화소 값의 빈도수를 의미한다. 그 후, 빈도수가 많이 발생하는 화소들을 기준으로 양자화 존을 설정한다. 양자화 존 안에 존재하는 화소들은 빈도수가 가장 높은 화소로 대체되고, 빈도수가 가장 높은 화소에 하나의 인덱스를 할당한다. 양자화 존의 크기를 나타내는 정보가 부호화되어 복호화 장치에 전송될 수 있다. 또는, 현재 블록의 크기, 형태, 또는 비트 뎁스 중 적어도 하나에 기초하여, 양자화 존의 크기를 결정할 수 있다.In the palette mode, pixels occurring a lot in a block to be encoded (hereinafter referred to as a current block) are displayed with a specific index, and then the specific index is encoded instead of the pixel and transmitted to the decoding device. A flag indicating whether the palette mode is permitted may be encoded and transmitted to the decoding apparatus. In this case, the flag may be coded only when the size of the current block is less than or equal to a preset size. The preset size may be determined based on the slice type of the slice to which the current block belongs, the encoding mode or the prediction mode of the current block. For example, when the current block belongs to the I slice, the palette mode may be used only when the size of the current block is 4x4. When the current block belongs to the B or P slice, the palette mode can be used only when the size of the current block is larger than 4x4 and smaller than 64x64. FIG. 27 is an example of a process of generating a palette table. For convenience of explanation, it is assumed that the size of the current block is 4x4. First, a histogram of 16 pixels existing in the current block is shown in FIG. 27 . In FIG. 27 , the horizontal axis indicates a pixel value (for example, a value from 0 to 255 in the case of a pixel quantized to 8 bits), and the vertical axis indicates the frequency of the pixel value. Thereafter, a quantization zone is set based on pixels that occur frequently. Pixels existing in the quantization zone are replaced with the pixel with the highest frequency, and one index is assigned to the pixel with the highest frequency. Information indicating the size of the quantization zone may be encoded and transmitted to a decoding apparatus. Alternatively, the size of the quantization zone may be determined based on at least one of the size, shape, and bit depth of the current block.
도 27에서, 양자화 존 안에 굵은 실선으로 표현된 부분이 빈도수가 가장 높은 화소들(a3, a8, a10, a11)을 의미하며, 가는 실선으로 표현된 부분은 그 외 화소들을 의미한다. 그리고 양자화존에 포함되지 않는 화소(양자화존 바깥에서 굵은 실선으로 표시된 부분)는 escape 값이라고 표현하며, 이 값의 경우 인덱스로 부호화 외에 추가적으로 양자화하여 부호화한다. In FIG. 27 , a part represented by a thick solid line in the quantization zone means pixels a3, a8, a10, a11 having the highest frequency, and a part represented by a thin solid line means other pixels. In addition, pixels not included in the quantization zone (parts indicated by thick solid lines outside the quantization zone) are expressed as escape values, and in this case, they are quantized and encoded in addition to encoding by index.
도 28은, 도 27에서 설정된 팔레트 테이블에 대한 예시를 보여준다. Figure 28 shows an example for the palette table set in Figure 27.
도 28에서 팔레트 테이블의 각 행을 팔레트 엔트리라고 표현하며, 각 엔트리마다 상이한 인덱스를 할당한다. 즉 팔레트 테이블의 크기는 엔트리의 개수를 의미할 수 있다. In Fig. 28, each row of the palette table is expressed as a palette entry, and a different index is assigned to each entry. That is, the size of the palette table may mean the number of entries.
각 양자화 존에서 가장 빈도수가 높았던 화소들(a3, a8, a10, a11)을 이용하여 엔트리를 구성하고, 각 엔트리마다 인덱스를 할당한다. 만약 escape 값이 존재한다면, 마지막 엔트리에 escape를 배치하고 인덱스를 할당할 수 있다. 즉, 팔레트 내 마지막 인덱스는 escape 값을 의미하게 할 수 있다. An entry is formed using pixels a3, a8, a10, and a11 having the highest frequency in each quantization zone, and an index is assigned to each entry. If an escape value exists, an escape can be placed in the last entry and an index can be assigned. That is, the last index in the palette can mean an escape value.
도 29는 설정된 팔레트 테이블을 이용하여, 블록 안의 화소들이 인덱스로 할당되는 과정에 대한 예시이다. 도 29에서, 할당된 인덱스들을 팔레트 인덱스라고 표현한다.29 is an example of a process in which pixels in a block are allocated as indexes using a set palette table. In Figure 29, the allocated indexes are expressed as palette indexes.
블록 안에 존재하던 화소들은 설정된 팔레트 테이블에 따라 인덱스로 대체되며, 인덱스가 부호화되어 복호화 장치로 전송된다. 그리고 escape 값으로 표시된 경우 (도 29에서 a5, a15), 인덱스 외에 추가적으로 양자화된 a5'와 a15'가 부호화된다. 또한 사용된 팔레트 테이블 또한 부호화되어 복호화 장치로 전송된다.Pixels existing in the block are replaced with indexes according to the set palette table, and the indexes are encoded and transmitted to the decoding device. In addition, when indicated as escape values (a5, a15 in FIG. 29), quantized a5' and a15' in addition to the index are encoded. In addition, the used palette table is also encoded and transmitted to the decoding device.
도 30은 본 개시에 따른 팔레트 모드(palette mode)에 기반하여 인트라 예측을 수행하는 방법을 도시한 것이다.30 illustrates a method of performing intra prediction based on a palette mode according to the present disclosure.
팔레트 모드는 블록 단위(예를 들어, 코딩 유닛, 예측 유닛)로 적용될 수 있으며, 이를 위해 블록 단위로 팔레트 모드의 사용 여부를 나타내는 플래그 정보(pred_mode_plt_flag)를 시그날링할 수도 있다. 즉, 상기 플래그의 값이 1인 경우, 현재 블록에 대해 팔레트 모드가 적용되고, 상기 플래그의 값이 0인 경우, 현재 블록에 대해서 팔레트 모드가 적용되지 않는다.The palette mode may be applied on a block-by-block basis (eg, a coding unit, a prediction unit), and for this, flag information (pred_mode_plt_flag) indicating whether to use the palette mode may be signaled on a block-by-block basis. That is, when the value of the flag is 1, the palette mode is applied to the current block, and when the value of the flag is 0, the palette mode is not applied to the current block.
상기 플래그는, 현재 블록의 예측 모드 또는 현재 블록의 크기 중 적어도 하나에 기초하여 적응적으로 부호화/복호화될 수 있다. 예를 들어, 상기 플래그는 현재 블록의 예측 모드가 인트라 모드인 경우에 한하여 부호화/복호화될 수 있다. 상기 플래그는 현재 블록의 예측 모드가 스킵 모드(skip mode)가 아닌 경우에 한하여 부호화/복호화될 수 있다. 상기 플래그는 현재 블록의 너비 또는 높이 중 적어도 하나가 소정의 제1 문턱크기보다 작거나 같은 경우에 한하여 부호화/복호화될 수 있다. 여기서, 제1 문턱크기는 부호화/복호화 장치에 기-정의된 값으로서, 16, 32, 또는 64 중 어느 하나일 수 있다. 상기 플래그는 현재 블록의 너비와 높이의 곱이 소정의 제2 문턱크기보다 큰 경우에 한하여 부호화/복호화될 수 있다. 여기서, 제2 문턱크기는 부호화/복호화 장치에 기-정의된 값으로서, 16, 32, 또는 64 중 어느 하나일 수 있다. 다만, 상기 제1 문턱크기와 제2 문턱크기는 서로 다른 값일 수 있다. 전술한 조건 중 어느 하나라도 만족하지 않는 경우, 상기 플래그는 부호화/복호화되지 않으며, 이 경우 상기 플래그의 값은 0으로 설정될 수 있다.The flag may be adaptively encoded/decoded based on at least one of a prediction mode of the current block and a size of the current block. For example, the flag may be encoded/decoded only when the prediction mode of the current block is the intra mode. The flag may be encoded/decoded only when the prediction mode of the current block is not a skip mode. The flag may be encoded/decoded only when at least one of a width or a height of the current block is less than or equal to a predetermined first threshold size. Here, the first threshold size is a pre-defined value in the encoding/decoding apparatus, and may be any one of 16, 32, or 64. The flag may be encoded/decoded only when the product of the width and height of the current block is greater than a predetermined second threshold size. Here, the second threshold size is a value pre-defined in the encoding/decoding apparatus, and may be any one of 16, 32, or 64. However, the first threshold size and the second threshold size may be different values. If any one of the above conditions is not satisfied, the flag is not encoded/decoded, and in this case, the value of the flag may be set to 0.
도 30을 참조하면, 현재 블록의 팔레트 모드를 위한 팔레트 테이블(palette table)을 구성할 수 있다(S3000).Referring to Figure 30, it is possible to configure a palette table (palette table) for the palette mode of the current block (S3000).
팔레트 테이블은 적어도 하나의 팔레트 엔트리(palette entry)와 각각의 팔레트 엔트리를 식별하는 팔레트 인덱스(palette index)로 구성될 수 있다. 현재 블록의 팔레트 테이블은 이전 블록의 팔레트 테이블(이하, 이전 팔레트 테이블이라 함)를 이용하여 결정될 수 있다. 여기서, 이전 블록은 현재 블록 이전에 부호화 또는 복호화된 블록을 의미할 수 있다.The palette table may consist of at least one palette entry and a palette index identifying each palette entry. The palette table of the current block may be determined using the palette table of the previous block (hereinafter referred to as the previous palette table). Here, the previous block may mean a block coded or decoded before the current block.
구체적으로, 현재 블록의 팔레트 엔트리는 예측된 팔레트 엔트리 또는 시그널링된 팔레트 엔트리 중 적어도 하나를 포함할 수 있다. 현재 블록은 이전 블록이 사용한 팔레트 엔트리의 전부 또는 일부를 사용할 수 있으며, 이와 같이 이전 블록에서 사용된 팔레트 엔트리 중 현재 블록에서 재사용되는 팔레트 엔트리를 예측된 팔레트 엔트리라 부르기로 한다.Specifically, the palette entry of the current block may include at least one of a predicted palette entry or a signaled palette entry. The current block may use all or part of the palette entries used by the previous block, and among the palette entries used in the previous block, the palette entry reused in the current block is called a predicted palette entry.
현재 블록은 이전 팔레트 테이블의 팔레트 엔트리 전부 이용할 수 있다. 또는, 현재 블록은 이전 팔레트 테이블의 팔레트 엔트리 중 일부를 이용할 수도 있으며, 이를 위해 팔레트 엔트리의 재사용 여부를 특정하는 플래그(PalettePredictorEntryReuseFlag, 이하 팔레트 예측 플래그라 함)가 이용될 수 있다. 이전 팔레트 테이블의 팔레트 엔트리 각각에 상기 팔레트 예측 플래그의 값이 할당되며, 상기 팔레트 예측 플래그(PalettePredictorEntryReuseFlag[i])는 이전 팔레트 테이블에서 팔레트 인덱스 i에 대응하는 팔레트 엔트리가 현재 블록의 팔레트 테이블에 재사용되는지 여부를 나타낼 수 있다. 예를 들어, 상기 팔레트 예측 플래그의 값이 1인 경우에는 이전 팔레트 테이블에서 팔레트 인덱스 i에 대응하는 팔레트 엔트리가 현재 블록의 팔레트 테이블에 재사용되고, 상기 팔레트 예측 플래그의 값이 0인 경우에는 재사용되지 아니한다. 이전 팔레트 테이블로부터 팔레트 예측 플래그의 값이 1인 팔레트 엔트리를 추출하고, 이를 순차적으로 배열하여 현재 블록의 팔레트 테이블을 구성할 수 있다.The current block can use all of the palette entries in the previous palette table. Alternatively, the current block may use some of the palette entries of the previous palette table, and for this, a flag (PalettePredictorEntryReuseFlag, hereinafter referred to as a palette prediction flag) for specifying whether to reuse the palette entry may be used. The value of the palette prediction flag is assigned to each palette entry of the previous palette table, and the palette prediction flag (PalettePredictorEntryReuseFlag[i]) determines whether the palette entry corresponding to the palette index i in the previous palette table is reused in the palette table of the current block. can indicate whether For example, when the value of the palette prediction flag is 1, the palette entry corresponding to the palette index i in the previous palette table is reused in the palette table of the current block, and when the value of the palette prediction flag is 0, it is not reused No. A palette table of the current block may be constructed by extracting a palette entry having a value of the palette prediction flag of 1 from the previous palette table, and arranging them sequentially.
한편, 현재 블록의 팔레트 테이블은 소정의 영역 단위로 초기화될 수 있다. 여기서, 소정의 영역은 병렬 처리 영역을 의미하거나, 현재 픽쳐의 CTU 행을 의미할 수도 있다. 만일 현재 블록이 CTU 행의 첫번째 CTU에 속한 경우, 현재 블록의 팔레트 테이블은 현재 블록이 속한 CTU의 이웃 CTU의 팔레트 테이블로 초기화될 수 있다. 여기서, 이웃 CTU는 현재 블록이 속한 CTU의 상단에 위치한 CTU를 의미할 수 있다. 즉, N번째 CTU 행의 첫번째 CTU에 대한 팔레트 테이블은 (N-1)번째 CTU 행의 첫번째 CTU에 대한 팔레트 테이블을 기반으로 초기화될 수 있다. 초기화된 팔레트 테이블은, 동일 CTU 행에 속한 이전 블록의 팔레트 테이블을 기반으로 업데이트될 수 있다. 전술한 실시예는 일예에 불과하며, 현재 블록의 팔레트 테이블을 구성하는 방법에 대해서는 도 31 내지 도 32를 참조하여 자세히 살펴보도록 한다.Meanwhile, the palette table of the current block may be initialized in units of a predetermined area. Here, the predetermined region may mean a parallel processing region or a CTU row of the current picture. If the current block belongs to the first CTU of the CTU row, the palette table of the current block may be initialized with the palette table of the neighboring CTU of the CTU to which the current block belongs. Here, the neighboring CTU may mean a CTU located above the CTU to which the current block belongs. That is, the palette table for the first CTU of the N-th CTU row may be initialized based on the palette table for the first CTU of the (N-1)-th CTU row. The initialized palette table may be updated based on the palette table of the previous block belonging to the same CTU row. The above-described embodiment is merely an example, and a method of configuring the palette table of the current block will be described in detail with reference to FIGS. 31 to 32 .
한편, 상기 팔레트 예측 플래그는 팔레트 엔트리 별로 부호화/복호화된 플래그의 형태로 시그날링될 수 있다. 또는, 상기 팔레트 예측 플래그는 런 렝스(run length) 부호화 기반의 바이너리 벡터의 형태로 부호화/복호화될 수 있다. 즉, 이전 팔레트 엔트리의 재사용 여부를 특정하는 팔레트 예측 플래그 어레이에서, 0이 아닌 팔레트 예측 플래그들 사이에 있는 0인 팔레트 예측 플래그의 개수를 특정하는 신택스 palette_predictor_run가 부호화/복호화될 수 있다. 이에 대해서는 후술하기로 한다.Meanwhile, the palette prediction flag may be signaled in the form of an encoded/decoded flag for each palette entry. Alternatively, the palette prediction flag may be encoded/decoded in the form of a binary vector based on run length encoding. That is, in the palette prediction flag array that specifies whether to reuse the previous palette entry, a syntax palette_predictor_run that specifies the number of palette prediction flags that is 0 between non-zero palette prediction flags may be encoded/decoded. This will be described later.
또는, 런 렝스를 부호화하는 대신, 팔레트 예측 플래그 값들을 직접 부호화할 수도 있다. 이에 대해서는, 후술하기로 한다.Alternatively, instead of encoding the run length, the palette prediction flag values may be directly encoded. This will be described later.
또한, 현재 블록의 팔레트 테이블은 비트스트림을 통해 시그날링된 팔레트 엔트리를 더 포함할 수 있으며, 여기서, 상기 시그날링된 팔레트 엔트리는 현재 블록이 사용하는 팔레트 엔트리 중 이전 팔레트 테이블에 포함되지 않은 팔레트 엔트리를 의미할 수 있다. 시그날링된 팔레트 엔트리는 팔레트 테이블의 예측된 팔레트 엔트리 이후에 추가될 수 있다.In addition, the palette table of the current block may further include a palette entry signaled through a bitstream, wherein the signaled palette entry is a palette entry that is not included in the previous palette table among the palette entries used by the current block can mean The signaled palette entry may be added after the predicted palette entry of the palette table.
도 30을 참조하면, 현재 블록의 화소 단위로 팔레트 인덱스(palette index)를 결정할 수 있다(S3010).Referring to FIG. 30 , a palette index may be determined in units of pixels of the current block ( S3010 ).
현재 블록은 인덱스 모드(INDEX MODE) 또는 카피 모드(COPY MODE) 중 적어도 하나를 이용하여 팔레트 인덱스를 결정할 수 있다. The current block may determine the palette index using at least one of an index mode (INDEX MODE) or a copy mode (COPY MODE).
여기서, 인덱스 모드(INDEX MODE)는 현재 블록에서 사용되는 팔레트 인덱스를 특정하기 위해 부호화 장치에서 팔레트 인덱스 정보(palette_idx_idc)를 부호화하는 방식을 의미할 수 있다. 복호화 장치는, 부호화된 팔레트 인덱스 정보에 기반하여 현재 화소의 팔레트 인덱스를 유도할 수 있다. 팔레트 인덱스 정보는 0에서 (MaxPaletteIndex-1) 사이의 값을 가지며, 여기서 MaxPaletteIndex는 현재 블록의 팔레트 테이블의 크기 또는 팔레트 테이블을 구성하는 팔레트 엔트리의 개수를 의미할 수 있다. 인덱스 모드에서는, 비트스트림을 통해 시그날링된 팔레트 인덱스 정보의 값이 현재 화소의 팔레트 인덱스로 할당될 수 있다.Here, the index mode (INDEX MODE) may mean a method of encoding the palette index information (palette_idx_idc) in the encoding apparatus to specify the palette index used in the current block. The decoding apparatus may derive the palette index of the current pixel based on the encoded palette index information. The palette index information has a value between 0 and (MaxPaletteIndex-1), where MaxPaletteIndex may mean the size of the palette table of the current block or the number of palette entries constituting the palette table. In the index mode, the value of the palette index information signaled through the bitstream may be allocated as the palette index of the current pixel.
카피 모드(COPY MODE)는 소정의 스캔 순서에 따른 이웃 화소의 팔레트 인덱스를 이용하여 현재 화소의 팔레트 인덱스를 결정하는 방식을 의미할 수 있다. 여기서, 본 개시에 따른 스캔 순서로서, 수평 방향 스캔, 수직 방향 스캔, 대각 방향 스캔 등이 이용될 수 있으며, 이 중 어느 하나가 선택적으로 이용될 수 있다. 이를 위해, 소정의 플래그 또는 인덱스가 부호화/복호화될 수 있다. 예를 들어, 부호화 장치는, 현재 블록의 스캔 순서로서 수평 방향 스캔이 적용되는 경우, 상기 플래그를 0으로 부호화하고, 현재 블록의 스캔 순서로서 수직 방향 스캔이 적용되는 경우, 상기 플래그를 1로 부호화할 수 있다. 복호화 장치는, 부호화된 플래그에 따라 현재 블록의 스캔 순서를 적응적으로 결정할 수 있다. 다만, 이에 한정되지 아니하며, 스캔 순서에 따라 팔레트 인덱스를 부호화/복호화하는 방법에 대해서는 후술하기로 한다.The copy mode (COPY MODE) may refer to a method of determining the palette index of the current pixel by using the palette index of the neighboring pixel according to a predetermined scan order. Here, as the scan order according to the present disclosure, a horizontal scan, a vertical scan, a diagonal scan, etc. may be used, and any one of them may be selectively used. To this end, a predetermined flag or index may be encoded/decoded. For example, the encoding apparatus encodes the flag as 0 when horizontal scan is applied as the scan order of the current block, and codes the flag as 1 when vertical scan is applied as the scan order of the current block. can do. The decoding apparatus may adaptively determine the scan order of the current block according to the coded flag. However, the present invention is not limited thereto, and a method of encoding/decoding the palette index according to the scan order will be described later.
카피 모드에서는, 이웃 화소의 팔레트 인덱스에 기초하여 현재 화소의 팔레트 인덱스를 예측할 수도 있고, 이웃 화소의 팔레트 인덱스를 복사하여 그대로 현재 화소의 팔레트 인덱스로 설정할 수도 있다. 여기서, 이웃 화소는 현재 화소의 상단, 하단, 좌측 또는 우측에 인접한 화소를 의미할 수 있다. 특히, 상기 이웃 화소는 현재 화소와 동일 수평 라인 또는 동일 수직 라인에 위치한 것일 수 있다.In the copy mode, the palette index of the current pixel may be predicted based on the palette index of the neighboring pixel, or the palette index of the neighboring pixel may be copied and set as the palette index of the current pixel as it is. Here, the neighboring pixel may mean a pixel adjacent to the top, bottom, left, or right of the current pixel. In particular, the neighboring pixel may be located on the same horizontal line or the same vertical line as the current pixel.
예를 들어, 상기 카피 모드는 현재 화소의 상단 또는 하단에 인접한 화소가 사용한 팔레트 인덱스를 현재 화소의 팔레트 인덱스로 동일하게 사용하는 제1 카피 모드, 현재 화소의 좌측 또는 우측에 인접한 화소가 사용한 팔레트 인덱스를 현재 화소의 팔레트 인덱스로 동일하게 사용하는 제2 카피 모드, 또는 현재 화소의 대각 방향으로 인접한 화소가 사용한 팔레트 인덱스를 현재 화소의 팔레트 인덱스로 동일하게 사용하는 제3 카피 모드 중 적어도 하나를 포함할 수 있다. For example, the copy mode is the first copy mode in which the palette index used by the pixel adjacent to the top or bottom of the current pixel is identically used as the palette index of the current pixel, the palette index used by the pixel adjacent to the left or right of the current pixel At least one of a second copy mode that uses the same as the palette index of the current pixel, or a third copy mode that uses the palette index used by diagonally adjacent pixels of the current pixel equally as the palette index of the current pixel can
한편, 현재 블록의 스캔 순서에 따라 전술한 제1 내지 제3 카피 모드 중 어느 하나가 선택적으로 사용될 수 있다. 예를 들어, 상기 제1 카피 모드는 현재 블록의 스캔 순서가 수직 방향 스캔인 경우에 적용되고, 제2 카피 모드는 현재 블록의 스캔 순서가 수평 방향 스캔인 경우에 적용될 수 있다.Meanwhile, any one of the above-described first to third copy modes may be selectively used according to the scan order of the current block. For example, the first copy mode may be applied when the scan order of the current block is a vertical scan, and the second copy mode may be applied when the scan order of the current block is a horizontal scan.
또한, 현재 블록의 스캔 시작 위치는 현재 블록의 좌상단 화소로 한정되지 아니하며, 현재 블록의 다른 코너 화소(예를 들어, 좌하단 화소, 우상단 화소, 우하단 화소)이 스캔 시작 위치로 이용될 수도 있다. 따라서, 현재 블록의 스캔 순서 및 스캔 시작 위치에 따라 상술한 바와 같이 상단 또는 좌측에 인접한 화소와 동일한 팔레트 인덱스를 사용할 수도 있고, 하단 또는 우측에 인접한 화소와 동일한 팔레트 인덱스를 사용할 수도 있다.In addition, the scan start position of the current block is not limited to the upper-left pixel of the current block, and other corner pixels of the current block (eg, lower-left pixel, upper-right pixel, and lower-right pixel) may be used as the scan start position. . Accordingly, according to the scan order and scan start position of the current block, the same palette index as the pixel adjacent to the top or left may be used as described above, or the same palette index as the pixel adjacent to the bottom or right may be used.
전술한 인덱스 모드와 카피 모드 중 어느 하나가 선택적으로 이용될 수 있다. 예를 들어, 부호화 장치는 카피 모드가 사용되는지 여부를 나타내는 플래그(run_copy_flag)를 부호화할 수 있다. 여기서, 만일 카피 모드가 사용되는 경우, 부호화 장치는 상기 플래그를 1로 부호화하고, 그렇지 않은 경우(즉, 인덱스 모드가 사용되는 경우), 부호화 장치는 상기 플래그를 0으로 부호화할 수 있다.Any one of the above-described index mode and copy mode may be selectively used. For example, the encoding apparatus may encode a flag (run_copy_flag) indicating whether the copy mode is used. Here, if the copy mode is used, the encoding apparatus may encode the flag as 1, otherwise (ie, if the index mode is used), the encoding apparatus may encode the flag as 0.
도 30을 참조하면, 상기 팔레트 테이블과 팔레트 인덱스에 기반하여, 현재 블록의 화소를 예측할 수 있다(S3020).Referring to FIG. 30, based on the palette table and the palette index, it is possible to predict the pixel of the current block (S3020).
구체적으로, 현재 블록의 팔레트 테이블로부터 상기 팔레트 인덱스와 동일한 값의 팔레트 인덱스를 가진 팔레트 엔트리를 추출하고, 이를 이용하여 현재 블록의 화소를 예측/복원할 수 있다. 예를 들어, 팔레트 테이블로부터 추출된 팔레트 엔트리의 값이 현재 블록의 화소의 예측값 또는 복원값으로 설정될 수 있다.Specifically, it is possible to extract a palette entry having a palette index of the same value as the palette index from the palette table of the current block, and predict/restore the pixel of the current block using this. For example, the value of the palette entry extracted from the palette table may be set as the predicted value or the restored value of the pixel of the current block.
다만, 상기 팔레트 인덱스가 현재 블록의 팔레트 테이블 내 팔레트 엔트리 중 마지막 팔레트 엔트리를 지시하는 경우, 해당 화소는 이스케이프 모드(ESCAPE MODE)로 부호화된 것으로 유추될 수 있다. 여기서, 이스케이프 모드라 함은, 기-구성된 팔레트 테이블의 팔레트 엔트리를 이용하지 않고, 대신에 추가적으로 시그날링되는 팔레트 이스케이프 값(palette escape value)에 기반하여 화소를 예측/복원하는 방식을 의미할 수 있다. 따라서, (팔레트 엔트리의 개수-1)과 동일한 값의 팔레트 인덱스를 가진 화소는 상기 추가적으로 시그날링되는 팔레트 이스케이프 값을 이용하여 예측/복원될 수 있다.However, when the palette index indicates the last palette entry among the palette entries in the palette table of the current block, the pixel may be inferred as being encoded in the escape mode (ESCAPE MODE). Here, the escape mode does not use the palette entry of the pre-configured palette table, but instead predicts / restores the pixel based on the additionally signaled palette escape value It can mean a method. . Accordingly, a pixel having a palette index equal to (the number of palette entries - 1) may be predicted/restored using the additionally signaled palette escape value.
전술한 실시예는 일예에 불과하며, 팔레트 테이블을 구성하는 다양한 방법에 대해서는 이하의 도면을 참조하여 상세히 설명하기로 한다.The above-described embodiment is merely an example, and various methods of configuring the pallet table will be described in detail with reference to the following drawings.
도 31 및 도 32는 본 개시에 따른 팔레트 테이블을 구성하는 방법을 도시한 것이다.31 and 32 show a method of configuring a pallet table according to the present disclosure.
현재 블록이 팔레트 모드로 부호화된 경우, 부호화 장치에서 사용한 동일한 팔레트 테이블이 복호화 장치에서도 존재해야 한다. 따라서 부호화 장치에서 팔레트 테이블을 부호화해야만 한다. 따라서 팔레트 테이블에 존재하는 팔레트 엔트리의 개수를 부호화하고, 각 엔트리마다 할당된 화소값을 부호화할 수 있다. 하지만 이러한 방식은 블록의 크기가 커질수록, 엔트리의 개수가 많아 질수록 부호화 되는 비트량이 급격히 증가하게 된다. 따라서 이전 블록에서 팔레트 모드를 사용했다면, 이전 블록에서 사용했던 팔레트 테이블을 기초로 현재 블록의 팔레트 테이블을 생성함으로써, 팔레트 테이블을 부호화하는데 필요한 비트량을 크게 줄여줄 수 있다. 여기서, 이전 블록은 현재 블록 이전에 부호화/복호화가 완료된 블록을 의미한다. 구체적으로, 이전 팔레트 테이블을 기초로 현재 블록의 팔레트 테이블을 구성하는지 여부를 나타내는 플래그 또는 이전 블록의 팔레트 테이블에 포함된 엔트리를 현재 블록의 팔레트 테이블에 추가할 것인지 여부를 나타내는 팔레트 예측 플래그 중 적어도 하나를 이용할 수 있다. When the current block is encoded in the palette mode, the same palette table used in the encoding apparatus must also exist in the decoding apparatus. Therefore, it is necessary to encode the palette table in the encoding device. Therefore, it is possible to encode the number of palette entries existing in the palette table, and to encode the pixel value assigned to each entry. However, in this method, as the size of the block increases and the number of entries increases, the amount of encoded bits rapidly increases. Therefore, if the palette mode was used in the previous block, the amount of bits required to encode the palette table can be greatly reduced by generating the palette table of the current block based on the palette table used in the previous block. Here, the previous block means a block that has been encoded/decoded before the current block. Specifically, at least one of a flag indicating whether to configure the palette table of the current block based on the previous palette table or a palette prediction flag indicating whether to add an entry included in the palette table of the previous block to the palette table of the current block is available.
도 31은 팔레트 예측 플래그를 이용하여, 현재 부호화 하려는 팔레트 테이블의 비트량을 줄이는 방법이다. 31 is a method of reducing the bit amount of a palette table to be currently encoded by using a palette prediction flag.
도 31에서 팔레트 테이블 A는, 현재 블록 이전에 팔레트 모드를 이용하여 부호화된 블록에 존재하는 팔레트 테이블을 의미할 수 있다. 여기서, 이전 블록은 현재 블록에 인접하는 이웃 블록일 수 있다. 이웃 블록은, 상단 이웃 블록, 좌측 이웃 블록, 좌상단 이웃 블록, 우상단 이웃 블록 또는 좌하단 이웃 블록 중 적어도 하나를 포함할 수 있다. In FIG. 31 , the palette table A may mean a palette table existing in a block encoded using the palette mode before the current block. Here, the previous block may be a neighboring block adjacent to the current block. The neighboring block may include at least one of an upper neighboring block, a left neighboring block, an upper left neighboring block, an upper right neighboring block, or a lower left neighboring block.
팔레트 테이블 A에서, 각 엔트리마다 팔레트 예측 플래그를 이용하여 현제 팔레트 테이블에 그대로 사용되는지 여부를 특정할 수 있다. 예를 들어 팔레트 예측 플래그가 1이면 해당 엔트리가 현재 팔레트 테이블에 그대로 사용됨을 의미하고, 0이면 해당 엔트리가 현재 팔레트 테이블에 사용되지 않음을 의미할 수 있다. 팔레트 테이블 A로부터 예측된 엔트리들에 할당되는 인덱스는 팔레트 테이블 A에 할당된 인덱스와 동일하게 설정될 수 있다. 또는, 팔레트 테이블 A에서 각 엔트리에 할당되었던 인덱스들의 오름차순/내림차순으로 각 엔트리들의 인덱스를 재할당할 수 있다. In the palette table A, it is possible to specify whether or not to be used as it is in the current palette table by using a palette prediction flag for each entry. For example, if the palette prediction flag is 1, it may mean that the corresponding entry is used as it is in the current palette table, and if 0, it may mean that the corresponding entry is not used in the current palette table. The index allocated to the entries predicted from the palette table A may be set to be the same as the index allocated to the palette table A. Alternatively, the index of each entry in the ascending/descending order of the indexes allocated to each entry in the palette table A may be reassigned.
도 31의 예에서는, 첫번째 엔트리, 세번째 엔트리, 다섯번째 엔트리는 현재 팔레트 테이블에서 사용되므로, 현재 팔레트 테이블의 첫번째 엔트리부터 세번째 엔트리까지 순서대로 넣어주고 네번째 엔트리부터 다섯 번째 엔트리까지만 새로운 엔트리를 구성할 수 있다. 이러한 방식의 경우 팔레트 예측 플래그를 먼저 부호화하고, 나머지 엔트리의 개수(도 31의 예에서는 2개: 현재 팔레트 테이블의 네번째 엔트리와 다섯번째 엔트리)를 부호화할 수 있다. 그 후 나머지 엔트리의 개수만큼 나머지 엔트리를 부호화할 수 있다. 상기 정보들을 복호화 장치로 전송하여 복호화 장치에서도 부호화 장치와 동일한 팔레트 테이블을 생성하고 현재 블록을 예측/복원할 수 있게 한다. In the example of Figure 31, the first entry, the third entry, and the fifth entry are used in the current palette table, so you can put them in order from the first entry to the third entry of the current palette table, and configure a new entry only from the fourth entry to the fifth entry. have. In this case, the palette prediction flag is encoded first, and the number of remaining entries (two in the example of FIG. 31: the fourth entry and the fifth entry of the current palette table) can be encoded. After that, the remaining entries may be encoded as much as the number of remaining entries. By transmitting the information to the decoding device, the decoding device can also generate the same palette table as the coding device and predict/restore the current block.
복호화 장치에서도 부호화 장치와 동일한 팔레트 테이블을 구성하기 위해, 팔레트 테이블과 관련한 정보를 부호화하여 시그날링 할 수 있다. In order to configure the same palette table as the encoding apparatus in the decoding apparatus, information related to the palette table may be encoded and signaled.
일 예로, 비트스트림을 통해 현재 팔레트 테이블에 포함된 엔트리의 개수를 나타내는 정보 또는 이전 팔레트 테이블의 크기와의 차분값을 나타내는 정보 중 적어도 하나가 부호화되어 복호화 장치로 전송될 수 있다. 여기서, 팔레트 테이블의 크기는 팔레트 테이블이 포함할 수 있는 최대 팔레트 엔트리의 개수를 나타낼 수 있다. For example, through a bitstream, at least one of information indicating the number of entries included in the current palette table or information indicating a difference value with the size of the previous palette table may be encoded and transmitted to the decoding apparatus. Here, the size of the palette table may indicate the maximum number of palette entries that the palette table can contain.
또는, 팔레트 테이블의 크기는 부호화기 및 복호화기에서 고정된 값을 가질 수도 있다.또는, 현재 영상의 비트 심도, 현재 블록의 컬러 성분(예컨대, 휘도 성분 또는 색차 성분인지 여부), 현재 블록의 크기 또는 형태 중 적어도 하나에 기초하여, 팔레트 테이블의 크기가 결정될 수도 있다. Alternatively, the size of the palette table may have a fixed value in the encoder and decoder. Alternatively, the bit depth of the current image, the color component of the current block (eg, whether it is a luminance component or a chrominance component), the size of the current block, or Based on at least one of the shapes, the size of the pallet table may be determined.
현재 블록의 팔레트 테이블은 이전 팔레트 테이블에서 재사용된 팔레트 엔트리들과 새롭게 추가된 팔레트 엔트리들로 구성될 수 있다. 팔레트 테이블을 구성하는 재사용된 팔레트 엔트리들과 새롭게 추가된 팔레트 엔트리들에 대한 정보가 부호화되어 시그날링될 수 있다. The palette table of the current block may consist of palette entries reused in the previous palette table and palette entries newly added. Information about the reused palette entries constituting the palette table and the newly added palette entries may be encoded and signaled.
일 예로, 이전 팔레트 테이블에 포함된 팔레트 엔트리가 재사용되는지 여부를 나타내는 팔레트 예측 플래그가 부호화될 수 있다. As an example, a palette prediction flag indicating whether a palette entry included in a previous palette table is reused may be encoded.
팔레트 테이블이 포함할 수 있는 최대 팔레트 엔트리의 개수보다 이전 팔레트 테이블에서 재사용되는 팔레트 엔트리의 개수가 작은 경우, 새로운 팔레트 엔트리에 대한 정보가 추가 부호화될 수 있다. 이때, 팔레트 테이블에 새롭게 추가될 팔레트 엔트리의 개수는 팔레트 테이블의 크기에서 재사용된 팔레트 엔트리의 개수를 차분한 값일 수 있다. 일 예로, 팔레트 테이블이 포함할 수 있는 최대 팔레트 엔트리의 개수가 40개인 경우, 재사용된 팔레트 엔트리의 개수와 새로운 팔레트 엔트리의 개수의 합은 40을 초과할 수 없다. When the number of palette entries reused in the previous palette table is smaller than the maximum number of palette entries that the palette table can contain, information on the new palette entry may be additionally encoded. In this case, the number of palette entries to be newly added to the palette table may be a value obtained by subtracting the number of palette entries reused from the size of the palette table. For example, if the maximum number of palette entries that the palette table can contain is 40, the sum of the number of reused palette entries and the number of new palette entries cannot exceed 40.
반면, 재사용된 팔레트 엔트리의 개수가 팔레트 테이블이 포함할 수 있는 최대 팔레트 엔트리의 개수와 동일한 경우, 더 이상 팔레트 테이블에 새로운 팔레트 엔트리가 추가되지 않는다. 이 경우, 새로운 팔레트 엔트리에 대한 정보의 부호화가 생략될 수 있다. On the other hand, when the number of reused palette entries is the same as the maximum number of palette entries that the palette table can contain, no new palette entries are added to the palette table anymore. In this case, encoding of information for a new palette entry may be omitted.
팔레트 엔트리의 재사용 여부의 판단 횟수가 임계값을 초과하지 않도록 설정할 수 있다. 즉, 팔레트 예측 플래그의 개수가 임계값을 초과하지 않도록 설정될 수 있다. 일 예로, 임계값이 10인 경우, 이전 팔레트 테이블에 포함된 팔레트 엔트리들 중 최대 10개에 대해, 재사용 여부를 판단할 수 있다. 이에 따라, 최대 10개의 팔레트 예측 플래그가 생성될 수 있다.It can be set so that the number of times of determining whether to reuse the palette entry does not exceed a threshold. That is, the number of palette prediction flags may be set so as not to exceed a threshold value. For example, if the threshold value is 10, for up to 10 of the palette entries included in the previous palette table, it can be determined whether to reuse. Accordingly, a maximum of 10 palette prediction flags may be generated.
다른 예로, 재사용되는 팔레트 엔트리의 개수가 임계값을 초과하지 않도록 설정할 수 있다. 즉, 값이 참(True)인 팔레트 예측 플래그의 개수가 임계값을 초과하지 않도록 설정될 수 있다.As another example, it may be set so that the number of reused palette entries does not exceed a threshold value. That is, the number of palette prediction flags having a value of True may be set so as not to exceed a threshold value.
임계값은, 슬라이스, 픽처 또는 시퀀스 등 상위 헤더를 통해 부호화될 수 있다. 또는, 블록 별로 임계값을 특정하기 위한 정보가 부호화되어 시그날링될 수 있다.The threshold value may be encoded through an upper header such as a slice, a picture, or a sequence. Alternatively, information for specifying a threshold value for each block may be encoded and signaled.
다른 예로, 부호화기 및 복호화기에서 고정된 값의 임계값을 사용할 수 있다.As another example, an encoder and a decoder may use a fixed value threshold.
또는, 블록의 크기, 형태, 컬러 성분(예컨대, 휘도 성분인지 여부 또는 색차 성분인지 여부), 또는 비트 심도 중 적어도 하나에 기초하여 임계값이 결정될 수 있다. Alternatively, the threshold value may be determined based on at least one of a size, a shape, a color component (eg, a luminance component or a chrominance component) of the block, or a bit depth.
혹은 팔레트 예측 플래그를 이용하여 가져올 수 있는 엔트리의 개수(이하, 최대 예측 개수라 함)를 제한할 수 있다. 일 예로, 최대 예측 개수에 대한 정보가 비트스트림을 통해 시그날링될 수 있다. 또는, 팔레트 테이블의 크기, 현재 블록의 크기/형태, 이전 블록의 크기/형태 또는 이전 팔레트 테이블의 크기 중 적어도 하나에 기초하여 최대 예측 개수가 결정될 수 있다. Alternatively, it is possible to limit the number of entries (hereinafter, referred to as the maximum number of predictions) that can be brought by using the palette prediction flag. As an example, information on the maximum number of predictions may be signaled through a bitstream. Alternatively, the maximum number of predictions may be determined based on at least one of the size of the palette table, the size/shape of the current block, the size/shape of the previous block, or the size of the previous palette table.
일 예로, 현재 팔레트 테이블의 크기의 일정 비율만큼만 팔레트 예측 플래그를 이용하여 이전 팔레트 테이블에서 엔트리를 가져오고, 나머지 비율은 무조건 현재 팔레트 테이블에서 생성하는 방식으로 할 수도 있다. 예를 들어 현재 팔레트 테이블의 크기가 6이고 비율이 50%로 설정된 경우, 팔레트 예측 플래그를 이용하여 이전 팔레트 테이블에서 최대 3개의 엔트리를 가져오고, 나머지 3개의 엔트리는 무조건 현재 팔레트 테이블에서 생성할 수 있다. 이에 따라, 팔레트 예측 플래그의 값이 1인 엔트리가 3개에 다다른 경우, 이후 엔트리에 대해서는 팔레트 예측 플래그의 부호화가 생략될 수 있다. As an example, only a certain percentage of the size of the current palette table may be obtained by using the palette prediction flag to bring an entry from the previous palette table, and the remaining ratio may be unconditionally generated from the current palette table. For example, if the size of the current palette table is 6 and the ratio is set to 50%, up to 3 entries from the previous palette table are fetched using the palette prediction flag, and the remaining 3 entries can be created unconditionally from the current palette table. have. Accordingly, when the number of entries having the value of the palette prediction flag of 1 reaches three, encoding of the palette prediction flag may be omitted for subsequent entries.
또는, 이전 블록의 크기가 기 설정된 임계값보다 작은 경우, 이전 블록의 팔레트 테이블에 포함된 팔레트 엔트리들이 현재 블록의 팔레트 테이블에 추가되지 않도록 설정할 수 있다. 즉, 이전 블록의 크기가 기 설정된 임계값보다 작은 경우, 이전 블록의 팔레트 엔트리들에 대해서는 팔레트 엔트리 예측 플래그의 부호화를 생략하고, 그 값이 0인 것으로 간주할 수 있다.Alternatively, when the size of the previous block is smaller than a preset threshold, it may be set so that the palette entries included in the palette table of the previous block are not added to the palette table of the current block. That is, when the size of the previous block is smaller than a preset threshold, encoding of the palette entry prediction flag for the palette entries of the previous block may be omitted, and the value may be regarded as 0.
일 예로, 임계값이 16이고, 이전 블록이 포함된 샘플의 개수가 16개보다 작은 경우, 이전 블록의 팔레트 엔트리를 현재 블록의 팔레트 테이블에 추가하지 않을 수 있다. For example, if the threshold value is 16 and the number of samples including the previous block is less than 16, the palette entry of the previous block may not be added to the palette table of the current block.
임계값은 상위 헤더에서 부호화되어 복호화기로 전송될 수 있다. 또는, 부호화기 및 복호화기에서 고정된 임계값을 사용할 수 있다. The threshold value may be encoded in an upper header and transmitted to a decoder. Alternatively, the encoder and the decoder may use a fixed threshold.
또는, 이전 블록의 크기에 따라, 이전 블록의 팔레트 테이블로부터 현재 블록의 팔레트 테이블에 추가될 수 있는 팔레트 엔트리의 개수가 결정될 수 있다. Alternatively, according to the size of the previous block, the number of palette entries that can be added to the palette table of the current block from the palette table of the previous block may be determined.
혹은, 복수의 이전 팔레트 테이블들로부터 현재 팔레트 테이블에 포함될 엔트리들을 예측할 수 있다. 일 예로, 제1 이전 팔레트 테이블에 포함된 엔트리들 각각에 대해 예측 플래그를 이용하여 현재 팔레트 테이블로 엔트리를 가져오되, 1의 값을 가진 팔레트 예측 플래그의 개수가 현재 팔레트 테이블의 크기보다 작다면 제1 이전 팔레트 테이블보다 더 이전인 제2 이전 팔레트 테이블을 이용하여 연속적으로 팔레트 예측 플래그를 할당하는 방식 또한 가능하다.Alternatively, it is possible to predict entries to be included in the current palette table from a plurality of previous palette tables. For example, if the number of palette prediction flags having a value of 1 is smaller than the size of the current palette table, the entry is brought to the current palette table using a prediction flag for each of the entries included in the first previous palette table. A method of continuously allocating palette prediction flags using a second previous palette table that is earlier than the first previous palette table is also possible.
또는, 제1 이전 팔레트 테이블에 포함된 엔트리들 및 제2 이전 팔레트 테이블에 포함된 엔트리들의 인덱스를 고려하여, 팔레트 예측 플래그의 부호화 순서를 결정할 수 있다. 일 예로, 제1 이전 팔레트 테이블에 포함된 인덱스 0인 엔트리에 대해 팔레트 예측 플래그를 부호화한 뒤, 제2 이전 팔레트 테이블에 포함된 인덱스 0인 엔트리에 대해 팔레트 예측 플래그를 부호화할 수 있다. 그리고 나서, 제1 이전 팔레트 테이블에 포함된 인덱스 1인 엔트리에 대해 팔레트 예측 플래그를 부호화한 뒤, 제2 이전 팔레트 테이블에 포함된 인덱스 1인 엔트리에 대해 팔레트 예측 플래그를 부호화할 수 있다. Alternatively, the encoding order of the palette prediction flag may be determined by considering the indexes of the entries included in the first previous palette table and the entries included in the second previous palette table. As an example, after encoding the palette prediction flag for the entry with index 0 included in the first previous palette table, the palette prediction flag may be encoded for the entry with index 0 included in the second previous palette table. Then, after encoding the palette prediction flag for the entry with index 1 included in the first previous palette table, it is possible to encode the palette prediction flag for the entry with index 1 included in the second previous palette table.
혹은 팔레트 테이블 후보 리스트를 구성하고, 상기 팔레트 테이블 후보 리스트에 포함된 복수의 이전 팔레트 테이블 후보들 중 적어도 하나를 현재 팔레트 테이블을 부호화할 때 이용할 수도 있다. Alternatively, the palette table candidate list may be configured, and at least one of a plurality of previous palette table candidates included in the palette table candidate list may be used when encoding the current palette table.
도 32는 팔레트 예측 플래그를 이용하여, 현재 부호화 하려는 팔레트 테이블의 비트량을 줄이는 방법이다. 도 32에서 RT는 블록 내의 가장 오른쪽 위에 위치한 화소를 의미하며 LB는 블록 내의 가장 왼쪽 아래에 존재하는 화소를 의미한다. 예를 들어 도 32에서 5개 주변 블록 즉, A 내지 E 화소를 각각 포함한 블록 중 적어도 하나를 참조할 수 있다. 그 후, 참조된 블록을 인덱스로 표시하여 부호화하고 복호화 장치로 전송할 수 있다. 또는, 전술한 A 내지 E 화소를 각각 포함한 블록 중 부호화/복호화 장치에 기-정의된 위치의 블록만을 참조할 수도 있다. 여기서, 기-정의된 위치는, 상단 블록 (B)일 수도 있고, 좌측 블록(A)일 수도 있다. 이 경우, 참조된 블록을 특정하는 인덱스의 부호화가 생략될 수 있다.32 is a method of reducing the bit amount of a palette table to be currently encoded by using a palette prediction flag. In FIG. 32 , RT denotes a pixel located at the upper right of the block, and LB denotes a pixel located at the bottom left of the block. For example, reference may be made to at least one of five neighboring blocks, that is, blocks including pixels A to E in FIG. 32 . Thereafter, the referenced block may be encoded as an index and transmitted to a decoding apparatus. Alternatively, only blocks at positions pre-defined in the encoding/decoding apparatus may be referred to among the blocks each including the pixels A to E described above. Here, the pre-defined position may be the upper block (B) or the left block (A). In this case, encoding of an index specifying the referenced block may be omitted.
상기 인덱스에 대응하는 블록의 팔레트 엔트리만을 이용하여 현재 블록을 위한 팔레트 테이블을 초기화/구성할 수 있다. It is possible to initialize / configure the palette table for the current block using only the palette entry of the block corresponding to the index.
혹은 참조한 블록의 팔레트 테이블만을 이용하여 현재 블록의 팔레트 테이블을 기준치 이상 채우지 못했다면, 추가적인 인덱스를 기반으로 블록을 추가 지정하여 현재 부호화 하려는 팔레트 테이블을 채울 수도 있다. 이때, 부호화/복호화 장치는, 기-약속된 고정된 개수의 블록을 참조할 수도 있고, 참조되는 블록의 개수를 특정하는 정보가 상위 헤더를 통해 전송될 수도 있다. 또는 블록의 크기/형태, 팔레트 테이블의 크기에 따라 부호화/복호화 장치가 동일하게 고정된 개수의 주변 블록을 참조하는 방식 또한 가능하다. 혹은 도 32의 위치 이외에 부호화 순서상 현재 블록보다 먼저 팔레트 모드로 부호화된 M개의 블록을 인덱스로 지정하여 해당 블록에서 팔레트 테이블을 가져오는 방식 또한 가능하다. 혹은 콜로케이티드 픽처(Collocated Picture)에 포함된 블록을 인덱스로 지정하여 해당 블록에서 팔레트 테이블을 가져오는 방식 또한 가능하다.Alternatively, if the palette table of the current block cannot be filled beyond the standard value using only the palette table of the referenced block, the palette table to be currently encoded can be filled by additionally designating a block based on an additional index. In this case, the encoding/decoding apparatus may refer to a pre-promised fixed number of blocks, and information specifying the number of referenced blocks may be transmitted through an upper header. Alternatively, a method in which the encoding/decoding apparatus refers to the same fixed number of neighboring blocks according to the size/form of the block and the size of the palette table is also possible. Alternatively, in addition to the location of FIG. 32, a method of fetching the palette table from the block by designating M blocks encoded in the palette mode before the current block in the encoding order as indexes is also possible. Alternatively, a method of fetching the palette table from the block by designating the block included in the collocated picture as an index is also possible.
혹은 팔레트 테이블 후보 리스트를 구성하는 방식 또한 가능하다. 영상의 첫 위치에 존재하는 블록부터 시작하여 현재 블록 직전까지, 사용된 모든 팔레트 테이블을 후보 리스트에 저장한다. 혹은, 후보 리스트에 저장할 테이블의 개수 N을 설정한 후, N개의 팔레트 테이블을 후보 리스트에 저장한다. 즉, 블록의 부호화가 완료되면, 부호화가 완료된 블록의 팔레트 테이블을 후보 리스트에 저장할 수 있다. 이때, 후보 리스트에 추가하고자 하는 팔레트 테이블과 동일한 팔레트 테이블 후보가 존재하는 경우, 상기 팔레트 테이블을 상기 후보 리스트에 추가하지 않을 수 있다. 또는, 상기 팔레트 테이블을 상기 후보 리스트에 추가하고, 상기 팔레트 테이블과 동일한 팔레트 테이블 후보를 상기 후보 리스트에서 삭제할 수 있다. Alternatively, a method of constructing a palette table candidate list is also possible. All used palette tables are stored in the candidate list starting from the block existing in the first position of the image until just before the current block. Alternatively, after setting the number N of tables to be stored in the candidate list, the N palette tables are stored in the candidate list. That is, when the encoding of the block is completed, the palette table of the encoded block may be stored in the candidate list. In this case, if the same palette table candidate as the palette table to be added to the candidate list exists, the palette table may not be added to the candidate list. Alternatively, the palette table may be added to the candidate list, and the same palette table candidate as the palette table may be deleted from the candidate list.
이때 후보 리스트 내 팔레트 테이블 후보들이 저장되는 방식은, 현재 블록과 가까울수록 높은 우선순위를 가지며, 현재 블록과 멀리 떨어져 있을수록 낮은 우선순위를 가질 수 있다. 또는, 팔레트 테이블의 크기 또는 참조 빈도 등에 따라 우선 순위가 설정될 수 있다. 이 우선순위에 따라, 저장된 테이블의 개수가 N을 넘어설 때 낮은 우선순위를 가진 팔레트 테이블부터 후보 리스트에서 삭제될 수 있다. In this case, the method in which the palette table candidates in the candidate list are stored has a higher priority as it is closer to the current block, and may have a lower priority as it is further away from the current block. Alternatively, the priority may be set according to the size or reference frequency of the palette table. According to this priority, when the number of stored tables exceeds N, it can be deleted from the candidate list starting from the palette table with a lower priority.
혹은 병렬 처리 구조에서, 병렬 처리되는 각 영역마다 따로 팔레트 테이블 리스트를 구성하는 방식 또한 가능하다. 혹은 영역의 CTU 행마다 팔레트 테이블 리스트를 따로 구성하는 방식 또한 가능하다. 이때, 팔레트 테이블 리스트를 각 병렬 처리가 수행되는 영역마다 따로 가지는 경우, 영역의 초반 부분에는 팔레트 테이블 리스트에 저장되는 팔레트 테이블의 수가 매우 적을 수 있다. 따라서 각 병렬 처리가 수행되는 영역마다 팔레트 테이블을 처음부터 채워 넣지 말고, 기-설정된 초기 팔레트 테이블을 채워 넣는 것 또한 가능하다. 예를 들어, 도 30에서 살펴본 바와 같이, 초기 팔레트 테이블은 이전 CTU 행의 첫번째 CTU의 팔레트 테이블일 수 있다. 또는, 기-설정된 초기 팔레트 테이블은, 블록 단위로 유도되는 팔레트 테이블이 아니라 영상 전체에서 유도된 팔레트 테이블일 수 있다. 이러한 경우, 영상 전체에서 유도된 팔레트 테이블의 각 엔트리 값들은 엔트리 개수와 함께 상위 헤더를 통해 부호화될 수 있다. 혹은 초기 팔레트 테이블을 구성할 때, 화소의 표현 비트에 따라 양자화된 값을 엔트리 값으로 설정하는 것 또한 가능하다. 예를 들어 8 비트 화소를 5개로 양자화 한 경우(5개의 엔트리), 0~255를 5개의 구역으로 나누어 각 구역의 대표 값을 이용하여 엔트리로 설정하고 부호화할 수 있다. 혹은, 0~255를 균등하게 양자화를 하였다면, 균등하게 양자화하였다는 정보와 몇 개로 양자화를 하였는지 알려주는 정보만 상위 헤더를 통해 부호화할 수도 있다. Alternatively, in a parallel processing structure, a method of configuring a palette table list separately for each area to be processed in parallel is also possible. Alternatively, it is also possible to separately configure the palette table list for each CTU row of the area. In this case, if the palette table list is separately for each area in which parallel processing is performed, the number of palette tables stored in the palette table list may be very small in the initial part of the area. Therefore, it is also possible to fill a preset initial palette table without filling the palette table from the beginning for each area in which parallel processing is performed. For example, as shown in FIG. 30, the initial palette table may be the palette table of the first CTU of the previous CTU row. Alternatively, the preset initial palette table may be a palette table derived from the entire image, not a palette table derived for each block. In this case, each entry value of the palette table derived from the entire image may be encoded through a higher header along with the number of entries. Alternatively, when constructing the initial palette table, it is also possible to set a quantized value as an entry value according to the representation bit of a pixel. For example, when an 8-bit pixel is quantized into 5 (5 entries), 0 to 255 can be divided into 5 zones and set as entries and encoded using the representative values of each zone. Alternatively, if 0 to 255 are equally quantized, only information indicating that quantization was performed equally and information indicating how many quantizations were performed may be encoded through the upper header.
또는, 팔레트 테이블이 포함하는 엔트리들을 팔레트 엔트리 후보 리스트로 구성하는 방식 또한 가능하다. 부호화가 완료된 블록의 팔레트 테이블에 포함된 엔트리들을 엔트리 후보 리스트에 추가할 수 있다. 이때, 팔레트 테이블에 포함된 엔트리들 중 인덱스가 문턱값보다 작은 엔트리들만 엔트리 후보 리스트에 포함할 수 있다. 현재 블록의 팔레트 테이블에 포함된 엔트리의 개수가 최대 개수보다 작은 경우, 팔레트 엔트리 후보 리스트에 포함된 후보 엔트리들을 참조하여 팔레트 테이블을 구성할 수 있다.Alternatively, a method of configuring the entries included in the palette table as a palette entry candidate list is also possible. Entries included in the palette table of the encoded block can be added to the entry candidate list. In this case, among the entries included in the palette table, only entries having an index smaller than the threshold may be included in the entry candidate list. When the number of entries included in the palette table of the current block is less than the maximum number, the palette table may be configured with reference to the candidate entries included in the palette entry candidate list.
부호화/복호화가 완료된 블록의 팔레트 테이블에 포함된 팔레트 엔트리들을 팔레트 엔트리 후보 리스트에 추가할 수 있다. 새로운 팔레트 엔트리들이 팔레트 엔트리 후보 리스트에 추가되는 경우, 새롭게 추가되는 팔레트 엔트리들에 가장 작은 인덱스를 할당할 수 있다. 그리고, 팔레트 엔트리 후보 리스트에 기 존재하던 팔레트 엔트리들의 인덱스들에 새롭게 추가되는 팔레트 엔트리들의 개수를 더하여, 기 존재하던 팔레트 엔트리들의 인덱스들을 갱신할 수 있다. Palette entries included in the palette table of the encoded/decoded block may be added to the palette entry candidate list. When new palette entries are added to the palette entry candidate list, the smallest index may be assigned to the newly added palette entries. And, by adding the number of palette entries that are newly added to the indexes of the palette entries existing in the palette entry candidate list, it is possible to update the indexes of the existing palette entries.
새로운 팔레트 인덱스들이 추가됨에 따라, 팔레트 엔트리 후보 리스트가 포함하는 팔레트 엔트리들의 개수가 최대값을 초과하는 경우, 인덱스가 높은 순으로, 기 존재하던 팔레트 엔트리들을 팔레트 엔트리 후보 리스트에서 제거할 수 있다.As new palette indices are added, when the number of palette entries included in the palette entry candidate list exceeds the maximum value, the existing palette entries may be removed from the palette entry candidate list in the order of the highest index.
도 33은 팔레트 엔트리 후보 리스트에 팔레트 엔트리들이 추가되는 예를 나타낸 도면이다. 33 is a diagram illustrating an example in which palette entries are added to the palette entry candidate list.
팔레트 예측 플래그를 기초로, 팔레트 테이블을 구성한 뒤, 구성된 팔레트 테이블을 이용하여, 블록을 부호화/복호화할 수 있다. 블록의 부호화/복호화가 완료되면, 팔레트 테이블에 포함된 팔레트 엔트리들을 팔레트 엔트리 후보 리스트가 추가할 수 있다.After configuring a palette table based on the palette prediction flag, blocks may be encoded/decoded using the configured palette table. When the encoding/decoding of the block is completed, the palette entry candidate list may add palette entries included in the palette table.
일 예로, 팔레트 테이블이 a0, a2, a4, a5, a7을 포함하는 경우, 위 팔레트 엔트리들을 팔레트 엔트리 후보 리스트에 추가할 수 있다.For example, when the palette table includes a0, a2, a4, a5, a7, the above palette entries may be added to the palette entry candidate list.
만약, 팔레트 엔트리 후보 리스테에 추가하고자 하는 팔레트 엔트리와 동일한 팔레트 엔트리가 이미 팔레트 엔트리 후보 리스트에 저장되어 있을 경우, 중복되는 팔레트 엔트리를 팔레트 엔트리 후보 리스트에 추가하지 않을 수 있다. If the same palette entry as the palette entry to be added to the palette entry candidate list is already stored in the palette entry candidate list, the duplicate palette entry may not be added to the palette entry candidate list.
또는, 팔레트 엔트리 후보 리스트에 추가하고자 하는 팔레트 엔트리와 동일한 팔레트 엔트리가 이미 팔레트 엔트리 후보 리스트에 저장되어 있을 경우, 기 저장된 팔레트 엔트리를 팔레트 엔트리 후보 리스트에서 제거하고, 중복되는 팔레트 엔트리를 팔레트 엔트리 후보 리스트에 추가할 수 있다.Alternatively, if the same palette entry as the palette entry to be added to the palette entry candidate list is already stored in the palette entry candidate list, the previously stored palette entry is removed from the palette entry candidate list, and the duplicate palette entry is removed from the palette entry candidate list can be added to
상술한 예에서는, 부호화/복호화가 완료된 블록의 팔레트 테이블에 포함된 모든 팔레트 엔트리들이 팔레트 엔트리 후보 리스트에 추가되는 것으로 설명하였다.In the above-described example, it has been described that all palette entries included in the palette table of the encoded/decoded block are added to the palette entry candidate list.
팔레트 엔트리 후보 리스트 구성의 복잡도를 감소시키기 위해, 팔레트 엔트리들 중 인덱스가 문턱값 이하인 것만을 팔레트 엔트리 후보 리스트에 추가할 수 있다.In order to reduce the complexity of constructing the palette entry candidate list, only those whose index is less than or equal to a threshold value among palette entries may be added to the palette entry candidate list.
또는, 블록의 크기가 기 설정된 임계값보다 작은 경우, 팔레트 테이블에 포함된 팔레트 엔트리들을 팔레트 엔트리 후보 리스트에 추가하지 않을 수 있다. 일 예로, 블록에 포함된 픽셀들의 개수가 임계값 이하인 경우, 해당 블록의 팔레트 테이블에 포함된 팔레트 엔트리들을 팔레트 엔트리 후보 리스트에 추가하지 않을 수 있다. 이에 따라, 블록에 포함된 픽셀들의 개수가 임계값 이하인 블록의 팔레트 테이블에 포함된 팔레트 엔트리는, 다음 블록의 팔레트 테이블을 구성하는데 있어서, 예측 팔레트 엔트리로 활용될 수 없다. Alternatively, when the size of the block is smaller than a preset threshold, the palette entries included in the palette table may not be added to the palette entry candidate list. For example, when the number of pixels included in the block is less than or equal to the threshold, the palette entries included in the palette table of the block may not be added to the palette entry candidate list. Accordingly, the palette entry included in the palette table of the block in which the number of pixels included in the block is less than or equal to the threshold value cannot be utilized as a prediction palette entry in constructing the palette table of the next block.
반면, 블록의 크기가 기 설정된 임계값 이상인 경우, 팔레트 테이블에 포함된 팔레트 엔트리들을 팔레트 엔트리 후보 리스트에 추가할 수 있다. On the other hand, when the size of the block is greater than or equal to a preset threshold, the palette entries included in the palette table may be added to the palette entry candidate list.
임계값은 상위 헤더에서 부호화되어 복호화기로 전송될 수 있다. 또는, 부호화기 및 복호화기에서 고정된 임계값을 사용할 수 있다. 일 예로, 임계값은, 4, 8, 16 또는 32와 같은 자연수일 수 있다. The threshold value may be encoded in an upper header and transmitted to a decoder. Alternatively, the encoder and the decoder may use a fixed threshold. For example, the threshold may be a natural number such as 4, 8, 16, or 32.
또는, 블록의 크기 또는 다음 블록의 크기에 기초하여, 팔레트 엔트리 후보 리스트에 추가할 수 있는 팔레트 엔트리들의 개수를 결정할 수도 있다. 일 예로, 블록의 크기가 임계값 이하인 경우에는, 최대 n개의 팔레트 엔트리가 팔레트 엔트리 후보 리스트에 추가될 수 있는 반면, 블록의 크기가 임계값보다 큰 경우에는, 최대 m개의 팔레트 엔트리가 팔레트 엔트리 후보 리스트에 추가될 수 있다. 여기서, n은 m보다 작은 자연수일 수 있다. Alternatively, based on the size of the block or the size of the next block, the number of palette entries that can be added to the palette entry candidate list may be determined. For example, if the size of the block is less than or equal to the threshold, a maximum of n palette entries may be added to the palette entry candidate list, whereas if the size of the block is greater than the threshold, a maximum of m palette entries are palette entry candidates can be added to the list. Here, n may be a natural number smaller than m.
부호화기 및 복호화기에서 기 정의된 팔레트 테이블을 이용할 수도 있다. A palette table predefined in the encoder and the decoder may be used.
도 34는 부호화기 및 복호화기에서 기 정의된 팔레트 테이블이 이용되는 예를 나타낸다. 34 shows an example in which a palette table predefined in an encoder and a decoder is used.
부호화기 및 복호화기에서 기 정의된 팔레트 테이블을 이용하는 경우, 블록마다 팔레트 테이블을 부호화할 필요가 없다.When the encoder and decoder use a predefined palette table, it is not necessary to encode the palette table for each block.
기 정의된 팔레트 테이블은, 팔레트 테이블의 크기 및/또는 팔레트 엔트리들에 할당되는 화소 값이 부호화기 및 복호화기에서 기 정의된 상태인 것을 의미한다.The predefined palette table means that the size of the palette table and/or pixel values allocated to palette entries are predefined in the encoder and the decoder.
복수개의 기 정의된 팔레트 테이블을 저장한 뒤, 복수개의 팔레트 테이블들 중 하나를 특정하는 인덱스를 부호화하여 복호화기로 전송할 수도 있다.After storing a plurality of predefined palette tables, an index specifying one of the plurality of palette tables may be encoded and transmitted to the decoder.
또는, 각 팔레트 엔트리에 할당되는 화소값들만을 기 정의한 뒤, 팔레트 엔트리들 간의 인덱스 할당 순서를 나타내는 정보만을 부호화할 수도 있다. Alternatively, after defining only pixel values allocated to each palette entry, only information indicating an index allocation order between palette entries may be encoded.
일 예로, 블록 내 잔차값의 최소값이 -3인 경우, 화소값이 -3인 팔레트 엔트리에 인덱스 0을 할당하고, 화소값이 +4인 팔레트 엔트리에 인덱스 1을 할당하고, 화소값이 -4인 팔레트 엔트리에 인덱스 2를 할당할 수 있다. For example, when the minimum value of the residual value in the block is -3, index 0 is assigned to a palette entry having a pixel value of -3, index 1 is assigned to a palette entry having a pixel value of +4, and a pixel value of -4 Index 2 can be assigned to the in-palette entry.
또는, 블록 내 최소값 m을 부호화하여 복호화 장치로 전송하고, 최소값 m에 기초하여, 팔레트 엔트리들 각각의 인덱스를 결정할 수 있다. 일 예로, 최소값 m과 동일한 팔레트 엔트리에 인덱스 0을 할당하고, 최소값 m과 유사한 순서대로 인덱스를 할당할 수 있다. 일 예로, 최소값 m과의 차이가 작은 팔레트 엔트리에 할당되는 인덱스가 최소값 m과의 차이가 큰 팔레트 엔트리에 할당되는 인덱스보다 작은 값을 가질 수 있다.Alternatively, the minimum value m in the block may be encoded and transmitted to the decoding apparatus, and an index of each of the palette entries may be determined based on the minimum value m. As an example, index 0 may be allocated to the palette entry equal to the minimum value m, and indexes may be allocated in an order similar to the minimum value m. For example, an index assigned to a palette entry having a small difference from the minimum value m may have a smaller value than an index assigned to a palette entry having a large difference from the minimum value m.
기 정의된 팔레트 테이블을 이용할 것인지 여부는, 무손실 부호화가 적용되었는지 여부에 기초하여 결정될 수 있다. 일 예로, 무손실 부호화가 적용되는 경우, 기 정의된 팔레트 테이블을 이용하고, 무손실 부호화가 적용되지 않은 경우, 복호화기에서 부호화기와 동일한 방법으로 팔레트 테이블을 구성하여 사용할 수 있다. Whether to use the predefined palette table may be determined based on whether lossless encoding is applied. For example, when lossless encoding is applied, a predefined palette table is used, and when lossless encoding is not applied, the decoder may configure and use the palette table in the same way as the encoder.
팔레트 테이블을 이용하여 잔차값을 부호화하는 경우에도, 무손실 부호화 적용 여부에 따라, 팔레트 테이블의 구성 방법을 상이하게 설정할 수 있다. Even when the residual value is encoded using the palette table, the method of configuring the palette table may be set differently depending on whether lossless encoding is applied.
전술한, 팔레트 테이블은, 샘플의 예측값, 복원값 또는 잔차값을 유도하는데 이요될 수 있다. The above-described palette table may be used to derive a predicted value, a reconstructed value, or a residual value of a sample.
팔레트 예측 플래그의 경우 런 렝스(run length) 부호화 방식이 사용될 수 있다. 동일한 데이터가 연속되어 있는 것을 런이라 하며, 그 연속된 길이를 런 렝스라고 표현한다. 예를 들어 aaaaaabbccccccc라는 문자열이 있는 경우 a가 6개, B는 2개, c는 7개이므로 6a2b7c로 표현할 수 있다. 이러한 부호화 방식으로 런 렝스 부호화 방식이라고 한다. 팔레트 예측 플래그들을 런 렝스 부호화를 이용하여 부호화할 때, 0의 개수, 1의 개수, 등으로 표현할 수 있다. 혹은 0에 대해서만 런 렝스 부호화를 수행할 수도 있으며 반대로 1에 대해서만 런 렝스 부호화를 수행하는 것 또한 가능하다.In the case of the palette prediction flag, a run length encoding method may be used. A continuous sequence of identical data is called a run, and the continuous length is expressed as a run length. For example, if there is a string aaaaaabbccccccc, 6 a, 2 B, and 7 c, so it can be expressed as 6a2b7c. Such an encoding method is called a run-length encoding method. When encoding the palette prediction flags using run-length encoding, the number of 0's, the number of 1's, etc. can be expressed. Alternatively, run-length encoding may be performed only on 0, and conversely, run-length encoding may be performed on only 1 as well.
도 35는 본 개시가 적용되는 일실시예로서, 런 렝스 부호화 기반의 바이너리 벡터의 형태로 팔레트 예측 플래그를 시그날링하는 방법을 도시한 것이다.35 is a diagram illustrating a method of signaling a palette prediction flag in the form of a binary vector based on run length encoding as an embodiment to which the present disclosure is applied.
본 실시예에서는, 이전 블록의 팔레트 테이블은 0 내지 7의 팔레트 인덱스를 가진 8개의 팔레트 엔트리를 사용한 것으로 가정한다. In this embodiment, it is assumed that the palette table of the previous block uses 8 palette entries with palette indexes of 0 to 7.
영상 부호화 장치는, 이전 블록의 0 내지 7번의 팔레트 엔트리 각각에 대해서 해당 팔레트 엔트리가 현재 블록의 팔레트 엔트리로 재사용되는지를 결정하고, 만일 해당 팔레트 엔트리가 현재 블록의 팔레트 엔트리로 재사용되는 경우에는 해당 팔레트 엔트리에 대한 팔레트 예측 플래그의 값을 1로, 그렇지 않은 경우에는 0으로 각각 설정할 수 있다. 예를 들어, 도 35에 도시된 바와 같이, 이전 블록의 팔레트 엔트리 중에서 0번, 1번, 3번, 7번의 팔레트 엔트리가 현재 블록의 팔레트 엔트리로 재사용되고, 나머지 팔레트 엔트리는 재사용되지 않는 경우, 11010001로 표현되는 바이너리 벡터(binary vector)를 생성할 수 있다. The image encoding apparatus determines whether the corresponding palette entry is reused as the palette entry of the current block for each of the palette entries 0 to 7 of the previous block, and if the palette entry is reused as the palette entry of the current block, the corresponding palette The value of the palette prediction flag for the entry can be set to 1, otherwise 0, respectively. For example, as shown in FIG. 35, among the palette entries of the previous block, the palette entries 0, 1, 3, and 7 are reused as the palette entries of the current block, and the remaining palette entries are not reused, A binary vector represented by 11010001 may be generated.
그런 다음, 상기 바이너리 벡터에서 1의 개수(즉, 이전 블록의 팔레트 엔트리 중 현재 블록의 팔레트 엔트리로 재사용되는 팔레트 엔트리의 개수) 또는 상기 바이너리 벡터에서 1보다 앞선 0의 개수 중 적어도 하나를 부호화하여 영상 복호화 장치로 시그날링할 수 있다. 예를 들어, 상기 바이너리 벡터에서 1의 개수가 4개이므로, 현재 블록의 팔레트 엔트리로 재사용되는 이전 블록의 팔레트 엔트리의 개수로 4를 부호화할 수 있다. 또한, 상기 바이너리 벡터에서 1보다 앞선 0의 개수 즉, 0, 0, 1, 3을 순차적으로 부호화할 수도 있다.Then, encoding at least one of the number of 1s in the binary vector (that is, the number of palette entries reused as the palette entry of the current block among the palette entries of the previous block) or the number of 0s preceding 1 in the binary vector Signaling may be performed by a decoding device. For example, since the number of 1s in the binary vector is 4, 4 can be encoded as the number of palette entries of the previous block that is reused as the palette entry of the current block. In addition, the number of 0s preceding 1 in the binary vector, that is, 0, 0, 1, 3 may be sequentially encoded.
복호화 장치는, 부호화 장치로부터 현재 블록의 팔레트 엔트리로 재사용되는 이전 블록의 팔레트 엔트리의 개수에 관한 정보 또는 상기 바이너리 벡터에서 1보다 앞선 0의 개수에 관한 정보(palette_entry_run) 중 적어도 하나를 수신하고, 이를 이용하여 현재 블록의 팔레트 테이블을 구성할 수 있다.The decoding apparatus receives at least one of information (palette_entry_run) about the number of 0's preceding 1 in the binary vector or information about the number of palette entries of the previous block reused as the palette entry of the current block from the encoding device, and It can be used to compose the palette table of the current block.
예를 들어, 복호화 장치는, 바이너리 벡터에서 1보다 앞선 0의 개수에 관한 정보(palette_entry_run) 즉, 0, 0, 1, 3을 비트스트림으로부터 순차적으로 추출하고, 이를 이용하여 이전 블록의 팔레트 엔트리의 재사용 여부를 나타내는 바이너리 벡터 즉, 11010001을 복원할 수 있다. 바이너리 벡터를 복원하는 과정에서 1 값이 발생하면, 1 값에 대응하는 이전 블록의 팔레트 엔트리를 현재 블록의 팔레트 테이블에 삽입할 수 있다. 이러한 과정을 통해 이전 블록의 팔레트 테이블로부터 일부 팔레트 엔트리를 선택적으로 재사용하여 현재 블록의 팔레트 테이블을 구성할 수 있다.For example, the decoding apparatus sequentially extracts information (palette_entry_run), that is, 0, 0, 1, 3 about the number of 0s before 1 in the binary vector, from the bitstream, and using this, the palette entry of the previous block A binary vector indicating whether to reuse or not, that is, 11010001 may be restored. If a value of 1 occurs in the process of restoring a binary vector, the palette entry of the previous block corresponding to the value of 1 may be inserted into the palette table of the current block. Through this process, the palette table of the current block can be configured by selectively reusing some palette entries from the palette table of the previous block.
도 36은 본 개시에 따른 스캔 순서에 따라 팔레트 인덱스를 부호화/복호화하는 방법을 도시한 것이다.36 illustrates a method of encoding/decoding a palette index according to a scan order according to the present disclosure.
팔레트 테이블의 부호화한 후, 현재 블록의 각 화소마다 할당된 팔레트 인덱스 또한 부호화해야만 한다. 도 36은 현재 블록 내에서 수행되는 스캔 순서에 대한 예시이다.After encoding the palette table, the palette index assigned to each pixel of the current block must also be encoded. 36 is an example of a scan order performed in a current block.
도 36에 도시된 스캔 순서의 주 목적은, 방향성을 감안하여 스캔을 한다는 것이다. 도 36(a)와 같이 현재 블록 내에 존재하는 화소의 특성들이 가로 방향 혹은 세로 방향으로 유사한 값을 가진다면 도 36(a)와 같이 스캔을 한다면 같은 인덱스들끼리 군집될 가능성이 높아진다. 혹은 도 36(b)와 같이 블록 내에 존재하는 화소의 특성들이 z 방향 또는 대각 방향으로 유사한 값을 가진다면 도 36(b)와 같이 스캔을 한다면 같은 인덱스들끼리 군집될 가능성이 높아진다. The main purpose of the scan sequence shown in FIG. 36 is to perform scanning in consideration of directionality. As shown in FIG. 36(a) , if characteristics of pixels existing in the current block have similar values in the horizontal or vertical direction, the possibility of clustering among the same indexes increases if scanning is performed as shown in FIG. 36(a). Alternatively, if characteristics of pixels existing in a block have similar values in the z-direction or diagonal direction as shown in FIG. 36(b), the possibility of clustering among the same indices increases when scanning is performed as shown in FIG. 36(b).
부호화 장치에서는 어떤 스캔 방식이 사용되었는지 인덱스로 표시한 후 부호화하여 복호화 장치로 전송할 수 있다. 또는, 현재 블록의 크기, 형태에 따라 스캔 순서를 결정할 수 있다.The encoding apparatus may indicate which scan method is used as an index, encode it, and transmit it to the decoding apparatus. Alternatively, the scan order may be determined according to the size and shape of the current block.
복수 스캔 방식 중 값이 동일한 인덱스들이 군집화될 가능성이 높은 스캔 방식을 선택한 뒤, 각 화소에 대한 인덱스를 부호화할 수 있다. 이때, 런 머지 부호화를 이용하여, 현재 화소의 인덱스를 유도할 수 있다. 런 머지 부호화 방법은, 인접 화소의 인덱스로부터 현재 화소의 인덱스를 유도하는 방법을 나타낸다. After selecting a scan method in which indices having the same value are highly likely to be clustered among a plurality of scan methods, the index for each pixel may be encoded. In this case, the index of the current pixel may be derived using run merge encoding. The run merge encoding method represents a method of deriving an index of a current pixel from an index of an adjacent pixel.
런 머지 부호화가 적용되는 경우, 현재 화소와 인접 화소의 인덱스가 동일한지 여부에 따라, 현재 화소의 인덱스를 그대로 부호화할 것인지 여부가 결정될 수 있다. 여기서, 인접 화소는, 현재 화소의 좌측, 우측 인접 화소, 상단 인접 화소, 하단 인접 화소 또는 대각 방향으로 인접하는 화소 중 적어도 하나를 포함할 수 있고, 인접 화소의 위치는, 현재 블록에 적용되는 스캔 방향에 따라 적응적으로 결정될 수 있다.When run merge encoding is applied, it may be determined whether to encode the index of the current pixel as it is, depending on whether the index of the current pixel and the adjacent pixel are the same. Here, the adjacent pixel may include at least one of left and right adjacent pixels, an upper adjacent pixel, a lower adjacent pixel, or diagonally adjacent pixels of the current pixel, and the location of the adjacent pixel is determined by the scan applied to the current block. It may be adaptively determined according to the direction.
도 37은 현재 화소의 인접 화소를 설명하기 위한 예시도이다.37 is an exemplary diagram for describing a pixel adjacent to a current pixel.
설명의 편의를 위해, 현재 블록에 가로 방향 스캔이 적용되는 것으로 가정한다.For convenience of description, it is assumed that a horizontal scan is applied to the current block.
도 37에서, A는 부호화 대상인 현재 화소를 나타내고, B는 스캔 순서상 현재 화소의 바로 이전 화소를 나타낸다. C는 인접 라인(행/열)에 포함된 화소들 중 현재 화소와 인접하는 이웃 화소를 나타낸다. 인접 라인은, 스캔 방향에 따라, 상단 행, 하단 행, 좌측 열 또는 우측 열 중 하나일 수 있다. In FIG. 37 , A indicates a current pixel to be encoded, and B indicates a pixel immediately preceding the current pixel in a scan order. C indicates a neighboring pixel adjacent to the current pixel among pixels included in an adjacent line (row/column). The adjacent line may be one of a top row, a bottom row, a left column, or a right column, depending on the scan direction.
현재 화소 A의 런 타입 또는 인덱스가 이전 화소 B의 런 타입 또는 인덱스와 동일한지 여부에 기초하여, 런 타입 플래그를 설정할 수 있다. 여기서, 런 타입은, 현재 화소 A의 인덱스가 인접 라인에 포함된 이웃 화소(즉, 이웃 화소 C)의 인덱스와 동일함을 나타내는 'ABOVE' 또는 현재 화소 A의 인덱스가 그대로 부호화됨을 나타내는 'INDEX' 중 하나를 가리킬 수 있다.Based on whether the run type or index of the current pixel A is the same as the run type or index of the previous pixel B, the run type flag may be set. Here, the run type is 'ABOVE' indicating that the index of the current pixel A is the same as the index of the neighboring pixel (ie, the neighboring pixel C) included in the adjacent line, or 'INDEX' indicating that the index of the current pixel A is encoded as it is. can point to one of them.
이전 화소 B의 런 타입 및 현재 화소 A의 인덱스가 인접 화소 B 또는 C와 동일한지 여부에 기초하여, 런 머지 플래그의 값을 설정할 수 있다.The value of the run merge flag may be set based on the run type of the previous pixel B and whether the index of the current pixel A is the same as that of the adjacent pixel B or C.
일 예로, 이전 화소 B의 런 타입이 'ABOVE'인 경우, 현재 화소 A 및 이웃 화소 C의 인덱스가 동일한 경우, 런 머지 플래그의 값을 1(참)으로 설정할 수 있다. 반면, 이전 화소 B의 런 타입이 'INDEX'인 경우, 현재 화소 A 및 이전 화소 B의 인덱스가 동일한 경우, 런 머지 플래그의 값을 참으로 설정할 수 있다.For example, when the run type of the previous pixel B is 'ABOVE', when the indexes of the current pixel A and the neighboring pixel C are the same, the value of the run merge flag may be set to 1 (true). On the other hand, when the run type of the previous pixel B is 'INDEX' and the indexes of the current pixel A and the previous pixel B are the same, the value of the run merge flag may be set to true.
런 머지 플래그의 값이 참인 경우, 복호화기는, 이전 화소 B의 런 타입을 참고하여, 현재 화소의 인덱스를 유도할 수 있다. 일 예로, 이전 화소 B의 런 타입이 'ABOVE'인 경우, 현재 화소 A에도 런 타입 'ABOVE'를 적용하여, 이웃 화소 C의 인덱스를 현재 화소 A의 인덱스로 유도할 수 있다. 반면, 이전 화소 B의 런 타입이 'INDEX'인 경우, 이전 화소 B의 인덱스를 현재 화소 A의 인덱스로 유도할 수 있다.When the value of the run merge flag is true, the decoder may derive the index of the current pixel with reference to the run type of the previous pixel B. For example, when the run type of the previous pixel B is 'ABOVE', the run type 'ABOVE' may be applied to the current pixel A to derive the index of the neighboring pixel C as the index of the current pixel A. On the other hand, when the run type of the previous pixel B is 'INDEX', the index of the previous pixel B may be derived as the index of the current pixel A.
현재 화소 A 및 이전 화소 B의 런 타입이 상이하거나, 현재 화소 A 및 이전 화소 B의 인덱스가 상이한 경우, 런 머지 플래그의 값을 0(거짓)으로 설정할 수 있다.When the run types of the current pixel A and the previous pixel B are different or the indexes of the current pixel A and the previous pixel B are different, the value of the run merge flag may be set to 0 (false).
런 머지 플래그의 값이 거짓인 경우, 현재 화소 A의 런 타입을 나타내는 런 타입 정보가 부호화/복호화될 수 있다. 런 타입은, 현재 화소 A의 인덱스가 이웃 화소 C의 인덱스와 동일함을 나타내는 'ABOVE' 또는 현재 화소 A의 인덱스가 그대로 부호화되는 'INDEX' 중 하나를 가리킬 수 있다. When the value of the run merge flag is false, run type information indicating the run type of the current pixel A may be encoded/decoded. The run type may indicate either 'ABOVE' indicating that the index of the current pixel A is the same as the index of the neighboring pixel C or 'INDEX' in which the index of the current pixel A is encoded as it is.
런 타입 정보는 1비트의 플래그 또는 복수의 런 타입들 중 하나를 특정하는 인덱스일 수 있다. 일 예로, 런 타입을 나타내는 신택스 run_type이 'ABOVE'를 가리키는 것은, 현재 화소 A의 인덱스가 이웃 화소 C의 인덱스와 동일함을 나타낸다. 이 경우, 이웃 화소 C의 인덱스가 현재 화소 A의 인덱스로 유도될 수 있다.The run type information may be a 1-bit flag or an index specifying one of a plurality of run types. For example, when the syntax run_type indicating the run type indicates 'ABOVE', it indicates that the index of the current pixel A is the same as the index of the neighboring pixel C. In this case, the index of the neighboring pixel C may be derived as the index of the current pixel A.
반면, 런 타입을 나타내는 신택스 run_type이 'INDEX'를 가리키는 것은, 현재 화소 A의 인덱스를 나타내는 인덱스 정보가 부호화/복호화됨을 나타낸다. 예컨대, 런 타입이 'INDEX'를 가리키는 경우, 팔레트 테이블에 포함된 복수개의 팔레트 엔트리들 중 하나를 특정하는 palette_idx가 부호화/복호화될 수 있다.On the other hand, when the syntax run_type indicating the run type indicates 'INDEX', it indicates that index information indicating the index of the current pixel A is encoded/decoded. For example, when the run type indicates 'INDEX', palette_idx specifying one of a plurality of palette entries included in the palette table may be encoded/decoded.
이때, 인덱스가 escape 값을 나타내는 경우, escape 값을 유도하기 위한 정보가 추가 부호화될 수 있다. In this case, when the index indicates an escape value, information for deriving an escape value may be additionally encoded.
현재 블록 내 최상단 행에 위치하는 화소에는 상단에 인접하는 화소가 존재하지 않는다. 이에 따라, 최상단 행에 위치하는 화소에 대해서는, 런 타입 정보의 부호화를 생략하고, 런 타입이 'INDEX'인 것으로 추정할 수 있다.A pixel located at the top row in the current block does not have a pixel adjacent to the top. Accordingly, with respect to the pixel located in the uppermost row, encoding of run type information may be omitted and it may be estimated that the run type is 'INDEX'.
런 머지 플래그의 값이 거짓인 경우, 복호화기는, 런 타입 정보를 이용하여, 현재 화소 A의 인덱스를 유도할 수 있다. 일 예로, 런 타입 정보가 'ABOVE'를 가리키는 경우, 이웃 화소 C의 인덱스를 현재 화소 A의 인덱스로 유도할 수 있다. 반면, 런 타입 정보가 'INDEX'를 가리키는 경우, 인덱스 정보를 추가 파싱하고, 파싱된 인덱스 정보에 기초하여, 현재 화소 A의 인덱스로 유도할 수 있다.When the value of the run merge flag is false, the decoder may derive the index of the current pixel A using the run type information. For example, when the run type information indicates 'ABOVE', the index of the neighboring pixel C may be derived as the index of the current pixel A. On the other hand, when the run type information indicates 'INDEX', index information may be additionally parsed, and the index information of the current pixel A may be derived based on the parsed index information.
현재 블록 내 첫번째 화소에 대해서는, 런 머지 플래그의 부호화/복호화가 생략될 수 있다. 이는, 첫번째 화소에 대해서는 인덱스가 부호화된 이전 화소가 존재하지 않기 때문이다. 런 머지 플래그의 부호화가 생략된 경우, 그 값이 0(거짓)인 것으로 추정할 수 있다.For the first pixel in the current block, encoding/decoding of the run merge flag may be omitted. This is because, for the first pixel, there is no previous pixel whose index is coded. When the encoding of the run merge flag is omitted, it can be estimated that the value is 0 (false).
상술한 예에서와 같이, 런 머지 후보화 방법이 적용되는 경우, 신택스 run_merge_flag, run_type 또는 palette_idx 중 적어도 하나에 기초하여, 현재 화소의 인덱스가 유도될 수 있다. 이때, 위 신택스들은 문맥 정보를 이용하지 않고 부호화될 수 있다. 문맥 정보를 이용하지 않는 부호화 방법을 바이패스 부호화(Bypass coding)라 정의할 수 있다.As in the above example, when the run merge candidate method is applied, the index of the current pixel may be derived based on at least one of the syntax run_merge_flag, run_type, and palette_idx. In this case, the above syntaxes may be encoded without using context information. A coding method that does not use context information may be defined as bypass coding.
또는, 위 신택스들 중 적어도 하나가 문맥 정보를 이용하여 부호화되도록 설정할 수 있다. 일 예로, 신택스 run_merge_flag 부호화시, 문맥 정보를 참조할 수 있다. 문맥 정보를 이용하는 경우, 런 머지 플래그의 값이 1일 확률 또는 0일 확률이 이전 런 머지 플래그의 값에 기초하여 결정될 수 있다.Alternatively, at least one of the above syntaxes may be set to be encoded using context information. For example, when the syntax run_merge_flag is encoded, context information may be referred to. When context information is used, the probability that the value of the run merge flag is 1 or the probability that the value of the run merge flag is 0 may be determined based on the value of the previous run merge flag.
도 38은 문맥 정보를 이용하여 런 머지 플래그를 부호화하는 예를 나타낸 것이다. 38 shows an example of encoding a run merge flag using context information.
런 머지 플래그를 부호화함에 있어서, 런 머지 플래그의 값이 0으로 설정된 화소들 중 스캔 순번이 가장 높은 화소의 스캔 순번을 나타내는 변수 PREV_POS를 이용할 수 있다. 구체적으로, 현재 화소의 스캔 순번에서, 변수 PREV_POS 및 1을 차분하여 문맥 정보 인덱스 값을 유도하고, 유도된 문맥 정보 인덱스 값을 이용하여, 런 머지 플래그를 부호화할 수 있다. In encoding the run merge flag, a variable PREV_POS indicating the scan order of a pixel having the highest scan order among pixels in which the value of the run merge flag is set to 0 may be used. Specifically, in the scan order of the current pixel, a context information index value may be derived by differentiating variables PREV_POS and 1, and a run merge flag may be encoded using the derived context information index value.
이때, 첫번째 런 머지 플래그를 부호화 하는 경우, 기 부호화된 런 머지 플래그가 존재하지 않으므로, 변수 PREV_POS의 값은 초기값(예컨대, 0)으로 설정될 수 있다. 이에 따라, 첫번쨰 팔레트 예측 플래그에 대해서는, 문맥 정보 인덱스 값이 -1로 설정될 수 있다. In this case, when the first run merge flag is encoded, since the previously encoded run merge flag does not exist, the value of the variable PREV_POS may be set to an initial value (eg, 0). Accordingly, for the first palette prediction flag, the context information index value may be set to -1.
값이 0인 런 머지 플래그가 부호화될 때마다, 변수 PREV_POS가 업데이트될 수 있다. 반면, 값이 1인 런 머지 플래그가 부호화되는 경우, 변수 PREV_POS는 그대로 유지될 수 있다.Whenever a run merge flag with a value of 0 is encoded, the variable PREV_POS may be updated. On the other hand, when the run merge flag having a value of 1 is encoded, the variable PREV_POS may be maintained as it is.
도 38에 도시된 예에서, 스캔 순번이 6인 화소에 대해, 변수 PREV_POS는 3의 값을 가진 것으로 예시되었다. 이에 따라, 스캔 순번이 6인 화소에 대한 문맥 정보 인덱스는 2로 설정될 수 있다. 스캔 순번이 6인 화소의 런 머지 플래그를 부호화할 때, 문맥 정보 인덱스의 값에 따라, 런 머지 플래그의 확률을 결정하고, 결정된 확률에 기초하여 팔레트 예측 플래그를 부호화할 수 있다.In the example shown in FIG. 38 , for a pixel whose scan order number is 6, the variable PREV_POS is exemplified as having a value of 3. Accordingly, a context information index for a pixel having a scan order of 6 may be set to 2. When encoding the run merge flag of the pixel having the scan order number 6, the probability of the run merge flag may be determined according to the value of the context information index, and the palette prediction flag may be encoded based on the determined probability.
도 38에서는, 변수 PREV_POS가 값이 0인 런 머지 플래그를 같는 화소의 위치를 나타내는 것으로 설명하였으나, 변수 PREV_POS를 값이 1인 런 머지 플래그를 갖는 화소의 위치를 나타내도록 설정할 수도 있다. In FIG. 38 , the variable PREV_POS has been described as indicating the position of a pixel having the run merge flag having a value of 0, but the variable PREV_POS may be set to indicate the position of a pixel having the run merge flag having a value of 1.
도 39는 문맥 정보 인덱스의 범위를 나타낸 예시이다. 39 is an example showing the range of the context information index.
문맥 정보 인덱스의 최대값이 기 정의된 문턱값을 초과하지 않도록 설정될 수 있다. 현재 화소의 위치에서, 변수 PREV_POS 및 1을 차분하여 유도된 값이, 문턱값을 초과하는 경우, 문맥 정보 인덱스의 값을 최대값으로 설정할 수 있다. 도 39에서는, 최대값이 4인 것으로 예시되었다.The maximum value of the context information index may be set not to exceed a predefined threshold. When a value derived by differentiating the variables PREV_POS and 1 at the position of the current pixel exceeds a threshold value, the value of the context information index may be set to the maximum value. In FIG. 39 , it is illustrated that the maximum value is 4.
문맥 정보 인덱스의 최소값이 기 정의된 문턱값 미만이 되지 않도록 설정할 수도 있다. 현재 화소의 위치에서, 변수 PREV_POS 및 1을 차분하여 유도된 값이, 문턱값 미만인 경우, 문맥 정보 인덱스의 값을 최소값으로 설정할 수 있다. 도 39에서는, 최소값이 0인 것으로 예시되었다. 이에 따라, 첫번째 화소에 대한 문맥 정보 인덱스는 -1에서 0으로 변경될 수 있다.It may be set so that the minimum value of the context information index does not become less than a predefined threshold. When a value derived by differentiating the variables PREV_POS and 1 at the position of the current pixel is less than the threshold, the value of the context information index may be set to the minimum value. In FIG. 39 , it is illustrated that the minimum value is zero. Accordingly, the context information index for the first pixel may be changed from -1 to 0.
문맥 정보 인덱스의 최대값 및/또는 최소값은 부호화기 및 복호화기에서 정의될 수 있다. 또는, 문맥 정보 인덱스의 최대값 및/또는 최소값을 나타내는 정보가 비트스트림을 통해 시그날링될 수 있다. 일 예로, 슬라이스, 픽처 또는 시퀀스 등 상위 레벨에서 상기 정보가 부호화되어 시그날링될 수 있다. The maximum and/or minimum values of the context information index may be defined in the encoder and the decoder. Alternatively, information indicating the maximum and/or minimum values of the context information index may be signaled through the bitstream. For example, the information may be encoded and signaled at a higher level such as a slice, a picture, or a sequence.
블록을 복수의 영역들로 분할한 뒤, 영역별로 인덱스 관련 정보를 부호화할 수도 있다. After the block is divided into a plurality of regions, index-related information may be encoded for each region.
도 40은 기 설정된 크기의 영역 단위로 인덱스 관련 정보가 부호화되는 예를 나타낸 것이다. 40 shows an example in which index-related information is encoded in units of a region having a preset size.
도 40의 (a)의 예시는, 블록 크기가 16x4인 경우를 나타내고, 도 40의 (b)의 예시는, 블록 크기가 8x8인 경우를 나타낸다. 설명의 편의를 위해, 블록에는 가로 방향 스캔이 적용되는 것으로 가정한다.The example of FIG. 40(a) shows a case where the block size is 16x4, and the example of FIG. 40(b) shows a case where the block size is 8x8. For convenience of description, it is assumed that a horizontal scan is applied to a block.
블록을 기 정의된 크기의 영역들로 분할할 수 있다. 일 예로, 기 정의된 크기가 16인 경우, 16개의 화소 단위로 블록을 복수개의 영역들로 분할할 수 있다. 일 예로, 도 40의 (a)의 예시에서는, 블록이 16x1 크기의 영역들로 분할되고, 도 40의 (b)의 예시에서는, 블록이 8x2 크기의 영역들로 분할되는 것으로 예시되었다.A block may be divided into regions of a predefined size. For example, when the predefined size is 16, the block may be divided into a plurality of regions in units of 16 pixels. For example, in the example of FIG. 40A , the block is divided into 16x1 sized regions, and in the example of FIG. 40B , the block is divided into 8x2 sized regions.
영역별로 인덱스 관련 정보를 부호화할 수 있다. 일 예로, N번째 영역 내 인덱스 관련 정보(예컨대, run_merge_flag, run_type 또는 palette_idx 중 적어도 하나)의 부호화를 완료한 뒤, N+1번째 영역 내 인덱스 관련 정보를 부호화할 수 있다. 또는, 인덱스 관련 정보의 부호화가 영역간 병렬 처리될 수 있다. Index-related information may be encoded for each region. For example, after encoding of the index-related information in the N-th region (eg, at least one of run_merge_flag, run_type, or palette_idx) is completed, the index-related information in the N+1 th region may be encoded. Alternatively, the encoding of index-related information may be parallel-processed between regions.
인덱스 관련 정보는 영역간 독립적으로 부호화될 수 있다. 일 예로, 소정 영역 내 인덱스 관련 정보 부호화시, 타 영역을 참조하지 않을 수 있다. 예컨대, 영역 2의 첫번째 화소 부호화시, 영역 1의 마지막 화소의 정보를 참조하지 않을 수 있다. 이에 따라, 각 영역 내 첫번째 화소에 대해서는 런 머지 플래그의 부호화가 생략될 수 있다. 영역간 독립적으로 인덱스 관련 정보가 부호화되는 바, 스캔 순번도 영역간 독립적으로 부여될 수 있다. 예컨대, 각 영역마다 0부터 15까지의 스캔 순번을 할당하여, 화소들을 구분할 수 있다.Index-related information may be coded independently between regions. For example, when encoding index-related information within a predetermined region, other regions may not be referred. For example, when the first pixel of the region 2 is encoded, information on the last pixel of the region 1 may not be referenced. Accordingly, encoding of the run merge flag may be omitted for the first pixel in each region. Since index-related information is coded independently between regions, a scan order may also be independently assigned between regions. For example, by assigning scan order numbers 0 to 15 for each area, pixels may be distinguished.
또한, 각 영역 내 최상단 행에 위치하는 화소들에 대해서는 런 타입 정보의 부호화가 생략될 수 있다. Also, encoding of run type information may be omitted for pixels located in the uppermost row in each region.
다른 예로, 영역간 종속성을 부여하여, 인덱스 관련 정보를 부호화할 수 있다. 일 예로, 영역 2의 최상단 행에 위치하는 화소들의 인덱스 관련 정보는 영역 1의 최하단 행에 위치하는 화소들의 인덱스 관련 정보를 참조하여 부호화될 수 있다. 영역간 종속성이 부여된 경우, 영역간 연속되는 스캔 순번을 할당하여, 화소들을 구분할 수 있다. 일 예로, 영역 1에 속한 화소들에는 스캔 순번 0 내지 15가 할당되는 반면, 영역 2에 속한 화소들에는 스캔 순선 16 내지 31이 할당될 수 있다. As another example, index-related information may be encoded by providing inter-region dependency. For example, index-related information of pixels positioned in the uppermost row of region 2 may be encoded with reference to index-related information of pixels positioned in the lowermost row of region 1. When the inter-region dependency is given, the pixels may be distinguished by assigning a continuous scan order between the regions. For example, scan orders 0 to 15 may be allocated to pixels belonging to region 1, while scan orders 16 to 31 may be allocated to pixels belonging to region 2 .
또한, 첫번째 영역을 제외한 잔여 영역 내 첫번째 화소에 대해서도 런 머지 플래그의 값을 부호화할 수 있다. 일 예로, 영역 2의 첫번째 화소의 런 머지 플래그는, 영역 1의 마지막 화소(예컨대, 스캔 순번 15번인 화소)를 참조하여 부호화될 수 있다. Also, the value of the run merge flag may be coded for the first pixel in the remaining area except for the first area. As an example, the run merge flag of the first pixel of region 2 may be encoded with reference to the last pixel of region 1 (eg, a pixel having a scan order of 15).
영역간 인덱스 관련 정보가 독립적으로 부호화되는지 또는 종속적으로 부호화되는지 여부를 나타내는 정보가 부호화되어 시그날링될 수 있다. 또는, 현재 블록의 크기 또는 형태 중 적어도 하나에 기초하여, 영역간 인덱스 관련 정보가 독립적으로 부호화되는지 또는 종속적으로 부호화되는지 여부가 결정될 수 있다. Information indicating whether inter-region index-related information is independently encoded or dependently encoded may be encoded and signaled. Alternatively, based on at least one of the size or shape of the current block, it may be determined whether the inter-region index-related information is independently coded or dependently coded.
상술한 예에서는, 하나의 블록을 복수개의 영역으로 분할한 뒤, 영역간 종속성을 부여하여, 인덱스 관련 정보가 부호화될 수 있는 것으로 예시되었다. 이를 확장하여, 블록간 종속성을 부여하여, 인덱스 관련 정보를 부호화할 수도 있다.In the above-described example, it has been exemplified that index-related information can be encoded by dividing one block into a plurality of regions and then providing dependencies between regions. By extending this, inter-block dependency may be given to encode index-related information.
도 41은 블록간 종속성을 이용하여 인덱스 관련 정보가 부호화되는 예를 나타낸 것이다.41 shows an example in which index-related information is encoded using inter-block dependency.
현재 블록 상단 또는 좌측에 부호화/복호화가 완료된 이웃 블록이 존재하는 경우, 이웃 블록을 참조하여, 인덱스 관련 정보를 부호화할 수 있다. 일 예로, 현재 블록 내 첫번째 화소에 대한 런 머지 플래그를, 이웃 블록을 참조하여 부호화할 수 있다. 구체적으로, 상단 이웃 블록 또는 좌측 이웃 블록 내 스캔 순번이 마지막인 화소 또는 상단 이웃 블록 또는 좌측 이웃 블록 내 현재 블록의 첫번째 화소와 인접하는 화소를 참조하여, 현재 블록의 첫번째 화소에 대한 런 머지 플래그를 부호화할 수 있다.When a neighboring block that has been encoded/decoded exists on the top or left side of the current block, index-related information may be coded with reference to the neighboring block. As an example, the run merge flag for the first pixel in the current block may be encoded with reference to the neighboring block. Specifically, the run merge flag for the first pixel of the current block is set by referring to the pixel having the last scan order in the upper neighboring block or the left neighboring block, or the pixel adjacent to the first pixel of the current block in the upper neighboring block or the left neighboring block. can be encoded.
일 예로, 도 41에 도시된 예에서, 현재 블록 내 첫번째 화소 C에 대한 런 머지 플래그는, 상단에 이웃화는 화소 A 또는 좌측에 이웃하는 화소 B를 참조하여 부호화될 수 있다. For example, in the example shown in FIG. 41 , the run merge flag for the first pixel C in the current block may be encoded with reference to the pixel A neighboring to the top or the pixel B neighboring to the left.
또한, 현재 블록 내 최상단 행에 위치하는 화소들에 대해서도, 이웃 블록을 참조하여 런 타입 정보를 부호화할 수 있다.In addition, run type information may be coded with reference to a neighboring block even for pixels located in the uppermost row in the current block.
현재 블록의 상단 이웃 블록 또는 좌측 이웃 블록 중 어느 하나를 우선적으로 참조하도록 설정할 수 있다. 일 예로, 좌측 이웃 블록 및 상단 이웃 블록 중 좌측 이웃 블록을 먼저 참조하도록 설정할 수 있다. 상단 이웃 블록은 좌측 이웃 블록이 이용 불가능한 경우 참조될 수 있다. 즉, 현재 블록 내 첫번째 화소 C에 대한 런 타입 플래그 부호화시, 화소 B를 우선 적으로 참조하되, 화소 B가 이용 불가능한 경우, 화소 A를 참조할 수 있다. It can be set to preferentially refer to either the upper neighboring block or the left neighboring block of the current block. As an example, it may be set to first refer to the left neighboring block among the left neighboring block and the upper neighboring block. The upper neighboring block may be referred to when the left neighboring block is unavailable. That is, when the run-type flag encoding for the first pixel C in the current block is performed, the pixel B is preferentially referenced, but when the pixel B is unavailable, the pixel A may be referenced.
현재 화소의 인덱스가 escape 값을 가리키는 경우, escape 값을 추가적으로 부호화해야 한다. escape 값을 양자화하고, 양자화된 escape 값을 부호화할 수 있다. 이때, 양자화는, 슬라에스 레벨에서 정의된 초기 양자화 파라미터(QP, Quantization Parameter)를 이용하여 수행될 수 있다. 슬라에스 헤더를 통해, 초기 양자화 파라미터가 시그날링될 수 있다. If the current pixel index points to an escape value, the escape value must be additionally encoded. You can quantize escape values and encode quantized escape values. In this case, quantization may be performed using an initial quantization parameter (QP) defined at the SLAS level. Through the SLAS header, an initial quantization parameter may be signaled.
또는, 슬라이스 레벨에서 정의된 양자화 파라미터와 현재 블록에 적용되는 양자화 파라미터 사이의 차분을 나타내는 오프셋 값이 부호화될 수도 있다. 오프셋은 블록 단위로 부호화될 수 있다.Alternatively, an offset value indicating a difference between a quantization parameter defined at the slice level and a quantization parameter applied to the current block may be encoded. The offset may be coded in units of blocks.
일 예로, 슬라이스 레벨에서 정의된 초기 양자화 파라미터의 값이 23이고, 현재 블록에 대한 양자화 파라미터의 값이 27인 경우, 값이 4인 오프셋을 부호화하여 시그날링할 수 있다. For example, when the value of the initial quantization parameter defined at the slice level is 23 and the value of the quantization parameter for the current block is 27, an offset having a value of 4 may be encoded and signaled.
현재 팔레트 테이블에 escape 값이 존재하는지 여부에 따라, 팔레트 테이블의 크기(즉, 팔레트 엔트리의 최대 개수) 및/또는 인덱스의 이진화 방법이 상이할 수 있다. 이에 따라, 현재 팔레트 테이블에 escape 값이 존재하는지 여부를 나타내는 정보를 부호화하여 시그날링할 수 있다. 상기 정보는 1비트의 플래그일 수 있다. Depending on whether an escape value exists in the current palette table, the size of the palette table (ie, the maximum number of palette entries) and/or the binarization method of the index may be different. Accordingly, information indicating whether an escape value exists in the current palette table can be encoded and signaled. The information may be a 1-bit flag.
상기 플래그가 escape 값이 존재함을 나타내는 경우, 현재 팔레트 테이블의 크기를 1 증가시킬 수 있다. 반면, 상기 플래그가 escape 값이 존재하지 않음을 나타내는 경우, 현재 팔레트 테이블의 크기를 유지할 수 있다. When the flag indicates that an escape value exists, the size of the current palette table may be increased by one. On the other hand, when the flag indicates that the escape value does not exist, it is possible to maintain the size of the current palette table.
escape 값을 그대로 부호화하는 대신, escape 값과, 인트라 예측을 통해 유도된 예측값과의 차분을 부호화할 수 있다.Instead of encoding the escape value as it is, the difference between the escape value and the predicted value derived through intra prediction may be encoded.
도 42는 escape 값의 부호화 양상을 설명하기 위한 예시도이다.42 is an exemplary diagram for explaining an encoding aspect of an escape value.
도 42의 (a)는 현재 블록 및 현재 블록에 인접하는 참조 화소들을 나타내고, 도 42의 (b)는 현재 블록에 대한 팔레트 엔트리를 나타낸다. Figure 42 (a) shows the current block and reference pixels adjacent to the current block, Figure 42 (b) shows the palette entry for the current block.
도 42의 (a)에서 인덱스 4가 할당된 화소는 escape 값으로 부호화된다. 이때, 상기 화소의 값 A를 그대로 부호화하는 대신, 상기 화소의 값 A에서, 인트라 예측을 통해 획득되는 예측값을 차분하여 유도되는 차분값을 부호화할 수 있다.In (a) of FIG. 42 , the pixel assigned with the index 4 is encoded as an escape value. In this case, instead of encoding the value A of the pixel as it is, a difference value derived by differentiating a prediction value obtained through intra prediction from the value A of the pixel may be encoded.
일 예로, 수직 방향의 인트라 예측 모드가 적용되는 경우, 화소의 값 A에서, 상단 참조 화소 R2를 차분하여 유도되는 차분값(즉, A-R2)를 부호화할 수 있다. 또는, 상기 유도된 차분값을 양자화한 뒤, 양자화된 차분값을 부호화할 수도 있다.For example, when the intra prediction mode in the vertical direction is applied, a difference value (ie, A-R2) derived by differentiating the upper reference pixel R2 from the pixel value A may be encoded. Alternatively, after quantizing the derived difference value, the quantized difference value may be encoded.
차분값을 유도하는데 이용되는 인트라 예측 모드는, 플래너, DC, 수직 방향, 수평 방향, 우상단 대각 방향, 좌상단 대각 방향 또는 좌하단 대각 방향 중 적어도 하나일 수 있다.The intra prediction mode used to derive the difference value may be at least one of planar, DC, vertical direction, horizontal direction, upper right diagonal direction, upper left diagonal direction, or lower left diagonal direction.
부호화기 및 복호화기에서 고정된 화면 내 예측 모드를 이용하여 escape 값을 유도할 수 있다.An escape value can be derived by using a fixed intra-picture prediction mode in the encoder and decoder.
또는, 복수개의 인트라 예측 모드들 중 escape 값을 유도하기 위한 인트라 예측 모드를 특정하는 정보를 부호화하여 시그날링할 수 있다. 이때, 이용 가능한 인트라 예측 모드가 2개인 경우, 상기 정보는 1비트의 플래그일 수 있다. 일 예로, 수직 방향 또는 수평 방향의 인트라 예측 모드만이 이용 가능한 경우, 상기 플래그에 기초하여, escape 값을 유도하는데 이용되는 인트라 예측 모드를 결정할 수 있다. Alternatively, information specifying an intra prediction mode for deriving an escape value among a plurality of intra prediction modes may be encoded and signaled. In this case, when there are two available intra prediction modes, the information may be a 1-bit flag. For example, when only the intra prediction mode in the vertical direction or the horizontal direction is available, the intra prediction mode used to derive the escape value may be determined based on the flag.
또는, 현재 블록의 크기, 형태 또는 이웃 블록의 인트라 예측 모드 중 적어도 하나에 기초하여, escape 값을 유도하는데 이용되는 인트라 예측 모드를 결정할 수도 있다. Alternatively, the intra prediction mode used to derive the escape value may be determined based on at least one of the size and shape of the current block and the intra prediction mode of the neighboring block.
현재 블록 바깥의 참조 화소를 이용하여 차분값을 유도하는 대신, 현재 블록 내 인접하는 화소를 이용하여 차분값을 유도할 수도 있다. 여기서, 인접하는 화소는, 스캔 순서 상 현재 화소보다 이전에 인덱스가 결정된 화소를 나타낸다. Instead of deriving a difference value using a reference pixel outside the current block, a difference value may be derived using an adjacent pixel in the current block. Here, the adjacent pixel indicates a pixel whose index is determined before the current pixel in the scan order.
도 43은 인트라 예측 모드에 기초하여, escape 값에 대한 차분값을 유도하는 예를 나타낸다. 43 shows an example of deriving a difference value with respect to an escape value based on the intra prediction mode.
도 43의 (a)는 참조 화소를 이용하여, escape 값에 대한 차분값을 유도하는 예이고, 도 43의 (b)는 인접 화소를 이용하여, escape 값에 대한 차분값을 유도하는 예이다. 설명의 편의를 위해, 스캔 순서를 가로 방향인 것으로 가정한다. 43 (a) is an example of deriving a difference value with respect to an escape value using a reference pixel, and FIG. 43 (b) is an example of deriving a difference value with respect to an escape value using an adjacent pixel. For convenience of description, it is assumed that the scan order is in the horizontal direction.
현재 블록 바깥의 참조 화소를 이용하는 경우, 현재 화소의 값 및 현재 화소의 수직 방향 또는 수평 방향에 위치하는 참조 화소와의 차분값을 유도할 수 있다. 일 예로, 도 43의 (a)에 도시된 예에서, 인덱스가 4인 화소의 값 A에서, 참조 화소 R2 또는 참조 화소 R6를 차분하여, 차분값을 유도할 수 있다. 이때, 수직 방향 인트라 예측 모드가 적용되는 경우, 수직 방향의 참조 화소를 이용하여 차분값을 유도하고, 수평 방향 인트라 예측 모드가 적용되는 경우, 수평 방향의 참조 화소를 이용하여 차분값을 유도할 수 있다. When a reference pixel outside the current block is used, a difference value between the value of the current pixel and the reference pixel located in the vertical or horizontal direction of the current pixel may be derived. As an example, in the example illustrated in FIG. 43A , a difference value may be derived by differentiating the reference pixel R2 or the reference pixel R6 from the value A of the pixel having the index 4 . In this case, when the vertical intra prediction mode is applied, a difference value is derived using the reference pixel in the vertical direction, and when the horizontal intra prediction mode is applied, the difference value can be derived using the reference pixel in the horizontal direction. have.
현재 블록 내 화소를 이용하는 경우, 현재 화소의 값 및 현재 화소에 인접하는 이웃 화소와의 차분값을 유도할 수 있다. 일 예로, 도 43의 (b)에 도시된 예에서, 인덱스가 4인 화소의 값 A에서, 우측 이웃 화소의 값을 차분하거나, 상단 이웃 화소의 값을 차분하여 차분값을 유도할 수 있다. 이때, 수직 방향 인트라 예측 모드가 적용되는 경우, 수직 방향의 이웃 화소를 이용하여 차분값을 유도하고, 수평 방향 인트라 예측 모드가 적용되는 경우, 수평 방향의 이웃 화소를 이용하여 차분값을 유도할 수 있다.When a pixel in the current block is used, a difference value between the value of the current pixel and a neighboring pixel adjacent to the current pixel may be derived. As an example, in the example shown in FIG. 43B , a difference value may be derived by differentiating the value of the right neighboring pixel or the value of the upper neighboring pixel from the value A of the pixel having the index 4 . In this case, when the vertical intra prediction mode is applied, a difference value is derived using the neighboring pixels in the vertical direction, and when the horizontal intra prediction mode is applied, the difference value can be derived using the neighboring pixels in the horizontal direction. have.
무손실 부호화가 적용되었는지 여부에 기초하여, 차분값의 유도 방법을 결정할 수 있다. 일 예로, 무손실 부호화가 적용되지 않은 경우에는, 도 43의 (a)에 도시된 예에서와 같이, 현재 블록 바깥의 참조 화소를 이용하여, 차분값을 유도할 수 있다. 반면, 무손실 부호화가 적용된 경우에는, 도 43의 (b)에 도시된 예에서와 같이, 현재 블록 내 이웃 화소를 이용하여, 차분값을 유도할 수 있다. Based on whether or not lossless encoding is applied, a method of deriving a difference value may be determined. For example, when lossless encoding is not applied, as in the example shown in FIG. 43A , a difference value may be derived using a reference pixel outside the current block. On the other hand, when lossless coding is applied, as in the example shown in (b) of FIG. 43 , a difference value can be derived using neighboring pixels in the current block.
복호화기는 차분값 및 예측값을 합하여, 현재 픽셀에 대한 escape 값을 유도할 수 있다. 일 예로, 현재 블록 바깥의 참조 화소를 이용하여 차분값이 유도된 경우에는, 비트스트림으로부터 복호화된 차분값과 상단 참조 화소 또는 좌측 참조 화소를 더하여 escape 값을 유도할 수 있다. 반면, 현재 블록 내 참조 화소를 이용하여 차분값이 부호화된 경우에는, 비트스트림으로부터 복호화된 차분값과 복원된 이웃 화소(예컨대, 상단 이웃 화소 또는 우측 이웃 화소)의 값을 더하여, escape 값을 유도할 수 있다. The decoder may derive an escape value for the current pixel by summing the difference value and the predicted value. For example, when a difference value is derived using a reference pixel outside the current block, an escape value may be derived by adding the difference value decoded from the bitstream and the upper reference pixel or the left reference pixel. On the other hand, when the difference value is encoded using the reference pixel in the current block, the escape value is derived by adding the difference value decoded from the bitstream and the value of the restored neighboring pixel (eg, the upper neighboring pixel or the right neighboring pixel). can do.
다른 예로, 블록 벡터를 이용하여, escape 값에 대한 예측 값을 생성할 수도 있다. As another example, a prediction value for an escape value may be generated using a block vector.
도 44는 블록 벡터를 이용하여, escape 값에 대한 차분값을 유도하는 예를 나타낸다.44 shows an example of deriving a difference value with respect to an escape value using a block vector.
현재 블록의 블록 벡터를 유도한 뒤, 블록 벡터를 통해 특정된 참조 블록을 특정할 수 있다. 그리고, 참조 블록 내, escape 값이 할당되는 현재 화소와 동일한 위치의 화소의 값을 예측값으로 설정할 수 있다. After deriving the block vector of the current block, the reference block specified through the block vector may be specified. And, in the reference block, the value of the pixel at the same position as the current pixel to which the escape value is assigned may be set as the predicted value.
일 예로, 도 44에 도시된 예에서, escape 값이 할당되는 화소의 값 A에서, 참조 블록 내 상기 화소와 동일한 위치의 화소인 A5를 차분하여, 차분값을 유도할 수 있다. For example, in the example shown in FIG. 44 , a difference value may be derived by differentiating A5, which is a pixel at the same position as the pixel in the reference block, from the value A of the pixel to which the escape value is assigned.
차분값이 유도되면, 차분값을 부호화하거나, 또는 차분값을 양자화하여, 양자화된 차분값을 부호화할 수 있다.When the difference value is derived, the quantized difference value may be encoded by encoding the difference value or quantizing the difference value.
블록 벡터를 이용하여 escape 값에 대한 예측값을 생성할 것인지 여부는, 무손실 부호화가 적용되었는지 여부에 기초하여 결정될 수 있다. 일 예로, 현재 영상에 무손실 부호화가 적용되는 경우에 한하여, 블록 벡터를 이용하여 escape 값에 대한 예측값을 생성할 수 있다. Whether to generate a prediction value for an escape value using a block vector may be determined based on whether lossless coding is applied. As an example, only when lossless encoding is applied to the current image, a prediction value for an escape value may be generated using a block vector.
또는, escape 값에 대한 예측값 생성 방법을 특정하는 정보가 비트스트림을 통해 시그날링될 수 있다. 일 예로, 상기 정보는, 인트라 예측 모드 또는 블록 벡터 이용 모드 중 적어도 하나를 특정하는 것일 수 있다.Alternatively, information specifying a method of generating a predicted value for an escape value may be signaled through a bitstream. As an example, the information may specify at least one of an intra prediction mode and a block vector use mode.
현재 블록의 인트라 예측 모드 또는 블록 벡터는 현재 블록에 인접하는 이웃 블록을 참조하여 유도될 수 있다. 여기서, 이웃 블록은 현재 블록의 상단 이웃 블록, 좌측 이웃 블록, 좌상단 이웃 블록, 우상단 이웃 블록 또는 좌하단 이웃 블록 중 적어도 하나를 포함할 수 있다.The intra prediction mode or block vector of the current block may be derived with reference to a neighboring block adjacent to the current block. Here, the neighboring block may include at least one of an upper neighboring block, a left neighboring block, an upper left neighboring block, an upper right neighboring block, or a lower left neighboring block of the current block.
도 45은 현재 블록의 이웃 블록을 설명하기 위한 예시이다. 45 is an example for describing a neighboring block of the current block.
도 45에서, RT는 블록 내의 가장 오른쪽 위에 위치한 화소를 나타내고, LB는 블록 내의 가장 왼쪽 아래에 존재하는 화소를 나타낸다. In FIG. 45 , RT indicates a pixel located at the upper right of the block, and LB indicates a pixel located at the bottom left of the block.
현재 블록 주변의 5개 이웃 블록을 참조하여 블록 벡터가 유도된다고 가정할 때, 기 정의된 우선 순위에 따라 이웃 블록들을 탐색하여 블록 벡터 후보 리스트를 구성할 수 있다. 일 예로, A 위치의 화소를 포함하는 상단 이웃 블록, L 위치의 화소를 포함하는 좌측 이웃 블록, e 위치의 화소를 포함하는 우상단 이웃 블록, i 위치의 화소를 포함하는 좌하단 이웃 블록 및 a 위치의 화소를 포함하는 좌상단 이웃 블록순으로 이웃 블록들을 탐색할 수 있다.Assuming that a block vector is derived with reference to five neighboring blocks around the current block, a block vector candidate list may be constructed by searching for neighboring blocks according to a predefined priority. For example, an upper neighboring block including a pixel at position A, a left neighboring block including a pixel at position L, an upper right neighboring block including a pixel at position e, a lower left neighboring block including a pixel at position i, and position a The neighboring blocks may be searched in the order of the upper left neighboring blocks including the pixel of .
블록 벡터를 이용하여 부호화된 블록이 탐색된 경우, 탐색된 블록의 블록 벡터를 기초로, 블록 벡터 후보 리스트를 구성할 수 있다. 블록 벡터 후보 리스트에 복수의 블록 벡터 후보가 포함되어 있는 경우, 복수의 블록 벡터 후보 중 하나를 특정하는 인덱스 정보를 부호화하여 시그날링할 수 있다. When a block encoded using a block vector is searched for, a block vector candidate list may be constructed based on the block vector of the searched block. When a plurality of block vector candidates are included in the block vector candidate list, index information specifying one of the plurality of block vector candidates may be encoded and signaled.
또는, 상기 탐색 순서에 따라 이웃 블록들을 탐색하였을 때, 첫번째로 발견된 블록(즉, 블록 벡터로 부호화된 첫번째 블록)의 블록 벡터를, 현재 블록의 블록 벡터로 설정할 수 있다. Alternatively, when neighboring blocks are searched according to the search order, a block vector of a first found block (ie, a first block encoded as a block vector) may be set as a block vector of the current block.
상술한 실시예들에서 사용된 신택스들의 명칭은, 설명의 편의를 위해 명명된 것에 불과하다.The names of syntaxes used in the above-described embodiments are merely named for convenience of description.
복호화 과정 또는 부호화 과정을 중심으로 설명된 실시예들을, 부호화 과정 또는 복호화 과정에 적용하는 것은, 본 개시의 범주에 포함되는 것이다. 소정의 순서로 설명된 실시예들을, 설명된 것과 상이한 순서로 변경하는 것 역시, 본 개시의 범주에 포함되는 것이다.Applying the decoding process or the embodiments described based on the encoding process to the encoding process or the decoding process is included in the scope of the present disclosure. It is also within the scope of the present disclosure to change the embodiments described in a certain order in an order different from that described.
상술한 실시예는 일련의 단계 또는 순서도를 기초로 설명되고 있으나, 이는 발명의 시계열적 순서를 한정한 것은 아니며, 필요에 따라 동시에 수행되거나 다른 순서로 수행될 수 있다. 또한, 상술한 실시예에서 블록도를 구성하는 구성요소(예를 들어, 유닛, 모듈 등) 각각은 하드웨어 장치 또는 소프트웨어로 구현될 수도 있고, 복수의 구성요소가 결합하여 하나의 하드웨어 장치 또는 소프트웨어로 구현될 수도 있다. 상술한 실시예는 다양한 컴퓨터 구성요소를 통하여 수행될 수 있는 프로그램 명령어의 형태로 구현되어 컴퓨터 판독 가능한 기록 매체에 기록될 수 있다. 상기 컴퓨터 판독 가능한 기록 매체는 프로그램 명령어, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. 컴퓨터 판독 가능한 기록 매체의 예에는, 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체, CD-ROM, DVD와 같은 광기록 매체, 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical media), 및 ROM, RAM, 플래시 메모리 등과 같은 프로그램 명령어를 저장하고 수행하도록 특별히 구성된 하드웨어 장치가 포함된다. 상기 하드웨어 장치는 본 개시에 따른 처리를 수행하기 위해 하나 이상의 소프트웨어 모듈로서 작동하도록 구성될 수 있으며, 그 역도 마찬가지이다.Although the above-described embodiment has been described based on a series of steps or a flowchart, this does not limit the time-series order of the invention, and may be performed simultaneously or in a different order, if necessary. In addition, each of the components (eg, unit, module, etc.) constituting the block diagram in the above-described embodiment may be implemented as a hardware device or software, or a plurality of components may be combined to form one hardware device or software. may be implemented. The above-described embodiment may be implemented in the form of program instructions that can be executed through various computer components and recorded in a computer-readable recording medium. The computer-readable recording medium may include program instructions, data files, data structures, etc. alone or in combination. Examples of the computer-readable recording medium include a hard disk, a magnetic medium such as a floppy disk and a magnetic tape, an optical recording medium such as a CD-ROM, a DVD, and a magneto-optical medium such as a floppy disk. media), and hardware devices specially configured to store and execute program instructions, such as ROM, RAM, flash memory, and the like. The hardware device may be configured to operate as one or more software modules to perform processing according to the present disclosure, and vice versa.
본 개시는 비디오 신호를 부호화/복호화하기 위해 이용될 수 있다.The present disclosure may be used to encode/decode a video signal.

Claims (13)

  1. 현재 영상에 무손실 부호화가 적용되는지 여부를 결정하는 단계; determining whether lossless encoding is applied to the current image;
    상기 현재 영상 내 현재 블록에 대한 잔차 계수를 복호화하는 단계; 및decoding a residual coefficient for a current block in the current image; and
    상기 잔차 계수에 기초하여, 잔차 샘플을 유도하는 단계를 포함하되,based on the residual coefficients, deriving a residual sample;
    상기 잔차 계수 복호화시, 상기 현재 영상에 무손실 부호화가 적용되었는지 여부에 기초하여, 최대 m개의 비교 플래그가 이용되는 제1 방법 및 최대 n개의 비교 플래그가 이용되는 제2 방법 중 하나가 선택되고,When decoding the residual coefficient, one of a first method using a maximum of m comparison flags and a second method using a maximum of n comparison flags is selected based on whether lossless encoding is applied to the current image,
    상기 비교 플래그는, 상기 잔차 계수의 절대값이 소정의 값을 초과하는지 여부를 나타내는 것을 특징으로 하는, 영상 복호화 방법.The comparison flag indicates whether an absolute value of the residual coefficient exceeds a predetermined value.
  2. 제1 항에 있어서,According to claim 1,
    문맥 정보를 이용하여 복호화된 빈의 개수와 임계값을 비교하여, 상기 잔차 계수에 대해 적어도 하나의 비교 플래그가 복호화되는지 여부가 결정되는 것을 특징으로 하는, 영상 복호화 방법.An image decoding method, characterized in that it is determined whether at least one comparison flag is decoded with respect to the residual coefficient by comparing the number of decoded bins and a threshold value using context information.
  3. 제2 항에 있어서,3. The method of claim 2,
    문맥 정보를 이용하여 복호화된 빈의 개수가 상기 임계값 이상인 경우, 상기 비교 플래그 대신 상기 잔차 계수의 절대값을 그대로 나타내는 신택스가 복호화되는 것을 특징으로 하는, 영상 복호화 방법.When the number of bins decoded using context information is equal to or greater than the threshold value, a syntax representing the absolute value of the residual coefficient as it is instead of the comparison flag is decoded.
  4. 제2 항에 있어서,3. The method of claim 2,
    상기 비교 플래그 또는 상기 잔차 계수의 절대값이 짝수인지 여부를 나타내는 패리티 플래그 중 적어도 하나가 복호화되는 경우, 상기 문맥 정보를 이용하여 복호화된 빈의 개수가 증가하는 것을 특징으로 하는, 영상 복호화 방법.When at least one of the comparison flag or a parity flag indicating whether the absolute value of the residual coefficient is an even number is decoded, the number of bins decoded using the context information is increased.
  5. 제1 항에 있어서,According to claim 1,
    상기 제1 신택스가 복호화되고, 상기 제1 신택스가 상기 잔차 계수가 0이 아닌 값을 가짐을 나타내는 경우, When the first syntax is decoded and the first syntax indicates that the residual coefficient has a non-zero value,
    상기 잔차 계수의 절대값이 1보다 큰 값을 갖는지 여부를 나타내는 gt_1_flag가 추가 복호화되는 것을 특징으로 하는, 영상 복호화 방법.and gt_1_flag indicating whether the absolute value of the residual coefficient has a value greater than 1 is further decoded.
  6. 제5 항에 있어서,6. The method of claim 5,
    상기 gt_1_flag가 상기 절대값이 1보다 큰 값을 가짐을 나타내는 경우, 상기 절대값이 짝수인지 여부를 나타내는 패리티 플래그 및 상기 절대값이 3보다 큰지 여부를 나타내는 gt_2_flag가 추가 복호화되는 것을 특징으로 하는, 영상 복호화 방법.When the gt_1_flag indicates that the absolute value has a value greater than 1, a parity flag indicating whether the absolute value is an even number and a gt_2_flag indicating whether the absolute value is greater than 3 are further decoded. Decryption method.
  7. 제2 항에 있어서,3. The method of claim 2,
    상기 임계값은 상기 현재 블록의 크기에 기초하여 결정되는 것을 특징으로 하는, 영상 복호화 방법. The image decoding method, characterized in that the threshold value is determined based on the size of the current block.
  8. 현재 영상에 무손실 부호화가 적용되는지 여부를 결정하는 단계;determining whether lossless encoding is applied to the current image;
    현재 블록의 잔차 샘플에 기초하여, 잔차 계수를 유도하는 단계; 및deriving a residual coefficient based on the residual sample of the current block; and
    상기 현재 블록의 상기 잔차 계수를 부호화하는 단계를 포함하되, encoding the residual coefficients of the current block;
    상기 잔차 계수 부호화시, 상기 현재 영상에 무손실 부호화가 적용되었는지 여부에 기초하여, 최대 m개의 비교 플래그가 이용되는 제1 방법 및 최대 n개의 비교 플래그가 이용되는 제2 방법 중 하나가 선택되고,When encoding the residual coefficient, one of a first method using a maximum of m comparison flags and a second method using a maximum of n comparison flags is selected based on whether lossless encoding is applied to the current image,
    상기 비교 플래그는, 상기 잔차 계수의 절대값이 소정의 값을 초과하는지 여부를 나타내는 것을 특징으로 하는, 영상 부호화 방법.and the comparison flag indicates whether an absolute value of the residual coefficient exceeds a predetermined value.
  9. 제8 항에 있어서,9. The method of claim 8,
    문맥 정보를 이용하여 부호화된 빈의 개수와 임계값을 비교하여, 상기 잔차 계수에 대해 적어도 하나의 비교 플래그가 부호화되는지 여부가 결정되는 것을 특징으로 하는, 영상 부호화 방법.An image encoding method, characterized in that it is determined whether at least one comparison flag is encoded with respect to the residual coefficient by comparing the number of encoded bins and a threshold value using context information.
  10. 제9 항에 있어서,10. The method of claim 9,
    문맥 정보를 이용하여 부호화된 빈의 개수가 상기 임계값 이상인 경우, 상기 비교 플래그 대신 상기 잔차 계수의 절대값을 그대로 나타내는 신택스가 부호화되는 것을 특징으로 하는, 영상 부호화 방법.When the number of bins encoded using context information is equal to or greater than the threshold value, a syntax indicating the absolute value of the residual coefficient as it is instead of the comparison flag is encoded.
  11. 제9 항에 있어서,10. The method of claim 9,
    상기 비교 플래그 또는 상기 잔차 계수의 절대값이 짝수인지 여부를 나타내는 패리티 플래그 중 적어도 하나가 부호화되는 경우, 상기 문맥 정보를 이용하여 부호화된 빈의 개수가 증가하는 것을 특징으로 하는, 영상 부호화 방법.When at least one of the comparison flag or the parity flag indicating whether the absolute value of the residual coefficient is an even number is encoded, the number of bins encoded using the context information is increased.
  12. 제9 항에 있어서,10. The method of claim 9,
    상기 임계값은 상기 현재 블록의 크기에 기초하여 결정되는 것을 특징으로 하는, 영상 부호화 방법. The threshold value is an image encoding method, characterized in that determined based on the size of the current block.
  13. 비디오 부호화 방법에 의해 부호화되는 비트스트림을 저장하는 컴퓨터로 판독가능한 기록 매체에 있어서,A computer-readable recording medium storing a bitstream encoded by a video encoding method, comprising:
    상기 비디오 부호화 방법은,The video encoding method comprises:
    현재 영상에 무손실 부호화가 적용되는지 여부를 결정하는 단계;determining whether lossless encoding is applied to the current image;
    현재 블록의 잔차 샘플에 기초하여, 잔차 계수를 유도하는 단계; 및deriving a residual coefficient based on the residual sample of the current block; and
    상기 현재 블록의 상기 잔차 계수를 부호화하는 단계를 포함하되, encoding the residual coefficients of the current block;
    상기 잔차 계수 부호화시, 상기 현재 영상에 무손실 부호화가 적용되었는지 여부에 기초하여, 최대 m개의 비교 플래그가 이용되는 제1 방법 및 최대 n개의 비교 플래그가 이용되는 제2 방법 중 하나가 선택되고,When encoding the residual coefficient, one of a first method using a maximum of m comparison flags and a second method using a maximum of n comparison flags is selected based on whether lossless encoding is applied to the current image,
    상기 비교 플래그는, 상기 잔차 계수의 절대값이 소정의 값을 초과하는지 여부를 나타내는 것을 특징으로 하는, 컴퓨터로 판독가능한 기록 매체.and the comparison flag indicates whether an absolute value of the residual coefficient exceeds a predetermined value.
PCT/KR2020/018201 2019-12-13 2020-12-11 Video signal processing method and device WO2021118310A1 (en)

Applications Claiming Priority (6)

Application Number Priority Date Filing Date Title
KR20190167125 2019-12-13
KR10-2019-0167126 2019-12-13
KR10-2019-0167125 2019-12-13
KR10-2019-0167128 2019-12-13
KR20190167128 2019-12-13
KR20190167126 2019-12-13

Publications (1)

Publication Number Publication Date
WO2021118310A1 true WO2021118310A1 (en) 2021-06-17

Family

ID=76330218

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/KR2020/018201 WO2021118310A1 (en) 2019-12-13 2020-12-11 Video signal processing method and device

Country Status (1)

Country Link
WO (1) WO2021118310A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20140056600A (en) * 2012-10-30 2014-05-12 광주과학기술원 Hevc lossless level encoding method and apparatus
KR20160133509A (en) * 2014-03-14 2016-11-22 퀄컴 인코포레이티드 Coefficient level coding in a video coding process
KR101772740B1 (en) * 2012-01-17 2017-08-29 퀄컴 인코포레이티드 Throughput improvement for cabac coefficient level coding
KR20180041774A (en) * 2013-04-23 2018-04-24 퀄컴 인코포레이티드 Repositioning of prediction residual blocks in video coding
KR20180048929A (en) * 2015-09-01 2018-05-10 퀄컴 인코포레이티드 Coefficient level coding in video coding

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101772740B1 (en) * 2012-01-17 2017-08-29 퀄컴 인코포레이티드 Throughput improvement for cabac coefficient level coding
KR20140056600A (en) * 2012-10-30 2014-05-12 광주과학기술원 Hevc lossless level encoding method and apparatus
KR20180041774A (en) * 2013-04-23 2018-04-24 퀄컴 인코포레이티드 Repositioning of prediction residual blocks in video coding
KR20160133509A (en) * 2014-03-14 2016-11-22 퀄컴 인코포레이티드 Coefficient level coding in a video coding process
KR20180048929A (en) * 2015-09-01 2018-05-10 퀄컴 인코포레이티드 Coefficient level coding in video coding

Similar Documents

Publication Publication Date Title
WO2020185022A1 (en) Method for encoding/decoding image signal, and device therefor
WO2020159198A1 (en) Video signal encoding/decoding method and device therefor
WO2018226015A1 (en) Video encoding/decoding method and device, and recording medium storing bit stream
WO2017176030A1 (en) Method and apparatus for processing video signal
WO2018012886A1 (en) Image encoding/decoding method and recording medium therefor
WO2019177354A1 (en) Method and device for encoding/decoding image and recording medium having bitstream stored thereon
WO2018012851A1 (en) Image encoding/decoding method and recording medium therefor
WO2020096389A1 (en) Image signal encoding/decoding method and apparatus therefor
WO2017171370A1 (en) Method and apparatus for processing video signal
WO2019182385A1 (en) Image encoding/decoding method and device, and recording medium in which bitstream is stored
WO2019172705A1 (en) Image encoding/decoding method and apparatus using sample filtering
WO2020076125A1 (en) Method for encoding/decoding image signal and device for same
WO2018174617A1 (en) Block form-based prediction method and device
WO2020005035A1 (en) Image encoding/decoding method and apparatus for throughput enhancement, and recording medium storing bitstream
WO2020096388A1 (en) Method for encoding/decoding image signal, and apparatus therefor
WO2020222617A1 (en) Method for encoding/decoding video signal and device therefor
WO2020060244A1 (en) Method and device for encoding/decoding images, and recording medium for storing bitstream
WO2020256442A1 (en) Method for encoding/decoding image signal and apparatus therefor
WO2020213963A1 (en) Method for encoding/decoding image signal, and device for same
WO2020060329A1 (en) Method for encoding/decoding image signal and apparatus therefor
WO2020013532A1 (en) Method and device for image encoding/decoding, and recording medium having bitstream stored thereon
WO2020060327A1 (en) Image signal encoding/decoding method and device therefor
WO2020256422A1 (en) Inter prediction information encoding/decoding method and device
WO2020050600A1 (en) Video encoding/decoding method and device, and recording medium for storing bitstream
WO2016190627A1 (en) Method and device for processing video signal

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20897968

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20897968

Country of ref document: EP

Kind code of ref document: A1