Method and device for encoding and decoding video

By employing intra-frame and inter-frame prediction techniques with arithmetic right shift operations and motion vector scaling, the method addresses high computational complexity in video encoding and decoding, improving efficiency for high-resolution video formats.

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

Patent Information

Application Number
JP2025097688
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2013-01-18
Filing Date
2025-06-11
Publication Date
2025-09-09

AI Technical Summary

Technical Problem

Existing video encoding and decoding technologies face high computational complexity, which hinders efficient processing of high-resolution video formats like UHD.

Method used

Implementing methods for intra-frame and inter-frame prediction that reduce computational complexity by using arithmetic right shift operations on two's complement integer representations and scaling motion vectors based on Picture Order Count (POC) differences.

Benefits of technology

Reduces computational complexity and enhances video encoding/decoding efficiency, particularly for high-resolution video formats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025131801000002
    Figure 2025131801000002
  • Figure 2025131801000003
    Figure 2025131801000003
  • Figure 2025131801000004
    Figure 2025131801000004
Patent Text Reader

Abstract

To provide an intra prediction and inter prediction method, and a video encoding and decoding method by reducing computation complexity.SOLUTION: A method for decoding a video comprises the steps of: restoring a residual block by performing inverse quantization and inverse transformation for an entropy-decoded residual block; generating a prediction block by performing intra prediction for a current block; and restoring a video by adding the restored residual block to the prediction block. The step of generating the prediction block further comprises a step for generating a final prediction value of a pixel to be predicted, on the basis of a first prediction value of the pixel to be predicted, which is included in the current block, and of a final correction value that is calculated by performing an arithmetic right shift by a binary digit 1 for a two's complement integer representation with respect to an initial correction value of the pixel to be predicted. Thus, the operational complexity during video encoding / decoding can be reduced.SELECTED DRAWING: None
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present invention relates to a method and apparatus for encoding and decoding video, and more particularly to an intra-frame prediction and an inter-frame prediction method with reduced computational complexity. [Background technology]

[0002] Recently, as HD (High Definition) broadcasting services have expanded not only in Korea but also around the world, many users have become accustomed to high-resolution, high-quality images, and as a result, many organizations are spurring the development of next-generation video equipment.In addition to HDTV, there is growing interest in UHD (Ultra High Definition), which has a resolution four times that of HDTV, and there is a demand for compression techniques for higher-resolution, high-quality images.

[0003] For video compression, techniques such as inter-prediction, which predicts pixel values ​​contained in a current picture from previous and / or subsequent pictures, intra-prediction, which predicts pixel values ​​contained in a current picture using pixel information within the current picture, and entropy coding, which assigns short codes to symbols that occur frequently and long codes to symbols that occur infrequently, can be used. Summary of the Invention [Problem to be solved by the invention]

[0004] An object of the present invention is to provide a video encoding method and apparatus capable of improving video encoding / decoding efficiency by reducing computational complexity.

[0005] Another technical object of the present invention is to provide a video decoding method and apparatus capable of improving video encoding / decoding efficiency by reducing computational complexity.

[0006] Another technical object of the present invention is to provide a method and apparatus for generating a predicted block, which can improve video encoding / decoding efficiency by reducing computational complexity.

[0007] Another technical object of the present invention is to provide an intra prediction method and apparatus capable of improving video encoding / decoding efficiency through reduced computational complexity.

[0008] Another technical object of the present invention is to provide an inter-prediction method and apparatus capable of improving video encoding / decoding efficiency through reduced computational complexity. [Means for solving the problem]

[0009] To achieve the above object, the video decoding method of the present invention includes the steps of: reconstructing a residual block by inverse quantizing and inverse transforming an entropy-decoded residual block; generating a predicted block by performing intra-frame prediction on a current block; and reconstructing an image by adding the reconstructed residual block to the predicted block. The predicted block generation step includes the step of generating a final predicted value of the pixel to be predicted based on a primary predicted value of the pixel to be predicted included in the current block and a final correction value calculated by performing an arithmetic right shift by one binary number on a two's complement integer representation of an initial correction value of the pixel to be predicted.

[0010] The predicted block generating step includes a step of determining whether to correct the intra-frame predicted value based on the coding information of the current block and the position of the pixel to be predicted within the current block, and a step of generating a final predicted value of the pixel to be predicted based on the determination result.

[0011] The determining whether to correct the intra prediction value includes determining whether to correct the intra prediction value in consideration of at least one of an intra prediction mode of the current block, luminance signal information, chrominance signal information, and a block size.

[0012] The determining whether to perform the correction includes determining whether to perform the correction for a pixel at a left boundary of the current block when the intra prediction mode of the current block is a vertical prediction mode.

[0013] The determining whether to perform the correction includes determining whether to perform the correction for pixels at an upper boundary of the current block when the intra prediction mode of the current block is a horizontal prediction mode.

[0014] The final predicted value generating step includes, when performing correction on an intra-screen predicted value, a step of obtaining a primary predicted value using reference pixel values ​​adjacent to the current block; a step of determining an initial correction value according to a horizontal or vertical position of the pixel to be predicted within the block; a step of calculating a final corrected value by performing an arithmetic right shift by 1 in binary on a two's complement integer representation of the initial correction value; and a step of calculating a final predicted value based on the primary predicted value and the final corrected value.

[0015] If the intra-screen prediction mode is a vertical prediction mode, correction is performed on a pixel at the left boundary of the current block, the primary predicted value is generated using an upper reference pixel value adjacent to the current block, and an initial correction value is determined using a difference between a left reference pixel value corresponding to a vertical position in the block of the pixel to be predicted and a pixel value of an upper left corner pixel of the current block. If the intra-screen prediction mode is a horizontal prediction mode, correction is performed on a pixel at the upper boundary of the current block, the primary predicted value is generated using a left reference pixel value adjacent to the current block, and an initial correction value is determined using a difference between an upper reference pixel value corresponding to a horizontal position in the block of the pixel to be predicted and a pixel value of an upper left corner pixel of the current block.

[0016] The final predicted value generation step includes, when no correction is performed on the intra-screen predicted value, generating a final predicted value of the pixel to be predicted based on upper reference pixel values ​​adjacent to the current block in a vertical prediction mode, and generating a final predicted value of the pixel to be predicted based on upper reference pixel values ​​adjacent to the current block in a horizontal prediction mode.

[0017] The video decoding method further includes a step of determining reference pixels to be used for intra-frame prediction for the pixel to be predicted, and the reference pixel determination step includes a step of determining reference pixels using already-restored pixels among pixels adjacent to the current block, and a step of smoothing-filtering pixel values ​​of the reference pixels.

[0018] To achieve the above object, the video decoding apparatus of the present invention includes a residual block reconstruction unit that reconstructs a residual block by inverse quantizing and inverse transforming an entropy-decoded residual block, a prediction block generation unit that generates a prediction block by performing intra prediction on a current block, and an image reconstruction unit that reconstructs an image by adding the reconstructed residual block to the prediction block, wherein the prediction block generation unit generates a final prediction value of the pixel to be predicted based on a primary prediction value of the pixel to be predicted included in the current block and a final correction value calculated by performing an arithmetic right shift by about 1 in binary on a two's complement integer representation of an initial correction value of the pixel to be predicted.

