Video decoding device and video encoding device

WO2025187142A8PCT designated stage Publication Date: 2025-10-02SHARP KK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/JP2024/042100
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-08
Filing Date
2024-11-28
Publication Date
2025-10-02

AI Technical Summary

Technical Problem

Existing video coding methods, such as H.265/HEVC and H.266/VVC, are limited in their ability to efficiently correct motion vectors when the distance between the target picture and reference pictures is not equal, leading to inefficiencies in video encoding and decoding processes.

Method used

A video decoding device and encoding device that includes a vector correction unit capable of deriving interpolated images from motion vectors, a cost array derivation unit, and a vector correction unit to derive a correction vector based on the distance between the target picture and reference pictures, enhancing motion vector correction efficiency.

Benefits of technology

Improves the efficiency of updating motion vectors in video encoding and decoding processes by effectively correcting motion vectors even when the distances between target and reference pictures are not equal.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure JP2024042100_02102025_PF_FP_ABST
    Figure JP2024042100_02102025_PF_FP_ABST
Patent Text Reader

Abstract

There is a problem such that motion vector correction is limited to cases where the distances between a subject picture and an L0 reference picture and between the subject picture and an L1 reference picture are equal, and thus if the distances are different, correction of motion vectors cannot be used resulting in a lack of efficiency. This video decoding device for decoding encoded data is characterized by being provided with a vector correction unit for correcting motion information of a subject block, and characterized in that: the vector correction unit is provided with an interpolation unit for deriving a first interpolated image from a first motion vector and deriving a second interpolated image from a second motion vector, a cost array derivation unit for deriving a cost array from the first interpolated image and the second interpolated image, and a vector correction unit for deriving a minimum position vector indicating a minimum position of the cost array, deriving a corrected vector from the minimum position vector, and correcting the motion vectors; and a scale value is derived from the distance between a subject picture and a reference picture, and the cost array is derived using the scale value.
Need to check novelty before this filing date? Find Prior Art

Description

Video decoding device and video encoding device

[0001] An embodiment of the present invention relates to a video decoding device and a video encoding device.

[0002] In order to efficiently transmit or record moving images, a moving image encoding device is used that encodes moving images to generate coded data, and a moving image decoding device is used that decodes the coded data to generate decoded images.

[0003] Specific video encoding methods include, for example, H.265 / HEVC (High-Efficiency Video Coding) and H.266 / VVC (Versatile Video Coding).

[0004] In such a video coding method, images (pictures) constituting a video are managed in a hierarchical structure consisting of slices obtained by dividing images, coding tree units (CTUs) obtained by dividing slices, coding units (sometimes called coding units (CUs)) obtained by dividing coding tree units, and transform units (TUs) obtained by dividing coding units, and are coded / decoded for each CU.

[0005] In such video coding methods, a predicted image is typically generated based on a locally decoded image obtained by encoding / decoding an input image, and the predicted image is subtracted from the input image (original image) to obtain a prediction error (sometimes called a "difference image" or "residual image"), which is then coded. Methods for generating predicted images include inter-frame prediction (inter-prediction) and intra-frame prediction (intra-prediction).

[0006] Furthermore, Non-Patent Document 1 discloses a Decoder Side Motion Refinement (DMVR) technique that corrects motion vectors in total prediction by slightly moving the motion vectors MV of the L0 predicted image and the L1 predicted image to minimize matching costs.

[0007] "Algorithm description of Enhanced Compression Model 10 (ECM 10)", JVET-AF2025, Joint Video Exploration Team (JVET) of ITU-T SG 16 WP 3 and ISO / IEC JTC 1 / SC 29 / WG 11, 2023-10-02

[0008] However, the method described in Non-Patent Document 1 is limited to cases where the distance between the target picture and the L0 reference picture and the distance between the target picture and the L1 reference picture are equal, and therefore has a problem in that it is not efficient enough because motion vector correction cannot be used when the distances are different.

[0009] A video decoding device according to one aspect of the present invention is a video decoding device that decodes encoded data, and includes a vector correction unit that corrects motion information of a target block, and the vector correction unit includes an interpolation unit that derives a first interpolated image from a first motion vector and a second interpolated image from a second motion vector, a cost array derivation unit that derives a cost array from the first interpolated image and the second interpolated image, and a vector correction unit that derives a minimum position vector indicating the minimum position of the cost array, derives a correction vector from the minimum position vector, and corrects the motion vector, and is characterized in that it derives a scale value from the distance between the target picture and the reference picture, and derives the cost array using the scale value.

[0010] A video encoding device that decodes encoded data includes a vector correction unit that corrects motion information of a target block, the vector correction unit including an interpolation unit that derives a first interpolated image from a first motion vector and a second interpolated image from a second motion vector, a cost array derivation unit that derives a cost array from the first interpolated image and the second interpolated image, and a vector correction unit that derives a minimum position vector indicating a minimum position of the cost array and derives a correction vector from the minimum position vector, and is characterized in that it derives a scale value from the distance between the target picture and a reference picture and derives the cost array using the scale value.

[0011] According to one aspect of the present invention, it is possible to improve the efficiency of updating motion vectors in video encoding and decoding processes.

[0012] FIG. 1 is a schematic diagram showing the configuration of an image transmission system according to the present embodiment. FIG. 2 is a diagram showing a hierarchical structure of data of an encoded stream. FIG. 3 is a schematic diagram showing the configuration of a video decoding device. FIG. 4 is a block diagram showing the configuration of a video encoding device. FIG. 4 is a schematic diagram showing the configuration of an inter prediction parameter derivation unit. FIG. 5 is a schematic diagram showing the configuration of an inter prediction image generation unit. FIG. 6 is a diagram explaining merging and MMVD. FIG. 7 is a diagram explaining the syntax configuration of inter prediction parameters. FIG. 8 is a diagram explaining the arrangement of MxN point mrSad. FIG. 9 is a diagram explaining the operation of parametric motion vector refinement. FIG. 10 is a flowchart showing DMVR determination processing according to the present embodiment. FIG. 11 is a flowchart showing DMVR determination processing according to the present embodiment. FIG. 12 is a flowchart showing DMVR determination processing according to the present embodiment.

[0013] First Embodiment Hereinafter, an embodiment of the present invention will be described with reference to the drawings.

[0014] FIG. 1 is a schematic diagram showing the configuration of an image transmission system 1 according to this embodiment.

[0015] The image transmission system 1 is a system that transmits an encoded stream obtained by encoding a target image, decodes the transmitted encoded stream, and displays the image. The image transmission system 1 includes a video encoding device (image encoding device) 11, a network 21, a video decoding device (image decoding device) 31, and a video display device (image display device) 41.

[0016] An image T is input to the video encoding device 11 .

[0017] The network 21 transmits the coded stream Te generated by the video coding device 11 to the video decoding device 31. The network 21 is the Internet, a wide area network (WAN, including 4G / 5G / 6G, etc.), a local area network (LAN), or a combination thereof. The network 21 is not necessarily limited to a bidirectional communication network, but may also be a unidirectional communication network that transmits broadcast waves such as terrestrial digital broadcasting and satellite broadcasting. Furthermore, the network 21 may be replaced by a storage medium on which the coded stream Te is recorded, such as a DVD (Digital Versatile Disc: registered trademark) or a BD (Blue-ray Disc: registered trademark).

[0018] The video decoding device 31 decodes each of the coded streams Te transmitted over the network 21, and generates one or more decoded images Td.

[0019] The video display device 41 displays all or part of one or more decoded images Td generated by the video decoding device 31. The video display device 41 includes a display device such as a liquid crystal display or an organic EL (Electro-Luminescence) display. The display may be in the form of a stationary display, a mobile display, an HMD, or the like. Furthermore, if the video decoding device 31 has high processing power, it displays high-quality images, and if it has only low processing power, it displays images that do not require high processing power or display power.

[0020] <Operators> The operators used in this specification are listed below.

[0021] >> is a right bit shift, << is a left bit shift, & is a bitwise AND, | is a bitwise OR, |= is the OR assignment operator, and || indicates logical sum.

[0022] x?y:z is a ternary operator that takes y if x is true (non-zero) and z if x is false (zero).

[0023] Clip3(a, b, c) is a function that clips c to a value between a and b (inclusive). If c < a, it returns a; if c > b, it returns b; otherwise, it returns c (where a <= b).

[0024] ClipH(o, W, x) is a function that returns x if x < 0, x - o if x > W - 1, and x otherwise.

[0025] Clip1(x) is Clip3(0, (1 << BitDepth) - 1, x).

[0026] sign(a) is a function that returns 1 if a > 0, 1 if a == 0, and -1 if a < 0.

[0027] Abs(a) is a function that returns the absolute value of a.

[0028] int(a) is a function that returns the integer value of a.

[0029] floor(a) is a function that returns the largest integer less than or equal to a.

[0030] ceil(a) is a function that returns the smallest integer greater than or equal to a.

[0031] Max(a, b) is a function that returns the larger of a and b.

[0032] Min(a, b) is a function that returns the smaller of a and b.

[0033] a / d represents the division of a by d (truncating the fractional part).

[0034] a ÷ d and a over d represent the division of a by d (without rounding).

[0035] <Structure of the Encoded Stream Te> Before providing a detailed description of the moving image encoding device 11 and the moving image decoding device 31 according to the present embodiment, the data structure of the encoded stream Te generated by the moving image encoding device 11 and decoded by the moving image decoding device 31 will be described.

[0036] 2 is a diagram showing a hierarchical structure of data in a coded stream Te. The coded stream Te illustratively includes a sequence and multiple pictures that make up the sequence. (a) to (f) of FIG. 2 show a coded video sequence that defines the sequence SEQ, a coded picture that defines the picture PICT, a coded slice that defines the slice S, coded slice data that defines the slice data, a coding tree unit included in the coded slice data, and a coding unit included in the coding tree unit, respectively.

[0037] (Encoded Video Sequence) An encoded video sequence defines a set of data that the video decoding device 31 refers to in order to decode a sequence SEQ to be processed. As shown in Fig. 2, the sequence SEQ includes a video parameter set, a sequence parameter set SPS (Sequence Parameter Set), a picture parameter set PPS (Picture Parameter Set), an adaptation parameter set (APS), a picture PICT, and supplemental enhancement information SEI (Supplemental Enhancement Information).

[0038] The video parameter set VPS specifies a set of coding parameters common to multiple videos composed of multiple layers, as well as a set of coding parameters related to multiple layers included in the video and each individual layer.

[0039] The sequence parameter set SPS defines a set of coding parameters that the video decoding device 31 references to decode the target sequence. For example, the width and height of a picture are defined. Note that there may be multiple SPSs. In this case, one of the multiple SPSs is selected from the PPS.

[0040] The picture parameter set PPS defines a set of coding parameters that the video decoding device 31 references to decode each picture in the target sequence. For example, the PPS includes a reference value for the quantization width used in decoding the picture (pic_init_qp_minus26) and a flag indicating the application of weighted prediction (weighted_pred_flag). Note that there may be multiple PPSs. In this case, one of the multiple PPSs is selected for each picture in the target sequence.

[0041] (Coded Picture) A coded picture defines a set of data that the video decoding device 31 references in order to decode a picture PICT to be processed. As shown in Fig. 2, the picture PICT includes slices 0 to NS-1 (NS is the total number of slices included in the picture PICT).

[0042] In the following description, when there is no need to distinguish between slices 0 to NS-1, the subscripts of the symbols may be omitted. This also applies to other data that are included in the coded stream Te described below and have subscripts.

[0043] (Encoded Slice) An encoded slice defines a set of data to be referenced by the video decoding device 31 in order to decode a slice S to be processed. As shown in Fig. 2, a slice includes a slice header and slice data.

[0044] The slice header includes a group of coding parameters that the video decoding device 31 refers to in order to determine a decoding method for the current slice. Slice type designation information (slice_type) that designates the slice type is an example of a coding parameter included in the slice header.

[0045] Slice types that can be specified by the slice type specification information include (1) an I slice that uses only intra prediction during encoding, (2) a P slice that uses unidirectional prediction or intra prediction during encoding, and (3) a B slice that uses unidirectional prediction, bidirectional prediction, or intra prediction during encoding. Note that inter prediction is not limited to uni-prediction or bi-prediction, and a predicted image may be generated using more reference pictures. Hereinafter, when referred to as a P or B slice, it refers to a slice including a block that can use inter prediction.

[0046] Note that the slice header may include a reference to the picture parameter set PPS (pic_parameter_set_id).

[0047] (Encoded Slice Data) The encoded slice data defines a set of data that the video decoding device 31 references in order to decode the slice data to be processed. As shown in Fig. 2(d), the slice data includes CTUs. A CTU is a block of a fixed size (e.g., 64x64, 128x128) that constitutes a slice.

[0048] (Coding Trees and Coding Units) A CTU is divided into coding units (CUs), which are the basic units of the coding process, by recursive quad-tree division (QT (Quad Tree) division), binary tree division (BT (Binary Tree) division), or ternary tree division (TT (Ternary Tree) division). BT division and TT division are collectively called multi-tree division (MT (Multi Tree) division). A node in the tree structure obtained by recursive quad-tree division is called a coding tree (CT). The intermediate nodes of a quad-tree, binary tree, or ternary tree are coding trees, and the CTU itself is defined as the top-level coding node. The lowest-level coding tree is defined as a coding unit (CU).

[0049] Different trees (separate trees or dual trees) may be used for luminance and chrominance. The tree type is indicated by treeType. For example, when using a common tree for luminance (Y, cIdx=0) and chrominance (Cb / Cr, cIdx=1,2), the common single tree is indicated by treeType=SINGLE_TREE. When using two different trees (DUAL trees) for luminance and chrominance, the luminance tree is indicated by treeType=DUAL_TREE_LUMA and the chrominance tree is indicated by treeType=DUAL_TREE_CHROMA.

