Image decoding device, image decoding method, and image decoding program

JP7639870B2Active Publication Date: 2025-03-05JVC KENWOOD CORP
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
JP2023167820
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2019-06-25
Filing Date
2023-09-28
Publication Date
2025-03-05
Estimated Expiration
2040-06-25

AI Technical Summary

Benefits of technology

【0007】 本発明によれば、高効率な画像符号化·復号処理を低負荷で実現することができる。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007639870000001
    Figure 0007639870000001
  • Figure 0007639870000002
    Figure 0007639870000002
  • Figure 0007639870000003
    Figure 0007639870000003
Patent Text Reader

Abstract

To provide a technique for reducing the amount of processing for intra-block copy.SOLUTION: An image decoding device includes: a block vector candidate derivation unit that derives block vector candidates of a block to be processed in a picture to be processed, from encoding information stored in an encoding information storage memory; a selection unit that selects a selection block vector from the block vector candidates; and a reference area border correction unit that determines a referenceable area including a predetermined position of a reference block that is referenced by the selection block vector, from a plurality of referenceable areas, and sets a predetermined value as a prediction value of the block to be processed for a second divided reference block included in a referenceable area not including the predetermined position of the reference block.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to an image encoding and decoding technique for dividing an image into blocks and performing prediction. [Background technology]

[0002] In image encoding and decoding, the image to be processed is divided into blocks, which are collections of a certain number of pixels, and processed on a block-by-block basis. By dividing the image into appropriate blocks and appropriately setting intra-frame prediction (intra-prediction) and inter-frame prediction (inter-prediction), the encoding efficiency can be improved.

[0003] Patent Document 1 discloses an intra prediction technique for obtaining a predicted image using decoded pixels adjacent to a block to be coded or decoded. [Prior art documents] [Patent documents]

[0004] [Patent Document 1] JP 2009-246975 A Summary of the Invention [Problem to be solved by the invention]

[0005] However, the technique of Patent Document 1 uses only decoded pixels adjacent to the block to be coded / decoded for prediction, resulting in poor prediction efficiency. [Means for solving the problem]

[0006] In one aspect of the present invention that solves the above problem, the present invention comprises a block vector candidate derivation unit that derives block vector candidates for a block to be processed in a picture to be processed from coding information stored in a coding information storage memory; a selection unit that selects a selected block vector from the block vector candidates; and a reference area boundary correction unit that determines a referenceable area including a predetermined position of a reference block referenced by the selected block vector from a plurality of referenceable areas, and for a first divided reference block included in the referenceable area including the predetermined position of the reference block, obtains a decoded pixel in the picture to be processed from a decoded image memory unit based on the reference position of the reference block as a predicted value of the block to be processed, and for a second divided reference block included in the referenceable area not including the predetermined position of the reference block, sets a predetermined value as the predicted value of the block to be processed. Effect of the Invention

[0007] According to the present invention, highly efficient image encoding / decoding processing can be realized with a low load. [Brief description of the drawings]

[0008] [Figure 1] 1 is a block diagram of an image encoding device according to an embodiment of the present invention. [Diagram 2] 1 is a block diagram of an image decoding device according to an embodiment of the present invention. [Diagram 3] 13 is a flowchart for explaining an operation of dividing a tree block. [Figure 4] FIG. 13 is a diagram showing how an input image is divided into tree blocks. [Diagram 5] FIG. 1 is a diagram illustrating a z-scan. [Figure 6] FIG. 13 is a diagram showing the divided shapes of blocks. [Figure 7] 13 is a flowchart for explaining an operation of dividing a block into four. [Figure 8] 13 is a flowchart for explaining an operation of dividing a block into two or three. [Figure 9] This is a syntax for expressing the shape of block division. [Figure 10] FIG. 1 is a diagram illustrating intra prediction. [Figure 11] FIG. 13 is a diagram for explaining reference blocks for inter prediction. [Figure 12] This is a syntax for expressing a coding block prediction mode. [Figure 13] FIG. 13 is a diagram showing the correspondence between syntax elements and modes relating to inter prediction. [Figure 14] FIG. 13 is a diagram for explaining affine transformation motion compensation of two control points. [Figure 15] FIG. 13 is a diagram for explaining affine transformation motion compensation of three control points. [Figure 16] FIG. 2 is a block diagram showing a detailed configuration of the inter prediction unit 102 in FIG. [Figure 17] 17 is a block diagram showing a detailed configuration of a normal predicted motion vector mode derivation unit 301 in FIG. 16. [Figure 18] 17 is a block diagram showing a detailed configuration of a normal merge mode derivation unit 302 in FIG. 16. [Figure 19] 17 is a flowchart for explaining a normal predicted motion vector mode derivation process of the normal predicted motion vector mode derivation unit 301 of FIG. 16. [Figure 20] 13 is a flowchart showing a processing procedure of a normal predicted motion vector mode derivation process. [Figure 21] 13 is a flowchart illustrating a procedure for a normal merge mode derivation process. [Figure 22] FIG. 3 is a block diagram showing a detailed configuration of an inter prediction unit 203 in FIG. 2. [Figure 23] 23 is a block diagram showing a detailed configuration of a normal predicted motion vector mode derivation unit 401 in FIG. 22. [Figure 24] 23 is a block diagram showing a detailed configuration of a normal merge mode derivation unit 402 in FIG. 22. [Diagram 25]23 is a flowchart for explaining a normal predicted motion vector mode derivation process of the normal predicted motion vector mode derivation unit 401 in FIG. 22. [Figure 26] 13 is a flowchart illustrating a procedure of a history motion vector predictor candidate list initialization / update process. [Figure 27] 13 is a flowchart of a procedure of a same element confirmation process in the procedure of a history predicted motion vector candidate update process. [Figure 28] 13 is a flowchart of an element shifting process procedure in the history motion vector predictor candidate update process procedure. [Figure 29] 13 is a flowchart illustrating a procedure of a process of deriving a history predicted motion vector candidate. [Diagram 30] 13 is a flowchart illustrating a history merging candidate derivation process procedure. [Diagram 31] 11 is a diagram illustrating an example of a history motion vector predictor candidate list update process. FIG. [Diagram 32] FIG. 13 is a diagram illustrating a valid reference area for intra block copying. [Diagram 33] FIG. 13 is a diagram illustrating motion compensation prediction in the case of L0 prediction in which an L0 reference picture (RefL0Pic) is located at a time earlier than a current picture (CurPic). [Diagram 34] 13 is a diagram for explaining motion compensation prediction in the case where L0 prediction is performed and a reference picture for L0 prediction is located at a later time than the current picture to be processed. FIG. [Diagram 35] FIG. 13 is a diagram for explaining motion compensation prediction in a bi-predictive case where a reference picture for L0 prediction is located at a time earlier than a current picture to be processed and a reference picture for L1 prediction is located at a time later than the current picture to be processed. [Diagram 36] 13 is a diagram for explaining the prediction direction of motion compensation prediction in bi-prediction where the reference picture for L0 prediction and the reference picture for L1 prediction are located at a time earlier than the current picture to be processed. FIG. [Figure 37] 13 is a diagram for explaining the prediction direction of motion compensation prediction in bi-prediction where the reference picture for L0 prediction and the reference picture for L1 prediction are at a time later than the current picture. FIG. [Figure 38] 13 is a flowchart illustrating an average merging candidate derivation process; [Figure 39] 11 is a table showing information regarding merge motion vector difference. [Diagram 40] FIG. 13 is a diagram illustrating the derivation of a merge differential motion vector. [Diagram 41] 2 is a block diagram showing a detailed configuration of an intra prediction unit 103 in FIG. 1. [Diagram 42] 3 is a block diagram showing a detailed configuration of an intra prediction unit 204 in FIG. 2. [Diagram 43] FIG. 13 is a block diagram of an intra block copy prediction unit 352. [Diagram 44] FIG. 13 is a block diagram of an intra block copy prediction unit 362. [Diagram 45] 13 is a flowchart illustrating a predictive intra block copy process of the intra block copy predictor 352. [Figure 46] 13 is a flowchart illustrating a predictive intra block copy process of the intra block copy predictor 362. [Figure 47] 13 is a flowchart illustrating a merge intra block copy process. [Figure 48] 13 is a flowchart showing a processing procedure of a block vector mode derivation process for predictive intra block copy. [Figure 49] 13 is a diagram for explaining the processing of the reference position correction unit 380 and the reference position correction unit 480. FIG. [Figure 50] FIG. 13 is a diagram showing how a reference position is corrected. [Figure 51] 13 is a diagram illustrating the positions of the top left and bottom right when the referenceable area is rectangular. FIG. [Figure 52] 13A and 13B are diagrams illustrating a process for correcting the reference position of a portion where the referenceable area is not rectangular. [Figure 53] FIG. 13 is a diagram showing how a reference position is corrected. [Figure 54] 13 is a diagram for explaining the processing of the reference position correction unit 380 and the reference position correction unit 480. FIG. [Figure 55] FIG. 13 is a diagram for explaining how a referenceable area is decomposed into two. [Figure 56] FIG. 13 is a diagram illustrating a process of dividing a referenceable area into two and correcting the reference position of each. [Figure 57] 11 is a diagram for explaining a memory space of a reference area when a coding tree block unit is used as an intra block copy reference block. FIG. [Figure 58] 13 is a diagram illustrating the memory space of a reference area when a valid reference area is determined by dividing a coding tree block into four units and using the units as intra block copy reference blocks. FIG. [Figure 59] 13 is a flowchart illustrating a reference area boundary correction procedure. [Figure 60] 13 is a diagram for explaining division of a reference block in memory space when a coding tree block unit is used as an intra block copy reference block. FIG. [Figure 61] 13 is a diagram for explaining division of a reference block in memory space when a valid reference area is determined by dividing a coding tree block into four units and using the units as intra block copy reference blocks. FIG. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0009] The technologies and technical terms used in this embodiment will be defined below.

[0010] <Tree Block> In the embodiment, the image to be encoded / decoded is divided equally into a predetermined size. This unit is defined as a tree block. In FIG. 4, the size of the tree block is 128x128 pixels, but the size of the tree block is not limited to this and may be set to any size. The tree blocks to be processed (corresponding to the encoding target in the encoding process and the decoding target in the decoding process) are switched in raster scan order, that is, from left to right and from top to bottom. The inside of each tree block can be further divided recursively. The block to be encoded / decoded after the tree block is divided recursively is defined as an encoding block. In addition, the tree block and the encoding block are collectively defined as a block. Efficient encoding can be achieved by performing appropriate block division. The size of the tree block can be a fixed value previously determined by the encoding device and the decoding device, or the encoding device can be configured to transmit the size of the tree block determined to the decoding device. Here, the maximum size of the tree block is 128x128 pixels, and the minimum size of the tree block is 16x16 pixels. Also, the maximum size of a coding block is set to 64x64 pixels, and the minimum size of a coding block is set to 4x4 pixels.

[0011] <Prediction mode> For each coding block to be processed, switching is performed between intra prediction (MODE_INTRA), which makes predictions from surrounding image signals of the processed image to be processed (in coding processing, signals for which coding has been completed are used for decoded images, image signals, tree blocks, blocks, coding blocks, etc., and in decoding processing, signals for which decoding has been completed are used for images, image signals, tree blocks, blocks, coding blocks, etc.), and inter prediction (MODE_INTER), which makes predictions from image signals of the processed image. The mode for distinguishing between intra prediction (MODE_INTRA) and inter prediction (MODE_INTER) is defined as the prediction mode (PredMode). The prediction mode (PredMode) has the values ​​intra prediction (MODE_INTRA) or inter prediction (MODE_INTER).

[0012] <Intra Block Copy Prediction> Intra block copy prediction is a process of encoding / decoding a current block by referring to decoded pixels in a current picture as predicted values. The distance from the current block to the referenced pixel is expressed by a block vector. The block vector refers to the current picture, and the reference picture is uniquely determined, so no reference index is required. The difference between a block vector and a motion vector is whether the referenced picture is the current picture or a processed picture. Also, the block vector can select 1-pixel accuracy or 4-pixel accuracy using adaptive motion vector resolution (AMVR).

[0013] In the intra block copy, two modes can be selected: a predictive intra block copy mode and a merge intra block copy mode.

[0014] The predicted intra block copy mode is a mode in which a block vector of a processing target block is determined from a predicted block vector derived from processed information and a differential block vector. The predicted block vector is derived from a processed block adjacent to the processing target block and an index for identifying the predicted block vector. The index for identifying the predicted block vector and the differential block vector are transmitted in a bit stream.

[0015] The merge intra block copy mode is a mode in which intra block copy prediction information of a current block is derived from intra block copy prediction information of a processed block adjacent to the current block, without transmitting a differential motion vector.

[0016] <Inter Prediction> In inter prediction, which performs prediction from an image signal of a processed image, multiple processed images can be used as reference pictures. In order to manage multiple reference pictures, two types of reference lists, L0 (reference list 0) and L1 (reference list 1), are defined, and each uses a reference index to identify a reference picture. L0 prediction (Pred_L0) is available in P slices. L0 prediction (Pred_L0), L1 prediction (Pred_L1), and bi-prediction (Pred_BI) are available in B slices. L0 prediction (Pred_L0) is inter prediction that refers to a reference picture managed in L0, and L1 prediction (Pred_L1) is inter prediction that refers to a reference picture managed in L1. Bi-prediction (Pred_BI) is inter prediction in which both L0 prediction and L1 prediction are performed, and one reference picture managed in each of L0 and L1 is referenced. Information that identifies L0 prediction, L1 prediction, and bi-prediction is defined as an inter prediction mode. In the subsequent processing, it is assumed that the constants and variables with the subscript LX in the output are processed for each L0 and L1.

[0017] <Predictive motion vector mode> The predicted motion vector mode is a mode in which an index for identifying a predicted motion vector, a differential motion vector, an inter prediction mode, and a reference index are transmitted to determine inter prediction information for a block to be processed. The predicted motion vector is derived from a predicted motion vector candidate derived from a processed block adjacent to the block to be processed, or a block belonging to a processed image that is located at the same position as the block to be processed or in the vicinity (neighborhood), and an index for identifying the predicted motion vector.

[0018] <Merge mode> Merge mode is a mode in which inter-prediction information for the block to be processed is derived from inter-prediction information for a processed block adjacent to the block to be processed, or a block belonging to a processed image that is located at the same position as the block to be processed or in its vicinity (vicinity), without transmitting differential motion vectors or reference indexes.

[0019] The spatial merge candidates are defined as processed blocks adjacent to the current block and the inter prediction information of the processed blocks. The temporal merge candidates are defined as blocks belonging to the processed image that are located at the same position as the current block or in its vicinity (neighborhood) and the inter prediction information derived from the inter prediction information of the blocks. Each merge candidate is registered in a merge candidate list, and the merge candidate to be used in predicting the current block is identified by a merge index.

[0020] <Adjacent block> 11 is a diagram for explaining reference blocks to be referenced for deriving inter prediction information in the predicted motion vector mode and merge mode. A0, A1, A2, B0, B1, B2, and B3 are processed blocks adjacent to the processing target block. T0 is a block belonging to a processed image, and is a block located at the same position as the processing target coding block of the processing target image or in the vicinity (neighborhood).

[0021] A1 and A2 are blocks located to the left of the coding block to be processed and adjacent to the coding block to be processed. B1 and B3 are blocks located above the coding block to be processed and adjacent to the coding block to be processed. A0, B0, and B2 are blocks located at the bottom left, top right, and top left of the coding block to be processed, respectively.

[0022] How adjacent blocks are handled in the predicted motion vector mode and merge mode will be described in detail later.

[0023] <Affine transformation motion compensation> Affine transformation motion compensation is a method of dividing an encoding block into subblocks of a predetermined unit, and performing motion compensation by setting a motion vector for each subblock individually. The motion vector for each subblock is derived based on one or more control points derived from inter prediction information of a processed block adjacent to the block to be processed, or a block belonging to a processed image that is located at the same position as the block to be processed or in the vicinity (neighborhood). In this embodiment, the size of the subblock is 4x4 pixels, but the size of the subblock is not limited to this, and the motion vector may be derived in units of pixels.

[0024] FIG. 14 shows an example of affine transformation motion compensation when there are two control points. In this case, the two control points have two parameters, a horizontal component and a vertical component, so the affine transformation when there are two control points is called a four-parameter affine transformation. CP1 and CP2 in FIG. 14 are the control points. FIG. 15 shows an example of affine transformation motion compensation when there are three control points. In this case, the three control points have two parameters, a horizontal component and a vertical component, so the affine transformation when there are three control points is called a six-parameter affine transformation. CP1, CP2, and CP3 in FIG. 15 are the control points.

[0025] Affine transform motion compensation can be used in both the predictive motion vector mode and the merge mode. A mode in which affine transform motion compensation is applied in the predictive motion vector mode is defined as a sub-block predictive motion vector mode, and a mode in which affine transform motion compensation is applied in the merge mode is defined as a sub-block merge mode.

[0026] <Syntax of coding block> The syntax for encoding / decoding the prediction mode of the coding block (syntax rules of the coding bit string) will be described with reference to FIG. 12(a), FIG. 12(b), and FIG. 13. In FIG. 12(a), pred_mode_flag is a flag indicating whether or not it is inter prediction. If pred_mode_flag is 0, it is inter prediction, and if pred_mode_flag is 1, it is intra prediction. In the case of intra prediction, pred_mode_ibc_flag, which is a flag indicating whether it is intra block copy prediction, is encoded / decoded. If it is intra block copy prediction (pred_mode_ibc_flag=1), merge_flag is encoded / decoded. merge_flag is a flag indicating whether it is a merge intra block copy mode or a predicted intra block copy mode. If it is a merge intra block copy mode (merge_flag=1), the merge index merge_idx is encoded / decoded. If it is not intra block copy prediction (pred_mode_ibc_flag=0), normal intra prediction is used, and information intra_pred_mode of the normal intra prediction is coded / decoded.

[0027] In the case of inter prediction, merge_flag is coded / decoded. merge_flag is a flag indicating whether to use merge mode or predicted motion vector mode. In the case of predicted motion vector mode (merge_flag=0), a flag inter_affine_flag indicating whether to apply sub-block predicted motion vector mode is coded / decoded. In the case of applying sub-block predicted motion vector mode (inter_affine_flag=1), cu_affine_type_flag is coded / decoded. cu_affine_type_flag is a flag for determining the number of control points in sub-block predicted motion vector mode.

[0028] On the other hand, in the case of merge mode (merge_flag=1), the regular_merge_flag in FIG. 12(b) is coded / decoded. The regular_merge_flag is a flag indicating whether or not the normal merge mode is applied. In the case of normal merge mode (regular_merge_flag=1), the merge index merge_idx of the normal merge mode is coded / decoded. On the other hand, in the case of not normal merge mode (regular_merge_flag=0), the flag merge_subblock_flag indicating whether or not the subblock merge mode is applied is coded / decoded. In the case of subblock merge mode (merge_subblock_flag=1), the merge index merge_subblock_idx is coded / decoded. On the other hand, in the case of not subblock merge mode (merge_subblock_flag=0), the direction in which the block is split, merge_triangle_split_dir, and the merge triangle indices merge_triangle_idx0, merge_triangle_idx1 for each of the two partitions split are coded / decoded.

[0029] FIG. 13 shows the values ​​of each syntax element and the corresponding prediction modes. merge_flag=0, inter_affine_flag=0 corresponds to the normal predicted motion vector mode (Inter Pred Mode). merge_flag=0, inter_affine_flag=1 corresponds to the sub-block predicted motion vector mode (Inter Affine Mode). merge_flag=1, regular_merge_flag=1 corresponds to the normal merge mode (Merge Mode). merge_flag=1, regular_merge_flag=0, merge_subblock_flag=0 corresponds to the triangle merge mode (Triangle Merge Mode). merge_flag=1, regular_merge_flag=0, merge_subblock_flag=1 corresponds to the sub-block merge mode (Affine Merge Mode).

[0030] <poc> POC (Picture Order Count) is a variable associated with a picture to be coded, and is set to a value that increases by one in the picture output order. The POC value can be used to determine whether the pictures are the same, to determine the order of pictures in the output order, and to derive the distance between pictures. For example, if two pictures have the same POC value, they can be determined to be the same picture. If two pictures have different POC values, the picture with the smaller POC value can be determined to be the picture that will be output first, and the difference between the POCs of the two pictures indicates the distance between the pictures along the time axis.

[0031] (First embodiment) An image encoding device 100 and an image decoding device 200 according to a first embodiment of the present invention will be described.