[0019] To achieve the above object, the video encoding method of the present invention includes the steps of: generating a predicted block by performing intra prediction on an input video; and entropy encoding a residual block, which is the difference between the predicted block predicted by the intra prediction and a current predicted block, by transforming and quantizing the residual block. The predicted block generation step includes the step of generating a final predicted value of the pixel to be predicted based on a primary predicted value of the pixel to be predicted included in the current block and a final correction value calculated by performing an arithmetic right shift by 1 in binary on a two's complement integer representation of the initial correction value of the pixel to be predicted.

[0020] To achieve the above object, the video coding apparatus of the present invention includes a prediction block generation unit that generates a prediction block by performing intra prediction on an input video, and an encoding unit that transforms and quantizes a residual block, which is the difference between the prediction block predicted by the intra prediction and a current prediction block, and entropy encodes the residual block. The prediction block generation step includes a step of generating a final prediction value of the pixel to be predicted based on a primary prediction value of the pixel to be predicted included in the current block and a final correction value calculated by performing an arithmetic right shift by about 1 in binary on a two's complement integer representation of the initial correction value of the pixel to be predicted.

[0021] To achieve the above object, the video decoding method of the present invention includes the steps of: inverse quantizing and inverse transforming an entropy-decoded residual block to reconstruct the residual block; generating a prediction block by performing inter-frame prediction on a current block using motion information of a reference block; and reconstructing an image by adding the reconstructed residual block to the prediction block, wherein the prediction block generation step includes the steps of determining whether a reference picture of the current block and a reference picture of the reference block are the same; and, if the determination result shows that they are not the same, scaling a motion vector of the reference block and using it to predict the current block.

[0022] The reference blocks used when deriving spatial or temporal motion vectors and when deriving temporal merge candidates include: i) when deriving spatial motion vectors, at least one of the bottom-most block adjacent to the left of the current block, the block adjacent to the bottom of the left-most block, the top corner block to the left of the current block, the top corner block to the right of the current block, and the top-rightmost block adjacent to the current block; and ii) when deriving temporal motion vectors and iii) when deriving temporal merge candidates, at least one of the blocks located inside and outside the corresponding position block that is spatially corresponding to the current block in the corresponding position picture of the current picture.

[0023] The predictive block generating step includes the steps of obtaining first and second values ​​based on a POC (Picture Order Count) difference value between the pictures, calculating an offset value by performing an arithmetic right shift by about 1 binary number on a two's complement integer representation of the absolute value of the first value to calculate an inversely proportional value of the first value, and calculating the scaling factor value based on the second value and the inversely proportional value of the first value.

[0024] i) In the case of spatial motion vector guidance, the first value is a difference value between the POC of the current picture and the POC of the reference picture referenced by the reference block, and the second value is a difference value between the POC of the current picture and the POC of the reference picture referenced by the current block; ii) in the case of temporal motion vector guidance or iii) in the case of temporal merge candidate guidance, the first value is a difference value between the POC of a co-located picture and the POC of a reference picture referenced by the current block and the co-located block in the co-located picture, and the second value is a difference value between the POC of the current block picture and the POC of the reference picture referenced by the current block.

[0025] The scaling factor value calculation step includes a step of calculating the scaling factor value by performing an addition operation and an arithmetic right shift operation based on the product of the inversely proportional values ​​of the second value and the first value, and a step of adjusting the scaling factor value to be within a specific range.

[0026] To achieve the above object, the video decoding apparatus of the present invention includes a residual block reconstruction unit that reconstructs a residual block by inverse quantizing and inverse transforming an entropy-decoded residual block, a prediction block generation unit that generates a prediction block by performing inter-frame prediction on a current block, and an image reconstruction unit that reconstructs an image by adding the reconstructed residual block to the prediction block, wherein the prediction block generation unit includes an identity determination unit that determines whether a reference picture of the current block and a reference picture of the reference block are the same, and a scaling unit that scales a motion vector of the reference block and uses it for predicting the current block if the determination result indicates that they are not the same.

[0027] To achieve the above object, the video encoding method of the present invention includes a step of generating a prediction block by performing inter-frame prediction on an input video, and a step of transforming and quantizing a residual block, which is the difference between the current input block and the prediction block predicted by inter-frame prediction, and entropy encoding the residual block, wherein the prediction block generation step includes a step of determining whether a reference picture of the current block and a reference picture of the reference block are the same, and if the determination result shows that they are not the same, a step of scaling a motion vector of the reference block and using it to predict the current block.

[0028] To achieve the above object, the video coding apparatus of the present invention includes a prediction block generation unit that generates a prediction block by performing inter-frame prediction on an input video, and a coding unit that transforms and quantizes a residual block, which is a difference between the current input block and the prediction block predicted by inter-frame prediction, and entropy codes the residual block. The prediction block generation unit includes an identity determination unit that determines whether a reference picture of the current block and a reference picture of the reference block are the same, and a scaling unit that, if the determination result indicates that they are not the same, scales a motion vector of the reference block and uses it for predicting the current block. [Effects of the Invention]

[0029] According to the video encoding method of the present invention, it is possible to reduce the computational complexity and improve the video encoding / decoding efficiency.

[0030] According to the video decoding method of the present invention, it is possible to reduce the computational complexity and improve the video encoding / decoding efficiency.

[0031] According to the method for generating a predicted block according to the present invention, it is possible to reduce the computational complexity and improve the efficiency of video encoding / decoding.

[0032] According to the intra prediction method according to the present invention, it is possible to reduce the computational complexity and improve the efficiency of video encoding / decoding.

[0033] According to the inter prediction method according to the present invention, it is possible to reduce the computational complexity and improve the efficiency of video encoding / decoding. [Brief explanation of the drawings]

[0034] [Figure 1] 1 is a block diagram showing a configuration of an embodiment of a video encoding device to which the present invention is applied. [Figure 2] 1 is a block diagram showing a configuration of an embodiment of a video decoding device to which the present invention is applied; [Figure 3] 10 is a flowchart illustrating a process of calculating a final predicted value of a current block in a video encoding / decoding method according to an embodiment of the present invention. [Figure 4] 10 is a flowchart outlining an example of a process for determining reference pixels to be used in intra prediction. [Figure 5] 10 illustrates an example of substitution of unavailable pixels in the process of determining reference pixels to be used in intra prediction. [Figure 6] 10 is a flowchart illustrating an example of a process for determining whether to correct an intra prediction value according to coding information of a current block and a position of a pixel to be predicted; [Figure 7a] 10 illustrates an example in which a first predicted value for a pixel in a current block is used as a final predicted value in a vertical prediction mode. [Figure 7b] 10 illustrates an example where a first predicted value for a pixel in a current block is used as a final predicted value in a horizontal prediction mode. [Figure 8] 10 is a flow chart that illustrates an example of calculating a final predicted value by performing a correction on a first predicted value for pixels in a current block; [Figure 9a] 10A and 10B show schematic diagrams of an embodiment in which a final predicted value is calculated by performing corrections on a primary predicted value when using vertical mode. [Figure 9b] 10A and 10B show schematic diagrams of an embodiment in which a final predicted value is calculated by performing corrections on a primary predicted value when using horizontal mode. [Figure 10] 10 is a flowchart illustrating a scaling process of a video encoding / decoding method according to another embodiment of the present invention. [Figure 11a] It indicates a POC (Picture Order Count) difference value between the current picture and the reference picture of the spatial reference block, and a POC difference value between the current picture and the reference picture of the current block. [Figure 11b] It indicates the POC difference value between the reference picture of the corresponding position block and the corresponding position picture, and the POC difference value between the current picture and the reference picture of the current block. [Figure 12] 10 is a flowchart outlining an embodiment of a process for calculating scaling factor values ​​for motion vectors based on POC difference values. [Figure 13] FIG. 10 is a block diagram illustrating a schematic configuration for calculating a final scaling factor value based on the inversely proportional values ​​of the tb and td values. DETAILED DESCRIPTION OF THE INVENTION

