Image encoding / decoding method and device, and recording medium on which bitstream is stored

The method employs reduced-dimensional non-separable transformation kernels and adaptive transformation techniques to enhance video compression efficiency, addressing the challenges of encoding and decoding high-resolution images by optimizing transformations for different block sizes and shapes.

WO2024215147A1PCT designated stage expired Publication Date: 2024-10-17LG ELECTRONICS INC
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/KR2024/004963
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-12
Filing Date
2024-04-12
Publication Date
2024-10-17

AI Technical Summary

Technical Problem

Current video compression technologies face challenges in efficiently encoding and decoding high-resolution images, particularly in handling non-separable transformations and determining optimal transformation kernels for improved coding efficiency.

Method used

The method involves using a reduced-dimensional non-separable first-order transformation kernel and determining a non-separable transformation kernel based on encoding parameters, applying inverse quantization and inverse transformation to derive residual samples, and performing transformations using Low Frequency Non-Separable Transform (LFNST) or Non-Separable Primary Transform (NSPT) depending on block sizes and shapes.

Benefits of technology

This approach enhances transformation performance, improves coding efficiency, and effectively handles various block sizes and shapes by adaptively selecting the appropriate transformation method, leading to better compression and decoding of high-resolution video data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure KR2024004963_17102024_PF_FP_ABST
    Figure KR2024004963_17102024_PF_FP_ABST
Patent Text Reader

Abstract

An image decoding method and device according to the present disclosure can acquire residual information from a bitstream, derive transform coefficients of the current block on the basis of the residual information, derive residual samples of the current block by performing inverse quantization and / or inverse transform on the transform coefficients of the current block, and reconstruct the current block on the basis of the residual samples of the current block. Here, the inverse transform can be performed on the basis of a non-separable primary transform and / or a low frequency non-separable transform.
Need to check novelty before this filing date? Find Prior Art

Description

Video encoding / decoding method and device, and recording medium storing bitstream

[0001] The present invention relates to a video encoding / decoding method and device, and a recording medium storing a bitstream.

[0002] Recently, the demand for high-resolution, high-quality images, such as HD (High Definition) images and UHD (Ultra High Definition) images, is increasing in various application fields, and accordingly, high-efficiency image compression technologies are being discussed.

[0003] There are various technologies for image compression, such as inter prediction technology that predicts pixel values ​​included in the current picture from pictures before or after the current picture, intra prediction technology that predicts pixel values ​​included in the current picture using pixel information within the current picture, and entropy encoding technology that assigns short codes to values ​​with high frequency of appearance and long codes to values ​​with low frequency of appearance, and these technologies can be used to effectively compress and transmit or store image data.

[0004] The present disclosure provides a method and apparatus for performing a transformation using a non-separable primary transformation.

[0005] The present disclosure provides a method and apparatus for performing a transformation using a non-separable first-order transform kernel of reduced dimensionality.

[0006] The present disclosure provides a method and device for determining / signaling a non-separable transform kernel based on encoding parameters.

[0007] A video decoding method and device according to the present disclosure can obtain residual information from a bitstream, derive transform coefficients of a current block based on the residual information, derive residual samples of the current block by performing at least one of inverse quantization or inverse transform on the transform coefficients of the current block, and reconstruct the current block based on the residual samples of the current block. Here, the inverse transform can be performed based on at least one of a non-separable primary transform (NSPT) or a low frequency non-separable transform (LFNST).

[0008] In the image decoding method and device according to the present disclosure, the LFNST can be applied to transform coefficients belonging to an area having a predetermined width (W) and height (H) within the current block, and the width and height of the area can be determined based on at least one of the width or height of the current block.

[0009] In the image decoding method and device according to the present disclosure, the output length of the LFNST may be (W*H).

[0010] In the image decoding method and device according to the present disclosure, when the current block is a 4xN block or an Nx4 block, an LFNST having an output length of 32 may be applied to the current block. Here, N may be an integer greater than or equal to 8.

[0011] In the video decoding method and device according to the present disclosure, when the current block is an 8xN block or an Nx8 block, an LFNST having an output length of 128 may be applied to the current block. Here, N may be an integer greater than or equal to 16.

[0012] In the image decoding method and device according to the present disclosure, when the current block is a 4xN block or an Nx4 block, an LFNST having an output length of 64 may be applied to the current block. Here, N may be an integer greater than or equal to 16.

[0013] In the video decoding method and device according to the present disclosure, when the current block is a 4xN block or an Nx4 block, LFNST having an output length of 32 may be applied to the current block. Here, N may be an integer greater than or equal to 8. When the current block is an 8x16 block or a 16x8 block, NSPT may be applied to the current block.

[0014] In the video decoding method and device according to the present disclosure, when the current block is a 4xN block or an Nx4 block, the LFNST having an output length of 64 may be applied to the current block. Here, N may be an integer greater than or equal to 16. When the current block is a 4x8 block or an 8x4 block, the NSPT may be applied to the current block.

[0015] In the video decoding method and device according to the present disclosure, when the current block is an 8xN block or an Nx8 block, LFNST having an output length of 128 may be applied to the current block. Here, N may be an integer greater than or equal to 16. When the current block is a 4x8 block, an 8x4 block, a 4x16 block, or a 16x4 block, the NSPT may be applied to the current block.

[0016] In the image decoding method and device according to the present disclosure, when the current block is a 4xN block or an Nx4 block, the output length of LFNST applied to the current block may be the same as the output length of LFNST applied to a 4x4 block.

[0017] In the image decoding method and device according to the present disclosure, when the current block is an 8xN block or an Nx8 block, the output length of LFNST applied to the current block may be the same as the output length of LFNST applied to an 8x8 block.

[0018] In the image decoding method and device according to the present disclosure, when the current block is a 16xN block or an Nx16 block, the output length of LFNST applied to the current block may be the same as the output length of LFNST applied to a 16x16 block.

[0019] In the image decoding method and device according to the present disclosure, when the current block is larger than or equal to a 32x32 block, the inverse transformation may be performed based on either LFNST for a square block or LFNST for a non-square block.

[0020] The video encoding method and device according to the present disclosure can derive residual samples of a current block, derive transform coefficients of the current block by performing at least one of transform and quantization on the residual samples of the current block, and encode the transform coefficients of the current block. Here, the transform can be performed based on at least one of a non-separable primary transform (NSPT) or a low frequency non-separable transform (LFNST).

[0021] In the video encoding method and device according to the present disclosure, the LFNST can be applied to transform coefficients belonging to an area having a predetermined width (W) and height (H) within the current block, and the width and height of the area can be determined based on at least one of the width or height of the current block.

[0022] In the video encoding method and device according to the present disclosure, the input length of the LFNST may be (W*H).

[0023] A computer-readable digital storage medium is provided having encoded video / image information stored thereon, which causes a decoding device according to the present disclosure to perform a video decoding method.

[0024] A computer-readable digital storage medium storing video / image information generated by a video encoding method according to the present disclosure is provided.

[0025] A method and device for transmitting video / image information generated by a video encoding method according to the present disclosure are provided.

[0026] The present disclosure can improve the performance of transformation by using a non-separable primary transformation as a primary transformation.

[0027] The present disclosure can improve the performance of transformation by performing the transformation using a non-separable first-order transformation kernel of reduced dimension.

[0028] The present disclosure can improve encoding efficiency by effectively determining and / or signaling a non-separable transform kernel based on encoding parameters.

[0029] FIG. 1 illustrates a video / image coding system according to the present disclosure.

[0030] FIG. 2 is a schematic block diagram of an encoding device to which an embodiment of the present disclosure can be applied and in which encoding of a video / image signal is performed.

[0031] FIG. 3 is a schematic block diagram of a decoding device to which an embodiment of the present disclosure can be applied and in which decoding of a video / image signal is performed.

[0032] FIG. 4 illustrates an image decoding method performed by a decoding device (300) as an embodiment according to the present disclosure.

[0033] FIG. 5 exemplarily shows an intra prediction mode and its prediction direction according to the present disclosure.

[0034] FIG. 6 illustrates a schematic configuration of a decoding device (300) that performs an image decoding method according to the present disclosure.

[0035] FIG. 7 illustrates an image encoding method performed by an encoding device (200) as an embodiment according to the present disclosure.

[0036] FIG. 8 illustrates a schematic configuration of an encoding device (200) that performs an image encoding method according to the present disclosure.

[0037] FIG. 9 illustrates an example of a content streaming system to which embodiments of the present disclosure can be applied.

[0038] The present disclosure may be subject to various modifications and embodiments. Therefore, specific embodiments are illustrated and described in detail in the drawings. However, this is not intended to limit the present disclosure to specific embodiments, but rather to encompass all modifications, equivalents, and alternatives falling within the spirit and technical scope of the present disclosure. Similar reference numerals have been used to designate similar components throughout the description of each drawing.

[0039] While terms such as "first" and "second" may be used to describe various components, these components should not be limited by these terms. These terms are used solely to distinguish one component from another. For example, without departing from the scope of the present disclosure, a first component could be referred to as a "second component," and similarly, a second component could also be referred to as a "first component." The term "and / or" includes a combination of multiple related items described herein or any of multiple related items described herein.

[0040] When a component is referred to as being "connected" or "connected" to another component, it should be understood that it may be directly connected or connected to that other component, but that there may be other components intervening. Conversely, when a component is referred to as being "directly connected" or "connected" to another component, it should be understood that there are no other components intervening.

[0041] The terminology used in this application is only used to describe specific embodiments and is not intended to limit the present disclosure. The singular expression includes the plural expression unless the context clearly indicates otherwise. In this application, it should be understood that the terms "comprise" or "have" indicate the presence of a feature, number, step, operation, component, part, or combination thereof described in the specification, but do not preclude the possibility of the presence or addition of one or more other features, numbers, steps, operations, components, parts, or combinations thereof.

[0042] The present disclosure relates to video / image coding. For example, the methods / embodiments disclosed in this specification can be applied to methods disclosed in the versatile video coding (VVC) standard. In addition, the methods / embodiments disclosed in this specification can be applied to methods disclosed in the essential video coding (EVC) standard, the AOMedia Video 1 (AV1) standard, the second generation of audio video coding standard (AVS2), or the next generation of video / image coding standards (e.g., H.267 or H.268).

[0043] This specification presents various embodiments of video / image coding, and unless otherwise stated, the embodiments may be performed in combination with each other.

[0044] In this specification, a video may refer to a set of images over time. A picture generally refers to a unit representing one image at a specific time point, and a slice / tile is a unit that constitutes part of a picture in coding. A slice / tile may include one or more coding tree units (CTUs). A picture may be composed of one or more slices / tiles. A tile is a rectangular area consisting of multiple CTUs within a specific tile column and a specific tile row of a picture. A tile column is a rectangular area of ​​CTUs that has a height equal to the height of the picture and a width specified by the syntax requirements of the picture parameter set. A tile row is a rectangular area of ​​CTUs that has a height specified by the picture parameter set and a width equal to the width of the picture. CTUs within a tile are arranged consecutively according to the CTU raster scan, while tiles within a picture may be arranged consecutively according to the tile raster scan. A slice may contain an integer number of complete tiles or an integer number of contiguous complete CTU rows within a picture, which may be exclusively contained within a single NAL unit. Meanwhile, a picture may be divided into two or more subpictures. A subpicture may be a rectangular region of one or more slices within a picture.

[0045] A pixel, or pel, can refer to the smallest unit that constitutes a picture (or image). Additionally, the term "sample" can be used as a counterpart to a pixel. A sample can generally represent a pixel or a pixel value, and can represent only the pixel / pixel value of the luminance component, or only the pixel / pixel value of the chrominance component.

[0046] A unit may represent a basic unit of image processing. A unit may include at least one of a specific region of a picture and information related to the region. One unit may include one luma block and two chroma (e.g., cb, cr) blocks. In some cases, the term "unit" may be used interchangeably with terms such as "block" or "area." In general, an MxN block may include a set (or array) of samples (or sample array) or transform coefficients consisting of M columns and N rows.

[0047] As used herein, "A or B" can mean "only A," "only B," or "both A and B." In other words, as used herein, "A or B" can be interpreted as "A and / or B." For example, as used herein, "A, B or C" can mean "only A," "only B," "only C," or "any combination of A, B and C."

[0048] As used herein, a slash ( / ) or a comma can mean "and / or." For example, "A / B" can mean "A and / or B." Accordingly, "A / B" can mean "only A," "only B," or "both A and B." For example, "A, B, C" can mean "A, B, or C."

[0049] In this specification, "at least one of A and B" may mean "only A", "only B" or "both A and B". Additionally, in this specification, the expressions "at least one of A or B" or "at least one of A and / or B" may be interpreted identically to "at least one of A and B".

[0050] Additionally, in this specification, “at least one of A, B and C” can mean “only A,” “only B,” “only C,” or “any combination of A, B and C.” Additionally, “at least one of A, B or C” or “at least one of A, B and / or C” can mean “at least one of A, B and C.”

[0051] Additionally, parentheses used herein may mean "for example." Specifically, when "prediction (intra-prediction)" is indicated, "intra-prediction" may be suggested as an example of "prediction." In other words, "prediction" in this specification is not limited to "intra-prediction," and "intra-prediction" may be suggested as an example of "prediction." Furthermore, even when "prediction (i.e., intra-prediction)" is indicated, "intra-prediction" may be suggested as an example of "prediction."

[0052] Technical features individually described in a single drawing in this specification may be implemented individually or simultaneously.

[0053] FIG. 1 illustrates a video / image coding system according to the present disclosure.

[0054] Referring to FIG. 1, a video / image coding system may include a first device (source device) and a second device (receiving device).

[0055] A source device can transmit encoded video / image information or data to a receiving device via a digital storage medium or a network in the form of a file or streaming. The source device may include a video source, an encoding device, and a transmitting device. The receiving device may include a receiving device, a decoding device, and a renderer. The encoding device may be referred to as a video / image encoding device, and the decoding device may be referred to as a video / image decoding device. The transmitter may be included in the encoding device. The receiver may be included in the decoding device. The renderer may include a display unit, and the display unit may be configured as a separate device or an external component.

[0056] A video source may obtain video / images through a process of capturing, synthesizing, or generating video / images. The video source may include a video / image capture device and / or a video / image generation device. The video / image capture device may include one or more cameras, a video / image archive containing previously captured video / images, etc. The video / image generation device may include a computer, a tablet, a smartphone, etc., and may (electronically) generate video / images. For example, a virtual video / image may be generated through a computer, etc., in which case the video / image capture process may be replaced by a process of generating related data.

[0057] An encoding device can encode input video / images. The encoding device can perform a series of procedures, such as prediction, transformation, and quantization, to improve compression and coding efficiency. The encoded data (encoded video / image information) can be output in the form of a bitstream.

[0058] The transmission unit can transmit encoded video / image information or data output in the form of a bitstream to the receiving unit of a receiving device via a digital storage medium or network in the form of a file or streaming. The digital storage medium can include various storage media such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, etc. The transmission unit can include an element for generating a media file via a predetermined file format and an element for transmission via a broadcasting / communication network. The receiving unit can receive / extract the bitstream and transmit it to a decoding device.

[0059] The decoding device can decode the video / image by performing a series of procedures such as inverse quantization, inverse transformation, and prediction corresponding to the operation of the encoding device.

[0060] The renderer can render decoded video / images. The rendered video / images can be displayed through the display unit.

[0061] FIG. 2 is a schematic block diagram of an encoding device to which an embodiment of the present disclosure can be applied and in which encoding of a video / image signal is performed.

[0062] Referring to FIG. 2, the encoding device (200) may be configured to include an image partitioner (210), a prediction unit (predictor) 220, a residual processor (residual processor) 230, an entropy encoder (entropy encoder) 240, an adder (adder) 250, a filter (filter) 260, and a memory (memory) 270. The prediction unit (220) may include an inter prediction unit (221) and an intra prediction unit (222). The residual processor (230) may include a transformer (transformer) 232, a quantizer (quantizer) 233, a dequantizer (dequantizer) 234, and an inverse transformer (inverse transformer) 235. The residual processing unit (230) may further include a subtractor (231). The addition unit (250) may be called a reconstructor or a recontructed block generator. The image segmentation unit (210), the prediction unit (220), the residual processing unit (230), the entropy encoding unit (240), the addition unit (250), and the filtering unit (260) described above may be configured by one or more hardware components (e.g., an encoding device chipset or processor) according to an embodiment. In addition, the memory (270) may include a decoded picture buffer (DPB) and may be configured by a digital storage medium. The hardware component may further include the memory (270) as an internal / external component.

[0063] The image segmentation unit (210) can segment an input image (or picture, frame) input to the encoding device (200) into one or more processing units. For example, the processing unit may be called a coding unit (CU). In this case, the coding unit may be recursively segmented from a coding tree unit (CTU) or a largest coding unit (LCU) according to a QTBTTT (Quad-tree binary-tree ternary-tree) structure.

[0064] For example, a single coding unit may be split into multiple coding units with deeper depths based on a quad-tree structure, a binary tree structure, and / or a ternary structure. In this case, for example, the quad-tree structure may be applied first, and the binary tree structure and / or the ternary structure may be applied later. Alternatively, the binary tree structure may be applied before the quad-tree structure. The coding procedure according to the present specification may be performed based on the final coding unit that is no longer split. In this case, based on coding efficiency according to image characteristics, etc., the largest coding unit may be used directly as the final coding unit, or, if necessary, the coding unit may be recursively split into coding units of lower depths, and the coding unit with the optimal size may be used as the final coding unit. Here, the coding procedure may include procedures such as prediction, transformation, and restoration, which will be described later.

[0065] As another example, the processing unit may further include a prediction unit (PU) or a transform unit (TU). In this case, the prediction unit and the transform unit may each be split or partitioned from the final coding unit described above. The prediction unit may be a unit of sample prediction, and the transform unit may be a unit for deriving a transform coefficient and / or a unit for deriving a residual signal from a transform coefficient.

[0066] The term "unit" may be used interchangeably with terms such as "block" or "area" depending on the case. In general, an MxN block can represent a set of samples or transform coefficients consisting of M columns and N rows. A sample can generally represent a pixel or a pixel value, and can represent only the pixel / pixel value of the luminance component, or only the pixel / pixel value of the chrominance component. A sample can be used as a term corresponding to a pixel or pel in a picture (or image).

[0067] The encoding device (200) can generate a residual signal (residual block, residual sample array) by subtracting a prediction signal (prediction block, prediction sample array) output from an inter prediction unit (221) or an intra prediction unit (222) from an input video signal (original block, original sample array), and the generated residual signal is transmitted to a conversion unit (232). In this case, a unit that subtracts a prediction signal (prediction block, prediction sample array) from an input video signal (original block, original sample array) within the encoding device (200) may be called a subtraction unit (231).

[0068] The prediction unit (220) can perform a prediction on a block to be processed (hereinafter, referred to as a current block) and generate a predicted block including prediction samples for the current block. The prediction unit (220) can determine whether intra prediction or inter prediction is applied on a current block or CU basis. The prediction unit (220) can generate various information related to prediction, such as prediction mode information, as described later in the description of each prediction mode, and transmit the information to the entropy encoding unit (240). The information related to prediction can be encoded by the entropy encoding unit (240) and output in the form of a bitstream.

[0069] The intra prediction unit (222) can predict the current block by referring to samples in the current picture. The referenced samples may be located in the neighborhood of the current block, or may be located a certain distance away from the current block, depending on the prediction mode. In intra prediction, the prediction modes may include one or more non-directional modes and multiple directional modes. The non-directional mode may include at least one of a DC mode or a planar mode. The directional mode may include 33 directional modes or 65 directional modes depending on the degree of detail in the prediction direction. However, this is only an example, and a greater or lesser number of directional modes may be used depending on the settings. The intra prediction unit (222) may also determine the prediction mode applied to the current block by using the prediction mode applied to the neighboring blocks.

[0070] The inter prediction unit (221) can derive a prediction block for the current block based on a reference block (reference sample array) specified by a motion vector on a reference picture. At this time, in order to reduce the amount of motion information transmitted in the inter prediction mode, the motion information can be predicted in units of blocks, subblocks, or samples based on the correlation of motion information between neighboring blocks and the current block. The motion information can include a motion vector and a reference picture index. The motion information can further include inter prediction direction information (L0 prediction, L1 prediction, Bi prediction, etc.). In the case of inter prediction, the neighboring block can include a spatial neighboring block existing in the current picture and a temporal neighboring block existing in the reference picture. The reference picture including the reference block and the reference picture including the temporal neighboring block may be the same or different. The above temporal neighboring blocks may be called collocated reference blocks, collocated CUs (colCUs), etc., and the reference pictures including the temporal neighboring blocks may be called collocated pictures (colPic). For example, the inter prediction unit (221) may construct a motion information candidate list based on the neighboring blocks, and generate information indicating which candidate is used to derive the motion vector and / or reference picture index of the current block. Inter prediction may be performed based on various prediction modes, and for example, in the case of skip mode and merge mode, the inter prediction unit (221) may use the motion information of the neighboring blocks as the motion information of the current block. In the case of skip mode, unlike the merge mode, a residual signal may not be transmitted.In the motion vector prediction (MVP) mode, the motion vector of the surrounding blocks is used as a motion vector predictor, and the motion vector of the current block can be indicated by signaling the motion vector difference.

[0071] The prediction unit (220) can generate a prediction signal based on various prediction methods described below. For example, the prediction unit can apply intra prediction or inter prediction for prediction of a single block, and can also apply intra prediction and inter prediction simultaneously. This can be called combined inter and intra prediction (CIIP) mode. In addition, the prediction unit can be based on an intra block copy (IBC) prediction mode or a palette mode for prediction of a block. The IBC prediction mode or palette mode can be used for content image / video coding such as games, such as screen content coding (SCC). IBC basically performs prediction within the current picture, but can be performed similarly to inter prediction in that it derives a reference block within the current picture. That is, IBC can utilize at least one of the inter prediction techniques described herein. Palette mode can be viewed as an example of intra coding or intra prediction. When the palette mode is applied, sample values ​​within a picture can be signaled based on information about the palette table and palette index. The prediction signal generated through the prediction unit (220) can be used to generate a restoration signal or a residual signal.

[0072] The transform unit (232) can apply a transform technique to the residual signal to generate transform coefficients. For example, the transform technique can include at least one of a Discrete Cosine Transform (DCT), a Discrete Sine Transform (DST), a Karhunen-Loeve Transform (KLT), a Graph-Based Transform (GBT), or a Conditionally Non-linear Transform (CNT). Here, GBT refers to a transform obtained from a graph when the relationship information between pixels is expressed as a graph. CNT refers to a transform obtained based on generating a prediction signal using all previously restored pixels. In addition, the transform process can be applied to a pixel block having a square size and the same size, or can be applied to a block of a non-square variable size.

[0073] The quantization unit (233) quantizes the transform coefficients and transmits them to the entropy encoding unit (240), and the entropy encoding unit (240) can encode the quantized signal (information about the quantized transform coefficients) and output it as a bitstream. The information about the quantized transform coefficients can be called residual information. The quantization unit (233) can rearrange the quantized transform coefficients in a block form into a one-dimensional vector form based on the coefficient scan order, and can also generate information about the quantized transform coefficients based on the quantized transform coefficients in the one-dimensional vector form.

[0074] The entropy encoding unit (240) can perform various encoding methods such as exponential Golomb, context-adaptive variable length coding (CAVLC), context-adaptive binary arithmetic coding (CABAC), etc. The entropy encoding unit (240) can also encode information necessary for video / image restoration (e.g., values ​​of syntax elements, etc.) together or separately from quantized transform coefficients.

[0075] Encoded information (e.g., encoded video / image information) can be transmitted or stored in the form of a bitstream in units of NAL (network abstraction layer) units. The video / image information may further include information on various parameter sets, such as an adaptation parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). In addition, the video / image information may further include general constraint information. In the present specification, information and / or syntax elements transmitted / signaled from an encoding device to a decoding device may be included in the video / image information. The video / image information may be encoded through the above-described encoding procedure and included in the bitstream. The bitstream may be transmitted via a network or stored in a digital storage medium. Here, the network may include a broadcasting network and / or a communication network, and the digital storage medium may include various storage media, such as a USB, SD, CD, DVD, Blu-ray, HDD, or SSD. The signal output from the entropy encoding unit (240) may be configured as an internal / external element of the encoding device (200) by a transmitting unit (not shown) and / or a storing unit (not shown), or the transmitting unit may be included in the entropy encoding unit (240).

[0076] The quantized transform coefficients output from the quantization unit (233) can be used to generate a prediction signal. For example, by applying inverse quantization and inverse transformation to the quantized transform coefficients through the inverse quantization unit (234) and the inverse transform unit (235), a residual signal (residual block or residual samples) can be reconstructed. The addition unit (250) can generate a reconstructed signal (reconstructed picture, reconstructed block, reconstructed sample array) by adding the reconstructed residual signal to the prediction signal output from the inter prediction unit (221) or the intra prediction unit (222). When there is no residual for the block to be processed, such as when skip mode is applied, the predicted block can be used as a reconstructed block. The addition unit (250) may be called a reconstructor or a reconstructed block generation unit. The generated restoration signal can be used for intra prediction of the next processing target block within the current picture, and can also be used for inter prediction of the next picture after filtering as described below. Meanwhile, LMCS (luma mapping with chroma scaling) may be applied during the picture encoding and / or restoration process.

[0077] The filtering unit (260) can improve subjective / objective picture quality by applying filtering to the restoration signal. For example, the filtering unit (260) can apply various filtering methods to the restoration picture to generate a modified restoration picture, and store the modified restoration picture in the memory (270), specifically, in the DPB of the memory (270). The various filtering methods can include deblocking filtering, sample adaptive offset, adaptive loop filter, bilateral filter, etc. The filtering unit (260) can generate various information regarding filtering and transmit it to the entropy encoding unit (240). The information regarding filtering can be encoded by the entropy encoding unit (240) and output in the form of a bitstream.

[0078] The modified restored picture transmitted to the memory (270) can be used as a reference picture in the inter prediction unit (221). Through this, when inter prediction is applied, the encoding device can avoid prediction mismatch between the encoding device (200) and the decoding device, and can also improve encoding efficiency.