[0032] 1 is a block diagram of an image coding device 100 according to a first embodiment. The video coding device according to the embodiment includes an image coding device 100, a block division unit 101, an inter prediction unit 102, an intra prediction unit 103, a decoded image memory 104, a prediction method determination unit 105, a residual signal generation unit 106, an orthogonal transform / quantization unit 107, a bit string coding unit 108, an inverse quantization / inverse orthogonal transform unit 109, a decoded image signal superimposition unit 110, and a coding information storage memory 111.

[0033] The block division unit 101 recursively divides an input image to generate coding blocks. The block division unit 101 includes a 4-division unit that divides a block to be divided horizontally and vertically, and a 2-3 division unit that divides a block to be divided either horizontally or vertically. The block division unit 101 supplies the generated image signal of the coding block to be processed to the inter prediction unit 102, the intra prediction unit 103, and the residual signal generation unit 106. The block division unit 101 also supplies information indicating the determined recursive division structure to the bit string coding unit 108. The detailed operation of the block division unit 101 will be described later.

[0034] The inter prediction unit 102 performs inter prediction of the coding block to be processed. A plurality of candidates for inter prediction information are derived from the inter prediction information stored in the coding information storage memory and the decoded image signal stored in the decoded image memory 104, an appropriate inter prediction mode is selected from the plurality of candidates, and the selected inter prediction mode and a predicted image signal according to the selected inter prediction mode are supplied to the prediction method determination unit 105. A detailed configuration and operation of the inter prediction unit 102 will be described later.

[0035] The intra prediction unit 103 performs intra prediction of the coding block to be processed. Intra prediction creates a predicted image signal from a decoded area of ​​the same image signal as the coding block to be processed stored in the decoded image memory 104, and supplies the predicted image signal to the prediction method determination unit 105. The detailed configuration and operation of the intra prediction unit 103 will be described later.

[0036] The decoded image memory 104 stores the decoded image generated by the decoded image signal superimposition unit 110. The decoded image memory 104 also supplies the decoded image stored in the decoded image memory to the inter prediction unit 102 and the intra prediction unit 103.

[0037] The prediction method determination unit 105 determines the optimal prediction mode (inter prediction or intra prediction) for each prediction by evaluating using the coding information and the code amount of the residual signal, the distortion amount between the predicted image signal and the image signal to be processed, etc. In the case of the merge mode of the inter prediction, the coding information of the merge index and the information indicating whether or not it is a sub-block merge mode (sub-block merge flag) is supplied to the bit string coding unit 108, and in the case of the predicted motion vector mode of the inter prediction, the coding information of the inter prediction mode, the predicted motion vector index, the reference index of L0 and L1, the difference motion vector, and the information indicating whether or not it is a sub-block mode (sub-block predicted motion vector flag) is supplied to the bit string coding unit 108. The determined coding information is supplied to the coding information storage memory 111.

[0038] The residual signal generation unit 106 generates a residual signal by subtracting the predicted image signal from the image signal to be processed, and supplies the residual signal to the orthogonal transformation and quantization unit 107 .

[0039] The orthogonal transform and quantization unit 107 performs orthogonal transform and quantization on the residual signal in accordance with the quantization parameter to generate an orthogonally transformed and quantized residual signal, and supplies the orthogonal transformed and quantized residual signal to a bit string coding unit 108 and an inverse quantization and inverse orthogonal transform unit 109 .

[0040] The bitstream coding unit 108 codes coding information according to the prediction method determined by the prediction method determining unit 105 for each coding block, in addition to information in units of sequences, pictures, slices, and coding blocks. Specifically, the bitstream coding unit 108 codes the prediction mode PredMode and the division mode PartMode for each coding block. When the prediction mode is intra prediction (PRED_INTRA), the bitstream coding unit 108 codes a flag (pred_mode_ibc_flag) for determining whether or not the prediction mode is intra block copy. When the prediction mode is intra block copy, the bitstream coding unit 108 codes coding information such as a merge index if the prediction mode is merge mode, a predicted block vector index if the prediction mode is not merge mode, and a differential block vector according to a specified syntax (syntax rules of coding bitstreams) to generate a first coding bitstream. When the prediction mode is inter prediction (PRED_INTER), the bitstream coding unit 108 codes coding information such as a flag for determining whether or not the prediction mode is merge mode, a sub-block merge flag, a merge index if the prediction mode is merge mode, an inter prediction mode if the prediction mode is not merge mode, a predicted motion vector index, information on a differential motion vector, and a sub-block predicted motion vector flag according to a specified syntax (syntax rules of coding bitstreams) to be described later, to generate a first coding bitstream. Furthermore, the bitstream coding unit 108 performs entropy coding on the orthogonally transformed and quantized residual signal in accordance with a specified syntax to generate a second coded bitstream, multiplexes the first coded bitstream and the second coded bitstream in accordance with a specified syntax, and outputs a bitstream.

[0041] The inverse quantization and inverse orthogonal transform unit 109 inverse quantizes and inverse orthogonal transforms the orthogonally transformed and quantized residual signal supplied from the orthogonal transform and quantization unit 107 to calculate a residual signal, and supplies it to a decoded image signal superimposition unit 110.

[0042] The decoded image signal superimposing unit 110 superimposes the predicted image signal according to the determination by the prediction method determining unit 105 and the residual signal that has been inverse quantized and inverse orthogonal transformed by the inverse quantization and inverse orthogonal transform unit 109 to generate a decoded image, and stores the decoded image in the decoded image memory 104. Note that the decoded image may be stored in the decoded image memory 104 after being subjected to a filtering process for reducing distortion such as block distortion caused by encoding.

[0043] The coding information storage memory 111 stores coding information such as a prediction mode (inter prediction or intra prediction) determined by the prediction method determination unit 105. In the case of inter prediction, the coding information stored in the coding information storage memory 111 includes a determined motion vector, a reference list, and a reference index, in the case of a merge mode of inter prediction, coding information of a merge index and information indicating whether or not a sub-block merge mode (sub-block merge flag), in the case of a predicted motion vector mode of inter prediction, an inter prediction mode, a predicted motion vector index, reference indexes of L0 and L1, a difference motion vector, information indicating whether or not a sub-block mode (sub-block predicted motion vector flag), and in the case of intra prediction, a determined intra prediction mode. The construction of a history candidate list managed by the coding information storage memory 111 will be described later.

[0044] Fig. 2 is a block diagram showing the configuration of a video decoding device according to an embodiment of the present invention, which corresponds to the video encoding device of Fig. 1. The video decoding device according to the embodiment includes a bitstream decoding unit 201, a block dividing unit 202, an inter prediction unit 203, an intra prediction unit 204, an encoded information storage memory 205, an inverse quantization and inverse orthogonal transform unit 206, a decoded image signal superimposition unit 207, and a decoded image memory 208.

[0045] 2 corresponds to the decoding process provided inside the video encoding device of FIG. 1, and therefore each of the components of the encoding information storage memory 205, the inverse quantization and inverse orthogonal transformation unit 206, the decoded image signal superimposition unit 207, and the decoded image memory 208 of FIG. 2 has a function corresponding to each of the components of the inverse quantization and inverse orthogonal transformation unit 109, the decoded image signal superimposition unit 110, the encoding information storage memory 111, and the decoded image memory 104 of the video encoding device of FIG. 1.

[0046] The bitstream supplied to the bitstream decoding unit 201 is separated according to the rules of a specified syntax. The separated first coded bitstream is decoded to obtain information on a sequence, a picture, a slice, and a coding block unit, and coding information on a coding block unit. Specifically, the prediction mode PredMode and the division mode PartMode that determine whether the coding block unit is an inter prediction (PRED_INTER) or an intra prediction (PRED_INTRA) are decoded. In the case of intra prediction (PRED_INTRA), a flag (pred_mode_ibc_flag) that determines whether or not the coding block is an intra block copy is decoded. In the case of intra block copy, coding information such as a merge index in the case of a merge mode, a predicted block vector index in the case of a non-merge mode, and a difference block vector are decoded according to the specified syntax (syntax rules of a coded bitstream), and the coding information is supplied to the inter prediction unit 203 or the intra prediction unit 204 and the coding information storage memory 205. In the case of inter prediction (PRED_INTER), the coding information relating to a flag for determining whether or not the mode is merge mode, a merge index in the case of merge mode, a sub-block merge flag, and in the case of predicted motion vector mode, the coding information relating to the inter prediction mode, predicted motion vector index, differential motion vector, sub-block predicted motion vector flag, etc. is decoded according to a specified syntax described later, and the coding information is supplied to the inter prediction unit 203 or the intra prediction unit 204, and the coding information storage memory 205. The separated second coded bit string is decoded to calculate an orthogonally transformed and quantized residual signal, and the orthogonally transformed and quantized residual signal is supplied to the inverse quantization and inverse orthogonal transform unit 206.

[0047] When the prediction mode PredMode of the coding block to be processed is inter prediction (PRED_INTER) and a predicted motion vector mode, the inter prediction unit 203 derives multiple predicted motion vector candidates using the coding information of the already decoded image signal stored in the coding information storage memory 205, and registers them in a predicted motion vector candidate list described below. From the multiple predicted motion vector candidates registered in the predicted motion vector candidate list, the inter prediction unit 203 selects a predicted motion vector corresponding to the predicted motion vector index decoded and supplied by the bit string decoding unit 201, calculates a motion vector from the difference vector decoded by the bit string decoding unit 201 and the selected predicted motion vector, and stores the motion vector in the coding information storage memory 205 together with other coding information. The coding information of the coding block supplied and stored here includes a prediction mode PredMode, a partition mode PartMode, flags predFlagL0[xP][yP] and predFlagL1[xP][yP] indicating whether or not to use L0 prediction and L1 prediction, reference indexes refIdxL0[xP][yP] and refIdxL1[xP][yP] of L0 and L1, motion vectors mvL0[xP][yP] and mvL1[xP][yP] of L0 and L1, etc. Here, xP and yP are indexes indicating the position of the upper left pixel of the coding block in a picture. When the prediction mode PredMode is inter prediction (MODE_INTER) and the inter prediction mode is L0 prediction (Pred_L0), the flag predFlagL0 indicating whether or not to use L0 prediction is 1, and the flag predFlagL1 indicating whether or not to use L1 prediction is 0. When the inter prediction mode is L1 prediction (Pred_L1), the flag predFlagL0 indicating whether or not to use L0 prediction is 0, and the flag predFlagL1 indicating whether or not to use L1 prediction is 1. When the inter prediction mode is bi-prediction (Pred_BI), the flag predFlagL0 indicating whether or not to use L0 prediction and the flag predFlagL1 indicating whether or not to use L1 prediction are both 1. Furthermore, when the prediction mode PredMode of the coding block to be processed is inter prediction (PRED_INTER) and a merge mode, merge candidates are derived.Using the coding information of the already decoded coding block stored in the coding information storage memory 205, a plurality of merge candidates are derived and registered in a merge candidate list described later, a merge candidate corresponding to a merge index decoded and supplied by the bitstream decoding unit 201 is selected from the plurality of merge candidates registered in the merge candidate list, and inter prediction information such as flags predFlagL0[xP][yP], predFlagL1[xP][yP] indicating whether or not to use L0 prediction and L1 prediction of the selected merge candidate, reference indexes refIdxL0[xP][yP], refIdxL1[xP][yP] of L0, L1, motion vectors mvL0[xP][yP], mvL1[xP][yP] of L0, L1, etc. are stored in the coding information storage memory 205. Here, xP and yP are indexes indicating the position of the upper left pixel of the coding block in the picture. A detailed configuration and operation of the inter prediction unit will be described later.

[0048] The intra prediction unit 204 performs intra prediction when the prediction mode PredMode of the coding block to be processed is intra prediction (PRED_INTRA). The coding information decoded by the bitstream decoding unit 201 includes an intra prediction mode, and generates a predicted image signal by intra prediction from a decoded image signal stored in a decoded image memory 208 according to the intra prediction mode, and supplies the predicted image signal to a decoded image signal superimposition unit 207. The intra prediction unit 204 corresponds to the intra prediction unit 103 of the image coding device 100, and therefore performs the same processing as the intra prediction unit 103.

[0049] The inverse quantization and inverse orthogonal transformation unit 206 performs inverse orthogonal transformation and inverse quantization on the orthogonally transformed and quantized residual signal decoded by the bit string decoding unit 201, thereby obtaining an inverse orthogonally transformed and inverse quantized residual signal.

[0050] The decoded image signal superimposition unit 207 superimposes the predicted image signal inter predicted by the inter prediction unit 203 or the predicted image signal intra predicted by the intra prediction unit 204 on a residual signal inverse orthogonal transformed and inverse quantized by the inverse quantization and inverse orthogonal transformation unit 206, thereby decoding the decoded image signal and storing it in the decoded image memory 208. When storing in the decoded image memory 208, the decoded image may be subjected to a filtering process for reducing block distortion and the like caused by encoding before being stored in the decoded image memory 208.

[0051] Next, the operation of the block division unit 101 in the image encoding device 100 will be described. Fig. 3 is a flowchart showing the operation of dividing an image into tree blocks and further dividing each tree block. First, an input image is divided into tree blocks of a predetermined size (step S1001). Each tree block is scanned in a predetermined order, i.e., in raster scan order (step S1002), and the inside of the tree block to be processed is divided (step S1003).

[0052] 7 is a flowchart showing the detailed operation of the division process in step S1003. First, it is determined whether or not the block to be processed is to be divided into four (step S1101).

[0053] If it is determined that the processing target block should be divided into four, the processing target block is divided into four (step S1102). Each block into which the processing target block is divided is scanned in Z scan order, that is, in the order of upper left, upper right, lower left, and lower right (step S1103). FIG. 5 is an example of Z scan order, and 601 in FIG. 6 is an example in which the processing target block is divided into four. Numbers 0 to 3 of 601 in FIG. 6 indicate the order of processing. Then, for each block divided in step S1101, the division process in FIG. 7 is recursively performed (step S1104).

[0054] If it is determined that the processing target block should not be divided into four, it is divided into two and three (step S1105).

[0055] 8 is a flowchart showing the detailed operation of the 2-3 division process in step S1105. First, it is determined whether or not the block to be processed is to be divided into 2-3, that is, whether or not to divide into 2 or 3 (step S1201).

[0056] If it is not determined that the block to be processed should be divided into 2-3, that is, if it is determined that the block should not be divided, the division is terminated (step S1211) and the process returns to the block in the upper hierarchy.

[0057] If it is determined that the block to be processed is to be divided into 2 or 3, it is then determined whether or not the block to be processed is to be further divided into 2 (step S1202).

[0058] If it is determined that the target block is to be divided into two, it is determined whether or not to divide the target block vertically (step S1203), and based on the result, the target block is divided vertically (step S1204) or horizontally (step S1205). As a result of step S1204, the target block is divided into two vertically as shown in 602 in Fig. 6, and as a result of step S1205, the target block is divided into two horizontally as shown in 604 in Fig. 6.

[0059] In step S1202, if it is not determined that the block to be processed should be divided into two, i.e., if it is determined that the block to be processed should be divided into three, it is determined whether or not to divide the block to be processed vertically (step S1206), and based on the result, the block to be processed is divided vertically (step S1207) or horizontally (step S1208). As a result of step S1207, the block to be processed is divided vertically into three as shown in 603 of Fig. 6, and as a result of step S1208, the block to be processed is divided horizontally into three as shown in 605 of Fig. 6.

[0060] After executing any one of steps S1204 to S1205, each block obtained by dividing the target block is scanned from left to right and from top to bottom (step S1209). Numbers 0 to 3 of 602 to 605 in Fig. 6 indicate the order of processing. For each divided block, the 2-3 division process in Fig. 8 is recursively executed (step S1210).

[0061] The recursive block division described here may limit the necessity of division depending on the number of divisions, the size of the block to be processed, etc. The information limiting the necessity of division may be realized in a configuration in which no information is transmitted by a prearrangement between the encoding device and the decoding device, or may be realized in a configuration in which the encoding device determines information limiting the necessity of division and transmits it to the decoding device by recording it in the encoded bit string.

[0062] Here, when a block is divided, the block before the division is called a parent block, and each block after the division is called a child block.

[0063] Next, the operation of the block division unit 202 in the image decoding device 200 will be described. The block division unit 202 divides tree blocks in the same processing procedure as the block division unit 101 in the image encoding device 100. However, the difference is that the block division unit 101 in the image encoding device 100 determines the optimal block division shape by applying an optimization method such as optimal shape estimation by image recognition or distortion rate optimization, whereas the block division unit 202 in the image decoding device 200 determines the block division shape by decoding block division information recorded in the encoded bit string.

[0064] The syntax for block division in the first embodiment (syntax rules for coded bitstreams) is shown in Fig. 9. coding_quadtree() represents syntax for dividing a block into four, and multi_type_tree() represents syntax for dividing a block into two or three. qt_split is a flag indicating whether or not to divide a block into four. If the block is divided into four, qt_split=1 is set, and if not, qt_split=0 is set. If the block is divided into four (qt_split=1), each block is divided into four and divided into four recursively (coding_quadtree(0), coding_quadtree(1), coding_quadtree(2), coding_quadtree(3)). If the block is not divided into four (qt_split=0), the subsequent division is determined according to multi_type_tree(). mtt_split is a flag indicating whether or not to divide the block further. If further division is required (mtt_split=1), the mtt_split_vertical flag indicating whether to divide vertically or horizontally and the mtt_split_binary flag determining whether to divide into two or three are referenced. mtt_split_vertical=1 indicates vertical division, and mtt_split_vertical=0 indicates horizontal division. mtt_split_binary=1 indicates division into two, and mtt_split_binary=0 indicates division into three. Hierarchical block division is performed by recursively calling multi_type_tree until mtt_split=0 is reached.

[0065] <Intra prediction> The intra prediction method according to the embodiment is implemented in the intra prediction unit 103 of the video encoding device in FIG. 1 and the inter prediction unit 203 of the video decoding device in FIG.

[0066] An intra prediction method according to an embodiment will be described with reference to the drawings. The intra prediction method is carried out in both encoding and decoding processes on a coding block basis.

[0067] <Description of the intra prediction unit 103 on the encoding side> FIG. 41 is a diagram showing a detailed configuration of the intra prediction unit 103 of the video encoding device of FIG. 1. The normal intra prediction unit 351 generates a predicted image signal by normal intra prediction from decoded pixels adjacent to the encoding block to be processed, selects an appropriate intra prediction mode from among a plurality of intra prediction modes, and supplies the selected intra prediction mode and a predicted image signal according to the selected intra prediction mode to the prediction method determination unit 105. FIG. 10 shows an example of normal intra prediction. FIG. 10(a) shows the correspondence between the prediction direction of normal intra prediction and the intra prediction mode number. For example, the intra prediction mode 50 generates an intra prediction image by copying pixels in the vertical direction. The intra prediction mode 1 is a DC mode, and is a mode in which all pixel values ​​of the block to be processed are the average value of the reference pixels. The intra prediction mode 0 is a Planar mode, and is a mode in which a two-dimensional intra prediction image is created from reference pixels in the vertical and horizontal directions. FIG. 10(b) is an example of generating an intra prediction image in the case of the intra prediction mode 40. For each pixel in the block to be processed, the value of the reference pixel in the direction indicated by the intra prediction mode is copied. If the reference pixel in the intra prediction mode is not at an integer position, the reference pixel value is determined by interpolation from the reference pixel values ​​of neighboring integer positions.

[0068] The intra block copy prediction unit 352 obtains a decoded area of ​​an image signal that is the same as the coding block to be processed from the decoded image memory 104, generates a predicted image signal by intra block copy processing, and supplies it to the prediction method determination unit 105. The detailed configuration and processing of the intra block copy prediction unit 352 will be described later.

[0069] <Description of the intra prediction unit 204 on the decoding side> FIG. 42 is a diagram showing a detailed configuration of the intra prediction unit 204 of the video decoding device of FIG.

[0070] The normal intra prediction unit 361 generates a predicted image signal by normal intra prediction from decoded pixels adjacent to the coding block to be processed, selects an appropriate intra prediction mode from among a plurality of intra prediction modes, and obtains the selected intra prediction mode and a predicted image signal according to the selected intra prediction mode. This predicted image signal is supplied to the decoded image signal superimposition unit 207 via a switch 364. The process of the normal intra prediction unit 361 in FIG. 42 corresponds to the normal intra prediction unit 351 in FIG. 41, and therefore detailed description will be omitted.