[0050] A CU is composed of a CU header CUH, prediction parameters, transformation parameters, quantized transformation coefficients, etc. The CU header specifies a prediction mode, etc.

[0051] Prediction processing may be performed in units of CUs, or in units of sub-CUs obtained by further dividing a CU. When the sizes of a CU and a sub-CU are equal, there is one sub-CU in the CU. When the size of a CU is larger than the size of a sub-CU, the CU is divided into sub-CUs. For example, if the CU is 8x8 and the sub-CU is 4x4, the CU is divided into four sub-CUs, divided horizontally in half and vertically in half. Prediction types (prediction modes) include intra prediction (MODE_INTRA), inter prediction (MODE_INTER), and intra block copy (MODE_IBC). Intra prediction is prediction within the same picture, while inter prediction refers to prediction processing performed between different pictures (e.g., between display times or between layer images).

[0052] The transformation and quantization processes are performed in units of CUs, but the quantized transformation coefficients may be entropy coded in units of sub-blocks such as 4x4.

[0053] (Prediction Parameters) A predicted image is derived from prediction parameters associated with a block. Prediction parameters include intra-prediction and inter-prediction parameters.

[0054] (Prediction Parameters for Inter Prediction) The prediction parameters for inter prediction will be described. The inter prediction parameters are composed of prediction list usage flags predFlagL0 and predFlagL1, reference picture indices refIdxL0 and refIdxL1, and motion vectors mvL0 and mvL1, and are decoded from encoded data in units of CU. predFlagL0 and predFlagL1 are flags indicating whether a reference picture list (L0 list, L1 list) is used, and when the value is 1, the corresponding reference picture list is used. Note that in this specification, when the term "flag indicating whether XX is true" is used, a flag other than 0 (e.g., 1) indicates XX, and 0 indicates non-XX, and in logical negation, logical product, etc., 1 is treated as true and 0 is treated as false (the same applies below). However, in actual devices and methods, other values ​​may be used as true and false values.

[0055] To derive inter prediction parameters, for example, the following syntax elements are decoded on a CU-by-CU basis: skip flag skip_flag, merge flag merge_flag (general_merge_flag), merge index merge_idx, merge_subblock_flag, regular_merge_flag, ciip_flag, merge_gpm_partition_idx, merge_gpm_idx0, merge_gpm_idx1, inter_pred_idc, reference picture index refIdxLX, mvp_LX_idx, difference vector mvdLX, motion vector precision flag amvr_flag, and motion vector precision index amvr_precision_idx. merge_subblock_flag is a flag indicating whether to use subblock-based inter prediction. regular_merge_flag is a flag indicating whether to use normal merge mode or MMVD. ciip_flag is a flag indicating whether to use CIIP (Combined Inter-picture merge and Intra-picture Prediction) mode. merge_gpm_partition_idx is an index indicating the partition shape in GPM mode. merge_gpm_idx0 and merge_gpm_idx1 are indices indicating the merge index in GPM mode. inter_pred_idc is an inter prediction identifier for selecting a reference picture to be used in AMVP mode. mvp_LX_idx is a predicted vector index for deriving a motion vector.

[0056] (Reference Picture List) The reference picture list is a list of reference pictures stored in the reference picture memory 306. In each CU, refIdxLX specifies which picture in the reference picture list RefPicList[X] (X = 0 or 1) to actually reference. Note that LX is a notation method used when there is no distinction between L0 prediction and L1 prediction; hereinafter, parameters for the L0 list and parameters for the L1 list will be distinguished by replacing LX with L0 or L1.

[0057] (Merge Prediction and AMVP Prediction) Prediction parameter decoding (encoding) methods include merge prediction mode (merge mode) and AMVP (Advanced Motion Vector Prediction, adaptive motion vector prediction) mode, and general_merge_flag is a flag for distinguishing between them. Merge mode is a prediction mode that omits some or all of the motion vector difference, and derives the prediction list usage flag predFlagLX, reference picture index refIdxLX, and motion vector mvLX from the encoded data, instead of including them in the encoded data, and instead derives them from prediction parameters of already processed neighboring blocks, etc. AMVP mode is a mode that includes inter_pred_idc, refIdxLX, and mvLX in the encoded data. Note that mvLX is encoded as mvp_LX_idx, which identifies the prediction vector mvpLX, and the difference vector mvdLX. The general term for prediction modes that omit or simplify motion vector differences is called the general merge mode, and general_merge_flag can be used to select between general merge mode and AMVP prediction. general_merge_flag is decoded from the coded data if the current block is not in skip mode, and is set to 1 if the current block is in skip mode.

[0058] If general_merge_flag is 1, regular_merge_flag may be transmitted separately. If regular_merge_flag is 1, normal merge mode or MMVD may be selected, and otherwise CIIP mode or GPM mode may be selected. CIIP mode generates a predicted image by weighted sum of inter-predicted image and intra-predicted image. GPM mode generates a predicted image by combining two regions separated by a line segment within the target CU.

[0059] inter_pred_idc is a value indicating the type and number of reference pictures, and takes one of the values ​​PRED_L0, PRED_L1, or PRED_BI. PRED_L0 and PRED_L1 indicate uni-prediction using one reference picture managed in the L0 list and L1 list, respectively. PRED_BI indicates bi-prediction using two reference pictures managed in the L0 list and L1 list.

[0060] The merge_idx is an index indicating which prediction parameter from among prediction parameter candidates (merge candidates) derived from blocks for which processing has been completed is to be used as the prediction parameter for the current block.

[0061] (Motion Vector) mvLX indicates the amount of shift between blocks on two different pictures. The predicted vector and differential vector related to mvLX are called mvpLX and mvdLX, respectively.

[0062] (Inter prediction identifier inter_pred_idc and prediction list use flag predFlagLX) The relationship between inter_pred_idc, predFlagL0, and predFlagL1 is as follows, and they can be converted into each other.

[0063] inter_pred_idc = (predFlagL1<<1)+predFlagL0 predFlagL0 = inter_pred_idc & 1 predFlagL1 = inter_pred_idc >> 1 Note that, as the inter prediction parameters, a prediction list usage flag or an inter prediction identifier may be used. Furthermore, a determination using the prediction list usage flag may be replaced with a determination using the inter prediction identifier. Conversely, a determination using the inter prediction identifier may be replaced with a determination using the prediction list usage flag.

[0064] (Determination of Bi-Prediction biPred) The flag biPred indicating whether or not bi-prediction is performed can be derived based on whether two prediction list usage flags are both 1. For example, it can be derived using the following formula.

[0065] biPred = (predFlagL0==1 && predFlagL1==1) Alternatively, biPred can also be derived based on whether the inter prediction identifier is a value indicating the use of two prediction lists (reference pictures). For example, it can be derived using the following formula:

[0066] biPred = (inter_pred_idc==PRED_BI) ? 1 : 0 (Configuration of Video Decoding Apparatus) The configuration of a video decoding apparatus 31 (FIG. 3) according to this embodiment will be described.

[0067] The video decoding device 31 includes an entropy decoding unit 301, a parameter decoding unit (prediction parameter decoding device) 302, a loop filter 305, a reference picture memory 306, a prediction parameter memory 307, a prediction image generation unit (prediction image generation device) 308, an inverse quantization and inverse transform unit 311, an adder 312, and a prediction parameter derivation unit 320. Note that the video decoding device 31 may also be configured without including the loop filter 305, in accordance with the video coding device 11 described below.

[0068] The parameter decoding unit 302 further includes a header decoding unit 3020, a CT information decoding unit 3021, and a CU decoding unit 3022 (prediction mode decoding unit), and the CU decoding unit 3022 further includes a TU decoding unit 3024. These may be collectively referred to as a decoding module. The header decoding unit 3020 decodes parameter set information such as VPS, SPS, PPS, and APS, and slice headers (slice information) from the coded data. The CT information decoding unit 3021 decodes the CT from the coded data. The CU decoding unit 3022 decodes the CU from the coded data. The TU decoding unit 3024 decodes the CU from the coded data.

[0069] When a TU includes a prediction error, the TU decoding unit 3024 decodes QP update information (quantization correction value) and quantization prediction error (residual_coding) from the coded data. The QP update information is a difference value from a quantization parameter predicted value qPpred, which is a predicted value of the quantization parameter QP.

[0070] The TU decoding unit 3024 decodes the QP update information and the quantized prediction error from the coded data when the mode is other than the skip mode (skip_mode==0). More specifically, when skip_mode==0, the TU decoding unit 3024 decodes the flag cu_cbp indicating whether or not the current block includes a quantized prediction error, and decodes the quantized prediction error when cu_cbp is 1. When cu_cbp does not exist in the coded data, it is derived as 0.

[0071] The TU decoding unit 3024 decodes an index mts_idx indicating a transform base from the coded data. The TU decoding unit 3024 also decodes an index stIdx indicating the use of a secondary transform and the transform base from the coded data. stIdx indicates no application of a secondary transform when it is 0, indicates one transform of a set (pair) of secondary transform bases when it is 1, and indicates the other transform of the pair when it is 2.

[0072] The TU decoding unit 3024 may also decode a sub-block transform flag cu_sbt_flag. When cu_sbt_flag is 1, the CU is divided into multiple sub-blocks and the residual of only one specific sub-block is decoded. The TU decoding unit 3024 may also decode a flag cu_sbt_quad_flag indicating whether the number of sub-blocks is 4 or 2, cu_sbt_horizontal_flag indicating the division direction, and cu_sbt_pos_flag indicating a sub-block that includes a non-zero transform coefficient.

[0073] The predicted image generating unit 308 includes an inter predicted image generating unit 309 and an intra predicted image generating unit 310 .

[0074] The prediction parameter derivation unit 320 includes an inter prediction parameter derivation unit 303 and an intra prediction parameter derivation unit.

[0075] In the following, an example will be described in which CTUs and CUs are used as processing units, but this is not limiting and processing may be performed in sub-CU units. Alternatively, CTUs and CUs may be read as blocks, and sub-CUs as sub-blocks, and processing may be performed in block or sub-block units.

[0076] The entropy decoding unit 301 performs entropy decoding on the externally input coded stream Te to decode individual codes (syntax elements). Entropy coding can be performed in two ways: one is to perform variable-length coding of syntax elements using a context (probability model) adaptively selected according to the type of syntax element and the surrounding circumstances, and the other is to perform variable-length coding of syntax elements using a predetermined table or formula.

[0077] The entropy decoding unit 301 performs entropy decoding on the externally input coded stream Te to decode individual codes (syntax elements). Entropy coding can be divided into two types: variable-length coding of syntax elements using a context (probability model) adaptively selected according to the type of syntax element and surrounding conditions, and variable-length coding of syntax elements using a predefined table or formula. The former, CABAC (Context Adaptive Binary Arithmetic Coding), stores the CABAC state of the context (the type of most probable symbol (0 or 1) and a probability state index pStateIdx that specifies the probability) in memory. The entropy decoding unit 301 initializes all CABAC states at the beginning of a segment (tile, CTU row, slice). The entropy decoding unit 301 converts the syntax elements into a binary string (bin string) and decodes each bit of the bin string.

[0078] The entropy decoding unit 301 outputs the decoded code to the parameter decoding unit 302. The decoded code includes, for example, a prediction mode predMode, general_merge_flag, merge_idx, inter_pred_idc, refIdxLX, mvp_LX_idx, mvdLX, amvr_flag, amvr_precision_idx, ciip_flag, merge_gpm_partition_idx, gpm_mmvd_flag0, gpm_mmvd_distance_idx0, gpm_mmvd_direction_idx0, gpm_mmvd_enable_flag1, gpm_mmvd_distance_idx1, gpm_mmvd_direction_idx1, merge_gpm_idx0, merge_gpm_idx1, etc. Control of which code to decode is performed based on an instruction from the parameter decoding unit 302.

[0079] The loop filter 305 is a filter provided in the encoding loop that removes block distortion and ringing distortion to improve image quality. The loop filter 305 applies filters such as a deblocking filter, a sample adaptive offset (SAO), and an adaptive loop filter (ALF) to the decoded image of the CU generated by the adder 312.

[0080] The reference picture memory 306 stores the decoded image of the CU generated by the adder 312 in a predetermined location for each current picture and current CU.

[0081] The prediction parameter memory 307 stores prediction parameters at a predetermined location for each CTU or CU to be decoded. Specifically, the prediction parameter memory 307 stores the parameters decoded by the parameter decoding unit 302 and the prediction mode predMode decoded by the entropy decoding unit 301.

[0082] The predicted image generation unit 308 receives input of predMode, prediction parameters, etc. The predicted image generation unit 308 also reads a reference picture from the reference picture memory 306. The predicted image generation unit 308 generates a predicted image of a block or sub-block using the prediction parameters and the read reference picture (reference block) in the prediction mode indicated by predMode. Here, the reference block is a set of pixels on the reference picture (usually rectangular, and therefore called a block), and is an area referenced to generate a predicted image.

[0083] (Configuration of Inter-Prediction Parameter Derivation Unit) FIG. 5 shows the configuration of the inter-prediction parameter derivation unit 303. As shown in FIG.

[0084] The inter prediction parameter derivation unit 303 derives inter prediction parameters by referring to prediction parameters stored in the prediction parameter memory 307, based on the syntax elements decoded by the parameter decoding unit 302. The inter prediction parameter derivation unit 303 also outputs the inter prediction parameters to the inter prediction image generation unit 309 and the prediction parameter memory 307. The inter prediction parameter derivation unit 303 and its internal elements, namely, the AMVP prediction parameter derivation unit 3032, the merge prediction parameter derivation unit 3036, the MMVD prediction unit 30376, the GPM prediction unit 30377, the affine prediction unit 30372, the DMVR unit 30375, and the MV addition unit 3038, are means common to the video encoding device and the video decoding device, and therefore may be collectively referred to as a motion vector derivation unit (motion vector derivation device).