[0079] The DPB of the memory (270) can store the modified restored picture to be used as a reference picture in the inter prediction unit (221). The memory (270) can store motion information of a block from which motion information is derived (or encoded) within the current picture and / or motion information of blocks within a picture that has already been restored. The stored motion information can be transferred to the inter prediction unit (221) to be used as motion information of a spatial neighboring block or motion information of a temporal neighboring block. The memory (270) can store restored samples of restored blocks within the current picture and transfer them to the intra prediction unit (222).

[0080] FIG. 3 is a schematic block diagram of a decoding device to which an embodiment of the present disclosure can be applied and in which decoding of a video / image signal is performed.

[0081] Referring to FIG. 3, the decoding device (300) may be configured to include an entropy decoder (310), a residual processor (320), a predictor (330), an adder (340), a filter (350), and a memory (360). The predictor (330) may include an inter-prediction unit (331) and an intra-prediction unit (332). The residual processor (320) may include a dequantizer (321) and an inverse transformer (321).

[0082] The entropy decoding unit (310), residual processing unit (320), prediction unit (330), addition unit (340), and filtering unit (350) described above may be configured by a single hardware component (e.g., a decoding device chipset or processor) depending on the embodiment. In addition, the memory (360) may include a decoded picture buffer (DPB) and may be configured by a digital storage medium. The hardware component may further include the memory (360) as an internal / external component.

[0083] When a bitstream including video / image information is input, the decoding device (300) can restore the image corresponding to the process in which the video / image information is processed in the encoding device of FIG. 2. For example, the decoding device (300) can derive units / blocks based on block division-related information obtained from the bitstream. The decoding device (300) can perform decoding using a processing unit applied in the encoding device. Accordingly, the processing unit of decoding may be a coding unit, and the coding unit may be divided from a coding tree unit or a maximum coding unit according to a quad tree structure, a binary tree structure, and / or a ternary tree structure. One or more transform units may be derived from the coding unit. Then, the restored image signal decoded and output through the decoding device (300) can be reproduced through a reproduction device.

[0084] The decoding device (300) can receive a signal output from the encoding device of FIG. 2 in the form of a bitstream, and the received signal can be decoded through the entropy decoding unit (310). For example, the entropy decoding unit (310) can parse the bitstream to derive information (e.g., video / image information) necessary for image restoration (or picture restoration). The video / image information may further include information on various parameter sets, such as an adaptation parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). In addition, the video / image information may further include general constraint information. The decoding device can decode the picture further based on the information on the parameter set and / or the general constraint information. The signaling / received information and / or syntax elements described later in this specification can be decoded through the decoding procedure and obtained from the bitstream. For example, the entropy decoding unit (310) can decode information in a bitstream based on a coding method such as exponential Golomb coding, CAVLC, or CABAC, and output the values ​​of syntax elements required for image restoration and the quantized values ​​of transform coefficients for residuals. More specifically, the CABAC entropy decoding method receives a bin corresponding to each syntax element in the bitstream, determines a context model using information of the syntax element to be decoded and decoding information of the surrounding and decoding target blocks or information of symbols / bins decoded in the previous step, and predicts the occurrence probability of the bin according to the determined context model to perform arithmetic decoding of the bin to generate a symbol corresponding to the value of each syntax element.At this time, the CABAC entropy decoding method can update the context model using the information of the decoded symbol / bin for the context model of the next symbol / bin after determining the context model. Information regarding prediction among the information decoded by the entropy decoding unit (310) is provided to the prediction unit (inter prediction unit (332) and intra prediction unit (331)), and residual values ​​on which entropy decoding is performed by the entropy decoding unit (310), i.e., quantized transform coefficients and related parameter information, can be input to the residual processing unit (320). The residual processing unit (320) can derive a residual signal (residual block, residual samples, residual sample array). In addition, information regarding filtering among the information decoded by the entropy decoding unit (310) can be provided to the filtering unit (350). Meanwhile, a receiving unit (not shown) that receives a signal output from an encoding device may be further configured as an internal / external element of a decoding device (300), or the receiving unit may be a component of an entropy decoding unit (310).

[0085] Meanwhile, a decoding device according to the present specification may be called a video / video / picture decoding device, and the decoding device may be divided into an information decoding device (video / video / picture information decoding device) and a sample decoding device (video / video / picture sample decoding device). The information decoding device may include the entropy decoding unit (310), and the sample decoding device may include at least one of the inverse quantization unit (321), the inverse transformation unit (322), the addition unit (340), the filtering unit (350), the memory (360), the inter prediction unit (332), and the intra prediction unit (331).

[0086] The inverse quantization unit (321) can inverse quantize the quantized transform coefficients and output the transform coefficients. The inverse quantization unit (321) can rearrange the quantized transform coefficients into a two-dimensional block form. In this case, the rearrangement can be performed based on the coefficient scanning order performed in the encoding device. The inverse quantization unit (321) can perform inverse quantization on the quantized transform coefficients using quantization parameters (e.g., quantization step size information) and obtain transform coefficients.

[0087] In the inverse transform unit (322), the transform coefficients are inversely transformed to obtain a residual signal (residual block, residual sample array).

[0088] The prediction unit (320) can perform a prediction on the current block and generate a predicted block including prediction samples for the current block. The prediction unit (320) can determine whether intra-prediction or inter-prediction is applied to the current block based on the information regarding the prediction output from the entropy decoding unit (310), and can determine a specific intra / inter-prediction mode.

[0089] The prediction unit (320) can generate a prediction signal based on various prediction methods described below. For example, the prediction unit (320) can apply intra prediction or inter prediction for prediction of a single block, and can also apply intra prediction and inter prediction simultaneously. This can be called combined inter and intra prediction (CIIP) mode. In addition, the prediction unit can be based on an intra block copy (IBC) prediction mode or a palette mode for prediction of a block. The IBC prediction mode or palette mode can be used for content image / video coding such as games, such as screen content coding (SCC). IBC basically performs prediction within the current picture, but can be performed similarly to inter prediction in that it derives a reference block within the current picture. That is, IBC can utilize at least one of the inter prediction techniques described herein. Palette mode can be viewed as an example of intra coding or intra prediction. When palette mode is applied, information about the palette table and palette index may be included and signaled in the video / image information.

[0090] The intra prediction unit (331) can predict the current block by referring to samples within the current picture. The referenced samples may be located in the neighborhood of the current block, or may be located a certain distance away from the current block, depending on the prediction mode. In intra prediction, the prediction modes may include one or more non-directional modes and multiple directional modes. The intra prediction unit (331) may also determine the prediction mode applied to the current block by using the prediction mode applied to the neighboring blocks.

[0091] The inter prediction unit (332) can derive a prediction block for the current block based on a reference block (reference sample array) specified by a motion vector on a reference picture. At this time, in order to reduce the amount of motion information transmitted in the inter prediction mode, the motion information can be predicted in units of blocks, subblocks, or samples based on the correlation of the motion information between the neighboring blocks and the current block. The motion information can include a motion vector and a reference picture index. The motion information can further include inter prediction direction information (L0 prediction, L1 prediction, Bi prediction, etc.). In the case of inter prediction, the neighboring blocks can include spatial neighboring blocks existing in the current picture and temporal neighboring blocks existing in the reference picture. For example, the inter prediction unit (332) can construct a motion information candidate list based on the neighboring blocks, and derive the motion vector and / or reference picture index of the current block based on the received candidate selection information. Inter prediction can be performed based on various prediction modes, and information about the prediction can include information indicating an inter prediction mode for the current block.

[0092] The addition unit (340) can generate a restoration signal (restored picture, restoration block, restoration sample array) by adding the acquired residual signal to the prediction signal (prediction block, prediction sample array) output from the prediction unit (including the inter-prediction unit (332) and / or intra-prediction unit (331)). When there is no residual for the block to be processed, such as when skip mode is applied, the prediction block can be used as the restoration block.

[0093] The addition unit (340) may be referred to as a restoration unit or restoration block generation unit. The generated restoration signal may be used for intra prediction of the next processing target block within the current picture, may be output after filtering as described below, or may be used for inter prediction of the next picture. Meanwhile, LMCS (luma mapping with chroma scaling) may be applied during the picture decoding process.

[0094] The filtering unit (350) can improve subjective / objective image quality by applying filtering to the restored signal. For example, the filtering unit (350) can apply various filtering methods to the restored picture to generate a modified restored picture, and transmit the modified restored picture to the memory (360), specifically, to the DPB of the memory (360). The various filtering methods can include deblocking filtering, sample adaptive offset, adaptive loop filter, bilateral filter, etc.

[0095] The (modified) reconstructed picture stored in the DPB of the memory (360) can be used as a reference picture in the inter prediction unit (332). The memory (360) can store motion information of a block from which motion information is derived (or decoded) in the current picture and / or motion information of blocks in a picture that has already been reconstructed. The stored motion information can be transferred to the inter prediction unit (260) to be used as motion information of a spatial neighboring block or motion information of a temporal neighboring block. The memory (360) can store reconstructed samples of reconstructed blocks in the current picture and transfer them to the intra prediction unit (331).

[0096] In this specification, the embodiments described in the filtering unit (260), the inter prediction unit (221), and the intra prediction unit (222) of the encoding device (200) can be applied to the filtering unit (350), the inter prediction unit (332), and the intra prediction unit (331) of the decoding device (300) in the same or corresponding manner, respectively.

[0097] FIG. 4 illustrates an image decoding method performed by a decoding device as an embodiment according to the present disclosure.

[0098] Referring to FIG. 4, the transform coefficients of the current block can be derived from the bitstream (S400). That is, the bitstream can include residual information of the current block, and the transform coefficients of the current block can be derived by decoding the residual information.

[0099] Referring to FIG. 4, residual samples of the current block can be derived by performing at least one of dequantization or inverse-transform on the transform coefficients of the current block (S410).

[0100] When adaptive multiple transform selection (MTS) is applied, the inverse transform may be performed based on at least one of DCT-2, DST-7, or DCT-8. Here, DCT-2, DST-7, DCT-8, etc. may be referred to as a transform type, a transform kernel, or a transform core.

[0101] In the present disclosure, the inverse transform may mean a separable transform. However, the present disclosure is not limited thereto, and the inverse transform may also mean a non-separable transform, or may be a concept that includes both a separable transform and a non-separable transform. In addition, the inverse transform in the present disclosure means a primary transform, but is not limited thereto, and may be transformed into an identical / similar form and applied to a secondary transform.

[0102] For example, as a method for inverse transformation, only DCT-2 and a non-separable transform may be used, or a non-separable transform may be used in addition to at least one of DCT-2, DST-7, or DCT-8, or a non-separable transform may replace the transform kernel of one or more of DCT-2, DST-7, or DCT-8.

[0103] As a more specific example, if there are (DCT-2, DCT-2), (DST-7, DST-7), (DCT-8, DST-7), (DST-7, DCT-8), (DCT-8, DCT-8) as transform kernel candidates for separable transform, a non-separable transform can replace or be added to one or more of the five transform kernel candidates. Here, the notation (transform1, transform2) indicates that transform1 is applied in the horizontal direction and transform2 is applied in the vertical direction. If a non-separable transform replaces some of the transform kernel candidates, the remaining transform kernel candidates except (DCT-2, DCT-2) and (DST-7, DST-7) can be replaced with the non-separable transform. However, the above transform kernel candidates are only examples, and other types of DCT and / or DST may be included, and a transform skip may be included as a transform kernel candidate.

[0104] A non-separable transformation can refer to a transformation or inverse transformation based on a non-separable transformation matrix. That is, unlike a separable transformation that performs vertical and horizontal transformations independently by separating the vertical and horizontal transformations, a non-separable transformation can perform horizontal and vertical transformations simultaneously.

[0105] For example, when a non-separable transformation is performed on a 4x4 block, the input data X to the non-separable transformation is as follows:

[0106]

[0107] When the above input data X is expressed in vector form, vector X' can be expressed as follows.

[0108]

[0109] In this case, the non-separable transformation can be performed as in the following mathematical expression 3.

[0110]

[0111] In mathematical expression 3, F represents a transformation coefficient vector, T represents a 16x16 non-separable transformation matrix, and ㆍ represents the multiplication of a matrix and a vector.

[0112] A 16x1 transform coefficient vector F can be derived through the above mathematical expression 3, and the F can be reconstructed into 4x4 blocks according to a predetermined scan order. The scan order can be a horizontal scan, a vertical scan, a diagonal scan, a z-scan, a raster scan, or a predefined scan.

[0113] The non-separable transform set and / or transform kernel for the above non-separable transform can be variously configured based on at least one of a prediction mode (e.g., intra mode, inter mode, etc.), the width, height, or number of pixels of the current block, the position of a sub-block within the current block, explicitly signaled syntax elements, statistical characteristics of surrounding samples, whether a secondary transform is used, or a quantization parameter (QP).

[0114] Specifically, for the intra mode, pre-defined intra prediction modes are grouped to correspond to n sets of non-separable transformations, and each set of non-separable transformations may include k transform kernel candidates. Here, n and k may be arbitrary constants according to rules (conditions) defined identically for the encoding device and the decoding device.

[0115] The number of non-separable transformation sets and / or the number of transformation kernel candidates included in the non-separable transformation sets may be configured differently depending on the width and / or height of the current block. For example, for a 4x4 block, n1 non-separable transformation sets and k1 transformation kernel candidates may be configured. For a 4x8 block, n2 non-separable transformation sets and k2 transformation kernel candidates may be configured. In addition, the number of non-separable transformation sets and the number of transformation kernel candidates included in each non-separable transformation set may be configured differently depending on the product of the width and height of the current block. For example, when the product of the width and height of the current block is equal to or greater than 256, n3 non-separable transformation sets and k3 transformation kernel candidates may be configured, and otherwise, n4 non-separable transformation sets and k4 transformation kernel candidates may be configured. That is, since the degree of change in the statistical characteristics of the residual signal varies depending on the block size, the number of non-separable transformation sets and transformation kernel candidates can be configured differently to reflect this.

[0116] If the current block is divided into multiple sub-blocks, the statistical characteristics of the residual signal may be different for each sub-block, and therefore the number of non-separable transform sets and transform kernel candidates may be configured differently. For example, if a 4x8 or 8x4 block is divided into two 4x4 sub-blocks and a non-separable transform is applied to each sub-block, n5 non-separable transform sets and k5 transform kernel candidates may be configured for the upper left 4x4 sub-block, and n6 non-separable transform sets and k6 transform kernel candidates may be configured for the other 4x4 sub-blocks.

[0117] Based on the explicitly signaled syntax element, the number of non-separable transformation sets and transformation kernel candidates can be configured differently. As the syntax element, information indicating any one of a plurality of non-separable transformation configurations can be used. For example, if three types of non-separable transformation configurations are supported (i.e., n7 non-separable transformation sets and k7 transformation kernel candidates, n8 non-separable transformation sets and k8 transformation kernel candidates, n9 non-separable transformation sets and k9 transformation kernel candidates), the corresponding syntax element can have values ​​of 0, 1, and 2, and the non-separable transformation configuration applied to the current block can be determined according to the value of the signaled syntax element.

[0118] Depending on whether and / or which secondary transformation is applied, the number of non-separable transformation sets and transformation kernel candidates can be configured differently. For example, if no secondary transformation is applied, n 10 A set of non-separable transformations and k 10 A non-separable transformation configuration including n transformation kernel candidates can be applied. When a second transformation is applied, n 11 A set of non-separable transformations and k 11 A non-separable transformation configuration including a transformation kernel candidate can be applied.

[0119] Depending on the quantization parameter (QP) and / or the range of QP values, different non-separable transform configurations can be applied. For example, if the QP value has a small value, n 12 A set of non-separable transformations and k 12 A non-separable transformation configuration including n transformation kernel candidates can be applied. On the other hand, if the QP value has a large value, n 13 A set of non-separable transformations and k 13 A non-separable transform configuration including a candidate transform kernel can be applied. If the QP value is less than or equal to a threshold (e.g., 32), the case is classified as having a small QP value, and otherwise, the case is classified as having a large QP value. Alternatively, the QP value range can be divided into three or more ranges, and a different non-separable transform configuration can be applied to each range.

[0120] For relatively large blocks, instead of using a non-separable transform corresponding to the width and height of the block, the block can be divided into multiple sub-blocks and a non-separable transform corresponding to the width and height of the sub-blocks can be used. For example, when performing a non-separable transform on a 4x8 block, the 4x8 block can be divided into two 4x4 sub-blocks and a 4x4 block-based non-separable transform can be used for each 4x4 sub-block. Alternatively, for an 8x16 block, the block can be divided into two 8x8 sub-blocks and an 8x8 block-based non-separable transform can be used.

[0121] The above non-separable transform set can be determined based on the intra prediction mode of the current block and a mapping table. The mapping table can define a mapping relationship between pre-defined intra prediction modes and non-separable transform sets. The pre-defined intra prediction modes can include two non-directional modes and 65 directional modes. In general, the size of the transform kernel of a non-separable transform is larger than that of a separable transform. This means that the computational complexity required for the transform process is high and the memory required for storing the transform kernel is large. Meanwhile, a separable transform can only consider statistical characteristics existing in the horizontal and / or vertical directions, but a non-separable transform can simultaneously consider statistical characteristics in a two-dimensional space including the horizontal and vertical directions, thereby providing better compression efficiency. Since the statistical characteristics and diversity of the residual vary depending on the directionality of the intra prediction mode, there may be cases where a non-separable transform is absolutely necessary, and there may exist intra prediction modes where the characteristics of the residual can be sufficiently identified using only a separable transform. Therefore, by predefining which transformation to use according to the intra prediction mode in the encoding device and the decoding device, the transformation process can be designed with optimized complexity and memory requirements. The non-directional mode may include the planar mode (number 0) and the DC mode (number 1), and the directional mode may include the intra prediction modes (numbers 2 to 66). However, this is merely an example, and the present disclosure may also be applied to cases where the number of pre-defined intra prediction modes is different.

[0122] Due to the application of wide angle intra prediction (WAIP), the pre-defined intra prediction modes may further include intra prediction modes from -14 to -1 and intra prediction modes from 67 to 80.

[0123] FIG. 5 exemplarily illustrates intra prediction modes and their prediction directions according to the present disclosure. Referring to FIG. 5 , modes -14 to -1 and 2 to 33, and modes 35 to 80 are symmetrical with respect to the prediction direction with respect to mode 34. For example, modes 10 and 58 are symmetrical with respect to the direction corresponding to mode 34, and mode -1 is symmetrical with mode 67. Therefore, for vertical modes that are symmetrical with respect to horizontal modes with respect to mode 34, input data can be transposed and used. Transposing input data means that rows in the input data MxN of a 2D block become columns and columns become rows to form NxM data.

[0124] For example, when a 4x4 block is used, the 16 data that make up the 4x4 block can be appropriately arranged to form a 16x1 one-dimensional vector for non-separable transformation. At this time, the one-dimensional vector can be formed in row-major order or column-major order. The residual samples resulting from the non-separable transformation can be arranged in the above order to form a two-dimensional block.

[0125] For modes -14 to -1 and 2 to 33, if the data arrangement order for constructing a 16x1 input vector is row-major order, for modes 35 to 80, the input vector can be constructed according to column-major order.

[0126] Although mode 34 can be considered neither a horizontal mode nor a vertical mode, it is classified as belonging to the horizontal mode in the present disclosure. That is, for modes -14 to -1 and 2 to 33, the input data alignment method for the horizontal mode, i.e., row-major order, can be used, and the input data can be transposed and used for the vertical mode that is symmetrical around mode 34.

[0127] For non-square blocks, the symmetry in square blocks (i.e., the symmetry between the P mode and the (68-P) mode in an NxN block (2<=P<=33) or the symmetry between the Q mode and the (66-Q) mode (-14<=Q<=-1)) cannot be utilized. Therefore, in addition to the symmetry based only on the intra prediction mode, the symmetry between block shapes that are in a transpose relationship with each other, i.e., the symmetry between the KxL block and the LxK block, can also be utilized. Specifically, a symmetry relationship exists between a KxL block predicted by the P mode and an LxK block predicted by the (68-P) mode. Alternatively, a symmetry relationship exists between a KxL block predicted by the Q mode and an LxK block predicted by the (66-Q) mode.

[0128] Since a KxL block with mode 2 and an LxK block with mode 66 can be viewed as symmetrical to each other, the same transform kernel can be applied to the KxL block and the LxK block. If a non-separable transform set for the intra prediction mode of the KxL block is mapped, in order to apply a non-separable transform to the LxK block, the non-separable transform set can be derived through a mapping table corresponding to the KxL block based on the (68-P) mode instead of the P mode applied to the LxK block. Alternatively, the non-separable transform set can be derived through a mapping table corresponding to the KxL block based on the (66-Q) mode instead of the Q mode applied to the LxK block.

[0129] For example, to apply a non-separable transformation to an LxK block, the non-separable transformation set can be selected based on mode 2 instead of mode 66. Also, for a KxL block, the input data can be read in a pre-determined order (e.g., row-major order or column-major order) to form a one-dimensional vector and then the corresponding non-separable transformation can be applied. For an LxK block, the input data can be read in the transposed order to form a one-dimensional vector and then the corresponding non-separable transformation can be applied. That is, if the KxL block is read in row-major order, the LxK block can be read in column-major order. Conversely, if the KxL block is read in column-major order, the LxK block can be read in row-major order.

[0130] In addition, when mode 34 is applied to a KxL block, a non-separable transformation set can be determined based on mode 34, and the input data can be read in a predetermined order to form a one-dimensional vector to perform the corresponding non-separable transformation. When mode 34 is applied to an LxK block, a non-separable transformation set can be determined based on mode 34 as well, but the input data can be read in a transposed order to form a one-dimensional vector to perform the corresponding non-separable transformation.

[0131] Although the present disclosure describes a method for determining a non-separable transformation set and a method for organizing input data based on a KxL block, the non-separable transformation can be performed based on an LxK block by utilizing the symmetry described above for a KxL block in the same manner. Alternatively, a block whose width is greater than its height can be restricted to be used as a reference block. Alternatively, symmetry can be restricted not to be utilized for non-square blocks. In this case, non-square blocks can use a different number of non-separable transformation sets and / or transformation kernel candidates than square blocks, and can select a non-separable transformation set using a different mapping table than square blocks.

[0132] An example of a mapping table for selecting a non-separable transformation set is as follows.

[0133] predModeIntraTrSetIdxpredModeIntra < 040 <= predModeIntra <= 102 <= predModeIntra <= 12113 <= predModeIntra <= 23224 <= predModeIntra <= 44345 <= predModeIntra <= 55256 <= predModeIntra <= 66167 <= predModeIntra <= 804

[0134] Table 1 shows an example of assigning non-separable transform sets according to intra prediction modes when there are five non-separable transform sets. The value of predModeIntra indicates the value of the intra prediction mode considering WAIP, and TrSetIdx is an index indicating a specific non-separable transform set. In Table 1, it can be confirmed that the same non-separable transform set is applied to modes located in symmetrical directions according to the intra prediction mode. Table 1 is only an example using five non-separable transform sets and does not limit the total number of non-separable transform sets for non-separable transforms.

[0135] Alternatively, as shown in Table 2, non-separable transform may not be applied to WAIP for compression performance.

[0136] predModeIntraTrSetIdx0 <= predModeIntra <= 102 <= predModeIntra <= 12113 <= predModeIntra <= 23224 <= predModeIntra <= 44345 <= predModeIntra <= 55256 <= predModeIntra <= 661

[0137] Alternatively, as shown in Table 3, instead of constructing a separate non-separable transform set for WAIP, a non-separable transform set corresponding to an adjacent intra prediction mode may be shared.

[0138] predModeIntraTrSetIdxpredModeIntra < 010 <= predModeIntra <= 102 <= predModeIntra <= 12113 <= predModeIntra <= 23224 <= predModeIntra <= 44345 <= predModeIntra <= 55256 <= predModeIntra <= 801

[0139] The above non-separable transform set may include multiple transform kernel candidates, and any one of the multiple transform kernel candidates may be selectively used. For this purpose, an index signaled through a bitstream may be used. Alternatively, any one of the multiple transform kernel candidates may be implicitly determined based on context information of the current block. Here, the context information may mean the size of the current block or whether a non-separable transform is applied to a neighboring block. Here, the size of the current block may be defined by the width, the height, the maximum / minimum values ​​of the width and the height, the sum of the width and the height, or the product of the width and the height.

[0140] Below, we will take a closer look at how to determine the transformation kernel for the inverse transformation of the current block.

[0141] Example 1

[0142] As mentioned above, inverse transformation can be divided into separable transformation and non-separable transformation. Separable transformation means performing transformations in the horizontal and vertical directions respectively for a two-dimensional block, and non-separable transformation can mean performing a single transformation on samples constituting the entire or a portion of a two-dimensional block. When notating a separable transformation, it can be notated as a pair of horizontal transformation and vertical transformation, and in this disclosure, it will be expressed as (horizontal transformation, vertical transformation).

[0143] Multiple transformation sets can be defined for the inverse transformation of the current block. Each transformation set can contain one or more transformation kernel candidates.

[0144] For example, any one of (DST-7, DST-7), (DCT-8, DST-7), (DST-7, DCT-8), or (DCT-8, DCT-8) can be applied as a separate transform, and the four transform kernel candidates can be regarded as one transform set. In addition, (DCT-2, DCT-2) can be regarded as one transform set. A transform skip that does not apply a transform can also be regarded as one transform set, and (DCT-2, DCT-2) and the transform skip can be regarded as one transform set. In the present disclosure, a transform kernel may refer to one transform (e.g., DCT-2, DST-7) or may refer to two transform pairs (e.g., (DCT-2, DCT-2)).

[0145] As another example of a transform set, there may be the aforementioned non-separable transform set. In the present disclosure, the non-separable transform applied as the primary transform may be denoted as a Non-Separable Primary Transform (NSPT). In NSPT, multiple non-separable transform sets may be configured, and each non-separable transform set may include one or more transform kernels as transform kernel candidates. In the case of NSPT, one of the multiple non-separable transform sets is selected according to the intra prediction mode, and the multiple non-separable transform sets for NSPT may be denoted as an NSPT set list. This is as discussed above, and a detailed description thereof will be omitted here.