[0071] The intra block copy prediction unit 362 obtains a decoded area of ​​the image signal that is the same as the coding block to be processed from the decoded image memory 208, and obtains a predicted image signal by intra block copy processing. This predicted image signal is supplied to the decoded image signal superimposition unit 207 via a switch 364. The detailed configuration and processing of the intra block copy prediction unit 362 will be described later.

[0072] <Inter Prediction> The inter prediction method according to the embodiment is implemented in the inter prediction unit 102 of the video encoding device in FIG. 1 and the inter prediction unit 203 of the video decoding device in FIG.

[0073] An inter prediction method according to an embodiment will be described with reference to the drawings. The inter prediction method is performed in both encoding and decoding processes on a coding block basis.

[0074] <Description of the inter prediction unit 102 on the encoding side> Fig. 16 is a diagram showing a detailed configuration of the inter prediction unit 102 of the video encoding device of Fig. 1. A normal prediction motion vector mode derivation unit 301 derives a plurality of normal prediction motion vector candidates, selects a predicted motion vector, and calculates a difference vector with respect to the detected motion vector. The detected inter prediction mode, reference index, motion vector, and calculated difference vector become inter prediction information of the normal prediction motion vector mode. This inter prediction information is supplied to an inter prediction mode determination unit 305. A detailed configuration and processing of the normal prediction motion vector mode derivation unit 301 will be described later.

[0075] The normal merge mode derivation unit 302 derives a plurality of normal merge candidates, selects a normal merge candidate, and obtains inter prediction information for the normal merge mode. This inter prediction information is supplied to the inter prediction mode determination unit 305. A detailed configuration and processing of the normal merge mode derivation unit 302 will be described later.

[0076] The sub-block predicted motion vector mode derivation unit 303 derives a plurality of sub-block predicted motion vector candidates, selects a sub-block predicted motion vector, and calculates a difference vector with the detected motion vector. The detected inter prediction mode, reference index, motion vector, and calculated difference vector become inter prediction information for the normal predicted motion vector mode. This inter prediction information is supplied to the inter prediction mode determination unit 305. The detailed configuration and processing of the sub-block predicted motion vector mode derivation unit 303 will be described later.

[0077] The subblock merging mode derivation unit 304 derives a plurality of subblock merging candidates, selects a subblock merging candidate, and obtains inter prediction information of the subblock merging mode. This inter prediction information is supplied to the inter prediction mode determination unit 305. The detailed configuration and processing of the subblock merging mode derivation unit 304 will be described later.

[0078] The inter prediction mode determination unit 305 determines the inter prediction mode based on the inter prediction information supplied from the normal prediction motion vector mode derivation unit 301, the normal merge mode derivation unit 302, the sub-block prediction motion vector mode derivation unit 303, and the sub-block merge mode derivation unit 304. The inter prediction mode determination unit 305 supplies inter prediction information according to the determination result to a motion compensation prediction unit 306.

[0079] Based on the determined inter prediction information, the motion compensation prediction unit 306 performs inter prediction on the reference image signal stored in the decoded image memory 104. The detailed configuration and processing will be described later.

[0080] <Description of the Inter Prediction Unit 203 on the Decoding Side> FIG. 22 is a diagram showing a detailed configuration of the inter prediction unit 203 of the video decoding device of FIG.

[0081] The normal prediction motion vector mode derivation unit 401 derives a plurality of normal prediction motion vector candidates, selects a prediction motion vector, and calculates a difference vector with the detected motion vector. The detected inter prediction mode, reference index, motion vector, and difference vector become inter prediction information of the normal prediction motion vector mode. This inter prediction information is supplied to the motion compensation prediction unit 406 via a switch 408. The detailed configuration and processing of the normal prediction motion vector mode derivation unit 401 will be described later.

[0082] The normal merge mode derivation unit 402 derives a plurality of normal merge candidates, selects a normal merge candidate, and obtains inter prediction information for the normal merge mode. This inter prediction information is supplied to the motion compensation prediction unit 406 via a switch 408. The detailed configuration and processing of the normal merge mode derivation unit 402 will be described later.

[0083] The sub-block prediction motion vector mode derivation unit 403 derives a plurality of sub-block prediction motion vector candidates, selects a sub-block prediction motion vector, and calculates a difference vector with the detected motion vector. The detected inter prediction mode, reference index, motion vector, and calculated difference vector become inter prediction information for the normal prediction motion vector mode. This inter prediction information is supplied to the motion compensation prediction unit 406 via the switch 408.

[0084] The subblock merging mode derivation unit 404 derives a plurality of subblock merging candidates, selects a subblock merging candidate, and obtains inter-prediction information for the subblock merging mode. This inter-prediction information is supplied to a motion compensation prediction unit 406 via a switch 408. The motion compensation prediction unit 406 performs inter-prediction on a reference image signal stored in a decoded image memory 208 based on the determined inter-prediction information. The detailed configuration and processing are the same as those on the encoding side.

[0085] <Normal predicted motion vector mode derivation part (normal AMVP)> The normal prediction motion vector mode derivation unit 301 in Figure 17 includes a spatial prediction motion vector candidate derivation unit 321, a temporal prediction motion vector candidate derivation unit 322, a history prediction motion vector candidate derivation unit 323, a prediction motion vector candidate supplementation unit 325, a normal motion vector detection unit 326, a prediction motion vector candidate selection unit 327, and a motion vector subtraction unit 328.

[0086] The normal predictor motion vector mode derivation unit 401 in Figure 23 includes a spatial predictor motion vector candidate derivation unit 421, a temporal predictor motion vector candidate derivation unit 422, a history predictor motion vector candidate derivation unit 423, a predictor motion vector candidate supplementation unit 425, a predictor motion vector candidate selection unit 426, and a motion vector addition unit 427.

[0087] The processing procedures of the normal prediction motion vector mode derivation unit 301 on the encoding side and the normal prediction motion vector mode derivation unit 401 on the decoding side will be described with reference to the flowcharts of Fig. 19 and Fig. 25. Fig. 19 is a flowchart showing the normal prediction motion vector mode derivation processing procedure by the normal motion vector mode derivation unit 301 on the encoding side, and Fig. 25 is a flowchart showing the normal prediction motion vector mode derivation processing procedure by the normal motion vector mode derivation unit 401 on the decoding side.

[0088] <Normal prediction motion vector mode derivation part (normal AMVP): Explanation on the encoding side> A normal predicted motion vector mode derivation process procedure on the encoding side will be described with reference to Fig. 19. In the description of the process procedure in Fig. 19, the term motion vector in the specification corresponds to the term normal motion vector in Fig. 19.

[0089] First, the normal motion vector detection unit 326 detects a normal motion vector for each inter prediction mode and reference index (step S100 in FIG. 19).

[0090] Next, the spatial prediction motion vector candidate derivation unit 321, the temporal prediction motion vector candidate derivation unit 322, the history prediction motion vector candidate derivation unit 323, the prediction motion vector candidate supplementation unit 325, the prediction motion vector candidate selection unit 327, and the motion vector subtraction unit 328 calculate the difference motion vector of the motion vector used in the inter prediction of the normal prediction motion vector mode for each of L0 and L1 (steps S101 to S106 in FIG. 19). Specifically, when the prediction mode PredMode of the processing target block is inter prediction (MODE_INTER) and the inter prediction mode is L0 prediction (Pred_L0), the prediction motion vector candidate list mvpListL0 of L0 is calculated, the prediction motion vector mvpL0 is selected, and the difference motion vector mvdL0 of the motion vector mvL0 of L0 is calculated. When the inter prediction mode of the block to be processed is L1 prediction (Pred_L1), the L1 predicted motion vector candidate list mvpListL1 is calculated, the predicted motion vector mvpL1 is selected, and the differential motion vector mvdL1 of the motion vector mvL1 of L1 is calculated. When the inter prediction mode of the block to be processed is bi-prediction (Pred_BI), both L0 prediction and L1 prediction are performed, the L0 predicted motion vector candidate list mvpListL0 is calculated, the L0 predicted motion vector mvpL0 is selected, and the differential motion vector mvdL0 of the motion vector mvL0 of L0 is calculated, and the L1 predicted motion vector candidate list mvpListL1 is calculated, the L1 predicted motion vector mvpL1 is calculated, and the differential motion vector mvdL1 of the motion vector mvL1 of L1 is calculated.

[0091] A differential motion vector calculation process is performed for each of L0 and L1, but the process is common to both L0 and L1. Therefore, in the following description, L0 and L1 are represented as a common LX. In the process of calculating the differential motion vector of L0, X is 0, and in the process of calculating the differential motion vector of L1, X is 1. Furthermore, when referring to information of the other list instead of LX during the process of calculating the differential motion vector of LX, the other list is represented as LY.

[0092] When the motion vector mvLX of LX is used (step S102 in FIG. 19: YES), a candidate of the predicted motion vector of LX is calculated to construct a predicted motion vector candidate list mvpListLX of LX (step S103 in FIG. 19). A spatial predicted motion vector candidate derivation unit 321, a temporal predicted motion vector candidate derivation unit 322, a history predicted motion vector candidate derivation unit 323, and a predicted motion vector candidate supplementation unit 325 in the normal predicted motion vector mode derivation unit 301 derive multiple predicted motion vector candidates to construct the predicted motion vector candidate list mvpListLX. The detailed processing procedure of step S103 in FIG. 19 will be described later with reference to the flowchart in FIG. 20.

[0093] Next, the motion vector predictor candidate selection unit 327 selects the motion vector predictor mvpLX of LX from the motion vector predictor candidate list mvpListLX of LX (step S104 in FIG. 19). Each difference motion vector is calculated as a difference between the motion vector mvLX and each motion vector predictor candidate mvpListLX[i] stored in the motion vector predictor candidate list mvpListLX. The amount of code when these difference motion vectors are coded is calculated for each element of the motion vector predictor candidate list mvpListLX. Then, among the elements registered in the motion vector predictor candidate list mvpListLX, the motion vector predictor candidate mvpListLX[i] with the smallest amount of code for each motion vector predictor candidate is selected as the motion vector predictor mvpLX, and its index i is obtained. If there are multiple candidates for the predicted motion vector that will result in the smallest amount of generated code in the predicted motion vector candidate list mvpListLX, the candidate predicted motion vector mvpListLX[i] represented by the smallest index i in the predicted motion vector candidate list mvpListLX is selected as the optimal predicted motion vector mvpLX, and its index i is obtained.

[0094] Next, the motion vector subtraction unit 328 subtracts the selected predicted motion vector mvpLX of LX from the motion vector mvLX of LX, mvdLX = mvLX - mvpLX Then, the differential motion vector mvdLX of LX is calculated as (Step S105 in FIG. 19).

[0095] <Normal predicted motion vector mode derivation part (normal AMVP): Decoding side explanation> Next, the normal predicted motion vector mode processing procedure on the decoding side will be described with reference to Fig. 25. On the decoding side, the spatial predicted motion vector candidate derivation unit 421, the temporal predicted motion vector candidate derivation unit 422, the history predicted motion vector candidate derivation unit 423, and the predicted motion vector candidate supplement unit 425 calculate the motion vectors used in inter prediction of the normal predicted motion vector mode for each of L0 and L1 (steps S201 to S206 in Fig. 25). Specifically, when the prediction mode PredMode of the processing target block is inter prediction (MODE_INTER) and the inter prediction mode of the processing target block is L0 prediction (Pred_L0), the predicted motion vector candidate list mvpListL0 of L0 is calculated, the predicted motion vector mvpL0 is selected, and the motion vector mvL0 of L0 is calculated. When the inter prediction mode of the block to be processed is L1 prediction (Pred_L1), the L1 predicted motion vector candidate list mvpListL1 is calculated, the predicted motion vector mvpL1 is selected, and the motion vector mvL1 of L1 is calculated. When the inter prediction mode of the block to be processed is bi-prediction (Pred_BI), both L0 prediction and L1 prediction are performed, the L0 predicted motion vector candidate list mvpListL0 is calculated, the L0 predicted motion vector mvpL0 is selected, and the motion vector mvL0 of L0 is calculated, while the L1 predicted motion vector candidate list mvpListL1 is calculated, the L1 predicted motion vector mvpL1 is calculated, and the motion vector mvL1 of L1 is calculated.

[0096] As in the coding side, the decoding side also performs motion vector calculation processing for each of L0 and L1, but the processing is common to both L0 and L1. Therefore, in the following description, L0 and L1 are represented as a common LX. LX represents an inter-prediction mode used for inter-prediction of the coding block to be processed. In the processing to calculate the motion vector of L0, X is 0, and in the processing to calculate the motion vector of L1, X is 1. In addition, when the information of the other reference list is referred to during the processing to calculate the motion vector of LX, instead of the same reference list as the LX to be calculated, the other reference list is represented as LY.

[0097] When the motion vector mvLX of LX is used (step S202 in FIG. 25: YES), a candidate of the predicted motion vector of LX is calculated to construct a predicted motion vector candidate list mvpListLX of LX (step S203 in FIG. 25). A spatial predicted motion vector candidate derivation unit 421, a temporal predicted motion vector candidate derivation unit 422, a history predicted motion vector candidate derivation unit 423, and a predicted motion vector candidate supplementation unit 425 in the normal predicted motion vector mode derivation unit 401 calculate a plurality of predicted motion vector candidates to construct the predicted motion vector candidate list mvpListLX. A detailed processing procedure of step S203 in FIG. 25 will be described later with reference to the flowchart in FIG. 20.

[0098] Next, the predicted motion vector candidate selection unit 426 extracts the predicted motion vector candidate mvpListLX[mvpIdxLX] corresponding to the predicted motion vector index mvpIdxLX decoded and supplied by the bit string decoding unit 201 from the predicted motion vector candidate list mvpListLX as the selected predicted motion vector mvpLX (step S204 in Figure 25).

[0099] Next, the motion vector adder 427 adds the differential motion vector mvdLX of LX decoded and supplied by the bit stream decoder 201 and the predicted motion vector mvpLX of LX, mvLX = mvpLX + mvdLX Then, the motion vector mvLX of LX is calculated (step S205 in FIG. 25).

[0100] <Normal predicted motion vector mode derivation part (normal AMVP): Motion vector prediction method> Figure 20 is a flowchart showing the processing steps of a normal prediction motion vector mode derivation process having functions common to the normal prediction motion vector mode derivation unit 301 of a video encoding device and the normal prediction motion vector mode derivation unit 401 of a video decoding device according to an embodiment of the present invention.

[0101] The normal motion vector predictor mode derivation unit 301 and the normal motion vector predictor mode derivation unit 401 are provided with a motion vector predictor candidate list mvpListLX. The motion vector predictor candidate list mvpListLX has a list structure, and is provided with a storage area for storing a motion vector predictor index indicating a location in the motion vector predictor candidate list and a motion vector predictor candidate corresponding to the index as an element. The number of the motion vector predictor index starts from 0, and the motion vector predictor candidate is stored in the storage area of ​​the motion vector predictor candidate list mvpListLX. In this embodiment, it is assumed that the motion vector predictor candidate list mvpListLX can register at least two motion vector predictor candidates (inter prediction information). Furthermore, 0 is set to a variable numCurrMvpCand indicating the number of motion vector predictor candidates registered in the motion vector predictor candidate list mvpListLX.

[0102] The spatial motion vector predictor candidate derivation units 321 and 421 derive a candidate of a motion vector predictor from a block adjacent to the left. In this process, a flag availableFlagLXA indicating whether or not a motion vector predictor candidate of a block adjacent to the left (A0 or A1) is available, a motion vector mvLXA, and a reference index refIdxA are derived, and mvLXA is added to a motion vector predictor candidate list mvpListLX (step S301 in FIG. 20). Note that X is 0 when L0, and X is 1 when L1 (similar below). Next, the spatial motion vector predictor candidate derivation units 321 and 421 derive a candidate of a motion vector predictor from a block adjacent to the upper side (B0, B1, or B2). In this process, a flag availableFlagLXB indicating whether or not a motion vector predictor candidate of an adjacent block above is available, a motion vector mvLXB, and a reference index refIdxB are derived, and if mvLXA and mvLXB are not equal, mvLXB is added to the motion vector predictor candidate list mvpListLX (step S302 in FIG. 20). The processes in steps S301 and S302 in FIG. 20 are the same except that the positions and numbers of adjacent blocks to be referenced are different, and a flag availableFlagLXN indicating whether or not a motion vector predictor candidate of a coding block is available, a motion vector mvLXN, and a reference index refIdxN (N is A or B, similarly below) are derived.

[0103] Next, the temporal motion vector predictor candidate derivation units 322 and 422 derive candidates for motion vector predictors from coding blocks in pictures that are different in time from the current picture to be processed. In this process, a flag availableFlagLXCol indicating whether a motion vector predictor candidate of a coding block in a picture that is different in time is available or not, a motion vector mvLXCol, a reference index refIdxCol, and a reference list listCol are derived, and mvLXCol is added to the motion vector predictor candidate list mvpListLX (step S303 in FIG. 20). A detailed description of the derivation process procedure in step S303 is omitted.

[0104] It is assumed that the processing of the temporal motion vector predictor candidate derivation units 322 and 422 can be omitted in units of a sequence (SPS), a picture (PPS), or a slice.

[0105] Next, the history motion vector predictor candidate derivation units 323 and 423 add the history motion vector predictor candidates registered in the history motion vector predictor candidate list HmvpCandList to the motion vector predictor candidate list mvpListLX (step S304 in FIG. 20). Details of the registration process procedure in step S304 will be described later with reference to the flowchart in FIG. 29.

[0106] Next, the motion vector predictor candidate supplementation units 325 and 425 add motion vectors of a predetermined value, such as (0, 0), until the motion vector predictor candidate list mvpListLX is filled (S305 in FIG. 20).

[0107] <Normal merge mode derivation part (normal merge)> The normal merge mode derivation unit 302 in FIG. 18 includes a spatial merge candidate derivation unit 341, a temporal merge candidate derivation unit 342, an average merge candidate derivation unit 344, a history merge candidate derivation unit 345, a merge candidate supplementation unit 346, and a merge candidate selection unit 347.

[0108] The normal merge mode derivation unit 402 in FIG. 24 includes a spatial merge candidate derivation unit 441, a temporal merge candidate derivation unit 442, an average merge candidate derivation unit 444, a history merge candidate derivation unit 445, a merge candidate supplementation unit 446, and a merge candidate selection unit 447.

[0109] FIG. 21 is a flowchart illustrating the steps of a normal merge mode derivation process having a function common to the normal merge mode derivation unit 302 of the video encoding device and the normal merge mode derivation unit 402 of the video decoding device according to an embodiment of the present invention.

[0110] The various processes will be described below in order. In the following description, unless otherwise specified, the slice type slice_type is a B slice, but can also be applied to the case of a P slice. However, when the slice type slice_type is a P slice, there is only L0 prediction (Pred_L0) as an inter prediction mode, and there is no L1 prediction (Pred_L1) or bi-prediction (Pred_BI), so that the process related to L1 can be omitted.

[0111] The normal merge mode derivation unit 302 and the normal merge mode derivation unit 402 include a merge candidate list mergeCandList. The merge candidate list mergeCandList has a list structure and is provided with a merge index indicating a location in the merge candidate list and a storage area for storing merge candidates corresponding to the index as elements. The merge index number starts from 0, and merge candidates are stored in the storage area of ​​the merge candidate list mergeCandList. In the following processing, the merge candidate of the merge index i registered in the merge candidate list mergeCandList is represented as mergeCandList[i]. In this embodiment, it is assumed that the merge candidate list mergeCandList can register at least six merge candidates (inter prediction information). Furthermore, 0 is set to a variable numCurrMergeCand indicating the number of merge candidates registered in the merge candidate list mergeCandList.

[0112] The spatial merge candidate derivation unit 341 and the spatial merge candidate derivation unit 441 derive spatial merge candidates A and B from adjacent blocks on the left and upper sides of the block to be processed from the coding information stored in the coding information storage memory 111 of the video coding device or the coding information storage memory 205 of the video decoding device, and register the derived spatial merge candidates in a merge candidate list mergeCandList (step S401 in FIG. 21). Here, N indicating either the spatial merge candidates A and B or the temporal merge candidate Col is defined. A flag availableFlagN indicating whether inter prediction information of the block N can be used as the spatial merge candidate N, an L0 reference index refIdxL0N and an L1 reference index refIdxL1N of the spatial merge candidate N, an L0 prediction flag predFlagL0N indicating whether L0 prediction is performed and an L1 prediction flag predFlagL1N indicating whether L1 prediction is performed, a motion vector mvL0N of L0, and a motion vector mvL1N of L1 are derived. However, in this embodiment, merging candidates are derived without referring to other coding blocks contained in the block that contains the coding block to be processed, so spatial merging candidates contained in the block that contains the coding block to be processed are not derived.