[0035] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings. In describing the examples of this specification, if a detailed description of related known configurations or functions is deemed to obscure the gist of this specification, the detailed description will be omitted.

[0036] When a component is referred to as being "coupled" or "connected" to another component, it should be understood that the component may be directly coupled or connected to the other component, but that there may be other components in between. Furthermore, in the present invention, when a component is described as "including" a specific component, it does not exclude components other than the component, but rather means that additional components may be included within the scope of the implementation or technical idea of ​​the present invention.

[0037] Terms such as "first" and "second" may be used to describe various components, but the components should not be limited by these terms. These terms are used only to distinguish one component from another. For example, a first component may be called a "second component," and similarly, a second component may be called a "first component," without departing from the scope of the present invention.

[0038] Furthermore, the components shown in the embodiments of the present invention are illustrated independently to show different characteristic functions, and do not mean that each component is configured as a separate hardware or software unit. That is, each component is included as a separate component for the convenience of explanation, and at least two of the components may be integrated into one component, or one component may be divided into multiple components to perform its function. Such integrated and separated embodiments of each component are also included in the scope of the present invention as long as they do not deviate from the essence of the present invention.

[0039] In addition, in the present invention, some components are not essential components for performing essential functions but are optional components merely for improving performance. The present invention may be embodied including only components essential for embodying the essence of the present invention, excluding components merely used for improving performance, and a structure including only essential components, excluding optional components merely used for improving performance, is also included in the scope of the present invention.

[0040] FIG. 1 is a block diagram showing the configuration of an embodiment of a video encoding device to which the present invention is applied.

[0041] 1, the video encoding device 100 includes a motion prediction unit 111, a motion compensation unit 112, an intra prediction unit 120, a switch 115, a subtractor 125, a transform unit 130, a quantization unit 140, an entropy encoding unit 150, an inverse quantization unit 160, an inverse transform unit 170, an adder 175, a filter unit 180, and a reference video buffer 190. Here, the term "video" may be used interchangeably with the term "picture" described below.

[0042] The video encoding device 100 can output a bitstream by encoding the input video in intra mode or inter mode. Intra prediction means intra-frame prediction, and inter prediction means inter-frame prediction. In the intra mode, the switch 115 is switched to intra, and in the inter mode, the switch 115 is switched to inter. The video encoding device 100 can generate a predicted block for an input block of the input video, and then encode the difference between the input block and the predicted block.

[0043] In the case of the intra mode, the intra prediction unit 120 may generate a predicted block by performing spatial prediction using pixel values ​​of previously coded blocks surrounding the current block.

[0044] In the inter mode, the motion prediction unit 111 may search for an area that closely matches the input block in a reference image stored in the reference image buffer 190 during the motion prediction process to obtain a motion vector. The motion compensation unit 112 may generate a prediction block by performing motion compensation using the motion vector. Here, the motion vector is a two-dimensional vector used in inter prediction and may indicate an offset between a current image to be coded / decoded and a reference image.

[0045] The subtractor 125 can generate a residual block based on the difference between the input block and the generated prediction block. The transform unit 130 can output transform coefficients by performing a transform on the residual block. The quantization unit 140 can output quantized coefficients by quantizing the input transform coefficients using a quantization parameter.

[0046] The entropy coding unit 150 can output a bit stream by performing entropy coding based on the value calculated by the quantization unit 140 or the coding parameter value calculated during the coding process.

[0047] When entropy coding is applied, fewer bits are assigned to symbols with higher occurrence probabilities and more bits are assigned to symbols with lower occurrence probabilities to represent the symbols, thereby reducing the size of the bit string for the symbols to be coded. Therefore, the compression performance of video coding can be improved through entropy coding. The entropy coding unit 150 can use coding methods such as exponential golomb, CAVLC (Context-Adaptive Variable Length Coding), and CABAC (Context-Adaptive Binary Arithmetic Coding) for entropy coding.

[0048] 1 performs inter-prediction coding, i.e., inter-frame predictive coding, so that a currently coded image needs to be decoded and stored to be used as a reference image. Therefore, the quantized coefficients are inversely quantized by an inverse quantization unit 160 and inversely transformed by an inverse transform unit 170. The inversely quantized and inversely transformed coefficients are added to a predicted block via an adder 175 to generate a reconstructed block.

[0049] The reconstructed block passes through the filter unit 180, which can apply at least one of a deblocking filter, a sample adaptive offset (SAO), and an adaptive loop filter (ALF) to the reconstructed block or the reconstructed picture. The filter unit 180 is also called an adaptive in-loop filter. The deblocking filter can remove block distortion that occurs at boundaries between blocks. The SAO can add an appropriate offset value to pixel values ​​to compensate for coding errors. The ALF can perform filtering based on a value obtained by comparing a reconstructed image with an original image. The reconstructed block that has passed through the filter unit 180 can be stored in the reference image buffer 190.

[0050] FIG. 2 is a block diagram showing the configuration of an embodiment of a video decoding device to which the present invention is applied.

[0051] Referring to FIG. 2, the video decoding apparatus 200 includes an entropy decoding unit 210, an inverse quantization unit 220, an inverse transform unit 230, an intra prediction unit 240, a motion compensation unit 250, an adder 255, a filter unit 260, and a reference video buffer 270.

[0052] The video decoding apparatus 200 receives a bitstream output from an encoder and performs decoding in an intra mode or an inter mode to output a reconstructed image, i.e., a restored image. In the intra mode, a switch is set to intra, and in the inter mode, a switch is set to inter. The video decoding apparatus 200 obtains a reconstructed residual block from the input bitstream, generates a prediction block, and then generates a reconstructed block, i.e., a restored block, by adding the reconstructed residual block and the prediction block.

[0053] The entropy decoding unit 210 may entropy decode the input bitstream according to a probability distribution to generate symbols including symbols in the form of quantized coefficients. The entropy decoding method is similar to the entropy coding method described above.

[0054] When the entropy decoding method is applied, a smaller number of bits are assigned to symbols having a higher occurrence probability, and a larger number of bits are assigned to symbols having a lower occurrence probability, thereby reducing the size of the bit string for each symbol. Therefore, the entropy decoding method can improve the compression performance of video decoding.

[0055] The quantized coefficients are inverse quantized in the inverse quantization unit 220 and inverse transformed in the inverse transform unit 230, and a reconstructed residual block can be generated as a result of the inverse quantization / inverse transformation of the quantized coefficients.

[0056] In the case of the intra mode, the intra prediction unit 240 may generate a predicted block by performing spatial prediction using pixel values ​​of already coded / decoded blocks surrounding the current block. In the case of the inter mode, the motion compensation unit 250 may generate a predicted block by performing motion compensation using a motion vector and a reference image stored in the reference image buffer 270.