[0146] A group of one or more transformation sets available to a current block can be formed from a plurality of pre-defined transformation sets. The group of one or more transformation sets can be formed by a predetermined area unit to which the current block belongs, and is hereinafter referred to as a collection. Here, the predetermined area unit can be at least one of a picture, a slice, a coding tree unit row (CTU row), or a coding tree unit (CTU).

[0147] For example, let the transform set consisting of (DCT-2, DCT-2) be called S1, and the transform set consisting of (DST-7, DST-7), (DCT-8, DST-7), (DST-7, DCT-8) and (DCT-8, DCT-8) be called S2, respectively. In addition, the above-mentioned NSPT set list can include N non-separable transform sets, and the N non-separable transform sets are called S 3,1 , S 3,2 , ..., S 3,N Let us call them respectively. Here, N can be 35, but is not limited thereto.

[0148] S by intra prediction mode of current block 3,13When selected as a non-separable transformation set for this NSPT, the transformation kernels applicable to the current block are S1, S2, or S 3,13 It may belong to any of the following collections. In this case, the current block is available in {S1, S2, S 3,13} can be expressed as .

[0149] As described above, since a collection according to the present disclosure is a group of one or more transformation sets available to the current block, the collection can be configured differently depending on the context of the current block. Here, the context can include at least one of a shape, a size, or an intra prediction mode. If a total of K contexts are defined, K collections can be created, each collection having C i can be represented as (i=1, 2, ..., N). For example, if the block sizes to which NSPT can be applied are 4x4, 8x8, 16x16, and 32x32, and one of a total of 35 non-separable transformation sets is selected by the intra prediction mode, if the transformation kernel applied to each block size is different, a total of 4 x 35 = 140 contexts can be defined.

[0150] A collection may be constructed based on the context of the current block, and at this time, a process of selecting one of a plurality of transformation sets belonging to the collection and selecting one of a plurality of transformation kernel candidates belonging to the selected transformation set may be performed. Here, the selection of the transformation set and the transformation kernel candidate may be performed implicitly based on the context of the current block or based on an explicitly signaled index. Alternatively, the process of selecting one of a plurality of transformation sets belonging to the collection and the process of selecting one of a plurality of transformation kernel candidates belonging to the selected transformation set may be performed separately. For example, an index for selecting a transformation set may be first signaled, and based on this, one of the plurality of transformation sets belonging to the collection may be selected. Then, an index indicating one of a plurality of transformation kernel candidates belonging to the transformation set may be signaled, and based on the signaled index, one of the transformation kernel candidates may be selected from the transformation set. The transformation kernel of the current block may be determined based on the selected transformation kernel candidate. Alternatively, the selection of any one of the transformation sets from the collection may be performed implicitly based on the context of the current block, and the selection of any one of the transformation kernel candidates from the selected transformation set may be performed based on a signaled index. Alternatively, the selection of any one of the transformation sets from the collection may be performed based on a signaled index, and the selection of any one of the transformation kernel candidates from the selected transformation set may be performed implicitly based on the context of the current block. Alternatively, the selection of any one of the transformation sets from the collection may be performed implicitly based on the context of the current block, and the selection of any one of the transformation kernel candidates from the selected transformation set may also be performed implicitly based on the context of the current block. Of course, if the number of transformation sets belonging to the collection is 1, the index for selecting the transformation set may not be signaled.Similarly, if the number of transformation kernel candidates in the selected transformation set is only one, the index indicating the transformation kernel candidate may not be signaled. Alternatively, an index indicating any one of all transformation kernel candidates in the current collection may be signaled. In this case, the process of selecting a transformation set from the collection may be omitted. At this time, all transformation sets in the collection may be reordered considering priorities. For example, in cases where small-length binary codes are assigned to small-value indices, such as truncated unary codes, it may be advantageous to assign small-value indices to transformation kernel candidates that are more advantageous for improving coding performance. When reordering all transformation kernel candidates in a collection according to priorities (shuffling), different shuffling may be applied to each collection. Furthermore, rather than reordering all transformation kernel candidates in a collection, only some of them may be selectively reordered.

[0151] Example 2

[0152] The transformation kernel for the inverse transformation of the current block can be determined based on MTS (Multiple Transform Selection).

[0153] The MTS according to the present disclosure may use at least one of DST-7, DCT-8, DCT-5, DST-4, DST-1, or IDT (identity transform) as a transform kernel. In addition, the MTS according to the present disclosure may further include a DCT-2 transform kernel.

[0154] In the present disclosure, multiple MTS sets for MTS can be defined. Based on the size of the current block and / or the intra prediction mode, any one of the multiple MTS sets can be determined. For example, in determining any one MTS set, 16 transform block sizes can be considered, and for directional modes, the shape of the transform block and the symmetry between the intra prediction modes can be considered. For the WAIP (Wide Angle Intra Prediction) mode (i.e., -1 to -14 (or -15), 67 to 80 (or 81)), the MTS set corresponding to mode 2 can be applied to modes -1 to -14 (or -15), and the MTS set corresponding to mode 66 can be applied to modes 67 to 80 (or 81). A separate MTS set can be allocated for the MIP (Matrix-based Intra Prediction) mode.

[0155] For example, the MTS set according to the transform block size and intra prediction mode can be allocated / defined as shown in Table 4 below.

[0156] Block size Intra prediction mode Width Height [0, 1] [2, 12] [13, 23] [24, 34] MIP4 40 1 2 3 4 4 8 5 6 7 8 9 4 16 10 1 1 2 1 3 1 4 4 3 2 1 5 1 6 1 7 1 8 1 9 8 4 2 0 2 1 2 2 2 3 2 4 8 8 2 5 2 6 2 7 2 8 2 9 8 16 3 0 3 1 3 2 3 3 3 4 8 3 2 3 5 3 6 3 7 3 8 3 9 16 4 4 0 4 1 4 2 4 3 4 1 6 8 4 5 4 6 4 7 4 8 4 9 16 1 6 5 0 5 1 5 2 5 3 5 4 1 6 3 2 5 5 5 6 5 7 5 8 5 9 3 2 4 6 0 6 16 2 6 3 6 4 3 2 8 6 5 6 6 6 7 6 8 6 9 3 2 1 6 7 0 7 1 7 2 7 3 7 4 3 2 3 2 7 5 7 6 7 7 7 8 7 9

[0157] Table 4 shows the allocation of MTS sets according to 16 transform block sizes and intra prediction modes. The number of predefined MTS sets is 80, and the index indicating any one of the 80 MTS sets can range from 0 to 79, as shown in Table 4.

[0158] MTS set index transformation kernel candidate index

[0159] Table 5 shows the transformation kernel candidates included in each MTS set discussed in Table 4. Each MTS set can be composed of six transformation kernel candidates. The transformation kernel candidate index has a value of any one of 0 to 5 and can indicate any one of the six transformation kernel candidates. Here, each transformation kernel candidate can be a combination of a horizontal transformation kernel and a vertical transformation kernel for a separate transformation, and 25 transformation kernel candidates with indices of 0 to 24 can be defined.

[0160] Kernel Combination Index When the value of intra prediction mode is less than 35 When the value of intra prediction mode is 35 or more 0 (DCT-8, DCT-8) (DCT-8, DCT-8) 1 (DST-7, DCT-8) (DCT-8, DST-7) 2 (DCT-5, DCT-8) (DCT-8, DCT-5) 3 (DST-4, DCT-8) (DCT-8, DST-4) 4 (DST-1, DCT-8) (DCT-8, DST-1) 5 (DCT-8, DST-7) (DST-7, DCT-8) 6 (DST-7, DST-7) (DST-7, DST-7) 7 (DCT-5, DST-7) (DST-7, DCT-5) 8 (DST-4, DST-7) (DST-7, DST-4) 9 (DST-1, DST-7)(DST-7, DST-1)10(DCT-8, DCT-5)(DCT-5, DCT-8)11(DST-7, DCT-5)(DCT-5, DST-7)12(DCT-5, DCT-5)(DCT-5, DCT-5)13(DST-4, DCT-5)(DCT-5, DST-4)14(DST-1, DCT-5)(DCT-5, DST-1)15(DCT-8, DST-4)(DST-4, DCT-8)16(DST-7, DST-4)(DST-4, DST-7)17(DCT-5, DST-4)(DST-4, DCT-5)18(DST-4, DST-4)(DST-4, DST-4)19(DST-1, DST-4)(DST-4, DST-1)20(DCT-8, DST-1)(DST-1, DCT-8)21(DST-7, DST-1)(DST-1, DST-7)22(DCT-5, DST-1)(DST-1, DCT-5)23(DST-4, DST-1)(DST-1, DST-4)24(DST-1, DST-1)(DST-1, DST-1)

[0161] Table 6 is an example of the 25 transform kernel candidates discussed in Table 5. Specifically, the horizontal and vertical transforms of the transform kernel candidates are indicated as (horizontal transform, vertical transform). For each transform kernel candidate index, the horizontal / vertical transform when the intra prediction mode is less than 35 may be the opposite of the horizontal / vertical transform when the intra prediction mode is 35 or greater. When the value of the intra prediction mode is 35 or greater, a mode symmetrical around mode 34 may be derived, and an MTS set may be selected from Table 4 based on the mode. In addition, the symmetry of the block shape may be additionally considered. When the original transform block has a WxH size, the original transform block may be considered to have a HxW size by symmetrizing it, and an MTS set may be selected from Table 4. Here, the value of the intra prediction mode may be the value of the modified intra prediction mode. That is, as mode values ​​for WAIP, -14 (or -15) to -1 are modified to mode 2, 67 to 80 (or 81) are modified to mode 66, and the remaining modes can be set to the values ​​of the modified intra prediction modes with the values ​​of the original intra prediction modes as they are. In this case, since the extended modes for WAIP are also configured symmetrically around mode 34, the symmetry around mode 34 can be utilized for all directional modes except for the Planar mode and the DC mode.

[0162] For example, if a 16x32 block is predicted to be mode 54, mode 14 (=68-54) can be derived as a mode symmetric to mode 54, and the block size can be considered as 32x16. In this case, an MTS set with an index of 72 can be selected, as defined in Table 4.

[0163] When the MIP mode is applied, the MTS set assigned to the MIP mode may be selected based on the size of the current block, without considering the symmetry of the block shape. Alternatively, when the MIP mode is applied, the MTS set assigned to the MIP mode may be selected based on the symmetric block size, considering the symmetry of the block shape. For example, when the MIP mode is applied to an 8x16 block, the 8x16 block may be regarded as a symmetrical 16x8 block, and an MTS set with an index of 49 may be selected, as defined in Table 4. Alternatively, when the MIP mode is applied, the intra prediction mode may be regarded as the Planar mode. In this case, the MTS set assigned to the MIP mode may be selected based on the size of the current block, without considering the symmetry of the block shape. Alternatively, the MTS set assigned to the MIP mode may be selected based on the symmetrical block size, considering the symmetry of the block shape.

[0164] For the MIP mode, a flag may be used to indicate whether the MIP mode is applied in transpose mode. If the MIP mode is applied to the current block of MxN and the flag indicates application of the transpose mode, the intra prediction mode is regarded as the Planar mode, and the current block of MxN may be regarded as an NxM block. That is, from Table 4, an MTS set corresponding to the block size of NxM and the Planar mode may be selected. As seen in Table 6, if the value of the intra prediction mode is 35 or greater, the horizontal and vertical transformations are swapped, but since the intra prediction mode of the current block is regarded as the Planar mode, the horizontal and vertical transformations of the transform kernel candidates may not be swapped. Alternatively, if the MIP mode is applied to the current block of MxN and the flag indicates application of the transpose mode, the intra prediction mode is not regarded as the Planar mode, and the current block of MxN may be regarded as an NxM block. That is, from Table 4, an MTS set corresponding to the block size of NxM and the MIP mode may be selected.

[0165] In Table 5, a transformation kernel candidate selected by a transformation kernel candidate index may be set as the transformation kernel of the current block. Alternatively, depending on the size of the current block, at least one of the horizontal transformation or the vertical transformation of the selected transformation kernel candidate may be changed to another transformation kernel. For example, if the transformation kernel candidate index is 3 and the width and height of the current block are both 16 or less, at least one of the horizontal transformation or the vertical transformation of the transformation kernel candidate corresponding to the transformation kernel candidate index of 3 may be changed to another transformation kernel. At this time, the horizontal transformation and the vertical transformation may be changed independently of each other. If the difference (or the absolute value of the difference) between the value of the intra prediction mode of the current block and the value of the horizontal mode is less than or equal to a predetermined threshold, the vertical transformation of the selected transformation kernel candidate may be changed to an identity transform (IDT). If the difference (or the absolute value of the difference) between the value of the intra prediction mode of the current block and the value of the vertical mode is less than or equal to a predetermined threshold, the horizontal transformation of the selected transformation kernel candidate may be changed to an identity transform (IDT). Here, the threshold value can be determined based on the width and height of the current block, as shown in Table 7 below.

[0166] Block Size Threshold Width Height 44848641648488888166164416821616-1

[0167] Table 7 defines thresholds according to the size of a transform block for changing the horizontal transformation and / or vertical transformation of a transform kernel candidate selected by a transform kernel candidate index to another transform kernel.

[0168] The six transform kernel candidates constituting one MTS set can be distinguished by transform kernel candidate indices from 0 to 5 as defined in Table 5. The transform kernel candidate indices can be signaled through the bitstream. A flag indicating whether the MTS set is available / applied (MTS enabled flag or MTS flag) can be signaled, and the transform kernel candidate index can be signaled when the flag indicates the availability / applicability of the MTS set. The MTS flag can be composed of one bin, and one or more contexts for CABAC-based entropy coding (hereinafter referred to as CABAC context) can be allocated to the bin. For example, different CABAC contexts can be allocated for non-MIP mode and MIP mode, respectively.

[0169] Depending on the context of the current block described above, the number of transform kernel candidates available to the current block may be set differently. For example, as the context of the current block, the sum of the absolute values ​​of all or part of the transform coefficients in the current block may be considered. The sum of the absolute values ​​of the transform coefficients is referred to as AbsSum. If AbsSum is less than or equal to T1, only one transform kernel candidate corresponding to a transform kernel candidate index of 0 may be available. If AbsSum is greater than T1 and less than or equal to T2, four transform kernel candidates corresponding to transform kernel candidate indices of 0 to 3 may be available. If AbsSum is greater than T2, six transform kernel candidates corresponding to transform kernel candidate indices of 0 to 5 may be available. Here, T1 may be 6 and T2 may be 32, but this is only an example.

[0170] When AbsSum is less than or equal to T1, since the number of transformation kernel candidates available for the current block is 1, the transformation kernel candidate corresponding to the transformation kernel candidate index of 0 can be set as the transformation kernel of the current block without signaling the transformation kernel candidate index. When AbsSum is greater than T1 and less than or equal to T2, since four transformation kernel candidates are available, any one of the four transformation kernel candidates can be selected based on the transformation kernel candidate index with two bins. That is, the transformation kernel candidate indices of 0 to 3 can be signaled as 00, 01, 10, and 11, respectively. For the two bins, the Most Significant Bit (MSB) can be signaled first, and the Least Significant Bit (LSB) can be signaled later. Different CABAC contexts can be assigned to each bin. For example, for two bins, a CABAC context other than the CABAC context assigned for the MTS flag may be assigned to each bin. Alternatively, bypass coding may be applied without assigning a CABAC context to the two bins. When AbsSum is greater than T2, the transform kernel candidate index has a value from 0 to 5, so the transform kernel candidate index cannot be expressed with only two bins. In this case, the transform kernel candidate index may be expressed by assigning two or more bins, such as truncated binary coding. For each bin assigned by the truncated binary coding method, a CABAC context may be assigned, or bypass coding may be applied without assigning a CABAC context. Alternatively, a CABAC context may be assigned to some of the multiple bins (e.g., the first bin, or the first and second bins), and bypass coding may be applied to the remaining bins.

[0171] Example 3

[0172] The transformation kernel of the current block can be determined based on a transformation set including one or more transformation kernel candidates. The transformation kernel of the current block can be derived from any one or more transformation kernel candidates belonging to the transformation set.

[0173] The process of determining a transformation kernel of the current block may include at least one of 1) determining a transformation set of the current block or 2) selecting one transformation kernel candidate from the transformation set of the current block. The process of determining the transformation set may be a process of selecting one of a plurality of transformation sets that are identically predefined for the encoding device and the decoding device. Alternatively, the process of determining the transformation set may be a process of configuring one or more transformation sets available to the current block from among a plurality of transformation sets that are identically predefined for the encoding device and the decoding device, and selecting one of the configured transformation sets. Alternatively, the process of determining the transformation set may be a process of configuring one transformation set based on a transformation kernel candidate available to the current block from among a plurality of transformation kernel candidates that are identically predefined for the encoding device and the decoding device.

[0174] If the transformation set of the current block includes multiple transformation kernel candidates, a process of selecting one of the multiple transformation kernel candidates for the current block may be performed. However, if the transformation set of the current block includes only one transformation kernel candidate (i.e., the current block has only one transformation kernel candidate available), the transformation kernel of the current block may be set to that transformation kernel candidate.

[0175] The transformation set according to the present disclosure may mean the (non-separable) transformation set in the aforementioned embodiment 1, or may mean the MTS set in the embodiment 2. Alternatively, the transformation set may be defined separately from the (non-separable) transformation set in the embodiment 1 or the MTS set in the embodiment 2. In this case, the transformation set may include one or more specific transformation kernels as transformation kernel candidates. One specific transformation kernel may be defined as a pair of a transformation kernel for horizontal transformation and a transformation kernel for vertical transformation, or may be defined as one transformation kernel that is equally applied to horizontal and vertical transformations.

[0176] In the embodiments of the present disclosure, the process of applying NSPT, which is a non-separable transform applied as a primary transform, is described in detail. NSPT can be applied to all or part of a transform block. Based on the forward NSPT, residual samples existing in the region where NSPT is applied can be input as a one-dimensional vector of NSPT. That is, residual samples existing in all or part of a transform block (referred to as Region Of Interest, ROI, in the present disclosure) can be collected into a one-dimensional vector and configured as an input. Then, by applying the forward NSPT, the primary transform coefficients can be obtained. Conversely, by applying the backward NSPT to the primary transform coefficients, the one-dimensional vector output can be obtained. By arranging each element value constituting the corresponding output vector at a predetermined location within the 2D transform block, the residual sample for the ROI can be obtained.

[0177] The dimension of the matrix of the non-separable transform kernel for NSPT may be determined according to the size of the ROI. In the present disclosure, the transform kernel may be referred to as a transform type and a transform matrix, and the non-separable transform kernel for NSPT may be referred to as an NSPT kernel. For example, if the current block is an MxN transform block, the ROI is the area of ​​the entire MxN transform block, and a square NSPT is applied, the dimension of the corresponding transform matrix may be MN x MN. For example, if the ROI is the area of ​​the entire 8x8 transform block, the dimension of the NSPT kernel may be 64 x 64.

[0178] According to one embodiment of the present disclosure, when applying NSPT to a residual generated by intra prediction, the NSPT kernel can be adaptively determined depending on the intra prediction mode. Since the statistical characteristics of the residual block may vary depending on the intra prediction mode, compression efficiency can be improved by adaptively determining the NSPT kernel depending on the intra prediction mode.

[0179] It can be configured to share an NSPT kernel applied to one or more intra prediction modes. As described above, the non-separable transform set can be determined based on the intra prediction mode of the current block and a mapping table. The mapping table can define a mapping relationship between pre-defined intra prediction modes and non-separable transform sets. The pre-defined intra prediction modes can include two non-directional modes and 65 directional modes.

[0180] In one embodiment, intra prediction modes can be grouped into intra prediction mode groups. One NSPT kernel or multiple NSPT kernels can be assigned to an intra prediction mode group. In other words, a non-separable transform set (NSPT set) including one or more NSPT kernels can be assigned to an intra prediction mode group. The non-separable transform set is mapped to an intra prediction mode, and one of the N NSPT kernels included in the non-separable transform set can be selected.

[0181] For example, an intra prediction group may include adjacent prediction modes (e.g., modes 17, 18, and 19). In addition, the intra prediction group may include modes that have symmetry. For example, directional modes may be symmetrical around the diagonal mode of FIG. 5 described above (i.e., intra prediction mode 34). In this case, two modes that have symmetry may form a group (or pair). For example, modes 18 and 50 may be included in the same group because they are symmetrical around mode 34. However, for modes that have symmetry, a process of transposing the 2D input block and then constructing a one-dimensional input vector may be added before applying the forward NSPT kernel. For example, if the intra prediction mode is 34 or less, the one-dimensional input vector may be derived from the corresponding input block in the row-first order without transposing the 2D input block. If the intra prediction mode is greater than 34, the one-dimensional input vector can be constructed by first transposing the 2D input block and then reading the input block in the row-first order, or by leaving the 2D input block as is and reading the input block in the column-first order.

[0182] Table 8 below illustrates an example of a mapping table for assigning NSPT sets according to intra prediction modes. Referring to Table 8, a total of 35 NSPT sets, from 0 to 34, can be defined. The extended WAIP mode (i.e., modes -14 to -1 and modes 67 to 80 in FIG. 5 ) can be assigned the NSPT set assigned to the nearest normal directional mode. In other words, the extended WAIP mode can be assigned NSPT set number 2.

[0183]

[0184] An NSPT set may include one or more NSPT kernels (or kernel candidates). That is, an NSPT set may include N NSPT kernel candidates. For example, N may be set to a value greater than or equal to 1, such as 1, 2, 3, or 4. Among one or more NSPT kernels included in the NSPT set, a kernel applied to a current block may be signaled using an index. In the present disclosure, the index may be referred to as an NSPT index. For example, the NSPT index may have values ​​of 0, 1, 2, …, N - 1.

[0185] Additionally, as an example, if the number of NSPT kernel candidates is 1, the NSPT index value may be fixed to 0. In this case, the NSPT index may be inferred without being separately signaled. In addition, a flag indicating whether NSPT is applied may be signaled separately from the NSPT index. In the present disclosure, the flag may be referred to as an NSPT flag.

[0186] If the NSPT flag value is 1, NSPT may be applied. If the NSPT flag value is 0, NSPT may not be applied. If the NSPT flag is not signaled, the NSPT flag value may be inferred to be 0. For example, if the NSPT flag value is 1, the NSPT index may be signaled. Based on the signaled NSPT index, one of the N kernel candidates included in the NSPT set selected by the intra prediction mode may be specified.

[0187] In one embodiment, the entropy coding method of the NSPT index can be defined in various ways considering the number (N) of NSPT kernels included in the NSPT set. For example, as a method of mapping values ​​from 0 to N-1 to empty strings (i.e., a binarization method), truncated unary binarization, truncated binarization, and fixed-length binarization methods can be used.

[0188] For example, if the number of kernel candidates constituting the NSPT set, N, is 2, one of the two candidates can be specified by one bin. For example, 0 can indicate the first candidate, and 1 can indicate the second candidate. In addition, if the value of N is 3 and truncated unary binarization is applied, the candidates can be specified by two bins. For example, the first, second, and third candidates can be binarized and signaled as 0, 10, and 11, respectively. As an example, the binarized bins can be coded using context coding or bypass coding.

[0189] In this disclosure, a reduced primary transform (RPT) method using a transform kernel of a reduced dimension by a primary transform is described. As described above, when forward NSPT is applied, samples belonging to a 2D residual block can be arranged (or rearranged) into a 1D vector according to row-majority (or column-majority). Thereafter, a transformation matrix for NSPT can be multiplied by the arranged vector. When the corresponding 2D residual block is an M x N block (M is the width, N is the height), the length of the rearranged 1D vector can be M*N. That is, the corresponding 2D residual block can also be represented as a column vector having dimensions M*N x 1. In this disclosure, M*N can be conveniently denoted as MN. In this case, the dimension of the corresponding transformation matrix can be MN x MN. In summary, forward NSPT can operate by multiplying the left side of an MN x 1 vector by the corresponding MN x MN transformation matrix to obtain an MN x 1 transformation coefficient vector.

[0190] When RPT is applied, instead of multiplying the MN x MN matrix as the forward NSPT transformation matrix described above, r transform coefficients can be obtained by multiplying an r x MN matrix. Here, r represents the number of rows of the transformation matrix, and MN represents the number of columns of the transformation matrix. According to an embodiment of the present disclosure, the value of r can be set to be less than or equal to MN. That is, the existing forward NSPT transformation matrix includes MN rows, each row being a 1 x MN row vector, which is a transform basis vector of the corresponding NSPT transformation matrix. The corresponding transform coefficients can be obtained by multiplying each transform basis vector by an MN x 1 sample column vector.

[0191] Since the conventional forward NSPT transformation matrix is ​​composed of MN row vectors, MN transformation coefficients (i.e., MN x 1 transformation coefficient column vectors) can be obtained by applying the forward NSPT. On the other hand, in the case of the forward RPT, the transformation matrix can be composed of r transformation basis vectors instead of MN transformation basis vectors. Accordingly, when the forward RPT is applied, r transformation coefficients (i.e., r x 1 transformation coefficient column vectors) can be obtained instead of MN.

[0192] The RPT kernel can be constructed by selecting r transform basis vectors, which are part of the transform basis vectors constituting the MN x MN forward NSPT kernel. In the present disclosure, the transform kernel can be referred to as a transform type and a transform matrix, and the non-separable transform kernel for NSPT can be referred to as an RPT kernel. That is, when selecting r 1 x MN row vectors from the MN x MN forward NSPT kernel, it can be advantageous to select the most important transform basis vectors from the perspective of coding performance. Specifically, in terms of energy compaction through transform, more energy can be concentrated in the transform coefficients that appear first by multiplying the forward NSPT transform matrix. In other words, the transform basis vectors located on the upper side of the forward NSPT transform matrix can generate transform coefficients having larger energy. Considering this, the r x MN forward RPT kernel can be constructed (or derived) by taking r from the upper side of the forward NSPT kernel.