[0113] Next, the temporal merge candidate derivation unit 342 and the temporal merge candidate derivation unit 442 derive temporal merge candidates from pictures of different times, and register the derived temporal merge candidates in a merge candidate list mergeCandList (step S402 in FIG. 21). A flag availableFlagCol indicating whether the temporal merge candidate is available, an L0 prediction flag predFlagL0Col indicating whether L0 prediction of the temporal merge candidate is performed, an L1 prediction flag predFlagL1Col indicating whether L1 prediction is performed, and a motion vector mvL0Col of L0 and a motion vector mvL1Col of L1 are derived. A detailed description of the processing procedure of step S402 will be omitted.

[0114] It is assumed that the processing of the temporal merge candidate derivation unit 342 and the temporal merge candidate derivation unit 442 can be omitted in units of a sequence (SPS), a picture (PPS), or a slice.

[0115] Next, the history merge candidate derivation unit 345 and the history merge candidate derivation unit 445 add the history predicted motion vector candidate registered in the history predicted motion vector candidate list HmvpCandList to the merge candidate list mergeCandList (step S403 in FIG. 21). A detailed process procedure of step S403 will be described later with reference to the flowchart in FIG. 38.

[0116] Next, the average merge candidate derivation unit 344 and the average merge candidate derivation unit 444 derive average merge candidates from the merge candidate list mergeCandList, and register the derived average merge candidates in the merge candidate list mergeCandList (step S404 in FIG. 21). A detailed process of step S404 will be described later with reference to the flowchart in FIG. 29.

[0117] Next, in the merge candidate supplementation unit 346 and the merge candidate supplementation unit 446, when the number of merge candidates registered in the merge candidate list mergeCandList, numCurrMergeCand, is smaller than the maximum number of merge candidates, MaxNumMergeCand, the number of merge candidates registered in the merge candidate list mergeCandList, numCurrMergeCand is set as an upper limit of the maximum number of merge candidates, MaxNumMergeCand, and additional merge candidates are derived and registered in the merge candidate list mergeCandList (step S405 in FIG. 21). For the P slice, a merge candidate having a motion vector of (0,0) value with a different reference index and a prediction mode of L0 prediction (Pred_L0) is added, with the maximum number of merge candidates, MaxNumMergeCand, being set as an upper limit. For the B slice, a merge candidate having a motion vector of (0,0) value with a different reference index and a prediction mode of bi-prediction (Pred_BI) is added.

[0118] Next, the merge candidate selection unit 347 and the merge candidate selection unit 447 select a merge candidate from among the merge candidates registered in the merge candidate list mergeCandList. The merge candidate selection unit 347 on the encoding side selects a merge candidate by calculating the code amount and the distortion amount, and supplies a merge index indicating the selected merge candidate and inter prediction information of the merge candidate to the motion compensation prediction unit 306. On the other hand, the merge candidate selection unit 447 on the decoding side selects a merge candidate based on the decoded merge index, and supplies the selected merge candidate to the motion compensation prediction unit 406.

[0119] <Update of historical motion vector prediction candidate list> Next, a detailed description will be given of a method for initializing and updating the historical motion vector predictor candidate list HmvpCandList provided in the encoding information storage memory 111 on the encoding side and the encoding information storage memory 205 on the decoding side. Fig. 26 is a flowchart illustrating the procedure of the historical motion vector predictor candidate list initialization / update process.

[0120] In this embodiment, the history prediction motion vector candidate list HmvpCandList is updated in the coding information storage memory 111 and the coding information storage memory 205. A history candidate list update unit may be provided in the inter prediction unit 102 and the inter prediction unit 203 to update the history prediction motion vector candidate list HmvpCandList.

[0121] The historical prediction motion vector candidate list HmvpCandList is initially set at the beginning of the slice, and on the encoding side, the historical prediction motion vector candidate list HmvpCandList is updated when the prediction method determination unit 105 selects the normal prediction vector mode or the normal merge mode, and on the decoding side, the historical prediction motion vector candidate list HmvpCandList is updated when the inter prediction mode decoded by the bit string decoding unit 201 is the normal prediction vector mode or the normal merge mode.

[0122] Inter prediction information used when performing inter prediction in normal prediction vector mode or normal merge mode is registered in the history prediction motion vector candidate list HmvpCandList as an inter prediction information candidate hMvpCand. The inter prediction information candidate hMvpCand includes an L0 reference index refIdxL0 and an L1 reference index refIdxL1, an L0 prediction flag predFlagL0 indicating whether or not L0 prediction is performed, an L1 prediction flag predFlagL1 indicating whether or not L1 prediction is performed, a motion vector mvL0 of L0, and a motion vector mvL1 of L1. If inter prediction information with the same value as the inter prediction information candidate hMvpCand exists among elements (i.e., inter prediction information) registered in the history prediction motion vector candidate list HmvpCandList provided in the coding information storage memory 111 on the coding side and the coding information storage memory 205 on the decoding side, the element is deleted from the history prediction motion vector candidate list HmvpCandList. On the other hand, if there is no inter prediction information with the same value as the inter prediction information candidate hMvpCand, the first element of the historical motion vector predictor candidate list HmvpCandList is deleted, and the inter prediction information candidate hMvpCand is added to the end of the historical motion vector predictor candidate list HmvpCandList.

[0123] The number of elements in the historical motion vector predictor candidate list HmvpCandList provided in the encoding information storage memory 111 on the encoding side and the encoding information storage memory 205 on the decoding side in the present invention is assumed to be six.

[0124] First, the historical motion vector predictor candidate list HmvpCandList is initialized in units of slices (step S2101 in FIG. 26). All elements of the historical motion vector predictor candidate list HmvpCandList are cleared at the beginning of the slice, and the value of the number of historical motion vector predictor candidates NumHmvpCand registered in the historical motion vector predictor candidate list HmvpCandList is set to 0.

[0125] Note that, although the initialization of the historical motion vector predictor candidate list HmvpCandList is performed on a slice-by-slice basis (the first coding block of a slice), it may be performed on a picture-by-picture basis, a tile-by-tile basis, or a tree block row-by-tree block basis.

[0126] Next, the following update process of the historical motion vector predictor candidate list HmvpCandList is repeatedly performed for each coding block in the slice (steps S2102 to S2107 in FIG. 26).

[0127] First, initial settings are made for each coding block: A flag identicalCandExist indicating whether an identical candidate exists or not is set to FALSE, and a deletion target index removeIdx is set to 0 (step S2103 in FIG. 26).

[0128] It is determined whether or not there is an inter prediction information candidate hMvpCand to be registered in the history prediction motion vector candidate list HmvpCandList (step S2104 in FIG. 26). If the prediction method determination unit 105 on the encoding side determines that the mode is the normal prediction motion vector mode or the normal merge mode, or if the bitstream decoding unit 201 on the decoding side decodes as the normal prediction motion vector mode or the normal merge mode, the inter prediction mode is set as hMvpCand. If the prediction method determination unit 105 on the encoding side determines that the mode is the intra prediction mode, the sub-block prediction motion vector mode, or the sub-block merge mode, or if the bitstream decoding unit 201 on the decoding side decodes as the intra prediction mode, the sub-block prediction motion vector mode, or the sub-block merge mode, the history prediction motion vector candidate list HmvpCandList is not updated, and there is no inter prediction information candidate hMvpCand to be registered. If there is no inter prediction information candidate hMvpCand to be registered, steps S2105 to S2106 are skipped (step S2104 in FIG. 26: NO). When an inter-prediction information candidate hMvpCand to be registered exists, the processes in and after step S2105 are performed (step S2104 in FIG. 26: YES).

[0129] Next, it is determined whether or not an element identical to the inter-prediction information candidate hMvpCand to be registered exists among the elements of the history prediction motion vector candidate list HmvpCandList (step S2105 in FIG. 26). FIG. 27 is a flowchart of this identical element confirmation process procedure. If the value of the number of history prediction motion vector candidates NumHmvpCand is 0 (step S2121 in FIG. 27: NO), the history prediction motion vector candidate list HmvpCandList is empty and no identical candidate exists, so steps S2122 to S2125 in FIG. 27 are skipped and this identical element confirmation process procedure ends. If the value of the number of history prediction motion vector candidates NumHmvpCand is greater than 0 (step S2121 in FIG. 27: YES), the process of step S2123 is repeated for the history prediction motion vector index hMvpIdx from 0 to NumHmvpCand-1 (steps S2122 to S2125 in FIG. 27). First, the hMvpIdx-th element HmvpCandList[hMvpIdx] counting from 0 in the history motion vector predictor candidate list is compared with the inter-prediction information candidate hMvpCand to see if they are the same (step S2123 in FIG. 27). If they are the same (step S2123 in FIG. 27: YES), a flag identicalCandExist indicating whether an identical candidate exists is set to TRUE, the value of hMVpIndex is set to the deletion target index removeIdx, and this identical element confirmation process ends. If they are not the same (step S2123 in FIG. 27: NO), hMvpIdx is incremented by 1, and if the history motion vector predictor index hMvpIdx is equal to or less than NumHmvpCand-1, the processes from step S2123 onward are performed (steps S2122 to S2125 in FIG. 27).

[0130] Returning to the flowchart of FIG. 26 again, a shift and addition process of elements of the historical motion vector predictor candidate list HmvpCandList is performed (step S2106 of FIG. 26). FIG. 28 is a flowchart of an element shift / addition process procedure of the historical motion vector predictor candidate list HmvpCandList in step S2106 of FIG. 26. First, it is determined whether to remove elements stored in the historical motion vector predictor candidate list HmvpCandList and then add a new element, or to add a new element without removing elements. Specifically, it is compared whether a flag identicalCandExist indicating whether an identical candidate exists is TRUE (true) or NumHmvpCand is 6 (step S2141 of FIG. 28). If either of the conditions that the flag identicalCandExist indicating whether an identical candidate exists is TRUE (true) or NumHmvpCand is 6 is satisfied (step S2141 of FIG. 28: YES), an element stored in the historical motion vector predictor candidate list HmvpCandList is removed and then a new element is added. The initial value of index i is set to the value of removeIdx+1. The element shift process of step S2143 is repeated from this initial value to NumHmvpCand (steps S2142 to S2144 in FIG. 28). The elements of HMVPCandList[i] are shifted forward by copying them to HMVPCandList[i-1] (step S2143 in FIG. 28), and i is incremented by 1 (steps S2142 to S2144 in FIG. 28). When index i becomes NumHmvpCand+1 and the element shift process of step S2143 is completed, the inter prediction information candidate hMvpCand is added to the end of the history motion vector predictor candidate list (step S2145 in FIG. 28). Here, the end of the history motion vector predictor candidate list is the (NumHmvpCand-1)-th HMVPCandList[NumHmvpCand-1] counting from 0. This ends the element shift and addition process of the historical motion vector predictor candidate list HMVPCandList.On the other hand, when neither of the conditions that the flag identicalCandExist indicating whether or not an identical candidate exists is TRUE (true) and NumHmvpCand is 6 is satisfied (step S2141 in FIG. 28: NO), the inter prediction information candidate hMvpCand is added to the end of the history motion vector predictor candidate list without removing any elements stored in the history motion vector predictor candidate list HmvpCandList (step S2146 in FIG. 28). Here, the end of the history motion vector predictor candidate list is the NumHmvpCand-th HMVPCandList[NumHmvpCand] counting from 0. In addition, NumHmvpCand is incremented by 1, and the element shift / addition process of this history motion vector predictor candidate list HMVPCandList is terminated.

[0131] Fig. 31 is a diagram for explaining an example of a process of updating a history prediction motion vector list. When six elements (inter prediction information) are registered in the history prediction motion vector candidate list HMVPCandList, in the case of adding new inter prediction information, each element of the history prediction motion vector candidate list HMVPCandList is compared with new inter prediction information from the front (Fig. 31(a)). If the new inter prediction information has the same value as the third element HMVP2 from the beginning of the history prediction motion vector candidate list HMVPCandList, the element HMVP2 is deleted from the history prediction motion vector candidate list HMVPCandList, and the rear elements HMVP3 to HMVP5 are shifted (copied) forward one by one, and the new inter prediction information is added to the end of the history prediction motion vector candidate list HMVPCandList (Fig. 31(b)), completing the update of the history prediction motion vector candidate list HMVPCandList (Fig. 31(c)).

[0132] <Historical Prediction Motion Vector Candidate Derivation Process> Next, a detailed description will be given of a method for deriving a historical prediction motion vector candidate from the historical prediction motion vector candidate list HMVPCandList, which is a processing procedure of step S304 in Fig. 20 and is common to the historical prediction motion vector candidate derivation unit 323 of the normal prediction motion vector mode derivation unit 301 on the encoding side and the historical prediction motion vector candidate derivation unit 423 of the normal prediction motion vector mode derivation unit 401 on the decoding side. Fig. 29 is a flowchart illustrating the historical prediction motion vector candidate derivation processing procedure.

[0133] If the number of current motion vector predictor candidates numCurrMvpCand is equal to or greater than the maximum number of elements in the motion vector predictor candidate list mvpListLX (2 here) or the value of the number of history motion vector predictor candidates NumHmvpCand is 0 (step S2201: NO in FIG. 29), steps S2202 to S2209 in FIG. 29 are omitted and the history motion vector predictor candidate derivation procedure is terminated. If the number of current motion vector predictor candidates numCurrMvpCand is smaller than 2, which is the maximum number of elements in the motion vector predictor candidate list mvpListLX, and the value of the number of history motion vector predictor candidates NumHmvpCand is greater than 0 (step S2201: YES in FIG. 29), steps S2202 to S2209 in FIG. 29 are performed.

[0134] Next, the processes of steps S2203 to S2208 in FIG. 41 are repeated for index i from 1 to the smaller value of 4 or the number of historical motion vector predictor candidates NumHmvpCand (steps S2202 to S2209 in FIG. 29). If the number of current motion vector predictor candidates numCurrMvpCand is equal to or greater than 2, which is the maximum number of elements in the motion vector predictor candidate list mvpListLX (step S2203 in FIG. 29: NO), the processes of steps S2204 to S2209 in FIG. 29 are omitted, and the historical motion vector predictor candidate derivation process procedure is terminated. If the number of current motion vector predictor candidates numCurrMvpCand is smaller than 2, which is the maximum number of elements in the motion vector predictor candidate list mvpListLX (step S2203 in FIG. 29: YES), the processes of step S2204 and subsequent steps in FIG. 29 are performed.

[0135] Next, the processes from step S2205 to S2207 are performed for Y being 0 and 1 (L0 and L1), respectively (steps S2204 to S2208 in FIG. 29). If the current number of motion vector predictor candidates numCurrMvpCand is equal to or greater than 2, which is the maximum number of elements in the motion vector predictor candidate list mvpListLX (step S2205: NO in FIG. 29), steps S2206 to S2209 in FIG. 29 are omitted, and the history motion vector predictor candidate derivation process procedure ends. If the current number of motion vector predictor candidates numCurrMvpCand is smaller than 2, which is the maximum number of elements in the motion vector predictor candidate list mvpListLX (step S2205: YES in FIG. 29), the processes from step S2206 in FIG. 29 onwards are performed.