[0085] If general_merge_flag is 1, that is, if it indicates merge prediction mode, merge_idx is decoded and output to the merge prediction parameter derivation unit 3036 .

[0086] When general_merge_flag is 0, that is, when it indicates the AMVP prediction mode, the AMVP prediction parameter derivation unit 3032 derives mvpLX from inter_pred_idc, refIdxLX, or mvp_LX_idx.

[0087] If sym_mvd_flag is 0, that is, if it does not indicate SMVD (Symmetric Motion Vector Difference) mode, the AMVP prediction parameter derivation unit 3032 uses mvdLX corresponding to L0 and L1 decoded by the parameter decoding unit 302.

[0088] When sym_mvd_flag is 1, i.e., when SMVD mode is indicated, the parameter decoding unit 302 derives refIdxLX and mvdLX only for L0, and the AMVP prediction parameter derivation unit 3032 derives refIdxL1 and MvdL1 so that the MVD is temporally and spatially symmetric with the MVD of L0. MvdL1[0] = -MvdL0[0] MvdL1[1] = -MvdL0[1] (Merge Prediction) The merge prediction parameter derivation unit 3036 includes a merge candidate derivation unit 30361 and a merge candidate selection unit 30362. Note that merge candidates include prediction parameters (predFlagLX, mvLX, refIdxLX) and are stored in a merge candidate list. Merge candidates stored in the merge candidate list are assigned indices according to a predetermined rule.

[0089] The merge candidate derivation unit 30361 derives merge candidates by directly using the motion vectors and refIdxLX of the decoded adjacent blocks. Alternatively, the merge candidate derivation unit 30361 may apply a spatial merge candidate derivation process, a temporal merge candidate derivation process, or the like, which will be described later.

[0090] In the spatial merge candidate derivation process, the merge candidate derivation unit 30361 reads prediction parameters stored in the prediction parameter memory 307 according to a predetermined rule and sets them as merge candidates. For example, the prediction parameters for the positions A1, B1, B0, A0, and B2 shown in FIG. 7 are read.

[0091] A1: (xCb-1, yCb+cbHeight-1) B1: (xCb+cbWidth-1, yCb-1) B0: (xCb+cbWidth, yCb-1) A0: (xCb-1, yCb+cbHeight) B2: (xCb-1, yCb-1) The top left coordinates of the target block are (xCb, yCb), the width is cbWidth, and the height is cbHeight.

[0092] As a temporal merge derivation process, the merge candidate derivation unit 30361 may read the prediction parameters of the lower right CBR of the target block or the block C in the reference image including the center coordinates from the prediction parameter memory 307, set it as a merge candidate Col, and store it in the merge candidate list mergeCandList[].

[0093] The order in which mergeCandList[] is stored is, for example, spatial merge candidates (B1, A1, B0, A0, B2), followed by temporal merge candidate Col. Reference blocks that are unavailable (e.g., blocks that are intra-predicted) are not stored in the merge candidate list. i = 0 if(availableFlagB1) mergeCandList[i++] = B1 if(availableFlagA1) mergeCandList[i++] = A1 if(availableFlagB0) mergeCandList[i++] = B0 if(availableFlagA0) mergeCandList[i++] = A0 if(availableFlagB2) mergeCandList[i++] = B2 if(availableFlagCol) mergeCandList[i++] = Col. Furthermore, history merge candidate HmvpCand, pairwise average candidate avgCand, and zero merge candidate zeroCandm may be added to mergeCandList[] and used. for (j=1, j <= numHmvpCand; j++) if( i < MaxNumMergeCand && numHmvpCand > 0) mergeCandList[ i++ ] = HmvpCand[numHmvpCand - j] if( i < MaxNumMergeCand && i > 1 ) mergeCandList[ i++ ] = avgCand if( i < MaxNumMergeCand ) mergeCandList[ i++ ] = zeroCand Furthermore, non-adjacent spatial merge candidates may be added to mergeCandList[] and used. Unlike the spatial merge candidates (B1, A1, B0, A0, B2), non-adjacent spatial merge candidates are merge candidates that use prediction parameters from positions that are not adjacent to the target block.

[0094] The merge candidate selection unit 30362 selects a merge candidate N indicated by merge_idx from among the merge candidates included in the merge candidate list using the following formula.

[0095] N = mergeCandList[merge_idx] where N is a label indicating a merge candidate, such as A1, B1, B0, A0, B2, Col, etc. The motion information of the merge candidate indicated by label N is indicated by (mvLXN[0], mvLXN[1]), predFlagLXN, and refIdxLXN.

[0096] The merge candidate selection unit 30362 stores the inter prediction parameters of the selected merge candidate in the prediction parameter memory 307 and outputs them to the inter prediction image generation unit 309.

[0097] (MMVD prediction unit 30376) When mmvd_flag is 1, the MMVD prediction unit 30376 decodes the further restricted difference vector and performs MMVD (Merge with Motion Vector Difference) processing. The MMVD processing adds a difference vector restricted to a predetermined distance and a predetermined direction to the motion vector of the merge candidate. In MMVD mode, the value range of the difference vector is restricted to a predetermined distance (e.g., 6 ways, 8 ways, etc.) and a predetermined direction (e.g., 4 directions, 8 directions, 16 directions, etc.), thereby efficiently deriving a motion vector.

[0098] The MMVD prediction unit 30376 selects the central vector mvLXN[ ] using base_candidate_idx.

[0099] N = mergeCandList[base_candidate_idx] The MMVD prediction unit 30376 derives a base distance (mvdUnit[0], mvdUnit[1]) from distance_idx, and derives a distance MmvdDistance from distance_idx. The table shown in FIG.

[0100] mvdUnit[0] = DirectionTableNx[mmvd_direction_idx] mvdUnit[1] = DirectionTableN4y[mmvd_direction_idx] MmvdDistance = DistanceTable[mmvd_distance_idx] Here, DistanceTable may be {1, 2, 4, 8, 16, 32, 64, 128, 256}. It may also be derived by a left shift operation without referencing the table.

[0101] MmvdDistance = 1<< mmvd_distance_idx DirectionTableNx and DirectionTableNy may be any of the following tables with N=4, N=8, or N=16. DirectionTable4x[] = { 1, -1, 0, 0} DirectionTable4y[] = { 0, 0, 1, -1} DirectionTable8x[] = { 1, -1, 0, 0, 1, -1, 1,-1} DirectionTable8y[] = { 0, 0, 1, -1, 1, -1,-1, 1} DirectionTable16x[] = { 1, -1, 0, 0, 1, -1, 1,-1, 2,-2, 2,-2, 1, 1,-1,-1} DirectionTable16y[] = { 0, 0, 1, -1, 1, -1,-1, 1, 1, 1,-1,-1, 2,-2, 2,-2} The MMVD prediction unit 30376 calculates the direction of the direction of the input signal from (mvdUnit[0], The difference vector refineMvdLX[] is derived using the product of mvdUnit[1]) and MmvdDistance.

[0102] refineMvdL0[0] = (MmvdDistance << shiftMMVD) * mvdUnit[0] refineMvdL0[1] = (MmvdDistance << shiftMMVD) * mvdUnit[1] refineMvdL1[0] = -(MmvdDistance << shiftMMVD) * mvdUnit[0] refineMvdL1[1] = -(MmvdDistance << shiftMMVD) * mvdUnit[1] Here, shiftMMVD is a value for adjusting the magnitude of the differential vector so as to match the accuracy MVPREC of the motion vector in the motion compensation unit 3091 (interpolation unit). For example, shiftMMVD = 2 may be used.

[0103] Scaling may be performed according to the POC difference between the reference picture and the target picture.

[0104] Finally, the MMVD prediction unit 30376 derives the motion vectors of the MMVD merge candidates from refineMvdLX and the central vector mvLXN as follows. mvL0[0] = mvL0N[0] + refineMvdL0[0] mvL0[1] = mvL0N[1] + refineMvdL0[1] mvL1[0] = mvL1N[0] + refineMvdL1[0] mvL1[1] = mvL1N[1] + refineMvdL1[1] (DMVR) The DMVR (Decoder side Motion Vector Refinement) process performed by the DMVR unit 30375 will be described. The DMVR process is a process of correcting the motion vectors mvL0 and mvL1 of the target CU derived by the merge prediction unit 30374 and the MMVD prediction unit 30376 using the predicted image derived from the motion vectors corresponding to the two reference pictures when the target CU is in the merge mode (when merge_flag is 1 or skip_flag is 1).

[0105] DMVR divides a target block into sub-blocks of 16 pixels each. However, if the height or width is less than 16 pixels, it does not divide the block. For each sub-block, when motion vector displacements dMvL0 and dMvL1 are synthesized with mvL0 and mvL1, respectively, the dMvL0 and dMvL1 that minimize the sum of absolute differences (SAD) between the L0 predicted image obtained by mvL0 + dMvL0 and the L1 predicted image obtained by mvL1 + dMvL1 are calculated. However, when the components of the motion vector displacements dMvL0 and dMvL1 are (dMvL0[0], dMvL0[1]) and (dMvL1[0], dMvL1[1]), respectively, dMvL1[0] = -dMvL0[0] and dMvL1[1] = -dMvL0[1]. For the values ​​of dMvL0 and dMvL1 within a predetermined range, the dMvL0 and dMvL1 that give the smallest SAD value are defined as dMvL0_min and dMvL1_min.

[0106] The DMVR unit 30375 derives the motion vector changes dmvL0 and dmvL1 for correcting mvL0 and mvL1 by referring to the following: the top left position (xCb, yCb) of the target block; the width bW of the target block; the height bH of the target block; the motion vectors mvL0 and mvL1 with 1 / 16 pixel precision; and the reference pictures refPicL0L and refPicL1L.

[0107] If all of the following conditions are true, the DMVR unit 30375 sets dmvrFlag to 1, performs subsequent DMVR processing, and corrects the motion vector. Otherwise, it sets dmvrFlag to 0. - The DMVR on / off flag dmvr_enabled_flag is 1 - The merge flag merge_flag is 1 - Bi-prediction is enabled (predFlagL0 and predFlagL1 are 1) - mmvd_flag is 0 - The POC difference between the current picture currPic and the L0 reference picture RefPicList[0][refIdxL0] is equal to the POC difference between the L1 reference picture RefPicList[1][refIdxL1] and the current picture currPic. DiffPicOrderCnt( currPic, RefPicList[0][refIdxL0] ) == DiffPicOrderCnt( RefPicList[1][refIdxL1], currPic ) - The size of the CU is equal to or greater than a predetermined size (for example, cbHeight>=8 and cbHeight*cbWidth>=64) Note that dmvr_enabled_flag may be a flag for encoding using SPS. There may also be no restriction on the POC difference, or a conditional expression different from the above may be used. The condition for determining whether the size of a CU is equal to or greater than a predetermined size does not have to be as described above, and may instead be a determination that cbWidth>=8 and cbHeight>=8, for example.

[0108] First, the DMVR unit 30375 (interpolation unit) derives a predicted image predSamplesLXL having a size of (sbW)*(sbH) by referring to the following: the top left position (xSb, ySb) of the current sub-block, the width sbW of the current sub-block of luminance samples, the height sbH of the current sub-block of luminance samples, the motion vector mvLX (X=0,1), and the reference picture refPicLXL (X=0,1). Note that the processing of the interpolation unit may be performed by the motion compensation unit 3091.

[0109] The DMVR unit 30375 derives the motion vector MvLsX (X=0, 1) using the following formula:

[0110] MvLsX[0] = MvLX[0] - 32 MvLsX[1] = MvLX[1] - 32 The DMVR unit 30375 also sets the values ​​of the variables srRange, offsetH[0], offsetV[0], offsetH[1], and offsetV[1] to 2, respectively.

[0111] Let (xIntL, yIntL) be the integer pixel position of the reference block corresponding to pixel position (xL, yL) in the current block. Also, let (xFracL, yFracL) be the offset from (xIntL, yIntL) in 1 / 16 pixel units. These coordinates are derived from the integer components (mvLX[0]>>4, mvLX[1]>>4) and fractional components (mvLX[0]&15, mvLX[1]&15) of the motion vector (mvLX[0], mvLX[1]), and indicate the pixel position with fractional precision within the reference picture refPicLXL. For a pixel located at (xL, yL) (xL=0, ..., sbW-1, yL=0, ..., sbH-1) in predSamplesLXL, the DMVR unit 30375 derives xIntL, yIntL, xFracL, and yFracL using the following equations.

[0112] xIntL = xSb + (mvLX[0]>>4) + xL yIntL = ySb + (mvLX[1]>>4) + yL xFracL = mvLX[0]&15 yFracL = mvLX[1]&15 Next, the DMVR unit 30375 derives predSamplesLXL by referring to: (xIntL, yIntL), (xFracL, yFracL), and refPicLXL.

[0113] First, the DMVR unit 30375 derives variables shift1, shift2, shift3, and shift4 using the following formulas.

[0114] shift1 = Min(6, BitDepthY - 6) shift2 = 4 shift3 = Max(2, 10-BitDepthY) (BitDepthY <= 10) shift4 = Max(2, BitDepthY - 10) (BitDepthY > 10) In the above equations, BitDepthY is the number of pixel bits.

[0115] Next, the DMVR unit 30375 sets picW equal to the picture width value of pic_width_in_luma_samples. The DMVR unit 30375 also sets picH equal to the picture height value of pic_height_in_luma_samples.