[0193] The RPT according to the present disclosure takes only a portion (i.e., r) of the transform coefficients obtained by applying the existing NSPT, which may result in a loss of some of the energy contained in the original signal. In other words, distortion may occur between the original signal and the original signal through this process. Nevertheless, by applying the RPT, only r transform coefficients are generated instead of MN, so the number of bits required to code the transform coefficients can be reduced. Therefore, in the case of a signal in which a large amount of energy is concentrated in a small number of transform coefficients (e.g., an image residual signal), the gain obtained by reducing the signaling bits can be significantly large, thereby improving the coding performance.

[0194] The backward NSPT may be the transpose matrix of the forward NSPT kernel described above as a transformation matrix. In this case, the input data may be a transformation coefficient signal instead of a sample signal such as a residual signal. Specifically, if the forward NSPT transformation matrix is ​​G and the sample signal rearranged into a 1D vector is x, the transformation coefficient vector obtained by multiplying the transformation matrix on the left side can be expressed as in the following mathematical equation 4.

[0195]

[0196] Referring to Equation 4, x and y can be MN x 1 column vectors. G can have the form of an MN x MN matrix. The reverse NSPT process can be expressed as Equation 5 below using the same variables.

[0197]

[0198] In mathematical expression 5, G Tmeans the transpose matrix of G. The forward RPT operation and the backward RPT operation according to the present disclosure can also be expressed by the two mathematical equations above. However, when RPT is applied, y is an r x 1 column vector instead of an MN x 1 column vector, and G is an r x MN matrix instead of an MM x MN matrix. That is, even if RPT is applied instead of NSPT, the dimension of the sample signal (e.g., image residual signal) does not change, which may mean that the original number of sample signals (i.e., MN sample signals) can be restored with only r transform coefficients through the backward RPT. In other words, the original MN sample signals can be restored by coding only r transform coefficients that are less than MN, which may lead to an improvement in coding performance.

[0199] In one embodiment of the present disclosure, we propose an RPT structure that defines an r value by considering the statistical characteristics of a residual block, and derives a residual block of the size of an existing transform block from a residual block of a reduced size determined by the defined r value. If an additional transformation (i.e., a secondary transform) is applied to predict the statistical distribution of primary transform coefficients, quantized non-zero coefficients may be concentrated in a relatively low frequency region because a quantization process is applied to the primary transform coefficients. Accordingly, a reduced secondary transform for the statistical distribution of primary transform coefficients can define the statistical characteristics of the primary transform coefficients relatively simply by setting an r value for a given low frequency region. However, the RPT according to the present disclosure is fundamentally different from the reduced secondary transform in that it is a technique for defining an r value by considering the statistical characteristics of samples within a residual block that have very different characteristics from the distribution of the primary transform coefficients. Below, we describe various embodiments for determining the RPT kernel, which is a reduced-dimensional transformation matrix. In other words, a method for determining or defining the r value in the RPT is described below.

[0200] In one embodiment of the present disclosure, the r value in the RPT can be determined by considering the worst case complexity allowed by the conversion system. In one embodiment, the worst case complexity can be calculated based on the number of multiplications per sample. Applying the RPT in both the forward and backward directions based on an M x N block requires MN * r multiplications. Since a 2D block is composed of a total of MN samples, the number of multiplications per sample can be calculated as (MN * r) / MN = r. Therefore, the r value can be configured to be less than or equal to the maximum number of multiplications per sample allowed. For example, if the maximum possible number of multiplications per sample is set to 16 for a 16x16 block, the r value can be determined to be less than or equal to 16. That is, the forward RPT kernel can be set to 16 x 256.

[0201] In another embodiment, memory usage can be considered as a measure of worst-case complexity. As an example, the allowed memory size per kernel can be set. For example, if each kernel coefficient (each element constituting a transform kernel is referred to as a kernel coefficient in the present disclosure) requires p bytes and the memory usage per kernel is set to be q bytes or less, the value of r can be set to be q / (MN * p) or less. For example, if p is 1 byte for a forward RPT kernel for a 16x16 block and the memory usage per kernel is set to be 8KB or less (q = 8KB = 2 13 bytes), the r value can be set to 32 or less.

[0202] Additionally, as another example, memory usage and / or the number of multiplications per sample can be considered as measures of worst-case complexity. For example, if the maximum possible number of multiplications per sample is set to 16 for a 16x16 block and memory usage is set to 8KB or less per kernel (kernel coefficients are expressed as 1 byte), the value of r can be set to 16 or less.

[0203] In addition, in one embodiment, the r value constituting the RPT kernel may be determined by specific information. In other words, the r value constituting the RPT kernel may be determined based on a predefined encoding parameter. For example, the r value may be determined based on the size of a block. In other words, the RPT kernel may be variably determined based on the size of the block. Here, the block may be at least one of a coding block, a transform block, and a prediction block. In addition, for example, the r value may be determined based on prediction information. Here, the prediction information may include information regarding inter / intra prediction, intra prediction mode information, etc. In addition, for example, the r value may be determined based on signaled information (values ​​of syntax elements). For example, the r value may be variably determined based on a quantization parameter value. In addition, in terms of improving complexity, a predefined fixed value may be used as the r value, and the predefined fixed value may be determined based on signaled information.

[0204] When the RPT kernel rx MN is multiplied by the sample signal, r transform coefficients can be obtained. The obtained r transform coefficients can be arranged according to a predefined scan order of the transform coefficients (e.g., forward / backward zig-zag scan order, forward / backward horizontal scan order, forward / backward vertical scan order, forward / backward diagonal scan order, a scan order specified based on an intra prediction mode, etc.). When the transform coefficients obtained from the forward RPT application are arranged according to such a scan order (e.g., a scan order per coefficient group (CG) unit can also be applied), if the value of r is smaller than MN, the inside of the M x N block cannot be completely filled with the r transform coefficients, and thus a blank space may be generated. In an embodiment of the present disclosure, the above-described blank space can be predicted in the following manner in consideration of the characteristics of the residual signal.

[0205] - The values ​​of empty spaces can be filled using the values ​​of available surrounding pixels.

[0206] - The values ​​in empty spaces can be filled based on the values ​​of available surrounding pixels and the intra prediction mode. For example, the values ​​in empty spaces can be predicted by performing intra prediction based on the values ​​of available surrounding pixels and the intra prediction mode.

[0207] - You can fill in the empty space with a predefined fixed value (e.g. 0).

[0208] - The values ​​of empty spaces can be filled from available surrounding pixels using a predefined intra prediction mode (e.g., planar mode).

[0209] In the present disclosure, filling the empty space with 0 among the examples described above may be referred to as a zero-out process. When filling the empty space with 0, the following embodiment may be applied. If a non-zero transform coefficient is detected (or parsed) in the empty space portion during parsing of the transform coefficients on the decoding device side, it may be considered (or inferred) that the RPT is not applied. In other words, if a non-zero transform coefficient exists in the predefined area representing the empty space, it may be considered that the RPT is not applied. In this case, signaling (or parsing) for a flag indicating whether the RPT is applied and / or an index designating one of a plurality of RPT kernel candidates may not be performed. As an example, if a non-zero transform coefficient exists in the predefined area representing the empty space, a predefined variable value may be updated, and it may be inferred that the RPT is not applied based on the updated variable value.

[0210] In one embodiment of the present disclosure, whether or not to apply RPT may be determined based on the size and / or shape of a block. Furthermore, the RPT kernel may be variably determined based on the size and / or shape of the block. Since the r value may vary based on the size and / or shape of the block (i.e., for each M x N block), the empty space may vary based on the size and / or shape of the block. Accordingly, the area for checking whether a non-zero transform coefficient is detected may be defined differently based on the size and / or shape of the block. In other words, the zero-out area may be variably determined.

[0211] For example, when a 16x64 matrix is ​​applied as a forward RPT matrix for an 8x8 block, the r value may be 16. In this case, when the CG is a 4x4 sub-block, only the upper left 4x4 block may be filled with a non-zero RPT transform coefficient, and the remaining three empty 4x4 sub-blocks (i.e., the upper right, lower left, and lower right sub-blocks) may be filled with 0 values. In this case, if a non-zero transform coefficient is detected in the remaining three 4x4 sub-block areas during the decoding process, it may be considered that the RPT is not applied. In addition, as described above, a flag indicating whether to apply the RPT or an index specifying one of multiple RPT kernel candidates may not be signaled.

[0212] Also, as an example, when a 32x128 matrix is ​​applied as a forward RPT matrix for a 16x8 block (i.e., the r value is 32), and the CG is a 4x4 sub-block, only two CGs in the scan order can be filled with non-zero RPT transform coefficients. For example, the RPT transform coefficients can be filled in the upper-left 4x4 sub-block and the 4x4 sub-block adjacent to the lower side of the upper-left sub-block. The area to be filled with zero as an empty space can be determined as the remaining area excluding the two 4x4 sub-blocks. The RPT kernel can be determined variably depending on the size and / or shape of the block, and as seen, the empty space can be determined differently for an 8x8 block and a 16x8 block.

[0213] As an example, if the value of r is a multiple of the CG size and the transform coefficients are scanned in CG units, the flag and / or index associated with the RPT may not be signaled if it is detected that non-zero transform coefficients exist in CGs belonging to empty spaces. That is, the transform coefficients within each CG may be scanned in a specified order, and the transform coefficients within the CG may be scanned in the same manner for the next CG according to the scan order for the CG unit. In conventional image compression techniques, since a flag for whether a non-zero transform coefficient exists within each CG is signaled first, whether to apply the RPT can be determined based on that information alone, which can reduce signaling overhead and related implementation complexity.

[0214] As described above, if a non-zero transform coefficient is detected in an empty space area that is filled with 0 when RPT is applied, RPT may not be applied. In this case, signaling for information related to RPT may be omitted. However, since it is not possible to determine whether RPT is applied if a non-zero transform coefficient is not detected in the empty space area, the flag indicating whether RPT is applied can be parsed after parsing (or signaling) the related transform coefficients to make a final determination as to whether RPT is applied.

[0215] In one embodiment, a forward secondary transform may be additionally applied to the transform coefficients generated through the application of RPT. Alternatively, a forward secondary transform may be additionally applied to an area where the generated transform coefficients are located within an M x N block. In the present disclosure, the area or a part of the area may be referred to as an ROI from the perspective of the forward secondary transform. In the reverse direction, the backward secondary transform may be applied first and then the backward RPT may be applied. Specifically, an area or a part of the area where r transform coefficients generated by the application of the forward RPT are located may be set as an ROI and the forward secondary transform may be applied. In this case, when a 16x64 forward RPT transform matrix is ​​applied to an 8x8 area, the 16 generated transform coefficients may be located in the upper left 4x4 sub-block, and the sub-block area may be set as an ROI and the forward secondary transform may be applied to the ROI.

[0216] In addition, the coefficient values ​​of the RPT kernel can be adjusted considering operations such as integer arithmetic or fixed-point arithmetic. That is, the RPT kernel can be configured to perform a transformation through integer arithmetic (or fixed-point arithmetic) in a practical codec system by appropriately scaling the kernel coefficients belonging to the kernel, rather than a theoretical orthogonal transformation or non-orthogonal transformation (wherein, orthogonal transformation and non-orthogonal transformation refer to transformations in which the norm of each transformation basis vector is 1). When applying a separable transformation in a conventional image compression technology, the scaling factor multiplied can be equally reflected when applying the RPT. In this case, a separable transformation or a non-separable transformation (including RPT) can be performed while maintaining other processes (e.g., quantization and dequantization processes) other than the transformation.

[0217] Integer coefficients of the RPT kernel can be obtained by multiplying the transformation basis vector by the scaling value described above. In an embodiment, multiplying the scaling value may include applying operations such as rounding, flooring, and ceilinging to each kernel coefficient. That is, the integerized RPT kernel obtained through the above-described method is defined and can be used in the transformation / inverse transformation process. As described above, if kernel coefficients whose integer values ​​are scaled through operations such as rounding, flooring, and ceilinging are obtained, the maximum and minimum values ​​can be obtained for all kernel coefficients, and thus the number of bits that can express all kernel coefficients can be obtained from the maximum and minimum values. For example, if the maximum value is less than or equal to 127 and the minimum value is greater than or equal to -128, all integer kernel coefficients can be expressed with 8 bits (especially, through 2's complement representation, etc.).

[0218] Generalizing, the maximum value is (2 (N-1) - 1) and the minimum value is -2 (N-1) If this is the case, all integer kernel coefficients can be expressed with N bits. If the maximum value is (2 (N-1) - 1) Greater than or equal to the minimum value -2 (N-1) For smaller cases, it may not be possible to represent all integer kernel coefficients with N bits. In this case, 1) all kernel coefficients can be additionally multiplied by a scaling value to fit within the N-bit range, or 2) the number of bits required to represent the kernel coefficients can be increased (i.e., more than N+1 bits). If all kernel coefficients are multiplied by 2 to represent them with N bits, -p If we need to multiply by that amount (p >= 1), then 2 is added to the existing encoding / decoding process. p Compensation can be made by multiplying the amount. As an example, 2 pMultiplying by can be implemented by performing an additional shift operation to the left by p bits, or by reducing the amount of right shift applied during quantization or dequantization by p.

[0219] All kernel coefficients can be expressed as 8-bit, 9-bit, 10-bit, etc. using the method described above. Of course, the scaling value of the kernel coefficients can be set differently for each block size or kernel, and the number of bits for expressing the kernel coefficients can be set differently.

[0220] The aforementioned NSPT can be applied based on at least one of the size, tree type, or component type of the current block. For example, whether to apply NSPT can be determined based on at least one of the size, tree type, or component type of the current block. An NSPT index can be signaled based on at least one of the size, tree type, or component type of the current block. An NSPT set or NSPT kernel can be derived based on at least one of the size, tree type, or component type of the current block.

[0221] Allowed transform block sizes pre-defined in a decoding device can be broadly divided into two groups. One of the two groups (hereinafter referred to as the first group) may refer to a set of block sizes to which NSPT can be applied. The first group may be composed of any one of the allowed transform block sizes, or may be composed of two or more block sizes among the allowed block sizes. A block size to which NSPT can be applied may be defined as a block size in which at least one of the width and the height is less than or equal to a predetermined threshold. Alternatively, a block size to which NSPT can be applied may be defined as a block size in which the product of the width and the height is less than or equal to a predetermined threshold. Alternatively, a block size to which NSPT can be applied may be defined as a block size in which the maximum value of the width and the height is less than or equal to a predetermined threshold. The threshold may be an integer of 4, 8, 16, 32, 64, 128, or higher.

[0222] The other of the two groups above (hereinafter referred to as the "second group") may refer to a set of block sizes to which NSPT is not applied. The aforementioned separable primary transformation may be applied to the block sizes belonging to the second group. Furthermore, a non-separable secondary transformation may be applied to all or some of the block sizes belonging to the second group.

[0223] For example, if the size of the current block belongs to the first group, the reverse NSPT may be applied to the (dequantized) transform coefficients of the current block. If the size of the current block belongs to the second group, the reverse separable primary transform may be applied to the (dequantized) transform coefficients of the current block. Alternatively, if the size of the current block belongs to the second group, the reverse non-separable secondary transform (e.g., low frequency non-separable transform, LFNST) may be first applied to the (dequantized) transform coefficients of the current block, and then the reverse separable primary transform (e.g., DCT-2) may be applied to the transform coefficients obtained therefrom.

[0224] For example, the first group, which is a set of block sizes to which NSPT can be applied, can be defined as a set of 4x4, 4x8, 8x4, 8x8. Alternatively, the first group can be defined as a set of 4x8, 8x4, 8x8. Alternatively, the first group can be defined as a set of 4x8, 8x4. Alternatively, the first group can be defined as a set of 4x4, 4x8, 4x16, 8x4, 8x8, 16x4. Alternatively, the first group can be defined as a set of 4x8, 4x16, 8x4, 8x8, 16x4. Alternatively, the first group can be defined as a set of 4x8, 4x16, 8x4, 16x4. Alternatively, the first group can be defined as a set of 4x4, 4x8, 8x4, 8x8, 8x16, 16x8, 16x16. Alternatively, the first group can be defined as a set of 4x4, 4x8, 8x4, 8x8, 8x16, 16x8. Alternatively, the first group can be defined as a set of 4x8, 8x4, 8x8, 8x16, 16x8. Alternatively, the first group can be defined as a set of 4x4, 4x8, 8x4, 8x8, 8x16, 16x8. Alternatively, the first group can be defined as a set of 4x4, 4x8, 8x4, 8x8, 8x16, 16x8, 16x16, 16x32, 32x16, 32x32. Alternatively, the first group can be defined as the set of 4x4, 4x8, 8x4, 8x8, 8x16, 16x8, 16x16, 16x32, 32x16. Alternatively, the first group can be defined as the set of 4x8, 8x4, 8x8, 8x16, 16x8, 16x16, 16x32, 32x16. Alternatively, the first group can be defined as the set of 4x8, 8x4, 8x16, 16x8, 16x16, 16x32, 32x16. Alternatively, the first group can be defined as the set of 4x8, 8x4, 8x16, 16x8, 16x32, 32x16. Alternatively, the first group can be defined as a set of 4x4, 4x8, 4x16, 8x4, 16x4.Alternatively, the first group can be defined as a set of 4x4, 4x8, 4x16, 8x4, 8x8, 8x16, 16x4, 16x8. Alternatively, the first group can be defined as a set of 4x8, 4x16, 8x4, 8x8, 8x16, 16x4, 16x8. Alternatively, the first group can be defined as a set of 4x4, 4x8, 4x16, 8x4, 8x16, 16x4, 16x8. Alternatively, the first group can be defined as a set of 4x8, 4x16, 8x4, 8x16, 16x4, 16x8. Alternatively, the first group can be defined as the set of 4x4, 4x8, 4x16, 8x4, 8x8, 8x16, 16x4, 16x8, 16x16. Alternatively, the first group can be defined as the set of 4x8, 4x16, 8x4, 8x8, 8x16, 16x4, 16x8, 16x16. Alternatively, the first group can be defined as the set of 4x4, 4x8, 4x16, 8x4, 8x16, 16x4, 16x8, 16x16. Alternatively, the first group can be defined as the set of 4x8, 4x16, 8x4, 8x16, 16x4, 16x8, 16x16. Alternatively, the first group can be defined as the set of 4x4, 4x8, 4x16, 4x32, 8x4, 8x16, 8x32, 16x4, 16x8, 32x4, 32x8. Alternatively, the first group can be defined as the set of 4x8, 4x16, 4x32, 8x4, 8x16, 8x32, 16x4, 16x8, 32x4, 32x8. The first group can be defined as the set of 4x4, 4x8, 4x16, 4x32, 8x4, 8x8, 8x16, 8x32, 16x4, 16x8, 16x16, 32x4, 32x8. Alternatively, the first group can be defined as a set of 4x4, 4x8, 4x16, 4x32, 8x4, 8x8, 8x16, 8x32, 16x4, 16x8, 16x32, 32x4, 32x8, 32x16.Alternatively, the first group can be defined as the set of 4x4, 4x8, 4x16, 4x32, 8x4, 8x8, 8x16, 8x32, 16x4, 16x8, 16x16, 16x32, 32x4, 32x8, 32x16. Alternatively, the first group can be defined as the set of 4x8, 4x16, 4x32, 8x4, 8x16, 8x32, 16x4, 16x8, 16x32, 32x4, 32x8, 32x16. Alternatively, the first group can be defined as a set of 4x4, 4x8, 4x16, 4x32, 8x4, 8x8, 8x16, 8x32, 16x4, 16x8, 16x16, 16x32, 32x4, 32x8, 32x16, 32x32.

[0225] For block sizes belonging to the first group, an NSPT matrix (or NSPT kernel) having a predetermined dimension can be applied. Here, the NSPT matrix can be expressed as a matrix having a dimension of PxQ as an inverse transformation matrix, and the PxQ matrix represents a matrix in which the number of rows and the number of columns are P and Q, respectively.

[0226] For example, for a 4x4 block, a 16x16 NSPT matrix may be applied. For at least one of a 4x8 block or an 8x4 block, a 32x20 NSPT matrix may be applied. For at least one of a 4x16 block or a 16x4 block, a 64x24 NSPT matrix may be applied. For an 8x8 block, a 64x32 NSPT matrix may be applied. For at least one of an 8x16 block or a 16x8 block, a 128x40 NSPT matrix may be applied. For a 16x16 block, a 256x44 NSPT matrix may be applied. For a 4x32 block or a 32x4 block, a 128x36, 128x38, or 128x40 NSPT matrix may be applied. For 8x32 blocks or 32x8 blocks, a 256x48 NSPT matrix can be applied. For 16x32 blocks or 32x16 blocks, a 512x52 or 512x54 NSPT matrix can be applied.

[0227] Since the above PxQ matrix is ​​a reverse NSPT matrix, a Px1 output vector can be obtained by applying the PxQ matrix to a Qx1 input vector (i.e., (PxQ matrix) x (Qx1 input vector)). Here, the Qx1 input vector may correspond to (inverse quantized) transform coefficients in the current block to which NSPT is applied. At this time, the value of Q may mean the number of transform coefficients to which NSPT is applied, and may be less than or equal to the product of the width and the height of the current block. The value of Q may be variably determined based on the size of the current block among the block sizes belonging to the first group described above. Alternatively, the value of Q may be set identically for the block sizes belonging to the first group. The Px1 output vector may correspond to a residual signal (or decoded residual samples). The value of P may be equal to the product of the width and the height of the current block.

[0228] Conversely, the forward NSPT matrix can be expressed as a QxP matrix, which is the transpose of the PxQ matrix. A QxP output vector can be obtained by applying the QxP matrix to a Px1 input vector (i.e., (QxP matrix)x(Px1 input vector)). Here, the Px1 input vector can correspond to residual samples in the current block to which NSPT is applied. The value of P can be equal to the product of the width and the height of the current block. The Qx1 output vector can correspond to transform coefficients in the current block derived through NSPT. At this time, the value of Q can mean the number of transform coefficients output through NSPT, and can be less than or equal to the product of the width and the height of the current block. Similarly, the value of Q can be variably determined based on the size of the current block among the block sizes belonging to the first group described above. Alternatively, the value of Q can be set identically for the block sizes belonging to the first group.

[0229] As in the above example, NSPT can be applied to non-square blocks, such as MxN blocks and NxM blocks. For example, NSPT can be applied to 4x8 blocks and 8x4 blocks. Alternatively, NSPT can be applied to 4x16 blocks and 16x4 blocks, or 8x16 blocks and 16x8 blocks, or 16x32 blocks and 32x16 blocks.

[0230] By applying NSPT to specific block sizes belonging to the first group, more precise transformation can be performed, and coding performance can be improved. When forward LFNST is applied, the primary transformed transform coefficients of the remaining regions except for the region to which LFNST is applied (i.e., Region-Of-Interest, ROI) can be zeroed out. In addition, LFNST can be composed of a small number of transform basis vectors. In this case, if a separable primary transform such as DCT-2 and a non-separable secondary transform such as LFNST are applied instead of NSPT to the corresponding block sizes, performance degradation may occur. In this case, if NSPT is applied instead of LFNST, the zeroing process is omitted, and coding performance can be improved compared to when LFNST is applied. In addition, performance improvement can also be expected by applying NSPT. NSPT or LFNST can be applied using symmetry, which will be described later. Here, LFNST performs a transpose operation on the input block only for the ROI region, utilizing symmetry. In contrast, NSPT performs a transpose operation on the entire block, utilizing symmetry. Therefore, NSPT can train and apply the NSPT kernel using a more sophisticated symmetry method, which is expected to improve performance.

[0231] Also, when applying LFNST instead of NSPT to an 8x8 block, a 32x64 transformation matrix can be applied instead of a 16x64 transformation matrix from the forward transformation perspective. Here, the 16x64 transformation matrix can be constructed by sampling the upper 16 rows of the 32x64 transformation matrix. When applying LFNST based on the 16x64 transformation matrix to an 8x8 block, 16 multiplications are required per sample to apply LFNST, but when using a 32x64 transformation matrix, 32 multiplications are required per sample to apply LFNST. However, when using a 32x64 transformation matrix in this way, improvement in coding performance can be expected.

[0232] If the tree type of the current block is a single tree, NSPT can be applied to the luma component of the current block, but NSPT can not be applied to the chroma component of the current block. If the tree type of the current block is a dual tree, NSPT can be applied to the luma and chroma components of the current block.

[0233] Alternatively, NSPT may be applied to the luma component of the current block and not applied to the chroma component of the current block, regardless of whether the tree type of the current block is a single tree. Alternatively, NSPT may be applied to the luma component and chroma component of the current block, regardless of whether the tree type of the current block is a single tree.

[0234] For example, if the tree type of the current block is single tree, NSPT is allowed for luma and chroma components, and the size of the current block belongs to the first group, one NSPT index may be signaled, and the luma and chroma components of the current block may share the NSPT index. Here, the NSPT index may be an index for selecting any one of the transformation kernel candidates for NSPT. If the sizes of the luma block and the chroma block of the current block belong to the first group, the transformation kernel candidate selected by the same NSPT index may be applied to the luma and chroma components. If the tree type of the current block is single tree and NSPT is applied only to the luma component, LFNST may not be applied to the chroma component of the current block, and a separate transformation may be applied. Alternatively, if the tree type of the current block is single tree and NSPT is applied only to the luma component, LFNST may be applied to the chroma component of the current block.

[0235] In the case of a single tree, the luma and chroma components may have highly correlated characteristics. In this case, applying NSPT only to the luma component or applying a transform kernel candidate selected by a single NSPT index to both luma and chroma components can reduce unnecessary signaling and improve compression efficiency. On the other hand, in the case of a non-single tree, the luma and chroma components each have independent partitioning and encoding structures. In this case, signaling the NSPT index for each component can reflect the characteristics of each component and improve compression efficiency.