[0136] Next, if the reference index of LY in the history predictor motion vector candidate list HmvpCandList[NumHmvpCand - i] is the same as the reference index refIdxLX of the motion vector to be encoded / decoded (step S2206: YES in Figure 29), the LY motion vector in the (NumHmvpCand-i)th element HmvpCandList[[NumHmvpCand - i], counting from 0, of the history predictor motion vector candidate list is added to the numCurrMvpCand-th element mvpListLX[numCurrMvpCand], counting from 0, of the predictor motion vector candidate list as the last element of the predictor motion vector candidate list (step S2207 in Figure 29), and the number of current predictor motion vector candidates numCurrMvpCand is incremented by 1. If the reference index of LY in the historical motion vector predictor candidate list HmvpCandList[NumHmvpCand-i] is not the same as the reference index refIdxLX of the motion vector to be coded / decoded (Step S2206 in FIG. 29: NO), the additional process of Step S2207 is skipped.

[0137] The above-mentioned processing from steps S2205 to S2207 in FIG. 29 is performed for both L0 and L1 (steps S2204 to S2208 in FIG. 29).

[0138] Index i is incremented by 1, and if index i is equal to or less than the smaller value of 4 or the number NumHmvpCand of historical motion vector predictor candidates, the processes in and after step S2203 are performed again (steps S2202 to S2209 in FIG. 29).

[0139] <History merge candidate derivation process> Next, a detailed description will be given of a method for deriving history merge candidates from the history merge candidate list HmvpCandList, which is a processing procedure in step S403 in Fig. 21 and is common to the history merge candidate derivation unit 345 of the normal merge mode derivation unit 302 on the encoding side and the history merge candidate derivation unit 445 of the normal merge mode derivation unit 402 on the decoding side. Fig. 30 is a flowchart illustrating the history merge candidate derivation processing procedure.

[0140] First, an initialization process is performed (step S2301 in FIG. 30). The value FALSE is set for each of the 0th to (numCurrMergeCand -1)th elements of isPruned[i], and the number of elements currently registered in the merge candidate list, numCurrMergeCand, is set to the variable numOrigMergeCand.

[0141] Next, the initial value of index hMvpIdx is set to 1, and the addition process from step S2303 to step S2310 in FIG. 30 is repeated from this initial value to NumHmvpCand (steps S2302 to S2311 in FIG. 30). If the number of elements registered in the current merge candidate list, numCurrMergeCand, is not equal to or less than (maximum number of merge candidates, MaxNumMergeCand-1), merge candidates have been added to all elements in the merge candidate list, so this history merge candidate derivation process is terminated (step S2303 in FIG. 30: NO). If the number of elements registered in the current merge candidate list, numCurrMergeCand, is equal to or less than (maximum number of merge candidates, MaxNumMergeCand-1) (step S2303 in FIG. 30: YES), processing from step S2304 onwards is performed.

[0142] First, the value FALSE is set in sameMotion (step S2304 in FIG. 30). Next, the initial value of index i is set to 0, and the processes of steps S2306 and S2307 in FIG. 30 are performed from this initial value to 1 (S2305 to S2308 in FIG. 30).

[0143] Next, the (NumHmvpCand-hMvpIdx)th element HmvpCandList[NumHmvpCand-hMvpIdx] counting from 0 of the history motion vector prediction candidate list is compared with the i-th element mergeCandList[i] counting from 0 of the merge candidate list to see if they have the same value (step S2306 in FIG. 30). Here, the merge candidates have the same value, meaning that the values ​​of all the components (inter prediction mode, reference index, motion vector) of the merge candidates are the same. However, the process of this step S2306 is limited to the case where hMvpIdx is larger than NumHmvpCand-2, mergeCandList[i] is a spatial merge candidate, and isPruned[i] is FALSE. If they have the same value (step S2306 in FIG. 30: YES), both sameMotion and isPruned[i] are set to TRUE (step S2307 in FIG. 30). If the values ​​are not the same (step S2306 in FIG. 30: NO), the process of step S2307 is skipped. After the repeated processes of steps S2305 to S2308 in FIG. 30 are completed, a comparison is made to see whether sameMotion is FALSE (step S2309 in FIG. 30), and if sameMotion is FALSE (step S2309 in FIG. 30: YES), the (NumHmvpCand - hMvpIdx)-th element HmvpCandList[NumHmvpCand - hMvpIdx] counting from 0 of the history motion vector predictor candidate list is added to the numCurrMergeCand-th mergeCandList[numCurrMergeCand] of the merge candidate list, and numCurrMergeCand is incremented by 1 (step S2310 in FIG. 30). The index hMvpIdx is incremented by 1 (step S2302 in FIG. 30), and steps S2302 to S2311 in FIG. 30 are repeated.

[0144] When all elements in the history motion vector predictor candidate list have been checked, or when merge candidates have been added to all elements in the merge candidate list, this history merge candidate derivation process is completed.

[0145] <Average merge candidate derivation process> Next, a detailed description will be given of a method for deriving an average merge candidate, which is a processing procedure of step S404 in Fig. 21 and is common to the average merge candidate derivation unit 344 of the normal merge mode derivation unit 302 on the encoding side and the average merge candidate derivation unit 444 of the normal merge mode derivation unit 402 on the decoding side. Fig. 38 is a flowchart illustrating the processing procedure for deriving an average merge candidate.

[0146] First, an initialization process is performed (step S1301 in FIG. 38). The number of elements currently registered in the merge candidate list, numCurrMergeCand, is set in a variable, numOrigMergeCand.

[0147] Next, the merge candidate list is scanned from the top to determine two pieces of motion information. The index i indicating the first piece of motion information is set to 0, and the index j indicating the second piece of motion information is set to 1 (steps S1302 to S1303 in FIG. 38). If the number of elements registered in the current merge candidate list, numCurrMergeCand, is not equal to or less than (the maximum number of merge candidates, MaxNumMergeCand-1), this means that merge candidates have been added to all elements in the merge candidate list, and this history merge candidate derivation process ends (step S1304 in FIG. 38). If the number of elements registered in the current merge candidate list, numCurrMergeCand, is equal to or less than (the maximum number of merge candidates, MaxNumMergeCand-1), the processes from step S1305 onwards are performed.

[0148] It is determined whether the i-th motion information mergeCandList[i] in the merge candidate list and the j-th motion information mergeCandList[j] in the merge candidate list are both invalid (step S1305 in FIG. 38). If both are invalid, the average merge candidate of mergeCandList[i] and mergeCandList[j] is not derived, and the process moves to the next element. If mergeCandList[i] and mergeCandList[j] are not invalid, the following process is repeated with X set to 0 and 1 (steps S1306 to S1314 in FIG. 38).

[0149] It is determined whether the LX prediction of mergeCandList[i] is valid (step S1307 in FIG. 38). If the LX prediction of mergeCandList[i] is valid, it is determined whether the LX prediction of mergeCandList[j] is valid (step S1308 in FIG. 38). If the LX prediction of mergeCandList[j] is valid, that is, if both the LX prediction of mergeCandList[i] and the LX prediction of mergeCandList[j] are valid, the motion vector of the LX prediction obtained by averaging the motion vector of the LX prediction of mergeCandList[i] and the motion vector of the LX prediction of mergeCandList[j] and the average merge candidate of the LX prediction having the reference index of the LX prediction of mergeCandList[i] are derived and set as the LX prediction of averageCand, and the LX prediction of averageCand is made valid (step S1309 in FIG. 38). In step S1308 of FIG. 38, if the LX prediction of mergeCandList[j] is not valid, that is, if the LX prediction of mergeCandList[i] is valid and the LX prediction of mergeCandList[j] is invalid, the average merge candidate of the LX prediction having the motion vector and reference index of the LX prediction of mergeCandList[i] is derived and set as the LX prediction of averageCand, and the LX prediction of averageCand is made valid (step S1310 of FIG. 38). In step S1307 of FIG. 38, if the LX prediction of mergeCandList[i] is not valid, it is determined whether the LX prediction of mergeCandList[j] is valid (step S1311 of FIG. 38). If the LX prediction of mergeCandList[j] is valid, i.e., if the LX prediction of mergeCandList[i] is invalid and the LX prediction of mergeCandList[j] is valid, an average merge candidate for LX prediction having the motion vector and reference index of the LX prediction of mergeCandList[j] is derived and set as the LX prediction of averageCand, and the LX prediction of averageCand is made valid (step S1312 in FIG. 38).In step S1311 of FIG. 38, if the LX prediction of mergeCandList[j] is not valid, that is, if the LX prediction of mergeCandList[i] and the LX prediction of mergeCandList[j] are both invalid, the LX prediction of averageCand is invalidated (step S1312 of FIG. 38).

[0150] The average merge candidate averageCand of the L0 prediction, L1 prediction, or BI prediction generated as described above is added to the numCurrMergeCand-th mergeCandList[numCurrMergeCand] of the merge candidate list, and numCurrMergeCand is incremented by 1 (step S1315 in FIG. 38). This completes the process of deriving the average merge candidate.

[0151] Note that the average merge candidate is averaged over the horizontal component of the motion vector and the vertical component of the motion vector.

[0152] <Motion compensation prediction processing> The motion compensation prediction unit 306 acquires the position and size of a block currently being subjected to prediction processing in encoding. The motion compensation prediction unit 306 also acquires inter prediction information from the inter prediction mode determination unit 305. A reference index and a motion vector are derived from the acquired inter prediction information, and a reference picture specified by the reference index in the decoded image memory is acquired at a position where the reference picture is moved by the amount of the motion vector from the same position as the image signal of the prediction block, and then a prediction signal is generated.

[0153] In the case where the inter prediction mode in the inter prediction is prediction from a single reference picture such as L0 prediction or L1 prediction, the prediction signal obtained from one reference picture is used as a motion compensation prediction signal, and in the case where the inter prediction mode is prediction from two reference pictures such as BI prediction, the weighted average of the prediction signals obtained from the two reference pictures is used as a motion compensation prediction signal, and the motion compensation prediction signal is supplied to the prediction method determination unit. Here, the ratio of the weighted average of bi-prediction is set to 1:1, but the weighted average may be performed using other ratios. For example, the weighting ratio may be set to be larger as the picture interval between the picture to be predicted and the reference picture becomes closer. In addition, the weighting ratio may be calculated using a correspondence table of combinations of picture intervals and weighting ratios.

[0154] The motion compensation prediction unit 406 has the same function as the motion compensation prediction unit 306 on the encoding side. The motion compensation prediction unit 406 obtains inter prediction information from a normal prediction motion vector mode derivation unit 401, a normal merge mode derivation unit 402, a sub-block prediction motion vector mode derivation unit 403, and a sub-block merge mode derivation unit 404 via a switch 408.

[0155] The motion compensation prediction unit 406 supplies the obtained motion compensation prediction signal to the decoded image signal superimposition unit 207 .

[0156] <Inter prediction mode> A process of making a prediction from a single reference picture is defined as uni-prediction, and in the case of uni-prediction, prediction is made using one of two reference pictures registered in reference lists L0 and L1, called L0 prediction or L1 prediction. L0 prediction and L1 prediction may be forward prediction (prediction referring to a forward reference image) or backward prediction (prediction referring to a backward reference image). Figures 33 and 34 are diagrams for explaining motion compensation prediction in L0 prediction (uni-prediction).

[0157] Figure 33 shows a case where the inter prediction mode is L0 prediction and the L0 reference picture (RefL0Pic) is located at a time before the processing target picture (CurPic). Figure 33 shows a case where the L0 prediction mode is L0 prediction and the L0 reference picture is located at a time after the processing target picture. Similarly, it is also possible to perform uni-prediction by replacing the reference picture of L0 prediction in Figures 33 and 34 with the reference picture of L1 prediction (RefL1Pic).

[0158] A process of making predictions from two reference pictures is defined as bi-prediction, and in the case of bi-prediction, both L0 prediction and L1 prediction are used to express bi-prediction. Figs. 35 to 37 are diagrams for explaining motion compensation prediction in bi-prediction. Fig. 35 shows a case in which the reference picture for L0 prediction is at a time before the picture to be processed and the reference picture for L1 prediction is at a time after the picture to be processed in bi-prediction. Fig. 36 shows a case in which the reference picture for L0 prediction and the reference picture for L1 prediction are at a time before the picture to be processed in bi-prediction. Fig. 37 shows a case in which the reference picture for L0 prediction and the reference picture for L1 prediction are at a time after the picture to be processed in bi-prediction.

[0159] In this way, the relationship between the prediction type and time of L0 / L1 can be used without being limited to L0 being forward prediction (prediction that refers to a forward reference image) and L1 being backward prediction (prediction that refers to a backward reference image). In the case of bi-prediction, the same reference picture may be used to perform both L0 prediction and L1 prediction. Note that the decision as to whether to perform motion compensation prediction in uni-prediction or bi-prediction is made based on information (e.g., a flag) indicating whether to use L0 prediction and whether to use L1 prediction.

[0160] <About reference indexes> In an embodiment of the present invention, in order to improve the accuracy of motion compensation prediction, it is possible to select an optimal reference picture from among multiple reference pictures in motion compensation prediction. To this end, the reference picture used in the motion compensation prediction is used as a reference index, and the reference index is coded into the coding stream together with a coding vector.

[0161] <Motion compensation process based on normal predicted motion vector mode> 16 , when inter prediction information by the normal prediction motion vector mode derivation unit 301 is selected in the inter prediction mode determination unit 305, the motion compensation prediction unit 306 acquires this inter prediction information from the inter prediction mode determination unit 305, derives the inter prediction mode, reference index, and motion vector of the block currently being processed, and generates a motion compensation prediction signal. The generated motion compensation prediction signal is supplied to the prediction method determination unit 105.

[0162] 22, when a switch 408 is connected to the normal prediction motion vector mode derivation unit 401 during the decoding process, the motion compensation prediction unit 406 obtains inter prediction information from the normal prediction motion vector mode derivation unit 401, derives the inter prediction mode, reference index, and motion vector of the block currently being processed, and generates a motion compensation prediction signal. The generated motion compensation prediction signal is supplied to the decoded image signal superimposition unit 207.

[0163] <Motion compensation processing based on normal merge mode> 16 , when inter prediction information by the normal merge mode derivation unit 302 is selected in the inter prediction mode determination unit 305, the motion compensation prediction unit 306 acquires this inter prediction information from the inter prediction mode determination unit 305, derives the inter prediction mode, reference index, and motion vector of the block currently being processed, and generates a motion compensation prediction signal. The generated motion compensation prediction signal is supplied to the prediction method determination unit 105.

[0164] 22, when a switch 408 is connected to the normal merge mode derivation unit 402 during the decoding process, the motion compensation prediction unit 406 obtains inter prediction information from the normal merge mode derivation unit 402, derives an inter prediction mode, a reference index, and a motion vector of the block currently being processed, and generates a motion compensation prediction signal. The generated motion compensation prediction signal is supplied to the decoded image signal superimposition unit 207. <Merged Motion Vector Difference (MMVD)> A differential motion vector can be added to the motion vectors of the top two merge candidates (the merge candidates with merge indexes 0 and 1 in the merge candidate list). This differential motion vector is called the merge differential motion vector.

[0165] When the merge candidate selection unit 347 on the encoding side adds a merge differential motion vector, the motion vector to which the merge differential motion vector has been added is supplied to the motion compensation prediction unit 306 via the inter prediction mode determination unit 305. The bitstream encoding unit 108 also encodes information related to the merge differential motion vector. The information related to the merge differential motion vector is an index mmvd_distance_idx indicating the distance to be added to the motion vector, and an index mmvd_direction_idx indicating the direction in which the motion vector is added. These indexes are defined as shown in the tables in Figures 39(a) and 39(b). If the x and y components of the merge differential motion vector offset MmvdOffset are represented as MmvdOffset[0] and MmvdOffset[1], respectively, then MmvdOffset[0] = ( MmvdDistance << 2 ) * MmvdSign[0] MmvdOffset[1] = ( MmvdDistance << 2 ) * MmvdSign[1] The merge motion vector difference is derived from the merge motion vector difference offset MmvdOffset in the above equation. Details of how to derive the merge motion vector difference will be described below in the case of the decoding side.

[0166] On the decoding side, if a merge differential motion vector exists, information on the merge differential motion vector is separated from the bitstream supplied to the bitstream decoding unit 201, and a merge differential motion vector offset MmvdOffset is derived. The merge candidate selection unit 447 also derives a merge differential motion vector from the decoded merge differential motion vector offset. The merge differential motion vector is added to a motion vector, and the motion vector is then supplied to the motion compensation prediction unit 406.

[0167] The derivation of the merge motion vector difference mMvdLX in the merge candidate selection unit 447 will be described with reference to the flowchart in FIG. 40. First, it is determined whether the inter prediction mode of the coding block is bi-prediction (PRED_BI) (S4402). If it is not bi-prediction (S4402: No), it is determined whether it is L0 prediction (PRED_L0) (S4404). If it is L0 prediction (S4404: Yes), mMvdL0 = MmvdOffset mMvdL1 = 0 In the case of L1 prediction (S4404: No), mMvdL0 = 0 mMvdL1 = MmvdOffset This completes the process of deriving a merge differential motion vector (S4408).

[0168] On the other hand, in the case of bi-prediction (S4402: Yes), the difference between the POC of the current picture currPic and the reference picture is calculated for each reference list, and set as currPocDiffL0 and currPocDiffL1 (S4410). Here, the POC difference between picA and picB, DiffPicOrderCnt(picA, picB), is expressed as follows: DiffPicOrderCnt( picA, picB ) = [POC of picA] - [POC of picB] In addition, reference picture RefPicList0[refIdxL0] is the picture indicated by reference index refIdxL0 in reference list L0. Similarly, reference picture RefPicList1[refIdxL1] is the picture indicated by reference index refIdxL1 in reference list L1.

[0169] Next, it is determined whether -currPocDiffL0 * currPocDiffL1 >= 0 (step S4412). If this determination is true (step S4412: Yes), mMvdL0 = MmvdOffset mMvdL1 = -MmvdOffset (step S4414), and the process of deriving the merge motion vector difference is terminated. On the other hand, if this determination is false (step S4412: No), mMvdL0 = MmvdOffset mMvdL1 = MmvdOffset (step S4416). Next, it is determined whether the absolute value of the difference in POC with reference list L0 is equal to or greater than the absolute value of the difference in POC with reference list L1 (step S4418). If this determination is true (step S4418: Yes), X=0, Y=1 are set (step S4420), and the merge differential motion vector mMvdL1 of L1 is scaled (step S4424). Here, mMvdLY indicates mMvdL0 when Y=0, and mMvdL1 when Y=1. On the other hand, if this determination is false (step S4418: No), X=1, Y=0 are set (step S4422), and the merge differential motion vector mMvdL0 of L0 is scaled (step S4424). The scaling of the merge differential motion vector mMvdLY is td = Clip3( -128, 127, currPocDiffLX ) tb = Clip3( -128, 127, currPocDiffLY ) tx = ( 16384 + Abs( td ) >> 1 ) / td distScaleFactor = Clip3( -4096, 4095, ( tb * tx + 32 ) >> 6 ) mMvdLY = Clip3( -131072, 131071, Sign( distScaleFactor * mMvdLY ) * ((Abs( distScaleFactor * mMvdLY ) + 127 ) >> 8 ) ) Here, currPocDiffLX indicates that it is currPocDiffL0 when X=0, and that it is currPocDiffL1 when X=1. Similarly, currPocDiffLY indicates that it is currPocDiffL0 when Y=0, and that it is currPocDiffL1 when Y=1. Also, Clip3(x,y,z) is a function that limits the minimum value of value z to x and the maximum value to y. Sign(x) is a function that returns the sign of value x, and is 1 when value x is positive, 0 when value x is 0, and -1 when value x is negative. Abs(x) is a function that returns the absolute value of value x. Also, >> is a bit operator that indicates that the operand on the left side is bit-shifted to the right by the number of bits of the operand on the right side. With the above, the process of deriving the merge differential motion vector is completed.

[0170] The merge motion vector difference may be added to the top two motion vectors of the sub-block merge candidates. In this case, the index mmvd_distance_idx indicating the distance to be added to the motion vector is defined as shown in the table in FIG. 39(c). The operation of the sub-block merge candidate selection unit 386 is the same as that of the merge candidate selection unit 347, and therefore a description thereof will be omitted. Also, the operation of the sub-block merge candidate selection unit 486 is the same as that of the merge candidate selection unit 447, and therefore a description thereof will be omitted.

[0171] As described above, MmvdDistance is defined as shown in the tables in Figures 39(a) and 39(c). Since these tables are defined with quarter-pixel precision, the generated merged motion vector difference may include fractional pixel precision. However, by encoding / decoding a flag indicating that the pixel precision of these tables is 1 on a slice-by-slice basis, the generated merged motion vector difference can be changed so that it does not include fractional pixel precision.

[0172] <Adaptive Motion Vector Resolution (AMVR)> The resolution of the differential motion vector can be adaptively changed for each coding block, and this resolution is called adaptive motion vector resolution.

[0173] A case where adaptive motion vector resolution is used for the normal predicted motion vector mode will be described. In this case, the derived candidate motion vectors are rounded according to the resolution in the spatial predicted motion vector candidate derivation units 321 and 421, the temporal predicted motion vector candidate derivation units 322 and 422, and the historical predicted motion vector candidate derivation units 323 and 423. The resolution can be selected from 1 / 4, 1, or 4 pixel accuracy, and if the resolution is not changed, the resolution is 1 / 4 pixel accuracy. The rounding process is performed according to the resolution of the motion vector in the coding block to be processed. In other words, the derived candidate motion vector mvX is rightShift = leftShift = MvShift + 2 offset = ( 1 << ( rightShift - 1 ) ) mvX = ( ( mvX + offset - ( mvX >= 0 ) ) >> rightShift ) << leftShift However, if rightShift=0, offset=0. Here, if the resolution of the motion vector in the coding block to be processed is 1 / 4 pixel precision, MvShift=0. Similarly, if the resolution of the motion vector is 1 pixel precision, MvShift=2, and if the resolution of the motion vector is 4 pixel precision, MvShift=4. Each of the x and y components of mvX is processed by the above formula.

[0174] The adaptive motion vector resolution can also be used for the sub-block prediction motion vector mode. In this case, the resolution is different from the above-mentioned normal prediction motion vector mode. That is, in the affine inheritance prediction motion vector candidate derivation units 361 and 461, the affine construction prediction motion vector candidate derivation units 362 and 462, and the affine identical prediction motion vector candidate derivation units 363 and 463, the derived candidate motion vector is rounded according to the resolution. The resolution can be selected from 1 / 16, 1 / 4, and 1 pixel accuracy, and when the resolution is not changed, it is 1 / 4 pixel accuracy. The rounding process is performed according to the resolution of the motion vector in the coding block to be processed. That is, the derived candidate motion vector mvX is rounded according to the above formula. Here, when the resolution of the motion vector in the coding block to be processed is 1 / 4 pixel accuracy, MvShift=0. Similarly, when the resolution of the motion vector is 1 / 16 pixel accuracy, MvShift=-2, and when the resolution of the motion vector is 1 pixel accuracy, MvShift=2. The above formula processes each of the x and y components of mvX.

[0175] <Intra Block Copy (IBC)> The valid reference area of ​​intra block copy will be described with reference to Fig. 32. Fig. 32(a) shows an example of determining a valid reference area by using a coding tree block unit as an intra block copy reference block. In Fig. 32(a), 500, 501, 502, 503, and 504 are coding tree blocks, and 504 is a coding tree block to be processed. 505 is a coding block to be processed. The coding tree blocks are processed in the order of 500, 501, 502, 503, and 504. In this case, the three coding tree blocks 501, 502, and 503 processed immediately before the coding tree block 504 including the coding block 505 to be processed are set as valid reference areas of the coding block 505 to be processed. Regardless of whether the coding tree blocks processed before the coding tree block 501 and the processing of the coding tree block 505 to be processed are completed or not, all areas included in the coding tree block 504 including the coding block 505 to be processed are set as invalid reference areas.

[0176] Fig. 32(b) shows an example of a case where a valid reference area is determined by dividing a coding tree block into four units as intra block copy reference blocks. In Fig. 32(b), 515 and 516 are coding tree blocks, and 516 is a coding tree block to be processed. The coding tree block 515 is divided into four parts, 506, 507, 508, and 509, and 516 is divided into four parts, 510, 511, 512, and 513. 514 is a coding block to be processed. The intra block copy reference blocks are processed in the order of 506, 507, 508, 509, 510, 511, 512, and 513. In this case, the three intra block copy reference blocks 508, 509, and 510 processed immediately before the intra block copy reference block 511 including the coding block 514 to be processed are set as the valid reference area of ​​the coding block 514 to be processed. Regardless of whether the coding tree blocks processed before the intra block copy reference block 508 and the processing target coding block 514 have been completed before the processing target coding block 514, all areas included in the intra block copy reference block 511 including the processing target coding block 514 are treated as invalid reference areas.

[0177] <Memory space of reference area> A memory space for storing a processed image of a reference region will be described. FIG. 57 is a diagram for explaining a memory space of a reference region when a coding tree block unit is set as an intra block copy reference block. 500, 501, 502, 503, 504, and 505 in FIG. 57(a) are coding tree blocks. The coding tree block 503 is a coding tree block to be processed. The coding tree block 500, the coding tree block 501, the coding tree block 502, and the coding tree block that have been processed correspond to a reference region of the coding tree block 503 to be processed. The coding tree blocks 504 and 505 are unprocessed coding tree blocks. 600, 601, 602, and 603 in FIG. 57(a) are memory spaces, and the memory space 600 stores a processed image of the coding tree block 500. Similarly, the memory space 601 stores a processed image of the coding tree block 501, and the memory space 602 stores a processed image of the coding tree block 502. The memory space 603 sequentially stores processed images in accordance with the processing of the coding tree block 503 to be processed. When the processing of the coding tree block 503 is completed, the processing of the coding tree block 504 starts next.

[0178] The process when the process of the coding tree block 503 is completed will be described with reference to FIG. 57(b). At this time, the coding tree block 504 becomes the coding tree block to be processed. Furthermore, the coding tree block 503 becomes the reference area, and the coding tree block 500 is no longer the reference area. At this time, the processed image of the coding tree block 503 is stored in the memory space 603 in which the processed images of the coding tree block 503 have been sequentially stored. The processed image of the coding tree block 500 stored in the memory space 600 is not the reference area of ​​the coding tree block 504, but becomes unnecessary information. Therefore, the processed images of the coding tree block 504 to be processed are sequentially stored in the memory space 600. When the process of the coding tree block 504 is completed, the process of the coding tree block 505 is started next.

[0179] FIG. 58 is a diagram for explaining the memory space of the reference area when determining a valid reference area by using a unit obtained by dividing a coding tree block into four as an intra block copy reference block. 510 and 511 in FIG. 58(a) are coding tree blocks. The coding tree block 510 is a processed coding tree block, and the coding tree block 511 is a coding tree block to be processed. The coding tree block 510 is composed of blocks 500, 501, 502, and 503, and the coding tree block 511 is composed of blocks 504, 505, 506, and 507. The block 504 is a block to be processed. 501, 502, and 503 are processed blocks, and correspond to the reference area of ​​the block 504 to be processed. The blocks 505, 506, and 507 are unprocessed blocks. 600, 601, 602, and 603 in FIG. 58(a) are memory spaces, and the memory space 601 stores a processed image of the block 501. Similarly, memory space 602 stores the processed image of block 502, and memory space 603 stores the processed image of block 503. Memory space 600 sequentially stores the processed images according to the processing of the target block 504. When the processing of block 504 is completed, the processing of block 505 starts next.

[0180] The process when the process of block 504 is completed will be described with reference to FIG. 58(b). At this time, block 505 becomes the coding tree block to be processed. Furthermore, block 504 becomes the reference region, and block 501 is no longer the reference region. At this time, the processed image of block 504 is stored in memory space 600, which has been sequentially storing the processed image of block 504. The processed image of block 501 stored in memory space 601 is no longer the reference region of block 505, and becomes unnecessary information. Therefore, the processed image of block 505 to be processed is sequentially stored in memory space 601. When the process of block 505 is completed, the process of coding tree block 506 is started next.

[0181] 58(c) will be used to explain the processing when the processing of the block 504 is completed. At this time, the block 506 becomes the block to be processed. Furthermore, the block 505 becomes the reference region, and the coding tree block 502 is no longer the reference region. As in the above example, the processed images of the coding tree block 506 to be processed are sequentially stored in the memory space 602.

[0182] 58(d) will be used to explain the processing when the processing of the block 505 is completed. At this time, the block 507 becomes the block to be processed. Furthermore, the block 506 becomes the reference region, and the coding tree block 503 is no longer the reference region. As in the above example, the processed images of the coding tree block 507 to be processed are sequentially stored in the memory space 603.

[0183] <Predictive Intra Block Copy: Encoding Side Explanation> The predictive intra block copy processing procedure on the encoding side will be described with reference to FIG.

[0184] First, the block vector detection unit 375 detects the block vector mvL (step S4500 in FIG. 45).

[0185] Next, the IBC spatial block vector candidate derivation unit 371, the IBC history prediction block vector candidate derivation unit 372, the IBC prediction block vector candidate supplementation unit 373, the IBC prediction block vector candidate selection unit 376, and the block vector subtraction unit 378 calculate the difference block vector of the block vector used in the prediction block vector mode (steps S4501 to S4503 in FIG. 45).

[0186] A prediction block vector candidate is calculated to construct a block vector candidate list mvpList (step S4501 in FIG. 45). A plurality of prediction block vector candidates are derived by an IBC spatial block vector candidate derivation unit 371, an IBC history block vector candidate derivation unit 372, and an IBC prediction block vector candidate supplementation unit 373 in the intra block copy prediction unit 352 to construct the prediction block vector candidate list mvpList. A detailed processing procedure of step S4501 in FIG. 45 will be described later using the flowchart in FIG. 48.

[0187] Next, the IBC prediction block vector candidate selection unit 376 selects a prediction block vector mvpL from the prediction block vector candidate list mvpListL (step S4502 in FIG. 45). Each difference block vector, which is the difference between the block vector mvL and each prediction block vector candidate mvpListL[i] stored in the prediction block vector candidate list mvpListL, is calculated. The amount of code when these difference block vectors are encoded is calculated for each element of the prediction block vector candidate list mvpListL. Then, among the elements registered in the prediction block vector candidate list mvpListL, the prediction block vector candidate mvpListL[i] with the smallest amount of code for each prediction block vector candidate is selected as the prediction block vector mvpL, and its index i is obtained. If there are multiple candidates for the prediction block vector that will result in the smallest amount of generated code in the prediction block vector candidate list mvpListL, the prediction block vector candidate mvpListL[i] represented by the smallest index i in the prediction block vector candidate list mvpListL is selected as the optimal prediction block vector mvpL, and its index i is obtained.

[0188] Next, the block vector subtraction unit 378 subtracts the selected prediction block vector mvpL from the block vector mvL. mvdL = mvL - mvpL The differential block vector mvdL is calculated as follows (step S4503 in FIG. 45).

[0189] <Intra block copy (prediction): Decoding side explanation> Next, a prediction block vector mode processing procedure on the decoding side will be described with reference to Fig. 46. On the decoding side, the IBC spatial prediction block vector candidate derivation unit 471, the IBC history block vector candidate derivation unit 472, and the IBC prediction block vector supplementation unit 473 calculate block vectors used in the prediction block vector mode (steps S4600 to S4602 in Fig. 46). Specifically, a prediction block vector candidate list mvpListL is calculated, a prediction block vector mvpL is selected, and a block vector mvL is calculated.

[0190] A prediction block vector candidate is calculated to construct a prediction block vector candidate list mvpListL (step S4601 in FIG. 46). A plurality of prediction block vector candidates are calculated by an IBC spatial block vector candidate derivation unit 471, an IBC history block vector candidate derivation unit 472, and an IBC block vector supplementation unit 473 in the intra block copy prediction unit 362, and the prediction block vector candidate list mvpListL is constructed. A detailed description of the processing procedure of step S4601 in FIG. 46 will be omitted.

[0191] Next, the IBC prediction block vector candidate selection unit 476 extracts the prediction block vector candidate mvpListL[mvpIdxL] corresponding to the prediction block vector index mvpIdxL decoded and supplied by the bit string decoding unit 201 from the prediction block vector candidate list mvpListL as the selected prediction block vector mvpL (step S4601 in Figure 46).

[0192] Next, the block vector adder 478 adds the difference block vector mvdL and the prediction block vector mvpL decoded and supplied by the bit string decoder 201, mvL = mvpL + mvdL (Step S4602 in FIG. 46).

[0193] <Prediction block vector mode: Block vector prediction method> FIG. 48 is a flowchart showing the processing steps of a prediction intra block copy mode derivation process having a function common to the intra block copy prediction unit 352 of the video encoding device and the intra block copy prediction unit 362 of the video decoding device according to an embodiment of the present invention.

[0194] The intra block copy prediction unit 352 and the intra block copy prediction unit 362 are provided with a prediction block vector candidate list mvpListL. The prediction block vector candidate list mvpListL has a list structure, and is provided with a storage area for storing a prediction block vector index indicating a location in the prediction block vector candidate list and a prediction block vector candidate corresponding to the index as an element. The numbers of the prediction block vector index start from 0, and the prediction block vector candidates are stored in the storage area of ​​the prediction block vector candidate list mvpListL. In this embodiment, it is assumed that the prediction block vector candidate list mvpListL can register three prediction block vector candidates. Furthermore, 0 is set to a variable numCurrMvpIbcCand indicating the number of prediction block vector candidates registered in the prediction block vector candidate list mvpListL. The IBC space block vector candidate derivation units 371 and 471 derive a candidate of a prediction block vector from a block adjacent to the left (step S4801 in FIG. 48). In this process, a flag availableFlagLA indicating whether or not a prediction block vector candidate of a block adjacent to the left (A0 or A1) is available, and a block vector mvLA are derived, and mvLA is added to a prediction block vector candidate list mvpListL. Next, the IBC space block vector candidate derivation units 371 and 471 derive a candidate of a prediction block vector from a block adjacent to the upper side (B0, B1, or B2) (step S4802 in FIG. 48). In this process, a flag availableFlagLB indicating whether or not a prediction motion vector candidate of a block adjacent to the upper side is available, and a block vector mvLB are derived, and if mvLA and mvLB are not equal, mvLB is added to a prediction block vector candidate list mvpListL. The processing in steps S4801 and S4802 in Figure 48 is common except for the positions and number of adjacent blocks to be referenced, and derives a flag availableFlagLN indicating whether a candidate prediction block vector for the coding block is available or not, and a motion vector mvLN (N is A or B, same below).

[0195] Next, the IBC history block vector candidate derivation units 372 and 472 add the history block vector candidates registered in the history block vector candidate list HmvpIbcCandList to the prediction block vector candidate list mvpListL (step S4803 in FIG. 48). Details of the registration procedure in step S4803 may be the same as the operation in the description of the operation shown in the flowchart in FIG. 29 when the motion vector is the block vector, the list of reference indexes is L0, and the history prediction motion vector candidate list HmvpCandList is the history block vector candidate list HmvpIbcCandList, so a description thereof will be omitted.

[0196] Next, the IBC prediction block vector supplementing units 373 and 473 add block vectors of a predetermined value, such as (0, 0), until the prediction block vector candidate list mvpListL is filled (S4804 in FIG. 48).

[0197] <Merge intra block copy mode derivation part> The intra block copy prediction unit 352 in Figure 43 includes an IBC spatial block vector candidate derivation unit 371, an IBC history block vector candidate derivation unit 372, an IBC block vector supplementation unit 373, a reference position correction unit 380, a reference region boundary correction unit 381, an IBC merge candidate selection unit 374, and an IBC prediction mode determination unit 377.

[0198] The intra block copy prediction unit 362 in FIG. 44 includes an IBC spatial block vector candidate derivation unit 471, an IBC history block vector candidate derivation unit 472, an IBC block vector supplementation unit 473, an IBC merge candidate selection unit 474, a reference position correction unit 480, a reference area boundary correction unit 481, and a block copy unit 477.

[0199] FIG. 47 is a flowchart illustrating the steps of a merge intra block copy mode derivation process having a function common to the intra block copy prediction unit 352 of the video encoding device and the intra block copy prediction unit 362 of the video decoding device according to an embodiment of the present invention.

[0200] The intra block copy prediction unit 352 and the intra block copy prediction unit 362 are provided with a merge intra block copy candidate list mergeIbcCandList. The merge intra block copy candidate list mergeIbcCandList has a list structure and is provided with a storage area for storing a merge index indicating the location inside the merge intra block copy candidate and a merge intra block copy candidate corresponding to the index as an element. The merge index number starts from 0, and the merge intra block copy candidate is stored in the storage area of ​​the merge intra block copy candidate list mergeIbcCandList. In the following processing, the merge candidate of the merge index i registered in the merge intra block copy candidate list mergeIbcCandList is represented by mergeIbcCandList[i]. In this embodiment, it is assumed that the merge candidate list mergeCandList can register at least three merge intra block copy candidates. Furthermore, 0 is set to a variable numCurrMergeIbcCand indicating the number of merge intra block copy candidates registered in the merge intra block copy candidate list mergeIbcCandList.

[0201] The IBC spatial block vector candidate derivation unit 371 and the IBC spatial block vector candidate derivation unit 471 derive spatial merge candidates A and B from adjacent blocks on the left and upper sides of the target block from the coding information stored in the coding information storage memory 111 of the video coding device or the coding information storage memory 205 of the video decoding device, and register the derived spatial merge candidates in a merge intra block copy candidate list mergeIbcCandList (step S4701 in FIG. 47). Here, N indicating either spatial merge candidate A or B is defined. A flag availableFlagN indicating whether or not intra block copy prediction information of block N can be used as the spatial block vector merge candidate N, and a block vector mvL are derived. However, in this embodiment, the block vector merge candidate is derived without referring to other coding blocks included in the block including the coding block to be processed, so that the spatial block vector merge candidate included in the block including the coding block to be processed is not derived.

[0202] Next, the IBC history block vector candidate derivation unit 372 and the IBC history block vector candidate derivation unit 472 add the history prediction block vector candidate registered in the history prediction block vector candidate list HmvpIbcCandList to the merge intra block copy candidate list mergeIbcCandList (step S4702 in FIG. 47). In this embodiment, if a block vector already added to mergeIbcCandList and a block vector of a history prediction block vector candidate have the same value, no addition to mergeIbcCandList is performed.

[0203] Next, when the number of merge candidates numCurrMergeIbcCand registered in the merge intra block copy candidate list mergeIbcCandList is smaller than the maximum number of intra block merge candidates MaxNumMergeIbcCand, the IBC prediction block vector supplementing unit 373 and the IBC prediction block vector supplementing unit 473 derive additional intra block merge candidates with the number of merge candidates numCurrMergeIbcCand registered in the merge intra block copy candidate list mergeIbcCandList set to the maximum number of merge candidates MaxNumMergeIbcCand as an upper limit, and register the additional intra block merge candidates in the merge intra block copy candidate list mergeIbcCandList (step S4703 in FIG. 47). A block vector having a value of (0,0) is added to the merge intra block copy candidate list mergeIbcCandList with the maximum number of merge candidates set to the upper limit.

[0204] Next, the IBC merge candidate selection unit 374 and the IBC merge candidate selection unit 474 select one of the intra block merge candidates registered in the merge intra block copy candidate list mergeIbcCandList (step S4704 in FIG. 47). The IBC merge candidate selection unit 374 acquires the decoded image at the reference position from the decoded image memory 104, calculates the code amount and the distortion amount, and selects a merge candidate, and supplies a merge index indicating the selected intra block merge candidate to the IBC prediction mode determination unit 377. The IBC prediction mode determination unit 377 selects whether or not the mode is a merge mode by calculating the code amount and the distortion amount, and supplies the result to the prediction method determination unit 105. On the other hand, the IBC merge candidate selection unit 474 on the decoding side selects an intra block merge candidate based on the decoded merge index, and supplies the selected intra block merge candidate to the reference position correction unit 480.

[0205] Next, the reference position correction unit 380 and the reference position correction unit 480 perform a process of correcting the reference position for the intra block merging candidate (step S4705 in FIG. 47). The process of the reference position correction unit 380 and the reference position correction unit 480 will be described later in detail.

[0206] Next, the reference area boundary correction unit 381 and the reference area boundary correction unit 481 perform processing to correct the reference area boundary for the intra block merging candidate (step S4706 in FIG. 47). The processing by the reference position correction unit 381 and the reference position correction unit 481 will be described later in detail.

[0207] The block copy unit 477 obtains the decoded image at the reference position from the decoded image memory 208, and supplies it to the decoded image signal superimposition unit 207. Here, the block copy unit 477 copies the luminance component and the chrominance component.

[0208] The above block vector mvL indicates the block vector of luminance. The block vector mvC of chrominance is as follows when the chrominance format is 420: mvC = ( ( mvL >> ( 3 + 2 ) ) * 32 Using the above formula, the x and y components of mvC are processed respectively.

[0209] <Reference position correction section> 49 is a diagram for explaining the processing of the reference position correction unit 380 and the reference position correction unit 480. Now, it is assumed that the unit of the intra block copy reference block is a coding tree block (CTU), and the size thereof is not 128x128 pixels.

[0210] First, the positions of the top left and bottom right of the reference block are calculated (S6001). The reference block refers to a block that the coding block to be processed refers to using a block vector. If the top left of the reference block is (xRefTL, yRefTL) and the bottom right is (xRefBR, yRefBR), then ( xRefTL, yRefTL ) = ( xCb + ( mvL

[0000] >> 4 ), yCb + ( mvL

[0001] >> 4 ) ) ( xRefBR, yRefBR ) = ( xRefTL + cbWidth - 1, yRefTL + cbHeight - 1 ) Here, the position of the coding block to be processed is (xCb, yCb), the block vector is (mvL[0], mvL[1]), the width of the coding block to be processed is cbWidth, and the height is cbHeight.

[0211] Next, it is determined whether the size of the CTU is 128x128 pixels (S6002). Since the size is not 128x128 pixels (S6002: NO), the positions of the top left and bottom right of the referenceable area are calculated (S6003). If the top left of the referenceable area is (xAvlTL, yAvlTL) and the bottom right is (xAvlBR, yAvlBR), then NL = Min( 1, 7 - CtbLog2SizeY ) - ( 1 << ((7 - CtbLog2SizeY) << 1) ) ( xAvlTL, yAvlTL ) = ( ((xCb >> CtbLog2SizeY) + NL) << CtbLog2SizeY, (yCb >> CtbLog2SizeY) << CtbLog2SizeY ) ( xAvlBR, yAvlBR ) = ( ((xCb >> CtbLog2SizeY) << CtbLog2SizeY) - 1, (((yCb >> CtbLog2SizeY) + 1) << CtbLog2SizeY) - 1 ) Here, the size of the CTU is CtbLog2SizeY.

[0212] Next, it is determined whether the reference position in the x direction of the reference block is smaller than the top left corner of the referenceable area (S6004). If the determination is false (S6004: NO), the process proceeds to the next step (S6006). On the other hand, if the determination is true (S6004: YES), the reference position in the x direction is corrected to match the top left corner of the referenceable area (S6005).

[0213] FIG. 50 is a diagram showing how the reference position is corrected. Reference numeral 6001 denotes a coding tree block to be processed, 6002 denotes a coding block to be processed, and 6003 denotes a referenceable area. If reference block r2 is now located at 6011, the reference position in the x direction is smaller than the upper left corner of the referenceable area (S6004: YES). Therefore, the reference position is corrected to position 6012 with xRefTL=xAvlTL (S6005). Here, as in S6001, xRefBR=xRefTL+cbWidth-1, and therefore xRefBR is also corrected in conjunction with the correction of xRefTL. In this correction of the reference position, the block vector mvL[0] may be corrected. That is, mvL[0] = (xAvlTL - xCb) << 4 This makes xRefTL=xAvlTL, so the reference position can be corrected.

[0214] In this way, if a reference block is located outside the referenceable area, it becomes referenceable by correcting the reference position.

[0215] Now, assume that some block vectors in the block vector candidate list constructed in the intra block copy prediction unit 352 are outside the referenceable area. If the reference position is not corrected, the block vectors cannot be referenced, and therefore the block vectors cannot be candidates for the IBC merge mode. On the other hand, if the reference position is corrected in the present invention, all block vectors in the constructed block vector candidate list are inside the referenceable area. Therefore, all block vectors can be referenced, and all block vectors can be candidates for the IBC merge mode. Therefore, the IBC merge mode selection unit 374 can select an optimal prediction mode from the IBC merge mode candidates corresponding to all block vectors, thereby improving coding efficiency.

[0216] Now, assume that some block vectors in the block vector candidate list constructed in the intra block copy prediction unit 362 are outside the referenceable area. If the reference position is not corrected, reference by those block vectors is impossible, and the IBC merge mode using those block vectors cannot be decoded. In a coding device other than the present invention, the merge index indicating the IBC merge mode using those block vectors operates as not being coded. However, due to a malfunction or the like, such a merge index may be coded to generate a bit stream. Or, due to a packet loss or the like, a part of the bit stream may be missing, and the decoding result may become such a merge index. When attempting to decode such an incomplete bit stream, there is a possibility that an attempt is made to reference outside the referenceable area and a decoded image memory at an incorrect position is accessed. As a result, the decoding result may differ depending on the decoding device, or the decoding process may stop. On the other hand, when the reference position is corrected in the present invention, all block vectors in the constructed block vector candidate list are inside the referenceable area. Therefore, even if such an incomplete bit stream is decoded, the reference position is corrected to inside the referenceable area and reference is possible. In this way, the memory access range is guaranteed by correcting the reference position. As a result, the decoding results are the same depending on the decoding device, and the decoding process can be continued, thereby improving the robustness of the decoding device.

[0217] In addition, when a block vector is corrected in the correction of the reference position, the target is the luminance block vector. Here, the chrominance block vector is calculated from the luminance block vector. In other words, if the luminance block vector is corrected, the chrominance block vector is also corrected. Therefore, there is no need to correct the reference position again for chrominance. This can reduce the amount of processing compared to when it is necessary to determine whether or not reference is possible for both luminance and chrominance when the block vector is not corrected.

[0218] In addition, when the block vector is corrected in the correction of the reference position, the corrected block vector is stored in the coding information storage memory 111 or the coding information storage memory 205 as the block vector of the coding block to be processed. In other words, the corrected reference position and the position indicated by the block vector are the same. Here, a deblocking filter process may be performed when storing the decoding result in the decoded image memory. In this filter process, the filter strength is controlled by the difference between the block vectors of two blocks facing the block boundary. In comparison with the case where the block vector is not corrected, in which the corrected reference position and the position indicated by the block vector are different, the filter strength becomes more appropriate, and the coding efficiency can be improved.

[0219] Next, it is determined whether the reference position in the y direction of the reference block is smaller than the top left corner of the referenceable area (S6006). If the determination is false (S6006: NO), the process proceeds to the next step (S6008). On the other hand, if the determination is true (S6006: YES), the reference position in the y direction is corrected to match the top left corner of the referenceable area (S6007).

[0220] Now, if reference block r4 is located at 6021, the reference position in the y direction is smaller than the top left corner of the referenceable area (S6006: YES). Therefore, the reference position is corrected to a position of 6022 by setting yRefTL=yAvlTL (S6007). Here, as in S6001, yRefBR=yRefTL+cbHeight-1, and therefore yRefBR is also corrected in conjunction with the correction of yRefTL. In correcting this reference position, the block vector mvL[1] may also be corrected. In other words, mvL[1] = (yAvlTL - yCb) << 4 This makes it so that yRefTL=yAvlTL, and the reference position can be corrected.

[0221] Next, it is determined whether the reference position in the x direction of the reference block is greater than the bottom right corner of the referenceable area (S6008). If the determination is false (S6008: NO), the process proceeds to the next step (S6010). On the other hand, if the determination is true (S6008: YES), the reference position in the x direction is corrected to match the bottom right corner of the referenceable area (S6009).

[0222] Now, if reference block r7 is located at 6031, the reference position in the x direction is larger than the bottom right of the referenceable area (S6008: YES). Therefore, xRefBR=xAvlBR is set and the reference position is corrected to a position of 6032 (S6009). Here, as in S6001, xRefBR=xRefTL+cbWidth-1, that is, xRefTL=xRefBR-(cbWidth-1), so xRefTL is also corrected in conjunction with the correction of xRefBR. In correcting this reference position, the block vector mvL[0] may also be corrected. In other words, mvL[0] = (xAvlBR - (xCb + cbWidth - 1)) << 4 This makes xRefBR=xAvlBR, so the reference position can be corrected.

[0223] Next, it is determined whether the reference position in the y direction of the reference block is greater than the bottom right corner of the referenceable area (S6010). If the determination is false (S6010: NO), the process ends. On the other hand, if the determination is true (S6010: YES), the reference position in the y direction is corrected to match the bottom right corner of the referenceable area (S6011).

[0224] Now, if reference block r5 is located at 6041, the reference position in the y direction is greater than the bottom right of the referenceable area (S6010: YES). Therefore, the reference position is corrected to a position of 6042 by setting yRefBR=yAvlBR (S6011). Here, as in S6001, yRefBR=yRefTL+cbHeight-1, that is, yRefTL=yRefBR-(cbHeight-1), and therefore yRefTL is also corrected in conjunction with the correction of yRefBR. In correcting this reference position, the block vector mvL[1] may also be corrected. In other words, mvL[1] = (yAvlBR - (yCb + cbHeitght - 1)) << 4 This makes it so that yRefBR=yAvlBR, and the reference position can be corrected.

[0225] Here, a case where reference block r1 is located at 6051 will be described. In this case, the reference position in the x direction is corrected in the same way as when the reference block is r2. Furthermore, the reference position in the y direction is corrected in the same way as when the reference block is r4. As a result, reference block r1 is located at 6052, which is inside the referenceable area.

[0226] When reference block r3 is located at 6061, when reference block r6 is located at 6062, and when reference block r8 is located at 6063, the reference positions in the x and y directions are corrected in the same manner as above. As a result, each reference block is located inside the referenceable area.

[0227] This ends the processing when the size of the CTU is not 128 x 128 pixels. On the other hand, when the size of the CTU is 128 x 128 pixels (S6002: YES), the upper left and lower right positions are calculated when the referenceable area is rectangular (S6012).

[0228] Figure 51 is a diagram explaining the positions of the top left and bottom right when the referenceable area is rectangular. In the case of Figure 51(a), the coding tree block 6101 to be processed is divided into four, and the coding block 6102 to be processed is located at the top left of this division. In this case, the referenceable area has an inverted L shape as shown by the diagonal line in 6103. When the referenceable area is rectangular, its range is the rectangular range of 6103. When the referenceable area is rectangular, if the top left of the reference block is (xRefTL, yRefTL) and the bottom right is (xRefBR, yRefBR), then offset[4] = {0, 64, 128, 128} NL = -offset[3 - blk_idx], NR = offset[blk_idx] ( xAvlTL, yAvlTL ) = ( (xCb >> CtbLog2SizeY) << CtbLog2SizeY + NL, (yCb >> CtbLog2SizeY) << CtbLog2SizeY ) ( xAvlBR, yAvlBR ) = ( ((xCb >> CtbLog2SizeY) << CtbLog2SizeY) - 1 + NR, (((yCb >> CtbLog2SizeY) + 1) << CtbLog2SizeY) - 1 ) Here, blk_idx is an index indicating the position of the coding block to be processed. When the coding tree block to be processed is divided into four and the coding block to be processed is located in the upper left, blk_idx=0 is set. Similarly, when the coding block to be processed is located in the upper right, lower left, or lower right, blk_idx is set to 1, 2, or 3. FIG. 51(a) is a diagram showing the case where blk_idx=0. Similarly, FIG. 51(b) to FIG. 51(d) are diagrams showing the cases where blk_idx=1 to 3, respectively.

[0229] Next, the reference position of the non-rectangular referenceable area is corrected (S6013). FIG. 52 is a diagram explaining the process of correcting the reference position of the non-rectangular referenceable area. First, the top left position of the referenceable area is calculated (S6021). Since the referenceable area is the shaded area in FIG. 51, there are two top left positions, 6111 and 6112, except when blk_idx=3. If these are (X1, Y1) and (X2, Y2), then offset[4] = {64, 128, 64, 0}, NL = offset[blk_idx] (X1, Y1) = (xAvlTL, yAvlTL + 64) (X2, Y2) = (xAvlTL + NL, yAvlTL) It becomes.

[0230] Next, it is determined whether or not to correct the reference position to match the top left corner of the referenceable area (S6022). In this determination, if blk_idx=3 is not true and the reference block is located in an area smaller than X2 and Y1, it is determined to be true (S6022: YES). If it is false (S6022: NO), it proceeds to the next process (S6026).

[0231] Next, it is determined whether the difference between the reference block and the referenceable area in the x direction is smaller than the difference between the reference block and the referenceable area in the y direction (S6023). If the determination is true (S6023: YES), the reference position in the x direction is corrected (S6024). On the other hand, if the determination is false (S6023: NO), the reference position in the y direction is corrected (S6025).

[0232] FIG. 53(a) is a diagram showing how the reference position is corrected in S6024 and S6025. Now, blk_idx=0. If the reference block r1 is located at 6201, then blk_idx=3 is not true, and the upper left corner of the reference block is located in an area smaller than X2 (x direction of 6112) and Y1 (y direction of 6111) (S6022: YES). Also, the difference between the reference block and the referenceable area in the x direction is smaller than the difference between the reference block and the referenceable area in the y direction (S6023: YES). Therefore, the reference position in the x direction is corrected to the position of 6202 by setting xRefTL=xAvlTL+NL (S6024). Here, since xRefBR=xRefTL+cbWidth-1 as in S6001, xRefBR is also corrected in conjunction with the correction of xRefTL. In correcting the reference position, the block vector mvL[0] may be corrected. mvL[0] = (xAvlTL + NL - xCb) << 4 This makes it so that xRefTL=xAvlTL+NL, and the reference position can be corrected.

[0233] On the other hand, if the reference block r2 is located at 6203, then blk_idx is not 3, and the top left corner of the reference block is located in an area smaller than X2 (x direction of 6112) and Y1 (y direction of 6111) (S6022: YES). Also, the difference between the reference block and the referenceable area in the x direction is not smaller than the difference between the reference block and the referenceable area in the y direction (S6023: NO). Therefore, the reference position in the y direction is corrected to the position of 6204 by setting yRefTL = yAvlTL + 64 (S6025). Here, since yRefBR = yRefTL + cbHeight - 1 as in S6001, yRefBR is also corrected in conjunction with the correction of yRefTL. In this correction of the reference position, the block vector mvL[0] may be corrected. That is, mvL[1] = (yAvlTL + 64 - yCb) << 4 This makes it so that yRefTL=yAvlTL+64, and the reference position can be corrected.

[0234] Now, assume that reference block r3 is located at 6205. In this case, the difference between the reference block and the referenceable area in the x direction is smaller than the difference between the reference block and the referenceable area in the y direction (S6023: YES). Therefore, by correcting the reference position in the x direction, as with reference block r1, it is positioned at 6206 (S6024). At this point, the reference block is outside the referenceable area. However, the reference position in the y direction is corrected by the processes of S6006 and S6007 described below. In the end, the reference block is inside the referenceable area.

[0235] Next, the bottom right position of the accessible area is calculated (S6026). Since the accessible area is the shaded area in Figure 51, there are two bottom right positions, 6113 and 6114, except when blk_idx=0. If these are (X3, Y3) and (X4, Y4), then offset[4] = {0, 64, 128, 64}, NR = offset[blk_idx] (X3, Y3) = (xAvlBR, yAvlBR - 64) (X4, Y4) = (xAvlBR - NR, yAvlBR) It becomes.

[0236] Next, it is determined whether or not to correct the reference position to match the bottom right of the referenceable area (S6027). In this determination, if blk_idx=0 is not satisfied and the reference block is located in an area larger than X4 and Y3, it is determined to be true (S6027: YES). If it is false (S6027: NO), the process ends.

[0237] Next, it is determined whether the difference between the reference block and the referenceable area in the x direction is smaller than the difference between the reference block and the referenceable area in the y direction (S6028). If the determination is true (S6028: YES), the reference position in the x direction is corrected (S6029). On the other hand, if the determination is false (S6028: NO), the reference position in the y direction is corrected (S6030).

[0238] FIG. 53(b) is a diagram showing how the reference position is corrected in S6029 and S6030. Now, blk_idx=3. If the reference block r1 is located at 6211, blk_idx is not 0, and the bottom right of the reference block is located in an area larger than X4 (x direction of 6114) and Y3 (y direction of 6113) (S6027: YES). Also, the difference between the reference block and the referenceable area in the x direction is smaller than the difference between the reference block and the referenceable area in the y direction (S6028: YES). Therefore, the reference position in the x direction is corrected to the position of 6212 with xRefBR=xAvlBR (S6029). Here, as in S6001, xRefBR=xRefTL+cbWidth-1, that is, xRefTL=xRefBR-(cbWidth-1), so xRefTL is also corrected with the correction of xRefBR. In correcting the reference position, the block vector mvL[0] may be corrected. mvL[0] = (xAvlBR - NR - (xCb + cbWitdh - 1)) << 4 This makes xRefBR=xAvlBR, so the reference position can be corrected.

[0239] On the other hand, if the reference block r2 is located at 6213, then blk_idx is not 0, and the bottom right corner of the reference block is located in an area larger than X4 (x direction of 6114) and Y3 (y direction of 6113) (S6027: YES). Also, the difference between the reference block and the referenceable area in the x direction is not smaller than the difference between the reference block and the referenceable area in the y direction (S6028: NO). Therefore, the reference position in the y direction is corrected to the position of 6214 with yRefBR=yAvlBR (S6030). Here, as in S6001, yRefBR=yRefTL+cbHeight-1, that is, yRefTL=yRefBR-(cbHeight-1), and therefore yRefTL is also corrected in conjunction with the correction of yRefBR. In this correction of the reference position, the block vector mvL[1] may be corrected. That is, mvL[1] = (yAvlBR - 64 - (yCb + cbHeight - 1)) << 4 This makes it so that yRefBR=yAvlBR, and the reference position can be corrected.

[0240] Now, assume that reference block r3 is located at 6215. In this case, the difference between the reference block and the referenceable area in the x direction is not smaller than the difference between the reference block and the referenceable area in the y direction (S6028: NO). Therefore, by correcting the reference position in the y direction, as with reference block r2, it is positioned at 6216 (S6030). At this point, the reference block is outside the referenceable area. However, the reference position in the x direction is corrected by the processes of S6008 and S6009 described below. In the end, the reference block is inside the referenceable area.

[0241] 53, the process of correcting the reference position has been described taking as an example the cases where blk_idx=0 and 3. When blk_idx=1 or 2, the process of correcting the reference position is performed in the same manner as when blk_idx=0 and 3.

[0242] After the process of correcting the reference position of the non-rectangular referable area (S6013), the processes from S6004 to S6011 are performed. This completes the process when the CTU size is 128x128 pixels.

[0243] Now, suppose that in the process of correcting the reference position of a non-rectangular referenceable area (S6013), the reference position in the x direction is corrected to match the top left corner of the referenceable area (S6024). Then, the reference position in the x direction of the reference block will never be smaller than the top left corner of the referenceable area, so the determination in S6004 will always be false (S6004: NO). Therefore, if S6024 is performed, it is possible to avoid performing S6004 and S6005. Similarly, if S6025 is performed, it is possible to avoid performing S6006 and S6007, if S6029 is performed, it is possible to avoid performing S6008 and S6009, and if S6030 is performed, it is possible to avoid performing S6010 and S6011.

[0244] 52, the comparison process of step S6023 may be omitted and step S6024 may always be executed, or step S6025 may always be executed. Similarly, the comparison process of step S6028 may be omitted and step S6029 may always be executed, or step S6030 may always be executed. In such a configuration, it is possible to correct the reference position by simple processing.

[0245] In Fig. 49, when the size of the CTU is 128 x 128 pixels, the reference position is corrected using the processes of S6012, S6013, and S6004 to S6011. Alternatively, this can be achieved by dividing the referenceable area into two and correcting the reference position of each (S6101), as shown in Fig. 54.

[0246] FIG. 55 is a diagram for explaining how a referenceable area is decomposed into two. Unlike FIG. 51 in which the referenceable area is rectangular, FIG. 55 decomposes the referenceable area into two. When the coding tree block (6101) to be processed is divided into four and the coding block (6102) to be processed is located in the upper left, blk_idx=0 is set. Similarly, when the coding blocks to be processed are located in the upper right, lower left, and lower right, respectively, blk_idx is set to 1, 2, and 3. FIG. 55(a) is a diagram showing the case where blk_idx=0. Similarly, FIG. 55(b) to FIG. 55(d) are diagrams showing the cases where blk_idx=1 to 3, respectively. Moreover, one referenceable area (6301) is set as referenceable area A, and the other referenceable area (6302) is set as referenceable area B.

[0247] FIG. 56 is a diagram explaining the process (S6101) of dividing the referenceable area into two and correcting the reference position of each. In FIG. 56, the same processes as in FIG. 49 are given the same step numbers and their explanations are omitted. First, the positions of the top left and bottom right of the referenceable area A are calculated (S6111). If the top left of the referenceable area A is (xAvlTL, yAvlTL) and the bottom right is (xAvlBR, yAvlBR), then xOffsetTL[4] = {-128, -128, -64, 0}, yOffsetTL[4] = {64, 64, 64, 0} xOffsetBR[4] = {0, 0, 0, 128}, yOffsetBR[4] = {128, 128, 128, 64} ( xAvlTL, yAvlTL ) = ( (xCb >> CtbLog2SizeY) << CtbLog2SizeY + xOffsetTL[blk_idx], (yCb >> CtbLog2SizeY) << CtbLog2SizeY + yOffsetTL[blk_idx]) ( xAvlBR, yAvlBR ) = ( ((xCb >> CtbLog2SizeY) << CtbLog2SizeY) - 1 + xOffsetBR[blk_idx], (((yCb >> CtbLog2SizeY) + 1) << CtbLog2SizeY) - 1 + yOffsetBR[blk_idx]).

[0248] Next, whether the reference block is outside the referenceable area A or not out_xRefTL = xRefTL < xAvlTL out_yRefTL = yRefTL < yAvlTL out_xRefBR = xRefBR > xAvlBR out_yRefBR = yRefBR > yAvlBR (S6112).

[0249] Next, the positions of the top left and bottom right of the referenceable area B are calculated (S6113). If the top left of the referenceable area B is (xAvlTL, yAvlTL) and the bottom right is (xAvlBR, yAvlBR), then xOffsetTL[4] = {-64, 0, 0, 0}, yOffsetTL[4] = {0, 0, 0, 0} xOffsetBR[4] = {0, 64, 128, 64}, yOffsetBR[4] = {128, 64, 64, 128} ( xAvlTL, yAvlTL ) = ( (xCb >> CtbLog2SizeY) << CtbLog2SizeY + xOffsetTL[blk_idx], (yCb >> CtbLog2SizeY) << CtbLog2SizeY + yOffsetTL[blk_idx]) ( xAvlBR, yAvlBR ) = ( ((xCb >> CtbLog2SizeY) << CtbLog2SizeY) - 1 + xOffsetBR[blk_idx], (((yCb >> CtbLog2SizeY) + 1) << CtbLog2SizeY) - 1 + yOffsetBR[blk_idx] ) It becomes.

[0250] Next, it is determined whether the reference position of the reference block in the x direction is smaller than the top left of referenceable area A and smaller than the top left of referenceable area B (S6114). If the determination is false (S6114: NO), proceed to the next process (S6116). On the other hand, if the determination is true (S6114: YES), the reference position in the x direction is corrected to match the top left of referenceable area B (S6005). The processing of S6005 has already been explained, so its explanation will be omitted.

[0251] Next, it is determined whether the reference position in the y direction of the reference block is smaller than the top left corner of referenceable area A and smaller than the top left corner of referenceable area B (S6116). If the determination is false (S6116: NO), the process proceeds to the next step (S6118). On the other hand, if the determination is true (S6116: YES), the reference position in the y direction is corrected to match the top left corner of referenceable area B (S6007). The processing of S6007 has already been explained, so its explanation will be omitted.

[0252] Next, it is determined whether the reference position of the reference block in the x direction is greater than the bottom right corner of referenceable area A and greater than the bottom right corner of referenceable area B (S6118). If the determination is false (S6118: NO), proceed to the next process (S6120). On the other hand, if the determination is true (S6118: YES), the reference position in the x direction is corrected to match the bottom right corner of referenceable area B (S6009). The processing of S6009 has already been explained, so explanation will be omitted.

[0253] Next, it is determined whether the reference position of the reference block in the y direction is greater than the bottom right of referenceable area A and greater than the bottom right of referenceable area B (S6120). If the determination is false (S6120: NO), the processing ends. On the other hand, if the determination is true (S6120: YES), the reference position in the y direction is corrected to match the bottom right of referenceable area B (S6011). The processing of S6011 has already been explained, so its explanation will be omitted.

[0254] As a result, when the size of the CTU is 128x128 pixels, even if the reference block is located outside the referenceable area, it can be referenced by correcting the reference position. Furthermore, by dividing the referenceable area into two and correcting the reference position of each, it is possible to simplify the processing and reduce the amount of calculation. Here, one referenceable area (6301) is set as referenceable area A, and the other referenceable area (6302) is set as referenceable area B. Alternatively, it is also possible to swap referenceable area A and referenceable area B, and process one referenceable area (6301) as referenceable area B, and the other referenceable area (6302) as referenceable area A.

[0255] In this embodiment, it is determined whether the size of the CTU is 128x128 pixels (S6002) and the process is switched. This may be determined whether the intra block copy reference block is a unit obtained by dividing the coding tree block into four, or it may be determined whether the size of the CTU is larger than the maximum size of the coding block.

[0256] <Reference area boundary correction section> FIG. 59 is a flowchart for explaining the processing of the reference area boundary correction unit 381 and the reference area boundary correction unit 481.

[0257] First, change the top left position of the reference block to ( xRefTL, yRefTL ) = ( xCb + ( mvL

[0000] >> 4 ), yCb + ( mvL

[0001] >> 4 ) ) ( xRefBR, yRefBR ) = ( xRefTL + cbWidth - 1, yRefTL + cbHeight - 1 ) (step S1401). This procedure is similar to step S6001 in FIG. 49, and therefore description thereof will be omitted.

[0258] Next, the top left and bottom right positions of each of the referenceable areas A, B, and C are calculated (steps S1402 to S1403). Here, the referenceable area A is the intra block copy reference block processed immediately before the intra block copy reference block to be processed, the referenceable area B is the intra block copy reference block processed immediately before the referenceable area A, and the referenceable area C is the intra block copy reference block processed immediately before the referenceable area B. FIG. 57 is an example when the coding tree block unit is used as the intra block copy reference block. In the example of FIG. 57(a), the coding tree block 503 is the coding tree block to be processed. At this time, the coding tree block 502 corresponds to the referenceable area A, the coding tree block 501 corresponds to the referenceable area B, and the coding tree block 500 corresponds to the referenceable area C. FIG. 58 is an example when the unit obtained by dividing the coding tree block into four is used as the intra block copy reference block. In the example of FIG. 57(a), the coding tree block 504 is the intra block copy reference block to be processed. In this case, the coding tree block 503 corresponds to the referenceable area A, the coding tree block 502 corresponds to the referenceable area B, and the coding tree block 501 corresponds to the referenceable area C.

[0259] The top left positions of the accessable areas A, B, and C are respectively (xAvlATL, yAvlATL), (xAvlBTL, yAvlBTL), and (xAvlCTL, yAvlCTL). Also, the bottom right positions of the accessable areas A, B, and C are respectively (xAvlABR, yAvlABR), (xAvlBBR, yAvlBBR), and (xAvlCBR, yAvlCBR). When the coding tree block unit is the intra block copy reference block, (xAvlATL, yAvlATL), (xAvlBTL, yAvlBTL), (xAvlCTL, yAvlCTL), (xAvlABR, yAvlABR), (xAvlBBR, yAvlBBR), and (xAvlCBR, yAvlCBR) are respectively defined as follows: (xAvlATL, yAvlATL) = ( (xCb >> CtbLog2SizeY) << (CtbLog2SizeY) - (1 << CtbLog2SizeY), (yCb >> CtbLog2SizeY) << (CtbLog2SizeY)) (xAvlABR, yAvlABR) = (xAvlATL + cbWidth - 1, yAvlATL + cbHeight - 1 ) (xAvlATL, yAvlATL) = ( (xCb >> CtbLog2SizeY) << (CtbLog2SizeY) - 2*(1 << CtbLog2SizeY)), (yCb >> CtbLog2SizeY) << (CtbLog2SizeY)) (xAvlBBR, yAvlBBR) = (xAvlBTL + cbWidth -1, yAvlBTL + cbHeight - 1 ) (xAvlATL, yAvlATL) = ( (xCb >> CtbLog2SizeY) << (CtbLog2SizeY) - 3*(1 << CtbLog2SizeY), (yCb >> CtbLog2SizeY) << (CtbLog2SizeY)) (xAvlCBR, yAvlCBR) = (xAvlCTL + cbWidth -1, yAvlCTL + cbHeight - 1 ) When the coding tree block is divided into four units as intra block copy reference blocks, (xAvlATL, yAvlATL), (xAvlBTL, yAvlBTL), and (xAvlCTL, yAvlCTL) are respectively defined as follows: (xAvlATL, yAvlATL) = ( (xCb >> (CtbLog2SizeY-1)) << (CtbLog2SizeY-1) - (1 << (CtbLog2SizeY-1)), (yCb >> (CtbLog2SizeY-1)) << ((CtbLog2SizeY-1))+ (1<<(CtbLog2SizeY-1))) (xAvlABR, yAvlABR) = (xAvlATL + cbWidth - 1, yAvlATL + cbHeight - 1 ) (xAvlBTL, yAvlBTL) = ( (xCb >> (CtbLog2SizeY-1)) << (CtbLog2SizeY-1) - (1 << (CtbLog2SizeY)), (yCb >> (CtbLog2SizeY-1)) << ((CtbLog2SizeY-1))+ (1<<(CtbLog2SizeY-1))) (xAvlBBR, yAvlBBR) = (xAvlBTL + cbWidth -1, yAvlBTL + cbHeight - 1 ) (xAvlCTL, yAvlCTL) = ( (xCb >> (CtbLog2SizeY-1)) << (CtbLog2SizeY-1) - (1 << (CtbLog2SizeY-1)), (yCb >> (CtbLog2SizeY-1)) << ((CtbLog2SizeY-1))+ (1<<(CtbLog2SizeY-1))) (xAvlCBR, yAvlCBR) = (xAvlCTL + cbWidth -1, yAvlCTL + cbHeight - 1 ) Let us assume that.

[0260] Next, a referenceable area including the upper left position of the reference block is determined (step S1405). Specifically, the upper left and lower right positions of referenceable areas A, B, and C are compared with the upper left position of the reference block, and the referenceable area that includes the upper left position of the reference block is determined as the referenceable area that includes the reference block.

[0261] Next, it is determined whether the referenceable area including the upper left position of the reference block includes the lower right position of the reference block (step S1406). If the referenceable area including the upper left position of the reference block includes the lower right position of the reference block, the flow chart in FIG. 59 is terminated.

[0262] If the referenceable area including the upper left position of the reference block does not include the lower right position of the reference block, the reference block is corrected (step S1407). The correction of the reference block will be described with reference to FIG. 60. FIG. 60 shows an example in which the coding tree block unit is used as the intra block copy reference block. FIG. 60(a) shows a case in which a block vector 507 is set for a coding block 505 to be processed. The referenceable area B (503) includes the upper left position of the reference block, but does not include the lower right position of the reference block. At this time, as shown in FIG. 60(b), the reference block 508 is divided into a divided reference block 509 and a divided reference block 510 and arranged in the memory space. The divided reference block 509 is an area included in the referenceable area B (503), which is a referenceable area including the upper left position of the reference block, and the divided reference block 510 is a reference block included in a reference area different from the referenceable area B (503). In this embodiment, when constructing a reference image of the reference block 510, different processes are performed on the area corresponding to the divided reference block 509 and the area corresponding to the divided reference block 510. Specifically, for the area corresponding to the divided reference block 509, a reference image is created based on the position indicated by the block vector. On the other hand, for the area corresponding to the divided reference block 510, a reference image is created by setting a predetermined value without referring to the memory space 600. Here, the predetermined value is MaxPixelValue / 2, assuming that the maximum value of the pixel value is MaxPixelValue. However, for the area corresponding to the divided reference block 510, instead of the predetermined value, a configuration may be adopted in which a reference image is constructed from the memory space 603 including the divided reference block 509. For example, a reference image may be constructed by copying the pixel located at the rightmost position of the divided reference block 509 in the horizontal direction.

[0263] FIG. 61 shows an example in which a unit obtained by dividing a coding tree block into four is used as an intra block copy reference block. FIG. 61(a) shows a case in which a block vector 508 is set for a coding block 509 to be processed. The referenceable area C (501) includes the upper left position of the reference block, but does not include the lower right position of the reference block. In this case, as shown in FIG. 61(b), the reference block 510 is divided into a divided reference block 511 and a divided reference block 512 and arranged in the memory space. The divided reference block 511 is an area included in the referenceable area C (501), which is a referenceable area including the upper left position of the reference block, and the divided reference block 512 is a reference block included in a reference area different from the referenceable area C (501). In this embodiment, when constructing a reference image of the reference block 510, different processes are performed on the area corresponding to the divided reference block 511 and the area corresponding to the divided reference block 512. Specifically, for the area corresponding to the divided reference block 511, a reference image is created based on the position indicated by the block vector. On the other hand, for the area corresponding to divided reference block 511, a reference image is created by setting a predetermined value without referring to memory space 602. Here, the predetermined value is MaxPixelValue / 2, where the maximum pixel value is MaxPixelValue. However, for the area corresponding to divided reference block 512, instead of the predetermined value, a reference image may be constructed from memory space 601 including divided reference block 511. For example, a reference image may be constructed by vertically copying the pixel located at the bottom of divided reference block 511.

[0264] By adopting this configuration, when determining a reference block for intra block copying, if the reference image is divided and arranged in the memory space, it is possible to avoid accessing the divided memory space multiple times, and therefore the amount of processing required to configure the reference block for intra block copying can be reduced.

[0265] In all the embodiments described above, the coded bit stream output by the image coding device has a specific data format so that it can be decoded according to the coding method used in the embodiment. The coded bit stream may be provided by recording it on a computer-readable recording medium such as an HDD, SSD, flash memory, or optical disk, or may be provided from a server via a wired or wireless network. Therefore, an image decoding device corresponding to this image coding device can decode the coded bit stream in this specific data format regardless of the providing means.

[0266] When a wired or wireless network is used to exchange coded bitstreams between an image coding device and an image decoding device, the coded bitstream may be converted into a data format suitable for the transmission mode of the communication channel before being transmitted. In this case, a transmitting device is provided that converts the coded bitstream output by the image coding device into coded data in a data format suitable for the transmission mode of the communication channel and transmits the coded bitstream to the network, and a receiving device is provided that receives coded data from the network, restores the coded bitstream to the coded bitstream, and supplies the coded bitstream to the image decoding device. The transmitting device includes a memory that buffers the coded bitstream output by the image coding device, a packet processing unit that packetizes the coded bitstream, and a transmitting unit that transmits the packetized coded data via the network. The receiving device includes a receiving unit that receives the packetized coded data via the network, a memory that buffers the received coded data, and a packet processing unit that packetizes the coded data to generate a coded bitstream and provides it to the image decoding device.

[0267] When a wired or wireless network is used to exchange the coded bit stream between the image coding device and the image decoding device, in addition to the transmitting device and the receiving device, a relay device may be provided that receives the coded data transmitted by the transmitting device and supplies it to the receiving device. The relay device includes a receiving unit that receives packetized coded data transmitted by the transmitting device, a memory that buffers the received coded data, and a transmitting unit that transmits the packetized coded data to the network. The relay device may further include a receiving packet processing unit that processes the packetized coded data into packets to generate a coded bit stream, a recording medium that accumulates the coded bit stream, and a transmitting packet processing unit that packetizes the coded bit stream.

[0268] Moreover, a display unit for displaying an image decoded by the image decoding device may be added to the configuration to form a display device. In this case, the display unit reads out the decoded image signal generated by the decoded image signal superimposition unit 207 and stored in the decoded image memory 208, and displays it on a screen.

[0269] Moreover, an imaging unit may be added to the configuration and the captured image may be input to the image coding device to form an imaging device. In this case, the imaging unit inputs a captured image signal to the block division unit 101.

[0270] The above-mentioned encoding and decoding processes may be realized not only as a transmission, storage, and receiving device using hardware, but also as firmware stored in a ROM (read-only memory) or flash memory, or as software for a computer, etc. The firmware program or software program may be provided by recording it on a recording medium readable by a computer, etc., or may be provided from a server via a wired or wireless network, or may be provided as data broadcasting of terrestrial or satellite digital broadcasting.

[0271] The present invention has been described above based on the embodiments. The embodiments are merely examples, and it will be understood by those skilled in the art that various modifications are possible in the combination of each component and each treatment process, and that such modifications are also within the scope of the present invention. [Explanation of symbols]

[0272] 100 image encoding device, 101 block division unit, 102 inter prediction unit, 103 intra prediction unit, 104 decoded image memory, 105 prediction method determination unit, 106 residual signal generation unit, 107 orthogonal transform and quantization unit, 108 bit string encoding unit, 109 inverse quantization and inverse orthogonal transform unit, 110 decoded image signal superposition unit, 111 encoding information storage memory, 200 image decoding device, 201 bit string decoding unit, 202 block division unit, 203 inter prediction unit 204 intra prediction unit, 205 encoding information storage memory, 206 inverse quantization and inverse orthogonal transform unit, 207 decoded image signal superposition unit, 208 decoded image memory.< / poc>

Claims

1. A method for dividing a coding tree block into one or more intra block copy reference blocks. In an image coding apparatus, The coding information stored in the coding information storage memory is used to select the coding target in the coding target picture. a block vector candidate derivation unit that derives block vector candidates for a block; a selection unit for selecting a selected block vector from the block vector candidates; A predetermined number of the intra block copies immediately before the intra block copy reference block to be coded A storage unit for storing an encoded image of the copy reference block; The encoded image of the intra block copy reference block including the encoding target block The left side of the reference block indicated by the selected block vector is selected. A reference area boundary correction unit that determines whether the top position and bottom right position are both included in the referenceable area. and, Equipped with The reference area boundary correction unit corrects the upper left position of the reference block indicated by the selected block vector. In the first divided reference area including the lower right position but not including the lower right position, the position indicated by the selected block vector is deriving a predicted image of the picture to be encoded based on the position; In a second divided reference area different from the first divided reference area, the selected block vector derive a predicted image of the picture to be coded without referring to the position indicated by 1. An image encoding device comprising:

2. A method for dividing a coding tree block into one or more intra block copy reference blocks.

1. A method for encoding an image, comprising: The coding information stored in the coding information storage memory is used to select the coding target in the coding target picture. a block vector candidate derivation step of deriving a block vector candidate of a block; a selection step of selecting a selected block vector from the block vector candidates; A predetermined number of the intra block copies immediately before the intra block copy reference block to be coded a storing step of storing the encoded image of the copied reference block; The encoded image of the intra block copy reference block including the encoding target block The left side of the reference block indicated by the selected block vector is selected. A reference area boundary correction step that determines whether the top and bottom right positions are both included in the referenceable area. Tep and Equipped with The reference area boundary correction step is performed by dividing the reference area boundary by the left of the reference block indicated by the selected block vector. In the first divided reference area including the upper position and not including the lower right position, the selected block vector is deriving a predicted image of the current picture based on the position indicated by the In a second divided reference area different from the first divided reference area, the selected block vector derive a predicted image of the picture to be coded without referring to the position indicated by 13. An image coding method comprising:

3. A method for dividing a coding tree block into one or more intra block copy reference blocks. In the image encoding program, The coding information stored in the coding information storage memory is used to select the coding target in the coding target picture. a block vector candidate derivation step of deriving a block vector candidate of a block; a selection step of selecting a selected block vector from the block vector candidates; A predetermined number of the intra block copies immediately before the intra block copy reference block to be coded a storing step of storing the encoded image of the copied reference block; The encoded image of the intra block copy reference block including the encoding target block The left side of the reference block indicated by the selected block vector is selected. In the first divided reference area including the upper position and not including the lower right position, the selected block vector is a predicted image of the picture to be coded based on the position indicated by the first divided reference region; In the second divided reference area different from the first divided reference area, the position indicated by the selected block vector is referenced. a reference area boundary correction step of deriving a predicted image of the picture to be encoded. An image encoding program characterized by causing a computer to execute the above steps.

4. A method for dividing a coding tree block into one or more intra block copy reference blocks. In the image decoding device, A block to be decoded in a picture to be decoded is extracted from the coding information stored in the coding information storage memory. a block vector candidate derivation unit for deriving a block vector candidate of the block; a selection unit for selecting a selected block vector from the block vector candidates; A predetermined number of intra blocks immediately before the intra block copy reference block to be decoded a storage unit for storing a decoded image of the copy reference block; A decoded image of the intra block copy reference block including the block to be decoded is All of the referenceable areas are excluded, and the upper left corner of the reference block indicated by the selected block vector is a reference area boundary correction unit that determines that both the right and bottom positions are included in the referenceable area; Equipped with The reference area boundary correction unit corrects the upper left position of the reference block indicated by the selected block vector. In the first divided reference area including the lower right position but not including the lower right position, the position indicated by the selected block vector is deriving a predicted image of the picture to be decoded based on the position; In a second divided reference area different from the first divided reference area, the selected block vector derive a predicted image of the picture to be decoded without referring to the position indicated by 2. An image decoding device comprising:

5. A method for dividing a coding tree block into one or more intra block copy reference blocks. In the image decoding method, A block to be decoded in a picture to be decoded is extracted from the coding information stored in the coding information storage memory. A block vector candidate derivation step of deriving a block vector candidate of the block; a selection step of selecting a selected block vector from the block vector candidates; A predetermined number of intra blocks immediately before the intra block copy reference block to be decoded a storing step of storing the decoded image of the copy reference block; A decoded image of the intra block copy reference block including the block to be decoded is All of the referenceable areas are excluded, and the upper left corner of the reference block indicated by the selected block vector is A reference area boundary correction step that determines whether the reference area includes both the top and bottom right positions. P and Equipped with The reference area boundary correction step is performed by dividing the reference area boundary by the left of the reference block indicated by the selected block vector. In the first divided reference area including the upper position and not including the lower right position, the selected block vector is deriving a predicted image of the picture to be decoded based on the position indicated by the In a second divided reference area different from the first divided reference area, the selected block vector derive a predicted image of the picture to be decoded without referring to the position indicated by 2. An image decoding method comprising:

6. A method for dividing a coding tree block into one or more intra block copy reference blocks. In the image decoding program, A block to be decoded in a picture to be decoded is extracted from the coding information stored in the coding information storage memory. A block vector candidate derivation step of deriving a block vector candidate of the block; a selection step of selecting a selected block vector from the block vector candidates; A predetermined number of intra blocks immediately before the intra block copy reference block to be decoded a storing step of storing the decoded image of the copy reference block; A decoded image of the intra block copy reference block including the block to be decoded is All of the referenceable areas are excluded, and the upper left corner of the reference block indicated by the selected block vector is In the first divided reference area including the lower right position and not including the lower right position, A predicted image of the picture to be decoded is derived based on the position, and the first divided reference area is different from In the second divided reference area, the position indicated by the selected block vector is not referenced. a reference region boundary correction step of deriving a predicted image of the current picture; An image decoding program characterized by causing a computer to execute the above steps.

7. A method for dividing a coding tree block into one or more intra block copy reference blocks. A method for storing a bit stream encoded by an image encoding method on a recording medium, comprising the steps of: The image encoding method includes: The coding information stored in the coding information storage memory is used to select the coding target in the coding target picture. a block vector candidate derivation step of deriving a block vector candidate of a block; a selection step of selecting a selected block vector from the block vector candidates; A predetermined number of the intra block copies immediately before the intra block copy reference block to be coded a storing step of storing the encoded image of the copied reference block; The encoded image of the intra block copy reference block including the encoding target block The left side of the reference block indicated by the selected block vector is selected. A reference area boundary correction step that determines whether the top and bottom right positions are both included in the referenceable area. Tep and Equipped with The reference area boundary correction step is performed by dividing the reference area boundary by the left of the reference block indicated by the selected block vector. In the first divided reference area including the upper position and not including the lower right position, the selected block vector is a predicted image of the picture to be coded based on the position indicated by the first divided reference region; In the second divided reference area different from the first divided reference area, the position indicated by the selected block vector is referenced. deriving a predicted image of the picture to be encoded; A storage method comprising:

8. A method for dividing a coding tree block into one or more intra block copy reference blocks. A method for transmitting a bit stream encoded by an image encoding method, comprising the steps of: The conversion method is as follows: The coding information stored in the coding information storage memory is used to select the coding target in the coding target picture. a block vector candidate derivation step of deriving a block vector candidate of a block; a selection step of selecting a selected block vector from the block vector candidates; A predetermined number of the intra block copies immediately before the intra block copy reference block to be coded a storing step of storing the encoded image of the copied reference block; The encoded image of the intra block copy reference block including the encoding target block The left side of the reference block indicated by the selected block vector is selected. A reference area boundary correction step that determines whether the top and bottom right positions are both included in the referenceable area. Tep and Equipped with The reference area boundary correction step is performed by dividing the reference area boundary by the left of the reference block indicated by the selected block vector. In the first divided reference area including the upper position and not including the lower right position, the selected block vector is deriving a predicted image of the current picture based on the position indicated by the In a second divided reference area different from the first divided reference area, the selected block vector derive a predicted image of the picture to be coded without referring to the position indicated by A transmission method comprising:

Citation Information

Patent Citations

  • Method and apparatus for encoding and / or decoding information about intra-prediction mode of video

    JP2009246975A

  • Video encoding device, video encoding method, video encoding program, video decoding device, video decoding method, and video decoding program

    WO2020256102A1

  • Moving-image encoding device, moving-image encoding method, moving-image encoding program, moving-image decoding device, moving-image decoding method and moving-image decoding program

    WO2020256105A1