Encoding device and encoding method

The encoding device optimizes video coding by context-adaptive processing and Golomb-Rice coding to enhance efficiency, simplify processing, and reduce circuit size and delay, addressing challenges in existing video coding technologies.

JP7873072B2Inactive Publication Date: 2026-06-11PANASONIC INTELLECTUAL PROPERTY CORP OF AMERICA

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
PANASONIC INTELLECTUAL PROPERTY CORP OF AMERICA
Filing Date
2020-06-09
Publication Date
2026-06-11
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing video coding technologies face challenges in improving encoding efficiency, image quality, reducing processing volume, and circuit size, while appropriately selecting elements or operations such as filters, blocks, sizes, motion vectors, and reference pictures.

Method used

An encoding device that performs context-adaptive coding on the number of processing steps, using orthogonal transform or skipping it, and encodes coefficient information flags with Golomb-Rice coding, and converts coefficients using peripheral coefficients to optimize encoding and decoding processes.

🎯Benefits of technology

This approach enhances coding efficiency, simplifies processing, reduces circuit size, and improves processing speed by controlling orthogonal transformations and Golomb-Rice coding, thereby reducing processing delay and code amount.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007873072000018
    Figure 0007873072000018
  • Figure 0007873072000019
    Figure 0007873072000019
  • Figure 0007873072000020
    Figure 0007873072000020
Patent Text Reader

Abstract

An encoding device (100) is provided with a circuit and a memory that is connected to the circuit. The circuit restricts the number of times that context adaptive encoding is processed and encodes blocks of an image. In encoding of each of the blocks, both in a case where orthogonal transformation is applied and in a case where orthogonal transformation is not applied, if the number of times of processing is within a restriction range, a coefficient information flag is encoded by the context adaptive encoding, and if the number of times of processing is not within a restriction range, encoding of the coefficient information flag is skipped. In a case where the coefficient information flag is encoded, remaining value information is encoded by Golomb-Rice encoding. In a case where orthogonal transformation is applied, if encoding of the coefficient information flag is skipped, transformation processing is performed and a value of a coefficient is encoded by Golomb-Rice encoding. In a case where orthogonal transformation is not applied, if encoding of the coefficient information flag is skipped, transformation processing is not performed and a value of a coefficient is encoded by Golomb-Rice encoding.
Need to check novelty before this filing date? Find Prior Art

Description