[0116] Then, the DMVR unit 30375 derives predSamplesLXL as follows. In the following description, fbL[p] denotes a filter coefficient for deriving a pixel value with 1 / 16 pixel accuracy. The value of fbL[p] depends on the position p (p=1, 2, ..., 15) with 1 / 16 pixel accuracy. The position p is equal to xFracL or yFracL. As the value of p increases, fbL[p][0] monotonically decreases and the value of fbL[p][1] monotonically increases.

[0117] First, the DMVR unit 30375 determines whether xFracL and yFracL are each 0. If both xFracL and yFracL are 0, the DMVR unit 30375 derives predSamplesLXL using one of the following formulas according to the value of BitDepthY.

[0118] predSamplesLXL = refPicLXL[xIntL][yIntL] << shift3 (BitDepthY <= 10) predSamplesLXL = refPicLXL[xIntL][yIntL] >> shift4 (BitDepthY > 10) If xFracL is not 0 and yFracL is 0, the DMVR unit 30375 derives predSamplesLXL using the following formula.

[0119] predSamplesLXL = (fbL[xFracL][0] * refPicLXL[Clip3(0,picW-1,xIntL)][yIntL] +fbL[xFracL][1] * refPicLXL[Clip3(0,picW-1,xIntL+1)][yIntL])>>shift1 When xFracL is 0 and yFracL is not 0, the DMVR unit 30375 derives predSamplesLXL using the following formula.

[0120] predSamplesLXL = (fbL[yFracL][0] * refPicLXL[xIntL][Clip3(0,picH-1,yIntL)] +fbL[yFracL][1] * refPicLXL[xIntL][Clip3(0,picH-1,yIntL+1)])>>shift1 If neither xFracL nor yFracL is 0, the DMVR unit 30375 derives predSamplesLXL as follows. First, the DMVR unit 30375 derives temp[n] using the following formula. The derivation process of temp[] is performed n times by changing the reference position. n=0 represents the first derivation process, and n=1 represents the second derivation process.

[0121] yPosL = Clip3(0, PicH-1, yIntL+n-3) temp[n] = (fbL[xFracL][0] * refPicLXL[Clip3(0,picW-1,xIntL)][yPosL] + fbL[xFracL][1] * refPicLXL[Clip3(0,picW-1,xIntL+1)][yPosL])>>shift1 Then, the DMVR unit 30375 derives predSamplesLXL using the following formula.

[0122] predSamplesLXL = (fbL[yFracL][0] * temp[0] + fbL[yFracL][1] * temp[1])>>shift2 The DMVR unit 30375 (interpolation unit) derives an array mrSad of costs of differences between pixel values ​​included in predSamplesL1 and predSamplesL2 by referring to: the sub-block width nSbW the sub-block height nCbH two predicted images predSamplesL1 and predSamplesL2 having a size of (nSbW+4)x(nSbH+4) variables offsetH[0], offsetH[1], offsetV[0], and offsetV[1]. Here, nSbW and nSbH may be 8 or 16, and the width nCbW and height nCbH of the target block may be used.

[0123] (M x N-point DMVR processing) The DMVR unit 30375 may derive an M x N-point SAD only once and perform motion vector refinement in a single process using raster scanning, etc. For example, it may derive 25-point SADs where M = 5 and N = 5, and derive intOffX and intOffY in pixel units for the position with the smallest SAD. Hereinafter, M2 = M / 2 and N2 = N / 2. When M = 5 and N = 5, M2 = N2 = 2.

[0124] The DMVR unit 30375 (cost array derivation unit) derives an MxN cost array mrSad[][] (without using distance scale values) from a predicted image pL0 (= predSamplesL0[x][y]) of size (nSbW+M2*2 x nSbH+N2*2) in the reference picture list L0 and a predicted image pL1 (= predSamplesL1[x][y]) of size (nSbW+M2*2 x nSbH+N2*2) in the reference picture list L1 (without using distance scale values) (S512D). mrSad[dX][dY] = Σ(x=0..nSbW-1)Σ(y=0..nSbH-1)Abs(pL0[x+M2+dX][y+N2+dY]-pL1[x+M2-dX][y+N2-dY]) Here, dX=0..M-1, dY=0..N-1. Note that the predicted image may be generated using bilinear interpolation corresponding to a separable two-tap filter.

[0125] The DMVR unit 30375 corrects the values ​​of mrSad[dX][dY] where dX==0 and dY==0 to become smaller values ​​mrSad[dX][dY] = mrSad[dX][dY] - (mrSad[dX][dY]>>2) (when dX==dY==0) The DMVR unit 30375 (vector correction unit) sets the dX and dY of the point with the smallest values ​​among mrSad[dX][dY] as bestX and bestY, and derives the relative position (intOffX, intOffY) when the center point is (0,0) from bestX and bestY using the following formula (S513): intOffX = (bestX - M2), intOffY = (bestY - N2) Here, the center point is set to (0,0) by subtracting the center point (M2, N2) of mrSad. The relative position (intOffX, intOffY) indicating the minimum position of the cost array mrSad is also called the minimum position vector (best sample offset). Note that it is also possible to search for cX = -M2..M2 and cY = -N2..N2 with 0 as the center for cX and cY, and derive infOffX and intOffY from the minimum position. The derivation may be performed using the following pseudocode: for( cY = -N2; cY <= N2; cY++ ) { for( cX = -M2; cX <= M2; cX++ ) { if( mrSad[ cX + M2 ][ cY + N2 ] < minSad ) { minSad = mrSad[ cX + M2 ][ cY + N2 ] intOffX = cX intOffY = cY}}} Furthermore, the DMVR unit 30375 (vector correction unit) calculates the integer-precision motion vector difference dmvL0 (without using a distance scale value) using the equations dmvL0[0] = 16*intOffX dmvL0[1] = 16*intOffY (S514D).

[0126] (Parametric Motion Vector Refinement Processing) If subPelFlag is true, the DMVR unit 30375 (vector correction unit) performs parametric motion vector refinement processing. Parametric motion vector refinement processing further corrects the position of the motion vector according to the left SAD value (mrSadL) and right SAD value (mrSadR) of the derived center vector SAD value (mrSadC), as well as the top SAD value (mrSadT) and bottom SAD value (mrSadB). Here, dMvX and dMvY are derived in subpixel units to the position assumed to have the smallest SAD.

[0127] Figure 10 is a diagram explaining the operation of parametric motion vector refinement. As shown in Figure 10(a), a 3x3 mrSad[][] around the minimum position (center position) of integer DMVR processing is used. Here, the following 3x3 mrSad2[][] is derived.

[0128] mrSad2[dX+1-intOffX][dY+1-intOffY] = mrSad[dX+M2][dY+N2] where dX=intOffX-1..intOffX+1, dY=intOffY-1..intOffY+1.

[0129] Or, mrSad2[cX+1][cY+1] = mrSad[cX+intOffX+M2][cY+intOffY+N2] where cX=-1..1, cY=-1..1.

[0130] Figures 10(b) and 10(c) show three SAD values ​​arranged horizontally and vertically from the minimum position with integer precision. An approximate curve passing through the three points is drawn. As shown in the figure, even if only SAD values ​​at positions shifted by integer pixels are searched, the motion vector can be refined with fractional pixel precision by using the position corresponding to the minimum point of the approximate curve (shifting the motion vector with sub-pel precision). A quadratic function passing through the three points may also be used as the approximate curve.

[0131] The DMVR unit 30375 sets sadMinus, sadCenter, sadPlus = mrSad2[0][1], mrSad2[1][1], mrSad2[2][1], and derives the position dMvX (dMvX = -8..8) corresponding to the minimum value of the curve passing through the three points using the following formula: dMvX = ((sadMinus - sadPlus)<<3) / ( sadMinus + sadPlus - (sadCenter<<1)) The DMVR unit 30375 sets sadMinus, sadCenter, sadPlus = mrSad2[1][0], mrSad2[1][1], mrSad2[1][2], and derives the position dMvY (dMvY = -8..8) corresponding to the minimum value of the curve passing through the three points using the following formula: dMvY = ((sadMinus - sadPlus)<<3) / ( sadMinus + sadPlus - (sadCenter<<1)) The DMVR unit 30375 (vector correction unit) corrects the motion vector as follows: dmvL0[0] += dMvX dmvL0[1] += dMvY The DMVR unit 30375 (vector correction unit) calculates the motion vector difference dmvL1 using the following formula through the above parametric motion vector refinement process.

[0132] dmvL1[0] = -dmvL0[0] dmvL1[1] = -dmvL0[1] Note that dX and dY may use the values ​​of dMvC derived by the following pseudo code. denom = ( ( sadMinus + sadPlus ) - ( sadCenter << 1 ) ) << 3 if( denom = = 0 ) dMvC = 0 else { if( sadMinus = = sadCenter ) {dMvC = -8} else if( sadPlus = = sadCenter ) {dMvC = 8} else { num = ( sadMinus - sadPlus ) << 4 signNum = 0 if( num < 0 ) {num = -num; signNum = 1} quotient = 0 counter = 3 while( counter > 0 ) { counter = counter - 1 quotient = quotient << 1 if( num >= denom ) {num = num - denom; quotient = quotient + 1} denom = ( denom >> 1 )} if( signNum = = 1 ) {dMvC = -quotient} else {dMvC = quotient}}} <DMVR when distances are different> The following describes a method for deriving DMVR when the distance between the current picture and the L0 reference picture (L0 distance, Abs(currPocDiffL0)) and the distance between the current picture and the L1 reference picture (L1 distance, Abs(currPocDiffL1)) are different. Note that it is also possible to compare currPocDiffL0 and currPocDiffL1 without using absolute values ​​(for example, the distances are determined to be equal if currPocDiffL0 = - currPocDiffL1 is determined to be true). The method for deriving currPocDiffL0 and currPocDiffL1 will be described later. The distance may be the absolute value of the POC difference, the POC distance.

[0133] 11 shows a flowchart of the DMVR determination process of this embodiment. In another form of DMVR determination process of this embodiment, the DMVR unit 30375 sets dmvrFlag to 1 if all of the following conditions are true (S305), and performs the subsequent DMVR process to correct the motion vector. Otherwise, it sets dmvrFlag to 0 (S306). - The DMVR on / off flag dmvr_enabled_flag is 1 - The merge flag merge_flag is 1 - Bi-prediction is enabled (S301, for example, predFlagL0 and predFlagL1 are 1) - The MMVD flag is 0 (S302) - The POC difference between the L0 reference picture RefPicList[0][refIdxL0] and the current picture's currPic is equal to a constant multiple of the POC difference between the L1 reference picture RefPicList[1][refIdxL1] and the current picture's currPic (S303). For example, it is considered true if the remainder of the POC difference ratio below, RemPocDiffRatio, is 0.

[0134] RemPocDiffRatio = Abs(currPocDiffL1) > Abs(currPocDiffL0) ? Abs(currPocDiffL1) % Abs(currPocDiffL0) : Abs(currPocDiffL0) % Abs(currPocDiffL1) Here, x%y is the modulus. The remainder when x is divided by y. Defined only for integers x and y where x>=0, y>0. - The size of the CU is equal to or greater than a certain size (S304, for example, cbHeight>=8 and cbHeight*cbWidth>=64). A determination that the target picture is sandwiched between two reference pictures (S305) may be added to the above. DiffPicOrderCnt(currPic, RefPicList[0][refIdxL0]) * DiffPicOrderCnt(currPic, RefPicList[0][refIdxL0]) < 0 In other words, dmvrFlag may be set to true only when the current picture is sandwiched between two reference pictures.

[0135] The DMVR unit 30375 performs the following processing when dmvrFlag is 1 (S307): When dmvrFlag is 0, the processing of the DMVR unit 30375 ends here without performing the processing of changing the motion vector.

[0136] FIG. 12 is a flowchart showing the motion vector refinement process (DMVR) including the case where the distances are different.

[0137] (Example A1 when the distances are different) The DMVR unit 30375 derives the distance currPocDiffL0 between the current picture and the L0 reference picture and the distance currPocDiffL1 between the current picture and the L1 reference picture (S501). currPocDiffL0 = DiffPicOrderCnt(currPic, RefPicList[0][refIdxL0]) currPocDiffL1 = DiffPicOrderCnt(currPic, RefPicList[1][refIdxL1]) Note that the following is also acceptable. currPocDiffL0 = DiffPicOrderCnt(currPic, RefPicList[0][refIdxL0]) currPocDiffL1 = DiffPicOrderCnt(RefPicList[1][refIdxL1], currPic) The DMVR unit 30375 derives a distance scale value (hereinafter simply referred to as the scale value) DisDisScaleLX from the ratio of the L0 distance currPocDiffL0 to the L1 distance currPocDiffL1 (S511).

[0138] DisDisScaleL0 = (Abs(currPocDiffL0)>Abs(currPocDiffL1)) ? Abs(currPocDiffL0) / Abs(currPocDiffL1) : 1 DisDisScaleL1 = (Abs(currPocDiffL1)>Abs(currPocDiffL0)) ? Abs(currPocDiffL1) / Abs(currPocDiffL0) : 1 Note that it may also be derived as follows, limited to when the target picture is sandwiched between two reference pictures.

[0139] DisDisScaleL0 = currPocDiffL0 / -currPocDiffL1 DisDisScaleL1 = currPocDiffL1 / -currPocDiffL0 if (DisDisScaleL0 == 0) DisDisScaleL0 = 1 if (DisDisScaleL1 == 0) DisDisScaleL1 = 1 The DMVR unit 30375 derives the cost array mrSad using the scale value DisScaleLX (S512).

[0140] The DMVR unit 30375 derives an interpolated image of a size according to the scale value DisScaleLX. Specifically, it derives two predicted images predSamplesL0 (=pL0) and predSamplesL1 (=pL1) of sizes (nSbW+2*M2*DisScaleL0) x (nCbH+2*N2*DisScaleL0) and (nSbW+2*M2*DisScaleL1) x (nCbH+2*N2*DisScaleL1).