[0057] The reconstructed residual block and the prediction block are added via an adder 255, and the added block may pass through a filter unit 260. The filter unit 260 may apply at least one of a deblocking filter, SAO, and ALF to the reconstructed block or the reconstructed picture. The filter unit 260 may output a reconstructed image, i.e., a reconstructed image. The reconstructed image may be stored in a reference image buffer 270 and used for inter prediction.

[0058] Hereinafter, the term "unit" refers to a unit of video encoding and decoding. When video is divided and encoded or decoded, the encoding or decoding unit refers to the divided unit, and is therefore also referred to as a block, coding unit (CU), prediction unit (PU), transform unit (TU), etc. In the embodiments described below, a unit is also referred to as a block. One unit may be divided into smaller sub-units. In addition, in this specification, a "current block" refers to a block to be subjected to intra prediction or motion compensation. When intra prediction is performed, the current block refers to any one of a prediction unit, a prediction block, a transform unit, and a transform block. When motion compensation is performed, the current block refers to any one of a prediction unit and a prediction block.

[0059] FIG. 3 is a flowchart illustrating a process of calculating a final predicted value of a current block in a video encoding / decoding method according to an embodiment of the present invention.

[0060] Referring to FIG. 3, a video encoding / decoding apparatus according to an embodiment of the present invention calculates a final predicted value based on reference pixels to generate a predicted block for a current block. To do so, the video encoding / decoding apparatus obtains pixel values ​​of reference pixels to be used for intra-frame prediction (S310). The reference pixels may be pixels that have already been reconstructed among pixels adjacent to the current block. If a pixel at an adjacent position is unavailable, the pixel value of the unavailable pixel may be substituted for the corresponding reference pixel value. After obtaining the reference pixels, the apparatus obtains coding information of the current block and position information of the pixel to be predicted within the block (S320). Then, the apparatus determines whether correction of the primary predicted value via the reference pixel value is necessary based on the coding information and the position information of the pixel to be predicted within the block (S330). The determination may be made based on at least one of intra-frame prediction mode information, luminance signal information, chrominance signal information, and block size.

[0061] If it is determined that correction is not necessary, the video encoding / decoding apparatus may directly use the primary predicted value as the final predicted value of the current block (S340). On the other hand, if it is determined that correction is necessary, the video encoding / decoding apparatus may obtain the primary predicted value and a correction value, and then calculate a final predicted value by adding the primary predicted value and the correction value (S350). Since the calculation of the correction value generally involves considerable computational complexity, an arithmetic right shift operation may be considered to reduce this complexity. The arithmetic right shift operation (“>>”) has the characteristic of not changing the sign of the operand and, unlike a typical integer division operation (“ / ”), which rounds its result toward zero, it rounds its result toward negative infinity.

[0062] FIG. 4 is a flowchart outlining an embodiment of a process for determining reference pixels to be used in intra prediction.

[0063] 4, the encoding / decoding apparatus determines whether pixel values ​​of neighboring blocks are available based on pixel information of neighboring blocks for a current block (S410). The pixel values ​​of the neighboring blocks cannot be used if the neighboring blocks are: (i) outside a picture boundary; (ii) outside a slice / tile boundary; or (iii) CIP (constrained_intra_pred_flag) is 1, i.e., the current block is a CIP-applied block and the neighboring blocks are blocks coded using inter-frame prediction. If the pixel values ​​of the neighboring blocks cannot be used as reference pixel values, the corresponding reference pixel values ​​may be replaced with available pixel values ​​of other neighboring blocks or specific base values ​​(S420).

[0064] FIG. 5 shows an example of substitution of unavailable pixels in the process of determining reference pixels to be used in intra prediction.

[0065] 5, neighboring blocks of a current block 500 can be used to obtain reference pixel values. The neighboring blocks that can be used to obtain the reference pixel values ​​include a neighboring block to the current block 500, a neighboring block adjacent to the bottom left neighboring block as high as the current block 500, and a neighboring block adjacent to the right of the top right neighboring block as wide as the current block 500. Of the neighboring blocks, only pixels located around the current block 500 can be used as reference pixels.

[0066] In this case, if a neighboring block cannot be used to calculate the reference pixel value, a usable pixel value from another neighboring block can be used instead. In Figure 5, among the neighboring blocks of the current block 500, the shaded blocks are usable blocks, and the other blocks are unusable blocks.

[0067] According to one embodiment of the present invention, a video encoding / decoding apparatus may determine whether pixels adjacent to a current block 500 are usable and store the determination result. For example, in Figure 5, pixels belonging to shaded blocks may be determined as usable pixels, and pixels belonging to unshaded blocks may be determined as unusable pixels and stored. In this case, if there is one or more unusable pixels, the unusable pixel values ​​may be replaced with usable pixel values.

[0068] Starting from pixel 520 at position A in FIG. 5 , moving to pixel 522 at position B allows for the substitution of unavailable pixels with the value of the immediately preceding available pixel. If starting pixel 520 is unavailable, the pixel value of the first available pixel 512 can be substituted for the value of starting pixel 520 as the process moves from position A to position B. In the case of surrounding blocks 510, 530, and 532, surrounding block 510 is an available block, and surrounding blocks 530 and 532 are unavailable blocks. Therefore, starting pixel 520 is an unavailable pixel. As the process moves from position A to position B, the pixel value of the first available pixel 512 can be substituted for starting pixel 520. The pixels of surrounding block 530 can be substituted with the pixel value of pixel 512, and the pixels of surrounding block 532 can be substituted with the pixel value of pixel 514, the immediately preceding available pixel. In this manner, unavailable pixels can be substituted with available pixel values ​​up to position B.

[0069] Referring again to FIG. 4, if the pixel values ​​of the surrounding blocks can be used as a result of determining whether the surrounding block pixels can be used, the pixel values ​​of the surrounding blocks can be used as reference pixel values ​​as they are (S422).

[0070] The video encoding / decoding apparatus may perform smoothing filtering on the obtained reference pixel values ​​(S430). At this time, the smoothing filtering may be performed differently depending on the size of the current block or the intra-frame prediction mode.

[0071] FIG. 6 is a flowchart illustrating an example of a process for determining whether to correct an intra-frame predicted value according to coding information of a current block and a position of a pixel to be predicted.

[0072] 6, a video encoding / decoding apparatus may determine whether to perform compensation based on coding information of a current block and a position of a pixel to be predicted within a block. The coding information used to determine whether to perform compensation may include at least one of intra-frame prediction mode information, luminance signal information, chrominance signal information, and block size, as described above.