[0236] The NSPT kernel for the above NSPT can be derived based on at least one of symmetry between intra prediction modes or symmetry between block shapes. For example, the NSPT kernel can be derived as an NSPT kernel corresponding to at least one of a mode symmetrical to the intra prediction mode of the current block or a block shape symmetrical to the block shape of the current block. Alternatively, the NSPT kernel can be derived based on an NSPT set including one or more NSPT kernel candidates, wherein the NSPT set can be derived as an NSPT set corresponding to at least one of a mode symmetrical to the intra prediction mode of the current block or a block shape symmetrical to the block shape of the current block. Any one of the one or more NSPT kernel candidates belonging to the NSPT set can be set as the NSPT kernel of the current block. For this purpose, an NSPT index specifying any one of the one or more NSPT kernel candidates belonging to the NSPT set can be used. The NSPT index can be signaled through the bitstream or can be derived based on the aforementioned symmetry.

[0237] There may be symmetry between at least two intra prediction modes among the intra prediction modes pre-defined in the decoding device. For convenience of explanation, the symmetry will be described centered on the upper left diagonal mode (i.e., mode 34). Referring to Fig. 5, there is symmetry between the directional modes. All modes have a prediction direction except for the Planar mode (number 0) and the DC mode (number 1). Modes 2 to 66 are named normal directional modes (which can be expressed as [2, 66]), and modes -14 to -1 (which can be expressed as [-14, -1]) and modes 67 to 80 (which can be expressed as [67, 80]) are named wide directional modes. The wide directional modes may include at least one of a mode having a value smaller than -14 or a mode having a value larger than 80. Referring to Fig. 5, all modes except modes 0 and 1 are symmetrical around mode 34. Specifically, for mode [2, 66], mode x and mode (68 - x) are symmetrical, and mode x and mode (66 - x) are symmetrical between mode [-14, -1] and mode [67, 80]. The same symmetry relationship can be established between mode [N, -1] and mode [67, 66 - N]. Here, N can be an integer less than or equal to -14.

[0238] Meanwhile, with respect to the symmetry between block shapes, an MxN block and an NxM block can be defined as blocks that are symmetric to each other. Here, M and N can be the same or different. Alternatively, if the ratio of the width and height of an M1xN1 block (M1 / N1) and the ratio of the height and width of an M2xN2 block (N2 / M2) are the same, an M1xN1 block and an M2xN2 block can be defined as blocks that are symmetric to each other. Alternatively, if the ratio of the width and height of an M1xN1 block (M1 / N1) and the ratio of the width and height of an M2xN2 block (M2 / N2) are the same, an M1xN1 block and an M2xN2 block can be defined as blocks that are symmetric to each other.

[0239] In a square block, modes that are symmetric to each other can share at least one of the NSPT set, NSPT index, or NSPT kernel. That is, at least one of the NSPT set, NSPT index, or NSPT kernel for any one of the symmetric modes can be applied equally to any other of the symmetric modes.

[0240] For example, modes that are symmetric to each other can share a single NSPT kernel. However, for one of the symmetric modes, the corresponding NSPT kernel can be applied to the input data, and for the other mode, a transpose operation can be applied to the input data and then the corresponding NSPT kernel can be applied. Specifically, if mode x belongs to the [2, 33] mode, for mode x, a one-dimensional vector (1D vector) can be constructed in row-first order for the input data, which is an MxM block, and the NSPT kernel can be applied to the 1D vector. Here, the construction of the 1D vector in column-first order can be done by reading the input data in units of columns from the input data, which is an MxM block, obtaining M columns, and arranging them in order to construct the 1D vector. On the other hand, for the (68 - x) mode that is symmetric to mode x, a 1D vector can be constructed in column-first order and the same NSPT kernel can be applied to the 1D vector. Here, the configuration of a 1D vector according to the row-major order may be to read the input data row by row from the MxM block of input data, obtain M rows, and sequentially arrange them to configure a 1D vector. If the x-th mode belongs to the [N, -1] mode (N ≤ -14), a 1D vector may be configured according to the column-first order for the (66 - x) mode, which is symmetric to the x-th mode, and the same NSPT kernel as that of the x-th mode may be applied to the 1D vector. The column-major order or the row-major order may be applied to the 0th and 1st modes, and the column-major order or the row-major order may also be applied to the 34th mode.Additionally, row-major ordering may be applied to intra prediction modes belonging to the [2, 33] mode, and column-major ordering may be applied to modes symmetrical to the intra prediction mode. Row-major ordering may be applied to intra prediction modes belonging to the [N, -1] mode, and column-major ordering may be applied to modes symmetrical to it.

[0241] For non-square blocks, in addition to the symmetry between intra prediction modes, the symmetry between block shapes can be further considered. A non-square block with width and height M and N, respectively, can be viewed as having a symmetry relationship with a non-square block with width and height N and M, respectively. For example, in the [2, 66] mode, there may be symmetry between the x-th mode of an MxN block and the (68 - x)-th mode of an NxM block. Similarly, if the x-th mode of an MxN block belongs to the [N, -1] mode (N ≤ -14), there may be symmetry between the x-th mode of the MxN block and the (66 - x)-th mode of an NxM block.

[0242] The method of constructing a 1D vector from an input data block is as discussed above. That is, if a column-major order is applied to mode x, a row-major order can be applied to a mode that is symmetric to it. Alternatively, if a row-major order is applied to mode x, a column-major order can be applied to a mode that is symmetric to it. Specifically, if a column-major order is applied to mode x, input data can be read column-wise from an MxN block of input data to obtain M columns, which can be arranged in sequence to construct a 1D vector. Here, each column can have a length of N. For a mode that is symmetric to mode x, input data can be read row-wise from an MxN block of input data to obtain N rows, which can be arranged in sequence to construct a 1D vector. Here, each row can have a length of M. Alternatively, if a row-major order is applied to mode x, input data can be read row-wise from an MxN block of input data to obtain N rows, which can be arranged in sequence to construct a 1D vector. Here, each row can have a length of M. For a mode symmetric to mode x, input data can be read column by column from an MxN block of input data to obtain M columns, which can be arranged in order to form a 1D vector. Here, each column can have a length of N.

[0243] If the current block is an MxN block with mode x and the aforementioned symmetry is utilized for the current block, the NSPT set and / or NSPT kernel of the current block may be determined based on at least one of an intra prediction mode symmetric to mode x or a block size of NxM symmetric to the block size of MxN. Here, the NSPT kernel may be set as an NSPT kernel for an NxM block, not an NSPT kernel for an MxN block. That is, if symmetry is utilized for the current block, the NSPT set and / or NSPT kernel for a block that has symmetry with the current block may be utilized in the same manner. As described above, a 1D vector may be constructed from an input data block according to a predetermined priority order, which may correspond to an input of the NSPT kernel.

[0244] In addition, the symmetry may be restricted to be utilized only when the value of the intra prediction mode of the current block is greater than 34. That is, when the value of the intra prediction mode of the current block is greater than 34, a transpose operation may be applied when constructing a 1D vector from an input data block, and an NSPT set or NSPT kernel corresponding to a mode and / or block shape having symmetry with the current block may be utilized. Specifically, when the intra prediction mode of the current block belongs to the [N, -1] mode and the [2, 34] mode, symmetry may not be utilized for the current block. On the other hand, when the intra prediction mode of the current block belongs to the [35, 66] mode and the [67, 66 - N] mode, symmetry may be utilized for the current block. Here, N may be an integer less than or equal to -14.

[0245] The derivation of the NSPT set or NSPT kernel based on the above symmetry can be adaptively performed based on the size of the current block. For example, for 4x4 blocks and 8x8 blocks, the NSPT set or NSPT kernel may be derived based on symmetry, and for 4x8 blocks and 8x4 blocks, the NSPT set or NSPT kernel may not be derived based on symmetry.

[0246] Depending on whether the above symmetry is utilized, the number of available NSPT sets may vary. For example, if symmetry is utilized, the number of available NSPT sets may be 35, and if symmetry is not utilized, the number of available NSPT sets may be 67.

[0247] Table 9 below shows an example in which the NSPT set is determined using symmetry, and shows the mapping relationship between the intra prediction mode and the NSPT set when the number of available NSPT sets is 35.

[0248] Intra prediction mode NSPT set index X < 020 ≤ X ≤ 34 X35 ≤ X ≤ 6668 - XX > 662

[0249] Referring to Table 9, if the value (X) of the intra prediction mode of the current block is less than 0, the NSPT set of the current block may be determined as an NSPT set having an NSPT set index of 2 among 35 NSPT sets. If the value (X) of the intra prediction mode of the current block is greater than or equal to 0 and less than or equal to 34, the NSPT set of the current block may be determined as an NSPT set having an NSPT set index of X among 35 NSPT sets. If the value (X) of the intra prediction mode of the current block is greater than or equal to 35 and less than or equal to 66, the NSPT set of the current block may be determined as an NSPT set having an NSPT set index of (68-X) among 35 NSPT sets. If the value (X) of the intra prediction mode of the current block is greater than or equal to 35 and less than or equal to 66, the NSPT set of the current block may be identical to the NSPT set corresponding to the value (68-X) of the mode symmetrical to the intra prediction mode of the current block. Similarly, if the value (X) of the intra prediction mode of the current block is greater than 66, the NSPT set of the current block may be determined as the NSPT set having the NSPT set index of 2 among the 35 NSPT sets. If the value (X) of the intra prediction mode of the current block is greater than 66, the NSPT set of the current block may be identical to the NSPT set corresponding to the mode symmetrical to the intra prediction mode of the current block.

[0250] Table 10 below shows an example in which the NSPT set is determined without using symmetry, and shows the mapping relationship between the intra prediction mode and the NSPT set when the number of available NSPT sets is 67.

[0251] Intra prediction mode NSPT set index X < 020 ≤ X ≤ 66XX > 6666

[0252] Referring to Table 10, if the value (X) of the intra prediction mode of the current block is less than 0, the NSPT set of the current block may be determined as an NSPT set having an NSPT set index of 2 among 67 NSPT sets. If the value (X) of the intra prediction mode of the current block is greater than or equal to 0 and less than or equal to 66, the NSPT set of the current block may be determined as an NSPT set having an NSPT set index of X among 67 NSPT sets. If the value (X) of the intra prediction mode of the current block is greater than 66, the NSPT set of the current block may be determined as an NSPT set having an NSPT set index of 66 among 67 NSPT sets.

[0253] By leveraging this symmetry, the memory required to store transformation kernels can be reduced while maintaining the performance required for transform application. For example, by utilizing symmetry to use 35 NSPT sets instead of 67, the memory required to store NSPT kernels can be significantly reduced.

[0254] The number of available NSPT sets and / or the number of NSPT kernel candidates in an NSPT set may vary depending on the block size. For example, the number of available NSPT sets for a 4x4 block may be 35, the number of available NSPT sets for a 4x8 block and an 8x4 block may be 19, and the number of available NSPT sets for an 8x8 block may be 10. The NSPT set for a 4x4 block may consist of three NSPT kernel candidates, the NSPT sets for a 4x8 block and an 8x4 block may consist of three or two NSPT kernel candidates, and the NSPT set for an 8x8 block may consist of one NSPT kernel candidate.

[0255] As the block size increases, the size of the transform kernel may increase. Therefore, by reducing the number of available NSPT sets and / or the number of NSPT kernel candidates within an NSPT set, the memory required to store the transform kernel can be saved. Furthermore, as the block size increases, the residual signal characteristics within the block tend to become more generalized. Therefore, reducing the number of available NSPT sets and / or the number of NSPT kernel candidates within an NSPT set can help maintain compression efficiency while reducing implementation complexity by reflecting these statistical characteristics.

[0256] The NSPT kernel can be configured with 8-bit precision. The range of the coefficients within the NSPT kernel can be greater than or equal to -128 and less than or equal to 127. If the precision is increased beyond 8 bits, the result obtained through matrix multiplication can be shifted to the right by the increased precision. For example, if the value obtained after matrix multiplication based on an NSPT kernel with 8-bit precision is shifted to the right by S bits and stored in a buffer, if the coefficients of the kernel are configured with N-bit precision, they can be shifted to the right by (S+(N-8)) bits and stored in a buffer.

[0257] When configuring the NSPT kernel with 8-bit precision, excessive increase in internal precision within the encoder / decoder performing the conversion can be prevented, thereby minimizing the decrease in compression efficiency while reducing implementation complexity in terms of memory requirements and computational amount.

[0258] When applying the reverse NSPT to the current block of size MxN, the size of the NSPT kernel (or NSPT matrix) can be expressed as MN x r. Here, MN can mean the product of the width and the height of the current block. This can mean the output length of NSPT or the number of residual samples generated by NSPT. In addition, r can mean the input length of NSPT or the number of (dequantized) transform coefficients to which NSPT is applied. r can be an integer greater than or equal to 0 and less than or equal to MN. The following is an example of the NSPT matrix of MN x r according to the block size.

[0259] The NSPT matrix for a 4x4 block can be composed of a 16x16 matrix. The NSPT matrix for a 4x8 block and an 8x4 block can be composed of a 32x20 matrix, a 32x16 matrix, a 32x24 matrix, a 32x28 matrix, or a 32x32 matrix. The NSPT matrix for an 8x8 block can be composed of a 64x16 matrix, a 64x24 matrix, a 64x32 matrix, a 64x40 matrix, a 64x48 matrix, a 64x56 matrix, or a 64x64 matrix. The NSPT matrix for a 4x16 block and a 16x4 block can be composed of a 64x16 matrix, a 64x24 matrix, a 64x32 matrix, a 64x40 matrix, a 64x48 matrix, a 64x56 matrix, or a 64x64 matrix. The NSPT matrix for 8x16 blocks and 16x8 blocks can be a 128x96 matrix, a 128x64 matrix, a 128x48 matrix, or a 128x32 matrix. The NSPT matrix for 16x16 blocks can be a 256x128 matrix, a 256x96 matrix, or a 256x64 matrix. The NSPT matrix for 16x32 blocks and 32x16 blocks can be a 512x256 matrix or a 512x128 matrix. The NSPT matrix for 32x32 blocks can be a 1024x512 matrix, a 1024x256 matrix, or a 1024x128 matrix.

[0260] Alternatively, a 16x16 matrix can be applied for 4xN blocks and Nx4 blocks, where N can be an integer greater than or equal to 4. A 64x16 matrix can be applied for 8x8 blocks. A 64x32 matrix can be applied for 8xN blocks and Nx8 blocks, where N can be an integer greater than or equal to 16. A 96x32 matrix can be applied for 16xN blocks and Nx16 blocks, where N can be an integer greater than or equal to 16.

[0261] Alternatively, the value of r in the NSPT matrix of the MN xr may be determined according to certain criteria. The criteria here may be (1) ensuring that the sum of the computational amount for the first transformation and the computational amount for the second transformation is below a certain level, and (2) ensuring that the number of multiplications per sample required for the NSPT operation is below a certain number.

[0262] Based on the reverse transformation, if a separable linear transformation is performed for an MxN block using matrix multiplication, (M+N) multiplications are required per sample to perform the linear transformation. In addition, if LFNST is applied to a certain ROI (Region-Of-Interest) area, assuming that the LFNST matrix of the reverse transformation is a PxQ matrix, (P*Q) / (M*N) multiplications are required per sample. Here, a PxQ matrix can mean a matrix in which the number of rows is P and the number of columns is Q.

[0263] When applying NSPT instead of DCT-2 transform (or separable transform such as KLT) and LFNST for MxN blocks, the value of r that ensures that the number of multiplications per sample for applying NSPT is less than or equal to the number of multiplications per sample for applying DCT-2 transform and LFNST can be determined as follows.

[0264]

[0265] If the value of r is set to the maximum value while satisfying the above mathematical expression 6 (i.e., r = M + N + (P*Q) / (M*N)), the value of r in the NSPT matrix for each block size can be set as follows. In mathematical expression 6, if the value of (P*Q) / (M*N) is not an integer, an integer close to the value of (P*Q) / (M*N) can be used. For example, a floor operation can be applied to the value of (P*Q) / (M*N). In this case, r can be set to (M + N + floor((P*Q) / (M*N))). Here, floor(x) can mean the largest integer that does not exceed x. Alternatively, a round operation can be applied to the value of (P*Q) / (M*N). In this case, r can be set to (M + N + round((P*Q) / (M*N))). Here, round(x) may mean a value obtained by rounding x. Alternatively, a ceil operation may be applied to the value of (P*Q) / (M*N). In this case, r may be set to (M + N + ceil((P*Q) / (M*N))). Here, ceil(x) may mean the smallest integer greater than or equal to x. When a floor operation is applied, the inequality of mathematical expression 6 may be satisfied. However, when a round operation or a ceil operation is applied, the inequality of mathematical expression 6 may not be satisfied.

[0266] For NSPT on 4x4 blocks, the maximum value of r is 24. However, the value of r must be less than or equal to 16, so the value of r can be set to 16.

[0267] For NSPT for 4x8 and 8x4 blocks, the maximum value of r is 20. The value of r can be set to 20.

[0268] For NSPT for 8x8 blocks, the maximum value of r is 32. The value of r can be set to 32.

[0269] For NSPT for 4x16 blocks and 16x4 blocks, the maximum value of r is 24. The value of r can be set to 24.

[0270] For NSPT for 8x16 blocks and 16x8 blocks, the maximum value of r is 40. The value of r can be set to 40.

[0271] For NSPT on 16x16 blocks, the maximum value of r is 44. The value of r can be set to 44.

[0272] For NSPT for 16x32 and 32x16 blocks, the maximum value of r is 54. The value of r can be set to 54.

[0273] For NSPT on 32x32 blocks, the maximum value of r is 67. The value of r can be set to 67.

[0274] For NSPT for 4x32 blocks and 32x4 blocks, the maximum value of r is 38. The value of r can be set to 38. Alternatively, the value of r can be set to 20.

[0275] For NSPT for 8x32 and 32x8 blocks, the maximum value of r is 48. The value of r can be set to 48. Alternatively, the value of r can be set to 24.

[0276] In the NSPT matrix for each block size described above, there may be cases where the value of r is not a multiple of 4. For ease of implementation, it may be advantageous for the value of r to be a multiple of 4. For example, in implementing parallel processing through SIMD (Single Instruction Multiple Data) instructions, when simultaneously processing the inner product for four transformation basis vectors (i.e., generating four transformation coefficients simultaneously) in the process of applying forward NSPT, it may be advantageous to set the value of r to be a multiple of 4.

[0277] For example, for NSPT for 16x32 blocks and 32x16 blocks, the value of r can be set to 52 or 56 instead of 54. For NSPT for 32x32 blocks, the value of r can be set to 64 or 68 instead of 67. For NSPT for 4x32 blocks and 32x4 blocks, the value of r can be set to 36 or 40 instead of 38.

[0278] More generally, the value of r can be set to be a multiple of K, where K can be an integer greater than or equal to 1. For example, the value of r can be set to be a multiple of K that satisfies the inequality in Equation 7 below.

[0279]

[0280] In the above mathematical expression 7, func() can be the floor, round, or ceil described above.

[0281] The value of r according to the above-mentioned predetermined criteria is for the case where zero-out is not considered. That is, when forward LFNST is applied, the primary transformed coefficients of the remaining areas except the area where LFNST is applied are zeroed out, so the actual amount of calculation required to apply DCT-2 and LFNST may be less than the above-mentioned amount of calculation. Therefore, when the above-mentioned zero-out is taken into account, the value of r may be set to a value smaller than the value of r according to the above-mentioned predetermined criteria.

[0282] Since zero-out is not performed for 4x4 blocks, the value of r can be set to a value less than or equal to 16.

[0283] For a 4x8 block, zero-out can be performed on the remaining areas except for the upper left 4x4 block based on the forward transform, and a 16x16 matrix, which is the forward LFNST matrix, can be applied to the upper left 4x4 block. When such zero-out is performed, the number of sample-wise multiplications required in the forward separable linear transform is 8 (((4x4x8)+(4x8x4)) / (4x8)=8), and the number of sample-wise multiplications required in LFNST is 8 ((16x16) / 32=8). Therefore, when replacing the separable linear transform and LFNST with NSPT, the value of r can be set to a value less than or equal to 16, which is the sum of the number of sample-wise multiplications in the separable linear transform and the number of sample-wise multiplications in the LFNST. Since the same amount of computation is required when applying the reverse separable primary transform and LFNST, the value of r can be set to a value less than or equal to 16.

[0284] For an 8x4 block, zero-out can be performed on the remaining areas except for the upper left 4x4 block based on the forward transform, and a 16x16 matrix, which is the forward LFNST matrix, can be applied to the upper left 4x4 block. When such zero-out is performed, the number of sample-wise multiplications required in the forward separable linear transform is 6 ((4x8x4)+(4x4x4) / (8x4)=6), and the number of sample-wise multiplications required in LFNST is 8 ((16x16) / 32=8). Therefore, when replacing the separable linear transform and LFNST with NSPT, the value of r can be set to a value less than or equal to 14, which is the sum of the number of sample-wise multiplications in the separable linear transform and the number of sample-wise multiplications in the LFNST. Since the same amount of computation is required when applying the reverse separable primary transform and LFNST, the value of r can be set to a value less than or equal to 14.

[0285] For 8x8 blocks, zero-out may not be performed for the separable primary transform, in which case the value of r may be set to a value less than or equal to 32.

[0286] For an 8x16 block, zero-out can be performed on the remaining areas except for the upper left 8x8 block based on the forward transform, and a 64x32 matrix, which is the forward LFNST matrix, can be applied to the upper left 8x8 block. When such zero-out is performed, the number of sample-wise multiplications required in the forward separable linear transform is 16 ((8x8x16)+(8x16x8) / (8x16)=16), and the number of sample-wise multiplications required in LFNST is 16 ((64x32) / 128=16). Therefore, when replacing the separable linear transform and LFNST with NSPT, the value of r can be set to a value less than or equal to 32, which is the sum of the number of sample-wise multiplications in the separable linear transform and the number of sample-wise multiplications in the LFNST. Since the same amount of computation is required when applying the reverse separable primary transform and LFNST, the value of r can be set to a value less than or equal to 32.

[0287] For a 16x8 block, zero-out can be performed on the remaining areas except for the upper left 8x8 block based on the forward transform, and a 64x32 matrix, which is the forward LFNST matrix, can be applied to the upper left 8x8 block. When such zero-out is performed, the number of sample-wise multiplications required in the forward separable linear transform is 12 ((8x16x8)+(8x8x8) / (16x8)=12), and the number of sample-wise multiplications required in LFNST is 16 ((64x32) / 128=16). Therefore, when replacing the separable linear transform and LFNST with NSPT, the value of r can be set to a value less than or equal to 28, which is the sum of the number of sample-wise multiplications in the separable linear transform and the number of sample-wise multiplications in the LFNST. Since the same amount of computation is required when applying the reverse separable primary transform and LFNST, the value of r can be set to a value less than or equal to 28.

[0288] For a 16x16 block, zero-out can be performed on the remaining areas except for the upper left 12x12 block based on the forward transform, and a 96x32 matrix, which is the forward LFNST matrix, can be applied to the upper left 12x12 block. When such zero-out is performed, the number of sample-wise multiplications required in the forward separable linear transform is 21 ((12x16x16)+(12x16x12) / (16x16)=21), and the number of sample-wise multiplications required in LFNST is 12 ((96x32) / 256=12). Therefore, when replacing the separable linear transform and LFNST with NSPT, the value of r can be set to a value less than or equal to 33, which is the sum of the number of sample-wise multiplications in the separable linear transform and the number of sample-wise multiplications in the LFNST. Since the same amount of computation is required when applying the reverse separable primary transform and LFNST, the value of r can be set to a value less than or equal to 33.

[0289] For a 4x16 block, zero-out can be performed on the remaining areas except for the upper left 4x4 block based on the forward transform, and a 16x16 matrix, which is the forward LFNST matrix, can be applied to the upper left 4x4 block. When such zero-out is performed, the number of sample-wise multiplications required in the forward separable linear transform is 8 (((4x4x16)+(4x16x4)) / (4x16)=8), and the number of sample-wise multiplications required in LFNST is 4 ((16x16) / 64=4). Therefore, when replacing the separable linear transform and LFNST with NSPT, the value of r can be set to a value less than or equal to 12, which is the sum of the number of sample-wise multiplications in the separable linear transform and the number of sample-wise multiplications in the LFNST. Since the same amount of computation is required when applying the reverse separable primary transform and LFNST, the value of r can be set to a value less than or equal to 12.

[0290] For a 16x4 block, zero-out can be performed on the remaining areas except for the upper left 4x4 block based on the forward transform, and a 16x16 matrix, which is the forward LFNST matrix, can be applied to the upper left 4x4 block. When such zero-out is performed, the number of sample-wise multiplications required in the forward separable linear transform is 5 (((4x16x4)+(4x4x4)) / (16x4)=5), and the number of sample-wise multiplications required in LFNST is 4 ((16x16) / 64=4). Therefore, when replacing the separable linear transform and LFNST with NSPT, the value of r can be set to a value less than or equal to 9, which is the sum of the number of sample-wise multiplications in the separable linear transform and the number of sample-wise multiplications in the LFNST. Since the same amount of computation is required when applying the reverse separable primary transform and LFNST, the value of r can be set to a value less than or equal to 9.

[0291] For a 4x32 block, zero-out can be performed on the remaining areas except for the upper left 4x4 block based on the forward transform, and a 16x16 matrix, which is the forward LFNST matrix, can be applied to the upper left 4x4 block. When such zero-out is performed, the number of sample-wise multiplications required in the forward separable linear transform is 8 (((4x4x32)+(4x32x4)) / (4x32)=8), and the number of sample-wise multiplications required in LFNST is 2 ((16x16) / 128=2). Therefore, when replacing the separable linear transform and LFNST with NSPT, the value of r can be set to a value less than or equal to 10, which is the sum of the number of sample-wise multiplications in the separable linear transform and the number of sample-wise multiplications in the LFNST. Since the same amount of computation is required when applying the reverse separable primary transform and LFNST, the value of r can be set to a value less than or equal to 10.