[0141] The DMVR unit 30375 uses the derived two images pL0 and pL1 and the scale value DisScaleLX to derive a cost array mrSad indicating the magnitude of the difference in dX and dY between the two images.

[0142] mrSad[dX][dY] = Σ(x=0..nSbW-1)Σ(y=0..nSbH-1)Abs(pL0[x+(M2+dX)*DisScaleL0][y+(N2+dY)*DisScaleL0]-pL1[x+(M2-dX)*DisScaleL1][y+(N2-dY)*DisScaleL1]) Here, the Sum of Absolute Difference (SAD) is used, but the cost is not limited to this. It may be SATD (Sum of Absolute Transformed Difference) or SAD (mean-removed sum of absolute differences (MRSAD)) with the DC component removed (same below). D = (Σ(x=0..nSbW-1)Σ(y=0..nSbH-1)(pL0[x+(M2+dX)][y+(N2+dY)]-pL1[x+(M2-dX)][y+(N2-dY)])) / (nSbW*nSbH) mrSad[dX][dY] = MRSAD[dX][dY] = Σ(x=0..nSbW-1)Σ(y=0..nSbH-1)Abs(pL0[x+(M2+dX)][y+(N2+dY)]-pL1[x+(M2-dX)][y+(N2-dY)] - D) The DMVR unit 30375 derives a minimum position vector (intOffX, intOffY) that indicates the position of the minimum value in the cost array mrSad (S513).

[0143] The DMVR unit 30375 derives a difference vector from the minimum position vector and the distance scale value (S514). Specifically, the DMVR unit 30375 calculates integer precision motion vector differences dmvL0 and dmvL1 using the product of the scale value and the minimum position vector (intOffX, intOffY).

[0144] dmvL0[0] = 16*intOffX*DisScaleL0 dmvL0[1] = 16*intOffY*DisScaleL0 dmvL1[0] = -16*intOffX*DisScaleL1 dmvL1[1] = -16*intOffY*DisScaleL1 The parametric DMVR unit 30375 derives the minimum position vector (dMvX, dMvY) of the cost array mrSad2 using the method already described. The DMVR unit 30375 calculates motion vector differentials dmvL0 and dmvL1 using the minimum position vector (dMvX, dMvY) and scale value of the parametric motion vector refinement process.

[0145] dmvL0[0] += dMvX*DisScaleL0 dmvL0[1] += dMvY*DisScaleL0 dmvL1[0] -= dMvX*DisScaleL1 dmvL1[1] -= dMvY*DisScaleL1 (Example A2 when distances are different) Below, we will explain a method similar to example A1, but using branching. In example A1, the scale values ​​were derived for both the L0 and L1 reference pictures, so processing was performed without distinguishing between cases depending on the magnitude of the distance, but it is also possible to derive the scale value from just one by distinguishing between cases depending on the magnitude of the distance, as shown below.

[0146] The DMVR unit 30375 derives the distance currPocDiffL0 between the current picture and the L0 reference picture and the distance currPocDiffL1 between the current picture and the L1 reference picture (S501).

[0147] (When L1 distance>L0 distance) When Abs(currPocDiffL1)>Abs(currPocDiffL0), the DMVR unit 30375 performs the following process. Here, it is expressed as >, but it can also be >=.

[0148] The DMVR unit 30375 compares the L0 distance currPocDiffL0 with the L1 distance currPocDiffL1, and derives the scale value DisScaleLX by dividing the larger value by the smaller value (S511).

[0149] DisScaleL1=Abs(currPocDiffL1) / Abs(currPocDiffL0) The DMVR unit 30375 derives the cost array mrSad using the scale value DisScaleLX (S512).

[0150] The DMVR unit 30375 derives an interpolated image of a size according to the scale value DisScaleLX. Specifically, it derives a larger predicted image for the larger distance. It derives two predicted images predSamplesL0 and predSamplesL1, each of which has a size of (nSbW+2*M2) x (nCbH+2*N2) and (nSbW+2*M2*DisScaleL1) x (nCbH+2*N2*DisScaleL1).

[0151] mrSad[dX][dY] = Σ(x=0..nSbW-1)Σ(y=0..nSbH-1)Abs(pL0[x+M2+dX][y+N2+dY]-pL1[x+(M2-dX)*DisScaleL1][y+(N2-dY)*DisScaleL1]) The DMVR unit 30375 derives the minimum position vector (intOffX, intOffY) indicating the position of the minimum value of the cost array mrSad using the method already described (S513).

[0152] The DMVR unit 30375 derives a difference vector from the minimum position vector and the distance scale value (S514). Specifically, the DMVR unit 30375 calculates integer precision motion vector differences dmvL0 and dmvL1 using the product of the scale value and (intOffX, intOffY) as shown in the following equation:

[0153] dmvL0[0] = 16*intOffX dmvL0[1] = 16*intOffY dmvL1[0] = -16*intOffX*DisScaleL1 dmvL1[1] = -16*intOffY*DisScaleL1 The parametric DMVR unit 30375 calculates the motion vector difference dmvL1 using the minimum position vector (dMvX, dMvY) and scale value DisScaleL1 of the parametric motion vector refinement process.

[0154] dmvL0[0] += dMvX dmvL0[1] += dMvY dmvL1[0] -= dMvX*DisScaleL1 dmvL1[1] -= dMvY*DisScaleL1 (When L0 distance > L1 distance) The DMVR unit 30375 performs the following processing when Abs(currPocDiffL0) > Abs(currPocDiffL1). Here, > is used, but >= may also be used.

[0155] The DMVR unit 30375 compares the L0 distance currPocDiffL0 with the L1 distance currPocDiffL1, and derives the scale value DisScaleLX by dividing the larger value by the smaller value (S511).

[0156] DisScaleL0=Abs(currPocDiffL0) / Abs(currPocDiffL1) The DMVR unit 30375 derives the cost array mrSad using the scale value DisScaleLX (S512).

[0157] The DMVR unit 30375 derives an interpolated image of a size according to the scale value DisScaleLX. Specifically, it derives a larger predicted image for the larger distance. It derives two predicted images predSamplesL0 (=pL0) and predSamplesL1 (=pL1) of sizes (nSbW+2*M2*DisScaleL0) x (nCbH+2*N2*DisScaleL0) and (nSbW+2*M2*DisScaleL1) x (nCbH+2*N2*DisScaleL1).

[0158] mrSad[dX][dY] = Σ(x=0..nSbW-1)Σ(y=0..nSbH-1)Abs(pL0[x+(M2+dX)*DisScaleL0][y+(N2+dY)*DisScaleL0]-pL1[x+M2-dX][y+N2-dY]) The DMVR unit 30375 derives the minimum position vector (intOffX, intOffY) indicating the position of the minimum value of the cost array mrSad using the method already described (S513).

[0159] The DMVR unit 30375 derives a difference vector from the minimum position vector and the distance scale value (S514).

[0160] dmvL0[0] = 16*intOffX*DisScaleL0 dmvL0[1] = 16*intOffY*DisScaleL0 dmvL1[0] = -16*intOffX dmvL1[1] = -16*intOffY The parametric DMVR unit 30375 calculates the motion vector difference dmvL0 using the minimum position vector (dMvX, dMvY) and scale value DisScaleL0 of the parametric motion vector refinement process.

[0161] dmvL0[0] += dMvX*DisScaleL0 dmvL0[1] += dMvY*DisScaleL0 dmvL1[0] -= dMvX dmvL1[1] -= dMvY Figure 13 is a flowchart showing the motion vector refinement process (DMVR) including the case where the distances are different. Unlike Figure 12, a determination is made as to whether the distances are different (S501), and if the distances are different (YES in S501), the above-mentioned processes of S511, S512, S513, and S514 are performed. If the distances are equal (NO in S501), the processes of S512D, S513, and S514D are performed.

[0162] In Examples 1 and 2 above, when searching for the minimum value of mrSad in integer pixel units, if the reference pixel distance is 1:2 (DisScaleL0=1, DisScaleL1=2), the motion vector can be corrected in 1 pixel units (DisScaleL0 units) or 2 pixel units (DisScaleL1 units).

[0163] (Example B1 when distances are different) FIG. 14 is a flowchart showing the motion vector refinement process (DMVR) including the case when distances are different.

[0164] The DMVR unit 30375 derives the distance currPocDiffL0 between the current picture and the L0 reference picture and the distance currPocDiffL1 between the current picture and the L1 reference picture (S601). currPocDiffL0 = DiffPicOrderCnt(currPic, RefPicList[0][refIdxL0]) currPocDiffL1 = DiffPicOrderCnt(currPic, RefPicList[1][refIdxL1]) The DMVR unit 30375 derives a distance scale value (hereinafter simply referred to as the scale value) DisDisScaleLX from the ratio of the L0 distance currPocDiffL0 to the L1 distance currPocDiffL1 (S611).

[0165] DisDisScaleL0 = (Abs(currPocDiffL0)>Abs(currPocDiffL1)) ? Abs(currPocDiffL0) / Abs(currPocDiffL1) : 1 DisDisScaleL1 = (Abs(currPocDiffL1)>Abs(currPocDiffL0)) ? Abs(currPocDiffL1) / Abs(currPocDiffL0) : 1 The DMVR unit 30375 derives the cost array mrSad using the scale value DisScaleLX (S612).

[0166] The DMVR unit 30375 derives a predicted image (interpolated image) of a size according to the scale value DisScaleLX (S6121). Specifically, a predicted image predSamplesL0 (=pL0) with a size of ((nSbW+2*M2)*DisScaleL1) x ((nCbH+2*N2)*DisScaleL1) and a size of DisScaleL1 is derived, and a predicted image predSamplesL1 (=pL1) with a size of ((nSbW+2*M2)*DisScaleL0) x ((nCbH+2*N2)*DisScaleL0) and a size of DisScaleL0 is derived. That is, when DisScaleL1>1 for predSamplesL0, an image enlarged by DisScaleL1 is derived. When DisScaleL1==1, an image with the same size is derived. When DisScaleL0>1 for predSamplesL1, an image enlarged by DisScaleL0 is derived. When DisScaleL0==1, an image with the same size is derived.

[0167] The DMVR unit 30375 derives a cost array mrSad indicating the difference according to the dX and dY positions of pL0 and pL1 enlarged by the scale value or at the same magnification (S6122).

[0168] mrSad[dX][dY] = Σ(x=0..nSbW-1)Σ(y=0..nSbH-1)Abs(pL0[x+(M2+dX)][y+(N2+dY)]-pL1[x+(M2-dX)][y+(N2-dY)]) Here, the sum of absolute differences (SAD) is used, but the cost is not limited to this. SATD (Sum of Absolute Transformed Difference) or the like may also be used. Furthermore, the SAD (MRSAD) value excluding the DC component may also be used as follows:

[0169] The DMVR unit 30375 derives the minimum position vector (intOffX, intOffY) indicating the position of the minimum value in the cost array mrSad using the method already described (S613).

[0170] The DMVR unit 30375 derives a difference vector from the minimum position vector and the distance scale value (S614). Specifically, the DMVR unit 30375 calculates motion vector differences dmvL0 and dmvL1 using a value obtained by dividing the minimum position vector (intOffX, intOffY) with integer precision by the scale value.

[0171] dmvL0[0] = 16*intOffX / DisScaleL1 dmvL0[1] = 16*intOffY / DisScaleL1 dmvL1[0] = -16*intOffX / DisScaleL0 dmvL1[1] = -16*intOffY / DisScaleL0 The / DisScaleLX calculation may be a shift operation of >>log2(DisScaleLX) (for X = 0, 1, and the same applies below). The parametric DMVR unit 30375 derives the minimum position vector (dMvX, dMvY) of the cost array mrSad2 using the method already described. The DMVR unit 30375 calculates motion vector differentials dmvL0 and dmvL1 using the minimum position vector (dMvX, dMvY) and scale value of the parametric motion vector refinement process.

[0172] dmvL0[0] += dMvX / DisScaleL1 dmvL0[1] += dMvY / DisScaleL1 dmvL1[0] -= dMvX / DisScaleL0 dmvL1[1] -= dMvY / DisScaleL0 In this example, when searching for the minimum value of mrSad in integer pixel units, for example, if the reference pixel distance is 1:2 (DisScaleL0=1, DisScaleL1=2), the motion vector is corrected in 0.5 pixel units (1 / DisScaleL1 units) and 1 pixel units (1 / DisScaleL0 units). In this way, matching is performed in finer units than in Examples A1 and A2, improving accuracy. At the same time, it is more complex than Examples A1 and A2 because it is necessary to derive an enlarged image in pL0 or pL1.

[0173] (Example B2 When Distances Are Different) The following describes a method similar to Example B1, but using branching. In Example B1, the scale value was derived for both the L0 and L1 reference pictures, and processing was performed without distinguishing between cases depending on the magnitude of the distance. However, it is also possible to derive the scale value from only one case by distinguishing between cases depending on the magnitude of the distance, as follows:

[0174] The DMVR unit 30375 derives the distance currPocDiffL0 between the current picture and the L0 reference picture and the distance currPocDiffL1 between the current picture and the L1 reference picture (S501).

[0175] (When L1 distance>L0 distance) When Abs(currPocDiffL1)>Abs(currPocDiffL0), the DMVR unit 30375 performs the following process. Here, it is expressed as >, but it can also be >=.

[0176] The DMVR unit 30375 compares the L0 distance currPocDiffL0 with the L1 distance currPocDiffL1, and derives the scale value DisScaleLX by dividing the larger value by the smaller value (S511).

[0177] DisScaleL1=Abs(currPocDiffL1) / Abs(currPocDiffL0) The DMVR unit 30375 derives the cost array mrSad using the scale value DisScaleL1 (S512).