【Technical Field】 【0001】 The present disclosure relates to video coding, for example, systems, components, and methods in video encoding and decoding, etc. 【Background Art】 【0002】 Video coding technology has evolved from H.261 and MPEG-1 to H.264 / AVC (Advanced Video Coding), MPEG-LA, H.265 / HEVC (High Efficiency Video Coding), and H.266 / VVC (Versatile Video Codec). Along with this progress, there is always a need to provide improvements and optimizations to video coding technology to handle the continuously increasing amount of digital video data in various applications. 【0003】 Note that Non-Patent Document 1 relates to an example of a conventional standard regarding the above-described video coding technology. 【Prior Art Documents】 【Non-Patent Documents】 【0004】 【Non-Patent Document 1】 H.265(ISO / IEC 23008-2 HEVC) / HEVC(High Efficiency Video Coding) 【Summary of the Invention】 【Problems to be Solved by the Invention】 【0005】 Regarding the encoding method as described above, for improving encoding efficiency, improving image quality, reducing processing volume, reducing circuit scale, or appropriately selecting elements or operations such as filters, blocks, sizes, motion vectors, reference pictures, or reference blocks, etc., a new method is desired to be proposed. 【0006】 This disclosure provides a configuration or method that can contribute to one or more of the following: improved coding efficiency, improved image quality, reduced processing load, reduced circuit size, improved processing speed, and appropriate selection of elements or operations. This disclosure may also include configurations or methods that can contribute to other benefits not mentioned above. [Means for solving the problem] 【0007】 For example, an encoding device according to one aspect of the present disclosure comprises a circuit and a memory connected to the circuit, wherein in residual coding of the current block, the circuit performs context-adaptive coding on a number of processing steps, both when an orthogonal transform is applied and when the orthogonal transform is skipped. Below a specific value If so, the multiple coefficient information flags relating to the coefficients included in the current block are encoded by context-adaptive coding, the remaining values ​​of the coefficients are encoded by Golomb-Rice coding, and the number of processing steps is Below a specific value Otherwise, the encoding of the plurality of coefficient information flags is skipped, and when the orthogonal transform is applied, if the encoding of the plurality of coefficient information flags is skipped, the coefficient is converted to a second coefficient using a poszero value determined using a plurality of peripheral coefficients located around the coefficient in the current block, and the value of the second coefficient is encoded by Golomb-Rice coding, and when the orthogonal transform is skipped, if the encoding of the plurality of coefficient information flags is skipped, the value of the coefficient is encoded by Golomb-Rice coding without performing the transformation, and the plurality of coefficient information flags are flags indicating whether the value of the coefficient is zero or non-zero and ,before It includes a flag indicating whether the coefficient is odd or even. 【0008】 Some implementations of the embodiments in this disclosure may improve coding efficiency, simplify coding / decoding processes, increase coding / decoding speeds, or efficiently select appropriate components / operations used for coding and decoding, such as appropriate filters, block sizes, motion vectors, reference pictures, reference blocks, etc. 【0009】 Further advantages and effects of one aspect of this disclosure will be made apparent from the specification and drawings. Such advantages and / or effects may be obtained by several embodiments and features described in the specification and drawings, but not all of them are necessarily provided to obtain one or more advantages and / or effects. 【0010】 These general or specific embodiments may be implemented as systems, methods, integrated circuits, computer programs, recording media, or any combination thereof. [Effects of the Invention] 【0011】 A configuration or method relating to one aspect of this disclosure may contribute to one or more of the following: improved encoding efficiency, improved image quality, reduced processing load, reduced circuit size, improved processing speed, and appropriate selection of elements or operations. A configuration or method relating to one aspect of this disclosure may also contribute to other benefits not mentioned above. [Brief explanation of the drawing] 【0012】 [Figure 1] Figure 1 is a block diagram showing the functional configuration of an encoding device according to an embodiment. [Figure 2] Figure 2 is a flowchart showing an example of the overall encoding process performed by the encoding device. [Figure 3] Figure 3 is a conceptual diagram showing an example of block division. [Figure 4A] Figure 4A is a conceptual diagram showing an example of a slice configuration. [Figure 4B] Figure 4B is a conceptual diagram showing an example of tile configuration. [Figure 5A] Figure 5A is a table showing the transformation basis functions corresponding to various transformation types. [Figure 5B] Figure 5B is a conceptual diagram showing an example of SVT (Spatially Varying Transform). [Figure 6A]FIG. 6A is a conceptual diagram showing an example of the shape of a filter used in an ALF (adaptive loop filter). [Figure 6B] FIG. 6B is a conceptual diagram showing another example of the shape of a filter used in an ALF. [Figure 6C] FIG. 6C is a conceptual diagram showing another example of the shape of a filter used in an ALF. [Figure 7] FIG. 7 is a block diagram showing an example of the detailed configuration of a loop filter section functioning as a DBF (deblocking filter). [Figure 8] FIG. 8 is a conceptual diagram showing an example of a deblocking filter having filter characteristics symmetric with respect to a block boundary. [Figure 9] FIG. 9 is a conceptual diagram for explaining a block boundary where deblocking filter processing is performed. [Figure 10] FIG. 10 is a conceptual diagram showing an example of a Bs value. [Figure 11] FIG. 11 is a flowchart showing an example of the processing performed in the prediction processing section of an encoding apparatus. [Figure 12] FIG. 12 is a flowchart showing another example of the processing performed in the prediction processing section of an encoding apparatus. [Figure 13] FIG. 13 is a flowchart showing another example of the processing performed in the prediction processing section of an encoding apparatus. [Figure 14] FIG. 14 is a conceptual diagram showing an example of 67 intra prediction modes in the intra prediction of an embodiment. [Figure 15] FIG. 15 is a flowchart showing an example of the basic processing flow of inter prediction. [Figure 16] FIG. 16 is a flowchart showing an example of motion vector derivation. [Figure 17] FIG. 17 is a flowchart showing another example of motion vector derivation. [Figure 18] FIG. 18 is a flowchart showing another example of motion vector derivation. [Figure 19]Figure 19 is a flowchart showing an example of inter-mode prediction. [Figure 20] Figure 20 is a flowchart showing an example of interpretation using merge mode. [Figure 21] Figure 21 is a conceptual diagram illustrating an example of motion vector derivation processing using merge mode. [Figure 22] Figure 22 is a flowchart showing an example of FRUC (frame rate up conversion) processing. [Figure 23] Figure 23 is a conceptual diagram illustrating an example of pattern matching (bilateral matching) between two blocks along a motion trajectory. [Figure 24] Figure 24 is a conceptual diagram illustrating an example of pattern matching (template matching) between a template in the current picture and a block in a referenced picture. [Figure 25A] Figure 25A is a conceptual diagram illustrating an example of deriving a subblock-level motion vector based on the motion vectors of multiple adjacent blocks. [Figure 25B] Figure 25B is a conceptual diagram illustrating an example of deriving motion vectors for subblock units in an affine mode with three control points. [Figure 26A] Figure 26A is a conceptual diagram illustrating the affine merge mode. [Figure 26B] Figure 26B is a conceptual diagram illustrating an affine merge mode with two control points. [Figure 26C] Figure 26C is a conceptual diagram illustrating an affine merge mode with three control points. [Figure 27] Figure 27 is a flowchart showing an example of processing in affine merge mode. [Figure 28A] Figure 28A is a conceptual diagram illustrating an affine intermode with two control points. [Figure 28B]Figure 28B is a conceptual diagram illustrating an affine intermode with three control points. [Figure 29] Figure 29 is a flowchart showing an example of affine intermode processing. [Figure 30A] Figure 30A is a conceptual diagram illustrating an affine intermode in which the current block has three control points and the adjacent block has two control points. [Figure 30B] Figure 30B is a conceptual diagram illustrating an affine intermode in which the current block has two control points and the adjacent block has three control points. [Figure 31A] Figure 31A is a flowchart showing merge modes including DMVR (decoder motion vector refinement). [Figure 31B] Figure 31B is a conceptual diagram illustrating an example of DMVR processing. [Figure 32] Figure 32 is a flowchart showing an example of predictive image generation. [Figure 33] Figure 33 is a flowchart showing another example of predictive image generation. [Figure 34] Figure 34 is a flowchart showing another example of predictive image generation. [Figure 35] Figure 35 is a flowchart illustrating an example of predictive image correction processing using OBMC (overlapped block motion compensation). [Figure 36] Figure 36 is a conceptual diagram illustrating an example of predictive image correction processing using OBMC. [Figure 37] Figure 37 is a conceptual diagram illustrating the generation of two triangular predicted images. [Figure 38] Figure 38 is a conceptual diagram illustrating a model that assumes uniform linear motion. [Figure 39]Figure 39 is a conceptual diagram illustrating an example of a predictive image generation method using brightness correction processing by LIC (local illumination compensation). [Figure 40] Figure 40 is a block diagram showing an example implementation of an encoding device. [Figure 41] Figure 41 is a block diagram showing the functional configuration of a decoding device according to an embodiment. [Figure 42] Figure 42 is a flowchart showing an example of the overall decoding process by the decoding device. [Figure 43] Figure 43 is a flowchart showing an example of the processing performed in the prediction processing unit of the decoding device. [Figure 44] Figure 44 is a flowchart showing another example of the processing performed in the prediction processing unit of the decoding device. [Figure 45] Figure 45 is a flowchart showing an example of inter-mode prediction in a decoding device. [Figure 46] Figure 46 is a block diagram showing an example of a decoding device implementation. [Figure 47] Figure 47 is a flowchart showing a basic coefficient coding method according to the first embodiment. [Figure 48] Figure 48 is a flowchart of a basic first encoding scheme according to the first embodiment. [Figure 49] Figure 49 is a flowchart showing a basic second encoding scheme according to the first embodiment. [Figure 50] Figure 50 is a flowchart showing a coefficient coding method according to a first example of the first embodiment. [Figure 51] Figure 51 is a flowchart showing a coefficient coding method according to a second example of the first embodiment. [Figure 52] Figure 52 is a flowchart showing a coefficient coding method according to the first example of the second embodiment. [Figure 53] Figure 53 is a flowchart showing a coefficient coding method according to a second example of the second embodiment. [Figure 54]Figure 54 is a syntax diagram showing the basic first encoding scheme according to the third embodiment. [Figure 55] Figure 55 is a syntax diagram showing the basic second coding scheme according to the third embodiment. [Figure 56] Figure 56 is a syntax diagram showing the second coding scheme according to the first example of the third embodiment. [Figure 57] Figure 57 is a syntax diagram showing a second coding scheme relating to a second example of the third embodiment. [Figure 58] Figure 58 is a relationship diagram showing the basic correspondence between coefficient information flags and context numbers in the fourth embodiment. [Figure 59] Figure 59 is a conceptual diagram showing the basic multiple adjacent coefficients related to the fourth embodiment. [Figure 60] Figure 60 is a conceptual diagram showing multiple adjacent coefficients relating to the first example of the fourth embodiment. [Figure 61A] Figure 61A is a conceptual diagram showing the coding target coefficients located at the horizontal edge positions. [Figure 61B] Figure 61B is a conceptual diagram showing the coding target coefficients located at the vertical edge positions. [Figure 62A] Figure 62A is a conceptual diagram showing the coding target coefficients adjacent to the horizontal edge positions. [Figure 62B] Figure 62B is a conceptual diagram showing the coding target coefficients adjacent to the vertical edge positions. [Figure 63] Figure 63 is a conceptual diagram showing the correspondence between residual values ​​and Golomb-Rice codes in the third example of the fourth embodiment. [Figure 64] Figure 64 is a flowchart showing a basic coefficient coding method according to the fifth embodiment. [Figure 65] Figure 65 is a flowchart of the third encoding scheme according to the fifth embodiment. [Figure 66] Figure 66 is a conceptual diagram showing multiple peripheral coefficients related to the fifth embodiment. [Figure 67] Figure 67 is a conceptual diagram showing the conversion process related to the fifth embodiment. [Figure 68]Figure 68 is a flowchart showing a coefficient coding method according to the first example of the fifth embodiment. [Figure 69] Figure 69 is a flowchart showing a coefficient coding method according to a second example of the fifth embodiment. [Figure 70] Figure 70 is a flowchart showing the operation of the encoding device according to the embodiment. [Figure 71] Figure 71 is a flowchart showing the operation of the decoding device according to the embodiment. [Figure 72] Figure 72 is a block diagram showing the overall configuration of a content supply system that realizes a content distribution service. [Figure 73] Figure 73 is a conceptual diagram showing an example of an encoding structure during scalable encoding. [Figure 74] Figure 74 is a conceptual diagram showing an example of an encoding structure during scalable encoding. [Figure 75] Figure 75 is a conceptual diagram showing an example of a web page display screen. [Figure 76] Figure 76 is a conceptual diagram showing an example of a web page display screen. [Figure 77] Figure 77 is a block diagram showing an example of a smartphone. [Figure 78] Figure 78 is a block diagram showing an example of a smartphone configuration. [Modes for carrying out the invention] 【0013】 For example, an encoding device may be able to convert blocks into more compressible data by applying an orthogonal transformation to the blocks during the encoding of image blocks. On the other hand, an encoding device may be able to reduce processing delays by not applying an orthogonal transformation to the blocks during the encoding of image blocks. 【0014】 Furthermore, the characteristics of a block to which an orthogonal transformation has been applied differ from those of a block to which an orthogonal transformation has not been applied. The encoding scheme used for a block to which an orthogonal transformation has been applied may also differ from those used for a block to which an orthogonal transformation has not been applied. 【0015】 However, if an inappropriate encoding scheme is used for blocks to which orthogonal transformations are applied, or if an inappropriate encoding scheme is used for blocks to which orthogonal transformations are not applied, an increase in the amount of code or an increase in processing delay may occur. Furthermore, if there is a significant difference between the encoding scheme used for blocks to which orthogonal transformations are applied and the encoding scheme used for blocks to which orthogonal transformations are not applied, the processing may become more complex and the circuit size may increase. 【0016】 For example, an encoding device according to one aspect of the present disclosure comprises a circuit and a memory connected to the circuit, wherein the circuit, in operation, encodes blocks of an image by limiting the number of context-adaptive encoding operations, and in the encoding of the blocks, in both cases where an orthogonal transform is applied to the block and where an orthogonal transform is not applied to the block, if the number of operations is within the limit range of the number of operations, it encodes a coefficient information flag indicating the attributes of the coefficients included in the block by context-adaptive encoding, and if the number of operations is not within the limit range of the number of operations, it skips encoding the coefficient information flag, and the coefficient information flag If encoded, residual value information for reconstructing the value of the coefficient using the coefficient information flag is encoded by Golomb-Rice coding. If an orthogonal transform is applied to the block and the encoding of the coefficient information flag is skipped, a transformation process is performed to transform the value of the coefficient using a value determined using peripheral coefficients, which are coefficients around the position of the coefficient in the block, and the value of the coefficient is encoded by Golomb-Rice coding. If an orthogonal transform is not applied to the block and the encoding of the coefficient information flag is skipped, the value of the coefficient is encoded by Golomb-Rice coding without performing the transformation process. 【0017】 This means that, regardless of whether orthogonal transformations are applied, the encoding of coefficient information flags may be skipped according to the limitations on the number of processing iterations in context-adaptive coding. Therefore, the increase in processing delay and the increase in coding size may be suppressed. In addition, the difference between the encoding scheme used for blocks where orthogonal transformations are applied and the encoding scheme used for blocks where orthogonal transformations are not applied may be reduced, potentially resulting in a smaller circuit size. 【0018】 Furthermore, by appropriately controlling whether or not to transform the coefficient values ​​using peripheral coefficients, it may be possible to suppress the increase in processing delay and the increase in the amount of code. 【0019】 Furthermore, for example, the coefficient information flag is a flag that indicates whether or not the value of the coefficient is greater than 1. 【0020】 This means that, regardless of whether an orthogonal transform is applied, the encoding of coefficient information flags indicating whether the coefficient value is greater than 1 may be skipped, in accordance with the limitations on the number of processing iterations of context-adaptive coding. Therefore, the increase in processing delay and the increase in coding size may be suppressed. 【0021】 Furthermore, for example, the conversion process includes replacing the value of the coefficient with a value determined using the peripheral coefficients if the value of the coefficient is 0, and reducing the value of the coefficient by subtracting 1 from the value of the coefficient if the value of the coefficient is greater than 0 and less than or equal to the value determined using the peripheral coefficients. 【0022】 This may allow the coefficient values ​​to be appropriately transformed according to the peripheral coefficients, potentially suppressing the increase in sign. 【0023】 Furthermore, for example, a decoding device according to one aspect of the present disclosure comprises a circuit and a memory connected to the circuit, wherein the circuit, in operation, decodes blocks of an image by limiting the number of context-adaptive decoding operations, and in the decoding of the blocks, both when an inverse orthogonal transform is applied to the block and when an inverse orthogonal transform is not applied to the block, if the number of operations is within the limit range of the number of operations, it decodes a coefficient information flag indicating the attributes of the coefficients included in the block by context-adaptive decoding, if the number of operations is not within the limit range of the number of operations, it skips decoding the coefficient information flag, and if the coefficient information flag is decoded, it uses the coefficient information flag to process the coefficients The residual value information for reconstructing the value is decoded by Golombrice decoding, the value of the coefficient is derived using the coefficient information flag and the residual value information, if the decoding of the coefficient information flag is skipped when an inverse orthogonal transform is applied to the block, the value of the coefficient is decoded by Golombrice decoding, and a conversion process is performed to convert the value of the coefficient using a value determined using peripheral coefficients, which are coefficients around the position of the coefficient in the block, to derive the value of the coefficient, if the decoding of the coefficient information flag is skipped when an inverse orthogonal transform is not applied to the block, the value of the coefficient is decoded by Golombrice decoding, and the value of the coefficient is derived without performing the conversion process. 【0024】 This means that, regardless of whether an inverse orthogonal transform is applied, the decoding of coefficient information flags may be skipped according to the limit on the number of processing iterations in context-adaptive decoding. Therefore, the increase in processing delay and the increase in code size may be suppressed. In addition, the difference between the decoding method used for blocks to which an inverse orthogonal transform is applied and the decoding method used for blocks to which an inverse orthogonal transform is not applied will be reduced, which may reduce the circuit size. 【0025】 Furthermore, by appropriately controlling whether or not to transform the coefficient values ​​using peripheral coefficients, it may be possible to suppress the increase in processing delay and the increase in the amount of code. 【0026】 Furthermore, for example, the coefficient information flag is a flag that indicates whether or not the value of the coefficient is greater than 1. 【0027】 This means that, regardless of whether an inverse orthogonal transform is applied, the decoding of coefficient information flags indicating whether the coefficient value is greater than 1 may be skipped, according to the limit on the number of processing iterations of context-adaptive decoding. Therefore, the increase in processing delay and the increase in code size may be suppressed. 【0028】 Furthermore, for example, the conversion process includes replacing the value of the coefficient with 0 if the value of the coefficient is equal to the value determined using the peripheral coefficients, and increasing the value of the coefficient by adding 1 if the value of the coefficient is smaller than the value determined using the peripheral coefficients. 【0029】 This may allow the coefficient values ​​to be appropriately transformed according to the peripheral coefficients, potentially suppressing the increase in sign. 【0030】 Furthermore, for example, an encoding method according to one aspect of the present disclosure encodes an image block by limiting the number of context-adaptive encoding operations, and in the encoding of the block, if the number of operations is within the limit range for the number of operations when an orthogonal transform is applied to the block and when an orthogonal transform is not applied to the block, a coefficient information flag indicating the attributes of the coefficients included in the block is encoded by context-adaptive encoding, if the number of operations is not within the limit range for the number of operations, the encoding of the coefficient information flag is skipped, and if the coefficient information flag is encoded, residual value information for reconstructing the value of the coefficient using the coefficient information flag is encoded by Golomb-Rice encoding, if an orthogonal transform is applied to the block and the encoding of the coefficient information flag is skipped, a transformation process is performed to transform the value of the coefficient using a value determined using peripheral coefficients which are coefficients around the position of the coefficient in the block, and the value of the coefficient is encoded by Golomb-Rice encoding, and if an orthogonal transform is not applied to the block and the encoding of the coefficient information flag is skipped, the value of the coefficient is encoded by Golomb-Rice encoding without performing the transformation process. 【0031】 This means that, regardless of whether orthogonal transformations are applied, the encoding of coefficient information flags may be skipped according to the limitations on the number of processing iterations in context-adaptive coding. Therefore, the increase in processing delay and the increase in coding size may be suppressed. In addition, the difference between the encoding scheme used for blocks where orthogonal transformations are applied and the encoding scheme used for blocks where orthogonal transformations are not applied may be reduced, potentially resulting in a smaller circuit size. 【0032】 Furthermore, by appropriately controlling whether or not to transform the coefficient values ​​using peripheral coefficients, it may be possible to suppress the increase in processing delay and the increase in the amount of code. 【0033】 Furthermore, for example, a decoding method according to one aspect of the present disclosure decodes an image block by limiting the number of context-adaptive decoding operations, and in the decoding of the block, both when an inverse orthogonal transform is applied to the block and when an inverse orthogonal transform is not applied to the block, if the number of operations is within the limit range, a coefficient information flag indicating the attribute of the coefficient included in the block is decoded by context-adaptive decoding, if the number of operations is not within the limit range, the decoding of the coefficient information flag is skipped, and if the coefficient information flag is decoded, residual value information for reconstructing the value of the coefficient using the coefficient information flag is generated. The data is decoded by Rice decoding, and the value of the coefficient is derived using the coefficient information flag and the residual value information. If an inverse orthogonal transform is applied to the block and the decoding of the coefficient information flag is skipped, the value of the coefficient is decoded by Golomb-Rice decoding, and a transformation process is performed to convert the value of the coefficient using a value determined using peripheral coefficients, which are coefficients around the position of the coefficient in the block, thereby deriving the value of the coefficient. If an inverse orthogonal transform is not applied to the block and the decoding of the coefficient information flag is skipped, the value of the coefficient is decoded by Golomb-Rice decoding, and the value of the coefficient is derived without performing the transformation process. 【0034】 This means that, regardless of whether an inverse orthogonal transform is applied, the decoding of coefficient information flags may be skipped according to the limit on the number of processing iterations in context-adaptive decoding. Therefore, the increase in processing delay and the increase in code size may be suppressed. In addition, the difference between the decoding method used for blocks to which an inverse orthogonal transform is applied and the decoding method used for blocks to which an inverse orthogonal transform is not applied will be reduced, which may reduce the circuit size. 【0035】 Furthermore, by appropriately controlling whether or not to transform the coefficient values ​​using peripheral coefficients, it may be possible to suppress the increase in processing delay and the increase in the amount of code. 【0036】 Furthermore, for example, an encoding device according to one aspect of the present disclosure comprises a division unit, an intra-prediction unit, an inter-prediction unit, a prediction control unit, a conversion unit, a quantization unit, an entropy encoding unit, and a loop filter unit. 【0037】 The division unit divides the picture to be encoded that constitutes the video into a plurality of blocks. The intra prediction unit performs intra prediction, generating predicted images of the blocks to be encoded in the picture using a reference image in the picture to be encoded. The inter prediction unit performs inter prediction, generating predicted images of the blocks to be encoded using a reference image in a reference picture different from the picture to be encoded. 【0038】 The prediction control unit controls the intra-prediction performed by the intra-prediction unit and the inter-prediction performed by the inter-prediction unit. The conversion unit converts the prediction residual signal between the predicted image generated by the intra-prediction unit or the inter-prediction unit and the image of the block to be encoded to generate a conversion coefficient signal of the block to be encoded. The quantization unit quantizes the conversion coefficient signal. The entropy encoding unit encodes the quantized conversion coefficient signal. The loop filter unit applies a filter to the block to be encoded. 【0039】 Furthermore, for example, the entropy coding unit, in its operation, codes an image block by limiting the number of context-adaptive coding operations, and in the coding of the block, if the number of operations is within the limit range, whether an orthogonal transform is applied to the block or not, it codes a coefficient information flag indicating the attributes of the coefficients included in the block by context-adaptive coding, if the number of operations is not within the limit range, it skips coding the coefficient information flag, and if the coefficient information flag is coded, it codes residual value information for reconstructing the coefficient value using the coefficient information flag by Golomb-Rice coding, if an orthogonal transform is applied to the block and coding the coefficient information flag is skipped, it performs a conversion process to convert the value of the coefficient using a value determined using peripheral coefficients, which are coefficients around the position of the coefficient in the block, and codes the value of the coefficient by Golomb-Rice coding, and if an orthogonal transform is not applied to the block and coding the coefficient information flag is skipped, it codes the value of the coefficient by Golomb-Rice coding without performing the conversion process. 【0040】 Furthermore, for example, a decoding device according to one aspect of the present disclosure is a decoding device that decodes a moving image using a predicted image, and comprises an entropy decoding unit, an inverse quantization unit, an inverse transform unit, an intra prediction unit, an inter prediction unit, a prediction control unit, an addition unit (reconstruction unit), and a loop filter unit. 【0041】 The entropy decoding unit decodes the quantized conversion coefficient signal of the target block in the picture to be decoded that constitutes the moving image. The inverse quantization unit inversely quantizes the quantized conversion coefficient signal. The inverse transformation unit inversely transforms the conversion coefficient signal to obtain the predicted residual signal of the target block to be decoded. 【0042】 The intra prediction unit performs intra prediction, generating a predicted image of the decoded block using a reference image in the decoded picture. The inter prediction unit performs inter prediction, generating a predicted image of the decoded block using a reference image in a reference picture different from the decoded picture. The prediction control unit controls the intra prediction performed by the intra prediction unit and the inter prediction performed by the inter prediction unit. 【0043】 The summing unit reconstructs the image of the target block for decoding by adding the predicted image generated by the intra prediction unit or the inter prediction unit with the predicted residual signal. The loop filter unit applies a filter to the target block for decoding. 【0044】 Furthermore, for example, the entropy decoding unit, in its operation, limits the number of context-adaptive decoding processes to decode blocks of an image, and in the decoding of the blocks, both when an inverse orthogonal transform is applied to the block and when an inverse orthogonal transform is not applied to the block, if the number of processes is within the limit range, it decodes a coefficient information flag indicating the attributes of the coefficients included in the block by context-adaptive decoding, if the number of processes is not within the limit range, it skips decoding the coefficient information flag, and if the coefficient information flag is decoded, it uses the coefficient information flag to generate residual value information for reconstructing the coefficient values. The data is decoded by Romrice decoding, and the value of the coefficient is derived using the coefficient information flag and the residual value information. If an inverse orthogonal transform is applied to the block and the decoding of the coefficient information flag is skipped, the value of the coefficient is decoded by Goromrice decoding, and a conversion process is performed to convert the value of the coefficient using a value determined using peripheral coefficients, which are coefficients around the position of the coefficient in the block, thereby deriving the value of the coefficient. If an inverse orthogonal transform is not applied to the block and the decoding of the coefficient information flag is skipped, the value of the coefficient is decoded by Goromrice decoding, and the value of the coefficient is derived without performing the conversion process. 【0045】 Furthermore, these comprehensive or specific embodiments may be implemented as systems, devices, methods, integrated circuits, computer programs, or non-temporary recording media such as computer-readable CD-ROMs, or as any combination of systems, devices, methods, integrated circuits, computer programs, and recording media. 【0046】 The embodiments will be described in detail below with reference to the drawings. Note that the embodiments described below are all general or specific examples. The numerical values, shapes, materials, components, arrangement and connection forms of components, steps, relationships and sequences of steps shown in the following embodiments are examples only and are not intended to limit the scope of the claims. 【0047】 Embodiments of encoding and decoding devices are described below. These embodiments are examples of encoding and decoding devices to which the processes and / or configurations described in each aspect of this disclosure can be applied. The processes and / or configurations can also be implemented in encoding and decoding devices different from those in the embodiments. For example, with respect to the processes and / or configurations applicable to the embodiments, one of the following may be implemented: 【0048】 (1) Any of the multiple components of the encoding or decoding device of the embodiments described in each aspect of the present disclosure may be replaced or combined with other components described in any of the aspects of the present disclosure. 【0049】 (2) In the encoding or decoding device of the embodiment, any modifications such as addition, replacement, or deletion of functions or processes performed by some of the multiple components of the encoding or decoding device may be made. For example, any of the functions or processes may be replaced or combined with other functions or processes described in any of the embodiments of this disclosure. 【0050】 (3) In the methods performed by the encoding or decoding apparatus of the embodiment, any modifications, such as additions, replacements, and deletions, may be made to some of the processes included in the method. For example, any of the processes in the method may be replaced with or combined with other processes described in any of the embodiments of this disclosure. 【0051】 (4) Some of the multiple components constituting the encoding or decoding device of the embodiment may be combined with components described in any of the embodiments of this disclosure, or with components that have some of the functions described in any of the embodiments of this disclosure, or with components that perform some of the processing performed by the components described in any of the embodiments of this disclosure. 【0052】 (5) Components that provide some of the functions of the encoding or decoding device of the embodiment, or components that perform some of the processing of the encoding or decoding device of the embodiment, may be combined with or replaced with components described in any of the aspects of the disclosure and components that provide some of the functions described in any of the aspects of the disclosure, or components that perform some of the processing described in any of the aspects of the disclosure. 【0053】 (6) In a method performed by an encoding or decoding device of an embodiment, any of the processes included in the method may be replaced or combined with any of the processes described in any of the embodiments of the present disclosure. 【0054】 (7) Some of the processes included in the methods performed by the encoding or decoding device of the embodiment may be combined with the processes described in any of the embodiments of this disclosure. 【0055】 (8) The methods of carrying out the processes and / or configurations described in each aspect of the present disclosure are not limited to the encoding or decoding devices of the embodiments. For example, the processes and / or configurations may be carried out in devices used for purposes other than the video encoding or video decoding disclosed in the embodiments. 【0056】 [Encoding device] First, the encoding device according to the embodiment will be described. Figure 1 is a block diagram showing the functional configuration of the encoding device 100 according to the embodiment. The encoding device 100 is a video encoding device that encodes video in block units. 【0057】 As shown in Figure 1, the encoding device 100 is a device that encodes an image in block units and comprises a division unit 102, a subtraction unit 104, a transformation unit 106, a quantization unit 108, an entropy encoding unit 110, an inverse quantization unit 112, an inverse transformation unit 114, an addition unit 116, a block memory 118, a loop filter unit 120, a frame memory 122, an intra prediction unit 124, an inter prediction unit 126, and a prediction control unit 128. 【0058】 The encoding device 100 can be implemented, for example, by a general-purpose processor and memory. In this case, when a software program stored in memory is executed by the processor, the processor functions as a splitting unit 102, a subtraction unit 104, a conversion unit 106, a quantization unit 108, an entropy encoding unit 110, an inverse quantization unit 112, an inverse conversion unit 114, an addition unit 116, a loop filter unit 120, an intra prediction unit 124, an inter prediction unit 126, and a prediction control unit 128. Alternatively, the encoding device 100 may be implemented as one or more dedicated electronic circuits corresponding to the splitting unit 102, a subtraction unit 104, a conversion unit 106, a quantization unit 108, an entropy encoding unit 110, an inverse quantization unit 112, an inverse conversion unit 114, an addition unit 116, a loop filter unit 120, an intra prediction unit 124, an inter prediction unit 126, and a prediction control unit 128. 【0059】 The following describes the overall processing flow of the encoding device 100, followed by a description of each component included in the encoding device 100. 【0060】 [Overall flow of the encoding process] Figure 2 is a flowchart showing an example of the overall encoding process performed by the encoding device 100. 【0061】 First, the splitting unit 102 of the encoding device 100 divides each picture contained in the input image, which is a moving image, into multiple fixed-size blocks (for example, 128 x 128 pixels) (step Sa_1). Then, the splitting unit 102 selects a splitting pattern (also called a block shape) for these fixed-size blocks (step Sa_2). In other words, the splitting unit 102 further divides the fixed-size blocks into multiple blocks that constitute the selected splitting pattern. Then, the encoding device 100 performs the processing in steps Sa_3 to Sa_9 for each of these multiple blocks (i.e., the block to be encoded). 【0062】 In other words, the prediction processing unit, which consists of all or part of the intra prediction unit 124, the inter prediction unit 126, and the prediction control unit 128, generates a prediction signal (also called a prediction block) for the block to be encoded (also called the current block) (step Sa_3). 【0063】 Next, the subtraction unit 104 generates the difference between the block to be encoded and the predicted block as the predicted residual (also called the difference block) (step Sa_4). 【0064】 Next, the transformation unit 106 and the quantization unit 108 generate multiple quantization coefficients by performing transformation and quantization on the difference block (step Sa_5). A block consisting of multiple quantization coefficients is also called a coefficient block. 【0065】 Next, the entropy coding unit 110 generates an encoded signal by encoding (specifically, entropy coding) its coefficient block and the prediction parameters related to the generation of the prediction signal (step Sa_6). The encoded signal is also called an encoded bitstream, compressed bitstream, or stream. 【0066】 Next, the inverse quantization unit 112 and the inverse transform unit 114 reconstruct multiple predicted residuals (i.e., difference blocks) by performing inverse quantization and inverse transform on the coefficient block (step Sa_7). 【0067】 Next, the adder 116 reconstructs the current block into a reconstructed image (also called a reconstructed block or decoded image block) by adding the predicted block to the restored difference block (step Sa_8). This generates the reconstructed image. 【0068】 Once this reconstructed image is generated, the loop filter unit 120 performs filtering on the reconstructed image as needed (step Sa_9). 【0069】 Then, the encoding device 100 determines whether or not the encoding of the entire picture is complete (step Sa_10). If it determines that it is not complete (No. in step Sa_10), it repeats the process from step Sa_2. 【0070】 In the example described above, the encoding device 100 selects one division pattern for a fixed-size block and encodes each block according to that division pattern. However, it may also encode each block according to multiple division patterns. In this case, the encoding device 100 may evaluate the cost of each of the multiple division patterns and select, for example, the encoded signal obtained by encoding according to the division pattern with the smallest cost as the output encoded signal. 【0071】 As shown in the diagram, these steps Sa_1 to Sa_10 are performed sequentially by the encoding device 100. Alternatively, some of these processes may be performed in parallel, or the order of these processes may be changed. 【0072】 [Divided part] The splitting unit 102 divides each picture contained in the input video into multiple blocks and outputs each block to the subtraction unit 104. For example, the splitting unit 102 first divides the picture into blocks of a fixed size (e.g., 128x128). Other fixed block sizes may be used. These fixed-size blocks are sometimes called coding tree units (CTUs). Then, the splitting unit 102 divides each of the fixed-size blocks into blocks of a variable size (e.g., 64x64 or less) based on, for example, a recursive quadtree and / or binary tree block partitioning. In other words, the splitting unit 102 selects a partitioning pattern. These variable-size blocks are sometimes called coding units (CUs), prediction units (PUs), or transformation units (TUs). Note that in various processing examples, CUs, PUs, and TUs do not need to be distinguished, and some or all of the blocks in the picture may become processing units for CUs, PUs, and TUs. 【0073】 Figure 3 is a conceptual diagram showing an example of block partitioning in the embodiment. In Figure 3, solid lines represent block boundaries due to quadtree block partitioning, and dashed lines represent block boundaries due to binary tree block partitioning. 【0074】 Here, block 10 is a 128x128 pixel square block (128x128 block). This 128x128 block 10 is first divided into four 64x64 square blocks (quadtree block partitioning). 【0075】 The top-left 64x64 block is further divided vertically into two rectangular 32x64 blocks, and the left 32x64 block is further divided vertically into two rectangular 16x64 blocks (binary tree block partitioning). As a result, the top-left 64x64 block is divided into two 16x64 blocks 11 and 12 and a 32x64 block 13. 【0076】 The 64x64 block in the upper right is horizontally divided into two rectangular 64x32 blocks, 14 and 15 (binary tree block division). 【0077】 The bottom-left 64x64 block is divided into four square 32x32 blocks (quadrutree block division). Of the four 32x32 blocks, the top-left and bottom-right blocks are further divided. The top-left 32x32 block is vertically divided into two rectangular 16x32 blocks, and the rightmost 16x32 block is further horizontally divided into two 16x16 blocks (binary tree block division). The bottom-right 32x32 block is horizontally divided into two 32x16 blocks (binary tree block division). As a result, the bottom-left 64x64 block is divided into 16x32 block 16, two 16x16 blocks 17 and 18, two 32x32 blocks 19 and 20, and two 32x16 blocks 21 and 22. 【0078】 The 64x64 block 23 in the bottom right will not be divided. 【0079】 As described above, in Figure 3, block 10 is divided into 13 variable-sized blocks 11-23 based on recursive quad-tree and binary tree block partitioning. Such partitioning is sometimes called QTBT (quad-tree plus binary tree) partitioning. 【0080】 In Figure 3, one block was divided into four or two blocks (quadrutree or binary tree block partitioning), but partitioning is not limited to these. For example, one block may be divided into three blocks (ternary tree block partitioning). Partitioning that includes such ternary tree block partitioning is sometimes called MBT (multi-type tree) partitioning. 【0081】 [Picture composition: slice / tile] To decode pictures in parallel, the pictures may be composed of slice units or tile units. A picture consisting of slice units or tile units may be composed of a division unit 102. 【0082】 A slice is the basic coding unit that makes up a picture. A picture is composed of, for example, one or more slices. A slice consists of one or more consecutive Coding Tree Units (CTUs). 【0083】 Figure 4A is a conceptual diagram showing an example of slice configuration. For example, a picture contains 11 × 8 CTUs and is divided into four slices (slice 1-4). Slice 1 consists of 16 CTUs, slice 2 consists of 21 CTUs, slice 3 consists of 29 CTUs, and slice 4 consists of 22 CTUs. Here, each CTU in the picture belongs to one of the slices. The shape of the slice is the horizontal division of the picture. The boundaries of the slice do not have to be at the edges of the screen, but can be anywhere among the boundaries of the CTUs within the screen. The processing order (encoding order or decoding order) of the CTUs in a slice is, for example, the raster scan order. A slice also contains header information and encoded data. The header information may describe the characteristics of the slice, such as the CTU address at the beginning of the slice and the slice type. 【0084】 A tile is a rectangular area that makes up a picture. Each tile may be assigned a number called a TileId in the order of the raster scan. 【0085】 Figure 4B is a conceptual diagram showing an example of tile configuration. For example, a picture contains 11 × 8 CTUs and is divided into four rectangular tiles (tiles 1-4). When tiles are used, the processing order of CTUs is changed compared to when tiles are not used. When tiles are not used, multiple CTUs in a picture are processed in raster scan order. When tiles are used, in each of the multiple tiles, at least one CTU is processed in raster scan order. For example, as shown in Figure 4B, the processing order of multiple CTUs contained in tile 1 is from the left end of the first row of tile 1 to the right end of the first row of tile 1, and then from the left end of the second row of tile 1 to the right end of the second row of tile 1. 【0086】 Note that one tile may contain one or more slices, and one slice may contain one or more tiles. 【0087】 [Subtraction Unit] The subtraction unit 104 subtracts the predicted signal (predicted samples input from the prediction control unit 128, shown below) from the original signal (original sample) in block units that are input from the division unit 102 and divided by the division unit 102. In other words, the subtraction unit 104 calculates the prediction error (also called residual) of the block to be encoded (hereinafter referred to as the current block). The subtraction unit 104 then outputs the calculated prediction error (residual) to the conversion unit 106. 【0088】 The source signal is the input signal to the encoding device 100, and is a signal representing the image of each picture that makes up the video (for example, a luminance (luma) signal and two chroma (chroma) signals). In the following, the signal representing an image may also be referred to as a sample. 【0089】 [Conversion section] The conversion unit 106 converts the prediction error in the spatial domain into conversion coefficients in the frequency domain and outputs the conversion coefficients to the quantization unit 108. Specifically, the conversion unit 106 performs a predetermined discrete cosine transform (DCT) or discrete sine transform (DST) on the prediction error in the spatial domain, for example. The predetermined DCT or DST may be predetermined. 【0090】 The transformation unit 106 may also adaptively select a transformation type from among several transformation types and use a transformation basis function corresponding to the selected transformation type to convert the prediction error into transformation coefficients. Such a transformation is sometimes called an EMT (explicit multiple core transform) or an AMT (adaptive multiple transform). 【0091】 Multiple transformation types include, for example, DCT-II, DCT-V, DCT-VIII, DST-I, and DST-VII. Figure 5A is a table showing transformation basis functions corresponding to example transformation types. In Figure 5A, N represents the number of input pixels. The selection of a transformation type from among these multiple transformation types may depend, for example, on the type of prediction (intra-prediction and inter-prediction) or on the intra-prediction mode. 【0092】 Information indicating whether or not to apply EMT or AMT (e.g., called an EMT flag or AMT flag) and information indicating the selected conversion type are typically signaled at the CU level. However, the signaling of this information is not limited to the CU level and may be at other levels (e.g., bit sequence level, picture level, slice level, tile level, or CTU level). 【0093】 Furthermore, the transformation unit 106 may retransform the transformation coefficients (transformation results). Such retransformation is sometimes called AST (adaptive secondary transform) or NSST (non-separable secondary transform). For example, the transformation unit 106 performs retransformation for each subblock (e.g., 4x4 subblock) contained in the block of transformation coefficients corresponding to the intra-prediction error. Information indicating whether or not to apply NSST and information regarding the transformation matrix used for NSST are usually signaled at the CU level. However, the signaling of this information is not limited to the CU level and may be at other levels (e.g., sequence level, picture level, slice level, tile level, or CTU level). 【0094】 The transformation unit 106 may be subjected to either a separable transformation or a non-separable transformation. A separable transformation is a method in which the input is separated into directions equal to the number of dimensions and transformed multiple times, while a non-separable transformation is a method in which, when the input is multidimensional, two or more dimensions are treated as one dimension and transformed together. 【0095】 For example, one example of a non-separable transformation is to treat a 4x4 block as a single array with 16 elements and then perform the transformation on that array using a 16x16 transformation matrix. 【0096】 Another example of a non-separable transformation is a transformation (Hypercube Givens Transform) in which a 4x4 input block is treated as a single array with 16 elements, and then multiple Givens rotations are performed on that array. 【0097】 In the conversion unit 106, the type of basis for conversion to the frequency domain can be switched depending on the region within the CU. One example is SVT (Spatially Varying Transform). In SVT, as shown in Figure 5B, the CU is divided into two equal parts horizontally or vertically, and only one of the regions is converted to the frequency domain. The type of conversion basis can be set for each region; for example, DST7 and DCT8 are used. In this example, only one of the two regions within the CU is converted, and the other is not, but both regions may also be converted. Furthermore, the division method can be made more flexible, not only by dividing into two equal parts, but also by dividing into four equal parts, or by separately encoding information indicating the division and signaling it in the same way as CU division. Note that SVT is sometimes called SBT (Sub-block Transform). 【0098】 [Quantization section] The quantization unit 108 quantizes the conversion coefficients output from the conversion unit 106. Specifically, the quantization unit 108 scans the conversion coefficients of the current block in a predetermined scan order and quantizes the conversion coefficients based on the quantization parameter (QP) corresponding to the scanned conversion coefficients. The quantization unit 108 then outputs the quantized conversion coefficients of the current block (hereinafter referred to as quantization coefficients) to the entropy coding unit 110 and the inverse quantization unit 112. The predetermined scan order may be set in advance. 【0099】 A predetermined scan order is the order for quantization / inverse quantization of the conversion coefficients. For example, a predetermined scan order may be defined as ascending frequency (from low to high frequency) or descending frequency (from high to low frequency). 【0100】 The quantization parameter (QP) is a parameter that defines the quantization step (quantization width). For example, if the value of the quantization parameter increases, the quantization step also increases. In other words, if the value of the quantization parameter increases, the quantization error increases. 【0101】 Furthermore, quantization matrices may be used for quantization. For example, several types of quantization matrices may be used corresponding to frequency conversion sizes such as 4x4 and 8x8, prediction modes such as intra-prediction and inter-prediction, and pixel components such as luminance and chrominance. Note that quantization refers to the process of digitizing values ​​sampled at predetermined intervals and associating them with predetermined levels. In this technical field, it may also be referred to using other expressions such as rounding, scaling, and rounding, or rounding, rounding, and scaling may be employed. The predetermined intervals and levels may be predetermined. 【0102】 There are two methods for using quantization matrices: using a quantization matrix directly set on the encoding device, and using a default quantization matrix (default matrix). By directly setting the quantization matrix on the encoding device, it is possible to set a quantization matrix that corresponds to the image features. However, in this case, there is a disadvantage that the amount of code increases due to the encoding of the quantization matrix. 【0103】 On the other hand, there is also a method that does not use a quantization matrix, and quantizes both the high-frequency and low-frequency components in the same way. This method is equivalent to using a quantization matrix where all coefficients have the same value (a flat matrix). 【0104】 The quantization matrix may be specified, for example, as an SPS (Sequence Parameter Set) or a PPS (Picture Parameter Set). An SPS contains the parameters used for the sequence, and a PPS contains the parameters used for the picture. SPS and PPS are sometimes simply referred to as parameter sets. 【0105】 [Entropy coding unit] The entropy coding unit 110 generates an encoded signal (encoded bitstream) based on the quantization coefficients input from the quantization unit 108. Specifically, the entropy coding unit 110, for example, binarizes the quantization coefficients, arithmetically encodes the binary signal, and outputs a compressed bitstream or sequence. 【0106】 [Dequantization section] The inverse quantization unit 112 inversely quantizes the quantization coefficients input from the quantization unit 108. Specifically, the inverse quantization unit 112 inversely quantizes the quantization coefficients of the current block in a predetermined scanning order. Then, the inverse quantization unit 112 outputs the inversely quantized conversion coefficients of the current block to the inverse conversion unit 114. The predetermined scanning order may be set in advance. 【0107】 [Inverse Transformation Section] The inverse transform unit 114 restores the prediction error (residual) by performing an inverse transform on the transformation coefficients input from the inverse quantization unit 112. Specifically, the inverse transform unit 114 restores the prediction error of the current block by performing an inverse transform on the transformation coefficients corresponding to the transformation by the transformation unit 106. The inverse transform unit 114 then outputs the restored prediction error to the adder unit 116. 【0108】 Furthermore, the recovered prediction error usually does not match the prediction error calculated by the subtraction unit 104 because information is typically lost due to quantization. In other words, the recovered prediction error usually includes quantization errors. 【0109】 [Addition section] The adder 116 reconstructs the current block by adding the prediction error input from the inverse transformer 114 and the prediction sample input from the prediction control unit 128. The adder 116 then outputs the reconstructed block to the block memory 118 and the loop filter unit 120. The reconstructed block is sometimes called the local decoded block. 【0110】 [Block memory] The block memory 118 is a storage unit for storing blocks within the encoded picture (referred to as the current picture) that are referenced in intra prediction, for example. Specifically, the block memory 118 stores the reconstructed blocks output from the adder 116. 【0111】 [Frame memory] The frame memory 122 is a storage unit for storing reference pictures used, for example, for interpretation, and is sometimes called a frame buffer. Specifically, the frame memory 122 stores the reconstructed blocks filtered by the loop filter unit 120. 【0112】 [Loop Filter Section] The loop filter unit 120 applies a loop filter to the block reconstructed by the adder unit 116 and outputs the filtered reconstructed block to the frame memory 122. A loop filter is a filter used within the encoding loop (in-loop filter), and includes, for example, a deblocking filter (DF or DBF), sample adaptive offset (SAO), and adaptive loop filter (ALF). 【0113】 In ALF, a least-squares error filter is applied to remove coding distortion. For example, for each 2x2 subblock within the current block, one filter selected from several filters is applied based on the direction and activity of the local gradient. 【0114】 Specifically, first, subblocks (e.g., 2x2 subblocks) are classified into multiple classes (e.g., 15 or 25 classes). The classification of subblocks is based on the direction and activity of the gradient. For example, a classification value C (e.g., C = 5D + A) is calculated using the gradient direction value D (e.g., 0-2 or 0-4) and the gradient activity value A (e.g., 0-4). Then, based on the classification value C, the subblocks are classified into multiple classes. 【0115】 The gradient direction value D is derived, for example, by comparing gradients in multiple directions (e.g., horizontal, vertical, and two diagonal directions). The gradient activation value A is derived, for example, by adding the gradients in multiple directions and quantizing the sum. 【0116】 Based on the results of this classification, a filter for the subblock is determined from among multiple filters. 【0117】 For example, a circularly symmetric shape is used as the filter shape in ALF. Figures 6A to 6C show several examples of filter shapes used in ALF. Figure 6A shows a 5x5 diamond-shaped filter, Figure 6B shows a 7x7 diamond-shaped filter, and Figure 6C shows a 9x9 diamond-shaped filter. Information indicating the filter shape is usually signaled at the picture level. However, the signaling of information indicating the filter shape is not limited to the picture level and may be at other levels (e.g., sequence level, slice level, tile level, CTU level, or CU level). 【0118】 The on / off status of ALF may be determined, for example, at the picture level or CU level. For example, the decision to apply ALF to luminance may be made at the CU level, and the decision to apply ALF to color difference may be made at the picture level. Information indicating whether ALF is on or off is usually signaled at the picture level or CU level. However, the signaling of information indicating whether ALF is on or off is not limited to the picture level or CU level, but may be at other levels (e.g., sequence level, slice level, tile level, or CTU level). 【0119】 The coefficient sets for multiple selectable filters (e.g., up to 15 or 25 filters) are typically signaled at the picture level. However, signaling of the coefficient sets is not limited to the picture level; it may be at other levels (e.g., sequence level, slice level, tile level, CTU level, CU level, or subblock level). 【0120】 [Loop Filter Section > Deblocking Filter] In a deblocking filter, the loop filter section 120 reduces distortion at block boundaries by applying a filter to the block boundaries of the reconstructed image. 【0121】 Figure 7 is a block diagram showing an example of a detailed configuration of the loop filter section 120, which functions as a deblocking filter. 【0122】 The loop filter unit 120 includes a boundary determination unit 1201, a filter determination unit 1203, a filter processing unit 1205, a processing determination unit 1208, a filter characteristic determination unit 1207, and switches 1202, 1204, and 1206. 【0123】 The boundary determination unit 1201 determines whether or not a pixel to be deblocked and filtered (i.e., a target pixel) is located near a block boundary. The boundary determination unit 1201 then outputs the determination result to the switch 1202 and the processing determination unit 1208. 【0124】 If the boundary determination unit 1201 determines that the target pixel is located near a block boundary, switch 1202 outputs the image before filtering to switch 1204. Conversely, if the boundary determination unit 1201 determines that the target pixel is not located near a block boundary, switch 1202 outputs the image before filtering to switch 1206. 【0125】 The filter determination unit 1203 determines whether or not to perform a deblocking filter on the target pixel based on the pixel values ​​of at least one surrounding pixel located around the target pixel. The filter determination unit 1203 then outputs the determination result to the switch 1204 and the processing determination unit 1208. 【0126】 If the filter determination unit 1203 determines that deblocking filtering should be performed on the target pixel, switch 1204 outputs the pre-filtered image acquired via switch 1202 to the filter processing unit 1205. Conversely, if the filter determination unit 1203 determines that deblocking filtering should not be performed on the target pixel, switch 1204 outputs the pre-filtered image acquired via switch 1202 to switch 1206. 【0127】 When the filter processing unit 1205 acquires an image before filtering via switches 1202 and 1204, it performs a deblocking filter process on the target pixel, using the filter characteristics determined by the filter characteristic determination unit 1207. The filter processing unit 1205 then outputs the filtered pixel to switch 1206. 【0128】 Switch 1206 selectively outputs pixels that have not undergone deblocking and filtering, and pixels that have undergone deblocking and filtering by the filtering processing unit 1205, in accordance with the control by the processing determination unit 1208. 【0129】 The processing determination unit 1208 controls the switch 1206 based on the determination results of the boundary determination unit 1201 and the filter determination unit 1203. Specifically, if the boundary determination unit 1201 determines that a target pixel is near a block boundary, and the filter determination unit 1203 determines that the target pixel should undergo deblocking and filtering, the processing determination unit 1208 outputs the deblocked and filtered pixel from the switch 1206. In all other cases, the processing determination unit 1208 outputs the undeblocked and unfiltered pixel from the switch 1206. This output of pixels is repeated, resulting in the filtered image being output from the switch 1206. 【0130】 Figure 8 is a conceptual diagram showing an example of a deblocking filter with symmetrical filter characteristics with respect to block boundaries. 【0131】 In deblocking filtering, for example, one of two deblocking filters with different characteristics, namely a strong filter and a weak filter, is selected using pixel values ​​and quantization parameters. In the strong filter, as shown in Figure 8, if pixels p0~p2 and pixels q0~q2 exist on either side of a block boundary, the respective pixel values ​​of pixels q0~q2 are changed to pixel values ​​q'0~q'2 by performing an operation shown in the following equation, for example. 【0132】 q'0=(p1+2×p0+2×q0+2×q1+q2+4) / 8 q'1=(p0+q0+q1+q2+2) / 4 q'2=(p0+q0+q1+3×q2+2×q3+4) / 8 【0133】 In the above equations, p0~p2 and q0~q2 are the pixel values ​​of pixels p0~p2 and pixels q0~q2, respectively. Also, q3 is the pixel value of pixel q3, which is adjacent to pixel q2 on the opposite side of the block boundary. Furthermore, the coefficient multiplied by the pixel value of each pixel used in the deblocking filter process on the right-hand side of each of the above equations is the filter coefficient. 【0134】 Furthermore, in the deblocking filter process, clipping may be performed to ensure that the calculated pixel values ​​do not exceed a threshold. In this clipping process, the calculated pixel values ​​according to the above formula are clipped to "calculated pixel value ± 2 × threshold" using a threshold determined from the quantization parameters. This prevents excessive smoothing. 【0135】 Figure 9 is a conceptual diagram illustrating the block boundaries where deblocking filtering is performed. Figure 10 is a conceptual diagram showing an example of a Bs value. 【0136】 The block boundaries on which deblocking filtering is performed are, for example, the boundaries of the PU (Prediction Unit) or TU (Transform Unit) of an 8x8 pixel block, as shown in Figure 9. Deblocking filtering can be performed in units of 4 rows or 4 columns. First, for blocks P and Q shown in Figure 9, the Bs (Boundary Strength) value is determined as shown in Figure 10. 【0137】 According to the Bs value in Figure 10, it is determined whether or not to perform deblocking filtering of different strengths, even for block boundaries belonging to the same image. Deblocking filtering is performed on the color difference signal when the Bs value is 2. Deblocking filtering is performed on the luminance signal when the Bs value is 1 or greater and predetermined conditions are met. These predetermined conditions may be set in advance. Note that the criteria for determining the Bs value are not limited to those shown in Figure 10 and may be determined based on other parameters. 【0138】 [Prediction Processing Unit (Intra Prediction Unit, Inter Prediction Unit, Prediction Control Unit)] Figure 11 is a flowchart showing an example of processing performed in the prediction processing unit of the encoding device 100. The prediction processing unit consists of all or some of the components of the intra-prediction unit 124, the inter-prediction unit 126, and the prediction control unit 128. 【0139】 The prediction processing unit generates a predicted image of the current block (step Sb_1). This predicted image is also called a predicted signal or predicted block. Predicted signals include, for example, intra-predicted signals or inter-predicted signals. Specifically, the prediction processing unit generates a predicted image of the current block using the reconstructed image already obtained by generating predicted blocks, difference blocks, coefficient blocks, difference blocks, and decoded image blocks. 【0140】 The reconstructed image may be, for example, the image of the reference picture, or it may be the image of the encoded block within the current picture, which is the picture containing the current block. The encoded block within the current picture may be, for example, the adjacent block of the current block. 【0141】 Figure 12 is a flowchart showing another example of processing performed in the prediction processing unit of the encoding device 100. 【0142】 The prediction processing unit generates a predicted image using a first method (step Sc_1a), a second method (step Sc_1b), and a third method (step Sc_1c). The first, second, and third methods are different methods for generating predicted images, and may be, for example, an interpretation method, an intraprediction method, and other prediction methods. These prediction methods may use the reconstructed images described above. 【0143】 Next, the prediction processing unit selects one of the multiple prediction images generated in steps Sc_1a, Sc_1b, and Sc_1c (step Sc_2). This selection of a prediction image, i.e., the selection of a method or mode to obtain the final prediction image, may be based on the cost of each generated prediction image. Alternatively, the selection of the prediction image may be based on the parameters used in the coding process. The coding device 100 may signal information to identify the selected prediction image, method, or mode into a coded signal (also called a coded bitstream). This information may be, for example, a flag. This allows the decoding device to generate a prediction image according to the method or mode selected by the coding device 100 based on this information. In the example shown in Figure 12, the prediction processing unit selects one of the prediction images after generating prediction images for each method. However, the prediction processing unit may select a method or mode based on the parameters used in the coding process described above before generating those prediction images, and then generate the prediction image according to that method or mode. 【0144】 For example, the first and second methods are intra-prediction and inter-prediction, respectively, and the prediction processing unit may select the final predicted image for the current block from the predicted images generated according to these prediction methods. 【0145】 Figure 13 is a flowchart showing another example of processing performed in the prediction processing unit of the encoding device 100. 【0146】 First, the prediction processing unit generates a predicted image using intra-prediction (step Sd_1a), and then generates a predicted image using inter-prediction (step Sd_1b). The predicted image generated by intra-prediction is also called the intra-prediction image, and the predicted image generated by inter-prediction is also called the inter-prediction image. 【0147】 Next, the prediction processing unit evaluates the intra-predicted image and the inter-predicted image (step Sd_2). Cost may be used in this evaluation. That is, the prediction processing unit calculates the cost C of the intra-predicted image and the inter-predicted image. This cost C can be calculated using the formula of the RD optimization model, for example, C = D + λ × R. In this formula, D is the coding distortion of the predicted image, which can be expressed as, for example, the sum of the absolute differences between the pixel values ​​of the current block and the pixel values ​​of the predicted image. R is the generated code amount of the predicted image, which specifically is the code amount required to encode motion information and other data for generating the predicted image. λ is, for example, a Lagrange multiplier. 【0148】 The prediction processing unit then selects the prediction image with the smallest cost C from the intra-predicted image and inter-predicted image as the final prediction image for the current block (step Sd_3). In other words, a prediction method or mode for generating the prediction image for the current block is selected. 【0149】 [Intra Prediction Unit] The intra-prediction unit 124 generates a prediction signal (intra-prediction signal) by performing intra-prediction (also called in-screen prediction) of the current block by referring to the block in the current picture stored in the block memory 118. Specifically, the intra-prediction unit 124 generates an intra-prediction signal by performing intra-prediction by referring to samples (e.g., luminance values, color difference values) of blocks adjacent to the current block, and outputs the intra-prediction signal to the prediction control unit 128. 【0150】 For example, the intra-prediction unit 124 performs intra-prediction using one of a predetermined set of intra-prediction modes. The set of intra-prediction modes typically includes one or more non-directional prediction modes and multiple directional prediction modes. The predetermined set of modes may be predetermined. 【0151】 One or more non-directional prediction modes include, for example, the Planar prediction mode and DC prediction mode as defined in the H.265 / HEVC standard. 【0152】 Multiple directional prediction modes include, for example, the 33 directional prediction modes defined in the H.265 / HEVC standard. Note that multiple directional prediction modes may also include 32 additional directional prediction modes (a total of 65 directional prediction modes). Figure 14 is a conceptual diagram showing all 67 intra-prediction modes (2 non-directional prediction modes and 65 directional prediction modes) that can be used in intra-prediction. Solid arrows represent the 33 directions defined in the H.265 / HEVC standard, and dashed arrows represent the additional 32 directions (the 2 non-directional prediction modes are not shown in Figure 14). 【0153】 In various processing examples, luminance blocks may be referenced in the intra-prediction of chrominance blocks. That is, the chrominance components of the current block may be predicted based on the luminance components of the current block. Such intra-prediction is sometimes called CCLM (cross-component linear model) prediction. Such an intra-prediction mode for chrominance blocks that references luminance blocks (e.g., called CCLM mode) may be added as one of the intra-prediction modes for chrominance blocks. 【0154】 The intra-prediction unit 124 may correct the pixel values ​​after intra-prediction based on the gradient of the horizontal / vertical reference pixels. Intra-prediction with such correction is sometimes called PDPC (position dependent intra-prediction combination). Information indicating whether or not PDPC is applied (for example, called a PDPC flag) is usually signaled at the CU level. However, the signaling of this information is not limited to the CU level and may be at other levels (for example, sequence level, picture level, slice level, tile level, or CTU level). 【0155】 [International Prediction Department] The inter-prediction unit 126 generates a prediction signal (inter-prediction signal) by performing inter-prediction (also called inter-screen prediction) of the current block by referring to a reference picture stored in the frame memory 122 that is different from the current picture. Inter-prediction is performed in units of the current block or the current sub-block within the current block (e.g., a 4x4 block). For example, the inter-prediction unit 126 performs motion estimation within the reference picture for the current block or current sub-block and finds the reference block or sub-block that best matches that current block or current sub-block. Then, the inter-prediction unit 126 obtains motion information (e.g., a motion vector) that compensates for the movement or change from the reference block or sub-block to the current block or sub-block. Based on that motion information, the inter-prediction unit 126 performs motion compensation (or motion prediction) and generates an inter-prediction signal for the current block or sub-block. The inter-prediction unit 126 outputs the generated inter-prediction signal to the prediction control unit 128. 【0156】 The motion information used for motion compensation may be signaled as an interpretation signal in various forms. For example, the motion vector may be signaled. As another example, the difference between the motion vector and the predicted motion vector (motion vector predictor) may be signaled. 【0157】 [Basic flow of interpretation] Figure 15 is a flowchart illustrating an example of the basic flow of interpretation prediction. 【0158】 The interpretation unit 126 first generates a predicted image (steps Se_1 to Se_3). Next, the subtraction unit 104 generates the difference between the current block and the predicted image as the predicted residual (step Se_4). 【0159】 Here, the interpretation unit 126 generates a predicted image by determining the motion vector (MV) of the current block (steps Se_1 and Se_2) and performing motion compensation (step Se_3). The interpretation unit 126 also determines the MV by selecting a candidate motion vector (candidate MV) (step Se_1) and deriving the MV (step Se_2). The selection of a candidate MV is performed, for example, by selecting at least one candidate MV from a list of candidate MVs. In the derivation of the MV, the interpretation unit 126 may determine the selected at least one candidate MV as the MV of the current block by further selecting at least one candidate MV from the at least one candidate MV. Alternatively, the interpretation unit 126 may determine the MV of the current block by searching the region of the reference picture indicated by each of the selected at least one candidate MVs. This search of the region of the reference picture may be called motion estimation. 【0160】 Furthermore, in the example described above, steps Se_1 to Se_3 are performed by the interpretation unit 126, but processing such as step Se_1 or step Se_2 may be performed by other components included in the encoding device 100. 【0161】 [Flowchart for deriving motion vectors] Figure 16 is a flowchart showing an example of motion vector derivation. 【0162】 The interpretation unit 126 derives the MV of the current block in a mode that encodes motion information (e.g., MV). In this case, for example, motion information is encoded as prediction parameters and converted into a signal. That is, the encoded motion information is included in the encoded signal (also called an encoded bitstream). 【0163】 Alternatively, the interpretation unit 126 derives MV in a mode that does not encode motion information. In this case, motion information is not included in the encoded signal. 【0164】 Here, the modes for MV derivation may include the normal intermode, merge mode, FRUC mode, and affine mode, as described later. Among these modes, the modes that encode motion information include the normal intermode, merge mode, and affine mode (specifically, the affine intermode and affine merge mode). Note that the motion information may include not only the MV but also the predicted motion vector selection information, as described later. Modes that do not encode motion information include the FRUC mode, etc. The interpretation unit 126 selects a mode from these multiple modes for deriving the MV of the current block and derives the MV of the current block using the selected mode. 【0165】 Figure 17 is a flowchart showing another example of motion vector derivation. 【0166】 The interpretation unit 126 derives the MV of the current block in a mode that encodes the differential MV. In this case, for example, the differential MV is encoded as a prediction parameter and converted into a signal. That is, the encoded differential MV is included in the encoded signal. This differential MV is the difference between the MV of the current block and its predicted MV. 【0167】 Alternatively, the interpretation unit 126 derives MV in a mode that does not encode the differential MV. In this case, the encoded differential MV is not included in the encoded signal. 【0168】 As mentioned above, the modes for MV derivation include the normal inter, merge mode, FRUC mode, and affine mode, which will be described later. Of these modes, the modes that encode differential MV include the normal inter mode and affine mode (specifically, affine inter mode). Modes that do not encode differential MV include the FRUC mode, merge mode, and affine mode (specifically, affine merge mode). The inter prediction unit 126 selects a mode from these multiple modes to derive the MV of the current block, and uses the selected mode to derive the MV of the current block. 【0169】 [Flowchart for deriving motion vectors] Figure 18 is a flowchart illustrating another example of motion vector derivation. There are several modes for MV derivation, i.e., interpretation modes, which can be broadly divided into modes that encode differential MVs and modes that do not encode differential motion vectors. Modes that do not encode differential MVs include merge mode, FRUC mode, and affine mode (specifically, affine merge mode). Details of these modes will be described later, but simply put, merge mode derives the MV of the current block by selecting motion vectors from surrounding encoded blocks, and FRUC mode derives the MV of the current block by performing a search between encoded regions. Affine mode assumes an affine transformation and derives the motion vectors of each of the multiple subblocks that make up the current block as the MV of the current block. 【0170】 Specifically, as shown in the figure, the interpretation unit 126 derives the motion vector by merge mode (Sf_2) when the interpretation mode information indicates 0 (0 in Sf_1). The interpretation unit 126 also derives the motion vector by FRUC mode (Sf_3) when the interpretation mode information indicates 1 (1 in Sf_1). The interpretation unit 126 also derives the motion vector by affine mode (specifically, affine merge mode) when the interpretation mode information indicates 2 (2 in Sf_1) (Sf_4). The interpretation unit 126 also derives the motion vector by a mode that encodes the difference MV (for example, normal intermode) when the interpretation mode information indicates 3 (3 in Sf_1) (Sf_5). 【0171】 [MV Derivation > Normal Intermode] The normal intermode is an interpretation mode that derives the MV of the current block based on blocks similar to the image of the current block, using the region of the reference picture indicated by the candidate MV. In this normal intermode, the differential MV is also encoded. 【0172】 Figure 19 is a flowchart showing an example of inter-mode prediction. 【0173】 The interpretation unit 126 first obtains multiple candidate MVs for the current block based on information such as the MVs of multiple encoded blocks surrounding the current block in time or space (step Sg_1). In other words, the interpretation unit 126 creates a candidate MV list. 【0174】 Next, the interpretation unit 126 extracts N candidate MVs (where N is an integer greater than or equal to 2) from among the multiple candidate MVs obtained in step Sg_1 as predicted motion vector candidates (also called predicted MV candidates) according to a predetermined priority order (step Sg_2). Note that this priority order may be predetermined for each of the N candidate MVs. 【0175】 Next, the interpretation unit 126 selects one of the N predicted motion vector candidates as the predicted motion vector (also called predicted MV) for the current block (step Sg_3). At this time, the interpretation unit 126 encodes the predicted motion vector selection information for identifying the selected predicted motion vector into a stream. The stream is the encoded signal or encoded bitstream described above. 【0176】 Next, the interpretation unit 126 refers to the encoded reference picture and derives the MV of the current block (step Sg_4). At this time, the interpretation unit 126 further encodes the difference between the derived MV and the predicted motion vector as the difference MV into the stream. The encoded reference picture is a picture consisting of multiple blocks that have been reconstructed after encoding. 【0177】 Finally, the interpretation unit 126 generates a predicted image of the current block by performing motion compensation on the current block using the derived MV and the encoded reference picture (step Sg_5). The predicted image is the interpretation signal described above. 【0178】 Furthermore, information indicating the interprediction mode used to generate the predicted image (the normal intermode in the example above), which is included in the encoded signal, is encoded, for example, as a prediction parameter. 【0179】 The candidate MV list may be the same as the list used in other modes. Furthermore, processing related to the candidate MV list may be applied to processing related to lists used in other modes. This processing related to the candidate MV list may include, for example, extracting or selecting candidate MVs from the candidate MV list, rearranging candidate MVs, or deleting candidate MVs. 【0180】 [MV Derivation > Merge Mode] Merge mode is an interpretation mode that derives an MV by selecting a candidate MV from a list of candidate MVs as the MV of the current block. 【0181】 Figure 20 is a flowchart showing an example of interpretation using merge mode. 【0182】 The interpretation unit 126 first obtains multiple candidate MVs for the current block based on information such as the MVs of multiple encoded blocks surrounding the current block in time or space (step Sh_1). In other words, the interpretation unit 126 creates a candidate MV list. 【0183】 Next, the interpretation unit 126 derives the MV of the current block by selecting one candidate MV from among the multiple candidate MVs obtained in step Sh_1 (step Sh_2). At this time, the interpretation unit 126 encodes MV selection information to identify the selected candidate MV into a stream. 【0184】 Finally, the interpretation unit 126 generates a predicted image of the current block by performing motion compensation on the current block using the derived MV and the encoded reference picture (step Sh_3). 【0185】 Furthermore, information indicating the inter-prediction mode (the merge mode in the example above) used to generate the predicted image, which is included in the encoded signal, is encoded, for example, as a prediction parameter. 【0186】 Figure 21 is a conceptual diagram illustrating an example of the process of deriving the motion vector of the current picture using merge mode. 【0187】 First, a list of predicted MVs is generated, containing registered candidates for predicted MVs. Candidates for predicted MVs include spatially adjacent predicted MVs, which are the MVs of multiple encoded blocks located spatially around the target block; temporally adjacent predicted MVs, which are the MVs of nearby blocks projected onto the target block's position in the encoded reference picture; combined predicted MVs, which are generated by combining the MV values ​​of spatially adjacent predicted MVs and temporally adjacent predicted MVs; and zero predicted MVs, which are MVs with a value of zero. 【0188】 Next, one predicted MV is selected from the multiple predicted MVs registered in the predicted MV list to determine it as the MV for the target block. 【0189】 Furthermore, the variable-length coding unit encodes the merge_idx signal, which indicates which predicted MV was selected, by writing it to a stream. 【0190】 Note that the predicted MVs registered in the predicted MV list explained in Figure 21 are just examples, and the number of predicted MVs may differ from the number shown in the figure, the configuration may not include some of the types of predicted MVs shown in the figure, or it may include predicted MVs other than those shown in the figure. 【0191】 The final MV may be determined by performing the DMVR (decoder motion vector refinement) process described later, using the MV of the target block derived by merge mode. 【0192】 The candidates for the predicted MV are the candidate MVs mentioned above, and the predicted MV list is the candidate MV list mentioned above. The candidate MV list may also be referred to as the candidate list. Furthermore, merge_idx is the MV selection information. 【0193】 [MV Derivation > FRUC Mode] Motion information may be derived on the decoding side without being signaled from the encoding side. As mentioned above, the merge mode specified in the H.265 / HEVC standard may be used. Alternatively, motion information may be derived by performing motion search on the decoding side, for example. In this embodiment, motion search is performed on the decoding side without using the pixel values ​​of the current block. 【0194】 Here, we will explain the mode in which motion detection is performed on the decoding device side. This mode in which motion detection is performed on the decoding device side is sometimes called PMMVD (pattern matched motion vector derivation) mode or FRUC (frame rate up-conversion) mode. 【0195】 An example of FRUC processing is shown in flowchart form in Figure 22. First, a list of multiple candidates (i.e., a candidate MV list, which may be the same as the merge list) is generated by referencing the motion vectors of encoded blocks spatially or temporally adjacent to the current block, each having a predicted motion vector (MV) (step Si_1). Next, the best candidate MV is selected from the multiple candidate MVs registered in the candidate MV list (step Si_2). For example, an evaluation value is calculated for each candidate MV included in the candidate MV list, and one candidate MV is selected based on the evaluation value. Then, a motion vector for the current block is derived based on the motion vector of the selected candidate (step Si_4). Specifically, for example, the motion vector of the selected candidate (best candidate MV) is directly derived as the motion vector for the current block. Alternatively, for example, the motion vector for the current block may be derived by performing pattern matching in the area surrounding the position in the reference picture corresponding to the motion vector of the selected candidate. In other words, a search is performed in the area surrounding the best candidate MV using pattern matching and evaluation values ​​in the reference picture. If an MV with a better evaluation value is found, the best candidate MV may be updated to that MV and set as the final MV for the current block. It is also possible to configure the system so that it does not perform the process of updating to an MV with a better evaluation value. 【0196】 Finally, the interpretation unit 126 generates a predicted image of the current block by performing motion compensation on the current block using the derived MV and the encoded reference picture (step Si_5). 【0197】 The same processing method can be used when processing at the sub-block level. 【0198】 The evaluation value may be calculated by various methods. For example, the reconstructed image of a region in a reference picture corresponding to a motion vector may be compared with the reconstructed image of a predetermined region (which may be, for example, a region in another reference picture or a region in an adjacent block of the current picture, as shown below). The predetermined region may be set in advance. 【0199】 Furthermore, the difference in pixel values ​​between the two reconstructed images may be calculated and used as the evaluation value for the motion vector. Alternatively, the evaluation value may be calculated using other information in addition to the difference value. 【0200】 Next, we will explain in detail an example of pattern matching. First, one candidate MV included in the candidate MV list (e.g., merge list) is selected as the starting point for the search using pattern matching. For example, first pattern matching or second pattern matching may be used. First pattern matching and second pattern matching are sometimes called bilateral matching and template matching, respectively. 【0201】 [MV Derivation > FRUC > Bilateral Matching] In the first pattern matching, pattern matching is performed between two blocks in two different reference pictures that are aligned with the motion trajectory of the current block. Therefore, in the first pattern matching, a region in another reference picture aligned with the motion trajectory of the current block is used as a predetermined region for calculating the evaluation value of the candidate described above. This predetermined region may be set in advance. 【0202】 Figure 23 is a conceptual diagram illustrating an example of first pattern matching (bilateral matching) between two blocks in two reference pictures along a motion trajectory. As shown in Figure 23, in first pattern matching, two motion vectors (MV0, MV1) are derived by searching for the most matching pair among two pairs of blocks in two different reference pictures (Ref0, Ref1) that are along the motion trajectory of the current block. Specifically, for the current block, the difference between the reconstructed image at a specified position in the first encoded reference picture (Ref0) specified by the candidate MV and the reconstructed image at a specified position in the second encoded reference picture (Ref1) specified by a symmetric MV scaled by the display time interval of the candidate MV is derived, and an evaluation value is calculated using the obtained difference value. It is possible to select the candidate MV with the best evaluation value among multiple candidate MVs as the final MV, which can yield good results. 【0203】 Under the assumption of a continuous motion trajectory, the motion vector (MV0, MV1) pointing to two reference blocks is proportional to the temporal distance (TD0, TD1) between the current picture (Cur Pic) and the two reference pictures (Ref0, Ref1). For example, if the current picture is temporally located between the two reference pictures and the temporal distances from the current picture to the two reference pictures are equal, then the first pattern matching derives a mirror-symmetric bidirectional motion vector. 【0204】 [MV Derivation > FRUC > Template Matching] In the second pattern matching (template matching), pattern matching is performed between the template in the current picture (blocks adjacent to the current block in the current picture (e.g., blocks above and / or to the left)) and the blocks in the reference picture. Therefore, in the second pattern matching, the blocks adjacent to the current block in the current picture are used as a predetermined area for calculating the evaluation value of the candidates mentioned above. 【0205】 Figure 24 is a conceptual diagram illustrating an example of pattern matching (template matching) between a template in the current picture and a block in the reference picture. As shown in Figure 24, in the second pattern matching, the motion vector of the current block is derived by searching in the reference picture (Ref0) for the block that best matches the block adjacent to the current block in the current picture (Cur Pic). Specifically, for the current block, the difference between the reconstructed image of both or either of the left-adjacent and top-adjacent encoded regions and the reconstructed image at the equivalent position in the encoded reference picture (Ref0) specified by the candidate MV is derived, and an evaluation value is calculated using the obtained difference value. Among the multiple candidate MVs, the candidate MV with the best evaluation value is selected as the best candidate MV. 【0206】 Information indicating whether or not to apply such a FRUC mode (e.g., called a FRUC flag) may be signaled at the CU level. Furthermore, if FRUC mode is applied (e.g., the FRUC flag is true), information indicating the applicable pattern matching method (first pattern matching or second pattern matching) may be signaled at the CU level. Note that the signaling of this information is not limited to the CU level, but may be at other levels (e.g., sequence level, picture level, slice level, tile level, CTU level, or subblock level). 【0207】 [MV Derivation > Affine Mode] Next, we will describe an affine mode in which motion vectors are derived at the sub-block level based on the motion vectors of multiple adjacent blocks. This mode is sometimes called the affine motion compensation prediction mode. 【0208】 Figure 25A is a conceptual diagram illustrating an example of deriving a subblock-level motion vector based on the motion vectors of multiple adjacent blocks. In Figure 25A, the current block contains 16 4x4 subblocks. Here, the motion vector v0 of the upper left corner control point of the current block is derived based on the motion vectors of the adjacent blocks, and similarly, the motion vector v1 of the upper right corner control point of the current block is derived based on the motion vectors of the adjacent subblocks. Then, the two motion vectors v0 and v1 may be projected by the following equation (1A), and the motion vector (v) of each subblock within the current block is derived. x ,v y ) may be derived. 【0209】 【number】 【0210】 Here, x and y represent the horizontal and vertical positions of the subblock, respectively, and w represents a predetermined weighting coefficient. The predetermined weighting coefficient may be determined in advance. 【0211】 Information indicating such affine modes (e.g., called an affine flag) may be signaled at the CU level. However, the signaling of this information indicating affine modes is not limited to the CU level, but may be at other levels (e.g., sequence level, picture level, slice level, tile level, CTU level, or subblock level). 【0212】 Furthermore, such affine modes may include several modes in which the method of deriving the motion vectors of the upper-left and upper-right corner control points differs. For example, there are two affine modes: the affine inter (also called the affine normal inter) mode and the affine merge mode. 【0213】 [MV Derivation > Affine Mode] FIG. 25B is a conceptual diagram for explaining an example of deriving motion vectors of sub-block units in an affine mode having three control points. In FIG. 25B, the current block includes 16 4x4 sub-blocks. Here, the motion vector v0 of the upper left control point of the current block is derived based on the motion vectors of adjacent blocks. Similarly, the motion vector v1 of the upper right control point of the current block and the motion vector v2 of the lower left control point of the current block are derived based on the motion vectors of adjacent blocks. Then, the three motion vectors v0, v1, and v2 may be projected according to the following equation (1B), and the motion vectors (v x , v y ) of each sub-block within the current block may be derived. 【0214】 [Number] 【0215】 Here, x and y respectively indicate the horizontal position and vertical position of the sub-block center, w indicates the width of the current block, and h indicates the height of the current block. 【0216】 The affine modes with different numbers of control points (for example, two and three) may be switched and signaled at the CU level. Note that the information indicating the number of control points of the affine mode used at the CU level may be signaled at other levels (for example, sequence level, picture level, slice level, tile level, CTU level or sub-block level). 【0217】 Also, in such an affine mode having three control points, it may include several modes with different methods for deriving the motion vectors of the upper left, upper right, and lower left control points. For example, the affine mode includes two modes: the affine inter (also called affine normal inter) mode and the affine merge mode. 【0218】 [MV Derivation > Affine Merge Mode] Figures 26A, 26B, and 26C are conceptual diagrams for explaining the affine merge mode. 【0219】 In the affine merge mode, as shown in Figure 26A, for example, among the encoded blocks A (left), B (above), C (upper right), D (lower left), and E (upper left) adjacent to the current block, a plurality of prediction motion vectors of the control points of the current block are calculated based on the motion vectors corresponding to the blocks encoded in the affine mode. Specifically, these blocks are inspected in the order of encoded block A (left), block B (above), block C (upper right), block D (lower left), and block E (upper left), and the first valid block encoded in the affine mode is identified. Based on the plurality of motion vectors corresponding to this identified block, the prediction motion vectors of the control points of the current block are calculated. 【0220】 For example, as shown in Figure 26B, when the block A adjacent to the left of the current block is encoded in the affine mode having two control points, the motion vectors v3 and v4 projected onto the upper left corner and upper right corner positions of the encoded block including block A are derived. Then, from the derived motion vectors v3 and v4, the prediction motion vector v0 of the control point at the upper left corner of the current block and the prediction motion vector v1 of the control point at the upper right corner are calculated. 【0221】 For example, as shown in Figure 26C, when the block A adjacent to the left of the current block is encoded in the affine mode having three control points, the motion vectors v3, v4, and v5 projected onto the upper left corner, upper right corner, and lower left corner positions of the encoded block including block A are derived. Then, from the derived motion vectors v3, v4, and v5, the prediction motion vector v0 of the control point at the upper left corner of the current block, the prediction motion vector v1 of the control point at the upper right corner, and the prediction motion vector v2 of the control point at the lower left corner are calculated. 【0222】 Furthermore, this method for deriving predicted motion vectors may also be used to derive the predicted motion vectors for each control point of the current block in step Sj_1 of Figure 29, which will be described later. 【0223】 Figure 27 is a flowchart showing an example of the affine merge mode. 【0224】 In affine merge mode, as shown in the figure, the interpretation unit 126 first derives the predicted MV for each control point of the current block (step Sk_1). The control points are the upper left and upper right corners of the current block, as shown in Figure 25A, or the upper left, upper right, and lower left corners of the current block, as shown in Figure 25B. 【0225】 In other words, as shown in Figure 26A, the interpretation unit 126 examines these blocks in the order of encoded block A (left), block B (top), block C (upper right), block D (lower left), and block E (upper left), and identifies the first valid block encoded in affine mode. 【0226】 Then, if block A is identified and block A has two control points, as shown in Figure 26B, the interpretation unit 126 calculates the motion vector v0 of the upper left corner control point and the motion vector v1 of the upper right corner control point of the current block from the motion vectors v3 and v4 of the upper left and upper right corners of the encoded block containing block A. For example, the interpretation unit 126 calculates the predicted motion vector v0 of the upper left corner control point and the predicted motion vector v1 of the upper right corner control point of the current block by projecting the motion vectors v3 and v4 of the upper left and upper right corners of the encoded block onto the current block. 【0227】 Alternatively, if block A is identified and block A has three control points, as shown in Figure 26C, the interpretation unit 126 calculates the motion vector v0 of the upper left corner control point, the motion vector v1 of the upper right corner control point, and the motion vector v2 of the lower left corner control point of the current block from the motion vectors v3, v4, and v5 of the upper left, upper right, and lower left corners of the encoded block containing block A. For example, the interpretation unit 126 calculates the predicted motion vector v0 of the upper left corner control point, the predicted motion vector v1 of the upper right corner control point, and the motion vector v2 of the lower left corner control point of the current block by projecting the motion vectors v3, v4, and v5 of the upper left, upper right, and lower left corners of the encoded block onto the current block. 【0228】 Next, the interpretation unit 126 performs motion compensation for each of the multiple subblocks contained in the current block. That is, for each of the multiple subblocks, the interpretation unit 126 calculates the motion vector of that subblock as an affine MV using two predicted motion vectors v0 and v1 and equation (1A) described above, or three predicted motion vectors v0, v1 and v2 and equation (1B) described above (step Sk_2). Then, the interpretation unit 126 performs motion compensation for that subblock using these affine MVs and the encoded reference picture (step Sk_3). As a result, motion compensation is performed on the current block, and a predicted image of that current block is generated. 【0229】 [MV Derivation > Affine Intermode] Figure 28A is a conceptual diagram illustrating an affine intermode with two control points. 【0230】 In this affine intermode, as shown in Figure 28A, a motion vector selected from the motion vectors of the encoded blocks A, B, and C adjacent to the current block is used as the predicted motion vector v0 for the control point at the upper left corner of the current block. Similarly, a motion vector selected from the motion vectors of the encoded blocks D and E adjacent to the current block is used as the predicted motion vector v1 for the control point at the upper right corner of the current block. 【0231】 Figure 28B is a conceptual diagram illustrating an affine intermode with three control points. 【0232】 In this affine intermode, as shown in Figure 28B, the motion vector selected from the motion vectors of the encoded blocks A, B, and C adjacent to the current block is used as the predicted motion vector v0 for the control point at the upper left corner of the current block. Similarly, the motion vector selected from the motion vectors of the encoded blocks D and E adjacent to the current block is used as the predicted motion vector v1 for the control point at the upper right corner of the current block. Furthermore, the motion vector selected from the motion vectors of the encoded blocks F and G adjacent to the current block is used as the predicted motion vector v2 for the control point at the lower left corner of the current block. 【0233】 Figure 29 is a flowchart showing an example of an affine intermode. 【0234】 As shown in the figure, in affine intermode, the interpretation unit 126 first derives the predicted MV(v0,v1) or (v0,v1,v2) for each of two or three control points of the current block (step Sj_1). The control points are the upper left corner, upper right corner, or lower left corner of the current block, as shown in Figure 25A or Figure 25B. 【0235】 In other words, the interpretation unit 126 derives the predicted motion vector (v0,v1) or (v0,v1,v2) of the control point of the current block by selecting the motion vector of one of the encoded blocks near each control point of the current block shown in Figure 28A or Figure 28B. At this time, the interpretation unit 126 encodes predicted motion vector selection information into a stream to identify the two selected motion vectors. 【0236】 For example, the interpretation unit 126 may determine, using cost evaluation or the like, which block's motion vector to select as the predicted motion vector for the control point from the encoded blocks adjacent to the current block, and write a flag to the bitstream indicating which predicted motion vector was selected. 【0237】 Next, the interpretation unit 126 performs motion search (steps Sj_3 and Sj_4) while updating the predicted motion vectors selected or derived in step Sj_1 (step Sj_2). That is, the interpretation unit 126 calculates the motion vectors of each subblock corresponding to the updated predicted motion vectors as affine MVs using the above-mentioned equation (1A) or equation (1B) (step Sj_3). Then, the interpretation unit 126 performs motion compensation for each subblock using these affine MVs and encoded reference pictures (step Sj_4). As a result, in the motion search loop, the interpretation unit 126 determines, for example, the predicted motion vector that yields the smallest cost as the motion vector of the control point (step Sj_5). At this time, the interpretation unit 126 further encodes the difference between the determined MV and the predicted motion vector as a difference MV into a stream. 【0238】 Finally, the interpretation unit 126 generates a predicted image of the current block by performing motion compensation on the current block using the determined MV and the encoded reference picture (step Sj_6). 【0239】 [MV Derivation > Affine Inter Mode] When signaling by switching affine modes with different numbers of control points (for example, two and three) at the CU level, the number of control points may be different between the encoded block and the current block. FIGS. 30A and 30B are conceptual diagrams for explaining a method of deriving a predicted vector of control points when the number of control points is different between the encoded block and the current block. 【0240】 For example, as shown in FIG. 30A, when the current block has three control points at the upper left corner, upper right corner, and lower left corner, and the block A adjacent to the left of the current block is encoded in an affine mode having two control points, motion vectors v3 and v4 projected onto the upper left corner and upper right corner positions of the encoded block including block A are derived. Then, from the derived motion vectors v3 and v4, a predicted motion vector v0 of the control point at the upper left corner of the current block and a predicted motion vector v1 of the control point at the upper right corner are calculated. Further, from the derived motion vectors v0 and v1, a predicted motion vector v2 of the control point at the lower left corner is calculated. 【0241】 For example, as shown in FIG. 30B, when the current block has two control points at the upper left corner and upper right corner, and the block A adjacent to the left of the current block is encoded in an affine mode having three control points, motion vectors v3, v4, and v5 projected onto the upper left corner, upper right corner, and lower left corner positions of the encoded block including block A are derived. Then, from the derived motion vectors v3, v4, and v5, a predicted motion vector v0 of the control point at the upper left corner of the current block and a predicted motion vector v1 of the control point at the upper right corner are calculated. 【0242】 This predicted motion vector derivation method may be used to derive each predicted motion vector of the control points of the current block in step Sj_1 of FIG. 29. 【0243】 [MV Derivation > DMVR] Figure 31A is a flowchart showing the relationship between merge mode and DMVR. 【0244】 The interpretation unit 126 derives the motion vector of the current block in merge mode (step Sl_1). Next, the interpretation unit 126 determines whether or not to perform a motion vector search, i.e., a motion search (step Sl_2). If the interpretation unit 126 determines not to perform a motion search (No in step Sl_2), it determines the motion vector derived in step Sl_1 as the final motion vector for the current block (step Sl_4). In other words, in this case, the motion vector of the current block is determined in merge mode. 【0245】 On the other hand, if it is determined in step Sl_1 to perform a motion search (Yes in step Sl_2), the interpretation unit 126 derives the final motion vector for the current block by searching the surrounding region of the reference picture indicated by the motion vector derived in step Sl_1 (step Sl_3). In other words, in this case, the motion vector of the current block is determined by the DMVR. 【0246】 Figure 31B is a conceptual diagram illustrating an example of DMVR processing for determining MV. 【0247】 First, the optimal MVP set for the current block (for example, in merge mode) is designated as the candidate MV. Then, according to the candidate MV(L0), reference pixels are identified from the first reference picture (L0), which is an encoded picture in the L0 direction. Similarly, according to the candidate MV(L1), reference pixels are identified from the second reference picture (L1), which is an encoded picture in the L1 direction. A template is generated by taking the average of these reference pixels. 【0248】 Next, using the template, the surrounding regions of candidate MVs in the first reference picture (L0) and the second reference picture (L1) are searched, and the MV with the minimum cost is determined as the final MV. The cost value may be calculated, for example, using the difference between each pixel value of the template and each pixel value of the search region, as well as the candidate MV value. 【0249】 Typically, the encoding device and the decoding device (described later) share the same basic configuration and operation for the processing described here. 【0250】 Any process that can explore the vicinity of a candidate MV and derive the final MV is acceptable, even if it is not the exact process described here. 【0251】 [Motion compensation > BIO / OBMC] Motion compensation includes modes that generate a predictive image and then correct that predictive image. These modes include, for example, BIO and OBMC, which will be described later. 【0252】 Figure 32 is a flowchart showing an example of predictive image generation. 【0253】 The interpretation unit 126 generates a predicted image (step Sm_1) and corrects the predicted image using, for example, one of the modes described above (step Sm_2). 【0254】 Figure 33 is a flowchart showing another example of predictive image generation. 【0255】 The interpretation unit 126 determines the motion vector of the current block (step Sn_1). Next, the interpretation unit 126 generates a predicted image (step Sn_2) and determines whether or not to perform correction processing (step Sn_3). If the interpretation unit 126 determines that correction processing should be performed (Yes in step Sn_3), it generates the final predicted image by correcting the predicted image (step Sn_4). On the other hand, if the interpretation unit 126 determines that no correction processing should be performed (No in step Sn_3), it outputs the predicted image as the final predicted image without correction (step Sn_5). 【0256】 Furthermore, motion compensation includes a mode that corrects brightness when generating the predicted image. One such mode is the LIC, which will be discussed later. 【0257】 Figure 34 is a flowchart showing another example of predictive image generation. 【0258】 The interpretation unit 126 derives the motion vector of the current block (step So_1). Next, the interpretation unit 126 determines whether or not to perform brightness correction processing (step So_2). If the interpretation unit 126 determines to perform brightness correction processing (Yes in step So_2), it generates a predicted image while performing brightness correction (step So_3). In other words, the predicted image is generated by LIC. On the other hand, if the interpretation unit 126 determines not to perform brightness correction processing (No in step So_2), it generates a predicted image using normal motion compensation without performing brightness correction (step So_4). 【0259】 [Motion Compensation > OBMC] Interpretation signals may be generated using not only the motion information of the current block obtained through motion search, but also the motion information of adjacent blocks. Specifically, interpretation signals may be generated at the sub-block level within the current block by weighted addition of a prediction signal based on motion information obtained through motion search (within the reference picture) and a prediction signal based on motion information of adjacent blocks (within the current picture). Such interpretation (motion compensation) is sometimes called OBMC (overlapped block motion compensation). 【0260】 In OBMC mode, information indicating the size of subblocks for OBMC (e.g., called OBMC block size) may be signaled at the sequence level. Furthermore, information indicating whether or not to apply OBMC mode (e.g., called OBMC flag) may be signaled at the CU level. Note that the signaling levels of this information are not limited to the sequence level and CU level, but may be other levels (e.g., picture level, slice level, tile level, CTU level, or subblock level). 【0261】 Let's explain an example of the OBMC mode in more detail. Figures 35 and 36 are flowcharts and conceptual diagrams illustrating the overview of the predictive image correction process using OBMC processing. 【0262】 First, as shown in Figure 36, a predicted image (Pred) is obtained using normal motion compensation with the motion vector (MV) assigned to the current block to be processed. In Figure 36, the arrow "MV" points to the reference picture, indicating what the current block of the current picture is referencing in order to obtain the predicted image. 【0263】 Next, the motion vector (MV_L) already derived for the encoded left-adjacent block is applied (reused) to the block to be encoded to obtain the predicted image (Pred_L). The motion vector (MV_L) is indicated by the arrow "MV_L" pointing from the current block to the reference picture. Then, the first correction of the predicted image is performed by superimposing the two predicted images, Pred and Pred_L. This has the effect of blending the boundaries between adjacent blocks. 【0264】 Similarly, the motion vector (MV_U) already derived for the encoded upper adjacent block is applied (reused) to the block to be encoded to obtain the predicted image (Pred_U). The motion vector (MV_U) is indicated by an arrow "MV_U" pointing from the current block to the reference picture. Then, the predicted image Pred_U is superimposed on the predicted image that has undergone the first correction (e.g., Pred and Pred_L) to perform a second correction of the predicted image. This has the effect of blending the boundaries between adjacent blocks. The predicted image obtained by the second correction is the final predicted image of the current block, with the boundaries with adjacent blocks blended (smoothed). 【0265】 The above example is a two-pass correction method using left-adjacent and top-adjacent blocks, but the correction method may also be a three-pass or more-pass correction method using right-adjacent and / or bottom-adjacent blocks. 【0266】 Furthermore, the area to be superimposed does not have to be the entire pixel area of ​​the block, but rather only a portion of the area near the block boundary. 【0267】 Here, we have described the OBMC predictive image correction process for obtaining a single predictive image Pred by superimposing additional predictive images Pred_L and Pred_U onto a single reference picture. However, if the predictive image is corrected based on multiple reference images, the same process may be applied to each of the multiple reference pictures. In such cases, by performing OBMC image correction based on multiple reference pictures, a corrected predictive image is obtained from each reference picture, and then the final predictive image is obtained by further superimposing these multiple corrected predictive images. 【0268】 In OBMC, the unit of the target block may be the prediction block unit, or it may be a subblock unit obtained by further dividing the prediction block. 【0269】 One method for determining whether to apply OBMC processing is to use an obmc_flag signal, which indicates whether or not to apply OBMC processing. As a specific example, the encoding device may determine whether the target block belongs to a region with complex motion. If it belongs to a region with complex motion, the encoding device sets the obmc_flag to a value of 1 and applies OBMC processing to perform encoding. If it does not belong to a region with complex motion, it sets the obmc_flag to a value of 0 and encodes the block without applying OBMC processing. On the other hand, the decoding device decodes the obmc_flag described in the stream (e.g., compressed sequence) and switches whether or not to apply OBMC processing depending on its value to perform decoding. 【0270】 In the example described above, the interpretation unit 126 generates one rectangular prediction image for the current rectangular block. However, the interpretation unit 126 may generate multiple prediction images of shapes different from rectangles for the current rectangular block, and then combine these multiple prediction images to generate the final rectangular prediction image. The shapes different from rectangles may be, for example, triangles. 【0271】 Figure 37 is a conceptual diagram illustrating the generation of two triangular predicted images. 【0272】 The interpretation unit 126 generates a predicted triangular image by performing motion compensation on the first triangular partition within the current block using the first MV of that first partition. Similarly, the interpretation unit 126 generates a predicted triangular image by performing motion compensation on the second triangular partition within the current block using the second MV of that second partition. Then, the interpretation unit 126 combines these predicted images to generate a predicted rectangular image identical to that of the current block. 【0273】 In the example shown in Figure 37, the first and second partitions are triangular, but they may also be trapezoidal, or have different shapes from each other. Furthermore, in the example shown in Figure 37, the current block consists of two partitions, but it may also consist of three or more partitions. 【0274】 Furthermore, the first and second partitions may overlap. That is, the first and second partitions may contain the same pixel region. In this case, the predicted image of the current block may be generated using the predicted image in the first partition and the predicted image in the second partition. 【0275】 Furthermore, while this example shows that prediction images are generated by interpretation for both partitions, prediction images may also be generated by intrapretation for at least one partition. 【0276】 [Motion Compensation > BIO] Next, we will explain how to derive motion vectors. First, we will describe the mode of deriving motion vectors based on a model that assumes uniform linear motion. This mode is sometimes called the BIO (bi-directional optical flow) mode. 【0277】 Figure 38 is a conceptual diagram illustrating a model that assumes uniform linear motion. In Figure 38, (vx, vy) represents the velocity vector, and τ0 and τ1 represent the temporal distance between the current picture (Cur Pic) and the two reference pictures (Ref0, Ref1), respectively. (MVx0, MVy0) represents the motion vector corresponding to reference picture Ref0, and (MVx1, MVy1) represents the motion vector corresponding to reference picture Ref1. 【0278】 In this case, under the assumption of uniform linear motion of the velocity vector (vx, vy), (MVx0, MVy0) and (MVx1, MVy1) can be expressed as (vxτ0, vyτ0) and (-vxτ1, -vyτ1), respectively, and the following optical flow equation (2) may be adopted. 【0279】 【number】 【0280】 Here, I(k) represents the luminance value of the reference image k (k=0,1) after motion compensation. This optical flow equation shows that the sum of (i) the time derivative of the luminance value, (ii) the product of the horizontal velocity and the horizontal component of the spatial gradient of the reference image, and (iii) the product of the vertical velocity and the vertical component of the spatial gradient of the reference image is equal to zero. Based on this optical flow equation and Hermite interpolation, block-level motion vectors obtained from merge lists, etc., may be corrected on a pixel-by-pixel basis. 【0281】 Furthermore, motion vectors may be derived on the decoding side using a method different from that used for deriving motion vectors based on a model that assumes uniform linear motion. For example, motion vectors may be derived on a sub-block basis based on the motion vectors of multiple adjacent blocks. 【0282】 [Motion Compensation > LIC] Next, we will describe an example of a mode that generates a predicted image (prediction) using LIC (local illumination compensation) processing. 【0283】 Figure 39 is a conceptual diagram illustrating an example of a predictive image generation method using brightness correction processing by LIC processing. 【0284】 First, the MV is derived from the encoded reference picture to obtain the reference image corresponding to the current block. 【0285】 Next, information is extracted showing how the luminance values ​​have changed between the reference picture and the current picture for the current block. This extraction is based on the luminance pixel values ​​of the encoded left adjacent reference region (peripheral reference region) and encoded upper adjacent reference region (peripheral reference region) in the current picture, and the luminance pixel values ​​at the equivalent positions in the reference picture specified by the derived MV. Then, the luminance correction parameter is calculated using the information showing how the luminance values ​​have changed. 【0286】 A predicted image for the current block is generated by applying the brightness correction parameters to the reference image within the reference picture specified in MV. 【0287】 Note that the shape of the peripheral reference region in Figure 39 is just one example, and other shapes may be used. 【0288】 Furthermore, although this explanation describes the process of generating a predicted image from a single reference picture, the process is similar when generating predicted images from multiple reference pictures. Alternatively, the brightness correction process may be applied to each reference picture obtained from the reference picture in the same manner as described above before generating the predicted image. 【0289】 One method for determining whether or not to apply LIC processing is to use a signal called lic_flag, which indicates whether or not to apply LIC processing. For example, in an encoding device, it is determined whether the current block belongs to a region where brightness changes are occurring. If it belongs to a region where brightness changes are occurring, the value of lic_flag is set to 1, and LIC processing is applied and encoding is performed. If it does not belong to a region where brightness changes are occurring, the value of lic_flag is set to 0, and encoding is performed without applying LIC processing. On the other hand, in a decoding device, the lic_flag written in the stream can be decoded, and the device may switch whether or not to apply LIC processing depending on its value before performing decoding. 【0290】 Another way to determine whether to apply LIC processing is, for example, by checking whether LIC processing was applied to surrounding blocks. A specific example is, if the current block is in merge mode, the system checks whether the surrounding encoded blocks selected during the MV derivation in merge mode were encoded with LIC processing. Based on this result, the system switches whether to apply LIC processing and then performs the encoding. Note that in this example, the same process is applied to the decoding device. 【0291】 The LIC processing (luminance correction processing) method was explained using Figure 39, and its details will be explained below. 【0292】 First, the interpretation unit 126 derives motion vectors to obtain a reference image corresponding to the block to be encoded from a reference picture which is an encoded picture. 【0293】 Next, the interpretation unit 126 extracts information indicating how the luminance values ​​have changed between the reference picture and the picture to be encoded, using the luminance pixel values ​​of the left-adjacent and upper-adjacent encoded peripheral reference regions and the luminance pixel values ​​at equivalent positions in the reference picture specified by the motion vector, and calculates luminance correction parameters. For example, let p0 be the luminance pixel value of a pixel in the peripheral reference region of the picture to be encoded, and p1 be the luminance pixel value of a pixel in the peripheral reference region of the reference picture at an equivalent position to that pixel. The interpretation unit 126 calculates coefficients A and B as luminance correction parameters to optimize A×p1+B=p0 for multiple pixels in the peripheral reference region. 【0294】 Next, the interpretation unit 126 generates a predicted image for the encoding target block by performing brightness correction processing on the reference image in the reference picture specified by the motion vector using brightness correction parameters. For example, let p2 be the brightness pixel value in the reference image, and p3 be the brightness pixel value of the predicted image after brightness correction processing. The interpretation unit 126 generates the predicted image after brightness correction processing by calculating A × p2 + B = p3 for each pixel in the reference image. 【0295】 Note that the shape of the surrounding reference region in Figure 39 is just one example, and other shapes may be used. Also, only a part of the surrounding reference region shown in Figure 39 may be used. For example, a region containing a predetermined number of pixels obtained by thinning out the upper adjacent pixels and the left adjacent pixels may be used as the surrounding reference region. Furthermore, the surrounding reference region is not limited to the region adjacent to the block to be encoded, but may also be a region not adjacent to the block to be encoded. The predetermined number of pixels may be set in advance. 【0296】 Furthermore, in the example shown in Figure 39, the peripheral reference region within the reference picture is the region specified by the motion vector of the picture to be encoded, but it may also be a region specified by another motion vector. For example, this other motion vector may be the motion vector of the peripheral reference region within the picture to be encoded. 【0297】 Although the operation of the encoding device 100 has been described here, the operation of the decoding device 200 is typically similar. 【0298】 Furthermore, LIC processing may be applied not only to luminance but also to chrominance. In this case, correction parameters may be derived individually for each of Y, Cb, and Cr, or a common correction parameter may be used for any of them. 【0299】 Furthermore, LIC processing may be applied on a subblock basis. For example, correction parameters may be derived using the surrounding reference region of the current subblock and the surrounding reference region of the reference subblock within the reference picture specified by the MV of the current subblock. 【0300】 [Prediction Control Unit] The prediction control unit 128 selects either the intra-prediction signal (the signal output from the intra-prediction unit 124) or the inter-prediction signal (the signal output from the inter-prediction unit 126), and outputs the selected signal as the prediction signal to the subtraction unit 104 and the addition unit 116. 【0301】 As shown in Figure 1, in various encoding device examples, the prediction control unit 128 may output prediction parameters that are input to the entropy encoding unit 110. The entropy encoding unit 110 may generate an encoded bitstream (or sequence) based on the prediction parameters input from the prediction control unit 128 and the quantization coefficients input from the quantization unit 108. The prediction parameters may be used in the decoding device. The decoding device may receive and decode the encoded bitstream and perform the same processing as the prediction processing performed in the intra-prediction unit 124, inter-prediction unit 126, and prediction control unit 128. The prediction parameters may include a selected prediction signal (e.g., a motion vector, prediction type, or prediction mode used in the intra-prediction unit 124 or inter-prediction unit 126), or any index, flag, or value that is based on or indicates the prediction processing performed in the intra-prediction unit 124, inter-prediction unit 126, and prediction control unit 128. 【0302】 [Example of an encoding device implementation] Figure 40 is a block diagram showing an example implementation of the encoding device 100. The encoding device 100 includes a processor a1 and memory a2. For example, the multiple components of the encoding device 100 shown in Figure 1 are implemented by the processor a1 and memory a2 shown in Figure 40. 【0303】 Processor a1 is a circuit that performs information processing and is a circuit that can access memory a2. For example, processor a1 is a dedicated or general-purpose electronic circuit for encoding moving images. Processor a1 may be a processor such as a CPU. Alternatively, processor a1 may be a collection of multiple electronic circuits. Furthermore, for example, processor a1 may perform the roles of multiple components of the encoding device 100 shown in Figure 1, etc. 【0304】 Memory a2 is a dedicated or general-purpose memory in which information for the processor a1 to encode moving images is stored. Memory a2 may be an electronic circuit and may be connected to the processor a1. Memory a2 may also be included in the processor a1. Memory a2 may also be a collection of multiple electronic circuits. Memory a2 may also be a magnetic disk or an optical disk, or may be described as storage or a recording medium. Memory a2 may also be a non-volatile memory or a volatile memory. 【0305】 For example, memory a2 may store the video to be encoded, or it may store the bit sequence corresponding to the encoded video. Alternatively, memory a2 may store a program for processor a1 to encode the video. 【0306】 Furthermore, for example, memory a2 may play the role of an information storage component among the multiple components of the encoding device 100 shown in Figure 1, etc. For example, memory a2 may play the role of the block memory 118 and frame memory 122 shown in Figure 1. More specifically, reconstructed blocks and reconstructed pictures may be stored in memory a2. 【0307】 Furthermore, it is not necessary for the encoding device 100 to implement all of the components shown in Figure 1, etc., nor is it necessary for all of the processes described above to be performed. Some of the components shown in Figure 1, etc., may be included in other devices, and some of the processes described above may be performed by other devices. 【0308】 [Decoding device] Next, we will describe a decoding device capable of decoding an encoded signal (encoded bitstream) output from the above-mentioned encoding device 100. Figure 41 is a block diagram showing the functional configuration of a decoding device 200 according to an embodiment. The decoding device 200 is a video decoding device that decodes video in block units. 【0309】 As shown in Figure 41, the decoding device 200 includes an entropy decoding unit 202, an inverse quantization unit 204, an inverse transform unit 206, an adder unit 208, a block memory 210, a loop filter unit 212, a frame memory 214, an intra prediction unit 216, an inter prediction unit 218, and a prediction control unit 220. 【0310】 The decoding device 200 can be implemented, for example, by a general-purpose processor and memory. In this case, when the software program stored in memory is executed by the processor, the processor functions as an entropy decoding unit 202, an inverse quantization unit 204, an inverse transformation unit 206, an addition unit 208, a loop filter unit 212, an intra prediction unit 216, an inter prediction unit 218, and a prediction control unit 220. Alternatively, the decoding device 200 may be implemented as one or more dedicated electronic circuits corresponding to the entropy decoding unit 202, the inverse quantization unit 204, the inverse transformation unit 206, the addition unit 208, the loop filter unit 212, the intra prediction unit 216, the inter prediction unit 218, and the prediction control unit 220. 【0311】 The following describes the overall processing flow of the decoding device 200, followed by a description of each component included in the decoding device 200. 【0312】 [Overall flow of the decryption process] Figure 42 is a flowchart showing an example of the overall decoding process by the decoding device 200. 【0313】 First, the entropy decoding unit 202 of the decoding device 200 identifies a division pattern for a fixed-size block (for example, 128 × 128 pixels) (step Sp_1). This division pattern is the one selected by the encoding device 100. Then, the decoding device 200 performs steps Sp_2 to Sp_6 for each of the multiple blocks that make up that division pattern. 【0314】 In other words, the entropy decoding unit 202 decodes (specifically, performs entropy decoding) the encoded quantization coefficients and prediction parameters of the block to be decoded (also called the current block) (step Sp_2). 【0315】 Next, the inverse quantization unit 204 and the inverse transformation unit 206 reconstruct multiple predicted residuals (i.e., difference blocks) by performing inverse quantization and inverse transformation on multiple quantization coefficients (step Sp_3). 【0316】 Next, the prediction processing unit, which consists of all or part of the intra prediction unit 216, the inter prediction unit 218, and the prediction control unit 220, generates a prediction signal (also called a prediction block) for the current block (step Sp_4). 【0317】 Next, the addition unit 208 reconstructs the current block into a reconstructed image (also called a decoded image block) by adding the predicted block to the difference block (step Sp_5). 【0318】 Then, once this reconstructed image is generated, the loop filter unit 212 performs filtering on the reconstructed image (step Sp_6). 【0319】 The decryption device 200 then determines whether or not the entire picture has been decrypted (step Sp_7). If it determines that it has not been completed (No. in step Sp_7), it repeats the process from step Sp_1. 【0320】 As shown in the diagram, steps Sp_1 to Sp_7 are performed sequentially by the decoding device 200. Alternatively, some of these steps may be performed in parallel, or their order may be changed. 【0321】 [Entropy Decoder] The entropy decoding unit 202 entropically decodes the encoded bitstream. Specifically, the entropy decoding unit 202 arithmetically decodes the encoded bitstream into a binary signal, for example. Then, the entropy decoding unit 202 debinarizes the binary signal. The entropy decoding unit 202 outputs the quantization coefficients in block units to the inverse quantization unit 204. The entropy decoding unit 202 may also output prediction parameters included in the encoded bitstream (see Figure 1) to the intra-prediction unit 216, inter-prediction unit 218, and prediction control unit 220 in the embodiment. The intra-prediction unit 216, inter-prediction unit 218, and prediction control unit 220 can perform the same prediction processing as the intra-prediction unit 124, inter-prediction unit 126, and prediction control unit 128 on the encoding device side. 【0322】 [Dequantization section] The inverse quantization unit 204 inversely quantizes the quantization coefficients of the decoded block (hereinafter referred to as the current block), which is the input from the entropy decoding unit 202. Specifically, for each quantization coefficient of the current block, the inverse quantization unit 204 inversely quantizes the quantization coefficient based on the quantization parameter corresponding to that quantization coefficient. The inverse quantization unit 204 then outputs the inversely quantized quantization coefficients (i.e., transformation coefficients) of the current block to the inverse transformation unit 206. 【0323】 [Inverse Transformation Section] The inverse transform unit 206 restores the prediction error by inversely transforming the transformation coefficients, which are input from the inverse quantization unit 204. 【0324】 For example, if the information decoded from the encoded bitstream indicates that EMT or AMT should be applied (e.g., the AMT flag is true), the inverse transform unit 206 inversely transforms the transformation coefficients of the current block based on the information indicating the decoded transformation type. 【0325】 For example, if the information decoded from the encoded bitstream indicates that NSST should be applied, the inverse transform unit 206 applies inverse retransformation to the transformation coefficients. 【0326】 [Addition section] The adder 208 reconstructs the current block by adding the prediction error, which is the input from the inverse transformer 206, and the prediction sample, which is the input from the prediction control unit 220. The adder 208 then outputs the reconstructed block to the block memory 210 and the loop filter unit 212. 【0327】 [Block memory] The block memory 210 is a storage unit for storing blocks that are referenced in intra prediction and are located within the decoded picture (hereinafter referred to as the current picture). Specifically, the block memory 210 stores the reconstructed blocks output from the adder 208. 【0328】 [Loop Filter Section] The loop filter unit 212 applies a loop filter to the block reconstructed by the adder unit 208 and outputs the filtered reconstructed block to the frame memory 214 and the display device, etc. 【0329】 If the information interpreted from the encoded bitstream indicating ALF on / off indicates ALF is on, one filter is selected from among several filters based on the direction and activity of the local gradient, and the selected filter is applied to the reconstruction block. 【0330】 [Frame memory] The frame memory 214 is a memory unit for storing reference pictures used for interpretation, and is sometimes called a frame buffer. Specifically, the frame memory 214 stores the reconstructed blocks filtered by the loop filter unit 212. 【0331】 [Prediction Processing Unit (Intra Prediction Unit, Inter Prediction Unit, Prediction Control Unit)] Figure 43 is a flowchart showing an example of processing performed in the prediction processing unit of the decoding device 200. The prediction processing unit consists of all or some of the components of the intra-prediction unit 216, the inter-prediction unit 218, and the prediction control unit 220. 【0332】 The prediction processing unit generates a predicted image of the current block (step Sq_1). This predicted image is also called a predicted signal or predicted block. Predicted signals include, for example, intra-predicted signals or inter-predicted signals. Specifically, the prediction processing unit generates a predicted image of the current block using the reconstructed image already obtained by generating predicted blocks, difference blocks, coefficient blocks, difference blocks, and decoded image blocks. 【0333】 The reconstructed image may be, for example, the image of the reference picture, or it may be the image of the decoded block within the current picture, which is the picture containing the current block. The decoded block within the current picture is, for example, the adjacent block to the current block. 【0334】 Figure 44 is a flowchart showing another example of the processing performed in the prediction processing unit of the decoding device 200. 【0335】 The prediction processing unit determines a method or mode for generating the predicted image (step Sr_1). For example, this method or mode may be determined based on, for example, prediction parameters. 【0336】 If the prediction processing unit determines a first method as the mode for generating the prediction image, it generates the prediction image according to that first method (step Sr_2a). If the prediction processing unit determines a second method as the mode for generating the prediction image, it generates the prediction image according to that second method (step Sr_2b). If the prediction processing unit determines a third method as the mode for generating the prediction image, it generates the prediction image according to that third method (step Sr_2c). 【0337】 The first, second, and third methods are different methods for generating predictive images, and may be, for example, an interpretation method, an intrapretation method, and other prediction methods, respectively. These prediction methods may use the reconstructed images described above. 【0338】 [Intra Prediction Unit] The intra-prediction unit 216 generates a prediction signal (intra-prediction signal) by performing intra-prediction based on the intra-prediction mode decoded from the encoded bitstream, and by referring to the blocks in the current picture stored in the block memory 210. Specifically, the intra-prediction unit 216 generates an intra-prediction signal by performing intra-prediction by referring to samples (e.g., luminance values, chrominance values) of blocks adjacent to the current block, and outputs the intra-prediction signal to the prediction control unit 220. 【0339】 Furthermore, if an intra-prediction mode that references a luminance block is selected in the intra-prediction of a color difference block, the intra-prediction unit 216 may predict the color difference component of the current block based on the luminance component of the current block. 【0340】 Furthermore, if the information decoded from the encoded bitstream indicates the application of PDPC, the intra-prediction unit 216 corrects the pixel value after intra-prediction based on the gradient of the reference pixels in the horizontal / vertical directions. 【0341】 [International Prediction Department] The inter-prediction unit 218 predicts the current block by referring to a reference picture stored in the frame memory 214. Prediction is performed in units of the current block or sub-blocks within the current block (e.g., 4x4 blocks). For example, the inter-prediction unit 218 generates an inter-prediction signal for the current block or sub-block by performing motion compensation using motion information (e.g., motion vectors) decoded from the encoded bitstream (e.g., prediction parameters output from the entropy decoding unit 202), and outputs the inter-prediction signal to the prediction control unit 220. 【0342】 If the information decoded from the encoded bitstream indicates that the OBMC mode should be applied, the interpretation unit 218 generates an interpretation prediction signal using not only the motion information of the current block obtained by motion search, but also the motion information of the adjacent block. 【0343】 Furthermore, if the information decoded from the encoded bitstream indicates that FRUC mode should be applied, the interpretation unit 218 derives motion information by performing a motion search according to the pattern matching method (bilateral matching or template matching) decoded from the encoded stream. Then, the interpretation unit 218 performs motion compensation (prediction) using the derived motion information. 【0344】 Furthermore, when the BIO mode is applied, the inter-prediction unit 218 derives motion vectors based on a model that assumes uniform linear motion. Also, if the information decoded from the encoded bitstream indicates that the affine motion compensation prediction mode should be applied, the inter-prediction unit 218 derives motion vectors on a sub-block basis based on the motion vectors of multiple adjacent blocks. 【0345】 [MV Derivation > Normal Intermode] If the information decoded from the encoded bitstream indicates that the normal intermode should be applied, the interpretation unit 218 derives the motion video (MV) based on the information decoded from the encoded stream and uses that MV to perform motion compensation (prediction). 【0346】 Figure 45 is a flowchart showing an example of inter-mode prediction in the decoding device 200. 【0347】 The interpretation unit 218 of the decoding device 200 performs motion compensation for each block. Based on information such as the MVs of multiple decoded blocks surrounding the current block in time or space, the interpretation unit 218 obtains multiple candidate MVs for the current block (step Ss_1). In other words, the interpretation unit 218 creates a list of candidate MVs. 【0348】 Next, the interpretation unit 218 extracts N candidate MVs (where N is an integer greater than or equal to 2) from among the multiple candidate MVs obtained in step Ss_1 as predicted motion vector candidates (also called predicted MV candidates) according to a predetermined priority order (step Ss_2). Note that this priority order may be predetermined for each of the N predicted MV candidates. 【0349】 Next, the interpretation unit 218 decodes the predicted motion vector selection information from the input stream (i.e., the encoded bitstream), and uses the decoded predicted motion vector selection information to select one predicted MV candidate from among the N predicted MV candidates as the predicted motion vector (also called the predicted MV) for the current block (step Ss_3). 【0350】 Next, the interpretation unit 218 decodes the differential MV from the input stream and derives the MV of the current block by adding the decoded differential MV (the difference value) to the selected predicted motion vector (step Ss_4). 【0351】 Finally, the interpretation unit 218 generates a predicted image of the current block by performing motion compensation on the current block using the derived MV and the decoded reference picture (step Ss_5). 【0352】 [Prediction Control Unit] The prediction control unit 220 selects either the intra-prediction signal or the inter-prediction signal and outputs the selected signal as the prediction signal to the summer unit 208. Overall, the configuration, functions, and processing of the prediction control unit 220, intra-prediction unit 216, and inter-prediction unit 218 on the decoding device side may correspond to the configuration, functions, and processing of the prediction control unit 128, intra-prediction unit 124, and inter-prediction unit 126 on the encoding device side. 【0353】 [Example of a decryption device implementation] Figure 46 is a block diagram showing an example implementation of the decoding device 200. The decoding device 200 includes a processor b1 and memory b2. For example, the multiple components of the decoding device 200 shown in Figure 41 are implemented by the processor b1 and memory b2 shown in Figure 46. 【0354】 Processor b1 is a circuit that performs information processing and is a circuit that can access memory b2. For example, processor b1 is a dedicated or general-purpose electronic circuit that decodes encoded video (i.e., encoded bitstream). Processor b1 may be a processor such as a CPU. Alternatively, processor b1 may be a collection of multiple electronic circuits. Furthermore, for example, processor b1 may perform the roles of multiple components of the decoding device 200 shown in Figure 41, etc. 【0355】 Memory b2 is a dedicated or general-purpose memory in which information for the processor b1 to decode the encoded bitstream is stored. Memory b2 may be an electronic circuit and may be connected to the processor b1. Memory b2 may also be included in the processor b1. Memory b2 may also be a collection of multiple electronic circuits. Memory b2 may also be a magnetic disk or an optical disk, or may be described as storage or a recording medium. Memory b2 may also be non-volatile memory or volatile memory. 【0356】 For example, memory b2 may store a video image or an encoded bitstream. Alternatively, memory b2 may store a program for processor b1 to decode the encoded bitstream. 【0357】 Furthermore, for example, memory b2 may play the role of an information storage component among the multiple components of the decoding device 200 shown in Figure 41, etc. Specifically, memory b2 may play the role of the block memory 210 and frame memory 214 shown in Figure 41. More specifically, reconstructed blocks and reconstructed pictures may be stored in memory b2. 【0358】 Furthermore, the decoding device 200 does not necessarily have to implement all of the components shown in Figure 41, etc., nor does it have to perform all of the processes described above. Some of the components shown in Figure 41, etc., may be included in other devices, and some of the processes described above may be performed by other devices. 【0359】 [Definitions of each term] Each term may be defined as follows, for example: 【0360】 A picture is an array of multiple luminance samples in a monochrome format, or two corresponding arrays of multiple luminance samples and multiple color difference samples in 4:2:0, 4:2:2, and 4:4:4 color formats. A picture may be a frame or a field. 【0361】 The frame is composed of a top field where multiple sample rows 0, 2, 4, ... are generated, and a bottom field where multiple sample rows 1, 3, 5, ... are generated. 【0362】 A slice is an integer number of coded tree units contained within one independent slice segment and all subsequent dependent slice segments that precede (if any) the next independent slice segment within the same access unit. 【0363】 A tile is a rectangular region of a picture containing multiple coding tree blocks within a particular tile sequence and a particular tile row. A tile may also be a rectangular region of a frame that is intended to be decoded and coded independently, although loop filters may still be applied across the edges of the tile. 【0364】 A block is an MxN (N rows x M columns) array of multiple samples, or an MxN array of multiple transformation coefficients. A block may also be a square or rectangular region of multiple pixels consisting of multiple matrices of one luminance and two chrominance values. 【0365】 A CTU (Coded Tree Unit) may be a coded tree block of multiple luminance samples of a picture having three sample sequences, or two corresponding coded tree blocks of multiple chrominance samples. Alternatively, a CTU may be a coded tree block of multiple samples of either a monochrome picture or a picture coded using a syntax structure used to code three separate color planes and multiple samples. 【0366】 The superblock may consist of one or two mode information blocks, or it may be a 64x64 pixel square block that can be recursively divided into four 32x32 blocks and further divided. 【0367】 [First aspect of coefficient coding] Figure 47 is a flowchart illustrating a basic coefficient coding method according to the first embodiment. Specifically, Figure 47 shows a coefficient coding method for a region where a prediction residual is obtained by intra coding or inter coding. The following description shows the operations performed by the coding device 100. The decoding device 200 may perform operations corresponding to those performed by the coding device 100. For example, the decoding device 200 may perform an inverse orthogonal transform and decoding corresponding to the orthogonal transform and coding performed by the coding device 100. 【0368】 Figure 47 shows last_sig_coeff, subblock_flag, thresholds, and CCB. last_sig_coeff is a parameter that represents the coordinate position where a non-zero coefficient first appears when scanning within a block. subblock_flag is a flag that indicates whether there is a non-zero coefficient within a 4x4 subblock (also called a 16 transformation coefficient level). subblock_flag is also expressed as coded_sub_block_flag or subblock flag. 【0369】 `thres` is a constant determined on a block-by-block basis. `thres` may be predetermined. `thres` may have different values ​​depending on the block size, or it may be the same value regardless of the block size. `thres` may have different values ​​depending on whether orthogonal transformations are applied or not. `thres` may also be determined depending on the coordinate position defined in the block by `last_sig_coeff`. 【0370】 CCB represents the number of bins encoded in the context mode of CABAC (Context-Adaptive Binary Arithmetic Coding). In other words, CCB represents the number of encoding operations based on the context mode of CABAC. The context mode is also called the regular mode. Here, encoding based on the context mode of CABAC is called CABAC encoding or context-adaptive encoding. Encoding based on the bypass mode of CABAC is called bypass encoding. Bypass encoding is less computationally intensive than CABAC encoding. 【0371】 CABAC coding is a process that converts a sequence of bins obtained by binarizing the signal to be coded into a coded bit sequence based on the probability of 0 and 1 occurring for each bin. Note that CCB may count the number of all flags used in residual coefficient coding, or it may count the number of some of the flags used in residual coefficient coding. Bypass coding is a process that encodes one bin in the sequence of bins as one bit in the coded bit sequence without using the variable probability of 0 and 1 occurring for each bin (in other words, using a fixed probability). 【0372】 For example, the encoding device 100 compares the CCB value and the threshold value to determine the coefficient coding method. 【0373】 Specifically, in Figure 47, first, the CCB is initialized to 0 (S101). Then, it is determined whether or not an orthogonal transform should be applied to the block (S102). If an orthogonal transform should be applied to the block (Yes in S102), the encoding device 100 encodes last_sig_coeff (S131). Then, the encoding device 100 performs loop processing for each subblock (S141~S148). 【0374】 In the loop processing for each subblock (S141-S148), the encoding device 100 encodes the subblock_flag for that subblock. If the subblock_flag is not 0 (Yes in S146), the encoding device 100 encodes the 16 coefficients within that subblock using the first encoding method described later (S147). 【0375】 Furthermore, if no orthogonal transformation is applied to a block (No in S102), the encoding device 100 performs loop processing for each subblock (S121-S128). 【0376】 In the loop processing for each subblock (S121-S128), the encoding device 100 determines whether the CCB is less than or equal to thres (S122). If the CCB is less than or equal to thres (Yes in S122), the encoding device 100 encodes subblock_flag using CABAC encoding (S123). Then, the encoding device 100 counts up the CCB (S124). Otherwise (No in S122), the encoding device 100 encodes subblock_flag using bypass encoding (S125). 【0377】 Then, if subblock_flag is not 0 (Yes in S126), the encoding device 100 encodes the 16 coefficients in that subblock using the second encoding method described later (S127). 【0378】 If no orthogonal transformation is applied to a block, for example, the orthogonal transformation may be skipped. The CCB is also used in the first and second encoding schemes. The CCB may be initialized on a subblock basis. In that case, thres may not be a fixed value for the block, but a value that changes for each subblock. 【0379】 Note that here, the CCB is counted up from 0 and checked to see if it reaches the threshold, but the CCB could also be counted down from the threshold (or a specific value) and checked to see if it reaches 0. 【0380】 Figure 48 is a flowchart detailing the first encoding scheme shown in Figure 47. In the first encoding scheme, multiple coefficients within a subblock are encoded. At that time, a first loop process (S151-S156) is performed for each coefficient information flag within the subblock, and a second loop process (S161-S165) is performed for each coefficient within the subblock. 【0381】 In the first loop processing (S151-S156), one or more coefficient information flags, each representing one or more attributes of a coefficient, are sequentially encoded. These one or more coefficient information flags may include sig_flag, gt1_flag, parity_flag, and gt3_flag, as described later. Then, within the range where the CCB does not exceed the threshold, one or more coefficient information flags are sequentially encoded using CABAC encoding, and the CCB is incremented by one each time encoding is performed. After the CCB exceeds the threshold, no further coefficient information flags are encoded. 【0382】 In other words, in the first loop processing (S151-S156), the encoding device 100 determines whether the CCB is less than or equal to the threshold (S152). If the CCB is less than or equal to the threshold (Yes in S152), the encoding device 100 encodes the coefficient information flag using CABAC encoding (S153). Then, the encoding device 100 counts up the CCB (S154). If the CCB is not less than or equal to the threshold (No in S152), the encoding device 100 terminates the first loop processing (S151-S156). 【0383】 In the second loop processing (S161-S165), for coefficients for which the coefficient information flag has been encoded, the remaining value not represented by the coefficient information flag (i.e., the remaining value for reconstructing the coefficient value using the coefficient information flag) is encoded using Golomb-Rice coding. Coefficients for which the coefficient information flag was not encoded are encoded directly using Golomb-Rice coding. Note that the remainder may be encoded using a different coding scheme instead of Golomb-Rice coding. 【0384】 In other words, in the second loop processing (S161-S165), the encoding device 100 determines whether or not a coefficient information flag corresponding to the coefficient to be processed has been encoded (S162). If the coefficient information flag has been encoded (Yes in S162), the encoding device 100 encodes the remainder using Golomb-Rice coding (S163). If the coefficient information flag has not been encoded (No in S162), the encoding device 100 encodes the coefficient value using Golomb-Rice coding (S164). 【0385】 Note that while the number of loop iterations is 2 here, the number of loop iterations may be different from 2. 【0386】 The sig_flag mentioned above is a flag indicating whether AbsLevel is non-zero. AbsLevel is the value of the coefficient, more specifically, the absolute value of the coefficient. gt1_flag is a flag indicating whether AbsLevel is greater than 1. parity_flag is a flag representing the first bit of AbsLevel, indicating whether AbsLevel is odd or even. gt3_flag is a flag indicating whether AbsLevel is greater than 3. 【0387】 gt1_flag and gt3_flag may be expressed as abs_gt1_flag and abs_gt3_flag, respectively. Furthermore, for example, the value of (Abslevel-4) / 2 may be encoded using Golomb-Rice coding as the aforementioned reminder. 【0388】 One or more coefficient information flags different from the one or more coefficient information flags described above may be encoded. For example, some coefficient information flags may not be encoded. Coefficient information flags included in the one or more coefficient information flags described above may be replaced with coefficient information flags or parameters that have other meanings. 【0389】 Figure 49 is a flowchart detailing the second encoding scheme shown in Figure 47. In the second encoding scheme, multiple coefficients within a subblock are encoded. At that time, a first loop process (S171-S176) is performed for each coefficient information flag within the subblock, and a second loop process (S181-S185) is performed for each coefficient within the subblock. 【0390】 In the first loop processing (S171-S176), one or more coefficient information flags, each representing one or more attributes of a coefficient, are sequentially encoded. The one or more coefficient information flags may include sig_flag, sign_flag, gt1_flag, parity_flag, gt3_flag, gt5_flag, gt7_flag, and gt9_flag. 【0391】 Here, sign_flag is a flag indicating the sign of the coefficient. gt5_flag is a flag indicating whether AbsLevel is greater than 5. gt7_flag is a flag indicating whether AbsLevel is greater than 7. gt9_flag is a flag indicating whether AbsLevel is greater than 9. gt5_flag, gt7_flag, and gt9_flag may also be expressed as abs_gt5_flag, abs_gt7_flag, and abs_gt9_flag, respectively. Alternatively, the flags indicating whether AbsLevel is greater than x (where x is an integer greater than or equal to 1) may be collectively expressed as gtx_flag or abs_gtx_flag. AbsLevel is, for example, the absolute value of the transformation coefficient level. 【0392】 Furthermore, one or more coefficient information flags other than the one or more coefficient information flags described above may be encoded. For example, some coefficient information flags may not be encoded. Coefficient information flags included in the one or more coefficient information flags described above may be replaced with coefficient information flags or parameters that have other meanings. 【0393】 The one or more coefficient information flags mentioned above are sequentially encoded using CABAC coding. Each time encoding is performed, the CCB is incremented by one. After the CCB exceeds the threshold, the coefficient information flags are encoded using bypass coding. 【0394】 In other words, in the first loop processing (S171-S176), the encoding device 100 determines whether the CCB is less than or equal to the threshold (S172). If the CCB is less than or equal to the threshold (Yes in S172), the encoding device 100 encodes the coefficient information flag using CABAC encoding (S173). Then, the encoding device 100 counts up the CCB (S174). If the CCB is not less than or equal to the threshold (No in S172), the encoding device 100 encodes the coefficient information flag using bypass encoding (S175). 【0395】 The syntax of the second loop processing in Figure 49 remains the same before and after the CCB exceeds the threshold. In other words, whether the coefficient information flag is encoded using CABAC coding or bypass coding, the same processing is performed in the second loop processing (S181-S185). 【0396】 Specifically, in the second loop processing (S181-S185), the encoding device 100 encodes the remainder, which is the remaining value not represented by the coefficient information flag (i.e., the remaining value for reconstructing the coefficient value using the coefficient information flag), using Golomb-Rice coding (S183). Note that the remainder may be encoded using a different encoding scheme instead of Golomb-Rice coding. 【0397】 Note that while the number of loop iterations is 2 here, the number of loop iterations may be different from 2. 【0398】 As shown in Figures 47, 48, and 49, in the basic operation of this embodiment, there is a flag that determines whether or not a process is included in the limit of the number of CABAC coding processes, depending on whether or not an orthogonal transform is applied. Furthermore, the syntax of coefficient coding differs depending on whether orthogonal transforms are applied or not. This may necessitate the provision of separate circuits. Consequently, the circuit configuration may become complex. 【0399】 [First example of a first aspect of coefficient coding] Figure 50 is a flowchart showing a coefficient coding method according to a first example of the first embodiment. In the example in Figure 50, the post-processing of last_sig_coeff (S132) and the processing of subblock_flag (S142-S145) differ from the example in Figure 47. 【0400】 In Figure 47, when an orthogonal transformation is applied, the CCB is incremented for sig_flag, parity_flag, and gtX_flag (X=1, 3). In the example in Figure 50, the CCB is also incremented for last_sig_coeff and subblock_flag. On the other hand, the processing flow when no orthogonal transformation is applied is the same as in the example in Figure 47. 【0401】 In other words, in the example shown in Figure 50, the encoding device 100 encodes last_sig_coeff (S131), and then adds the number of CABAC encoding operations in encoding last_sig_coeff to the CCB (S132). 【0402】 Furthermore, before encoding subblock_flag, the encoding device 100 determines whether the CCB is less than or equal to the threshold (S142). If the CCB is less than or equal to the threshold (Yes in S142), the encoding device 100 encodes subblock_flag using CABAC encoding (S143). Then, the encoding device 100 adds 1 to the CCB (S144). On the other hand, if the CCB is not less than or equal to the threshold (No in S142), the encoding device 100 encodes subblock_flag using bypass encoding (S145). 【0403】 [Effects of the first example of the first aspect of coefficient coding] As shown in the example in Figure 50, it may be possible to unify and standardize the processing flow for encoding subblock_flag depending on whether orthogonal transformation is performed or not. Therefore, some circuits may be shared between cases where orthogonal transformation is performed and cases where it is not, potentially reducing the circuit size. As a result, multiple processing flows that differ depending on whether or not orthogonal transformation is performed may become the same, except for the presence or absence of last_sig_coeff. 【0404】 For example, even if the number of CABAC encoding operations is limited at the block level, in the example in Figure 47, the subblock_flag is encoded using CABAC encoding after the CCB reaches the threshold. On the other hand, in the case of Figure 50, the subblock_flag is not encoded using CABAC encoding after the CCB reaches the threshold. This may result in the number of CABAC encoding operations being appropriately limited to the threshold. 【0405】 Note that the number of CABAC encoding operations in last_sig_coeff does not need to be included in the CCB. Also, thres may be determined depending on the coordinate position defined in the block by last_sig_coeff. 【0406】 Alternatively, the encoding device 100 may always determine the value of subblock_flag to be 1 after the CCB exceeds the threshold and encode it. If it is determined that the value of subblock_flag is always 1 after the CCB exceeds the threshold, the encoding device 100 does not need to encode subblock_flag after the CCB exceeds the threshold. 【0407】 Furthermore, even when orthogonal transformation is not applied, the encoding device 100 may always determine the value of subblock_flag to be 1 after the CCB exceeds the threshold and encode it. Also, even in this case, if it is determined that the value of subblock_flag is always 1 after the CCB exceeds the threshold, the encoding device 100 does not need to encode subblock_flag after the CCB exceeds the threshold. 【0408】 [Second example of the first aspect of coefficient coding] Figure 51 is a flowchart showing a coefficient coding method according to a second example of the first embodiment. In the example in Figure 51, the processing of subblock_flag (S123) differs from that in the example in Figure 47. 【0409】 In Figure 47, when no orthogonal transformation is applied, the CCB is incremented for sig_flag, parity_flag, gtX_flag (X=1, 3, 5, 7, 9), and subblock_flag. In the example in Figure 51, the CCB is not incremented for subblock_flag. On the other hand, the processing flow when an orthogonal transformation is applied is the same as in the example in Figure 47. 【0410】 In other words, in the example in Figure 51, the encoding device 100 always encodes subblock_flag using CABAC encoding without counting up the CCB, regardless of whether the CCB exceeds the threshold (S123). 【0411】 [Effects of the second example of the first aspect of coefficient coding] As shown in the example in Figure 51, it may be possible to unify and standardize the encoding process of subblock_flag depending on whether orthogonal transformation is performed or not. Therefore, some circuits may be shared between cases where orthogonal transformation is performed and cases where it is not, potentially reducing the circuit size. As a result, multiple processing flows that differ depending on whether or not orthogonal transformation is performed may become the same, except for the presence or absence of last_sig_coeff. 【0412】 Furthermore, the processing is simplified in Figure 51 compared to Figure 50. Therefore, the circuit size may be reduced. Also, it is assumed that the frequency of occurrence of 0 or 1 in subblock_flag is likely to be biased depending on the surrounding circumstances. Therefore, it is assumed that the reduction in the amount of code is large compared to the increase in processing delay in CABAC coding of subblock_flag. For this reason, it is useful to perform CABAC coding of subblock_flag without including it in the limit of the number of CABAC coding iterations. 【0413】 The number of CABAC encoding operations for last_sig_coeff may be included in the CCB. Furthermore, thres may be determined based on the coordinate position defined in the block by last_sig_coeff. 【0414】 [Second aspect of coefficient coding] [First example of the second aspect of coefficient coding] Figure 52 is a flowchart showing a coefficient coding method according to the first example of the second embodiment. In the example of Figure 52, even when no orthogonal transformation is applied to the block, the 16 coefficients in the subblock are coded using the first coding scheme (S127a), which is different from the example of Figure 47. 【0415】 In other words, in the example in Figure 52, when no orthogonal transformation is applied to the block, the encoding device 100 encodes the 16 coefficients in the subblock using the first encoding method shown in Figure 48, rather than the second encoding method shown in Figure 49 (S127a). That is, whether or not an orthogonal transformation is applied, the encoding device 100 encodes the 16 coefficients in the subblock using the first encoding method shown in Figure 48, rather than the second encoding method shown in Figure 49. 【0416】 More specifically, regardless of whether orthogonal transformation is performed, the encoding device 100, following the first encoding scheme shown in Figure 48, skips encoding the coefficient information flag in the first loop processing if the CCB exceeds the threshold, without using bypass encoding. Then, in the second loop processing, if the coefficient information flag corresponding to the coefficient to be processed is not encoded, the encoding device 100 encodes the coefficient value using Golomb-Rice encoding without using the coefficient information flag. 【0417】 Note that the syntax for encoding the coefficient information flags in the first loop processing in Figure 48 may differ depending on whether or not an orthogonal transformation is applied. For example, one or more coefficient information flags when an orthogonal transformation is applied may differ from one or more coefficient information flags when an orthogonal transformation is not applied, and some or all of those coefficient information flags may differ. 【0418】 [Effects of the first example of the second aspect of coefficient coding] As illustrated in the example in Figure 52, even if the encoding syntax of the coefficient information flag differs depending on whether orthogonal transformations are applied, the encoding syntax of the 16 coefficients within the subblock may be common after the CCB exceeds the threshold, regardless of whether orthogonal transformations are applied. This may result in the sharing of some circuitry between cases where orthogonal transformations are applied and cases where they are not, potentially reducing the circuit size. 【0419】 Furthermore, after the CCB exceeds the threshold, the coefficients are encoded without being separated into coefficient information flags encoded by bypass coding and residual value information encoded by Golomb-Rice coding. Therefore, the increase in information may be suppressed, and the increase in code size may be suppressed. 【0420】 [Second example of the second aspect of coefficient coding] Figure 53 is a flowchart showing a coefficient coding method according to a second example of the second embodiment. In the example of Figure 53, even when an orthogonal transformation is applied to the block, the 16 coefficients in the subblock are coded using the second coding method (S147a), which differs from the example of Figure 47. 【0421】 In other words, in the example in Figure 53, when an orthogonal transform is applied to the block, the encoding device 100 encodes the 16 coefficients in the subblock using the second encoding method shown in Figure 49, rather than the first encoding method shown in Figure 48 (S147a). That is, whether or not an orthogonal transform is applied, the encoding device 100 encodes the 16 coefficients in the subblock using the second encoding method shown in Figure 49, rather than the first encoding method shown in Figure 48. 【0422】 More specifically, regardless of whether orthogonal transformation is performed, the encoding device 100, following the second encoding scheme shown in Figure 49, does not skip encoding in the first loop processing if the CCB exceeds the threshold, but instead encodes the coefficient information flag using bypass encoding. Then, in the second loop processing, the encoding device 100 encodes the remainder, which depends on the coefficient information flag, using Golomb-Rice encoding. 【0423】 Note that the syntax for encoding the coefficient information flags in the first loop processing in Figure 49 may differ depending on whether or not an orthogonal transformation is applied. For example, one or more coefficient information flags when an orthogonal transformation is applied may differ from one or more coefficient information flags when an orthogonal transformation is not applied, and some or all of those coefficient information flags may differ. 【0424】 [Effects of the second example of the second aspect of coefficient coding] As illustrated in the example in Figure 53, even if the encoding syntax of the coefficient information flag differs depending on whether orthogonal transformations are applied, the encoding syntax of the 16 coefficients within the subblock may be common after the CCB exceeds the threshold, regardless of whether orthogonal transformations are applied. This may result in the sharing of some circuitry between cases where orthogonal transformations are applied and cases where they are not, potentially reducing the circuit size. 【0425】 [Third aspect of coefficient coding] Figure 54 is a syntax diagram showing a basic first encoding scheme according to the third embodiment. The syntax shown in Figure 54 corresponds to an example of the syntax of the first encoding scheme shown in Figure 47. Basically, the first encoding scheme is used when orthogonal transforms are applied. 【0426】 Here, the coefficient information flags and parameters are the same as those shown in the first embodiment. Note that the multiple coefficient information flags shown here are just examples, and other multiple coefficient information flags may be encoded. For example, some coefficient information flags may not be encoded. Also, the coefficient information flags shown here may be replaced with coefficient information flags or parameters that have other meanings. 【0427】 The first for loop in the example in Figure 54 corresponds to the first loop processing in the example in Figure 48. In this first for loop, if a CCB remains, that is, if the CCB does not exceed the threshold, coefficient information flags such as sig_flag are encoded using CABAC coding. If no CCB remains, the coefficient information flags are not encoded. Note that the second example of the second embodiment may also be applied to this example. That is, if no CCB remains, the coefficient information flags may be encoded using bypass coding. 【0428】 The second and third for loops from the top correspond to the second loop processing in the example in Figure 48. In the second for loop from the top, the remaining values ​​are encoded using Golomb-Rice coding for coefficients for which the coefficient information flag has been encoded. In the third for loop from the top, the coefficients are encoded using Golomb-Rice coding for coefficients for which the coefficient information flag has not been encoded. Note that in this example, the second example of the second aspect may always be encoded using Golomb-Rice coding by applying the second example of the second aspect. 【0429】 In the fourth for loop from the top, sign_flag is encoded using bypass coding. 【0430】 The syntax described in this embodiment may be applied to the examples in Figures 47, 48, 50, 51, and 52. 【0431】 Figure 55 is a syntax diagram showing a basic second coding scheme according to the third embodiment. The syntax shown in Figure 55 corresponds to an example of the syntax of the second coding scheme in Figure 47. Basically, the second coding scheme is used when orthogonal transforms are not applied. 【0432】 Note that the coefficient information flags shown here are just examples, and other coefficient information flags may be encoded. For example, some coefficient information flags may not be encoded. Also, the coefficient information flags shown here may be replaced with coefficient information flags or parameters that have other meanings. 【0433】 The first five for loops in the example in Figure 55 correspond to the first loop processing in the example in Figure 49. In these first five for loops, if a CCB remains, that is, if the CCB does not exceed the threshold, coefficient information flags such as sig_flag are encoded using CABAC coding. If no CCB remains, the coefficient information flags are encoded using bypass coding. Note that the first example of the second embodiment may also be applied to this example. That is, if no CCB remains, the coefficient information flags do not need to be encoded. 【0434】 The sixth for loop from the top corresponds to the second loop processing in the example in Figure 49. In the sixth for loop from the top, the remaining value is encoded using Golomb-Rice coding. Note that the first example of the second embodiment may also be applied to this example. That is, for coefficients for which the coefficient information flag has been encoded, the remaining value may be encoded using Golomb-Rice coding. And for coefficients for which the coefficient information flag has not been encoded, the coefficient may be encoded using Golomb-Rice coding. 【0435】 The syntax described in this embodiment may be applied to the examples in Figures 47, 49, 50, 51, and 53. 【0436】 In the case where orthogonal transformation is not applied (Figure 55), the number of loop processes for encoding the coefficient information flag is greater than in the case where orthogonal transformation is applied (Figure 54). Therefore, the hardware processing load may increase when orthogonal transformation is not applied compared to when it is applied. Also, since the syntax for coefficient coding differs depending on whether orthogonal transformation is performed, it may be necessary to prepare separate circuits for each case. Consequently, the circuit may become more complex. 【0437】 [First example of the third aspect of coefficient coding] Figure 56 is a syntax diagram showing a second coding scheme according to the first example of the third embodiment. The syntax shown in Figure 56 corresponds to an example of the second coding scheme in Figure 47. The syntax shown in Figure 54 may be used for the first coding scheme in Figure 47. This example may be combined with other examples of the third embodiment, or with other embodiments. 【0438】 The first for loop in the example in Figure 56 corresponds to the first loop processing in the example in Figure 49. In this first for loop, if the remaining CCB is 8 or more, that is, if the CCB with 8 added does not exceed the threshold, up to 8 coefficient information flags are encoded using CABAC coding according to the coefficients, and the CCB is counted up to 8 times. If the remaining CCB is 8 or more, that is, if the CCB with 8 added exceeds the threshold, then 8 coefficient information flags are encoded using bypass coding according to the coefficients. 【0439】 In other words, before the eight coefficient information flags are encoded, a comprehensive determination is made as to whether or not it is possible to encode the eight coefficient information flags using CABAC encoding. If it is possible to encode the eight coefficient information flags using CABAC encoding, then up to eight coefficient information flags are encoded using CABAC encoding. 【0440】 Furthermore, the first example of the second embodiment may be applied to this example. That is, if there are no more than 8 CCBs remaining, the 8 coefficient information flags do not need to be encoded. In other words, in this case, the encoding of the 8 coefficient information flags may be skipped without them being encoded by bypass encoding. 【0441】 Furthermore, as shown in Figure 56, the encoding of one or more of the eight coefficient information flags may be omitted depending on the value of the coefficient. For example, if sig_flag is 0, the encoding of the remaining seven coefficient information flags may be omitted. 【0442】 The second for loop from the top corresponds to the second loop processing in the example in Figure 49. In the second for loop from the top, the remaining value is encoded using Golomb-Rice coding. Note that the first example of the second embodiment may also be applied to this example. That is, for coefficients for which the eight coefficient information flags have been encoded, the remaining value may be encoded using Golomb-Rice coding, and for coefficients for which the eight coefficient information flags have not been encoded, the coefficient may be encoded using Golomb-Rice coding. 【0443】 The coefficient information flags shown here are just examples, and other coefficient information flags may be encoded. For example, some coefficient information flags may not be encoded. Also, the coefficient information flags shown here may be replaced with coefficient information flags or parameters that have other meanings. 【0444】 Furthermore, the example in Figure 55 and the example in Figure 56 may be combined. For example, in the example in Figure 55, it may be comprehensively determined whether or not it is possible to encode the four coefficient information flags, such as sig_flag and sign_flag, using CABAC encoding before the four coefficient information flags are encoded. 【0445】 [Effects of the first example of the third aspect of coefficient coding] In the example in Figure 56, all coefficient information flags encoded by CABAC coding are encoded in a single loop. That is, compared to the example in Figure 55, the example in Figure 56 has fewer loops. Therefore, the processing load may be reduced. 【0446】 Furthermore, the number of loops used to encode multiple coefficient information flags using CABAC coding is the same in the example in Figure 54 and the example in Figure 56. Therefore, the combination of the example in Figure 54 and the example in Figure 56 may require fewer circuit modifications compared to the combination of the example in Figure 54 and the example in Figure 55. 【0447】 Furthermore, since it is comprehensively determined whether or not multiple coefficient information flags can be encoded using CABAC encoding before the multiple coefficient information flags are encoded, the process may be simplified and processing delays may be reduced. 【0448】 Furthermore, in both cases where orthogonal transformations are applied and where they are not, it may be comprehensively determined whether it is possible to encode multiple coefficient information flags using CABAC encoding before the multiple coefficient information flags are encoded. This could further reduce the difference between the encoding scheme used for blocks where orthogonal transformations are applied and the encoding scheme used for blocks where orthogonal transformations are not applied, potentially leading to an even smaller circuit size. 【0449】 Furthermore, in the example in Figure 56, sig_flag to abs_gt9_flag are included in a single loop, but the encoding scheme is not limited to this. Multiple loops (for example, two loops) may be used, and it may be comprehensively determined whether it is possible to encode multiple coefficient information flags using CABAC encoding for each loop. Compared to a single loop, the processing increases, but the effect of reducing processing compared to the example in Figure 55 is similar. 【0450】 [Second example of the third aspect of coefficient coding] Figure 57 is a syntax diagram showing a second coding scheme according to a second example of the third embodiment. The syntax shown in Figure 57 corresponds to an example of the second coding scheme in Figure 47. The syntax shown in Figure 54 may be used for the first coding scheme in Figure 47. This example may be combined with other examples of the third embodiment, or with other embodiments. 【0451】 The first for loop in the example in Figure 57 corresponds to the first loop processing in the example in Figure 49. In this first for loop, if the remaining CCB is 7 or greater, that is, if the CCB with 7 added does not exceed the threshold, up to 7 coefficient information flags are encoded using CABAC coding according to the coefficients, and the CCB is counted up to 7 times. If the remaining CCB is not 7 or greater, that is, if the CCB with 7 added exceeds the threshold, then 7 coefficient information flags are encoded using bypass coding according to the coefficients. 【0452】 In other words, before the seven coefficient information flags are encoded, a comprehensive determination is made as to whether or not it is possible to encode the seven coefficient information flags using CABAC encoding. If it is possible to encode the seven coefficient information flags using CABAC encoding, then the seven coefficient information flags are encoded using CABAC encoding. 【0453】 Furthermore, the first example of the second embodiment may be applied to this example. That is, if there are no more than 7 CCBs remaining, the seven coefficient information flags do not need to be encoded. In other words, in this case, the encoding of the seven coefficient information flags may be skipped without them being encoded by bypass encoding. 【0454】 Furthermore, as shown in Figure 57, the encoding of one or more of the seven coefficient information flags may be omitted depending on the value of the coefficient. For example, if sig_flag is 0, the encoding of the remaining six coefficient information flags may be omitted. 【0455】 The second for loop from the top corresponds to the second loop processing in the example in Figure 49. In the second for loop from the top, the remaining value is encoded using Golomb-Rice coding. Note that the first example of the second embodiment may also be applied to this example. That is, for coefficients for which the seven coefficient information flags have been encoded, the remaining value may be encoded using Golomb-Rice coding, and for coefficients for which the seven coefficient information flags have not been encoded, the coefficient may be encoded using Golomb-Rice coding. 【0456】 In the third for loop from the top, if a CCB remains, that is, if the CCB does not exceed the threshold, sign_flag is encoded using CABAC coding and the CCB is incremented. If no CCB remains, sign_flag is encoded using bypass coding. Note that, as in the example in Figure 54, sign_flag may always be encoded using bypass coding. 【0457】 The coefficient information flags shown here are just examples, and other coefficient information flags may be encoded. For example, some coefficient information flags may not be encoded. Also, the coefficient information flags shown here may be replaced with coefficient information flags or parameters that have other meanings. 【0458】 Furthermore, the example in Figure 55 and the example in Figure 57 may be combined. For example, in the example in Figure 55, it may be comprehensively determined whether or not it is possible to encode the four coefficient information flags, such as sig_flag and sign_flag, using CABAC encoding before the four coefficient information flags are encoded. 【0459】 [Effects of the second example of the third aspect of coefficient coding] Similar to the example in Figure 56, in the example in Figure 57, multiple coefficient information flags (specifically, abs_gt3_flag and abs_gt5_flag, etc.) used to represent the magnitude of the coefficients in comparison to a threshold are encoded in a single loop. Therefore, the example in Figure 57 has fewer loops compared to the example in Figure 55. As a result, the processing load may be reduced. 【0460】 Compared to the example in Figure 56, the example in Figure 57 involves more loop processing to encode multiple coefficient information flags. However, the example in Figure 57 has similarities to the example in Figure 54 compared to the example in Figure 56. For example, sign_flag is encoded last. Therefore, the combination of the examples in Figure 54 and Figure 57 may require fewer circuit modifications compared to the combination of the examples in Figure 54 and Figure 56. 【0461】 Furthermore, since it is comprehensively determined whether or not multiple coefficient information flags can be encoded using CABAC encoding before the multiple coefficient information flags are encoded, the process may be simplified and processing delays may be reduced. 【0462】 Furthermore, in both cases where orthogonal transformations are applied and where they are not, it may be comprehensively determined whether it is possible to encode multiple coefficient information flags using CABAC encoding before the multiple coefficient information flags are encoded. This could further reduce the difference between the encoding scheme used for blocks where orthogonal transformations are applied and the encoding scheme used for blocks where orthogonal transformations are not applied, potentially leading to an even smaller circuit size. 【0463】 Furthermore, in the example in Figure 57, sig_flag to abs_gt9_flag are included in a single loop, but the encoding scheme is not limited to this. Multiple loops (for example, two loops) may be used, and it may be comprehensively determined whether it is possible to encode multiple coefficient information flags using CABAC encoding for each loop. Compared to a single loop, the processing increases, but the effect of reducing processing compared to the example in Figure 55 is similar. 【0464】 [Fourth aspect of coefficient coding] Figure 58 shows the basic correspondence between coefficient information flags and context numbers according to the fourth embodiment. Specifically, Figure 58 shows an example of a method for determining the context number for encoding the coefficient information flags, which are encoded when no orthogonal transformation is applied, using CABAC encoding. One context number points to one occurrence probability for a value of 0 or 1. The encoding device 100 performs arithmetic encoding of the coefficient information flags using this occurrence probability. 【0465】 For example, if a coefficient information flag to be encoded is likely to be 0, the amount of code can be reduced by encoding that coefficient information flag using CABAC coding based on a context number that indicates a high probability of occurrence for the value 0. In other words, the amount of code can be reduced by performing arithmetic coding of the coefficient flag based on an appropriate context number that indicates an appropriate probability of occurrence. 【0466】 Figure 59 is a conceptual diagram showing a basic set of adjacent coefficients relating to the fourth embodiment. In Figure 59, x represents the coefficient to be encoded. 【0467】 The coefficient scan is performed diagonally from the top left of the 4x4 subblock shown in Figure 59. Specifically, in a coordinate system where the top left is (0,0), the top right is (3,0), the bottom left is (0,3), and the bottom right is (3,3), the coefficient scan is performed in the order of (0,0), (0,1), (1,0), (0,2), (1,1), ..., (3,3). L and U represent two coefficients adjacent to x. The positions of coefficients L and U are adjacent to the position of coefficient x. Without the application of orthogonal transformations, the three positions of coefficient x, L, and U correspond to three pixel positions, respectively. 【0468】 In this case, as shown in the example in Figure 58, the sum of the sig_flag values ​​of coefficients L and U is used as the context number for encoding the sig_flag of coefficient x. In other words, three context numbers are selectively used. Additionally, a fixed context number is used for each of parity_flag and gtX_flag (where X in gtX is, for example, 1, 3, 5, 7, or 9). 【0469】 In other words, in Figure 58, only one context number is used for coefficient information flags other than sig_flag. Generally, in blocks to which orthogonal transformation is not applied, multiple pixels arranged horizontally or vertically tend to be correlated. However, when only one context number is used, a context number corresponding to this tendency is not selected. 【0470】 For example, when a gt3_flag is encoded, the coefficient to which the gt3_flag is encoded may not be located on the horizontal or vertical line of the coefficient to be encoded among several already encoded coefficients. In this case, it is highly likely that the value of the gt3_flag to be encoded will differ from the values ​​of other gt3_flags that have been encoded in the past. As a result, the appropriate probability of occurrence of the value of the gt3_flag to be encoded may not be used, potentially leading to a decrease in compression efficiency. 【0471】 [First example of the fourth aspect of coefficient coding] Figure 60 is a conceptual diagram showing multiple adjacent coefficients in the first example of the fourth embodiment. In Figure 60, x represents the coefficient to be encoded. x0, x1, and x2 each represent three encoded coefficients adjacent to x. When no orthogonal transformation is applied, the four positions of coefficients x, x0, x1, and x2 correspond to four pixel positions, respectively. Furthermore, in the following, x, x0, x1, and x2 may each represent the absolute value of the coefficient. 【0472】 In this case, based on the absolute values ​​of the three adjacent coefficients x0, x1, and x2, the predicted value of x, pred, is determined as follows: 【0473】 【number】 【0474】 However, if x is located at a block boundary and therefore no adjacent pixels exist, the coefficient of that adjacent pixel is considered to be 0, and pred is calculated. 【0475】 When no orthogonal transformation is applied to a block, there is a tendency for edges to exist along the vertical or horizontal direction within the block. Here, an edge is a collection of pixels whose pixel value is larger than that of the surrounding pixels. Regarding the above pred, it is assumed that the prediction accuracy is high both when the coefficient x is on an edge and when it is not. The reason is as follows. 【0476】 Figure 61A is a conceptual diagram showing the coding target coefficients located at horizontal edge positions. In Figure 61A, the shaded area represents an edge, and x lies on an edge. In this case, since x1 is greater than or equal to x0, condition (3A) is likely to hold for calculating pred. In this case, since x1 is greater than or equal to x2, pred = x1. That is, pred for x on an edge is obtained as x1 on the edge. 【0477】 Figure 61B is a conceptual diagram showing the coding target coefficients located at vertical edge positions. In Figure 61B, pred can be found using the same logic as x2 on the edge. Specifically, in Figure 61B, the shaded area is an edge, and x lies on the edge. In this case, since x2 is greater than or equal to x0, condition (3A) is likely to hold for calculating pred. And in this case, since x2 is greater than or equal to x1, pred = x2. That is, pred for x on the edge can be found as x2 on the edge. 【0478】 Figure 62A is a conceptual diagram showing the coding target coefficients adjacent to the horizontal edge positions. In Figure 62A, the shaded area is an edge, and x is outside the edge. In this case, x0 is on the edge and is greater than x1, so condition (3B) is likely to hold for calculating pred. And in this case, x2 is greater than or equal to x1, so pred = x1. That is, pred for x outside the edge can be found to be x1 outside the edge. 【0479】 Figure 62B is a conceptual diagram showing the coding target coefficients adjacent to the vertical edge positions. In Figure 62B, pred is calculated using the same logic as x2 outside the edge. Specifically, in Figure 62B, the shaded area is an edge, and x is outside the edge. In this case, x0 is on the edge and is greater than x2, so condition (3B) is likely to hold for calculating pred. And in this case, since x1 is greater than or equal to x2, pred = x2. That is, pred for x outside the edge is calculated as x2 outside the edge. 【0480】 Furthermore, if no edges exist around x, it is assumed that x corresponds to a value that smoothly changes from the pixels x0, x1, and x2. Therefore, as shown in conditional equation (3C), x1+x2-x0, which corresponds to the plane prediction value, can be obtained as the value of pred. 【0481】 In this example, the context number of the sig_flag for coefficient x is determined based on the pred described above. The syntax of the first example in the third embodiment is used as the syntax for coefficient coding, but other syntaxes may be used. 【0482】 The minimum absolute value of the coefficients represented by x0, x1, and x2 adjacent to x is estimated based only on the multiple coefficient information flags processed in the first loop. That is, if y0, y1, and y2 are the original absolute values ​​of the coefficients, the estimated minimum values ​​of x0, x1, and x2 are expressed as follows: Here, a%b represents the remainder when a is divided by b. 【0483】 【number】 【0484】 These three values ​​are used to calculate pred. pred is the predicted minimum value of x estimated based only on the multiple coefficient information flags processed in the first loop, and specifically, it is the predicted value of min(x, 11-!(x%2)). The context number of the sig_flag for the coefficient x, sig_ctx, is defined as follows. 【0485】 【number】 【0486】 In Figure 58, three different context numbers are used to determine the context number of sig_flag, using the two coefficients on the left and above. In this example, two different context numbers are used, using the three coefficients adjacent to the coefficient to be encoded. 【0487】 In this example, the predicted value of the coefficient, pred, is obtained using three coefficients adjacent to the coefficient to be encoded. The number of adjacent coefficients used to calculate pred may be different. Also, the three coefficients may be obtained from different locations than those in this example. Furthermore, the method for calculating pred may be changed. In addition, the absolute values ​​of the coefficients x0, x1, and x2 may be estimated using all flags within the same loop processing, or they may be estimated using only some of the flags. 【0488】 Furthermore, in the example in Figure 58, one context number is used for coefficient information flags other than sig_flag. However, multiple context numbers may be selectively used for coefficient information flags other than sig_flag by using the same method as in this example. For example, the context numbers parity_ctx and gtX_ctx for the parity_flag and gtX_flag (where X in gtX is, for example, 1, 3, 5, 7, or 9) of the coefficient x to be encoded may be derived as follows. 【0489】 【number】 【0490】 【number】 【0491】 In this example, the context number for each coefficient information flag is selected from two types of context numbers based on the value of `pred`. These two types of context numbers may be shared across multiple different coefficient information flags. Furthermore, there may be coefficient information flags whose context numbers are determined by a different method. For example, the method shown in Figure 58 may be used to determine the context number for `sig_flag`, while the method in this example may be used for determining the context numbers of the other coefficient information flags, or vice versa. 【0492】 [Effects of the first example of the fourth aspect of coefficient information coding] As mentioned above, the prediction accuracy of the coefficient for pred may be high. Therefore, for example, with respect to gtX_ctx, the context number may be switched depending on whether the predicted value pred is greater than or less than the threshold X (X in gtX), which may lead to the use of an appropriate probability of occurrence and a higher compression ratio. Similarly, with respect to sig_flag, compared to examples using two adjacent coefficients as shown in Figures 58 and 59, this example may result in a higher compression ratio according to the higher prediction accuracy of the coefficient. 【0493】 [Second example of the fourth aspect of coefficient information coding] In the first example of the fourth embodiment, a predicted value pred is used to select the context number of the coefficient information flag for coefficient x, using the values ​​of multiple types of coefficient information flags that have already been encoded within the loop processing in which the coefficient information flag is encoded. 【0494】 In this example, the value of the coefficient information flag for the coefficient to be encoded is predicted using the values ​​of three coefficient information flags for three coefficients adjacent to the coefficient to be encoded, which are of the same type as the coefficient information flag for the coefficient to be encoded. 【0495】 For example, if the gt3_flag of the coefficient x to be encoded is encoded, the predicted value of gt3_flag, gt3_flag_pred, can be calculated as follows. Here, x0, x1, and x2 are the three coefficients adjacent to x, as shown in Figure 60. 【0496】 【number】 【0497】 Then, gt3_flag_pred is defined as gt3_ctx, which is the context number of gt3_flag for coefficient x. 【0498】 【number】 【0499】 In this example, the three gt3_flag values ​​of the three neighbor coefficients used for prediction, and the predicted value gt3_flag_pred, are each either 0 or 1. Therefore, gt3_flag_pred can be expressed using only bitwise operations as follows. 【0500】 【number】 【0501】 Similarly, the predicted values ​​for the coefficient information flags sig_flag, parity_flag, gt1_flag, gt5_flag, gt7_flag, and gt9_flag are obtained using the method described above. Then, the context number is determined. 【0502】 Furthermore, the number of coefficients used to predict the coefficient information flag may be changed, and the position of the coefficients may be changed. Also, the method for predicting the coefficient information flag may be changed. In addition, the number of candidate context numbers for the coefficient information flag may be increased. 【0503】 [Effects of the second example of the fourth aspect of coefficient coding] In the prediction of coefficient information flags in the second example of the fourth aspect, similar to the prediction of coefficient information flags in the first example of the fourth aspect, the prediction accuracy may be higher both when the coefficient is on an edge and when it is not. As a result, the compression ratio of cabac may be higher. 【0504】 Furthermore, since the predicted value of the coefficient information flag can be obtained using only bitwise operations, the amount of processing required may be reduced compared to the calculation of pred in the first example of the fourth embodiment. 【0505】 [Third example of the fourth aspect of coefficient coding] This example also relates to the processing flow when orthogonal transformation is not applied, as in the example in Figure 47. The syntax for coefficient coding is the first example of the third aspect, i.e., the example in Figure 56, but other syntaxes may be used. In the example in Figure 56, the remainder, which is the residual value of the coefficient not represented by the coefficient information flag, is coded using Golomm-Rice coding. The explanation of the remainder is as described in the first aspect of coefficient coding. 【0506】 In this example, the Rice parameters used in Golomb-Rice coding are selected using a pred, which is a value predicted using three coefficients adjacent to the coefficient to be coded, as described in the first example of the fourth aspect. 【0507】 First, let's explain the basics of Golomb-Rice coding. The coding of remainder uses a technique called Golomb-Rice coding. In Golomb-Rice coding, the value of remainder is binarized using a prefix and a suffix. 【0508】 Rice coding is used for the prefix. The coding method can be switched using the Rice parameter g (where g is, for example, a value of 0, 1, or 2). Unary coding and exponential Golomb coding are used for the suffix. 【0509】 Figure 63 is a conceptual diagram showing the correspondence between the residual value and the Golomb-Rice code in the third example of the fourth embodiment. Specifically, Figure 63 shows the respective encoding bins of the prefix and suffix when the remainder is encoded using Golomb-Rice coding, depending on the value of the Rice parameter. 【0510】 Here, x represents the coefficient to be encoded. x may also represent the absolute value of the coefficient. remainder[x] represents the remainder of x in the processing flow of Figure 49. remainder[x0], remainder[x1], and remainder[x2] represent the three remainders of the three coefficients adjacent to x in Figure 60, respectively. 【0511】 Furthermore, if any of the three coefficients adjacent to the coefficient to be encoded are represented by one or more coefficient information flags, meaning no remainder has occurred, the remainder for that coefficient may be represented as 0. The predicted value of remainder[x], remainder_pred, can then be determined as follows. 【0512】 【number】 【0513】 The Rice parameter r used in the Golomb-Rice coding of remainder[x] is derived as follows: 【0514】 【number】 【0515】 In this case, the Rice parameter table may be defined as follows, for example: 【0516】 【number】 【0517】 Furthermore, the number of coefficients used in predicting remainder[x] may be changed, or the position of the coefficients used in predicting remainder[x] may be changed. The method for determining remainder_pred may be changed. In addition, the values ​​in the rice parameter table may be changed. A calculation method different from the rice parameter calculation method mentioned above may be used. The third example of the fourth embodiment may be used in combination with the first example of the fourth embodiment, the second example of the fourth embodiment, or other embodiments. 【0518】 Furthermore, reminder_pred may be derived based on the absolute value of the coefficient adjacent to the coefficient to be encoded, as in the first example of the fourth embodiment, rather than being the reminder of the coefficient adjacent to the coefficient to be encoded. 【0519】 Specifically, based on the three absolute values ​​x0, x1, and x2 of three coefficients adjacent to the coefficient to be encoded, the predicted value of x, remainder_pred, may be calculated in a manner similar to that described with reference to Figure 60. Then, the Rice parameters may be derived using remainder_pred in the manner described above. 【0520】 In the above case, reminder_pred will be large because it is based on the absolute value of the coefficient, not the reminder of the coefficient. Therefore, the Rice parameter table may be designed so that the Rice parameter for reminder_pred based on the absolute value is smaller than the Rice parameter for reminder_pred based on the reminder. 【0521】 Alternatively, reminder_pred may be converted to reminder_pred' as shown below. The same table used to derive the rice parameters for reminder_pred based on reminder may also be used to derive the rice parameters for reminder_pred'. 【0522】 【number】 【0523】 [Effects of the third example of the fourth aspect of coefficient coding] In the third example of the fourth aspect, the prediction of the remainder can also be highly accurate, similar to the prediction of the coefficient information flag in the first example of the fourth aspect, both when the coefficient is on an edge and when it is not. 【0524】 Furthermore, for example, the Rice parameter table is designed so that the code length of the remainder encoded using Golomb-Rice coding is minimized, based on the Rice parameters obtained according to the retainer_pred substituted into the Rice parameter table. Therefore, it is possible that the code length of the remainder encoded using Golomb-Rice coding will indeed be minimized when using these Rice parameters. 【0525】 [Fifth aspect of coefficient coding] Figure 64 is a flowchart illustrating a basic coefficient coding method according to the fifth embodiment. Specifically, Figure 64 shows a coefficient coding method for the region where a prediction residual was obtained using intra-coding or inter-coding. 【0526】 In the example in Figure 64, unlike the example in Figure 47, the 16 coefficients within the subblock are encoded using a third encoding method (S147b) when an orthogonal transformation is applied. That is, in the example in Figure 64, when an orthogonal transformation is applied to the block, the encoding device 100 encodes the 16 coefficients within the subblock using a third encoding method described later, rather than the first encoding method shown in Figure 48 (S147b). 【0527】 Figure 65 is a flowchart detailing the third encoding scheme shown in Figure 64. In the third encoding scheme, multiple coefficients within a subblock are encoded. At that time, a first loop process (S151-S156) is performed for each coefficient information flag within the subblock, and a second loop process (S161-S165) is performed for each coefficient within the subblock. 【0528】 In the first loop processing (S151-S156), one or more coefficient information flags are sequentially encoded, similar to the first encoding scheme shown in Figure 48. The one or more coefficient information flags may include sig_flag, gt1_flag, parity_flag, and gt3_flag. Then, as long as the CCB does not exceed the threshold, one or more coefficient information flags are sequentially encoded using CABAC encoding, and the CCB is counted up by one each time encoding is performed. After the CCB exceeds the threshold, no further coefficient information flags are encoded. 【0529】 In the second loop processing (S161-S165), for coefficients for which the coefficient information flag has been encoded, the remaining value not represented by the coefficient information flag (i.e., the remaining value for reconstructing the coefficient value using the coefficient information flag) is encoded using Golom-Rice coding. Coefficients for which the coefficient information flag was not encoded are encoded using Golom-Rice coding after the conversion process described later (S164a) (S164b). Note that the remainder may be encoded using a different coding scheme instead of Golom-Rice coding. 【0530】 In other words, in the second loop processing (S161-S165), similar to the first encoding method shown in Figure 48, the encoding device 100 determines whether or not a coefficient information flag corresponding to the coefficient to be processed has been encoded (S162). If the coefficient information flag has been encoded (Yes in S162), the encoding device 100 encodes the remainder using Golomb-Rice encoding (S163). 【0531】 In the third coding scheme shown in Figure 65, if the coefficient information flag is not coded (No in S162), the coding device 100 applies a conversion process called zeropos processing or poszero processing, described later, to the coefficient value (S164a). Subsequently, the coding device 100 codes the coefficient value using Golomb-Rice coding (S164b). 【0532】 Note that while the number of loop iterations is 2 here, the number of loop iterations may be different from 2. 【0533】 Next, an example of the conversion process (S164a) described above will be explained using Figures 66 and 67. 【0534】 Figure 66 is a conceptual diagram showing multiple peripheral coefficients relating to the fifth embodiment. In this example, the coefficient scan is performed diagonally from the lower right of the 4x4 subblock shown in Figure 66. Specifically, in a coordinate system where the upper left is (0,0), the upper right is (3,0), the lower left is (0,3), and the lower right is (3,3), the coefficient scan is performed in the order of, for example, (3,3), (3,2), (2,3), (3,1), (2,2), ..., (0,0). 【0535】 Furthermore, 'a' represents the coefficient to be encoded (i.e., processed). a0, a1, a2, a3, and a4 represent the five encoded (i.e., processed) coefficients around coefficient 'a'. In the following, each of 'a', 'a0', 'a1', 'a2', 'a3', and 'a4' may represent the value of the coefficient, or more specifically, the absolute value of the coefficient. 【0536】 The encoding device 100 obtains sum, which is the sum of the absolute values ​​of the five coefficients a0, a1, a2, a3, and a4. Then, the encoding device 100 determines a value called poszero based on sum. For example, the encoding device 100 may determine poszero corresponding to sum by referring to a lookup table. 【0537】 Next, the encoding device 100 compares value a with poszero. Then, the encoding device 100 converts value a to value b, which is determined as follows. 【0538】 【number】 【0539】 Finally, the encoding device 100 encodes the value b obtained by transforming value a using Golomb-Rice coding. 【0540】 Figure 67 is a conceptual diagram showing the conversion process according to the fifth embodiment. In the example in Figure 67, poszero is 4. When value a is 0, value b is poszero (i.e., 4). When value a is greater than 0 and less than or equal to poszero (i.e., less than or equal to 4), value b is a-1. When value a is greater than poszero (i.e., greater than 4), value b is value a. In this way, value b is uniquely determined by value a. 【0541】 Furthermore, as shown in Figure 67, if value b is determined, value a is uniquely determined. Therefore, the decoding device 200 may decode value b using Golombrice decoding and convert the decoded value b to value a. For example, the decoding device 200 may derive value a by converting value b to value a, which is determined as follows. 【0542】 【number】 【0543】 Note that the multiple marginal coefficients used to determine poszero are not limited to the five coefficients mentioned above. Coefficients located in positions different from the five coefficients mentioned above may be used as marginal coefficients to determine poszero. Furthermore, six or more multiple marginal coefficients may be used to determine poszero, four or fewer multiple marginal coefficients may be used, or only one marginal coefficient may be used. For example, poszero may be determined according to the sum of the absolute values ​​of two coefficients, a3 and a4. 【0544】 Furthermore, poszero may be determined according to sum and other information besides sum. 【0545】 Furthermore, in the example shown in Figure 66, the positions of the peripheral coefficients for determining poszero are determined according to the scanning order, starting from the bottom right. However, if the scanning order is reversed, the positions of the peripheral coefficients for determining poszero may be inverted. 【0546】 Generally, in the region to which orthogonal transformations are applied, if the CCB exceeds the limit, the proportion of zero coefficients (zero coefficients) decreases compared to when the CCB does not exceed the limit. Therefore, if the value of a coefficient is greater than 0 and less than or equal to poszero, 1 is subtracted from that value. This reduces the amount of code generated by the subsequent Golomb-Rice coding. As a result, coding efficiency is improved. 【0547】 Next, using Figure 66, an example of Golomb-Rice coding (S164b) of coefficients to which the transformation process (S164a) has been applied will be explained. For example, in Golomb-Rice coding (S164b), five peripheral coefficients a0, a1, a2, a3, and a4 are used, similar to the transformation process (S164a). 【0548】 Specifically, the encoding device 100 obtains sum, which is the sum of the absolute values ​​of five coefficients a0, a1, a2, a3, and a4. Then, the encoding device 100 determines the rice parameter r according to sum. For example, the encoding device 100 may determine the rice parameter r corresponding to sum by referring to a lookup table. 【0549】 The encoding device 100 encodes the value b using Golomb-Rice coding as explained with reference to Figure 63. In doing so, the encoding device 100 uses the Rice parameter r, determined according to sum, for Golomb-Rice coding. 【0550】 Note that the multiple marginal coefficients used to determine the rice parameter r are not limited to the five coefficients mentioned above. Coefficients located in positions different from the five coefficients mentioned above may be used as marginal coefficients to determine the rice parameter r. Furthermore, six or more marginal coefficients may be used to determine the rice parameter r, or four or fewer marginal coefficients may be used, or only one marginal coefficient may be used. For example, the rice parameter r may be determined according to the sum of the absolute values ​​of two coefficients, a3 and a4. 【0551】 Furthermore, the multiple marginal coefficients used to determine the Rice parameter r may be the same as, or different from, the multiple marginal coefficients used to determine poszero. 【0552】 Furthermore, the rice parameter r may be determined according to the sum and other information besides the sum. 【0553】 Furthermore, in the example shown in Figure 66, the positions of the peripheral coefficients for determining the rice parameter r are determined according to the scan order, starting from the bottom right. However, if the scan order is reversed, the positions of the peripheral coefficients for determining the rice parameter r may be inverted. 【0554】 Generally, in the region where orthogonal transformations are applied, the coefficient values ​​tend to increase from the high-frequency side to the low-frequency side. Therefore, by determining the Rice parameter r for encoding the coefficients using Golomb-Rice coding according to the values ​​of the peripheral coefficients, coding efficiency may be improved. 【0555】 [First example of the fifth aspect of coefficient coding] Figure 68 is a flowchart showing a coefficient coding method according to the first example of the fifth embodiment. Specifically, Figure 68 shows a coefficient coding method for a region in which a predicted residual was obtained by intra coding or inter coding. 【0556】 In the example in Figure 68, unlike the example in Figure 64, the 16 coefficients in the subblock are encoded using the third encoding method (S127b) when no orthogonal transformation is applied. That is, in the example in Figure 68, even when no orthogonal transformation is applied to the block, the encoding device 100 encodes the 16 coefficients in the subblock using the third encoding method described above, rather than the second encoding method shown in Figure 49 (S127b). 【0557】 Note that the syntax for encoding the coefficient information flags in the first loop processing in Figure 65 may differ depending on whether or not an orthogonal transformation is applied. For example, one or more coefficient information flags when an orthogonal transformation is applied may differ from one or more coefficient information flags when an orthogonal transformation is not applied, and some or all of those coefficient information flags may differ. 【0558】 [Effects of the first example of the fifth aspect of coefficient coding] As illustrated in the example in Figure 68, even if the encoding syntax of the coefficient information flag differs depending on whether orthogonal transformations are applied, the encoding syntax of the 16 coefficients within the subblock may be common after the CCB exceeds the threshold, regardless of whether orthogonal transformations are applied. This may result in the sharing of some circuitry between cases where orthogonal transformations are applied and cases where they are not, potentially reducing the circuit size. 【0559】 Furthermore, the coding process for the 16 coefficients within the subblock (S127b and S147b) may differ depending on whether or not an orthogonal transformation is applied. For example, the number of peripheral coefficients used in calculating poszero and the Rice parameter r in the coding process for the 16 coefficients within the subblock (S127b and S147b) may differ depending on whether or not an orthogonal transformation is applied. 【0560】 Furthermore, the number of marginal coefficients used to calculate poszero may differ from the number of marginal coefficients used to calculate the rice parameter r. 【0561】 Furthermore, the positions of the peripheral coefficients used in calculating poszero and the Rice parameter r may be determined according to the respective scan order when orthogonal transformations are applied and when they are not. For example, if the scan order is different, the positions of the peripheral coefficients used in calculating poszero and the Rice parameter r may be different. 【0562】 [Second example of the fifth aspect of coefficient coding] Figure 69 is a flowchart illustrating a coefficient coding method according to a second example of the fifth embodiment. Specifically, Figure 69 shows a coefficient coding method for a region where a prediction residual was obtained using intra-coding or inter-coding. 【0563】 In the example in Figure 69, unlike the example in Figure 64, the 16 coefficients in the subblock are encoded using the first encoding method (S127a) when no orthogonal transformation is applied. That is, in the example in Figure 69, the encoding device 100 encodes the 16 coefficients in the subblock using the first encoding method shown in Figure 48, rather than the second or third encoding method, when no orthogonal transformation is applied to the block (S127a). 【0564】 For example, in the third encoding scheme, the conversion process (S164a) shown in Figure 65 is performed. On the other hand, in the first encoding scheme, the conversion process (S164a) shown in Figure 65 is not performed. In this respect, the first encoding scheme differs from the third encoding scheme. Apart from this point, the first encoding scheme may be the same as the third encoding scheme. 【0565】 Note that the syntax for encoding the coefficient information flags in the first loop processing in Figures 48 and 65 may differ depending on whether or not an orthogonal transformation is applied. For example, one or more coefficient information flags when an orthogonal transformation is applied may differ from one or more coefficient information flags when an orthogonal transformation is not applied. 【0566】 [Effects of the second example of the fifth aspect of coefficient coding] In the example in Figure 69, the encoding syntax for the coefficient information flag may differ depending on whether or not an orthogonal transform is applied. On the other hand, regardless of whether or not an orthogonal transform is applied, the encoding syntax for the 16 coefficients within the subblock may be common after the CCB exceeds the threshold, except for the poszero operation. This may result in some circuitry being shared between the cases where orthogonal transforms are applied and those where they are not, potentially reducing the circuit size. 【0567】 Generally, when orthogonal transforms are applied, poszero processing is effective in improving coding efficiency. On the other hand, when orthogonal transforms are not applied, poszero processing is not as effective in improving coding efficiency. Therefore, when orthogonal transforms are not applied, poszero processing may not be necessary. This may improve both processing efficiency and coding efficiency. 【0568】 Furthermore, the number of peripheral coefficients used to calculate poszero and the Rice parameter r in the third coding scheme may differ depending on whether or not an orthogonal transformation is applied. Also, the number of peripheral coefficients used to calculate poszero may differ from the number of peripheral coefficients used to calculate the Rice parameter r. 【0569】 Furthermore, the positions of the peripheral coefficients used in calculating poszero and the Rice parameter r may be determined according to the respective scan order when orthogonal transformations are applied and when they are not. For example, if the scan order is different, the positions of the peripheral coefficients used in calculating poszero and the Rice parameter r may be different. 【0570】 [Variations of coefficient coding] Any multiple embodiments and examples of the coefficient coding described above may be combined. Furthermore, any of the multiple embodiments, examples, and any combination thereof of the coefficient coding described above may be applied to a luminance block or to a chrominance block. In this case, different thresholds may be used for the luminance block and the chrominance block. 【0571】 Furthermore, for blocks to which orthogonal transformation is not applied, but to which BDPCM (Block-based Delta Pulse Code Modulation) is applied, any of the above-mentioned multiple embodiments, multiple examples, and any multiple combinations thereof of coefficient coding may be used. In blocks to which BDPCM is applied, the amount of information is reduced by subtracting each residual signal within the block from a residual signal that is perpendicular or horizontally adjacent to that residual signal. 【0572】 Furthermore, in blocks to which BDPCM is applied, any of the above-mentioned multiple embodiments, multiple examples, and any multiple combinations thereof of coefficient coding may be used for color difference blocks. 【0573】 Furthermore, any of the above-described embodiments, examples, and any combination thereof of coefficient coding may be used for blocks to which ISP (Intra Sub-Partitions) is applied. In ISP, the intra-block is divided vertically or horizontally, and intra-prediction for each sub-block is performed using the pixel values ​​of the sub-blocks adjacent to that sub-block. 【0574】 Furthermore, in blocks to which ISP is applied, any of the multiple embodiments, multiple examples, and any multiple combinations thereof relating to coefficient coding described above may be used for color difference blocks. 【0575】 Furthermore, when chroma joint coding is used as the coding mode for blocks of color difference, any of the above-mentioned multiple embodiments, multiple examples, and any multiple combinations thereof of coefficient coding may be used. Here, chroma joint coding is a coding method that derives the value of Cr from the value of Cb. 【0576】 Furthermore, the value of thres when an orthogonal transformation is applied may be twice the value of thres when an orthogonal transformation is not applied. Alternatively, the value of thres when an orthogonal transformation is not applied may be twice the value of thres when an orthogonal transformation is applied. 【0577】 Furthermore, only when chrominance coupling coding is used, the threshold value of the CCB when an orthogonal transformation is applied may be twice the threshold value of the CCB when an orthogonal transformation is not applied. Alternatively, only when chrominance coupling coding is used, the threshold value of the CCB when an orthogonal transformation is not applied may be twice the threshold value of the CCB when an orthogonal transformation is applied. 【0578】 Furthermore, in the various embodiments and examples of coefficient coding described above, the scan order of multiple coefficients in a block where no orthogonal transformation is applied may be the same as the scan order of multiple coefficients in a block where an orthogonal transformation is applied. 【0579】 Furthermore, while several examples of syntax are shown in the third aspect and several examples thereof, the applicable syntax is not limited to these examples. For example, in several aspects other than the third aspect and several examples thereof, syntax different from any of the syntaxes shown in the third aspect and several examples thereof may be used. Various syntaxes may be applied to encode the 16 coefficients. 【0580】 Although the coding process flow is shown in multiple embodiments and examples of coefficient coding, the decoding process flow is basically the same as the coding process flow, except for the difference in whether a bitstream is sent or received. For example, the decoding device 200 may perform an inverse orthogonal transform and decoding corresponding to the orthogonal transform and coding performed by the encoding device 100. 【0581】 Furthermore, each flowchart relating to multiple modes and examples of coefficient coding is merely an example. Conditions or processes may be added, deleted, or modified for each flowchart. 【0582】 Furthermore, the coefficients here are values ​​that constitute an image, such as blocks or subblocks. Specifically, multiple coefficients that constitute an image may be obtained from multiple pixel values ​​of the image via an orthogonal transformation. Alternatively, multiple coefficients that constitute an image may be obtained from multiple pixel values ​​of the image without an orthogonal transformation. In other words, the multiple coefficients that constitute an image may be the multiple pixel values ​​of the image themselves. Also, each pixel value may be the pixel value of the original image, or it may be the value of the predicted residual. Furthermore, the coefficients may be quantized. 【0583】 [Representative examples of configuration and processing] A typical example of the configuration and processing of the encoding device 100 and decoding device 200 described above is shown below. 【0584】 Figure 70 is a flowchart showing the operation of the encoding device 100. For example, the encoding device 100 includes a circuit and a memory connected to the circuit. The circuit and memory of the encoding device 100 may correspond to the processor a1 and memory a2 shown in Figure 40. The circuit of the encoding device 100 performs the operation shown in Figure 70. Specifically, in its operation, the circuit of the encoding device 100 encodes blocks of an image (S211). 【0585】 For example, the circuit of the encoding device 100 may encode blocks of an image by limiting the number of context-adaptive encoding processes. 【0586】 Furthermore, the coefficient information flag may be encoded by context-adaptive coding if the number of processing steps is within the processing limit, both when an orthogonal transformation is applied to the block and when an orthogonal transformation is not applied to the block. Also, in both of these cases, the encoding of the coefficient information flag may be skipped if the number of processing steps is not within the processing limit. Here, the coefficient information flag indicates the attributes of the coefficients included in the block. 【0587】 Furthermore, in both of these cases, if the coefficient information flag is encoded, the residual information may be encoded by Golomb-Rice coding. Here, the residual information is information for reconstructing the coefficient values ​​using the coefficient information flag. 【0588】 Furthermore, if an orthogonal transformation is applied to a block and the encoding of the coefficient information flag is skipped, the transformation process may be performed and the coefficient values ​​may be encoded using Golomb-Rice coding. Also, if an orthogonal transformation is not applied to a block and the encoding of the coefficient information flag is skipped, the transformation process may not be performed and the coefficient values ​​may be encoded using Golomb-Rice coding. 【0589】 Here, the transformation process is the process of transforming the value of a coefficient using a value determined using the peripheral coefficients. The peripheral coefficients are the coefficients in the vicinity of the coefficient's position within the block. 【0590】 This means that, regardless of whether orthogonal transformations are applied, the encoding of coefficient information flags may be skipped according to the limitations on the number of processing iterations in context-adaptive coding. Therefore, the increase in processing delay and the increase in coding size may be suppressed. In addition, the difference between the encoding scheme used for blocks where orthogonal transformations are applied and the encoding scheme used for blocks where orthogonal transformations are not applied may be reduced, potentially resulting in a smaller circuit size. 【0591】 Furthermore, by appropriately controlling whether or not to transform the coefficient values ​​using peripheral coefficients, it may be possible to suppress the increase in processing delay and the increase in the amount of code. 【0592】 Furthermore, the coefficient information flag may also be a flag indicating whether the coefficient value is greater than 1. This means that, regardless of whether an orthogonal transform is applied, the encoding of the coefficient information flag indicating whether the coefficient value is greater than 1 may be skipped according to the limit on the number of processing iterations of context-adaptive coding. Therefore, the increase in processing delay and the increase in coding size may be suppressed. 【0593】 Furthermore, the conversion process may include replacing the coefficient value with a value determined using the peripheral coefficients if the coefficient value is 0, and reducing the coefficient value by subtracting 1 if the coefficient value is greater than 0 and less than or equal to the value determined using the peripheral coefficients. This may allow the coefficient value to be appropriately converted according to the peripheral coefficients, thereby suppressing the increase in the sign amount. 【0594】 The above operations performed by the circuit of the encoding device 100 may also be performed by the entropy encoding unit 110 of the encoding device 100. 【0595】 Figure 71 is a flowchart illustrating the operation of the decoding device 200. For example, the decoding device 200 includes a circuit and a memory connected to the circuit. The circuit and memory of the decoding device 200 may correspond to the processor b1 and memory b2 shown in Figure 46. The circuit of the decoding device 200 performs the operation shown in Figure 71. Specifically, in its operation, the circuit of the decoding device 200 decodes blocks of the image (S221). 【0596】 For example, the circuit of the decoding device 200 may decode blocks of the image by limiting the number of context-adaptive decoding operations. 【0597】 Furthermore, in both cases—when an inverse orthogonal transform is applied to the block, and when an inverse orthogonal transform is not applied to the block—the coefficient information flag may be decoded by context-adaptive decoding if the number of processing attempts is within the processing attempt limit. Also, in both of these cases, the decoding of the coefficient information flag may be skipped if the number of processing attempts is outside the processing attempt limit. Here, the coefficient information flag indicates the attributes of the coefficients included in the block. 【0598】 Furthermore, in both of these cases, if the coefficient information flag is decoded, the residual information may be decoded by Golombrice decoding. Here, the residual information is information for reconstructing the coefficient value using the coefficient information flag. Alternatively, the coefficient value may be derived using the coefficient information flag and the residual information. 【0599】 Furthermore, if an inverse orthogonal transformation is applied to a block and the decoding of the coefficient information flag is skipped, the coefficient values ​​may be decoded by Golombrice decoding. Then, the transformation process may be performed to derive the coefficient values. Also, if an inverse orthogonal transformation is not applied to a block and the decoding of the coefficient information flag is skipped, the coefficient values ​​may be decoded by Golombrice decoding. Then, the coefficient values ​​may be derived without performing the transformation process. 【0600】 Here, the transformation process is the process of transforming the value of a coefficient using a value determined using the peripheral coefficients. The peripheral coefficients are the coefficients in the vicinity of the coefficient's position within the block. 【0601】 This means that, regardless of whether an inverse orthogonal transform is applied, the decoding of coefficient information flags may be skipped according to the limit on the number of processing iterations in context-adaptive decoding. Therefore, the increase in processing delay and the increase in code size may be suppressed. In addition, the difference between the decoding method used for blocks to which an inverse orthogonal transform is applied and the decoding method used for blocks to which an inverse orthogonal transform is not applied will be reduced, which may reduce the circuit size. 【0602】 Furthermore, by appropriately controlling whether or not to transform the coefficient values ​​using peripheral coefficients, it may be possible to suppress the increase in processing delay and the increase in the amount of code. 【0603】 Furthermore, the coefficient information flag may also be a flag indicating whether the coefficient value is greater than 1. This means that, regardless of whether an inverse orthogonal transform is applied, the decoding of the coefficient information flag indicating whether the coefficient value is greater than 1 may be skipped according to the limit on the number of processing iterations of context-adaptive decoding. Therefore, the increase in processing delay and the increase in the amount of code may be suppressed. 【0604】 Furthermore, the conversion process may include replacing the coefficient value with 0 if it is equal to the value determined using the peripheral coefficients, and increasing the coefficient value by adding 1 if it is smaller than the value determined using the peripheral coefficients. This may ensure that the coefficient value is appropriately converted according to the peripheral coefficients, thereby suppressing the increase in the sign quantity. 【0605】 The above operations performed by the circuit of the decoding device 200 may also be performed by the entropy decoding unit 202 of the decoding device 200. 【0606】 [Other examples] In each of the examples described above, the encoding device 100 and the decoding device 200 may be used as an image encoding device and an image decoding device, respectively, or as a video encoding device and a video decoding device. 【0607】 Furthermore, the encoding device 100 and the decoding device 200 may perform only some of the operations described above, with other devices performing other operations. Also, the encoding device 100 and the decoding device 200 may comprise only some of the multiple components described above, with other devices comprising other components. 【0608】 Furthermore, at least some of the examples described above may be used as encoding or decoding methods, or as other methods. 【0609】 Furthermore, each component may be implemented by being composed of dedicated hardware or by executing a software program suitable for each component. Each component may also be implemented by a program execution unit such as a CPU or processor reading and executing a software program recorded on a recording medium such as a hard disk or semiconductor memory. 【0610】 Specifically, each of the encoding device 100 and the decoding device 200 may include a processing circuitry and a storage device electrically connected to the processing circuitry and accessible from the processing circuitry. For example, the processing circuitry corresponds to a processor a1 or b1, and the storage device corresponds to memory a2 or b2. 【0611】 The processing circuit includes at least one of dedicated hardware and a program execution unit, and performs processing using a memory device. Furthermore, if the processing circuit includes a program execution unit, the memory device stores the software program executed by that program execution unit. 【0612】 The software that implements the encoding device 100 or decoding device 200, etc., described above, is the following program. 【0613】 For example, this program may cause the computer to encode blocks of an image, limiting the number of context-adaptive encoding operations; in the encoding of the blocks, if the number of operations is within the limit range, whether or not an orthogonal transform is applied to the block, encode a coefficient information flag indicating the attributes of the coefficients included in the block using context-adaptive encoding; skip encoding the coefficient information flag if the number of operations is outside the limit range; if the coefficient information flag is encoded, encode residual value information for reconstructing the coefficient value using the coefficient information flag using Golomb-Rice encoding; if an orthogonal transform is applied to the block and encoding the coefficient information flag is skipped, perform a transformation process to transform the value of the coefficient using a value determined using peripheral coefficients, which are coefficients around the position of the coefficient in the block, and encode the value of the coefficient using Golomb-Rice encoding; and if an orthogonal transform is not applied to the block and encoding the coefficient information flag is skipped, encode the value of the coefficient using Golomb-Rice encoding without performing the transformation process. 【0614】 Furthermore, for example, this program decodes blocks of an image, limiting the number of context-adaptive decoding operations, and in the decoding of the blocks, both when an inverse orthogonal transform is applied to the block and when an inverse orthogonal transform is not applied to the block, if the number of operations is within the limit, it decodes a coefficient information flag indicating the attributes of the coefficients included in the block using context-adaptive decoding; if the number of operations is outside the limit, it skips the decoding of the coefficient information flag; and if the coefficient information flag is decoded, it uses the coefficient information flag to reconstruct the coefficient values ​​using Goromrice decoding to obtain residual value information. Therefore, the decoding method may be performed such that the coefficient value is derived using the coefficient information flag and the residual value information, and if the decoding of the coefficient information flag is skipped when an inverse orthogonal transform is applied to the block, the coefficient value is decoded by Golombrice decoding, and a conversion process is performed to convert the coefficient value using a value determined using peripheral coefficients, which are coefficients around the position of the coefficient in the block, thereby deriving the coefficient value, and if the decoding of the coefficient information flag is skipped when an inverse orthogonal transform is not applied to the block, the coefficient value is decoded by Golombrice decoding, and the coefficient value is derived without performing the conversion process. 【0615】 Furthermore, each component may be a circuit, as described above. These circuits may form a single circuit as a whole, or they may be separate circuits. Also, each component may be implemented using a general-purpose processor, or it may be implemented using a dedicated processor. 【0616】 Furthermore, a process performed by one component may be performed by another component. Also, the order in which processes are executed may be changed, and multiple processes may be executed in parallel. Additionally, the encoding / decoding device may comprise an encoding device 100 and a decoding device 200. 【0617】 Furthermore, the first and second ordinal numbers used in the explanation may be changed as appropriate. Also, ordinal numbers may be newly assigned to the constituent elements, or removed. 【0618】 Although the embodiments of the encoding device 100 and the decoding device 200 have been described above based on several examples, the embodiments of the encoding device 100 and the decoding device 200 are not limited to these examples. Without departing from the spirit of this disclosure, various modifications that a person skilled in the art could conceive of may be applied to each example, or configurations constructed by combining components from different examples may also be included within the scope of the embodiments of the encoding device 100 and the decoding device 200. 【0619】 One or more embodiments disclosed herein may be implemented in combination with at least some of the other embodiments disclosed herein. Furthermore, some processes, some configurations of the apparatus, some syntax, etc., described in the flowcharts of one or more embodiments disclosed herein may be implemented in combination with the other embodiments. 【0620】 [Implementation and Application] In each of the above embodiments, each functional or operational block can typically be implemented by an MPU (micro processing unit) and memory, etc. Furthermore, the processing performed by each functional block may be implemented as a program execution unit, such as a processor, that reads and executes software (programs) recorded on a recording medium such as ROM. This software may be distributed. This software may be recorded on various recording media such as semiconductor memory. It is also possible to implement each functional block using hardware (dedicated circuits). Various combinations of hardware and software can be employed. 【0621】 The processing described in each embodiment may be implemented by centralized processing using a single device (system), or by distributed processing using multiple devices. Furthermore, the processor executing the above program may be one or multiple. In other words, centralized processing may be performed, or distributed processing may be performed. 【0622】 The embodiments of this disclosure are not limited to those described above, and various modifications are possible, which are also included within the scope of the embodiments of this disclosure. 【0623】 Furthermore, here we will describe application examples of the video encoding method (image encoding method) or video decoding method (image decoding method) shown in each of the above embodiments, and various systems for implementing these application examples. Such systems may be characterized by having an image encoding device using the image encoding method, an image decoding device using the image decoding method, or an image encoding and decoding device that includes both. Other configurations of such systems can be appropriately modified as needed. 【0624】 [Usage example] Figure 72 shows the overall configuration of a suitable content supply system ex100 for realizing a content distribution service. The service area for the communication service is divided into cells of a desired size, and within each cell, there are base stations ex106, ex107, ex108, ex109, and ex110, which are fixed radio stations in the illustrated example. 【0625】 In this content supply system ex100, various devices such as a computer ex111, a game console ex112, a camera ex113, a home appliance ex114, and a smartphone ex115 are connected to the internet ex101 via an internet service provider ex102 or a communication network ex104, and base stations ex106~ex110. The content supply system ex100 may also be configured to connect any combination of the above devices. In various implementations, the devices may be directly or indirectly interconnected via a telephone network or short-range wireless, etc., without going through base stations ex106~ex110. Furthermore, the streaming server ex103 may be connected to various devices such as a computer ex111, a game console ex112, a camera ex113, a home appliance ex114, and a smartphone ex115 via the internet ex101, etc. The streaming server ex103 may also be connected to terminals in a hotspot on an airplane ex117 via satellite ex116. 【0626】 Note that instead of base stations ex106~ex110, wireless access points or hotspots may be used. Also, streaming server ex103 may be connected directly to the communication network ex104 without going through the internet ex101 or internet service provider ex102, or it may be connected directly to the airplane ex117 without going through satellite ex116. 【0627】 The camera ex113 is a device capable of taking still images and videos, such as a digital camera. The smartphone ex115 is a smartphone, mobile phone, or PHS (Personal Handy-phone System) that supports mobile communication systems such as 2G, 3G, 3.9G, 4G, and the upcoming 5G. 【0628】 Home appliance ex114 refers to appliances such as refrigerators or equipment included in household fuel cell cogeneration systems. 【0629】 In the content supply system ex100, live streaming becomes possible when a terminal with a shooting function is connected to the streaming server ex103 via a base station ex106 or the like. In live streaming, a terminal (such as a computer ex111, a game console ex112, a camera ex113, a home appliance ex114, a smartphone ex115, and a terminal inside an airplane ex117) may perform the encoding process described in each of the above embodiments on still images or video content captured by a user using the terminal, or it may multiplex the video data obtained by encoding with sound data encoded from the sound corresponding to the video, and then transmit the obtained data to the streaming server ex103. In other words, each terminal functions as an image encoding device according to one aspect of this disclosure. 【0630】 Meanwhile, the streaming server ex103 streams the content data sent to the requesting client. The client is a computer ex111, a game console ex112, a camera ex113, a home appliance ex114, a smartphone ex115, or a terminal on an airplane ex117, etc., that is capable of decoding the encoded data. Each device that receives the distributed data may decode and play back the received data. That is, each device may function as an image decoding device according to one aspect of this disclosure. 【0631】 [Distributed Processing] Furthermore, the streaming server ex103 may consist of multiple servers or computers that distribute data processing, recording, and distribution. For example, the streaming server ex103 may be implemented by a CDN (Content Delivery Network), where content delivery is achieved through a network connecting numerous edge servers distributed worldwide. In a CDN, the physically closest edge server can be dynamically assigned depending on the client. Latency can be reduced by caching and delivering content to the edge server. In addition, if several types of errors occur or the communication state changes due to increased traffic, processing can be distributed among multiple edge servers, the delivery entity can be switched to another edge server, or delivery can be continued by bypassing the failed part of the network, thus enabling high-speed and stable delivery. 【0632】 Furthermore, beyond the distributed processing of the distribution itself, the encoding process of the captured data can be performed on each terminal, on the server side, or shared among them. For example, encoding generally involves two processing loops. In the first loop, the complexity or code amount of the image at the frame or scene level is detected. In the second loop, processing is performed to improve encoding efficiency while maintaining image quality. For example, if the terminal performs the first encoding process and the server that receives the content performs the second encoding process, it is possible to improve the quality and efficiency of the content while reducing the processing load on each terminal. In this case, if there is a request to receive and decode near real time, the first encoded data from the terminal can be received and played back on other terminals, enabling more flexible real-time distribution. 【0633】 Another example is the camera ex113, which extracts features (quantities of features or characteristics) from an image, compresses the data related to the features as metadata, and sends it to the server. The server performs compression according to the meaning (or importance of content) of the image, for example, by determining the importance of objects from the features and switching the quantization precision. Feature data is particularly effective in improving the accuracy and efficiency of motion vector prediction during further compression on the server. Alternatively, a simple encoding such as VLC (Variable Length Coding) may be performed on the terminal, and a more computationally intensive encoding such as CABAC (Context-Adaptive Binary Arithmetic Coding) may be performed on the server. 【0634】 Another example is a scenario in a stadium, shopping mall, or factory where multiple video data sets of nearly identical scenes may exist, captured by multiple terminals. In such cases, the encoding process is distributed among the multiple terminals that captured the footage, along with other terminals and servers as needed, by assigning encoding tasks to each unit, for example, at the Group of Picture (GOP) level, picture level, or tile level (a division of a picture). This reduces latency and enables more real-time performance. 【0635】 Since multiple video data sets depict essentially the same scene, the server may manage and / or instruct the video data captured by each terminal to reference each other. Alternatively, the server may receive the encoded data from each terminal, change the reference relationships between the multiple data sets, or correct or replace the pictures themselves and re-encode them. This allows for the creation of a stream with improved quality and efficiency for each individual data set. 【0636】 Furthermore, the server may transcode the video data to change its encoding method before distributing it. For example, the server may convert an MPEG-based encoding to a VP-based encoding (e.g., VP9), or convert H.264 to H.265, etc. 【0637】 Thus, the encoding process can be performed by a terminal or one or more servers. Therefore, in the following, the terms "server" or "terminal" will be used to refer to the entity performing the processing, but some or all of the processing performed by the server may be performed by the terminal, and some or all of the processing performed by the terminal may be performed by the server. The same applies to the decoding process. 【0638】 [3D, Multi-angle] It is becoming increasingly common to integrate and utilize images or videos of different scenes, or the same scene, captured from different angles, by multiple cameras ex113 and / or smartphones ex115, which are nearly synchronized with each other. Videos captured by each device can be integrated based on the relative positional relationship between the devices, or on areas where feature points contained in the video coincide. 【0639】 The server may not only encode two-dimensional video but also encode still images automatically based on scene analysis of the video, or at a time specified by the user, and transmit them to the receiving terminal. Furthermore, if the server can obtain the relative positional relationship between the shooting terminals, it can generate a three-dimensional shape of the scene based not only on two-dimensional video but also on video of the same scene taken from different angles. The server may separately encode three-dimensional data generated by a point cloud or the like, or it may select or reconstruct video from video taken by multiple terminals to transmit to the receiving terminal based on the results of recognizing or tracking a person or object using the three-dimensional data. 【0640】 In this way, users can enjoy scenes by arbitrarily selecting each video corresponding to each shooting terminal, or they can enjoy content in which a video from a selected viewpoint is extracted from 3D data reconstructed using multiple images or videos. Furthermore, along with the video, sound is also collected from multiple different angles, and the server may multiplex the sound from a specific angle or space with the corresponding video and transmit the multiplexed video and sound. 【0641】 In recent years, content that links the real world with a virtual world, such as Virtual Reality (VR) and Augmented Reality (AR), has also become popular. In the case of VR images, the server may create separate viewpoint images for the right and left eyes and perform encoding that allows referencing between the viewpoint images using Multi-View Coding (MVC), or it may encode them as separate streams without referencing each other. When decoding the separate streams, it is advisable to synchronize playback so that the virtual 3D space is reproduced according to the user's viewpoint. 【0642】 In the case of AR images, the server may superimpose virtual object information from the virtual space onto camera information from the real space, based on its three-dimensional position or the user's viewpoint movement. The decoding device may acquire or retain the virtual object information and three-dimensional data, generate a two-dimensional image according to the user's viewpoint movement, and create superimposed data by smoothly stitching them together. Alternatively, the decoding device may send the user's viewpoint movement to the server in addition to the request for virtual object information. The server may create superimposed data according to the viewpoint movement received from the three-dimensional data held by the server, encode the superimposed data, and distribute it to the decoding device. Typically, superimposed data has an α value indicating transparency in addition to RGB, and the server may set the α value of parts other than the object created from the three-dimensional data to 0, and encode the data in a state where those parts are transparent. Alternatively, the server may set predetermined RGB values ​​as the background, like in chroma keying, and generate data where parts other than the object are the background color. The predetermined RGB values ​​may be predetermined. 【0643】 Similarly, the decryption process of the distributed data can be performed by the client (e.g., a terminal), the server, or a shared task between them. For example, one terminal may send a reception request to the server, another terminal may receive the content corresponding to that request, decrypt it, and then transmit the decrypted signal to a device with a display. By distributing the processing and selecting appropriate content regardless of the performance of the communication-capable terminals themselves, it is possible to play back data with high image quality. Another example is that while receiving large image data on a TV or similar device, a portion of the picture, such as tiles, may be decrypted and displayed on the viewer's personal terminal. This allows for sharing the overall picture while simultaneously allowing users to check their own area of ​​responsibility or areas they wish to examine in more detail. 【0644】 In situations where multiple short-range, medium-range, or long-range wireless communication networks are available both indoors and outdoors, it may be possible to seamlessly receive content using distribution system standards such as MPEG-DASH. Users may freely select and switch in real time between decoding devices or display devices, such as their own terminals or displays located indoors or outdoors. Furthermore, decoding can be performed while switching between the decoding terminal and the display terminal using the user's location information. This makes it possible to map and display information on a part of the wall or ground of an adjacent building with a displayable device embedded, while the user is moving to their destination. It is also possible to switch the bitrate of the received data based on the ease of access to the encoded data on the network, such as when the encoded data is cached on a server that can be accessed quickly from the receiving terminal, or copied to an edge server in the content delivery service. 【0645】 [Scalable encoding] Regarding content switching, we will explain using a scalable stream compressed and encoded using the video encoding method described in each of the embodiments above, as shown in Figure 73. The server may have multiple streams with the same content but different qualities as individual streams, but it may also be configured to switch content by taking advantage of the temporal / spatial scalability of the stream realized by encoding it in layers, as shown in the figure. In other words, the decoding side can freely switch between decoding low-resolution and high-resolution content by deciding which layer to decode according to internal factors such as performance and external factors such as the state of the communication bandwidth. For example, if a user was watching a video on their smartphone ex115 while on the go and wants to continue watching it on a device such as an internet TV after returning home, the device only needs to decode the same stream up to a different layer, thus reducing the burden on the server. 【0646】 Furthermore, as described above, in addition to a configuration where each layer encodes a picture and scalability is achieved by an enhancement layer above the base layer, the enhancement layer may also include metadata based on image statistics. The decoding side may generate high-quality content by super-resolution the picture in the base layer based on the metadata. Super-resolution may improve the signal-to-noise ratio while maintaining and / or increasing the resolution. The metadata may include information for identifying linear or nonlinear filter coefficients used in the super-resolution process, or information for identifying parameter values ​​in the filtering process, machine learning, or least-squares operation used in the super-resolution process. 【0647】 Alternatively, a configuration may be provided in which the picture is divided into tiles or the like according to the meaning of objects within the image. The decoding side decodes only a portion of the area by selecting the tiles to decode. Furthermore, by storing the attributes of the objects (people, cars, balls, etc.) and their positions in the image (coordinate positions within the same image, etc.) as metadata, the decoding side can identify the position of the desired object based on the metadata and determine the tile containing that object. For example, as shown in Figure 74, the metadata may be stored using a data storage structure different from the pixel data, such as the SEI (supplemental enhancement information) message in HEVC. This metadata indicates, for example, the position, size, or color of the main object. 【0648】 Metadata may be stored in units consisting of multiple pictures, such as streams, sequences, or random access units. The decryption side can obtain information such as the time when a specific person appears in the video, and by combining the picture-level information with the time information, it can identify the picture in which the object exists and determine the object's position within the picture. 【0649】 [Web page optimization] Figure 75 shows an example of a web page display screen on a computer ex111, etc. Figure 76 shows an example of a web page display screen on a smartphone ex115, etc. As shown in Figures 75 and 76, a web page may contain multiple linked images, which are links to image content, and their appearance may differ depending on the viewing device. When multiple linked images are visible on the screen, the display device (decoder) may display still images or I-pictures of each content as linked images until the user explicitly selects a linked image, or until a linked image approaches the center of the screen or the entire linked image is within the screen, or it may display a video such as a GIF animation using multiple still images or I-pictures, or it may receive only the base layer and decode and display the video. 【0650】 When a linked image is selected by the user, the display device performs decoding, prioritizing the base layer, for example. If the HTML of the web page contains information indicating that the content is scalable, the display device may decode up to the enhancement layer. Furthermore, to ensure real-time performance, before selection or when the communication bandwidth is very limited, the display device can decode and display only forward-referenced pictures (I pictures, P pictures, and B pictures that only use forward references), thereby reducing the delay between the decoding time and the display time of the first picture (the delay from the start of content decoding to the start of display). In addition, the display device may deliberately ignore the reference relationships of the pictures and roughly decode all B pictures and P pictures using forward references, performing normal decoding as time passes and more pictures are received. 【0651】 [Autonomous driving] Furthermore, when transmitting and receiving still image or video data, such as 2D or 3D map information, for autonomous driving or driving assistance of a vehicle, the receiving terminal may receive metadata such as weather or construction information in addition to image data belonging to one or more layers, and decode these in association with each other. The metadata may belong to a layer, or it may simply be multiplexed with the image data. 【0652】 In this case, since the vehicle, drone, or airplane containing the receiving terminal is moving, the receiving terminal can transmit its own location information, enabling seamless reception and decoding while switching between base stations ex106 to ex110. Furthermore, the receiving terminal can dynamically switch how much metadata is received or how much map information is updated, depending on the user's selection, the user's situation, and / or the state of the communication bandwidth. 【0653】 The content delivery system ex100 allows the client to receive, decode, and play back encoded information transmitted by the user in real time. 【0654】 [Distribution of personal content] Furthermore, the ex100 content delivery system allows for unicast or multicast distribution of not only high-definition, long-duration content from video distribution companies, but also low-definition, short-duration content from individuals. It is expected that the amount of such individual content will continue to increase. To improve the quality of individual content, the server may perform editing before encoding. This can be achieved, for example, using a configuration like the following. 【0655】 During shooting, or after shooting, the server performs recognition processing such as detecting shooting errors, searching for scenes, analyzing semantics, and detecting objects from the original image data or encoded data in real time. Based on the recognition results, the server manually or automatically edits the images, correcting out-of-focus or shaky images, deleting less important scenes such as those with lower brightness or out of focus compared to other pictures, emphasizing object edges, and altering color tones. The server then encodes the edited data based on the editing results. It is also known that viewership decreases if the shooting time is too long, so the server may automatically clip scenes with little movement, as well as less important scenes, based on the image processing results, to ensure that the content falls within a specific time range according to the shooting time. Alternatively, the server may generate and encode a digest based on the results of the semantic analysis of the scenes. 【0656】 Personal content may contain elements that infringe on copyright, moral rights, or portrait rights, and the scope of sharing may exceed the intended scope, which can be inconvenient for the individual. Therefore, for example, the server may intentionally change the image to one that is out of focus, such as the faces of people at the edges of the screen or the interior of a house, before encoding. Furthermore, the server may recognize whether the face of a person other than those previously registered is visible in the image to be encoded, and if so, it may apply a mosaic effect to the face. Alternatively, as a pre-processing or post-processing step before encoding, the user may specify a person or background area that they want to process from a copyright perspective. The server may replace the specified area with another image or blur the focus. In the case of a person, the server can track the person in a video and replace the image of the person's face. 【0657】 Viewing personal content with small data volumes requires real-time processing, so depending on the bandwidth, the decoder may prioritize receiving the base layer first and then decode and play it back. During this time, the decoder may receive the enhancement layer, and if playback is looped or if the content is played back more than once, it may play back the high-quality video including the enhancement layer. With a stream that uses this scalable encoding, it is possible to provide an experience where the video is rough when unselected or at the beginning of viewing, but gradually the stream becomes smarter and the image quality improves. In addition to scalable encoding, a similar experience can be provided even if the rough stream played back the first time and the second stream encoded by referencing the first video are configured as a single stream. 【0658】 [Other examples of practical applications] Furthermore, these encoding or decoding processes are generally performed in the LSIex500 present in each terminal. The LSI (large scale integration circuitry) ex500 (see Figure 72) may be a single chip or a configuration consisting of multiple chips. Alternatively, video encoding or decoding software may be embedded in some recording medium (such as a CD-ROM, flexible disk, or hard disk) that can be read by a computer ex111, and the encoding or decoding process may be performed using that software. In addition, if the smartphone ex115 has a camera, video data acquired by that camera may be transmitted. This video data may be data encoded by the LSIex500 present in the smartphone ex115. 【0659】 The LSIex500 may also be configured to be activated by downloading application software. In this case, the terminal first determines whether it supports the content encoding method or whether it has the capability to perform the specific service. If the terminal does not support the content encoding method or does not have the capability to perform the specific service, the terminal may download a codec or application software and then acquire and play the content. 【0660】 Furthermore, not only the content supply system ex100 via the Internet ex101, but also digital broadcasting systems can incorporate at least one of the video encoding device (image encoding device) or video decoding device (image decoding device) of each of the above embodiments. While the content supply system ex100 has a configuration that is more suited to multicast than unicast, as it transmits and receives multiplexed data with video and sound multiplexed onto broadcast radio waves using satellites, etc., the encoding and decoding processes are similar and can be applied in the same way. 【0661】 [Hardware configuration] Figure 77 shows further details of the smartphone ex115 shown in Figure 72. Figure 78 shows an example of the configuration of the smartphone ex115. The smartphone ex115 includes an antenna ex450 for transmitting and receiving radio waves with the base station ex110, a camera unit ex465 capable of taking video and still images, and a display unit ex458 that displays video captured by the camera unit ex465 and data decoded from video received by the antenna ex450. The smartphone ex115 further includes an operation unit ex466, such as a touch panel, an audio output unit ex457, such as a speaker for outputting voice or sound, an audio input unit ex456, such as a microphone for inputting voice, a memory unit ex467 capable of storing captured video or still images, recorded audio, received video or still images, encoded data such as emails, or decoded data, and a slot unit ex464, which is an interface unit with SIM ex468 for identifying the user and authenticating access to various data, including the network. External memory may be used instead of the memory unit ex467. 【0662】 The main control unit ex460, which can comprehensively control the display unit ex458 and the operation unit ex466, is connected to the power supply circuit unit ex461, the operation input control unit ex462, the video signal processing unit ex455, the camera interface unit ex463, the display control unit ex459, the modulation / demodulation unit ex452, the multiplexing / decompression unit ex453, the audio signal processing unit ex454, the slot unit ex464, and the memory unit ex467 via the synchronization bus ex470. 【0663】 The power supply circuit unit ex461, when the power key is turned on by the user, starts up the smartphone ex115 into an operational state and supplies power to each component from the battery pack. 【0664】 The smartphone ex115 performs tasks such as voice calls and data communication based on the control of the main control unit ex460, which has a CPU, ROM, RAM, etc. During a call, the voice signal picked up by the voice input unit ex456 is converted into a digital voice signal by the voice signal processing unit ex454, spread spectrum processing is performed by the modulation / demodulation unit ex452, digital-to-analog conversion and frequency conversion processing are performed by the transmission / reception unit ex451, and the resulting signal is transmitted via the antenna ex450. Received data is amplified, subjected to frequency conversion and analog-to-digital conversion processing, despread spectrum processing is performed by the modulation / demodulation unit ex452, converted into an analog voice signal by the voice signal processing unit ex454, and then output from the voice output unit ex457. In data communication mode, text, still images, or video data can be transmitted via the operation input control unit ex462 under the control of the main control unit ex460 based on operations such as those performed by the operation unit ex466 on the main unit. Similar transmission and reception processing is performed. When transmitting video, still images, or video and audio in data communication mode, the video signal processing unit ex455 compresses and encodes the video signal stored in the memory unit ex467 or the video signal input from the camera unit ex465 using the video encoding method shown in each of the above embodiments, and sends the encoded video data to the multiplexing / decoding unit ex453. The audio signal processing unit ex454 encodes the audio signal picked up by the audio input unit ex456 while the camera unit ex465 is capturing video or still images, and sends the encoded audio data to the multiplexing / decoding unit ex453. The multiplexing / decoding unit ex453 multiplexes the encoded video data and encoded audio data in a predetermined manner, performs modulation and conversion processing in the modulation / demodulation unit (modulation / demodulation circuit unit) ex452 and the transmission / reception unit ex451, and transmits via the antenna ex450. The predetermined manner may be set in advance. 【0665】 When receiving video attached to an email or chat, or video linked to a webpage, etc., the multiplexing / decomposition unit ex453 separates the multiplexed data received via antenna ex450, dividing it into a video data bitstream and an audio data bitstream. It then supplies the encoded video data to the video signal processing unit ex455 and the encoded audio data to the audio signal processing unit ex454 via the synchronization bus ex470. The video signal processing unit ex455 decodes the video signal using a video decoding method corresponding to the video encoding method shown in each of the above embodiments, and the video or still image contained in the linked video file is displayed from the display unit ex458 via the display control unit ex459. The audio signal processing unit ex454 decodes the audio signal, and the audio is output from the audio output unit ex457. As real-time streaming is becoming increasingly widespread, audio playback may be socially inappropriate depending on the user's situation. Therefore, as an initial setting, it is preferable to play only the video data without playing the audio signal, and to synchronize the audio playback only when the user performs an action such as clicking on the video data. 【0666】 While the smartphone ex115 was used as an example here, other implementation forms are possible for terminals, such as a transmitting terminal with only an encoder and a receiving terminal with only a decoder, in addition to a transmitting / receiving terminal that has both an encoder and a decoder. In the explanation for digital broadcasting systems, multiplexed data in which audio data is multiplexed with video data is received or transmitted. However, the multiplexed data may also contain text data related to the video in addition to audio data. Furthermore, the video data itself may be received or transmitted instead of multiplexed data. 【0667】 Although it was explained that the main control unit ex460, including the CPU, controls the encoding or decoding process, various terminals often have a GPU. Therefore, a configuration that leverages the GPU's performance to process a wide area at once using memory shared by the CPU and GPU, or memory whose addresses are managed so that it can be used in common, is also possible. This can shorten the encoding time, ensure real-time performance, and achieve low latency. In particular, it is efficient to perform motion detection, deblocking filters, SAO (Sample Adaptive Offset), and transformation / quantization processes at once on the GPU, rather than on the CPU, in units such as pictures. [Industrial applicability] 【0668】 This disclosure can be used, for example, in television receivers, digital video recorders, car navigation systems, mobile phones, digital cameras, digital video cameras, video conferencing systems, or electronic mirrors. [Explanation of Symbols] 【0669】 100 Encoding device 102 Division 104 Subtraction Unit 106 Conversion Unit 108 Quantization section 110 Entropy coding unit 112, 204 Inverse quantization section 114, 206 Inverse Transform Section 116, 208 Addition section 118, 210 block memory 120, 212 Loop filter section 122,214 frame memory 124, 216 Intra Prediction Unit 126, 218 Interpretation Unit 128, 220 Prediction Control Unit 200 Decoders 202 Entropy Decoder 1201 Boundary determination section 1202, 1204, 1206 switches 1203 Filter determination unit 1205 Filter Processing Unit 1207 Filter Characterization Unit 1208 Processing determination unit a1, b1 processors a2, b2 memory