[0292] For a 32x4 block, zero-out can be performed on the remaining areas except for the upper left 4x4 block based on the forward transform, and a 16x16 matrix, which is the forward LFNST matrix, can be applied to the upper left 4x4 block. When such zero-out is performed, the number of multiplications per sample required in the forward separable linear transform is 4.5 (((4x32x4)+(4x4x4)) / (32x4)=4.5), and the number of multiplications per sample required in LFNST is 2 ((16x16) / 128=2). Therefore, when replacing the separable linear transform and LFNST with NSPT, the value of r can be set to a value less than or equal to 6.5. Since the same amount of computation is required when applying the backward separable linear transform and LFNST, the value of r can be set to a value less than or equal to 6.5. Here, the value of r is a value that constitutes the matrix dimension, so it can be set to an integer of 6 or 7 instead of 6.5.

[0293] For an 8x32 block, zero-out can be performed on the remaining areas except for the upper left 8x8 block based on the forward transform, and a 64x32 matrix, which is the forward LFNST matrix, can be applied to the upper left 8x8 block. When such zero-out is performed, the number of multiplications per sample required in the forward separable linear transform is 16 (((8x8x32)+(8x32x8)) / (8x32)=16), and the number of multiplications per sample required in LFNST is 8 ((64x32) / 256=8). Therefore, when replacing the separable linear transform and LFNST with NSPT, the value of r can be set to a value less than or equal to 24. Since the same amount of computation is required when applying the backward separable linear transform and LFNST, the value of r can be set to a value less than or equal to 24.

[0294] For a 32x8 block, zero-out can be performed on the remaining areas except for the upper left 8x8 block based on the forward transform, and a 64x32 matrix, which is the forward LFNST matrix, can be applied to the upper left 8x8 block. When such zero-out is performed, the number of multiplications per sample required in the forward separable linear transform is 10 (((8x32x8)+(8x8x8)) / (32x8)=10), and the number of multiplications per sample required in LFNST is 8 ((64x32) / 256=8). Therefore, when replacing the separable linear transform and LFNST with NSPT, the value of r can be set to a value less than or equal to 18. Since the same amount of computation is required when applying the backward separable linear transform and LFNST, the value of r can be set to a value less than or equal to 18.

[0295] For a 16x32 block, zero-out can be performed on the remaining areas except for the upper left 12x12 block based on the forward transform, and a 96x32 matrix, which is the forward LFNST matrix, can be applied to the upper left 12x12 block. When such zero-out is performed, the number of multiplications per sample required in the forward separable linear transform is 21 (((12x16x32)+(12x32x12)) / (16x32)=21), and the number of multiplications per sample required in LFNST is 6 ((96x32) / 512=6). Therefore, when replacing the separable linear transform and LFNST with NSPT, the value of r can be set to a value less than or equal to 27. Since the same amount of computation is required when applying the backward separable linear transform and LFNST, the value of r can be set to a value less than or equal to 27.

[0296] For a 32x16 block, zero-out can be performed on the remaining area except for the upper left 12x12 block based on the forward transform, and a 96x32 matrix, which is the forward LFNST matrix, can be applied to the upper left 12x12 block. When such zero-out is performed, the number of multiplications per sample required in the forward separable linear transform is 13.5 (((12x32x12)+(12x16x12)) / (32x16)=13.5), and the number of multiplications per sample required in LFNST is 6 ((96x32) / 512=6). Therefore, if the separable linear transform and LFNST are replaced with NSPT, the value of r can be set to a value less than or equal to 19.5. Since the same amount of computation is required when applying the reverse separable first-order transform and LFNST, the value of r can be set to a value less than or equal to 19.5. Here, the value of r is a value that constitutes the matrix dimension, so it can be set to an integer of 19 or 20 instead of 19.5.

[0297] In the NSPT matrix for each block size described above, there may be cases where the value of r is not a multiple of K. Here, K may be 4. In this case, the value of r may be set to be a multiple of K for ease of implementation. The value of r set by the method described above can be set to r prev In this case, the value of r, which is a multiple of K, can be set as follows.

[0298]

[0299] In the above mathematical expression 8, func() can be the floor, round, or ceil described above.

[0300] As mentioned above, the value of r in the NSPT matrix for an MxN block may be different from the value of r in the NSPT matrix for an NxM block. For example, the reverse NSPT matrix for a 4x8 block may be a 32x16 matrix, and the reverse NSPT matrix for an 8x4 block may be a 32x14 matrix. In this case, the NSPT matrix may be determined by utilizing the symmetry between the MxN block and the NxM block.

[0301] Assume that the current block is an MxN block with x mode. In case of utilizing the symmetry described above for the current block, instead of applying the NSPT matrix corresponding to the x mode or the block size of MxN, an NSPT matrix corresponding to at least one of a mode symmetric to the x mode or a block size of NxM symmetric to the block size of MxN may be applied. In this case, the NSPT matrix corresponding to the block size of NxM may be applied as is for the current block. Alternatively, the NSPT matrix corresponding to the block size of NxM may be applied, but the value of r in the NSPT matrix corresponding to the block size of MxN may be used.

[0302] For example, the reverse NSPT matrix for a 4x8 block may be a 32x16 matrix (i.e., the value of r in the NSPT matrix is ​​16), and the reverse NSPT matrix for an 8x4 block may be a 32x14 matrix (i.e., the value of r in the NSPT matrix is ​​14). If the current block is an 8x4 block with mode x, the NSPT matrix for at least one of a mode symmetric to mode x for the current block or a 4x8 block symmetric to the 8x4 block may be applied. In this case, the 32x16 matrix, which is the reverse NSPT matrix for the 4x8 block, may be used as is, or a 32x14 matrix having the value of r in the reverse NSPT matrix for the 8x4 block may be used. Here, the 32x14 matrix may be derived by sampling 14 rows from the left in the 32x16 matrix. In this way, when a 32x14 matrix is ​​applied to the current block with a block size of 8x4, the aforementioned criteria are satisfied.

[0303] Conversely, if the current block is a 4x8 block with mode x, then an NSPT matrix for at least one of a mode symmetric to mode x for the current block or an 8x4 block symmetric to the 4x8 block may be applied. In this case, a 32x14 matrix for an 8x4 block may be applied for the current block, rather than a 32x16 matrix for a 4x8 block. This allows NSPT to be performed with fewer multiplications than are allowed for a 4x8 block.

[0304] For NSPT for MxN blocks and NxM blocks, if the values ​​of r that satisfy the aforementioned conditions are r1 and r2, respectively, the reverse NSPT matrix for MxN blocks and NxM blocks can be set to MN x max(r1, r2). Here, max(r1, r2) can mean selecting a value that is greater than or equal to one of r1 and r2.

[0305] For example, the inverse NSPT matrix for a 4x8 block may be a 32x16 matrix (i.e., the value of r in the NSPT matrix is ​​16), and the inverse NSPT matrix for an 8x4 block may be a 32x14 matrix (i.e., the value of r in the NSPT matrix is ​​14). If the current block is a 4x8 block with mode x, the NSPT matrix for at least one of a mode symmetric to mode x for the current block or an 8x4 block symmetric to the 4x8 block may be applied. In this case, the 32x16 matrix as the inverse NSPT matrix for the 8x4 block may be used. If the inverse NSPT matrix is ​​not constructed as MN x max(r1, r2), the 32x14 matrix will be used as the NSPT matrix for the 8x4 block. However, if the NSPT matrix for a 4x8 block and the NSPT matrix for an 8x4 block are configured as a 32 x max(16, 14) matrix, the 32x16 matrix can be fully applied.

[0306] Conversely, if the current block is an 8x4 block with mode x, an NSPT matrix for at least one of a mode symmetric to mode x for the current block or a 4x8 block symmetric to the 8x4 block may be applied. In this case, a 32x16 matrix, which is the inverse NSPT matrix for a 4x8 block, or a 32x14 matrix may be used. Here, the 32x14 matrix can be derived by sampling 14 rows from the left in the 32x16 matrix.

[0307] As described above, when constructing an NSPT matrix, a transformation consisting of the maximum number of transformation basis vectors can be applied while satisfying the above-described conditions, thereby maximizing coding performance.

[0308] In the above-described embodiment, the value of r can be set to be a multiple of 16. For example, in the case of reverse NSPT for 4x8 blocks and 8x4 blocks, a 32x16 matrix can be applied instead of a 32x20 matrix. The transform coefficients of the transform block can be encoded in units of a predetermined coefficient group (CG). Here, a CG can be defined as a group of 16 transform coefficients, and for example, a CG can be a sub-block of a size such as 4x4, 2x8, or 8x2. There may be cases where there is no non-zero transform coefficient in a CG, and in this case, the encoding process of the transform coefficient for the corresponding CG can be skipped. Therefore, setting the value of r to a multiple of 16 has the advantage of reducing the complexity of the implementation.

[0309] Transform coefficients can be derived by applying forward NSPT to residual samples of an MxN block. At this time, the number of derived transform coefficients can be less than or equal to the value of (M*N) due to zero-out. That is, the forward NSPT matrix can be defined as an rx (M*N) matrix, where r represents the output length of NSPT or the number of transform coefficients derived through NSPT, and (M*N) represents the input length of NSPT or the number of residual samples to which NSPT is applied.

[0310] The above-described derived transform coefficients can be arranged in an MxN block according to a predetermined scan order, and an area where the transform coefficients are not filled can be filled with 0 (i.e., zero-out). Therefore, when a decoding device scans the transform coefficients, if a non-zero transform coefficient is found in an area that would have been filled with 0 if NSPT had been applied (or, if the scan position of the last significant coefficient in the MxN block is greater than or equal to r), it is considered that NSPT has not been applied to the corresponding MxN block, and the NSPT index may not be signaled. An index indicating a scan position of 0 may be assigned to the upper-left coefficient (i.e., the DC component coefficient) in the MxN block, and indices increased by 1 may be assigned to the remaining coefficients in the MxN block according to a predetermined order.

[0311] One or more values ​​of r can be defined for block sizes to which NSPT can be applied. For example, one or more values ​​of r can be defined for each of the block sizes to which NSPT can be applied. Alternatively, one value of r can be defined for each block size to which NSPT can be applied, and the value of r for one of the block sizes to which NSPT can be applied can be different from the value of r for another. Alternatively, one value of r can be defined for some of the block sizes to which NSPT can be applied, and two or more values ​​of r can be defined for the rest.

[0312] When multiple values ​​of r are available, an index specifying one of the multiple values ​​of r or r itself can be signaled. The index can be signaled in high level syntax (HLS) such as VPS, SPS, PPS, PH, SH, or at block level such as CTU, CU, TU. When the value of r is within a specific range, it can be signaled by allocating enough bits to encompass the range. For example, when the value of r is within the range of 1 to 256, it can be signaled by designating 8 bits as a fixed-length.

[0313] The transformation kernel of the current block may be determined based on any one of the embodiments 1 to 3 described above. Alternatively, the transformation kernel of the current block may be determined based on a combination of at least two of the embodiments 1 to 3, as long as the inventions according to the embodiments 1 to 3 described above do not conflict with each other.

[0314] A transform index for the inverse transformation of the current block may be signaled. Here, the transform index may specify one or more transform kernels (or transform matrices) belonging to a transform set. Here, the transform index may mean an NSPT index specifying one or more NSPT kernels belonging to an NSPT set. Alternatively, the transform index may mean an LFNST index specifying one or more LFNST kernels belonging to an LFNST set.

[0315] Whether the above transformation index corresponds to the NSPT index can be determined based on whether the size of the current block is one of the block sizes belonging to the first group described above. This assumes that the block sizes to which NSPT is applicable and the block sizes to which LFNST is applicable are distinct from each other. In this case, if the size of the current block belongs to the first group, the transformation index signaled for the current block corresponds to the NSPT index, and the NSPT kernel can be determined from the NSPT set based on the transformation index. On the other hand, if the size of the current block does not belong to the first group, the transformation index signaled for the current block corresponds to the LFNST index, and the LFNST kernel can be determined from the LFNST set based on the transformation index. If the size of the current block does not belong to the first group, this may mean that the size of the current block belongs to the second group described above. Alternatively, if the size of the current block does not belong to the first group, this may mean that the size of the current block corresponds to a block size to which LFNST is applicable among the block sizes belonging to the second group. In this way, the NSPT index and the LFNST index can be configured as a single integrated syntax rather than as separate syntaxes.

[0316] For example, assume that the block sizes applicable to NSPT belonging to the first group are 4x4, 4x8, 8x4, and 8x8. For the block sizes belonging to the first group, NSPT can be applied instead of LFNST. Specifically, NSPT can be applied instead of the combination of a separable primary transform (e.g., DCT-2, separable KLT) and LFNST. For the four block sizes belonging to the first group, the NSPT index can be signaled, and for the remaining block sizes (where LFNST is allowed), the LFNST index can be signaled.

[0317] In this way, signaling the NSPT and LFNST indices with a single, unified syntax can reduce the amount of encoded information. Furthermore, by applying at least one of the binarization, CABAC context, or initial value for entropy coding to the NSPT / LFNST indices equally, implementation complexity can also be reduced.

[0318] Alternatively, the NSPT and LFNST indices can be signaled separately as separate syntaxes. This may increase implementation complexity somewhat, but can improve compression performance by performing optimized entropy coding for each index.

[0319] If the number of LFNST kernel candidates in the LFNST set is the same as the number of NSPT kernel candidates in the NSPT set, the same binarization can be applied to the LFNST index and the NSPT index. The same CABAC context (or CABAC context increment) can also be assigned to the bins of the LFNST index and the NSPT index.

[0320] Different binarization and / or CABAC contexts may be used for the LFNST index and the NSPT index. Different CABAC initial values ​​may be assigned to the LFNST index and the NSPT index. For example, one of the LFNST index and the NSPT index may be binarized based on fixed-length binarization, and the other may be binarized based on truncated unary binarization. Even if the binarization of the LFNST index and the NSPT index are the same, different CABAC contexts and / or CABAC initial values ​​may be assigned. If the number of LFNST kernel candidates in the LFNST set is different from the number of NSPT kernel candidates in the NSPT set, different binarization and / or CABAC contexts may be used for the LFNST index and the NSPT index.

[0321] The number of NSPT kernel candidates belonging to the NSPT set may be set differently for each block size. Alternatively, the block sizes belonging to the first group may be divided into multiple subgroups. In this case, the number of NSPT kernel candidates belonging to the NSPT set may be set differently for each of the multiple subgroups. Here, at least one of the multiple subgroups may include multiple different block sizes.

[0322] Depending on the number of NSPT kernel candidates in the NSPT set, the binarization applied to the NSPT index may be different.

[0323] For example, if the number of NSPT kernel candidates in the NSPT set for a specific block size is three, the NSPT index can have any value between 0 and 3. If the value of the NSPT index is 0, this may indicate that NSPT is not applied to the current block. If the value of the NSPT index is not 0, this may indicate the NSPT kernel candidate corresponding to the NSPT index among the three NSPT kernel candidates. A bin can be assigned to distinguish between cases where NSPT is applied and cases where it is not. A bin with a value of 0 may correspond to a case where the value of the NSPT index is 0. On the other hand, a bin with a value of 1 may correspond to a case where the value of the NSPT index is 1, 2, or 3. In this case, truncated unary binarization can be applied to distinguish the three NSPT kernel candidates. That is, by assigning two bins, 0, 10, and 11 can be distinguished as the three NSPT kernel candidates.

[0324] If there are two NSPT kernel candidates in the NSPT set for a specific block size, the NSPT index can have any value between 0 and 2. If the value of the NSPT index is 0, it may indicate that NSPT is not applied to the current block. If the value of the NSPT index is not 0, it may indicate the NSPT kernel candidate corresponding to the NSPT index among the two NSPT kernel candidates. A bin can be assigned to distinguish between cases where NSPT is applied and cases where it is not. The two NSPT kernel candidates can be distinguished by assigning a bin representing one of the two NSPT kernel candidates.

[0325] If there is only one NSPT kernel candidate in the NSPT set for a given block size, the NSPT index can have either 0 or 1. A value of 0 for the NSPT index may indicate that NSPT is not applied to the current block. A value of 1 for the NSPT index may indicate one NSPT kernel candidate. In this case, whether NSPT is applied and which NSPT kernel candidate can be specified can be determined with just one bin.

[0326] The inverse transform of the current block may be a separable linear transform and / or an LFNST-based inverse transform. That is, a reverse LFNST may be applied to all or part of the (inverse quantized) transform coefficients of the current block, and then a reverse separable linear transform may be applied to the transform coefficients derived through the LFNST to derive residual samples. For example, a reverse LFNST may be applied to the (inverse quantized) transform coefficients belonging to a certain region of the current block. Here, the certain region means a region to which the forward LFNST is applied, and is hereinafter referred to as a region of interest (ROI). The transform coefficients derived through the LFNST may be arranged in the ROI region according to a predetermined scanning order. The predetermined scanning order may be a row-first order or a column-first order. A reverse separable linear transform may be applied to the transform coefficients derived through the LFNST and the transform coefficients belonging to the remaining area excluding the ROI area within the current block. Alternatively, in the forward transform process, if zero-out is performed on the remaining area excluding the ROI area within the current block (i.e., if the transform coefficients within the remaining area are set to 0), a reverse separable linear transform may be applied to the transform coefficients derived through the LFNST. The size of the ROI area may be determined based on at least one of the width or the height of the current block. Here, the size of the ROI area may mean at least one of the width or the height of the ROI area, or may mean the number of sample positions belonging to the ROI area.

[0327] For the current block, LFNST defined for a 4x8 block (hereinafter referred to as LFNST4x8) or LFNST defined for an 8x4 block (hereinafter referred to as LFNST8x4) may be applied. When LFNST4x8 is applied to the current block, the ROI area of ​​the current block may be a 4x8 area within the current block. Here, the 4x8 area may refer to a block including the upper left sample of the current block and having a width and height of 4 and 8, respectively. When LFNST8x4 is applied to the current block, the ROI area of ​​the current block may be an 8x4 area within the current block. Here, the 8x4 area may refer to a block including the upper left sample of the current block and having a width and height of 8 and 4, respectively.

[0328] The above LFNST4x8 can be applied only when the current block is a 4x8 block. Alternatively, the LFNST4x8 can be applied when the current block is 4xN and N is greater than or equal to 8 (for example, when the current block is a 4x8, 4x16, 4x32, or larger block). Alternatively, the LFNST4x8 can be applied when the current block is 4xN and N is greater than or equal to 8 and less than or equal to a predetermined threshold. For example, when the threshold is 16, the LFNST4x8 can be applied when the current block is a 4x8 or 4x16 block.

[0329] The above LFNST8x4 can be applied only when the current block is an 8x4 block. Alternatively, the LFNST8x4 can be applied when the current block is Nx4 and N is greater than or equal to 8 (for example, when the current block is an 8x4, 16x4, 32x4, or larger block). Alternatively, the LFNST8x4 can be applied when the current block is Nx4 and N is greater than or equal to 8 and less than or equal to a predetermined threshold. For example, when the threshold is 16, the LFNST8x4 can be applied when the current block is an 8x4 or 16x4 block.

[0330] Specifically, when LFNST4x8 or LFNST8x4 is applied to the current block, LFNST having an input length less than or equal to 32 and an output length of 32 (hereinafter referred to as LFNST-32) may be used. The input length may refer to the number of transform coefficients input to LFNST. Here, the transform coefficients input to LFNST may refer to all transform coefficients derived based on the residual information of the current block, or may refer to transform coefficients to which forward LFNST is applied among the derived transform coefficients. The output length may refer to the number of transform coefficients derived through LFNST. The ROI area of ​​the current block may be composed of 32 sample locations. In this case, the dimension (or size) of the transform matrix for backward LFNST4x8 or LFNST8x4 may be 32xN. Here, N may be 16, 20, or 24. That is, the input length of LFNST-32 can be N, and the output length of LFNST-32 can be 32.

[0331] For example, if the size of the current block is 4xN, LFNST-32 can be applied to all or part of the transform coefficients belonging to a 4x8 region, which is a ROI region within the current block. The transform coefficients derived through LFNST-32 can be arranged in a predetermined scan order in the 4x8 region within the current block. Alternatively, if the size of the current block is Nx4, LFNST-32 can be applied to all or part of the transform coefficients belonging to an 8x4 region, which is a ROI region within the current block. The transform coefficients derived through LFNST-32 can be arranged in a predetermined scan order in the 8x4 region within the current block.

[0332] A transform kernel for LFNST-32 can be determined as one of one or more transform kernels (or LFNST kernel candidates) belonging to a transform set. For this purpose, an index specifying one of a plurality of transform kernels belonging to the transform set can be used. Here, the index can be signaled through the bitstream. The transform set of the current block can be determined as one of a plurality of pre-defined transform sets. For example, the transform set of the current block can be determined as one of 35 transform sets, and each transform set can include three transform kernels. The transform set of the current block can be determined based on the intra prediction mode of the current block, as described above. The plurality of transform sets for LFNST-32 can also be defined for LFNST4x8 and LFNST8x4, respectively.

[0333] However, as described above, LFNST4x8 and LFNST8x4 can be adaptively applied based on the size of the current block. If LFNST4x8 and LFNST8x4 are not applied to the current block, LFNST (hereinafter referred to as LFNST-16) with an input length less than or equal to 16 and an output length of 16 can be used. LFNST-16 can be applied to all or part of the transform coefficients belonging to the 4x4 region within the current block. The 4x4 region within the current block is a region including the upper left sample of the current block, and can mean a block with a width and height of 4 and 4, respectively. The transform coefficients derived through LFNST-16 can be arranged in a predetermined scan order in the 4x4 region within the current block.

[0334] From the perspective of forward transform, a separable linear transform can be applied to residual samples of the current block to derive transform coefficients. Forward LFNST can be applied to all of the derived transform coefficients or only to transform coefficients belonging to a portion of the current block (i.e., the ROI region). The transform coefficients derived through LFNST can be arranged in a predetermined scan order in the ROI region of the current block. If the number of transform coefficients output from LFNST is less than the number of transform coefficients input to LFNST, there may be a region in the ROI region that is not filled with the transform coefficients derived through LFNST. The region can be filled with transform coefficients that are 0. In addition, the remaining region of the current block excluding the ROI region (or the region to which LFNST is not applied) can be filled with transform coefficients derived through the separable linear transform or can be filled with transform coefficients that are 0 through zero-out.

[0335] Specifically, when LFNST4x8 or LFNST8x4 is applied to the current block or the ROI region of the current block, LFNST (hereinafter referred to as LFNST-32) having an input length of 32 and an output length less than or equal to 32 may be used. Here, the input length may mean the number of transform coefficients input to the LFNST. The input transform coefficients may be coefficients derived through a separable first-order transform. The input length may also mean the number of transform coefficients belonging to the ROI region of the current block. The output length may mean the number of transform coefficients derived through LFNST. The ROI region of the current block may be composed of 32 sample positions. In this case, the dimension of the transform matrix for the forward LFNST4x8 or LFNST8x4 may be Nx32. Here, N may be 16, 20, or 24. That is, the input length of LFNST-32 can be 32, and the output length of LFNST-32 can be N.

[0336] For example, if the size of the current block is 4xN, LFNST-32 can be applied to transform coefficients belonging to a 4x8 region, which is a ROI region within the current block. The transform coefficients derived through LFNST-32 can be arranged in a predetermined scan order in the 4x8 region within the current block. Alternatively, if the size of the current block is Nx4, LFNST-32 can be applied to transform coefficients belonging to an 8x4 region, which is a ROI region within the current block. The transform coefficients derived through LFNST-32 can be arranged in a predetermined scan order in the 8x4 region within the current block.

[0337] However, as described above, LFNST4x8 and LFNST8x4 can be adaptively applied based on the size of the current block. If LFNST4x8 and LFNST8x4 are not applied to the current block, LFNST (hereinafter referred to as LFNST-16) with input length and output length of 16 and 16, respectively, can be used. LFNST-16 can be applied to transform coefficients belonging to a 4x4 area within the current block. The 4x4 area within the current block is an area including the upper left sample of the current block, and can mean a block with a width and height of 4 and 4, respectively. Transform coefficients derived through LFNST-16 can be arranged in a predetermined scan order in the 4x4 area within the current block.

[0338] When applying LFNST4x8 or LFNST8x4 to the current block, the symmetry between the block shapes described above can be utilized. For example, the LFNST set and / or LFNST kernel for LFNST of the current block can be determined according to the symmetry between a 4xN block and an Nx4 block. A 4xN block (or an Nx4 block) can use the same LFNST set and / or LFNST kernel as an Nx4 block (or a 4xN block) that has symmetry therewith. For a block where N is 8, the symmetry described above can be utilized as is, and for a block where N is greater than or equal to 16, LFNST can be applied to the ROI region (i.e., a 4x8 region or an 8x4 region) within the current block using the symmetry described above.

[0339] In addition, LFNST for 8x16 blocks (hereinafter referred to as LFNST8x16) and LFNST for 16x8 blocks (hereinafter referred to as LFNST16x8) can be defined. When LFNST8x16 is applied to the current block, the ROI region of the current block can be a 4x8, 4x16, 8x8, or 8x16 region within the current block. Here, the ROI region is a region that includes the upper left sample of the current block, and may mean a block with the corresponding width and height. When LFNST16x8 is applied to the current block, the ROI region of the current block can be an 8x4, 16x4, 8x8, or 16x8 region within the current block. Here, the ROI region is a region that includes the upper left sample of the current block, and may mean a block with the corresponding width and height. The above ROI region may be identically preset for the encoding device and the decoding device for LFNST8x16 and LFNST16x8, respectively. The same ROI region may be set for blocks whose width and height are 8 and N, respectively. Alternatively, at least one of the blocks whose width and height are 8 and N, respectively, may have a different ROI region from the other one. Similarly, the same ROI region may be set for blocks whose width and height are N and 8, respectively. Alternatively, at least one of the blocks whose width and height are N and 8, respectively, may have a different ROI region from the other one.

[0340] The above LFNST8x16 can be applied only when the current block is an 8x16 block. Alternatively, the LFNST8x16 can be applied when the current block is 8xN and N is greater than or equal to 16 (for example, when the current block is an 8x16, 8x32, 8x64, or larger block). Alternatively, the LFNST8x16 can be applied when the current block is 8xN and N is greater than or equal to 16 and less than or equal to a predetermined threshold. For example, when the threshold is 32, the LFNST8x16 can be applied when the current block is an 8x16 or 8x32 block.