[0178] The DMVR unit 30375 derives an interpolated image of a size according to the scale value DisScaleL1. Specifically, the DMVR unit 30375 derives a predicted image predSamplesL0 that is DisScaleL1-times large and has a size of ((nSbW+2*M2)*DisScaleL1) x ((nSbH+2*N2)*DisScaleL1), and derives a predicted image predSamplesL1 that has a size of (nSbW+2*M2) x (nSbH+2*N2).

[0179] The DMVR unit 30375 derives a cost array mrSad that indicates the difference according to the dX and dY positions of pL0 and pL1 enlarged by the scale value or at the same magnification.

[0180] mrSad[dX][dY] = Σ(x=0..nSbW-1)Σ(y=0..nSbH-1)Abs(pL0[x+(M2+dX)][y+(N2+dY)]-pL1[x+(M2-dX)][y+(N2-dY)) The DMVR unit 30375 derives the minimum position vector (intOffX, intOffY) indicating the position of the minimum value of the cost array mrSad using the method already described (S513).

[0181] The DMVR unit 30375 derives a difference vector from the minimum position vector and the distance scale value (S514). Specifically, the DMVR unit 30375 calculates motion vector differences dmvL0 and dmvL1 using a value obtained by dividing the minimum position vector (intOffX, intOffY) with integer precision by the scale value.

[0182] dmvL0[0] = 16*intOffX / DisScaleL1 dmvL0[1] = 16*intOffY / DisScaleL1 dmvL1[0] = -16*intOffX dmvL1[1] = -16*intOffY The parametric DMVR unit 30375 derives the minimum position vector (dMvX, dMvY) of the cost array mrSad2 using the method already described. The DMVR unit 30375 calculates motion vector differentials dmvL0 and dmvL1 using the minimum position vector (dMvX, dMvY) and scale value of the parametric motion vector refinement process.

[0183] dmvL0[0] += dMvX / DisScaleL1 dmvL0[1] += dMvY / DisScaleL1 dmvL1[0] -= dMvX dmvL1[1] -= dMvY (When L0 distance > L1 distance) The DMVR unit 30375 performs the following processing when Abs(currPocDiffL0) > Abs(currPocDiffL1). Here, it is expressed as >, but it can also be >=.

[0184] The DMVR unit 30375 compares the L0 distance currPocDiffL0 with the L1 distance currPocDiffL1, and derives the scale value DisScaleLX by dividing the larger value by the smaller value (S511).

[0185] DisScaleL0=Abs(currPocDiffL0) / Abs(currPocDiffL1) The DMVR unit 30375 derives the cost array mrSad using the scale value DisScaleL0 (S512).

[0186] The DMVR unit 30375 derives an interpolated image of a size according to the scale value DisScaleL0. Specifically, the DMVR unit 30375 derives a predicted image predSamplesL0 having a size of (nSbW+2*M2)×(nSbH+2*N2), and derives a predicted image predSamplesL1 that is DisScaleL0-fold and has a size of ((nSbW+2*M2)*DisScaleL1)×((nSbH+2*N2)*DisScaleL1).

[0187] The DMVR unit 30375 derives a cost array mrSad that indicates the difference according to the dX and dY positions of pL0 and pL1 enlarged by the scale value or at the same magnification.

[0188] mrSad[dX][dY] = Σ(x=0..nSbW-1)Σ(y=0..nSbH-1)Abs(pL0[x+(M2+dX)][y+(N2+dY)]-pL1[x+(M2-dX)][y+(N2-dY)) The DMVR unit 30375 derives the minimum position vector (intOffX, intOffY) indicating the position of the minimum value of the cost array mrSad using the method already described (S513).

[0189] The DMVR unit 30375 derives a difference vector from the minimum position vector and the distance scale value (S514). Specifically, the DMVR unit 30375 calculates motion vector differences dmvL0 and dmvL1 using a value obtained by dividing the minimum position vector (intOffX, intOffY) with integer precision by the scale value.

[0190] dmvL0[0] = 16*intOffX dmvL0[1] = 16*intOffY dmvL1[0] = -16*intOffX / DisScaleL0 dmvL1[1] = -16*intOffY / DisScaleL0 The parametric DMVR unit 30375 derives the minimum position vector (dMvX, dMvY) of the cost array mrSad2 using the method already described. The DMVR unit 30375 calculates motion vector differentials dmvL0 and dmvL1 using the minimum position vector (dMvX, dMvY) and scale value of the parametric motion vector refinement process.

[0191] dmvL0[0] += dMvX dmvL0[1] += dMvY dmvL1[0] -= dMvX / DisScaleL0 dmvL1[1] -= dMvY / DisScaleL0 Unlike Fig. 12, where the motion vector refinement process (DMVR) including the case where the distances are different can be performed using branching, a determination is made as to whether the distances are different (S501), and if the distances are different (YES in S501), the processes of S511, S512, S513, and S514 are performed. If the distances are equal (NO in S501), the processes of S512D, S513, and S514D are performed.

[0192] In Examples 1 and 2 above, when searching for the minimum value of mrSad in integer pixel units, if the reference pixel distance is 1:2 (DisScaleL0=1, DisScaleL1=2), the motion vector can be corrected in 1 pixel units (DisScaleL0 units) or 2 pixel units (DisScaleL1 units).

[0193] (Summary of the above configuration) A video decoding device according to one aspect of the present invention is a video decoding device that decodes encoded data, and includes a vector correction unit that corrects motion information of a target block, and the vector correction unit includes an interpolation unit that derives a first interpolated image from a first motion vector and a second interpolated image from a second motion vector, a cost array derivation unit that derives a cost array from the first interpolated image and the second interpolated image, and a vector correction unit that derives a minimum position vector indicating the minimum position of the cost array, derives a correction vector from the minimum position vector, and corrects the motion vector, and is characterized in that it derives a scale value from the distance between the target picture and the reference picture, and derives the cost array using the scale value.

[0194] The vector correction unit derives a correction vector from the minimum position vector and the scale value.

[0195] The interpolation unit is characterized by deriving at least one of the first interpolated image and the second interpolated image using the scale value.

[0196] The video decoding device corrects the motion vector only when the ratio of the distances is an integer.

[0197] A video encoding device that decodes encoded data includes a vector correction unit that corrects motion information of a target block, the vector correction unit including an interpolation unit that derives a first interpolated image from a first motion vector and a second interpolated image from a second motion vector, a cost array derivation unit that derives a cost array from the first interpolated image and the second interpolated image, and a vector correction unit that derives a minimum position vector indicating a minimum position of the cost array and derives a correction vector from the minimum position vector, and is characterized in that it derives a scale value from the distance between the target picture and a reference picture and derives the cost array using the scale value.

[0198] (Detailed Classification of Sub-Block Merging) The types of prediction processing related to sub-block merging are summarized below. As described above, they are roughly divided into merge prediction and AMVP prediction.

[0199] Merge predictions are further categorized as follows:

[0200] Normal merge prediction (block-based merge prediction) Sub-block merge prediction Sub-block merge prediction is further categorized as follows:

[0201] Sub-block prediction (ATMVP) Affine prediction Inferred affine prediction Constructed affine prediction On the other hand, AMVP prediction is categorized as follows:

[0202] AMVP (translational) MVD affine prediction MVD affine prediction is further classified as follows:

[0203] 4-parameter MVD affine prediction 6-parameter MVD affine prediction Note that MVD affine prediction refers to affine prediction that uses a decoded difference vector.

[0204] MMVD prediction (Merge with Motion Vector Difference) may be classified as merge prediction or AMVP prediction. In the former case, mmvd_flag (mmvd_merge_flag) and MMVD-related syntax elements are decoded when merge_flag=1, and in the latter case, mmvd_flag and MMVD-related syntax elements are decoded when merge_flag=0.

[0205] (TM Prediction) The TM prediction unit 30377 performs processing in TM (Template Matching) mode. In TM prediction, the prediction parameters (motion information) of the current block are corrected based on the matching cost (error value) of the template region. The regions adjacent to the top and left of the current block are used as the template region, and the position where the error value is minimum is searched for within the periphery of the initial MV (for example, within a range of ±8 pixels), and the motion information is updated to that position.

[0206] In the case of the AMVP prediction mode, the MVP candidate with the smallest template matching error value at that position is selected and used as the initial MV.

[0207] In the case of merge prediction mode, a merge candidate indicated by the merge index merge_idx is used as the initial MV, and similar correction is performed.

[0208] When TM prediction is applied to a bi-predictive block, an error value is derived for each of L0 and L1, and the other is further corrected with the MV with the smaller cost.

[0209] (AMVP Prediction) The AMVP prediction parameter derivation unit 3032 includes a vector candidate derivation unit 3033 and a vector candidate selection unit 3034. The vector candidate derivation unit 3033 derives predictor vector candidates from the motion vectors of decoded adjacent blocks stored in the prediction parameter memory 307 based on refIdxLX, and stores the candidates in a predictor vector candidate list mvpListLX[ ].

[0210] The vector candidate selection unit 3034 selects, as mvpLX, the motion vector mvpListLX[mvp_LX_idx] indicated by mvp_LX_idx from among the predicted vector candidates in mvpListLX[ ]. The vector candidate selection unit 3034 outputs the selected mvpLX to the MV addition unit 3038.

[0211] (MV Addition Unit) The MV addition unit 3038 calculates mvLX by adding the mvpLX input from the AMVP prediction parameter derivation unit 3032 and the decoded mvdLX. The addition unit 3038 outputs the calculated mvLX to the inter predicted image generation unit 309 and the prediction parameter memory 307.

[0212] mvLX[0] = mvpLX[0] + mvdLX[0] mvLX[1] = mvpLX[1] + mvdLX[1] The MV adder derives a shift value amvrShift based on the values ​​of amvr_flag and amvr_precision_idx, and may use it to change the precision of the derived mvLX. amvr_precision_idx is a syntax element that switches the precision of the vector together with amvr_flag. For example, in AMVP mode, when amvr_flag==0, amvr_flag==&&amvr_precision_idx=0, amvr_flag==&&amvr_precision_idx=1, amvr_flag==1&& amvr_precision_idx=2, amvrShift=2, 3, 4, 6 are set, respectively, to switch between 1 / 4 pixel, 1 / 2 pixel, 1 pixel, and 4 pixel precision.

[0213] (Motion Vector Scaling) A method for deriving motion vector scaling will now be described. Given a motion vector Mv (reference motion vector), a picture PicMv containing a block having Mv, a reference picture PicMvRef of Mv, a motion vector after scaling sMv, a picture CurPic containing a block having sMv, and a reference picture CurPicRef referenced by sMv, the derivation function MvScale(Mv, PicMv, PicMvRef, CurPic, CurPicRef) of sMv is expressed by the following equation:

[0214] sMv = MvScale(Mv,PicMv,PicMvRef,CurPic,CurPicRef) = Clip3(-R1,R1-1,sign(distScaleFactor*Mv)*((abs(distScaleFactor*Mv)+round1-1)>>shift1)) distScaleFactor = Clip3(-R2,R2-1,(tb*tx+round2)>>shift2) tx = (16384+abs(td)>>1) / td td = DiffPicOrderCnt(PicMv,PicMvRef) tb = DiffPicOrderCnt(CurPic,CurPicRef) Here, round1, round2, shift1, and shift2 are round and shift values ​​for division using reciprocals, for example, round1=1<<(shift1-1), round2=1<<(shift2-1), shift1=8, shift2=6. DiffPicOrderCnt(Pic1,Pic2) is a function that returns the difference in time information (e.g., POC) between Pic1 and Pic2. R1 and R2 limit the value range to perform processing with limited precision, for example, R1=32768, R2=4096.

[0215] Furthermore, the scaling function MvScale(Mv, PicMv, PicMvRef, CurPic, CurPicRef) may be expressed by the following formula:

[0216] MvScale(Mv, PicMv, PicMvRef, CurPic, CurPicRef) = Mv*DiffPicOrderCnt(CurPic, CurPicRef) / DiffPicOrderCnt(PicMv, PicMvRef) In other words, Mv may be scaled according to the ratio between the difference in time information between CurPic and CurPicRef and the difference in time information between PicMv and PicMvRef.

[0217] (Inter-prediction image generation unit 309) When predMode indicates inter-prediction, the inter-prediction image generation unit 309 generates a prediction image of a block or sub-block by inter-prediction using the inter-prediction parameters and reference picture input from the inter-prediction parameter derivation unit 303.

[0218] 6 is a schematic diagram showing the configuration of an inter-prediction image generation unit 309 included in the prediction image generation unit 308 according to this embodiment. The inter-prediction image generation unit 309 includes a motion compensation unit (prediction image generation device) 3091 and a synthesis unit 3095. The synthesis unit 3095 includes an intra-inter synthesis unit 30951, a GPM synthesis unit 30952, a weighted prediction unit 30953, a BDOF processing unit 30954, and a BCW processing unit 30955. It may also include an LIC processing unit 30956 and an OBMC processing unit 30957, which are not shown.

[0219] (Motion Compensation) The motion compensation unit 3091 (interpolated image generation unit 3091) generates an interpolated image (motion-compensated image) by reading a reference block from the reference picture memory 306 based on the inter-prediction parameters (predFlagLX, refIdxLX, mvLX) input from the inter-prediction parameter derivation unit 303. The reference block is a block located at a position shifted by mvLX from the position of the current block on the reference picture RefPicLX[X][refIdxLX] specified by refIdxLX. Here, if mvLX does not have integer precision, a filter for generating pixels at decimal positions called a motion compensation filter is applied to generate an interpolated image.

[0220] The motion compensation unit 3091 derives the integer position (xInt, yInt) and phase (xFrac, yFrac) corresponding to the top left coordinates (xPb, yPb) of a block of size bW*bH, the coordinates within the prediction block (xL, yL), and the motion vector (mvLX[0], mvLX[1]) using the following formula (MC-P1).

[0221] xInt = xPb+(mvLX[0]>>(log2MVPREC))+xL xFrac = mvLX[0]&(MVPREC-1) yInt = yPb+(mvLX[1]>>(log2MVPREC))+yL yFrac = mvLX[1]&(MVPREC-1) Here, MVPREC indicates the accuracy of mvLX (1 / MVPREC pixel accuracy), log2MVPREC=log2(MVPREC), x=0...bW-1, y=0...bH-1. For example, MVPREC=16.

[0222] To perform RPR, the values ​​may be derived as in (MC-P2) described below. Furthermore, the motion compensation unit 3091 may correct the positions of (xInt, yInt) derived in (MC-P1) and (MC-P2) to allow for wraparound at the frame end.

[0223] If the flag that treats subpicture boundaries as picture boundaries is enabled (sps_subpic_treated_as_pic_flag == 1) and the number of subpictures in the reference picture is greater than 1 (sps_num_subpics_minus1 > 0 for reference picture refPicLX), the following formula is used to derive (MC-P2): xInt = Clip3( SubpicLeftBoundaryPos, SubpicRightBoundaryPos, refWraparoundEnabledFlag ? ClipH( ( PpsRefWraparoundOffset ) * MinCbSizeY, picW, xInt ) : xInt ) yInt = Clip3( SubpicTopBoundaryPos, SubpicBotBoundaryPos, yInt ) Here, SubpicLeftBoundaryPos, SubpicRightBoundaryPos, SubpicTopBoundaryPos, and SubpicBottomBoundaryPos are the left, right, top, and bottom boundary positions of the subpicture, respectively.

[0224] In other cases (when the flag that treats subpicture boundaries as picture boundaries is disabled (sps_subpic_treated_as_pic_flag == 0) or when the number of subpictures in the reference picture is 1 (sps_num_subpics_minus1 == 0 for reference picture refPicLX), it is derived using the following formula (MC-P2). xInt = Clip3( 0, picW - 1, refWraparoundEnabledFlag ? ClipH( ( PpsRefWraparoundOffset ) * MinCbSizeY, picW, xInt ) : xInt ) yInt = Clip3( 0, picH - 1, yInt ) Here, each parameter is set as follows: refWraparoundEnabledFlag = pps_ref_wraparound_enabled_flag && !refPicIsScaled PpsRefWraparoundOffset= pps_pic_width_in_luma_samples / MinCbSizeY - pps_pic_width_minus_wraparound_offset MinCbSizeY is a predetermined constant or variable (for example, 4), and pps_pic_width_minus_wraparound_offset is an offset decoded from the coded data indicating the wraparound position.

[0225] The motion compensation unit 3091 derives the temporary image temp[][] by performing horizontal interpolation on the reference picture refImg using an interpolation filter. In the following, Σ is the sum over k, k=0..NTAP-1, mcFilter[Frac][k] is the kth interpolation filter coefficient in phase Frac, shift1 is a normalization parameter that adjusts the value range, and offset1=1<<(shift1-1).

[0226] temp[x][y] = (ΣmcFilter[xFrac][k]*refImg[xInt+k-NTAP / 2+1][yInt]+offset1)>>shift1 Next, the motion compensation unit 3091 derives the interpolated image Pred[][] by vertically interpolating the temporary image temp[][]. In the following, Σ is the sum for k=0..NTAP-1, shift2 is a normalization parameter that adjusts the value range, and offset2=1<<(shift2-1).

[0227] Pred[x][y] = (ΣmcFilter[yFrac][k]*temp[x][y+k-NTAP / 2+1]+offset2)>>shift2 In the case of bi-prediction, the above Pred[][] is used to derive interpolated images PredL0[][] and PredL1[][] for each L0 list and L1 list, and the interpolated image Pred[][] is generated from PredL0[][] and PredL1[][].

[0228] where shift1 = Min (4, BitDepth - 8) shift2 = 6 shift3 = Max (2, 14 - BitDepth) (Configuration of Intra Prediction Parameter Derivation Unit 304) The intra prediction parameter derivation unit 304 derives intra prediction parameters, for example, an intra prediction mode IntraPredMode, by referring to prediction parameters stored in a prediction parameter memory 307, based on syntax elements decoded by the parameter decoding unit 302 (or syntax elements derived by the parameter encoding unit 111). The intra prediction parameter derivation unit 304 outputs the intra prediction parameters to the predicted image generation unit 308, and also stores them in the prediction parameter memory 307. The intra prediction parameter derivation unit 304 may derive different intra prediction modes for luma and chroma.

[0229] The intra prediction parameter derivation unit 304 includes a luma intra prediction parameter derivation unit 3042 and a chroma intra prediction parameter derivation unit 3043 .

[0230] The luma intra prediction parameter derivation unit 3042 includes an MPM candidate list derivation unit 30421, an MPM parameter derivation unit 30422, and a non-MPM parameter derivation unit 30423 (decoding unit, derivation unit).

[0231] The MPM parameter derivation unit 30422 derives IntraPredModeY by referencing the mpmCandList[ ] and intra_luma_mpm_idx derived by the MPM candidate list derivation unit 30421 , and outputs the IntraPredModeY to the intra-predicted image generation unit 310 .

[0232] The non-MPM parameter derivation unit 30423 derives RemIntraPredMode from mpmCandList[ ] and intra_luma_mpm_reminder, and outputs IntraPredModeY to the intra-predicted image generation unit 310.

[0233] The chrominance intra-prediction parameter derivation unit 3043 derives IntraPredModeC from the syntax elements of the chrominance intra-prediction parameters, and outputs it to the intra-prediction image generation unit 310.

[0234] (IntraInter synthesis processing) When ciip_mode is 1, the IntraInter synthesis unit 30951 generates a predicted image in CIIP mode by weighting the inter predicted image and the intra predicted image. For example, the inter predicted image is generated using merge mode, and the intra predicted image is generated using planar prediction for the current block. The weights for the inter predicted image and the intra predicted image are derived based on, for example, whether the adjacent blocks above and to the left of the current block are intra blocks.

[0235] In the case of CIIP prediction (when ciip_flag is 1), the intra-prediction image generation unit 310 generates the predicted image PredIntra[][] using planar prediction (IntraPredModeY=INTRA_PLANAR).

[0236] When ciip_flag is 1, the inter predicted image generating unit 309 performs motion compensation using the motion vector obtained by merge prediction to generate a predicted image PredInter[][].

[0237] When ciip_flag is 1, the IntraInter synthesis unit 30951 generates a predicted image PredComb[][] by weighting the inter-predicted image PredInter[][] and the intra-predicted image PredIntra[][], and outputs the generated image to the addition unit 312.

[0238] PredComb[x][y] = (w * PredIntra[x][y] + (4 - w) * PredInter[x][y] + 2) >> 2 where w is set to 3 if both the upper and left neighboring blocks of the target CU are in intra mode, 1 if both are not in intra mode, and 2 otherwise.

[0239] (GPM Prediction) Next, GPM prediction will be explained. In GPM prediction, a target CU is divided into two diverse prediction units (hereinafter also referred to as partitions or regions) using a line segment as a boundary.

[0240] A line segment spanning the target CU is specified by an angle index angleIdx and a distance index distanceIdx. angleIdx indicates the angle φ between a vertical line and the line segment. distanceIdx indicates the distance ρ from the center of the target CU to the line segment. Regarding the angle, one angle mode (angle index) is assigned every 15 degrees. In the figure, 24 angle modes numbered 0 to 23 are used. Regarding the distance, for example, the distance mode (distance index) is: Rather than deriving a "non-rectangular" predicted image corresponding to each prediction unit, the GPM predicted image is derived by deriving two "rectangular" predicted images that include the prediction unit and weighting them according to the shape of the prediction unit. In other words, the motion compensation unit 3091 or the intra-prediction image generation unit 310 derives two temporary predicted images for the target CU, and the GPM synthesis unit 30952 derives a predicted image by weighting each pixel of the two temporary predicted images according to the pixel's position.

[0241] The GPM prediction unit 30377 derives prediction parameters for the two regions used in GPM prediction and supplies them to the inter-prediction image generation unit 309. The derivation of the two predicted images and synthesis using the predicted images are performed by the motion compensation unit 3091 and GPM synthesis unit 30952. The motion vector difference is added to the resulting motion vector and output to the GPM synthesis unit 30952.

[0242] When a region is inter-predicted, the GPM prediction unit 30377 derives merge indexes m and n from merge_gpm_idx0 and merge_gpm_idx1 as syntax indicating motion information of the two regions.

[0243] m = merge_gpm_idx0 n = merge_gpm_idx1 + (merge_gpm_idx1 >= m) ? 1 : 0 In the following, the merge candidate pointed to by merge index m is denoted as M, and the merge candidate pointed to by merge index n is denoted as N.

[0244] The merge prediction parameter derivation unit 3036 derives motion information (mvLXM, mvLXN, refIdxLXM, refIdxLXN, predFlagLXM, predFlagLXN, bcwIdx, mergeCandList, etc.) of merge candidates M and N using the method described in (Merge Prediction). Furthermore, the GPM prediction unit 30377 derives mvdLXM and mvdLXNM using MPG-MMVD processing, and sets the motion vectors mvA and mvB, reference indices refIdxA and refIdxB, and prediction list flags predListFlagA and predListFlagB of merge_gpm_idx0 and merge_gpm_idx1 as follows:

[0245] mvA[0] = mvLXM[0] + mvdLXM[0] mvA[1] = mvLXM[1] + mvdLXM[1] refIdxA = refIdxLXM predListFlagA = X Here, the GPM prediction unit 30377 sets the lowest 1 bit of m to X (m & 0x01). Note that if predFlagLXM is 0, the GPM prediction unit 30377 sets X to (1-X).

[0246] mvB[0] = mvLXN[0] + mvdLXN[0] mvB[1] = mvLXN[1] + mvdLXN[1] refIdxB = refIdxLXN predListFlagB = X Here, the GPM prediction unit 30377 sets the lowest 1 bit of n to X (n & 0x01). Note that if predFlagLXN is 0, the GPM prediction unit 30377 sets X to (1-X).

[0247] The GPM prediction unit 30377 generates Pred using wValue as follows: A predicted image Pred of x = 0..nSbW - 1, y = 0..nSbH - 1 is derived.

[0248] Pred[x][y] = Clip3(0, (1 << bitDepth) - 1, (PredLA[x][y] * (wValue) + PredLB[x][y] * (8 - wValue) + offset1) >> shift1) Here, Pred is a prediction block of size cbWidth*cbHeight. PredLA and PredLB are prediction images generated by the motion compensation unit 3091 using the motion information of areas A and B.

[0249] (Weighted Prediction) The weighted prediction unit 30953 generates a predicted image for a block by multiplying the interpolated image PredLX by a weighting factor. Weighting factors are set for each reference image and each luma and chroma channel, and are coded in the slice header or picture header. The weighted prediction unit 30953 generates a predicted image for a block by multiplying the interpolated image PredLX by a weighting factor. If one of the prediction list usage flags (predFlagL0 or predFlagL1) is 1 (uniprediction) and weighted prediction is not used, the weighted prediction unit 30953 performs the following equation to adjust PredLX (LX is L0 or L1) to the pixel bit depth bitDepth.

[0250] Pred[x][y] = Clip3(0,(1<<bitDepth)-1,(PredLX[x][y]+offset1)> >shift1) where shift1=14-bitDepth, offset1=1<<(shift1-1). Furthermore, when both prediction list usage flags (predFlagL0 and predFlagL1) are 1 (bi-prediction PRED_BI) and weighted prediction is not used, PredL0 and PredL1 are averaged and adjusted to the number of pixel bits according to the following equation.

[0251] Pred[x][y] = Clip3(0,(1<<bitDepth)-1,(PredL0[x][y]+PredL1[x][y]+offset2)> >shift2) where shift2=15-bitDepth and offset2=1<<(shift2-1).

[0252] Furthermore, when uni-prediction and weighted prediction are performed, the weighted prediction unit 30953 derives a weighted prediction coefficient w0 and an offset o0 from the coded data, and performs processing according to the following equations.

[0253] Pred[x][y] = Clip3(0,(1<<bitDepth)-1,((PredLX[x][y]*w0+2^(log2WD-1))> >log2WD)+o0) where log2WD is a variable indicating a predetermined shift amount.

[0254] Furthermore, when performing bi-prediction PRED_BI and weighted prediction, the weighted prediction unit 30953 derives weighted prediction coefficients w0, w1, o0, and o1 from the coded data, and performs processing according to the following equations.

[0255] Pred[x][y] = Clip3(0,(1< <bitDepth)-1,(PredL0[x][y]*w0+PredL1[x][y]*w1+((o0+o1+1)<<log2WD))> >(log2WD+1)) The inter predicted image generation unit 309 outputs the generated predicted image of the block to the addition unit 312.

[0256] The inverse quantization and inverse transform unit 311 inverse quantizes the quantized transform coefficients input from the parameter decoding unit 302 to obtain transform coefficients.

[0257] The inverse quantization and inverse transform unit 311 includes a scaling unit (inverse quantization unit), a secondary transform unit, and a core transform unit.

[0258] The secondary transform unit restores modified transform coefficients d[ ][ ] (transform coefficients after transformation by the second transform unit) by applying a transform using a transform matrix to some or all of the transform coefficients d[ ][ ] received from the scaling unit. The secondary transform unit applies a secondary transform to the transform coefficients d[ ][ ] of a predetermined unit for each TU. The secondary transform is applied only to intra CUs, and the transform base is determined by referring to stIdx and IntraPredMode. The secondary transform unit outputs the restored modified transform coefficients d[ ][ ] to the core transform unit.

[0259] The core transform unit transforms the transform coefficients d[ ][ ] or the modified transform coefficients d[ ][ ] using the selected transform matrix to derive prediction errors r[ ][ ]. The core transform unit outputs the prediction errors r[ ][ ] (resSamples[ ][ ]) to the adder 312. Note that the inverse quantization and inverse transform unit 311 sets all prediction errors of the current block to 0 when skip_flag is 1 or cu_cbp is 0. The transform matrix may be selected from multiple transform matrices using mts_idx.

[0260] The adder 312 adds, for each pixel, the predicted image Pred of the block input from the predicted image generator 308 and the prediction error resSamples input from the inverse quantization and inverse transformer 311, to generate a decoded image rec of the block.

[0261] rec[x][y]=Pred[x][y]+resSamples[x][y] The adder 312 stores the decoded image of the block in the reference picture memory 306 and also outputs it to the loop filter 305.

[0262] The inter-prediction image generation unit 309 outputs the generated prediction image of the block to the addition unit 312 .

[0263] (Configuration of Video Encoding Device) Next, the configuration of the video encoding device 11 according to this embodiment will be described. Fig. 4 is a block diagram showing the configuration of the video encoding device 11 according to this embodiment. The video encoding device 11 includes a prediction image generation unit 101, a subtraction unit 102, a transformation / quantization unit 103, an inverse quantization / inverse transformation unit 105, an addition unit 106, a loop filter 107, a prediction parameter memory (prediction parameter storage unit, frame memory) 108, a reference picture memory (reference image storage unit, frame memory) 109, a coding parameter determination unit 110, a parameter coding unit 111, a prediction parameter derivation unit 120, and an entropy coding unit 104.

[0264] The predicted image generation unit 101 generates a predicted image for each CU. The predicted image generation unit 101 includes the inter predicted image generation unit 309 and the intra predicted image generation unit 310, which have already been described, and therefore further description thereof will be omitted.

[0265] The subtraction unit 102 generates a prediction error by subtracting the pixel values ​​of the predicted image of the block input from the predicted image generation unit 101 from the pixel values ​​of the image T. The subtraction unit 102 outputs the prediction error to the transformation / quantization unit 103.

[0266] The transform / quantization unit 103 calculates transform coefficients by frequency transforming the prediction errors input from the subtraction unit 102, and derives quantized transform coefficients by quantizing them. The transform / quantization unit 103 outputs the quantized transform coefficients to the parameter coding unit 111 and the inverse quantization / inverse transform unit 105.

[0267] The transform / quantization unit 103 includes a separation transform unit (first transform unit), a non-separation transform unit (second transform unit), and a scaling unit.

[0268] The separate transform unit applies a separate transform to the prediction error, and the scaling unit scales the transform coefficients with a quantization matrix.

[0269] The inverse quantization and inverse transform unit 105 is the same as the inverse quantization and inverse transform unit 311 in the video decoding device 31, and a description thereof will be omitted. The calculated prediction error is output to the adder .

[0270] The parameter coding unit 111 includes a header coding unit 1110, a CT information coding unit 1111, and a CU coding unit 1112 (prediction mode coding unit). The CU coding unit 1112 further includes a TU coding unit 1114. The following describes an outline of the operation of each module.

[0271] The header encoding unit 1110 performs encoding processing of parameters such as header information, division information, prediction information, and quantized transform coefficients.

[0272] The CT information encoding unit 1111 encodes QT, MT (BT, TT) division information and the like.

[0273] The CU encoding unit 1112 encodes CU information, prediction information, division information, and the like.

[0274] When a prediction error is included in a TU, the TU encoding unit 1114 encodes the QP update information and the quantized prediction error.

[0275] The CT information encoding unit 1111 and the CU encoding unit 1112 supply syntax elements such as inter prediction parameters (predMode, general_merge_flag, merge_idx, inter_pred_idc, refIdxLX, mvp_LX_idx, mvdLX, amvr_flag, amvr_precision_idx), intra prediction parameters, and quantized transform coefficients to the parameter encoding unit 111.

[0276] The entropy coding unit 104 receives the quantized transform coefficients and coding parameters (division information, prediction parameters) from the parameter coding unit 111. The entropy coding unit 104 entropy codes these to generate and output a coded stream Te.

[0277] The prediction parameter derivation unit 120 is a means including the inter prediction parameter coding unit 112 and an intra prediction parameter coding unit, and derives intra prediction parameters and inter prediction parameters from the parameters input from the coding parameter determination unit 110. The derived intra prediction parameters and inter prediction parameters are output to the parameter coding unit 111.

[0278] (Configuration of Inter Prediction Parameter Encoding Unit) The inter prediction parameter encoding unit 112 includes a parameter encoding control unit 1121 and an inter prediction parameter derivation unit 303. The inter prediction parameter derivation unit 303 has the same configuration as the video decoding device. The parameter encoding control unit 1121 includes a merge index derivation unit 11211 and a vector candidate index derivation unit 11212.

[0279] The merge index derivation unit 11211 derives merge candidates and the like, and outputs them to the inter prediction parameter derivation unit 303. The vector candidate index derivation unit 11212 derives predicted vector candidates and the like, and outputs them to the inter prediction parameter derivation unit 303 and the parameter coding unit 111.

[0280] (Configuration of Intra Prediction Parameter Encoding Unit) The intra prediction parameter encoding unit includes a parameter encoding control unit and an intra prediction parameter derivation unit. The intra prediction parameter derivation unit has the same configuration as the video decoding device.

[0281] However, unlike the video decoding device, the inputs to the inter prediction parameter derivation unit 303 and the intra prediction parameter derivation unit are the coding parameter determination unit 110 and the prediction parameter memory 108 , and output to the parameter coding unit 111 .

[0282] The adder 106 generates a decoded image by adding, for each pixel, the pixel values ​​of the predicted block input from the predicted image generation unit 101 and the prediction errors input from the inverse quantization and inverse transform unit 105. The adder 106 stores the generated decoded image in a reference picture memory 109.

[0283] The loop filter 107 performs deblocking filtering, SAO, and ALF on the decoded image generated by the adder 106. Note that the loop filter 107 does not necessarily have to include the above three types of filters, and may be configured with only a deblocking filter, for example.

[0284] The prediction parameter memory 108 stores the prediction parameters generated by the coding parameter determination unit 110 in a predetermined location for each current picture and CU.

[0285] The reference picture memory 109 stores the decoded image generated by the loop filter 107 at a predetermined location for each current picture and CU.

[0286] The coding parameter determination unit 110 selects one set of coding parameters from among multiple sets of coding parameters. The coding parameters are the above-mentioned QT, BT, or TT division information, prediction parameters, or parameters to be coded that are generated in relation to these. The predicted image generation unit 101 generates a predicted image using these coding parameters.

[0287] The coding parameter determination unit 110 calculates an RD cost value indicating the magnitude of the information amount and the coding error for each of the multiple sets. The RD cost value is, for example, the sum of the code amount and the value obtained by multiplying the squared error by a coefficient λ. The code amount is the information amount of the coded stream Te obtained by entropy coding the quantization error and the coding parameters. The squared error is the sum of the squares of the prediction errors calculated by the subtraction unit 102. The coefficient λ is a preset real number greater than zero. The coding parameter determination unit 110 selects the set of coding parameters that minimizes the calculated cost value. The coding parameter determination unit 110 outputs the determined coding parameters to the prediction parameter derivation unit 120.

[0288] Note that a portion of the video encoding device 11 and the video decoding device 31 in the above-described embodiments, such as the entropy decoding unit 301, the parameter decoding unit 302, the loop filter 305, the predicted image generation unit 308, the inverse quantization / inverse transform unit 311, the adder 312, the prediction parameter derivation unit 320, the predicted image generation unit 101, the subtractor 102, the transform / quantization unit 103, the entropy encoding unit 104, the inverse quantization / inverse transform unit 105, the loop filter 107, the encoding parameter determination unit 110, the parameter encoding unit 111, and the prediction parameter derivation unit 120, may be implemented by a computer. In this case, a program for implementing this control function may be recorded on a computer-readable recording medium, and the program may be read and executed by a computer system. Note that the term "computer system" used here refers to a computer system built into either the video encoding device 11 or the video decoding device 31, and includes hardware such as an OS and peripheral devices. Furthermore, "computer-readable recording media" refers to portable media such as flexible disks, optical magnetic disks, ROMs, and CD-ROMs, as well as storage devices such as hard disks built into computer systems. Furthermore, "computer-readable recording media" may also include devices that dynamically store programs for a short period of time, such as communication lines used when transmitting programs over networks like the Internet or communication lines like telephone lines, or devices that store programs for a fixed period of time, such as volatile memory within computer systems that serve as servers or clients in such cases. Furthermore, the programs may be programs that realize some of the aforementioned functions, or may be programs that can realize the aforementioned functions in combination with programs already stored in the computer system.

[0289] Furthermore, part or all of the video encoding device 11 and video decoding device 31 in the above-described embodiments may be realized as an integrated circuit such as an LSI (Large Scale Integration). Each functional block of the video encoding device 11 and video decoding device 31 may be individually implemented as a processor, or part or all of them may be integrated into a processor. Furthermore, the integrated circuit implementation method is not limited to LSI, and may be implemented using a dedicated circuit or a general-purpose processor. Furthermore, if an integrated circuit implementation technology that can replace LSI emerges due to advances in semiconductor technology, an integrated circuit based on that technology may be used.

[0290] One embodiment of the present invention has been described in detail above with reference to the drawings, but the specific configuration is not limited to that described above, and various design changes and the like can be made within the scope that does not deviate from the gist of the present invention.

[0291] The present invention is not limited to the above-described embodiments, and various modifications are possible within the scope of the claims. In other words, embodiments obtained by combining technical means modified appropriately within the scope of the claims are also included in the technical scope of the present invention.

[0292] A video decoding device according to one aspect of the present invention is a video decoding device that decodes encoded data, and includes a vector correction unit that corrects motion information of a target block, and the vector correction unit includes an interpolation unit that derives a first interpolated image from a first motion vector and a second interpolated image from a second motion vector, a cost array derivation unit that derives a cost array from the first interpolated image and the second interpolated image, and a vector correction unit that derives a minimum position vector indicating the minimum position of the cost array, derives a correction vector from the minimum position vector, and corrects the motion vector, and is characterized in that it derives a scale value from the distance between the target picture and the reference picture, and derives the cost array using the scale value.

[0293] The vector correction unit derives a correction vector from the minimum position vector and the scale value.

[0294] The interpolation unit is characterized by deriving at least one of the first interpolated image and the second interpolated image using the scale value.

[0295] The video decoding device corrects the motion vector only when the ratio of the distances is an integer.

[0296] A video encoding device that decodes encoded data includes a vector correction unit that corrects motion information of a target block, the vector correction unit including an interpolation unit that derives a first interpolated image from a first motion vector and a second interpolated image from a second motion vector, a cost array derivation unit that derives a cost array from the first interpolated image and the second interpolated image, and a vector correction unit that derives a minimum position vector indicating a minimum position of the cost array and derives a correction vector from the minimum position vector, and is characterized in that it derives a scale value from the distance between the target picture and a reference picture and derives the cost array using the scale value. CROSS-REFERENCE TO RELATED APPLICATIONS

[0297] This application claims the benefit of priority to Japanese Patent Application No. 2024-035597, filed on March 8, 2024, the entire contents of which are incorporated herein by reference.

[0298] The embodiments of the present invention can be suitably applied to a video decoding device that decodes coded data obtained by coding image data, and a video coding device that generates coded data obtained by coding image data, and can also be suitably applied to the data structure of coded data generated by a video coding device and referenced by the video decoding device.

[0299] 31 Video decoding device 301 Entropy decoding unit 302 Parameter decoding unit 3022 CU decoding unit 3024 TU decoding unit 303 Inter prediction parameter derivation unit 30375 DMVR unit 305, 107 Loop filter 306, 109 Reference picture memory 307, 108 Prediction parameter memory 308, 101 Prediction image generation unit 309 Inter prediction image generation unit 3092 OOB processing unit 311, 105 Inverse quantization / inverse transform unit 312, 106 Addition unit 320 Prediction parameter derivation unit 11 Video encoding device 102 Subtraction unit 103 Transform / quantization unit 104 Entropy encoding unit 110 Encoding parameter determination unit 111 Parameter encoding unit 112 Inter prediction parameter encoding unit 120 Prediction parameter derivation unit

Claims

1. A video decoding device that decodes encoded data, comprising a vector correction unit that corrects motion information of a current block, the vector correction unit comprising an interpolation unit that derives a first interpolated image from a first motion vector and a second interpolated image from a second motion vector, a cost array derivation unit that derives a cost array from the first interpolated image and the second interpolated image, and a vector correction unit that derives a minimum position vector that indicates the minimum position of the cost array, derives a correction vector from the minimum position vector, and corrects the motion vector, the video decoding device deriving a scale value from the distance between the current picture and a reference picture, and deriving the cost array using the scale value.

2. The video decoding device according to claim 1, wherein said vector correction unit derives a correction vector from said minimum position vector and said scale value.

3. The video decoding device according to claim 1, wherein said interpolation unit derives at least one of said first interpolated image and said second interpolated image using said scale value.

4. The video decoding device according to claim 1, wherein said video decoding device corrects said motion vector only when said ratio of said distances is an integer.

5. A video coding device that decodes coded data, comprising a vector correction unit that corrects motion information of a target block, the vector correction unit comprising: an interpolation unit that derives a first interpolated image from a first motion vector and a second interpolated image from a second motion vector; a cost array derivation unit that derives a cost array from the first interpolated image and the second interpolated image; and a vector correction unit that derives a minimum position vector that indicates the minimum position of the cost array and derives a correction vector from the minimum position vector, the video coding device deriving a scale value from the distance between the target picture and a reference picture and deriving the cost array using the scale value.