[0073] To determine whether to perform compensation, the video encoding / decoding apparatus first determines whether the intra prediction mode of the current block is a vertical prediction mode (S610). If the prediction mode is a vertical prediction mode, it determines whether the pixel to be predicted is a pixel located at the left boundary of the current block (S612). If the pixel is located at the left boundary, it determines whether to perform compensation (S632). If the intra prediction mode is a vertical prediction mode and the pixel is not located at the left boundary, compensation is not performed (S630). The determination of the vertical prediction mode and the horizontal prediction mode may be performed with reference to the following description. When determining the horizontal prediction mode, it may strictly determine whether the prediction direction is exactly horizontal, or it may determine whether the prediction direction is close to the horizontal direction using a more relaxed condition. For example, when determining the horizontal prediction mode, it may determine that the prediction mode is a horizontal prediction mode if the prediction direction of the prediction mode to be determined is within 30 degrees of the horizontal direction. In this case, the angle used as the determination criterion is not necessarily limited to 30 degrees, but may be set based on other angles. When determining the vertical prediction mode, it is also possible to determine whether the prediction direction is close to the vertical direction using relaxed conditions, as in the case of determining the horizontal prediction mode. Although the following embodiments are described assuming that the horizontal and vertical directions are strictly determined, the present invention is not limited to such an embodiment, and determining the horizontal and / or vertical directions using the relaxed conditions as described above is also part of the present invention.

[0074] In addition, it is determined whether the prediction mode is horizontal (S620). The vertical prediction mode and horizontal prediction mode determination processes (S610, S620) are not related to each other and may be performed in reverse order. If the prediction mode is horizontal, it is determined whether the pixel to be predicted is a pixel located at the upper boundary of the current block (S622). If the pixel is located at the upper boundary, correction is performed (S632). If the intra prediction mode is horizontal and the pixel is not located at the upper boundary, no correction is performed (S630). If the intra prediction mode is neither vertical nor horizontal, no correction is performed on the predicted value for the current block (S630).

[0075] According to one embodiment of the present invention, correction of the predicted value of the current block is performed only for the luminance (luma) signal, taking into account at least one of the intra-frame prediction mode and block size, as described above, and is not performed for the chrominance (chroma) signal.

[0076] According to another embodiment of the present invention, prediction value correction can be performed on blocks smaller than 32x32, i.e., blocks of 4x4, 8x8, and 16x16 sizes.

[0077] According to another embodiment of the present invention, when the inter prediction mode is a DC mode, correction can be performed on pixels at the upper and left boundaries of the current block.

[0078] Figure 7a schematically illustrates an example in which a first predicted value for a pixel in a current block is used as a final predicted value in vertical prediction mode, and Figure 7b schematically illustrates an example in which a first predicted value for a pixel in a current block is used as a final predicted value in horizontal prediction mode.

[0079] Referring to Figures 7a and 7b, if the video encoding / decoding device determines in the correction / non-correction determining step (S330) that correction of the predicted value is not to be performed based on at least one of the intra-frame prediction mode, luminance signal, chrominance signal information, and block size, it obtains a first predicted value and then determines the first predicted value as the final predicted value for the current block 710 without performing correction.

[0080] In this case, the first-order predicted value (pred1[x,y]) may be obtained based on the reference pixel value. p[x,y], which will be described later, refers to the reference pixel value at the [x,y] position. In the following embodiments, the values ​​may range from x=-1,...,BlockWidth-1, and y=-1,...,BlockHeight-1. Here, BlockWidth refers to the width of the current block, and BlockHeight refers to the height of the current block. The embodiments related to Figures 7a and 7b illustrate an example of a 4x4 block. In this case, the reference pixels may range from x=-1,...,3 and y=-1,...,3, and the pixels of the current block may range from x=0,...,3 and y=0,...,3.

[0081] Referring to FIG. 7a, in the case of vertical prediction, the first predicted value (pred1[x,y]) can be determined as the upper reference pixel values ​​722, 724, 726, and 728 adjacent to the current block.

[0082] [Number 1] pred1[x,y]=p[x,-1](x=0,...,BlockWidth-1;y=0,...,BlockHeight-1)

[0083] Assuming that the upper left position of the current block is [0,0], the pixel on the left boundary of the current block 710 uses pixel 722 at position [0,-1], the pixel on the second left column uses pixel 724 at position [-1,-1], the pixel on the third left column uses pixel 726 at position [2,-1], and the pixel on the right boundary uses pixel value of pixel 728 at position [3,-1] to determine the first predicted value (pred1[x,y]).

[0084] Furthermore, the video encoding / decoding apparatus can use the first predicted value (pred1[x,y]) as the final predicted value (predS[x,y]).

[0085] [Number 2] predS[x,y]=pred[x,y](x=0,...,BlockWidth-1;y=0,...,BlockHeight-1) Here, predS[x,y] denotes the final predicted value.

[0086] Referring to FIG. 7b, in the case of horizontal prediction, the first predicted value (pred1[x,y]) may be determined as the left reference pixel values ​​732, 734, 736, and 738 adjacent to the current block.

[0087] [Number 3] pred1[x,y]=p[-1,y](x=0,...,BlockWidth-1;y=0,...,BlockHeight-1)

[0088] The pixel at the top boundary of the current block 710 uses pixel 732 at [-1,0], the pixel at the second row from the top uses pixel 734 at [-1,1], the pixel at the third row from the top uses pixel 736 at [-1,2], and the pixel at the bottom boundary uses pixel 738 at [-1,3] to determine the primary predicted value (pred1[x,y]). As in the case of vertical prediction, in the case of horizontal prediction, the primary predicted value (pred1[x,y]) can also be used as the final predicted value (predS[x,y]).

[0089] FIG. 8 is a flow chart that schematically illustrates an embodiment of calculating a final predicted value by performing corrections on the primary predicted values ​​for pixels in a current block.

[0090] Referring to FIG. 8, when the video encoding / decoding device performs correction on the predicted value based on at least one of the intra-frame prediction mode, luminance signal, chrominance signal information, and block size in the correction determination step (S330), the video encoding / decoding device obtains a first predicted value (pred1[x,y]) through a method using the reference pixel value (see FIGS. 7a and 7b) (S810).

[0091] In addition, an initial correction value (d[x,y]) for the primary predicted value (pred1[x,y]) of the pixel to be predicted is determined (S820). The initial correction value (d[x,y]) may be determined based on the horizontal or vertical position of the pixel to be predicted within the block. That is, in the case of vertical prediction, the initial correction value (d[x,y]) may be determined based on the vertical position of the pixel to be predicted within the block, and in the case of horizontal prediction, the initial correction value (d[x,y]) may be determined based on the horizontal position of the pixel to be predicted within the block.

[0092] [Number 4] d[x,y]=d[y]=p[-1,y]-p[-1,-1] (for vertical prediction) d[x,y]=d[x]=p[x,-1]-p[-1,-1] (for horizontal prediction) In this case, Equation 4 can be used by changing the direction of the difference as shown in Equation 4' below.