[0341] The above LFNST16x8 can be applied only when the current block is a 16x8 block. Alternatively, the LFNST16x8 can be applied when the current block is Nx8 and N is greater than or equal to 16 (for example, when the current block is a 16x8, 32x8, 64x8, or larger block). Alternatively, the LFNST16x8 can be applied when the current block is Nx8 and N is greater than or equal to 16 and less than or equal to a predetermined threshold. For example, when the threshold is 32, the LFNST16x8 can be applied when the current block is a 16x8 or 32x8 block.

[0342] Specifically, when LFNST8x16 or LFNST16x8 is applied to the current block, LFNST (hereinafter referred to as LFNST-K) having an input length less than or equal to K and an output length K can be used. As described above, the input length may mean the number of transform coefficients input to LFNST. Here, the transform coefficients input to LFNST may mean all transform coefficients derived based on the residual information of the current block, or may mean transform coefficients to which forward LFNST is applied among the derived transform coefficients. The output length may mean the number of transform coefficients derived through LFNST.

[0343] The above K can be determined based on the size of the ROI region of the current block. For example, if the ROI region is 4x8 or 8x4, LFNST with an input length less than or equal to 32 and an output length of 32 (i.e., LFNST-32) can be used. If the ROI region is 4x16, 16x4, or 8x8, LFNST with an input length less than or equal to 64 and an output length of 64 (i.e., LFNST-64) can be used. If the ROI region is 8x16 or 16x8, LFNST with an input length less than or equal to 128 and an output length of 128 (i.e., LFNST-128) can be used. That is, when LFNST8x16 or LFNST16x8 is applied to the current block of 8xN or Nx8, LFNST-K can be applied to the ROI region within the current block. Here, K can be 32, 64, or 128, but this is just an example, and K can be an integer greater than 128. The ROI region of the current block can consist of 128 sample locations. In this case, the dimension (or size) of the transformation matrix for the reverse LFNST8x16 or LFNST16x8 can be 128xN. Here, N can be 32, 40, or 48. That is, the input length of LFNST-128 can be N, and the output length of LFNST-128 can be 128.

[0344] When the size of the current block is 8xN, LFNST-K can be applied to all or part of the transform coefficients belonging to the ROI region within the current block. The transform coefficients derived through LFNST-K can be arranged in the ROI region within the current block according to a predetermined scan order. Alternatively, when the size of the current block is Nx8, LFNST-K can be applied to all or part of the transform coefficients belonging to the ROI region within the current block. The transform coefficients derived through LFNST-K can be arranged in the ROI region within the current block according to a predetermined scan order.

[0345] A transform kernel for LFNST-128 can be determined as one of one or more transform kernels (or LFNST kernel candidates) belonging to a transform set. For this purpose, an index specifying one of a plurality of transform kernels belonging to the transform set can be used. Here, the index can be signaled through the bitstream. The transform set of the current block can be determined as one of a plurality of pre-defined transform sets. For example, the transform set of the current block can be determined as one of 35 transform sets, and each transform set can include three transform kernels. The transform set of the current block can be determined based on the intra prediction mode of the current block, as described above. The plurality of transform sets for LFNST-128 can also be defined for LFNST8x16 and LFNST16x8, respectively.

[0346] However, as described above, LFNST8x16 and LFNST16x8 can be adaptively applied based on the size of the current block. If LFNST8x16 and LFNST16x8 are not applied to the current block, LFNST with an input length of 16 and an output length of 48 (hereinafter referred to as LFNST-48) can be used. LFNST-48 can be applied to transform coefficients belonging to a 4x4 region within the current block. The 4x4 region within the current block is a region including the upper left sample of the current block, and may mean a block with a width and height of 4 and 4, respectively. Transform coefficients derived through LFNST-48 can be arranged in a predetermined scan order in three 4x4 regions within the current block. The three 4x4 regions may be composed of a first 4x4 region containing the upper left sample of the current block, a second 4x4 region adjacent to the right of the first 4x4 region, and a third 4x4 region adjacent to the bottom of the first 4x4 region.

[0347] From the perspective of forward transform, a separable linear transform can be applied to residual samples of the current block to derive transform coefficients. Forward LFNST can be applied to all of the derived transform coefficients or only to transform coefficients belonging to a portion of the current block (i.e., the ROI region). The transform coefficients derived through LFNST can be arranged in a predetermined scan order in the ROI region of the current block. If the number of transform coefficients output from LFNST is less than the number of transform coefficients input to LFNST, there may be a region in the ROI region that is not filled with the transform coefficients derived through LFNST. The region can be filled with transform coefficients that are 0. In addition, the remaining region of the current block excluding the ROI region (or the region to which LFNST is not applied) can be filled with transform coefficients derived through the separable linear transform or can be filled with transform coefficients that are 0 through zero-out.

[0348] Specifically, when LFNST8x16 or LFNST16x8 is applied to the current block or the ROI region of the current block, an LFNST having an input length of K and an output length less than or equal to K (i.e., LFNST-K) may be used. Here, the input length may mean the number of transform coefficients input to the LFNST. The input transform coefficients may be coefficients derived through a separable first-order transform. The input length may also mean the number of transform coefficients belonging to the ROI region of the current block. The output length may mean the number of transform coefficients derived through LFNST. The ROI region of the current block may be composed of 128 sample positions. In this case, the dimension of the transform matrix for the forward LFNST8x16 or LFNST16x8 may be Nx128. Here, N may be 32, 40, or 48. That is, the input length of LFNST-128 can be 128, and the output length of LFNST-128 can be N.

[0349] For example, if the size of the current block is 8xN and N is greater than or equal to 16, LFNST-K can be applied to the transform coefficients belonging to the ROI region within the current block. The transform coefficients derived through LFNST-K can be arranged in the ROI region within the current block according to a predetermined scan order. Alternatively, if the size of the current block is Nx8 and N is greater than or equal to 16, LFNST-K can be applied to the transform coefficients belonging to the ROI region within the current block. The transform coefficients derived through LFNST-K can be arranged in the ROI region within the current block according to a predetermined scan order.

[0350] However, as described above, LFNST8x16 and LFNST16x8 can be adaptively applied based on the size of the current block. If LFNST8x16 and LFNST16x8 are not applied to the current block, LFNST with input length and output length of 48 and 16, respectively (i.e., LFNST-48) can be used. LFNST-48 can be applied to transform coefficients belonging to three 4x4 regions within the current block. The three 4x4 regions can be composed of a first 4x4 region containing the top-left sample of the current block, a second 4x4 region adjacent to the right of the first 4x4 region, and a third 4x4 region adjacent to the bottom of the first 4x4 region. The transform coefficients derived through LFNST-48 can be arranged in the 4x4 regions within the current block in a predetermined scan order.

[0351] When applying LFNST8x16 or LFNST16x8 to the current block, the symmetry between the block shapes described above can be utilized. For example, the LFNST set and / or LFNST kernel for LFNST-K of the current block can be determined according to the symmetry between an 8xN block and an Nx8 block. An 8xN block (or an Nx8 block) can utilize the same LFNST set and / or LFNST kernel as an Nx8 block (or an 8xN block) that has symmetry therewith. For a block where N is 16, the symmetry described above can be utilized as is, and for a block where N is greater than or equal to 32, LFNST can be applied to the ROI region (i.e., an 8x16 region or a 16x8 region) within the current block using the symmetry described above.

[0352] As mentioned above, LFNSTMx2M can be defined for Mx2M blocks and LFNST2MxM can be defined for 2MxM blocks. LFNSTMx2M can be applied to the current block of MxN, and LFNST2MxM can be applied to the current block of NxM. Here, N can be greater than or equal to (2*M). For example, M can be 16, and N can be greater than or equal to 32.

[0353] For LFNSTMx2M and LFNST2MxM, a ROI region can be defined, and an LFNST with a given input length and output length can be defined / used. The size of the ROI region can be determined based on the minimum value (i.e., M) of the width and height of the current block. The size of the ROI region can be different depending on the value of M. For example, the ROI region of an MxN block can be an Mx2M region within the MxN block. Here, the Mx2M region is a region including the upper left sample of the current block, and can mean a block whose width and height are M and 2M, respectively. The ROI region of an NxM block can be a 2MxM region within the NxM block. Here, the 2MxM region is a region including the upper left sample of the current block, and can mean a block whose width and height are 2M and M, respectively.

[0354] LFNSTMx2M or LFNST2MxM may be applied to the current block (or the ROI region of the current block). In this case, at least one of the input length and the output length of LFNST for the LFNSTMx2M or LFNST2MxM may be determined based on at least one of the minimum value of the width and height of the current block or the size of the ROI region. For example, the input length of LFNST may be less than or equal to (2*M*M), and the output length of LFNST may be (2*M*M). The input length may refer to the number of transform coefficients input to LFNST. Here, the transform coefficients input to LFNST may refer to all transform coefficients derived based on the residual information of the current block, or may refer to transform coefficients to which the forward LFNST is applied among the derived transform coefficients. The output length may refer to the number of transform coefficients derived through LFNST. The ROI area of ​​the current block can be composed of (2*M*M) sample locations. In this case, the dimension (or size) of the transformation matrix for the reverse LFNSTMx2M or LFNST2MxM can be (2*M*M)xL. That is, the input length of LFNST can be L, and the output length of LFNST can be (2*M*M). Here, the value of L can be set to be less than or equal to (2*M*M).

[0355] If the size of the current block is MxN, LFNST can be applied to all or part of the transform coefficients belonging to the Mx2M region, which is the ROI region within the current block. The transform coefficients derived through LFNST can be arranged in a predetermined scan order in the Mx2M region within the current block. Alternatively, if the size of the current block is NxM, LFNST can be applied to all or part of the transform coefficients belonging to the 2MxM region, which is the ROI region within the current block. The transform coefficients derived through LFNST can be arranged in a predetermined scan order in the 2MxM region within the current block.

[0356] The transform kernel for the LFNST may be determined as one of one or more transform kernels (or LFNST kernel candidates) belonging to a transform set. For this purpose, an index specifying one of a plurality of transform kernels belonging to the transform set may be used. Here, the index may be signaled through a bitstream. The transform set of the current block may be determined as one of a plurality of pre-defined transform sets. For example, the transform set of the current block may be determined as one of 35 transform sets, and each transform set may include three transform kernels. The transform set of the current block may be determined based on an intra prediction mode of the current block, as described above. The plurality of transform sets for the LFNST may be defined for LFNSTMx2M and LFNST2MxM, respectively.

[0357] From the perspective of forward transform, a separable linear transform can be applied to residual samples of the current block to derive transform coefficients. Forward LFNST can be applied to all of the derived transform coefficients or only to transform coefficients belonging to a portion of the current block (i.e., the ROI region). The transform coefficients derived through LFNST can be arranged in a predetermined scan order in the ROI region of the current block. If the number of transform coefficients output from LFNST is less than the number of transform coefficients input to LFNST, there may be a region in the ROI region that is not filled with the transform coefficients derived through LFNST. The region can be filled with transform coefficients that are 0. In addition, the remaining region of the current block excluding the ROI region (or the region to which LFNST is not applied) can be filled with transform coefficients derived through the separable linear transform or can be filled with transform coefficients that are 0 through zero-out.

[0358] Specifically, when LFNSTMx2M or LFNST2MxM is applied to the current block or the ROI region of the current block, an LFNST having an input length of (2*M*M) and an output length less than or equal to (2*M*M) can be used. Here, the input length may mean the number of transform coefficients input to the LFNST. The input transform coefficients may be coefficients derived through a separable first-order transform. The input length may also mean the number of transform coefficients belonging to the ROI region of the current block. The output length may mean the number of transform coefficients derived through LFNST. The ROI region of the current block may be composed of (2*M*M) sample positions. In this case, the dimension of the transform matrix for the forward LFNSTMx2M or LFNST2MxM may be Lx(2*M*M). That is, the input length of LFNST may be (2*M*M), and the output length of LFNST may be L. Here, the value of L can be set to be less than or equal to (2*M*M).

[0359] If the size of the current block is MxN, LFNST can be applied to the transform coefficients belonging to the Mx2M region, which is the ROI region within the current block. The transform coefficients derived through LFNST can be arranged in a predetermined scan order in the Mx2M region within the current block. Alternatively, if the size of the current block is NxM, LFNST can be applied to the transform coefficients belonging to the 2MxM region, which is the ROI region within the current block. The transform coefficients derived through LFNST can be arranged in a predetermined scan order in the 2MxM region within the current block.

[0360] When applying LFNSTMx2M or LFNST2MxM to the current block, the symmetry between the block shapes described above can be utilized. For example, the LFNST set and / or LFNST kernel for the LFNST of the current block can be determined according to the symmetry between an MxN block and an NxM block. An MxN block (or an NxM block) can use the same LNFST set and / or LFNST kernel as an NxM block (or an MxN block) that has symmetry therewith. For a block where N is 2M, the symmetry described above can be utilized as is, and for a block where N is greater than 2M, LFNST can be applied to the ROI region (i.e., an Mx2M region or a 2MxM region) within the current block using the symmetry described above.

[0361] LFNSTMxrM for M x rM blocks and LFNSTrMxM for rM x M blocks can be defined, where the value of r can be an integer greater than or equal to 2. rM represents (r*M), which can be considered to have the same meaning hereinafter. LFNSTMxrM can be applied to the current block of MxN, and LFNSTrMxM can be applied to the current block of NxM, where N can be greater than or equal to (r*M).

[0362] For LFNSTMxrM and LFNSTrMxM, ROI regions can be defined, respectively, and LFNST with a given input length and output length can be defined / used. The size of the ROI region can be determined based on the minimum value (i.e., M) of the width and height of the current block. The size of the ROI region can be different depending on the value of M. For example, the ROI region of an MxN block can be an M x rM region within the MxN block. Here, the M x rM region is a region including the upper left sample of the current block, and can mean a block whose width and height are M and rM, respectively. The ROI region of an NxM block can be an rM x M region within the NxM block. Here, the rM x M region is a region including the upper left sample of the current block, and can mean a block whose width and height are rM and M, respectively.

[0363] LFNSTMxrM or LFNSTrMxM may be applied to the current block (or the ROI region of the current block). In this case, at least one of the input length and the output length of LFNST for the LFNSTMxrM or LFNSTrMxM may be determined based on at least one of the minimum value of the width and height of the current block or the size of the ROI region. For example, the input length of LFNST may be less than or equal to (r*M*M), and the output length of LFNST may be (r*M*M). The input length may refer to the number of transform coefficients input to LFNST. Here, the transform coefficients input to LFNST may refer to all transform coefficients derived based on the residual information of the current block, or may refer to transform coefficients to which forward LFNST is applied among the derived transform coefficients. The output length may refer to the number of transform coefficients derived through LFNST. The ROI area of ​​the current block can be composed of (r*M*M) sample locations. In this case, the dimension (or size) of the transformation matrix for the reverse LFNSTMxrM or LFNSTrMxM can be (r*M*M)xL. That is, the input length of LFNST can be L, and the output length of LFNST can be (r*M*M). Here, the value of L can be set to be less than or equal to (r*M*M).

[0364] If the size of the current block is MxN, LFNST can be applied to all or part of the transform coefficients belonging to the M x rM region, which is the ROI region within the current block. The transform coefficients derived through LFNST can be arranged in a predetermined scan order in the M x rM region within the current block. Alternatively, if the size of the current block is NxM, LFNST can be applied to all or part of the transform coefficients belonging to the rM x M region, which is the ROI region within the current block. The transform coefficients derived through LFNST can be arranged in a predetermined scan order in the rM x M region within the current block.

[0365] The transform kernel for the LFNST may be determined as one of one or more transform kernels (or LFNST kernel candidates) belonging to a transform set. For this purpose, an index specifying one of a plurality of transform kernels belonging to the transform set may be used. Here, the index may be signaled through a bitstream. The transform set of the current block may be determined as one of a plurality of pre-defined transform sets. For example, the transform set of the current block may be determined as one of 35 transform sets, and each transform set may include three transform kernels. The transform set of the current block may be determined based on an intra prediction mode of the current block, as described above. The plurality of transform sets for the LFNST may be defined for LFNSTMxrM and LFNSTrMxM, respectively.

[0366] From the perspective of forward transform, a separable linear transform can be applied to residual samples of the current block to derive transform coefficients. Forward LFNST can be applied to all of the derived transform coefficients or only to transform coefficients belonging to a portion of the current block (i.e., the ROI region). The transform coefficients derived through LFNST can be arranged in a predetermined scan order in the ROI region of the current block. If the number of transform coefficients output from LFNST is less than the number of transform coefficients input to LFNST, there may be a region in the ROI region that is not filled with the transform coefficients derived through LFNST. The region can be filled with transform coefficients that are 0. In addition, the remaining region of the current block excluding the ROI region (or the region to which LFNST is not applied) can be filled with transform coefficients derived through the separable linear transform or can be filled with transform coefficients that are 0 through zero-out.

[0367] Specifically, when LFNSTMxrM or LFNSTrMxM is applied to the current block or the ROI region of the current block, an LFNST having an input length of (r*M*M) and an output length less than or equal to (r*M*M) may be used. Here, the input length may mean the number of transform coefficients input to the LFNST. The input transform coefficients may be coefficients derived through a separable first-order transform. The input length may also mean the number of transform coefficients belonging to the ROI region of the current block. The output length may mean the number of transform coefficients derived through LFNST. The ROI region of the current block may be composed of (r*M*M) sample positions. In this case, the dimension of the transform matrix for the forward LFNSTMxrM or LFNSTrMxM may be Lx(r*M*M). That is, the input length of the LFNST may be (r*M*M), and the output length of the LFNST may be L. Here, the value of L can be set to be less than or equal to (r*M*M).

[0368] If the size of the current block is MxN, LFNST can be applied to the transform coefficients belonging to the M x rM region, which is the ROI region within the current block. The transform coefficients derived through LFNST can be arranged in a predetermined scan order in the M x rM region within the current block. Alternatively, if the size of the current block is NxM, LFNST can be applied to the transform coefficients belonging to the rM x M region, which is the ROI region within the current block. The transform coefficients derived through LFNST can be arranged in a predetermined scan order in the rM x M region within the current block.

[0369] When applying LFNSTMxrM or LFNSTrMxM to the current block, the symmetry between the block shapes described above can be utilized. For example, the LFNST set and / or LFNST kernel for the LFNST of the current block can be determined according to the symmetry between an MxN block and an NxM block. An MxN block (or an NxM block) can equally utilize the LFNST set and / or LFNST kernel corresponding to an NxM block (or an MxN block) that has symmetry therewith. For a block where N is rM, the symmetry described above can be utilized as is, and for a block where N is greater than rM, LFNST can be applied using the symmetry described above to the ROI region (i.e., M x rM region or rM x M region) within the current block.

[0370] For example, when the value of M is 4 and the value of r is 4, LFNST4x16 and LFNST16x4 can be defined. LFNST4x16 can be applied to a 4xN current block, and LFNST16x4 can be applied to a Nx4 current block. Here, N can be greater than or equal to 16. When the current block is a 4xN block, the ROI region of the current block can be a 4x16 region within the current block. Here, the 4x16 region can mean a block that includes the upper left sample of the current block and has a width and height of 4 and 16, respectively. LFNST4x16 can be applied to the 4x16 region, which is the ROI region within the current block. Or, when the current block is an Nx4 block, the ROI region of the current block can be a 16x4 region within the current block. Here, the 16x4 region is a region that includes the upper left sample of the current block, and can mean a block with a width and height of 16 and 4, respectively. LFNST16x4 can be applied to the 16x4 region, which is the ROI region within the current block.

[0371] Based on the size of the current block, the aforementioned LFNSTMxrM (or LFNSTrMxM) can be adaptively applied to the current block.

[0372] Specifically, if either the width or the height of the current block is smaller than a predetermined threshold, LFNSTMxrM (or LFNSTrMxM) may be applied to the current block. On the other hand, if either the width or the height of the current block is greater than or equal to the predetermined threshold, LFNSTMxrM (or LFNSTrMxM) may not be applied to the current block. If either the width or the height of the current block is greater than or equal to the predetermined threshold, NSPT may be applied to the current block. For example, either the width or the height of the current block may be defined as the minimum value of the width or the height of the current block. The threshold may be defined as 8. In this case, if the current block is a 4xN block, LFNST4x8 may be applied to the current block. Or, if the current block is an Nx4 block, LFNST8x4 may be applied to the current block. Here, N may be an integer greater than or equal to 8. On the other hand, if the current block is an 8x16 block (or a 16x8 block), LFNST8x16 (or LFNST16x8) may not be applied to the current block. If the current block is an 8x16 block (or a 16x8 block), NSPT may be applied to the current block.

[0373] Alternatively, if either the width or the height of the current block is greater than or equal to a predetermined threshold, LFNSTMxrM (or LFNSTrMxM) may be applied to the current block. On the other hand, if either the width or the height of the current block is less than the predetermined threshold, LFNSTMxrM (or LFNSTrMxM) may not be applied to the current block. If either the width or the height of the current block is less than the predetermined threshold, NSPT may be applied to the current block. For example, either the width or the height of the current block may be defined as the maximum value of the width or the height of the current block. The threshold may be defined as 16. In this case, if the current block is a 4xL block, LFNST4x16 may be applied to the current block. Or, if the current block is a Lx4 block, LFNST16x4 may be applied to the current block. Here, L may be an integer greater than or equal to 16. On the other hand, if the current block is a 4x8 block (or an 8x4 block), LFNST4x8 (or LFNST8x4) may not be applied to the current block. If the current block is a 4x8 block (or an 8x4 block), NSPT may be applied to the current block.

[0374] Alternatively, if either the width or the height of the current block is greater than or equal to a predetermined threshold, LFNSTMxrM (or LFNSTrMxM) may be applied to the current block. On the other hand, if either the width or the height of the current block is less than the predetermined threshold, LFNSTMxrM (or LFNSTrMxM) may not be applied to the current block. If either the width or the height of the current block is less than the predetermined threshold, NSPT may be applied to the current block. For example, either the width or the height of the current block may be defined as the minimum value of the width or the height of the current block. The threshold may be defined as 8. In this case, if the current block is an 8xN block, LFNST8x16 may be applied to the current block. Or, if the current block is an Nx8 block, LFNST16x8 may be applied to the current block. Here, N may be an integer greater than or equal to 16. On the other hand, if the current block is a 4x8 block, an 8x4 block, a 4x16 block, or a 16x4 block, NSPT can be applied to the current block.

[0375] The ROI areas of LFNST4x8 and LFNST8x4 can be configured in the same manner as LFNST4. Here, LFNST4 means LFNST applied to a 4x4 block, and the ROI area of ​​LFNST4 can be a 4x4 block. That is, when LFNST is applied to a 4xN or Nx4 block, which is a block to which LFNST4x8 or LFNST8x4 can be applied, 16 transform coefficients are output, and the 16 output transform coefficients can be arranged in a 4x4 area within the 4xN or Nx4 block. Here, as discussed above, N can be an integer greater than or equal to 8. For example, N can be an integer of 8, 16, 32, or higher. The 4x4 area is an area including the upper left sample within the 4xN or Nx4 block, and can be an area whose width and height are 4 and 4, respectively.

[0376] The dimension (or size) of the transformation matrix for the above LFNST4x8 and LFNST8x4 may be configured identically to the LFNST4. For example, the dimension of the transformation matrix for LFNST4x8 and LFNST8x4 may be a 16x16 matrix. That is, when LFNST is applied to a 4xN or Nx4 block, 16 transformation coefficients belonging to the ROI region (i.e., 4x4 region) within the 4xN or Nx4 block may be input to the LFNST, and 16 transformation coefficients may be output through the LFNST. However, the present invention is not limited thereto, and the dimension of the transformation matrix for LFNST4x8 and LFNST8x4 may be configured differently from the LFNST4. For example, the input length of an LFNST for a 4x4 block may be different from the input length of an LFNST for a 4xN or Nx4 block, and the output length of an LFNST for a 4x4 block may be the same as the output length of an LFNST for a 4xN or Nx4 block. As described above, the input or output length of an LFNST may mean the number of transform coefficients input to or output from the LFNST.

[0377] From the perspective of forward transformation, when LFNST is applied to a 4xN or Nx4 block to which LFNST4x8 or LFNST8x4 can be applied, 16 transform coefficients belonging to a 4x4 area within the 4xN or Nx4 block can be input to LFNST. Here, as discussed above, N can be an integer greater than or equal to 8. For example, N can be an integer of 8, 16, 32, or higher. The 4x4 area includes the upper left sample within the 4xN or Nx4 block, and can be an area with a width and a height of 4 and 4, respectively.

[0378] The dimension (or size) of the transformation matrix for the above LFNST4x8 and LFNST8x4 may be configured identically to the LFNST4. For example, the dimension of the transformation matrix for LFNST4x8 and LFNST8x4 may be a 16x16 matrix. That is, when LFNST is applied to a 4xN or Nx4 block, 16 transformation coefficients belonging to the ROI region (i.e., 4x4 region) within the 4xN or Nx4 block may be input to the LFNST, and 16 transformation coefficients may be output through the LFNST. However, the present invention is not limited thereto, and the dimension of the transformation matrix for LFNST4x8 and LFNST8x4 may be configured differently from the LFNST4. For example, the input length of an LFNST for a 4x4 block may be the same as the input length of an LFNST for a 4xN or Nx4 block, and the output length of an LFNST for a 4x4 block may be different from the output length of an LFNST for a 4xN or Nx4 block.

[0379] At least one of the transform sets for LFNST4x8 and LFNST8x4, the number of transform kernels belonging to each transform set, or the determination of the transform set may be configured in the same manner as LFNST4. In other words, the transform sets for the 4x4 block, the number of transform kernels belonging to each transform set, or the determination method of the transform set may be equally applied to the 4xN or Nx4 blocks.

[0380] The ROI area of ​​LFNST8x16 and LFNST16x8 can be configured in the same manner as LFNST8. Here, LFNST8 means LFNST applied to an 8x8 block, and the ROI area of ​​LFNST8 can be an 8x8 block. That is, when LFNST is applied to an 8xN or Nx8 block, which is a block to which LFNST8x16 or LFNST16x8 can be applied, 64 transform coefficients are output, and the output 64 transform coefficients can be arranged in an 8x8 area within the 8xN or Nx8 block. Here, as discussed above, N can be an integer greater than or equal to 16. For example, N can be an integer of 16, 32, 64, or a higher integer. The 8x8 area is an area including the upper left sample within the 8xN or Nx8 block, and can be an area whose width and height are 8 and 8, respectively.