Claims

[Claim 1] Circuits and, The circuit comprises a memory connected to the aforementioned circuit, In residual coding of the current block, in both cases where an orthogonal transform is applied and where the orthogonal transform is skipped, the circuit is: If the number of context-adaptive coding operations is less than or equal to a specific value, then multiple coefficient information flags relating to the coefficients included in the current block are coded by the context-adaptive coding, and the remaining values ​​of the coefficients are coded by Golomb-Rice coding. If the number of processing steps is not less than or equal to the specified value, the encoding of the plurality of coefficient information flags is skipped. When the orthogonal transformation is applied, if the encoding of the plurality of coefficient information flags is skipped, the coefficient is converted to a second coefficient using a poszero value determined using a plurality of peripheral coefficients located around the coefficient in the current block, and the value of the second coefficient is encoded by Golomb-Rice coding. If the orthogonal transformation is skipped, and the encoding of the plurality of coefficient information flags is skipped, the values ​​of the coefficients are encoded by Golomb-Rice coding without performing the transformation. The plurality of coefficient information flags include a flag indicating whether the value of the coefficient is zero or non-zero, and a flag indicating whether the coefficient is odd or even. Encoding device. [Claim 2] In residual coding of the current block, both when an orthogonal transform is applied and when the orthogonal transform is skipped, If the number of context-adaptive coding operations is less than or equal to a specific value, then multiple coefficient information flags relating to the coefficients included in the current block are coded by the context-adaptive coding, and the remaining values ​​of the coefficients are coded by Golomb-Rice coding. If the number of processing steps is not less than or equal to the specified value, the encoding of the plurality of coefficient information flags is skipped. When the orthogonal transformation is applied, if the encoding of the plurality of coefficient information flags is skipped, the coefficient is converted to a second coefficient using a poszero value determined using a plurality of peripheral coefficients located around the coefficient in the current block, and the value of the second coefficient is encoded by Golomb-Rice coding. If the orthogonal transformation is skipped, and the encoding of the plurality of coefficient information flags is skipped, the values ​​of the coefficients are encoded by Golomb-Rice coding without performing the transformation. The plurality of coefficient information flags include a flag indicating whether the value of the coefficient is zero or non-zero, and a flag indicating whether the coefficient is odd or even. Encoding method.