[0093] [number 4'] d[x,y]=d[y]=p[-1,-1]-p[-1,y] (for vertical prediction) d[x,y]=d[x]=p[-1,-1]-p[x,-1] (for horizontal prediction)

[0094] Next, a final correction value (delta[x,y]) is calculated based on the initial correction value (d[x,y]) (S830). At this time, by calculating the final correction value (delta[x,y]) through an arithmetic right shift with a relatively low computational complexity without performing a division or multiplication operation with a high computational complexity, the computational efficiency can be enhanced. That is, the two's complement integer representation of the initial correction value (d[x,y]) is arithmetically right-shifted by a binary digit M to calculate the final correction value (delta[x,y]). At this time, the MSB (Most Significant Bit) of the arithmetically right-shifted final correction value (delta[x,y]) has the same value as the MSB of the initial correction value (d[x,y]), and the final correction value (delta[x,y]) has a characteristic of rounding in a direction close to negative infinity.

[0095] [Equation 5] delta[x,y]=d[x,y]>>M At this time, a preferable value of the binary digit M is 1 or 2.

[0096] Finally, the first prediction value (pred1[x,y]) and the final correction value (delta[x,y]) are added together to calculate the final prediction value (predS[x,y]).

[0097] [Equation 6] predS[x,y]=Clip1Y(pred1[x,y]+delta[x,y]) Here, Clip1 Y (x)=Clip3(0,(1<<BitDepthY)-1,x) is shown, [Equation] is shown, and BitDepthY indicates the bit depth of the luminance signal.

[0098] According to other embodiments of the present invention, after generating an initial correction value, several methods can be used to calculate a final correction value (delta[x,y]) using the initial correction value (d[x,y]). First, according to a first embodiment, after conditional analysis of the initial correction value, the final correction value (delta[x,y]) can be calculated through an arithmetic right shift operation. According to the first embodiment, the correction value can be calculated so that the correction value is rounded to an integer close to 0 using the following formula:

[0099] [Number 7] delta[x,y]=(d[x,y]+(d[x,y]<0?2 x :0))>>(x+1) (for vertical prediction mode) delta[x,y]=(d[x,y]+(d[x,y]<0?2 y :0))>>(y+1) (for horizontal prediction mode)

[0100] Also, according to the second embodiment, the correction value can be calculated using the following formula so that the correction value is rounded to an integer far from 0:

[0101] [Number 8] delta[x,y]=(d[x,y]+(d[x,y]<0?1+2 x :1))>>(x+1) (for vertical prediction mode) delta[x,y]=(d[x,y]+(d[x,y]<0?1+2 y :1))>>(y+1) (for horizontal prediction mode)

[0102] Furthermore, according to a third embodiment, the correction value can be calculated using the following equation so that the correction value is rounded to an integer close to negative infinity. In this case, Equation 9 can be applied only to the left boundary of the current block using the vertical prediction mode and the top boundary of the current block using the horizontal prediction mode. In this case, Equation 9 is the same as Equation 5 when M is 1.

[0103] [Number 9] delta[x,y]=d[x,y]>>(x+1) (for vertical prediction mode) delta[x,y]=d[x,y]>>(y+1) (for horizontal prediction mode)

[0104] According to a fourth embodiment of the present invention, after generating an initial correction value (d[x, y]), a final correction value can be calculated using a sign (Sign) operation and an absolute value (Abs) operation based on the initial correction value. In this case, the final correction value can be calculated by multiplying the sign of the initial correction value by a value obtained by performing an arithmetic right shift operation on the absolute value of the initial correction value. In this case, the final correction value can be calculated such that the calculated final predicted value is rounded to an integer close to 0.

[0105] [Number 10] delta[x,y]=Sign(d[x,y])*((Abs(d[x,y])+2 x )>>(x+1)) (for vertical prediction mode) delta[x,y]=Sign(d[x,y])*((Abs(d[x,y])+2 y )>>(y+1)) (for horizontal prediction mode)

[0106] In addition, in the fifth embodiment based on the sign operation and absolute value operation, the final correction value can be calculated by performing an addition operation on the sign of the initial correction value and the absolute value of the initial correction value, and then multiplying the result by a value obtained by performing an arithmetic right shift operation on the result. In this case, the final correction value can be calculated so that the calculated final predicted value is rounded to an integer far from 0.

[0107] [Number 11] delta[x,y]=Sign(d[x,y])*((Abs(d[x,y])+2 x )>>(x+1)) (for vertical prediction mode) delta[x,y]=Sign(d[x,y])*((Abs(d[x,y])+2 y )>>(y+1)) (for horizontal prediction mode)

[0108] Next, based on the final correction value calculated through the first to fifth embodiments, the first predicted value (pred1[x,y]) and the final correction value (delta[x,y]) can be added together to calculate the final predicted value (predS[x,y]).

[0109] FIG. 9a shows a schematic example of an embodiment in which a final predicted value is calculated by performing a correction on the primary predicted value when using the vertical mode.

[0110] Referring to Figure 9a, when a video encoding / decoding device performs intra-screen prediction via a vertical prediction mode, it determines the pixel value of the upper reference pixel of the current block 910 as the first predicted value (pred1[x,y]=p[x,-1]).

[0111] Also, correction is performed on pixel 920 at the left boundary of the current block 910. To perform correction of the primary predicted value, an initial correction value is first determined, which is determined according to the vertical position of the pixel to be predicted. That is, the initial correction value can be the difference between the corresponding left reference pixel value 940 of the pixel to be predicted and the pixel value of the upper left corner pixel 930 (d[x,y]=d[y]=p[-1,y]-p[-1,-1]). As described above, the initial correction value exists only when it is the left boundary, i.e., when x is 0, and is all 0 in other cases.

[0112] Next, the final correction value is calculated by arithmetically shifting the two's complement integer representation of the initial correction value by one binary number to the right (delta[x,y]=d[x,y]>>1=(p[-1,y]-p[-1,-1])>>1).

[0113] Finally, the final predicted value can be calculated by adding the first predicted value and the final corrected value (predS[x,y]=Clip1 Y (pred1[x,y]+delta[x,y]).

[0114] FIG. 9b shows a schematic example of an embodiment in which a correction is performed on the primary predicted value to calculate the final predicted value when using horizontal mode.

[0115] Referring to Figure 9b, when the video encoding / decoding device performs intra-screen prediction through horizontal prediction mode, it determines the pixel value of the left reference pixel of the current block 910 as the first predicted value (pred1[x,y]=p[-1,y]).

[0116] In addition, correction is performed on pixel 950 at the upper boundary of the current block 910. To perform correction of the primary predicted value, an initial correction value is determined, which is determined according to the horizontal position of the pixel to be predicted. That is, the initial correction value can be the difference between the upper reference pixel value 960 corresponding to the pixel to be predicted and the pixel value of the upper left corner pixel 930 (d[x,y]=d[x]=p[x,-1]-p[-1,-1]). As described above, the initial correction value exists only when it is the upper boundary, i.e., when y is 0, and is all 0 in other cases.

[0117] Next, the final correction value is calculated by arithmetically shifting the two's complement integer representation of the initial correction value by one binary number to the right (delta[x,y]=d[x,y]>>1=(p[x,-1]-p[-1,-1])>>1), and the final prediction value can be calculated by adding the first prediction value and the final correction value (predS[x,y]=Clip1 Y (pred1[x,y]+delta[x,y]).

[0118] FIG. 10 is a flowchart illustrating a scaling process of a video encoding / decoding method according to another embodiment of the present invention.

[0119] Referring to FIG. 10, a video encoding / decoding apparatus according to another embodiment of the present invention may perform scaling to derive motion vector information of a prediction block when performing inter-frame prediction or motion compensation on a current block. To this end, the video encoding / decoding apparatus determines whether a reference picture of a current block is the same as a reference picture of a reference block (S1010). In this case, the video encoding / decoding apparatus may determine whether not only the reference picture but also a reference picture index indicating a reference picture in a reference picture list are the same. Then, based on the determination result, it determines whether to perform scaling of the motion vector of the reference block (S1020). If the reference pictures are the same, scaling of the motion vector of the reference block is not performed. However, if they are not the same, scaling of the motion vector of the reference block is required. The scaled motion vector of the reference block can be used as the basis for the motion vector of the current block for inter-frame prediction of the current block.

[0120] Meanwhile, inter prediction methods applicable to inter prediction via the scaling process include AMVP (Advanced Motion Vector Prediction), merge mode, etc. In particular, the merge mode can be applied to a temporal merge candidate derivation process, and the AMVP can be applied to a temporal motion vector derivation process and a spatial motion vector derivation process.

[0121] FIG. 11a shows the POC difference values ​​between the current picture and the reference picture of the spatial reference block and the POC difference values ​​between the current picture and the reference picture of the current block.

[0122] 11a, a reference block 1110 for deriving spatial motion vector candidates among neighboring blocks of a current block 1100 is at least one of the bottommost block adjacent to the left of the current block 1100, the block adjacent to the bottom of the bottommost block on the left, the upper corner block on the left of the current block, the upper corner block on the right of the current block, and the rightmost block adjacent to the top of the current block. In this case, to use the motion vector of the reference block 1110 for predicting the current block 1100 without performing a scaling process, the reference picture 1140 of the reference block 1110 and the reference picture 1130 of the current block 1100 must be the same. If they are not the same, the motion vector of the reference block 1110 can be scaled and used for predicting the current block 1100. That is, it is determined whether the tb value indicating the POC (Picture Order Count) difference value between the reference picture 1130 of the current block and the current picture 1120 is the same as the td value indicating the POC difference value between the current picture 1120 and the reference picture 1140 of the reference block 1110, and if they are the same, the scaling process is not performed, and if they are not the same, the scaling process is performed.

[0123] FIG. 11b shows the POC difference value between the reference picture of the corresponding position block and the corresponding position picture, and the POC difference value between the current picture and the reference picture of the current block.

[0124] 11b, the video encoding / decoding apparatus may perform prediction of a current block 1100 based on a motion vector of a reference block associated with a co-located block 1150 at a position corresponding to the current block 1100 in a previously reconstructed co-located picture 1160. That is, a block located inside or outside the co-located block may be used as a reference block for temporal motion vector guidance or temporal merge candidate guidance. The reference block may be determined based on the relative position of a lower right corner block of the co-located block or a lower right block among four regular square blocks based on the center of the co-located block.

[0125] In this case, when the motion vector of the temporal reference block is used, it is determined whether a td value indicating a POC difference between the reference picture 1170 referred to by the corresponding position block 1150 and the corresponding position picture 1160 is the same as a tb value indicating a POC difference between the reference picture 1130 referred to by the current block 1100 and the current picture 1120. If the two values ​​are the same, it can be determined not to perform the scaling process, and if they are not the same, it can be determined to perform the scaling process.

[0126] FIG. 12 is a flow chart that schematically illustrates an embodiment of a process for calculating scaling factor values ​​for motion vectors based on POC difference values ​​between pictures.

[0127] As shown in FIG. 12, the video encoding / decoding apparatus obtains td and tb values ​​indicating a POC difference between pictures for calculating a scaling factor value (S1210). Here, the first value indicates the td value, and the second value indicates the tb value. As described above, in i) the spatial motion vector deriving process (see FIG. 11a), the td value indicates a difference between the POC of the current picture and the POC of a reference picture referenced by a spatially adjacent reference block, and the tb value indicates a difference between the POC of the current picture and the POC of a reference picture referenced by the current block. In this case, the prediction directions of the reference picture of the current block and the reference picture of the reference block are different from each other, and in this case, the signs of the td and tb values ​​may be assigned differently. Depending on the circumstances, the td or tb value may be adjusted to fall within the range of −128 to 127. In this case, if the td value or tb value is smaller than −128, the td value or tb value can be adjusted to −128, and if the td value or tb value is larger than 127, the td value or tb value can be adjusted to 127. If the td value or tb value is within the range of −128 to 127, the td value or tb value is not adjusted.

[0128] [Number 12] td=Clip3(-128,127,PicOrderCnt(currPic)-RefPicOrder(currPic,refIdxZ,ListZ)) tb=Clip3(-128,127,PicOrderCnt(currPic)-RefPicOrder(currPic,refIdxLX,LX)) Here, currPic refers to the current picture. X may have a value of 0 or 1. For example, if X is 0, refIdxLX,LX may indicate refIdxL0,L0, which refers to a variable associated with L0 temporal motion information. refIdxLX may indicate an LX reference picture index indicating a reference picture in an LX reference picture list to which a reference picture is assigned. If refIdxLX is 0, refIdxLX indicates the first reference picture in the LX reference picture list. If refIdxLX is -1, refIdxLX may indicate that it does not point to a reference picture in a reference picture list. In addition, Z can indicate at least one of the bottommost block adjacent to the left, which is the position of the reference block for spatial motion vector guidance, the block adjacent to the bottom of the bottommost block on the left, the upper corner block to the left of the current block, the upper corner block to the right of the current block, and the uppermost block adjacent to the current block.

[0129] In the case of ii) the temporal motion vector derivation process and iii) the temporal merge candidate derivation process (see FIG. 11b), the td value indicates a difference between the POC of the corresponding-position picture and the POC of the reference picture referred to by the corresponding-position block, and the tb value indicates a difference between the POC of the current picture and the POC of the reference picture referred to by the current block. In this case, the td value or the tb value can be adjusted to fall within the range of −128 to 127.