[0381] The dimension (or size) of the transformation matrix for the above LFNST8x16 and LFNST16x8 may be configured the same as that of the above LFNST8. For example, the dimension of the transformation matrix for LFNST8x16 and LFNST16x8 may be a 64x32 matrix. That is, when LFNST is applied to an 8xN or Nx8 block, 32 transformation coefficients belonging to the ROI region (i.e., 8x8 region) within the 8xN or Nx8 block may be input to the LFNST, and 64 transformation coefficients may be output through the LFNST. However, the present invention is not limited thereto, and the dimension of the transformation matrix for LFNST8x16 and LFNST16x8 may be configured differently from that of the above LFNST8. For example, the input length of an LFNST for an 8x8 block may be different from the input length of an LFNST for an 8xN or Nx8 block, and the output length of an LFNST for an 8x8 block may be the same as the output length of an LFNST for an 8xN or Nx8 block. The dimension of the transformation matrix for LFNST8 may be 64x16, and the dimensions of the transformation matrices for LFNST8x16 and LFNST16x8 may be 64x32 matrices. That is, the input length and output length of an LFNST for an 8x8 block may be 16 and 64, respectively. On the other hand, the input length and output length of an LFNST for an 8xN or Nx8 block may be 32 and 64, respectively. This means that 32 transform coefficients belonging to the ROI area (i.e., 8x8 area) within an 8xN or Nx8 block can be input to LFNST, and 64 transform coefficients can be output through LFNST.

[0382] From the perspective of forward transformation, when LFNST is applied to an 8xN or Nx8 block to which LFNST8x16 or LFNST16x8 can be applied, 64 transform coefficients belonging to an 8x8 area within the 8xN or Nx8 block can be input to the LFNST. Here, as discussed above, N can be an integer greater than or equal to 16. For example, N can be an integer of 16, 32, 64, or higher. The 8x8 area includes the upper left sample within the 8xN or Nx8 block, and can be an area with a width and height of 8 and 8, respectively.

[0383] The dimension (or size) of the transformation matrix for the above LFNST8x16 and LFNST16x8 may be configured the same as that of the above LFNST8. For example, the dimension of the transformation matrix for LFNST8x16 and LFNST16x8 may be a 32x64 matrix. That is, when LFNST is applied to an 8xN or Nx8 block, 64 transformation coefficients belonging to the ROI region (i.e., 8x8 region) within the 8xN or Nx8 block may be input to the LFNST, and 32 transformation coefficients may be output through the LFNST. However, the present invention is not limited thereto, and the dimension of the transformation matrix for LFNST8x16 and LFNST16x8 may be configured differently from that of the above LFNST8. For example, the input length of an LFNST for an 8x8 block may be the same as the input length of an LFNST for an 8xN or Nx8 block, and the output length of an LFNST for an 8x8 block may be different from the output length of an LFNST for an 8xN or Nx8 block. The dimension of the transformation matrix for LFNST8 may be 16x64, and the dimensions of the transformation matrices for LFNST8x16 and LFNST16x8 may be 32x64 matrices. That is, the input length and output length of an LFNST for an 8x8 block may be 64 and 16, respectively. On the other hand, the input length and output length of an LFNST for an 8xN or Nx8 block may be 64 and 32, respectively. This means that 64 transform coefficients belonging to the ROI area (i.e., 8x8 area) within an 8xN or Nx8 block can be input to LFNST, and 32 transform coefficients can be output through LFNST.

[0384] At least one of the transform sets for LFNST8x16 and LFNST16x8, the number of transform kernels belonging to each transform set, or the determination of the transform set may be configured in the same manner as LFNST8. In other words, the transform sets for the 8x8 block, the number of transform kernels belonging to each transform set, or the determination method of the transform set may be equally applied to the 8xN or Nx8 blocks.

[0385] The ROI area of ​​LFNST16x32 and LFNST32x16 can be configured in the same manner as LFNST16. Here, LFNST16 means LFNST applied to a 16x16 block, and the ROI area of ​​LFNST16 can be configured with one or more 4x4 blocks. For example, the ROI area of ​​LFNST16 can be configured with six 4x4 blocks within a 16x16 block. Here, the six 4x4 blocks can mean from the first 4x4 block to the sixth 4x4 block according to a predetermined scan order. That is, the ROI area of ​​LFNST16 can be configured with 96 sample positions. The scan order refers to an order according to a diagonal scan, but is not limited thereto, and vertical scan, horizontal scan, etc. may also be used.

[0386] In other words, when LFNST is applied to a 16xN or Nx16 block, which is a block to which LFNST16x32 or LFNST32x16 can be applied, 96 transform coefficients are output, and the output 96 transform coefficients can be arranged in the ROI area within the 16xN or Nx16 block. Here, as discussed above, N can be an integer greater than or equal to 32. For example, N can be an integer greater than or equal to 32, 64, or a higher integer.

[0387] The dimension (or size) of the transformation matrix for the above LFNST16x32 and LFNST32x16 may be configured in the same manner as the LFNST16. For example, the dimension of the transformation matrix for LFNST16x32 and LFNST32x16 may be a 96x32 matrix. That is, when LFNST is applied to a 16xN or Nx16 block, 32 transformation coefficients belonging to the ROI area within the 16xN or Nx16 block may be input to the LFNST, and 96 transformation coefficients may be output through the LFNST. However, the present invention is not limited thereto, and the dimension of the transformation matrix for LFNST16x32 and LFNST32x16 may be configured differently from the LFNST16. For example, the input length of an LFNST for a 16x16 block may be different from the input length of an LFNST for a 16xN or Nx16 block, and the output length of an LFNST for a 16x16 block may be the same as the output length of an LFNST for a 16xN or Nx16 block.

[0388] From the perspective of forward transformation, when LFNST is applied to a 16xN or Nx16 block, which is a block to which LFNST16x32 or LFNST32x16 can be applied, 96 transformation coefficients belonging to the ROI area within the 16xN or Nx16 block can be input to LFNST. Here, as discussed above, N can be an integer greater than or equal to 32. For example, N can be an integer greater than or equal to 32, 64, or a higher integer.

[0389] The dimension (or size) of the transformation matrix for the above LFNST16x32 and LFNST32x16 may be configured in the same manner as the LFNST16. For example, the dimension of the transformation matrix for LFNST16x32 and LFNST32x16 may be a 32x96 matrix. That is, when LFNST is applied to a 16xN or Nx16 block, 96 transformation coefficients belonging to the ROI area within the 16xN or Nx16 block may be input to the LFNST, and 32 transformation coefficients may be output through the LFNST. However, the present invention is not limited thereto, and the dimension of the transformation matrix for LFNST16x32 and LFNST32x16 may be configured differently from the LFNST16. For example, the input length of an LFNST for a 16x16 block may be the same as the input length of an LFNST for a 16xN or Nx16 block, and the output length of an LFNST for a 16x16 block may be different from the output length of an LFNST for a 16xN or Nx16 block.

[0390] At least one of the transform sets for LFNST16x32 and LFNST32x16, the number of transform kernels belonging to each transform set, or the determination of the transform set may be configured in the same manner as LFNST16. In other words, the transform sets for the 16x16 block, the number of transform kernels belonging to each transform set, or the determination method of the transform set may be equally applied to the 16xN or Nx16 blocks.

[0391] For MxN blocks, LFNST for square blocks or LFNST for non-square blocks can be applied. Here, M and N can each be an integer greater than or equal to 32. M and N can be the same or different. LFNST for the square block can mean LFNST16 described above. However, it is not limited thereto, and LFNST for the square block can mean LFNST4 or LFNST8. LFNST for the non-square block can mean LFNST16x32 (or LFNST32x16) described above. However, it is not limited thereto. For example, LFNST for the non-square block can mean LFNST8x16 (or LFNST16x8) described above, or LFNST4x8 (or LFNST8x4). The LFNST for the square block may be defined as an LFNST having the same output length as the LFNST for the non-square block and a different input length from the LFNST for the non-square block. Alternatively, the LFNST for the square block may be defined as an LFNST having different input lengths and output lengths from the LFNST for the non-square block. From a forward transform perspective, the LFNST for the square block may be defined as an LFNST having the same input length as the LFNST for the non-square block and a different output length from the LFNST for the non-square block. Alternatively, the LFNST for the square block may be defined as an LFNST having different input lengths and output lengths from the LFNST for the non-square block.

[0392] Specifically, LFNST for square blocks can be applied to all blocks where M and N are greater than or equal to 32. For example, LFNST16 can be applied to all blocks where M and N are greater than or equal to 32. Alternatively, LFNST8 can be applied to all blocks where M and N are greater than or equal to 32. Alternatively, LFNST4 can be applied to all blocks where M and N are greater than or equal to 32.

[0393] Alternatively, LFNST for square blocks can be applied for blocks where M and N are greater than or equal to 32 and M and N are the same. Conversely, LFNST for non-square blocks can be applied for blocks where M and N are greater than or equal to 32 and M and N are different. For example, LFNST16 can be applied for a 32x32 block, a 64x64 block, or a 128x128 block. Alternatively, LFNST8 can be applied for a 32x32 block, a 64x64 block, or a 128x128 block. Alternatively, LFNST4 can be applied for a 32x32 block, a 64x64 block, or a 128x128 block. LFNST16x32 can be applied for a 32x64 block, a 32x128 block, or a 64x128 block. Alternatively, LFNST8x16 may be applied to a 32x64 block, a 32x128 block, or a 64x128 block. Alternatively, LFNST4x8 may be applied to a 32x64 block, a 32x128 block, or a 64x128 block. LFNST32x16 may be applied to a 64x32 block, a 128x32 block, or a 128x64 block. Alternatively, LFNST16x8 may be applied to a 64x32 block, a 128x32 block, or a 128x64 block. Alternatively, LFNST8x4 may be applied to a 64x32 block, a 128x32 block, or a 128x64 block. Referring to FIG. 4, the current block may be restored based on the residual sample of the current block (S420).

[0394] Based on the intra prediction mode of the current block, a prediction sample for the current block can be derived. Based on the prediction sample and residual sample of the current block, a reconstruction sample for the current block can be generated.

[0395] FIG. 6 illustrates a schematic configuration of a decoding device (300) that performs an image decoding method according to the present disclosure.

[0396] Referring to FIG. 6, a decoding device (300) according to the present disclosure may include a transform coefficient derivation unit (600), a residual sample derivation unit (610), and a restoration block generation unit (620). The transform coefficient derivation unit (600) may be configured in the entropy decoding unit (310) of FIG. 3, the residual sample derivation unit (610) may be configured in the residual processing unit (320) of FIG. 3, and the restoration block generation unit (620) may be configured in the adding unit (340) of FIG. 3.

[0397] The transform coefficient derivation unit (600) can obtain residual information of the current block from the bitstream and decode it to derive the transform coefficient of the current block.

[0398] The residual sample derivation unit (610) can derive a residual sample of the current block by performing at least one of inverse quantization or inverse transformation on the transform coefficient of the current block.

[0399] The residual sample derivation unit (610) can determine a transformation kernel for the inverse transformation of the current block through a predetermined transformation kernel determination method, and derive the residual sample of the current block based on this. This has been described with reference to FIG. 4, and a detailed description thereof will be omitted here.

[0400] The restoration block generation unit (620) can restore the current block based on the residual sample of the current block.

[0401] FIG. 7 illustrates an image encoding method performed by an encoding device (200) as an embodiment according to the present disclosure.

[0402] Referring to FIG. 7, residual samples of the current block can be derived (S700).

[0403] The residual samples of the current block can be derived by differentiating prediction samples from the original samples of the current block. Here, the prediction samples can be derived based on a predetermined intra prediction mode.

[0404] Referring to FIG. 7, transform coefficients of the current block can be derived by performing at least one of transformation or quantization on the residual sample of the current block (S710).

[0405] The transformation method according to the present disclosure can be understood as the reverse process of the inverse transformation described with reference to FIG. 4. The method for determining the transformation kernel for the above transformation is as described with reference to FIG. 4. A detailed description thereof will be omitted here.

[0406] For example, one or more transformation sets for transformation of the current block can be defined / configured, and each transformation set can include one or more transformation kernel candidates. At this time, any one of the plurality of transformation sets can be selected as the transformation set of the current block. Any one of the plurality of transformation kernel candidates belonging to the transformation set of the current block can be selected. The selection can be performed implicitly based on the context of the current block. Alternatively, an optimal transformation set and / or transformation kernel candidate for the current block can be selected, and an index indicating the selection can be signaled.

[0407] Alternatively, the transform kernel of the current block may be determined based on an MTS set. One of a plurality of MTS sets may be selected based on at least one of the size of the current block or the intra prediction mode. The selected MTS set may include one or more transform kernel candidates. One of the one or more transform kernel candidates may be selected, and the transform kernel of the current block may be determined based on the selected transform kernel candidate. The selection of the transform kernel candidate may be performed using a transform kernel candidate index derived based on the context of the current block. Alternatively, an optimal transform kernel candidate for the current block may be selected, and a transform kernel candidate index indicating the selected transform kernel candidate may be signaled.

[0408] Alternatively, the transform kernel of the current block may be determined based on a non-separable linear transform (NSPT) kernel. If the size of the current block belongs to the first group, which is a set of block sizes to which the NSPT can be applied, the forward NSPT may be applied to the current block, and if the size of the current block belongs to the second group, the forward NSPT may not be applied to the current block. If the size of the current block belongs to the second group, the forward separable linear transform (e.g., DCT-2) may be applied to the residual samples of the current block to derive transform coefficients. The forward LFNST may additionally be applied to all or part of the transform coefficients derived through the separable linear transform.

[0409] In addition, the NSPT can be applied based on at least one of the tree type or component type of the current block. The NSPT kernel (or NSPT matrix) for the NSPT can be determined by utilizing the symmetry between intra prediction modes or the symmetry between block shapes. When the forward NSPT is applied to the current block of MxN, the NSPT kernel can be expressed as rx MN. Here, r means the output length of the NSPT or the number of transform coefficients generated by the NSPT, and MN can mean the input length of the NSPT or the number of residual samples to which the NSPT is applied as the product of the width and height of the current block. The method for determining the size of the NSPT kernel is as described with reference to FIG. 4.

[0410] The LFNST index and / or NSPT index for transformation may be encoded as a single integrated syntax, or the LFNST index and NSPT index may be encoded separately and inserted into the bitstream. Binarization of the LFNST index and NSPT index, and assignment of CABAC context and initial value are as described with reference to FIG. 4.

[0411] Additionally, we have looked at a method of signaling a transformation index with reference to FIG. 4, which can be equally applied to a method of encoding a transformation index.

[0412] Referring to Fig. 7, a bitstream can be generated by encoding the transform coefficients of the current block (S720).

[0413] Based on the transform coefficient of the current block, residual information about the transform coefficient can be generated, and a bitstream can be generated by encoding the residual information.

[0414] FIG. 8 illustrates a schematic configuration of an encoding device (200) that performs an image encoding method according to the present disclosure.

[0415] Referring to FIG. 8, an encoding device (200) according to the present disclosure may include a residual sample derivation unit (800), a transform coefficient derivation unit (810), and a transform coefficient encoding unit (820). The residual sample derivation unit (800) and the transform coefficient derivation unit (810) may be configured in the residual processing unit (230) of FIG. 2, and the transform coefficient encoding unit (820) may be configured in the entropy encoding unit (240) of FIG. 2.

[0416] The residual sample derivation unit (800) can derive a residual sample of the current block by differentiating a predicted sample from an original sample of the current block. Here, the predicted sample may be derived based on a predetermined intra prediction mode.

[0417] The transform coefficient derivation unit (810) can derive the transform coefficient of the current block by performing at least one of transform and quantization on the residual sample of the current block. The transform coefficient derivation unit (810) can determine the transform kernel of the current block based on at least one of the above-described embodiments 1 to 3, and derive the transform coefficient by applying the transform kernel to the residual sample of the current block.

[0418] The transform coefficient encoding unit (820) can generate a bitstream by encoding the transform coefficient of the current block.

[0419] In the embodiments described above, the methods are described based on a flowchart as a series of steps or blocks. However, the embodiments are not limited to the order of the steps, and some steps may occur in a different order or simultaneously with other steps described above. Furthermore, those skilled in the art will understand that the steps depicted in the flowchart are not exclusive, and other steps may be included, or one or more steps in the flowchart may be deleted without affecting the scope of the embodiments of this document.

[0420] The method according to the embodiments of the present document described above can be implemented in the form of software, and the encoding device and / or decoding device according to the present document can be included in a device that performs image processing, such as a TV, a computer, a smartphone, a set-top box, a display device, etc.

[0421] When the embodiments in this document are implemented as software, the above-described method can be implemented as a module (process, function, etc.) that performs the above-described function. The module can be stored in memory and executed by a processor. The memory can be internal or external to the processor and can be connected to the processor by various well-known means. The processor can include an application-specific integrated circuit (ASIC), another chipset, logic circuit, and / or data processing device. The memory can include a read-only memory (ROM), a random access memory (RAM), flash memory, a memory card, a storage medium, and / or other storage devices. That is, the embodiments described in this document can be implemented and performed on a processor, a microprocessor, a controller, or a chip. For example, the functional units illustrated in each drawing can be implemented and performed on a computer, a processor, a microprocessor, a controller, or a chip. In this case, information for implementation (e.g., information on instructions) or an algorithm can be stored on a digital storage medium.

[0422] In addition, the decoding device and encoding device to which the embodiment(s) of the present specification are applied may be included in a multimedia broadcasting transmitting and receiving device, a mobile communication terminal, a home cinema video device, a digital cinema video device, a surveillance camera, a video conversation device, a real-time communication device such as a video communication, a mobile streaming device, a storage medium, a camcorder, a video-on-demand (VoD) service providing device, an OTT (Over the top video) device, an Internet streaming service providing device, a three-dimensional (3D) video device, a VR (virtual reality) device, an AR (argumente reality) device, a video phone video device, a transportation terminal (ex. a vehicle (including an autonomous vehicle) terminal, an airplane terminal, a ship terminal, etc.), and a medical video device, and may be used to process a video signal or a data signal. For example, the OTT (Over the top video) device may include a game console, a Blu-ray player, an Internet-connected TV, a home theater system, a smartphone, a tablet PC, a DVR (Digital Video Recorder), etc.

[0423] In addition, the processing method to which the embodiment(s) of the present specification are applied can be produced in the form of a computer-executable program and can be stored in a computer-readable recording medium. Multimedia data having a data structure according to the embodiment(s) of the present specification can also be stored in a computer-readable recording medium. The computer-readable recording medium includes all types of storage devices and distributed storage devices in which computer-readable data is stored. The computer-readable recording medium can include, for example, a Blu-ray disc (BD), a universal serial bus (USB), a ROM, a PROM, an EPROM, an EEPROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device. In addition, the computer-readable recording medium includes a medium implemented in the form of a carrier wave (e.g., transmission via the Internet). In addition, a bitstream generated by an encoding method can be stored in a computer-readable recording medium or transmitted via a wired or wireless communication network.

[0424] Additionally, the embodiments of the present disclosure may be implemented as a computer program product by program code, and the program code may be executed on a computer by the embodiments of the present disclosure. The program code may be stored on a computer-readable carrier.

[0425] FIG. 9 illustrates an example of a content streaming system to which embodiments of the present disclosure can be applied.

[0426] Referring to FIG. 9, a content streaming system to which the embodiment(s) of the present specification are applied may largely include an encoding server, a streaming server, a web server, a media storage, a user device, and a multimedia input device.

[0427] The encoding server compresses content input from multimedia input devices such as smartphones, cameras, and camcorders into digital data, generates a bitstream, and transmits it to the streaming server. Alternatively, if multimedia input devices such as smartphones, cameras, and camcorders directly generate bitstreams, the encoding server may be omitted.

[0428] The above bitstream can be generated by an encoding method or a bitstream generation method to which the embodiment(s) of the present specification are applied, and the streaming server can temporarily store the bitstream during the process of transmitting or receiving the bitstream.

[0429] The streaming server transmits multimedia data to a user device based on a user request via a web server, and the web server acts as an intermediary to inform the user of available services. When a user requests a desired service from the web server, the web server transmits the request to the streaming server, and the streaming server transmits the multimedia data to the user. At this time, the content streaming system may include a separate control server, in which case the control server controls commands / responses between each device within the content streaming system.

[0430] The streaming server can receive content from a media repository and / or an encoding server. For example, when receiving content from the encoding server, the content can be received in real time. In this case, to provide a smooth streaming service, the streaming server can store the bitstream for a certain period of time.

[0431] Examples of the user devices may include mobile phones, smart phones, laptop computers, digital broadcasting terminals, personal digital assistants (PDAs), portable multimedia players (PMPs), navigation devices, slate PCs, tablet PCs, ultrabooks, wearable devices (e.g., smartwatches, smart glasses, HMDs), digital TVs, desktop computers, digital signage, etc.

[0432] Each server within the above content streaming system can be operated as a distributed server, in which case data received from each server can be processed in a distributed manner.

[0433] The claims set forth in this specification may be combined in various ways. For example, the technical features of the method claims of this specification may be combined and implemented as a device, and the technical features of the device claims of this specification may be combined and implemented as a method. Furthermore, the technical features of the method claims and the technical features of the device claims of this specification may be combined and implemented as a device, and the technical features of the method claims and the technical features of the device claims of this specification may be combined and implemented as a method.

Claims

1. A step of obtaining residual information from a bitstream; A step of deriving transform coefficients of the current block based on the residual information; A step of deriving residual samples of the current block by performing at least one of inverse quantization or inverse transformation on the transform coefficients of the current block; and A step of restoring the current block based on residual samples of the current block, The above inverse transform is performed based on at least one of a non-separable primary transform (NSPT) or a low frequency non-separable transform (LFNST), The above LFNST is applied to the transformation coefficients belonging to an area having a predetermined width (W) and height (H) within the current block, The width and height of the above region are determined based on at least one of the width or height of the current block, An image decoding method wherein the output length of the above LFNST is (W*H).

2. In paragraph 1, If the current block above is a 4xN block or an Nx4 block, LFNST with an output length of 32 is applied to the current block, A method for decoding an image, wherein the above N is an integer greater than or equal to 8.

3. In paragraph 1, If the current block is an 8xN block or an Nx8 block, an LFNST with an output length of 128 is applied to the current block, A method for decoding an image, wherein the above N is an integer greater than or equal to 16.

4. In paragraph 1, If the current block is a 4xN block or an Nx4 block, an LFNST with an output length of 64 is applied to the current block, A method for decoding an image, wherein the above N is an integer greater than or equal to 16.

5. In paragraph 1, If the current block is a 4xN block or an Nx4 block, an LFNST with an output length of 32 is applied to the current block, where N is an integer greater than or equal to 8. A video decoding method in which the NSPT is applied to the current block when the current block is an 8x16 block or a 16x8 block.

6. In paragraph 1, If the current block is a 4xN block or an Nx4 block, an LFNST with an output length of 64 is applied to the current block, where N is an integer greater than or equal to 16. A video decoding method in which the NSPT is applied to the current block when the current block is a 4x8 block or an 8x4 block.

7. In paragraph 1, If the current block is an 8xN block or an Nx8 block, an LFNST with an output length of 128 is applied to the current block, where N is an integer greater than or equal to 16. A video decoding method, wherein the NSPT is applied to the current block when the current block is a 4x8 block, an 8x4 block, a 4x16 block, or a 16x4 block.

8. In paragraph 1, A video decoding method, wherein, when the current block is a 4xN block or an Nx4 block, the output length of LFNST applied to the current block is the same as the output length of LFNST applied to a 4x4 block.

9. In paragraph 1, A video decoding method, wherein, when the current block is an 8xN block or an Nx8 block, the output length of LFNST applied to the current block is the same as the output length of LFNST applied to an 8x8 block.

10. In paragraph 1, A video decoding method, wherein, when the current block is a 16xN block or an Nx16 block, the output length of LFNST applied to the current block is the same as the output length of LFNST applied to a 16x16 block.

11. In paragraph 1, A method for decoding an image, wherein the inverse transformation is performed based on either an LFNST for a square block or an LFNST for a non-square block when the current block is larger than or equal to a 32x32 block.

12. Step of deriving residual samples of the current block; A step of deriving transform coefficients of the current block by performing at least one of transforming or quantizing residual samples of the current block; and Including a step of encoding the transform coefficients of the current block, The above transformation is performed based on at least one of a non-separable primary transform (NSPT) or a low frequency non-separable transform (LFNST), The above LFNST is applied to the transformation coefficients belonging to an area having a predetermined width (W) and height (H) within the current block, The width and height of the above region are determined based on at least one of the width or height of the current block, An image encoding method, wherein the input length of the above LFNST is (W*H).

13. A computer-readable storage medium storing a bitstream generated by the video encoding method according to Article 12.

14. A step of obtaining a bitstream for image information; wherein the bitstream is generated by deriving residual samples of a current block, deriving transform coefficients by performing at least one of transform or quantization on the residual samples of the current block, and encoding the transform coefficients of the current block. Including a step of transmitting data including the above bitstream, The above transformation is performed based on at least one of a non-separable primary transform (NSPT) or a low frequency non-separable transform (LFNST), The above LFNST is applied to the transformation coefficients belonging to an area having a predetermined width (W) and height (H) within the current block, The width and height of the above region are determined based on at least one of the width or height of the current block, A data transmission method in which the input length of the above LFNST is (W*H).

Citation Information

Patent Citations

  • An Apparatus for Opening and Closing a Bus Air Cleaner Capable of Removing Micro Particles with an Electrical Dust Collecting Function

    KR102260960B1

  • Image coding method and device based on non-separable second-order transform

    KR102489150B1

  • Muscle loss diagnosis system through multi-sensing and vision recognition

    KR102568107B1

  • Method, device, and medium for video processing

    WO2023051637A1

  • KR20210133300A