[0130] [Number 13] td=Clip3(-128,127,PicOrderCnt(colPic)-RefPicOrder(currPic,refIdxCol,ListCol)) tb=Clip3(-128,127,PicOrderCnt(currPic)-RefPicOrder(currPic,refIdxLX,LX)) Here, colPic means the correspondingly positioned picture, and refIdxCol and ListCol mean the reference picture index and reference picture list of the correspondingly positioned block, respectively.

[0131] After obtaining the td and tb values, the video encoding apparatus may calculate an offset value by performing an arithmetic right shift by binary 1 on the two's complement integer representation of the absolute value of the td value (S1220). That is, the offset value may be calculated by performing an arithmetic right shift with relatively low computational complexity using a value proportional to the absolute value of td, without performing a high-complexity operation.

[0132] [Number 14] offset=Abs(td)>>1 In this case, Abs() indicates an absolute value function, and the output value of the function is the absolute value of the input value.

[0133] After performing the arithmetic rightward shift, the video encoding / decoding apparatus calculates an inversely proportional value of the td value based on the offset value (S1230).

[0134] [Number 15] tx=(16384+offset) / td After calculating the inversely proportional value (tx) of td, a scaling factor value is calculated based on the tb value and the inversely proportional value (tx) of the td value (S1240).

[0135] 13 is a block diagram illustrating a configuration for calculating a final scaling factor value based on the inversely proportional values ​​of the tb and td values. As shown in FIG. 13, the configuration 1300 for calculating the final scaling factor value (ScaleFactor) may include a multiplier 1310, an addition operation execution unit 1320, an arithmetic shift execution unit 1330, and a factor value adjustment unit 1340.

[0136] 13, the first and second value acquisition unit 1302 acquires the td value and the tb value through the method described in step S1210. The offset value calculation unit 1306 calculates the offset value based on the td value through the method described in step S1220, and the inverse proportional value calculation unit 1308 calculates the inverse proportional value (tx) of the td value based on the offset value through the method described in step S1230.

[0137] The multiplier 1310 receives the tb value and the inverse proportional value (tx) of the td value calculated by the inverse proportional value calculation unit 1308 and performs multiplication. The addition operation execution unit 1320 can perform an addition operation based on the product of the tb value and the inverse proportional value (tx) of the td value. In this case, it can perform an operation to add 32. In addition, the arithmetic shift execution unit 1330 performs an arithmetic right shift by binary 6 on the two's complement integer representation of the result of the addition operation. The operations up to this point can be expressed as follows.

[0138] [Number 16] ScaleFactor=(tb*tx+32)>>6

[0139] Furthermore, the factor value adjustment unit 1340 adjusts the scaling factor value (ScaleFactor) so that it falls within the range of −4096 to 4095. Here, adjusting the scaling factor value (ScaleFactor) so that it falls within a specific range (for example, between A and B) means that if the scaling factor value (ScaleFactor) is smaller than A, it is clipped to A, and if it is larger than B, it is clipped to B.

[0140] After calculating the scaling factor value, the video encoding / decoding apparatus may calculate a scaled motion vector value (scaledMV). The scaled motion vector value (scaledMV) may be calculated by multiplying the scaling factor value (ScaleFactor) by a corresponding motion vector (meaning a motion vector associated with at least one of a spatial motion vector guide, a temporal motion vector guide, and a temporal merge), and then multiplying the result by a sign of the result and an addition operation and an arithmetic shift operation based on the absolute value of the multiplication result.

[0141] [Number 17] scaledMV=Sign(ScaleFactor*mv)*((Abs(ScaleFactor*mv)+127)>>8) Here, Sign() outputs sign information of a specific value (for example, Sign(-1) outputs -), and mv indicates the motion vector value before scaling. In this case, scaling can be performed on each component value of the motion vector, i.e., x and y components.

[0142] The video encoding / decoding apparatus can generate a prediction block for the current block using the scaled motion vector values.

[0143] According to another embodiment of the present invention, the scaling factor value calculation method can also be used in a scaling factor value calculation process in implicit weighted prediction. When performing implicit weighted prediction, a video encoding / decoding apparatus obtains td and tb values ​​indicating inter-picture POC difference values ​​to calculate scaling factor values.

[0144] The td value indicates a difference between the POC of a reference picture referenced by the current picture among reference pictures in reference picture list 1 and the POC of a reference picture referenced by the current picture among reference pictures in reference picture list 0, and the tb value indicates a difference between the POC of the current picture and the POC of a reference picture referenced by the current picture among reference pictures in reference picture list 0. In this case, the td value or the tb value may be adjusted to be within a range of −128 to 127. In this case, if the td value or the tb value is less than −128, the td value or the tb value may be adjusted to −128, and if the td value or the tb value is greater than 127, the td value or the tb value may be adjusted to 127. If the td value or the tb value is within the range of −128 to 127, the td value or the tb value is not adjusted.

[0145] [Number 18] td=Clip3(-128,127,PicOrderCnt(currPic,refIdxL1,L1)-RefPicOrder(currPic,refIdxL0,L0)) tb=Clip3(-128,127,PicOrderCnt(currPic)-RefPicOrder(currPic,refIdxL0,L0))

[0146] The video encoder can then calculate the offset value by performing an arithmetic right shift by one binary number on the two's complement integer representation of the absolute value of the td value.

[0147] After performing the arithmetic right shift, the video encoding / decoding device calculates the inversely proportional value of the td value (tx=(16384+offset) / td) based on the offset value, calculates the inversely proportional value of the td value (tx), and then calculates a scaling factor value (ScaleFactor=(tb*tx+32)>>6) based on the tb value and the inversely proportional value of the td value (tx).

[0148] In particular, when calculating a scaling factor in implicit weighted prediction, the scaling factor value (ScaleFactor) may be adjusted to fall within the range of -1024 to 1023. In this case, if the distance between images is large, scaling for the weighting factor (Weighting Factor) performed using the distance between images may not be performed accurately, resulting in inaccurate implicit weighted prediction, which may reduce coding efficiency. Therefore, instead of adjusting the scaling factor value to fall within the range of -1024 to 1023, the scaling factor value (ScaleFactor) may also be adjusted to fall within the range of -4096 to 4065.

[0149] In this case, using the weighting factor value, the weighting value for the reference picture in reference picture list 0 can be determined as 64-(ScaleFactor>>2), and the weighting value for the reference picture in reference picture list 1 can be determined as ScaleFactor>>2.

[0150] In the above-described embodiments, the method is described based on a flowchart with a series of steps or blocks, but the present invention is not limited to the order of steps, and some steps may occur in a different order or simultaneously with other steps than those described above. Furthermore, those skilled in the art will understand that the steps shown in the flowchart are not exclusive, and other steps may be included, or one or more steps in the flowchart may be omitted without affecting the scope of the present invention.

[0151] The above-described embodiments include examples of various aspects. It is not possible to describe all possible combinations for illustrating various aspects, but a person skilled in the art will recognize that other combinations are possible. Accordingly, the present invention includes all alterations, modifications, and variations that fall within the scope of the appended claims.

Claims

1. 1. A video decoding method, comprising: generating a predicted block by performing intra prediction on the current block; and adding a residual block to the predicted block to reconstruct an image; The step of generating the predicted block comprises: deriving a primary predicted value of a pixel to be predicted using one or more reference pixels designated by an intra-frame prediction mode of the current block among a plurality of usable neighboring pixels neighboring the current block; If the current block is a luminance block and an intra-frame prediction mode of the current block is a predetermined mode, the first predicted value is corrected to generate a final predicted value of the pixel to be predicted; When an intra-frame prediction mode of the current block is a DC mode, the final prediction value is calculated by performing an arithmetic right shift operation, and is clipped within a range specified by a bit depth of the current block.

2. In a video encoding method, generating a predicted block by performing intra prediction on the current block; and adding a residual block to the predicted block to reconstruct an image; The step of generating the predicted block comprises: deriving a primary predicted value of a pixel to be predicted using one or more reference pixels designated by an intra-frame prediction mode of the current block among a plurality of usable neighboring pixels neighboring the current block; If the current block is a luminance block and an intra-frame prediction mode of the current block is a predetermined mode, the first predicted value is corrected to generate a final predicted value of the pixel to be predicted; When an intra-frame prediction mode of the current block is a DC mode, the final prediction value is calculated by performing an arithmetic right shift operation, and the final prediction value is clipped within a range specified by a bit depth of the current block.

3. A method for transmitting a bitstream generated by a video encoding method, comprising: generating a predicted block by performing intra prediction on the current block; and adding a residual block to the predicted block to reconstruct an image; The step of generating the predicted block comprises: deriving a primary predicted value of a pixel to be predicted using one or more reference pixels designated by an intra-frame prediction mode of the current block among a plurality of usable neighboring pixels neighboring the current block; If the current block is a luminance block and an intra-frame prediction mode of the current block is a predetermined mode, the first predicted value is corrected to generate a final predicted value of the pixel to be predicted; When the intra-frame prediction mode of the current block is a DC mode, the final prediction value is calculated by performing an arithmetic right shift operation, and is clipped within a range specified by the bit depth of the current block.