Patent Publication Number: US-2022222867-A1

Title: Three-dimensional data encoding method, three-dimensional data decoding method, three-dimensional data encoding device, and three-dimensional data decoding device

Description:
CROSS REFERENCE TO RELATED APPLICATIONS 
     This application is a U.S. continuation application of PCT International Patent Application Number PCT/JP2020/037589 filed on Oct. 2, 2020, claiming the benefit of priority of U.S. Provisional Patent Application No. 62/910,012 filed on Oct. 3, 2019, the entire contents of which are hereby incorporated by reference. 
    
    
     BACKGROUND 
     1. Technical Field 
     The present disclosure relates to a three-dimensional data encoding method, a three-dimensional data decoding method, a three-dimensional data encoding device, and a three-dimensional data decoding device. 
     2. Description of the Related Art 
     Devices or services utilizing three-dimensional data are expected to find their widespread use in a wide range of fields, such as computer vision that enables autonomous operations of cars or robots, map information, monitoring, infrastructure inspection, and video distribution. Three-dimensional data is obtained through various means including a distance sensor such as a rangefinder, as well as a stereo camera and a combination of a plurality of monocular cameras. 
     Methods of representing three-dimensional data include a method known as a point cloud scheme that represents the shape of a three-dimensional structure by a point group in a three-dimensional space. In the point cloud scheme, the positions and colors of a point group are stored. While point cloud is expected to be a mainstream method of representing three-dimensional data, a massive amount of data of a point group necessitates compression of the amount of three-dimensional data by encoding for accumulation and transmission, as in the case of a two-dimensional moving picture (examples include MPEG-4 AVC and HEVC standardized by MPEG). 
     Meanwhile, point cloud compression is partially supported by, for example, an open-source library (Point Cloud Library) for point cloud-related processing. 
     Furthermore, a technique for searching for and displaying a facility located in the surroundings of the vehicle is known (for example, see International Publication WO 2014/020663). 
     SUMMARY 
     There has been a demand for improving coding efficiency in a three-dimensional data encoding process and a three-dimensional data decoding process. 
     The present disclosure is intended to provide a three-dimensional data encoding method, a three-dimensional data decoding method, a three-dimensional data encoding device, or a three-dimensional data decoding device capable of improving coding efficiency. 
     A three-dimensional data encoding method according to one aspect of the present disclosure includes: determining whether a first valid node count is greater than or equal to a first threshold value predetermined, the first valid node count being a total number of valid nodes that are nodes each including a three-dimensional point, the valid nodes being included in first nodes belonging to a layer higher than a layer of a current node in an N-ary tree structure of three-dimensional points included in point cloud data, N being an integer greater than or equal to 2; when the first valid node count is greater than or equal to the first threshold value, performing first encoding on attribute information of the current node, the first encoding including a prediction process in which second nodes are used, the second nodes including a parent node of the current node and belonging to a same layer as the parent node; and when the first valid node count is less than the first threshold value, performing second encoding on attribute information of the current node, the second encoding not including the prediction process in which the second nodes are used. 
     A three-dimensional data decoding method according to one aspect of the present disclosure includes: determining whether a first valid node count is greater than or equal to a first threshold value predetermined, the first valid node count being a total number of valid nodes that are nodes each including a three-dimensional point, the valid nodes being included in first nodes belonging to a layer higher than a layer of a current node in an N-ary tree structure of three-dimensional points included in point cloud data, N being an integer greater than or equal to 2; when the first valid node count is greater than or equal to the first threshold value, performing first decoding on attribute information of the current node, the first decoding including a prediction process in which second nodes are used, the second nodes including a parent node of the current node and belonging to a same layer as the parent node; and when the first valid node count is less than the first threshold value, performing second decoding on attribute information of the current node, the second decoding not including the prediction process in which the second nodes are used. 
     The present disclosure provides a three-dimensional data encoding method, a three-dimensional data decoding method, a three-dimensional data encoding device, or a three-dimensional data decoding device capable of improving coding efficiency. 
    
    
     
       BRIEF DESCRIPTION OF DRAWINGS 
       These and other objects, advantages and features of the disclosure will become apparent from the following description thereof taken in conjunction with the accompanying drawings that illustrate a specific embodiment of the present disclosure. 
         FIG. 1  is a diagram showing the structure of encoded three-dimensional data according to Embodiment 1; 
         FIG. 2  is a diagram showing an example of prediction structures among SPCs that belong to the lowermost layer in a GOS according to Embodiment 1; 
         FIG. 3  is a diagram showing an example of prediction structures among layers according to Embodiment 1; 
         FIG. 4  is a diagram showing an example order of encoding GOSs according to Embodiment 1; 
         FIG. 5  is a diagram showing an example order of encoding GOSs according to Embodiment 1; 
         FIG. 6  is a diagram showing an example of meta information according to Embodiment 1; 
         FIG. 7  is a schematic diagram showing three-dimensional data being transmitted/received between vehicles according to Embodiment 2; 
         FIG. 8  is a diagram showing an example of three-dimensional data transmitted between vehicles according to Embodiment 2; 
         FIG. 9  is a diagram that illustrates processes of transmitting three-dimensional data according to Embodiment 3; 
         FIG. 10  is a diagram showing a structure of a system according to Embodiment 4; 
         FIG. 11  is a block diagram of a client device according to Embodiment 4; 
         FIG. 12  is a block diagram of a server according to Embodiment 4; 
         FIG. 13  is a flowchart of a three-dimensional data creation process performed by the client device according to Embodiment 4; 
         FIG. 14  is a flowchart of a sensor information transmission process performed by the client device according to Embodiment 4; 
         FIG. 15  is a flowchart of a three-dimensional data creation process performed by the server according to Embodiment 4; 
         FIG. 16  is a flowchart of a three-dimensional map transmission process performed by the server according to Embodiment 4; 
         FIG. 17  is a diagram showing a structure of a variation of the system according to Embodiment 4; 
         FIG. 18  is a diagram showing a structure of the server and client devices according to Embodiment 4; 
         FIG. 19  is a diagram illustrating a configuration of a server and a client device according to Embodiment 5; 
         FIG. 20  is a flowchart of a process performed by the client device according to Embodiment 5; 
         FIG. 21  is a diagram illustrating a configuration of a sensor information collection system according to Embodiment 5; 
         FIG. 22  is a diagram showing an example of a volume according to Embodiment 6; 
         FIG. 23  is a diagram showing an example of an octree representation of the volume according to Embodiment 6; 
         FIG. 24  is a diagram showing an example of bit sequences of the volume according to Embodiment 6; 
         FIG. 25  is a diagram showing an example of an octree representation of a volume according to Embodiment 6; 
         FIG. 26  is a diagram showing an example of the volume according to Embodiment 6; 
         FIG. 27  is a diagram for describing the encoding of the attribute information by using a RAHT according to Embodiment 7; 
         FIG. 28  is a diagram showing an example of setting a quantization scale for each hierarchy according to Embodiment 7; 
         FIG. 29  is a diagram showing an example of a first code sequence and a second code sequence according to Embodiment 7; 
         FIG. 30  is a diagram showing an example of a truncated unary code according to Embodiment 7; 
         FIG. 31  is a diagram for describing the inverse Haar conversion according to Embodiment 7; 
         FIG. 32  is a diagram showing a syntax example of the attribute information according to Embodiment 7; 
         FIG. 33  is a diagram showing an example of a coding coefficient and ZeroCnt according to Embodiment 7; 
         FIG. 34  is a flowchart of the three-dimensional data encoding processing according to Embodiment 7; 
         FIG. 35  is a flowchart of the attribute information encoding processing according to Embodiment 7; 
         FIG. 36  is a flowchart of the coding coefficient encoding processing according to Embodiment 7; 
         FIG. 37  is a flowchart of the three-dimensional data decoding processing according to Embodiment 7; 
         FIG. 38  is a flowchart of the attribute information decoding processing according to Embodiment 7; 
         FIG. 39  is a flowchart the coding coefficient decoding processing according to Embodiment 7; 
         FIG. 40  is a block diagram of an attribute information encoder according to Embodiment 7; 
         FIG. 41  is a block diagram of an attribute information decoder according to Embodiment 7; 
         FIG. 42  is a diagram showing an example of a first code sequence and a second code sequence according to a modification of Embodiment 7; 
         FIG. 43  is a diagram showing a syntax example of the attribute information according to the modification of Embodiment 7; 
         FIG. 44  is a diagram showing an example of a coding coefficient, ZeroCnt, and TotalZeroCnt according to the modification of Embodiment 7; 
         FIG. 45  is a flowchart of the coding coefficient encoding processing according to the modification of Embodiment 7; 
         FIG. 46  is a flowchart of the coding coefficient decoding processing according to the modification of Embodiment 7; 
         FIG. 47  is a diagram showing a syntax example of the attribute information according to the modification of Embodiment 7; 
         FIG. 48  is a diagram showing a configuration of a three-dimensional data encoding device according to Embodiment 8; 
         FIG. 49  is a diagram showing a configuration of a three-dimensional data decoding device according to Embodiment 8; 
         FIG. 50  is a diagram for illustrating RAHT according to Embodiment 8; 
         FIG. 51  is a diagram for illustrating an integer-to-integer transform according to Embodiment 8; 
         FIG. 52  is a diagram for illustrating a hierarchical transform processing according to Embodiment 8; 
         FIG. 53  is a block diagram of a three-dimensional data encoding device according to Embodiment 8; 
         FIG. 54  is a block diagram of a lossless attribute information encoder according to Embodiment 8; 
         FIG. 55  is a block diagram of an integer transformer according to Embodiment 8; 
         FIG. 56  is a block diagram of a three-dimensional data decoding device according to Embodiment 8; 
         FIG. 57  is a block diagram of a lossless attribute information decoder according to Embodiment 8; 
         FIG. 58  is a block diagram of an inverse integer transformer according to Embodiment 8; 
         FIG. 59  is a flowchart of a lossless attribute information encoding processing according to Embodiment 8; 
         FIG. 60  is a flowchart of a lossless attribute information decoding processing according to Embodiment 8; 
         FIG. 61  is a diagram showing an example configuration of an integer Haar transformer according to Embodiment 8; 
         FIG. 62  is a diagram showing an example configuration of an inverse integer Haar transformer according to Embodiment 8; 
         FIG. 63  is a diagram showing a configuration of a three-dimensional data encoding device according to Embodiment 8; 
         FIG. 64  is a diagram showing a configuration of a three-dimensional data decoding device according to Embodiment 8; 
         FIG. 65  is a diagram showing a configuration of a three-dimensional data encoding device according to Embodiment 8; 
         FIG. 66  is a diagram showing a configuration of a three-dimensional data decoding device according to Embodiment 8; 
         FIG. 67  is a diagram showing an example configuration of a bitstream according to Embodiment 8; 
         FIG. 68  is a diagram showing an example configuration of a bitstream according to Embodiment 8; 
         FIG. 69  is a diagram showing a configuration of a three-dimensional data encoding device according to Embodiment 9; 
         FIG. 70  is a diagram showing a configuration of a three-dimensional data decoding device according to Embodiment 9; 
         FIG. 71  is a diagram showing an example configuration of a bitstream according to Embodiment 9; 
         FIG. 72  is a diagram showing an example configuration of an integer RAHT/Haar transformer according to Embodiment 9; 
         FIG. 73  is a diagram showing an example configuration of an inverse integer RAHT/Haar transformer according to Embodiment 9; 
         FIG. 74  is a flowchart of a three-dimensional data encoding process according to Embodiment 9; 
         FIG. 75  is a flowchart of a three-dimensional data decoding process according to Embodiment 9; 
         FIG. 76  is a diagram illustrating a prediction process according to Embodiment 10; 
         FIG. 77  is a diagram illustrating a relation among nodes according to Embodiment 10; 
         FIG. 78  is a diagram illustrating a first example of an encoding method according to Embodiment 10; 
         FIG. 79  is a diagram illustrating a first example of a decoding method according to Embodiment 10; 
         FIG. 80  is a diagram illustrating a second example of an encoding method according to Embodiment 10; 
         FIG. 81  is a diagram illustrating a second example of a decoding method according to Embodiment 10; 
         FIG. 82  is a diagram illustrating a third example of an encoding method according to Embodiment 10; 
         FIG. 83  is a diagram illustrating a third example of a decoding method according to Embodiment 10; 
         FIG. 84  is a diagram illustrating a fourth example of an encoding method according to Embodiment 10; 
         FIG. 85  is a diagram illustrating a fourth example of a decoding method according to Embodiment 10; 
         FIG. 86  is a diagram illustrating a fifth example of an encoding method according to Embodiment 10; 
         FIG. 87  is a diagram illustrating a fifth example of a decoding method according to Embodiment 10; 
         FIG. 88  is a flowchart of a three-dimensional data encoding process according to Embodiment 10; 
         FIG. 89  is a flowchart of a three-dimensional data decoding process according to Embodiment 10; 
         FIG. 90  is a diagram illustrating a prediction process according to Embodiment 11; 
         FIG. 91  is a diagram illustrating a first example of an encoding process according to Embodiment 11; 
         FIG. 92  is a diagram illustrating a first example of a decoding process according to Embodiment 11; 
         FIG. 93  is a diagram illustrating an example syntax of an attribute information header according to Embodiment 11; 
         FIG. 94  is a diagram illustrating an example syntax of the attribute information header according to Embodiment 11; 
         FIG. 95  is a flowchart of a three-dimensional data encoding process according to Embodiment 11; 
         FIG. 96  is a flowchart of a three-dimensional data decoding process according to Embodiment 11; 
         FIG. 97  is a diagram illustrating a second example of the encoding process according to Embodiment 11; 
         FIG. 98  is a diagram illustrating an example syntax of the attribute information header according to Embodiment 11; 
         FIG. 99  is a diagram illustrating an example syntax of the attribute information header according to Embodiment 11; 
         FIG. 100  is a flowchart of a three-dimensional data encoding process according to Embodiment 11; 
         FIG. 101  is a flowchart of a three-dimensional data decoding process according to Embodiment 11; 
         FIG. 102  is a diagram illustrating a third example of the encoding process according to Embodiment 11; 
         FIG. 103  is a diagram illustrating an example syntax of the attribute information header according to Embodiment 11; 
         FIG. 104  is a diagram illustrating an example syntax of the attribute information header according to Embodiment 11; 
         FIG. 105  is a flowchart of a three-dimensional data encoding process according to Embodiment 11; 
         FIG. 106  is a flowchart of a three-dimensional data decoding process according to Embodiment 11; 
         FIG. 107  is a diagram illustrating an example in which the range and number of nodes to be referred to and included in a parent node group are changed according to Embodiment 11; 
         FIG. 108  is a flowchart of a three-dimensional data encoding process according to Embodiment 11; and 
         FIG. 109  is a flowchart of a three-dimensional data decoding process according to Embodiment 11. 
     
    
    
     DETAILED DESCRIPTION OF THE EMBODIMENTS 
     A three-dimensional data encoding method according to one aspect of the present disclosure includes: determining whether a first valid node count is greater than or equal to a first threshold value predetermined, the first valid node count being a total number of valid nodes that are nodes each including a three-dimensional point, the valid nodes being included in first nodes belonging to a layer higher than a layer of a current node in an N-ary tree structure of three-dimensional points included in point cloud data, N being an integer greater than or equal to 2; when the first valid node count is greater than or equal to the first threshold value, performing first encoding on attribute information of the current node, the first encoding including a prediction process in which second nodes are used, the second nodes including a parent node of the current node and belonging to a same layer as the parent node; and when the first valid node count is less than the first threshold value, performing second encoding on attribute information of the current node, the second encoding not including the prediction process in which the second nodes are used. 
     According to the three-dimensional data encoding method, whether to use the first encoding including a prediction process can be appropriately selected, and therefore, the encoding efficiency can be improved. 
     For example, the first nodes may include the parent node and nodes belonging to the same layer as the parent node. 
     For example, the first nodes may include a grandparent node of the current node and nodes belonging to a same layer as the grandparent node. 
     For example, in the second encoding, a predicted value of attribute information of the current node may be set to zero. 
     For example, the three-dimensional data encoding method may further include generating a bitstream including attribute information of the current node encoded and first information indicating whether the first encoding is applicable. 
     For example, the three-dimensional data encoding method may further include generating a bitstream including attribute information of the current node encoded and second information indicating the first threshold value. 
     For example, the three-dimensional data encoding method may further include: determining whether a second valid node count is greater than or equal to a second threshold value predetermined, the second valid node count being a total number of valid nodes included in second nodes including a grandparent node of the current node and nodes belonging to a same layer as the grandparent node; when the first valid node count is greater than the first threshold value, and the second valid node count is greater than or equal to the second threshold value, performing the first encoding on attribute information of the current node; and when the first valid node count is less than the first threshold value or the second valid node count is less than the second threshold value, performing the second encoding on attribute information of the current node. 
     A three-dimensional data decoding method according to one aspect of the present disclosure includes: determining whether a first valid node count is greater than or equal to a first threshold value predetermined, the first valid node count being a total number of valid nodes that are nodes each including a three-dimensional point, the valid nodes being included in first nodes belonging to a layer higher than a layer of a current node in an N-ary tree structure of three-dimensional points included in point cloud data, N being an integer greater than or equal to 2; when the first valid node count is greater than or equal to the first threshold value, performing first decoding on attribute information of the current node, the first decoding including a prediction process in which second nodes are used, the second nodes including a parent node of the current node and belonging to a same layer as the parent node; and when the first valid node count is less than the first threshold value, performing second decoding on attribute information of the current node, the second decoding not including the prediction process in which the second nodes are used. 
     According to the three-dimensional data decoding method, whether to use the first decoding including a prediction process can be appropriately selected, and therefore, the encoding efficiency can be improved. 
     For example, the first nodes may include the parent node and nodes belonging to the same layer as the parent node. 
     For example, the first nodes may include a grandparent node of the current node and nodes belonging to a same layer as the grandparent node. 
     For example, in the second decoding, a predicted value of attribute information of the current node may be set to zero. 
     For example, the three-dimensional data decoding method may further include obtaining first information indicating whether the first decoding is applicable, from a bitstream including attribute information of the current node encoded. 
     For example, the three-dimensional data decoding method may further include obtaining second information indicating the first threshold value, from a bitstream including attribute information of the current node encoded. 
     For example, the three-dimensional data decoding method may further include: determining whether a second valid node count is greater than or equal to a second threshold value predetermined, the second valid node count being a total number of valid nodes included in second nodes including a grandparent node of the current node and nodes belonging to a same layer as the grandparent node; when the first valid node count is greater than the first threshold value, and the second valid node count is greater than or equal to the second threshold value, performing the first decoding on attribute information of the current node; and when the first valid node count is less than the first threshold value or the second valid node count is less than the second threshold value, performing the second decoding on attribute information of the current node. 
     A three-dimensional data encoding device according to one aspect of the present disclosure includes a processor and memory. Using the memory, the processor: determines whether a first valid node count is greater than or equal to a first threshold value predetermined, the first valid node count being a total number of valid nodes that are nodes each including a three-dimensional point, the valid nodes being included in first nodes belonging to a layer higher than a layer of a current node in an N-ary tree structure of three-dimensional points included in point cloud data, N being an integer greater than or equal to 2; when the first valid node count is greater than or equal to the first threshold value, performs first encoding on attribute information of the current node, the first encoding including a prediction process in which second nodes are used, the second nodes including a parent node of the current node and belonging to a same layer as the parent node; and when the first valid node count is less than the first threshold value, performs second encoding on attribute information of the current node, the second encoding not including the prediction process in which the second nodes are used. 
     According to this configuration, since the three-dimensional data encoding device can appropriately select whether to use the first encoding including a prediction process, the three-dimensional encoding device can improve the encoding efficiency. 
     A three-dimensional data decoding device according to one aspect of the present disclosure includes a processor and memory. Using the memory, the processor: determines whether a first valid node count is greater than or equal to a first threshold value predetermined, the first valid node count being a total number of valid nodes that are nodes each including a three-dimensional point, the valid nodes being included in first nodes belonging to a layer higher than a layer of a current node in an N-ary tree structure of three-dimensional points included in point cloud data, N being an integer greater than or equal to 2; when the first valid node count is greater than or equal to the first threshold value, performs first decoding on attribute information of the current node, the first decoding including a prediction process in which second nodes are used, the second nodes including a parent node of the current node and belonging to a same layer as the parent node; and when the first valid node count is less than the first threshold value, performs second decoding on attribute information of the current node, the second decoding not including the prediction process in which the second nodes are used. 
     According to this configuration, since the three-dimensional data decoding device can appropriately select whether to use the first decoding including a prediction process, the three-dimensional data decoding device can improve the encoding efficiency. 
     It is to be noted that these general or specific aspects may be implemented as a system, a method, an integrated circuit, a computer program, or a computer-readable recording medium such as a CD-ROM, or may be implemented as any combination of a system, a method, an integrated circuit, a computer program, and a recording medium. 
     The following describes embodiments with reference to the drawings. It is to be noted that the following embodiments indicate exemplary embodiments of the present disclosure. The numerical values, shapes, materials, constituent elements, the arrangement and connection of the constituent elements, steps, the processing order of the steps, etc. indicated in the following embodiments are mere examples, and thus are not intended to limit the present disclosure. Of the constituent elements described in the following embodiments, constituent elements not recited in any one of the independent claims that indicate the broadest concepts will be described as optional constituent elements. 
     Embodiment 1 
     First, the data structure of encoded three-dimensional data (hereinafter also referred to as encoded data) according to the present embodiment will be described.  FIG. 1  is a diagram showing the structure of encoded three-dimensional data according to the present embodiment.  FIG. 1  is a diagram showing the structure of encoded three-dimensional data according to the present embodiment. 
     In the present embodiment, a three-dimensional space is divided into spaces (SPCs), which correspond to pictures in moving picture encoding, and the three-dimensional data is encoded on a SPC-by-SPC basis. Each SPC is further divided into volumes (VLMs), which correspond to macroblocks, etc. in moving picture encoding, and predictions and transforms are performed on a VLM-by-VLM basis. Each volume includes a plurality of voxels (VXLs), each being a minimum unit in which position coordinates are associated. Note that prediction is a process of generating predictive three-dimensional data analogous to a current processing unit by referring to another processing unit, and encoding a differential between the predictive three-dimensional data and the current processing unit, as in the case of predictions performed on two-dimensional images. Such prediction includes not only spatial prediction in which another prediction unit corresponding to the same time is referred to, but also temporal prediction in which a prediction unit corresponding to a different time is referred to. 
     When encoding a three-dimensional space represented by point group data such as a point cloud, for example, the three-dimensional data encoding device (hereinafter also referred to as the encoding device) encodes the points in the point group or points included in the respective voxels in a collective manner, in accordance with a voxel size. Finer voxels enable a highly-precise representation of the three-dimensional shape of a point group, while larger voxels enable a rough representation of the three-dimensional shape of a point group. 
     Note that the following describes the case where three-dimensional data is a point cloud, but three-dimensional data is not limited to a point cloud, and thus three-dimensional data of any format may be employed. 
     Also note that voxels with a hierarchical structure may be used. In such a case, when the hierarchy includes n levels, whether a sampling point is included in the n−1th level or its lower levels (the lower levels of the n-th level) may be sequentially indicated. For example, when only the n-th level is decoded, and the n−1th level or its lower levels include a sampling point, the n-th level can be decoded on the assumption that a sampling point is included at the center of a voxel in the n-th level. 
     Also, the encoding device obtains point group data, using, for example, a distance sensor, a stereo camera, a monocular camera, a gyroscope sensor, or an inertial sensor. 
     As in the case of moving picture encoding, each SPC is classified into one of at least the three prediction structures that include: intra SPC (I-SPC), which is individually decodable; predictive SPC (P-SPC) capable of only a unidirectional reference; and bidirectional SPC (B-SPC) capable of bidirectional references. Each SPC includes two types of time information: decoding time and display time. 
     Furthermore, as shown in  FIG. 1 , a processing unit that includes a plurality of SPCs is a group of spaces (GOS), which is a random access unit. Also, a processing unit that includes a plurality of GOSs is a world (WLD). 
     The spatial region occupied by each world is associated with an absolute position on earth, by use of, for example, GPS, or latitude and longitude information. Such position information is stored as meta-information. Note that meta-information may be included in encoded data, or may be transmitted separately from the encoded data. 
     Also, inside a GOS, all SPCs may be three-dimensionally adjacent to one another, or there may be a SPC that is not three-dimensionally adjacent to another SPC. 
     Note that the following also describes processes such as encoding, decoding, and reference to be performed on three-dimensional data included in processing units such as GOS, SPC, and VLM, simply as performing encoding/to encode, decoding/to decode, referring to, etc. on a processing unit. Also note that three-dimensional data included in a processing unit includes, for example, at least one pair of a spatial position such as three-dimensional coordinates and an attribute value such as color information. 
     Next, the prediction structures among SPCs in a GOS will be described. A plurality of SPCs in the same GOS or a plurality of VLMs in the same SPC occupy mutually different spaces, while having the same time information (the decoding time and the display time). 
     A SPC in a GOS that comes first in the decoding order is an I-SPC. GOSs come in two types: closed GOS and open GOS. A closed GOS is a GOS in which all SPCs in the GOS are decodable when decoding starts from the first I-SPC. Meanwhile, an open GOS is a GOS in which a different GOS is referred to in one or more SPCs preceding the first I-SPC in the GOS in the display time, and thus cannot be singly decoded. 
     Note that in the case of encoded data of map information, for example, a WLD is sometimes decoded in the backward direction, which is opposite to the encoding order, and thus backward reproduction is difficult when GOSs are interdependent. In such a case, a closed GOS is basically used. 
     Each GOS has a layer structure in height direction, and SPCs are sequentially encoded or decoded from SPCs in the bottom layer. 
       FIG. 2  is a diagram showing an example of prediction structures among SPCs that belong to the lowermost layer in a GOS.  FIG. 3  is a diagram showing an example of prediction structures among layers. 
     A GOS includes at least one I-SPC. Of the objects in a three-dimensional space, such as a person, an animal, a car, a bicycle, a signal, and a building serving as a landmark, a small-sized object is especially effective when encoded as an I-SPC. When decoding a GOS at a low throughput or at a high speed, for example, the three-dimensional data decoding device (hereinafter also referred to as the decoding device) decodes only I-SPC(s) in the GOS. 
     The encoding device may also change the encoding interval or the appearance frequency of I-SPCs, depending on the degree of sparseness and denseness of the objects in a WLD. 
     In the structure shown in  FIG. 3 , the encoding device or the decoding device encodes or decodes a plurality of layers sequentially from the bottom layer (layer l). This increases the priority of data on the ground and its vicinity, which involve a larger amount of information, when, for example, a self-driving car is concerned. 
     Regarding encoded data used for a drone, for example, encoding or decoding may be performed sequentially from SPCs in the top layer in a GOS in height direction. 
     The encoding device or the decoding device may also encode or decode a plurality of layers in a manner that the decoding device can have a rough grasp of a GOS first, and then the resolution is gradually increased. The encoding device or the decoding device may perform encoding or decoding in the order of layers 3, 8, 1, 9 . . . , for example. 
     Next, the handling of static objects and dynamic objects will be described. 
     A three-dimensional space includes scenes or still objects such as a building and a road (hereinafter collectively referred to as static objects), and objects with motion such as a car and a person (hereinafter collectively referred to as dynamic objects). Object detection is separately performed by, for example, extracting keypoints from point cloud data, or from video of a camera such as a stereo camera. In this description, an example method of encoding a dynamic object will be described. 
     A first method is a method in which a static object and a dynamic object are encoded without distinction. A second method is a method in which a distinction is made between a static object and a dynamic object on the basis of identification information. 
     For example, a GOS is used as an identification unit. In such a case, a distinction is made between a GOS that includes SPCs constituting a static object and a GOS that includes SPCs constituting a dynamic object, on the basis of identification information stored in the encoded data or stored separately from the encoded data. 
     Alternatively, a SPC may be used as an identification unit. In such a case, a distinction is made between a SPC that includes VLMs constituting a static object and a SPC that includes VLMs constituting a dynamic object, on the basis of the identification information thus described. 
     Alternatively, a VLM or a VXL may be used as an identification unit. In such a case, a distinction is made between a VLM or a VXL that includes a static object and a VLM or a VXL that includes a dynamic object, on the basis of the identification information thus described. 
     The encoding device may also encode a dynamic object as at least one VLM or SPC, and may encode a VLM or a SPC including a static object and a SPC including a dynamic object as mutually different GOSs. When the GOS size is variable depending on the size of a dynamic object, the encoding device separately stores the GOS size as meta-information. 
     The encoding device may also encode a static object and a dynamic object separately from each other, and may superimpose the dynamic object onto a world constituted by static objects. In such a case, the dynamic object is constituted by at least one SPC, and each SPC is associated with at least one SPC constituting the static object onto which the each SPC is to be superimposed. Note that a dynamic object may be represented not by SPC(s) but by at least one VLM or VXL. 
     The encoding device may also encode a static object and a dynamic object as mutually different streams. 
     The encoding device may also generate a GOS that includes at least one SPC constituting a dynamic object. The encoding device may further set the size of a GOS including a dynamic object (GOS_M) and the size of a GOS including a static object corresponding to the spatial region of GOS_M at the same size (such that the same spatial region is occupied). This enables superimposition to be performed on a GOS-by-GOS basis. 
     SPC(s) included in another encoded GOS may be referred to in a P-SPC or a B-SPC constituting a dynamic object. In the case where the position of a dynamic object temporally changes, and the same dynamic object is encoded as an object in a GOS corresponding to a different time, referring to SPC(s) across GOSs is effective in terms of compression rate. 
     The first method and the second method may be selected in accordance with the intended use of encoded data. When encoded three-dimensional data is used as a map, for example, a dynamic object is desired to be separated, and thus the encoding device uses the second method. Meanwhile, the encoding device uses the first method when the separation of a dynamic object is not required such as in the case where three-dimensional data of an event such as a concert and a sports event is encoded. 
     The decoding time and the display time of a GOS or a SPC are storable in encoded data or as meta-information. All static objects may have the same time information. In such a case, the decoding device may determine the actual decoding time and display time. Alternatively, a different value may be assigned to each GOS or SPC as the decoding time, and the same value may be assigned as the display time. Furthermore, as in the case of the decoder model in moving picture encoding such as Hypothetical Reference Decoder (HRD) compliant with HEVC, a model may be employed that ensures that a decoder can perform decoding without fail by having a buffer of a predetermined size and by reading a bitstream at a predetermined bit rate in accordance with the decoding times. 
     Next, the topology of GOSs in a world will be described. The coordinates of the three-dimensional space in a world are represented by the three coordinate axes (x axis, y axis, and z axis) that are orthogonal to one another. A predetermined rule set for the encoding order of GOSs enables encoding to be performed such that spatially adjacent GOSs are contiguous in the encoded data. In an example shown in  FIG. 4 , for example, GOSs in the x and z planes are successively encoded. After the completion of encoding all GOSs in certain x and z planes, the value of the y axis is updated. Stated differently, the world expands in the y axis direction as the encoding progresses. The GOS index numbers are set in accordance with the encoding order. 
     Here, the three-dimensional spaces in the respective worlds are previously associated one-to-one with absolute geographical coordinates such as GPS coordinates or latitude/longitude coordinates. Alternatively, each three-dimensional space may be represented as a position relative to a previously set reference position. The directions of the x axis, the y axis, and the z axis in the three-dimensional space are represented by directional vectors that are determined on the basis of the latitudes and the longitudes, etc. Such directional vectors are stored together with the encoded data as meta-information. 
     GOSs have a fixed size, and the encoding device stores such size as meta-information. The GOS size may be changed depending on, for example, whether it is an urban area or not, or whether it is inside or outside of a room. Stated differently, the GOS size may be changed in accordance with the amount or the attributes of objects with information values. Alternatively, in the same world, the encoding device may adaptively change the GOS size or the interval between I-SPCs in GOSs in accordance with the object density, etc. For example, the encoding device sets the GOS size to smaller and the interval between I-SPCs in GOSs to shorter, as the object density is higher. 
     In an example shown in  FIG. 5 , to enable random access with a finer granularity, a GOS with a high object density is partitioned into the regions of the third to tenth GOSs. Note that the seventh to tenth GOSs are located behind the third to sixth GOSs. 
     Embodiment 2 
     The present embodiment will describe a method of transmitting/receiving three-dimensional data between vehicles. 
       FIG. 7  is a schematic diagram showing three-dimensional data  607  being transmitted/received between own vehicle  600  and nearby vehicle  601 . 
     In three-dimensional data that is obtained by a sensor mounted on own vehicle  600  (e.g., a distance sensor such as a rangefinder, as well as a stereo camera and a combination of a plurality of monocular cameras), there appears a region, three-dimensional data of which cannot be created, due to an obstacle such as nearby vehicle  601 , despite that such region is included in sensor detection range  602  of own vehicle  600  (such region is hereinafter referred to as occlusion region  604 ). Also, while the obtainment of three-dimensional data of a larger space enables a higher accuracy of autonomous operations, a range of sensor detection only by own vehicle  600  is limited. 
     Sensor detection range  602  of own vehicle  600  includes region  603 , three-dimensional data of which is obtainable, and occlusion region  604 . A range, three-dimensional data of which own vehicle  600  wishes to obtain, includes sensor detection range  602  of own vehicle  600  and other regions. Sensor detection range  605  of nearby vehicle  601  includes occlusion region  604  and region  606  that is not included in sensor detection range  602  of own vehicle  600 . 
     Nearby vehicle  601  transmits information detected by nearby vehicle  601  to own vehicle  600 . Own vehicle  600  obtains the information detected by nearby vehicle  601 , such as a preceding vehicle, thereby obtaining three-dimensional data  607  of occlusion region  604  and region  606  outside of sensor detection range  602  of own vehicle  600 . Own vehicle  600  uses the information obtained by nearby vehicle  601  to complement the three-dimensional data of occlusion region  604  and region  606  outside of the sensor detection range. 
     The usage of three-dimensional data in autonomous operations of a vehicle or a robot includes self-location estimation, detection of surrounding conditions, or both. For example, for self-location estimation, three-dimensional data is used that is generated by own vehicle  600  on the basis of sensor information of own vehicle  600 . For detection of surrounding conditions, three-dimensional data obtained from nearby vehicle  601  is also used in addition to the three-dimensional data generated by own vehicle  600 . 
     Nearby vehicle  601  that transmits three-dimensional data  607  to own vehicle  600  may be determined in accordance with the state of own vehicle  600 . For example, the current nearby vehicle  601  is a preceding vehicle when own vehicle  600  is running straight ahead, an oncoming vehicle when own vehicle  600  is turning right, and a following vehicle when own vehicle  600  is rolling backward. Alternatively, the driver of own vehicle  600  may directly specify nearby vehicle  601  that transmits three-dimensional data  607  to own vehicle  600 . 
     Alternatively, own vehicle  600  may search for nearby vehicle  601  having three-dimensional data of a region that is included in a space, three-dimensional data of which own vehicle  600  wishes to obtain, and that own vehicle  600  cannot obtain. The region own vehicle  600  cannot obtain is occlusion region  604 , or region  606  outside of sensor detection range  602 , etc. 
     Own vehicle  600  may identify occlusion region  604  on the basis of the sensor information of own vehicle  600 . For example, own vehicle  600  identifies, as occlusion region  604 , a region which is included in sensor detection range  602  of own vehicle  600 , and three-dimensional data of which cannot be created. 
     The following describes example operations to be performed when a vehicle that transmits three-dimensional data  607  is a preceding vehicle.  FIG. 8  is a diagram showing an example of three-dimensional data to be transmitted in such case. 
     As  FIG. 8  shows, three-dimensional data  607  transmitted from the preceding vehicle is, for example, a sparse world (SWLD) of a point cloud. Stated differently, the preceding vehicle creates three-dimensional data (point cloud) of a WLD from information detected by a sensor of such preceding vehicle, and extracts data having an amount of features greater than or equal to the threshold from such three-dimensional data of the WLD, thereby creating three-dimensional data (point cloud) of the SWLD. Subsequently, the preceding vehicle transmits the created three-dimensional data of the SWLD to own vehicle  600 . 
     Own vehicle  600  receives the SWLD, and merges the received SWLD with the point cloud created by own vehicle  600 . 
     The SWLD to be transmitted includes information on the absolute coordinates (the position of the SWLD in the coordinates system of a three-dimensional map). The merge is achieved by own vehicle  600  overwriting the point cloud generated by own vehicle  600  on the basis of such absolute coordinates. 
     The SWLD transmitted from nearby vehicle  601  may be: a SWLD of region  606  that is outside of sensor detection range  602  of own vehicle  600  and within sensor detection range  605  of nearby vehicle  601 ; or a SWLD of occlusion region  604  of own vehicle  600 ; or the SWLDs of the both. Of these SWLDs, a SWLD to be transmitted may also be a SWLD of a region used by nearby vehicle  601  to detect the surrounding conditions. 
     Nearby vehicle  601  may change the density of a point cloud to transmit, in accordance with the communication available time, during which own vehicle  600  and nearby vehicle  601  can communicate, and which is based on the speed difference between these vehicles. For example, when the speed difference is large and the communication available time is short, nearby vehicle  601  may extract three-dimensional points having a large amount of features from the SWLD to decrease the density (data amount) of the point cloud. 
     The detection of the surrounding conditions refers to judging the presence/absence of persons, vehicles, equipment for roadworks, etc., identifying their types, and detecting their positions, travelling directions, traveling speeds, etc. 
     Own vehicle  600  may obtain braking information of nearby vehicle  601  instead of or in addition to three-dimensional data  607  generated by nearby vehicle  601 . Here, the braking information of nearby vehicle  601  is, for example, information indicating that the accelerator or the brake of nearby vehicle  601  has been pressed, or the degree of such pressing. 
     In the point clouds generated by the vehicles, the three-dimensional spaces are segmented on a random access unit, in consideration of low-latency communication between the vehicles. Meanwhile, in a three-dimensional map, etc., which is map data downloaded from the server, a three-dimensional space is segmented in a larger random access unit than in the case of inter-vehicle communication. 
     Data on a region that is likely to be an occlusion region, such as a region in front of the preceding vehicle and a region behind the following vehicle, is segmented on a finer random access unit as low-latency data. 
     Data on a region in front of a vehicle has an increased importance when on an expressway, and thus each vehicle creates a SWLD of a range with a narrowed viewing angle on a finer random access unit when running on an expressway. 
     When the SWLD created by the preceding vehicle for transmission includes a region, the point cloud of which own vehicle  600  can obtain, the preceding vehicle may remove the point cloud of such region to reduce the amount of data to transmit. 
     Embodiment 3 
     The present embodiment describes a method, etc. of transmitting three-dimensional data to a following vehicle.  FIG. 9  is a diagram showing an exemplary space, three-dimensional data of which is to be transmitted to a following vehicle, etc. 
     Vehicle  801  transmits, at the time interval of Δt, three-dimensional data, such as a point cloud (a point group) included in a rectangular solid space  802 , having width W, height H, and depth D, located ahead of vehicle  801  and distanced by distance L from vehicle  801 , to a cloud-based traffic monitoring system that monitors road situations or a following vehicle. 
     When a change has occurred in the three-dimensional data of a space that is included in space  802  already transmitted in the past, due to a vehicle or a person entering space  802  from outside, for example, vehicle  801  also transmits three-dimensional data of the space in which such change has occurred. 
     Although  FIG. 9  illustrates an example in which space  802  has a rectangular solid shape, space  802  is not necessarily a rectangular solid so long as space  802  includes a space on the forward road that is hidden from view of a following vehicle. 
     Distance L may be set to a distance that allows the following vehicle having received the three-dimensional data to stop safely. For example, set as distance L is the sum of; a distance traveled by the following vehicle while receiving the three-dimensional data; a distance traveled by the following vehicle until the following vehicle starts speed reduction in accordance with the received data; and a distance required by the following vehicle to stop safely after starting speed reduction. These distances vary in accordance with the speed, and thus distance L may vary in accordance with speed V of the vehicle, just like L=a×V+b (a and b are constants). 
     Width W is set to a value that is at least greater than the width of the lane on which vehicle  801  is traveling. Width W may also be set to a size that includes an adjacent space such as right and left lanes and a side strip. 
     Depth D may have a fixed value, but may vary in accordance with speed V of the vehicle, just like D=c×V+d (c and d are constants). Also, D that is set to satisfy D&gt;V×Δt enables the overlap of a space to be transmitted and a space transmitted in the past. This enables vehicle  801  to transmit a space on the traveling road to the following vehicle, etc. completely and more reliably. 
     As described above, vehicle  801  transmits three-dimensional data of a limited space that is useful to the following vehicle, thereby effectively reducing the amount of the three-dimensional data to be transmitted and achieving low-latency, low-cost communication. 
     Embodiment 4 
     In Embodiment 3, an example is described in which a client device of a vehicle or the like transmits three-dimensional data to another vehicle or a server such as a cloud-based traffic monitoring system. In the present embodiment, a client device transmits sensor information obtained through a sensor to a server or a client device. 
     A structure of a system according to the present embodiment will first be described.  FIG. 10  is a diagram showing the structure of a transmission/reception system of a three-dimensional map and sensor information according to the present embodiment. This system includes server  901 , and client devices  902 A and  902 B. Note that client devices  902 A and  902 B are also referred to as client device  902  when no particular distinction is made therebetween. 
     Client device  902  is, for example, a vehicle-mounted device equipped in a mobile object such as a vehicle. Server  901  is, for example, a cloud-based traffic monitoring system, and is capable of communicating with the plurality of client devices  902 . 
     Server  901  transmits the three-dimensional map formed by a point cloud to client device  902 . Note that a structure of the three-dimensional map is not limited to a point cloud, and may also be another structure expressing three-dimensional data such as a mesh structure. 
     Client device  902  transmits the sensor information obtained by client device  902  to server  901 . The sensor information includes, for example, at least one of information obtained by LIDAR, a visible light image, an infrared image, a depth image, sensor position information, or sensor speed information. 
     The data to be transmitted and received between server  901  and client device  902  may be compressed in order to reduce data volume, and may also be transmitted uncompressed in order to maintain data precision. When compressing the data, it is possible to use a three-dimensional compression method on the point cloud based on, for example, an octree structure. It is possible to use a two-dimensional image compression method on the visible light image, the infrared image, and the depth image. The two-dimensional image compression method is, for example, MPEG-4 AVC or HEVC standardized by MPEG. 
     Server  901  transmits the three-dimensional map managed by server  901  to client device  902  in response to a transmission request for the three-dimensional map from client device  902 . Note that server  901  may also transmit the three-dimensional map without waiting for the transmission request for the three-dimensional map from client device  902 . For example, server  901  may broadcast the three-dimensional map to at least one client device  902  located in a predetermined space. Server  901  may also transmit the three-dimensional map suited to a position of client device  902  at fixed time intervals to client device  902  that has received the transmission request once. Server  901  may also transmit the three-dimensional map managed by server  901  to client device  902  every time the three-dimensional map is updated. 
     Client device  902  sends the transmission request for the three-dimensional map to server  901 . For example, when client device  902  wants to perform the self-location estimation during traveling, client device  902  transmits the transmission request for the three-dimensional map to server  901 . 
     Note that in the following cases, client device  902  may send the transmission request for the three-dimensional map to server  901 . Client device  902  may send the transmission request for the three-dimensional map to server  901  when the three-dimensional map stored by client device  902  is old. For example, client device  902  may send the transmission request for the three-dimensional map to server  901  when a fixed period has passed since the three-dimensional map is obtained by client device  902 . 
     Client device  902  may also send the transmission request for the three-dimensional map to server  901  before a fixed time when client device  902  exits a space shown in the three-dimensional map stored by client device  902 . For example, client device  902  may send the transmission request for the three-dimensional map to server  901  when client device  902  is located within a predetermined distance from a boundary of the space shown in the three-dimensional map stored by client device  902 . When a movement path and a movement speed of client device  902  are understood, a time when client device  902  exits the space shown in the three-dimensional map stored by client device  902  may be predicted based on the movement path and the movement speed of client device  902 . 
     Client device  902  may also send the transmission request for the three-dimensional map to server  901  when an error during alignment of the three-dimensional data and the three-dimensional map created from the sensor information by client device  902  is at least at a fixed level. 
     Client device  902  transmits the sensor information to server  901  in response to a transmission request for the sensor information from server  901 . Note that client device  902  may transmit the sensor information to server  901  without waiting for the transmission request for the sensor information from server  901 . For example, client device  902  may periodically transmit the sensor information during a fixed period when client device  902  has received the transmission request for the sensor information from server  901  once. Client device  902  may determine that there is a possibility of a change in the three-dimensional map of a surrounding area of client device  902  having occurred, and transmit this information and the sensor information to server  901 , when the error during alignment of the three-dimensional data created by client device  902  based on the sensor information and the three-dimensional map obtained from server  901  is at least at the fixed level. 
     Server  901  sends a transmission request for the sensor information to client device  902 . For example, server  901  receives position information, such as GPS information, about client device  902  from client device  902 . Server  901  sends the transmission request for the sensor information to client device  902  in order to generate a new three-dimensional map, when it is determined that client device  902  is approaching a space in which the three-dimensional map managed by server  901  contains little information, based on the position information about client device  902 . Server  901  may also send the transmission request for the sensor information, when wanting to (i) update the three-dimensional map, (ii) check road conditions during snowfall, a disaster, or the like, or (iii) check traffic congestion conditions, accident/incident conditions, or the like. 
     Client device  902  may set an amount of data of the sensor information to be transmitted to server  901  in accordance with communication conditions or bandwidth during reception of the transmission request for the sensor information to be received from server  901 . Setting the amount of data of the sensor information to be transmitted to server  901  is, for example, increasing/reducing the data itself or appropriately selecting a compression method. 
       FIG. 11  is a block diagram showing an example structure of client device  902 . Client device  902  receives the three-dimensional map formed by a point cloud and the like from server  901 , and estimates a self-location of client device  902  using the three-dimensional map created based on the sensor information of client device  902 . Client device  902  transmits the obtained sensor information to server  901 . 
     Client device  902  includes data receiver  1011 , communication unit  1012 , reception controller  1013 , format converter  1014 , sensors  1015 , three-dimensional data creator  1016 , three-dimensional image processor  1017 , three-dimensional data storage  1018 , format converter  1019 , communication unit  1020 , transmission controller  1021 , and data transmitter  1022 . 
     Data receiver  1011  receives three-dimensional map  1031  from server  901 . Three-dimensional map  1031  is data that includes a point cloud such as a WLD or a SWLD. Three-dimensional map  1031  may include compressed data or uncompressed data. 
     Communication unit  1012  communicates with server  901  and transmits a data transmission request (e.g. transmission request for three-dimensional map) to server  901 . 
     Reception controller  1013  exchanges information, such as information on supported formats, with a communications partner via communication unit  1012  to establish communication with the communications partner. 
     Format converter  1014  performs a format conversion and the like on three-dimensional map  1031  received by data receiver  1011  to generate three-dimensional map  1032 . Format converter  1014  also performs a decompression or decoding process when three-dimensional map  1031  is compressed or encoded. Note that format converter  1014  does not perform the decompression or decoding process when three-dimensional map  1031  is uncompressed data. 
     Sensors  815  are a group of sensors, such as LIDARs, visible light cameras, infrared cameras, or depth sensors that obtain information about the outside of a vehicle equipped with client device  902 , and generate sensor information  1033 . Sensor information  1033  is, for example, three-dimensional data such as a point cloud (point group data) when sensors  1015  are laser sensors such as LIDARs. Note that a single sensor may serve as sensors  1015 . 
     Three-dimensional data creator  1016  generates three-dimensional data  1034  of a surrounding area of the own vehicle based on sensor information  1033 . For example, three-dimensional data creator  1016  generates point cloud data with color information on the surrounding area of the own vehicle using information obtained by LIDAR and visible light video obtained by a visible light camera. 
     Three-dimensional image processor  1017  performs a self-location estimation process and the like of the own vehicle, using (i) the received three-dimensional map  1032  such as a point cloud, and (ii) three-dimensional data  1034  of the surrounding area of the own vehicle generated using sensor information  1033 . Note that three-dimensional image processor  1017  may generate three-dimensional data  1035  about the surroundings of the own vehicle by merging three-dimensional map  1032  and three-dimensional data  1034 , and may perform the self-location estimation process using the created three-dimensional data  1035 . 
     Three-dimensional data storage  1018  stores three-dimensional map  1032 , three-dimensional data  1034 , three-dimensional data  1035 , and the like. 
     Format converter  1019  generates sensor information  1037  by converting sensor information  1033  to a format supported by a receiver end. Note that format converter  1019  may reduce the amount of data by compressing or encoding sensor information  1037 . Format converter  1019  may omit this process when format conversion is not necessary. Format converter  1019  may also control the amount of data to be transmitted in accordance with a specified transmission range. 
     Communication unit  1020  communicates with server  901  and receives a data transmission request (transmission request for sensor information) and the like from server  901 . 
     Transmission controller  1021  exchanges information, such as information on supported formats, with a communications partner via communication unit  1020  to establish communication with the communications partner. 
     Data transmitter  1022  transmits sensor information  1037  to server  901 . Sensor information  1037  includes, for example, information obtained through sensors  1015 , such as information obtained by LIDAR, a luminance image obtained by a visible light camera, an infrared image obtained by an infrared camera, a depth image obtained by a depth sensor, sensor position information, and sensor speed information. 
     A structure of server  901  will be described next.  FIG. 12  is a block diagram showing an example structure of server  901 . Server  901  transmits sensor information from client device  902  and creates three-dimensional data based on the received sensor information. Server  901  updates the three-dimensional map managed by server  901  using the created three-dimensional data. Server  901  transmits the updated three-dimensional map to client device  902  in response to a transmission request for the three-dimensional map from client device  902 . 
     Server  901  includes data receiver  1111 , communication unit  1112 , reception controller  1113 , format converter  1114 , three-dimensional data creator  1116 , three-dimensional data merger  1117 , three-dimensional data storage  1118 , format converter  1119 , communication unit  1120 , transmission controller  1121 , and data transmitter  1122 . 
     Data receiver  1111  receives sensor information  1037  from client device  902 . Sensor information  1037  includes, for example, information obtained by LIDAR, a luminance image obtained by a visible light camera, an infrared image obtained by an infrared camera, a depth image obtained by a depth sensor, sensor position information, sensor speed information, and the like. 
     Communication unit  1112  communicates with client device  902  and transmits a data transmission request (e.g. transmission request for sensor information) and the like to client device  902 . 
     Reception controller  1113  exchanges information, such as information on supported formats, with a communications partner via communication unit  1112  to establish communication with the communications partner. 
     Format converter  1114  generates sensor information  1132  by performing a decompression or decoding process when the received sensor information  1037  is compressed or encoded. Note that format converter  1114  does not perform the decompression or decoding process when sensor information  1037  is uncompressed data. 
     Three-dimensional data creator  1116  generates three-dimensional data  1134  of a surrounding area of client device  902  based on sensor information  1132 . For example, three-dimensional data creator  1116  generates point cloud data with color information on the surrounding area of client device  902  using information obtained by LIDAR and visible light video obtained by a visible light camera. 
     Three-dimensional data merger  1117  updates three-dimensional map  1135  by merging three-dimensional data  1134  created based on sensor information  1132  with three-dimensional map  1135  managed by server  901 . Three-dimensional data storage  1118  stores three-dimensional map  1135  and the like. 
     Format converter  1119  generates three-dimensional map  1031  by converting three-dimensional map  1135  to a format supported by the receiver end. Note that format converter  1119  may reduce the amount of data by compressing or encoding three-dimensional map  1135 . Format converter  1119  may omit this process when format conversion is not necessary. Format converter  1119  may also control the amount of data to be transmitted in accordance with a specified transmission range. 
     Communication unit  1120  communicates with client device  902  and receives a data transmission request (transmission request for three-dimensional map) and the like from client device  902 . 
     Transmission controller  1121  exchanges information, such as information on supported formats, with a communications partner via communication unit  1120  to establish communication with the communications partner. 
     Data transmitter  1122  transmits three-dimensional map  1031  to client device  902 . Three-dimensional map  1031  is data that includes a point cloud such as a WLD or a SWLD. Three-dimensional map  1031  may include one of compressed data and uncompressed data. 
     An operational flow of client device  902  will be described next.  FIG. 13  is a flowchart of an operation when client device  902  obtains the three-dimensional map. 
     Client device  902  first requests server  901  to transmit the three-dimensional map (point cloud, etc.) (S 1001 ). At this point, by also transmitting the position information about client device  902  obtained through GPS and the like, client device  902  may also request server  901  to transmit a three-dimensional map relating to this position information. 
     Client device  902  next receives the three-dimensional map from server  901  (S 1002 ). When the received three-dimensional map is compressed data, client device  902  decodes the received three-dimensional map and generates an uncompressed three-dimensional map (S 1003 ). 
     Client device  902  next creates three-dimensional data  1034  of the surrounding area of client device  902  using sensor information  1033  obtained by sensors  1015  (S 1004 ). Client device  902  next estimates the self-location of client device  902  using three-dimensional map  1032  received from server  901  and three-dimensional data  1034  created using sensor information  1033  (S 1005 ). 
       FIG. 14  is a flowchart of an operation when client device  902  transmits the sensor information. Client device  902  first receives a transmission request for the sensor information from server  901  (S 1011 ). Client device  902  that has received the transmission request transmits sensor information  1037  to server  901  (S 1012 ). Note that client device  902  may generate sensor information  1037  by compressing each piece of information using a compression method suited to each piece of information, when sensor information  1033  includes a plurality of pieces of information obtained by sensors  1015 . 
     An operational flow of server  901  will be described next.  FIG. 15  is a flowchart of an operation when server  901  obtains the sensor information. Server  901  first requests client device  902  to transmit the sensor information (S 1021 ). Server  901  next receives sensor information  1037  transmitted from client device  902  in accordance with the request (S 1022 ). Server  901  next creates three-dimensional data  1134  using the received sensor information  1037  (S 1023 ). Server  901  next reflects the created three-dimensional data  1134  in three-dimensional map  1135  (S 1024 ). 
       FIG. 16  is a flowchart of an operation when server  901  transmits the three-dimensional map. Server  901  first receives a transmission request for the three-dimensional map from client device  902  (S 1031 ). Server  901  that has received the transmission request for the three-dimensional map transmits the three-dimensional map to client device  902  (S 1032 ). At this point, server  901  may extract a three-dimensional map of a vicinity of client device  902  along with the position information about client device  902 , and transmit the extracted three-dimensional map. Server  901  may compress the three-dimensional map formed by a point cloud using, for example, an octree structure compression method, and transmit the compressed three-dimensional map. 
     The following describes variations of the present embodiment. 
     Server  901  creates three-dimensional data  1134  of a vicinity of a position of client device  902  using sensor information  1037  received from client device  902 . Server  901  next calculates a difference between three-dimensional data  1134  and three-dimensional map  1135 , by matching the created three-dimensional data  1134  with three-dimensional map  1135  of the same area managed by server  901 . Server  901  determines that a type of anomaly has occurred in the surrounding area of client device  902 , when the difference is greater than or equal to a predetermined threshold. For example, it is conceivable that a large difference occurs between three-dimensional map  1135  managed by server  901  and three-dimensional data  1134  created based on sensor information  1037 , when land subsidence and the like occurs due to a natural disaster such as an earthquake. 
     Sensor information  1037  may include information indicating at least one of a sensor type, a sensor performance, and a sensor model number. Sensor information  1037  may also be appended with a class ID and the like in accordance with the sensor performance. For example, when sensor information  1037  is obtained by LIDAR, it is conceivable to assign identifiers to the sensor performance. A sensor capable of obtaining information with precision in units of several millimeters is class  1 , a sensor capable of obtaining information with precision in units of several centimeters is class  2 , and a sensor capable of obtaining information with precision in units of several meters is class  3 . Server  901  may estimate sensor performance information and the like from a model number of client device  902 . For example, when client device  902  is equipped in a vehicle, server  901  may determine sensor specification information from a type of the vehicle. In this case, server  901  may obtain information on the type of the vehicle in advance, and the information may also be included in the sensor information. Server  901  may change a degree of correction with respect to three-dimensional data  1134  created using sensor information  1037 , using the obtained sensor information  1037 . For example, when the sensor performance is high in precision (class  1 ), server  901  does not correct three-dimensional data  1134 . When the sensor performance is low in precision (class  3 ), server  901  corrects three-dimensional data  1134  in accordance with the precision of the sensor. For example, server  901  increases the degree (intensity) of correction with a decrease in the precision of the sensor. 
     Server  901  may simultaneously send the transmission request for the sensor information to the plurality of client devices  902  in a certain space. Server  901  does not need to use all of the sensor information for creating three-dimensional data  1134  and may, for example, select sensor information to be used in accordance with the sensor performance, when having received a plurality of pieces of sensor information from the plurality of client devices  902 . For example, when updating three-dimensional map  1135 , server  901  may select high-precision sensor information (class  1 ) from among the received plurality of pieces of sensor information, and create three-dimensional data  1134  using the selected sensor information. 
     Server  901  is not limited to only being a server such as a cloud-based traffic monitoring system, and may also be another (vehicle-mounted) client device.  FIG. 17  is a diagram of a system structure in this case. 
     For example, client device  902 C sends a transmission request for sensor information to client device  902 A located nearby, and obtains the sensor information from client device  902 A. Client device  902 C then creates three-dimensional data using the obtained sensor information of client device  902 A, and updates a three-dimensional map of client device  902 C. This enables client device  902 C to generate a three-dimensional map of a space that can be obtained from client device  902 A, and fully utilize the performance of client device  902 C. For example, such a case is conceivable when client device  902 C has high performance. 
     In this case, client device  902 A that has provided the sensor information is given rights to obtain the high-precision three-dimensional map generated by client device  902 C. Client device  902 A receives the high-precision three-dimensional map from client device  902 C in accordance with these rights. 
     Server  901  may send the transmission request for the sensor information to the plurality of client devices  902  (client device  902 A and client device  902 B) located nearby client device  902 C. When a sensor of client device  902 A or client device  902 B has high performance, client device  902 C is capable of creating the three-dimensional data using the sensor information obtained by this high-performance sensor. 
       FIG. 18  is a block diagram showing a functionality structure of server  901  and client device  902 . Server  901  includes, for example, three-dimensional map compression/decoding processor  1201  that compresses and decodes the three-dimensional map and sensor information compression/decoding processor  1202  that compresses and decodes the sensor information. 
     Client device  902  includes three-dimensional map decoding processor  1211  and sensor information compression processor  1212 . Three-dimensional map decoding processor  1211  receives encoded data of the compressed three-dimensional map, decodes the encoded data, and obtains the three-dimensional map. Sensor information compression processor  1212  compresses the sensor information itself instead of the three-dimensional data created using the obtained sensor information, and transmits the encoded data of the compressed sensor information to server  901 . With this structure, client device  902  does not need to internally store a processor that performs a process for compressing the three-dimensional data of the three-dimensional map (point cloud, etc.), as long as client device  902  internally stores a processor that performs a process for decoding the three-dimensional map (point cloud, etc.). This makes it possible to limit costs, power consumption, and the like of client device  902 . 
     As stated above, client device  902  according to the present embodiment is equipped in the mobile object, and creates three-dimensional data  1034  of a surrounding area of the mobile object using sensor information  1033  that is obtained through sensor  1015  equipped in the mobile object and indicates a surrounding condition of the mobile object. Client device  902  estimates a self-location of the mobile object using the created three-dimensional data  1034 . Client device  902  transmits the obtained sensor information  1033  to server  901  or another mobile object. 
     This enables client device  902  to transmit sensor information  1033  to server  901  or the like. This makes it possible to further reduce the amount of transmission data compared to when transmitting the three-dimensional data. Since there is no need for client device  902  to perform processes such as compressing or encoding the three-dimensional data, it is possible to reduce the processing amount of client device  902 . As such, client device  902  is capable of reducing the amount of data to be transmitted or simplifying the structure of the device. 
     Client device  902  further transmits the transmission request for the three-dimensional map to server  901  and receives three-dimensional map  1031  from server  901 . In the estimating of the self-location, client device  902  estimates the self-location using three-dimensional data  1034  and three-dimensional map  1032 . 
     Sensor information  1034  includes at least one of information obtained by a laser sensor, a luminance image, an infrared image, a depth image, sensor position information, or sensor speed information. 
     Sensor information  1033  includes information that indicates a performance of the sensor. 
     Client device  902  encodes or compresses sensor information  1033 , and in the transmitting of the sensor information, transmits sensor information  1037  that has been encoded or compressed to server  901  or another mobile object  902 . This enables client device  902  to reduce the amount of data to be transmitted. 
     For example, client device  902  includes a processor and memory. The processor performs the above processes using the memory. 
     Server  901  according to the present embodiment is capable of communicating with client device  902  equipped in the mobile object, and receives sensor information  1037  that is obtained through sensor  1015  equipped in the mobile object and indicates a surrounding condition of the mobile object. Server  901  creates three-dimensional data  1134  of a surrounding area of the mobile object using the received sensor information  1037 . 
     With this, server  901  creates three-dimensional data  1134  using sensor information  1037  transmitted from client device  902 . This makes it possible to further reduce the amount of transmission data compared to when client device  902  transmits the three-dimensional data. Since there is no need for client device  902  to perform processes such as compressing or encoding the three-dimensional data, it is possible to reduce the processing amount of client device  902 . As such, server  901  is capable of reducing the amount of data to be transmitted or simplifying the structure of the device. 
     Server  901  further transmits a transmission request for the sensor information to client device  902 . 
     Server  901  further updates three-dimensional map  1135  using the created three-dimensional data  1134 , and transmits three-dimensional map  1135  to client device  902  in response to the transmission request for three-dimensional map  1135  from client device  902 . 
     Sensor information  1037  includes at least one of information obtained by a laser sensor, a luminance image, an infrared image, a depth image, sensor position information, or sensor speed information. 
     Sensor information  1037  includes information that indicates a performance of the sensor. 
     Server  901  further corrects the three-dimensional data in accordance with the performance of the sensor. This enables the three-dimensional data creation method to improve the quality of the three-dimensional data. 
     In the receiving of the sensor information, server  901  receives a plurality of pieces of sensor information  1037  received from a plurality of client devices  902 , and selects sensor information  1037  to be used in the creating of three-dimensional data  1134 , based on a plurality of pieces of information that each indicates the performance of the sensor included in the plurality of pieces of sensor information  1037 . This enables server  901  to improve the quality of three-dimensional data  1134 . 
     Server  901  decodes or decompresses the received sensor information  1037 , and creates three-dimensional data  1134  using sensor information  1132  that has been decoded or decompressed. This enables server  901  to reduce the amount of data to be transmitted. 
     For example, server  901  includes a processor and memory. The processor performs the above processes using the memory. 
     Embodiment 5 
     In the present embodiment, a variation of Embodiment 4 will be described.  FIG. 19  is a diagram illustrating a configuration of a system according to the present embodiment. The system illustrated in  FIG. 19  includes server  2001 , client device  2002 A, and client device  2002 B. 
     Client device  2002 A and client device  2002 B are each provided in a mobile object such as a vehicle, and transmit sensor information to server  2001 . Server  2001  transmits a three-dimensional map (a point cloud) to client device  2002 A and client device  2002 B. 
     Client device  2002 A includes sensor information obtainer  2011 , storage  2012 , and data transmission possibility determiner  2013 . It should be noted that client device  2002 B has the same configuration. Additionally, when client device  2002 A and client device  2002 B are not particularly distinguished below, client device  2002 A and client device  2002 B are also referred to as client device  2002 . 
       FIG. 20  is a flowchart illustrating operation of client device  2002  according to the present embodiment. 
     Sensor information obtainer  2011  obtains a variety of sensor information using sensors (a group of sensors) provided in a mobile object. In other words, sensor information obtainer  2011  obtains sensor information obtained by the sensors (the group of sensors) provided in the mobile object and indicating a surrounding state of the mobile object. Sensor information obtainer  2011  also stores the obtained sensor information into storage  2012 . This sensor information includes at least one of information obtained by LiDAR, a visible light image, an infrared image, or a depth image. Additionally, the sensor information may include at least one of sensor position information, speed information, obtainment time information, or obtainment location information. Sensor position information indicates a position of a sensor that has obtained sensor information. Speed information indicates a speed of the mobile object when a sensor obtained sensor information. Obtainment time information indicates a time when a sensor obtained sensor information. Obtainment location information indicates a position of the mobile object or a sensor when the sensor obtained sensor information. 
     Next, data transmission possibility determiner  2013  determines whether the mobile object (client device  2002 ) is in an environment in which the mobile object can transmit sensor information to server  2001  (S 2002 ). For example, data transmission possibility determiner  2013  may specify a location and a time at which client device  2002  is present using GPS information etc., and may determine whether data can be transmitted. Additionally, data transmission possibility determiner  2013  may determine whether data can be transmitted, depending on whether it is possible to connect to a specific access point. 
     When client device  2002  determines that the mobile object is in the environment in which the mobile object can transmit the sensor information to server  2001  (YES in S 2002 ), client device  2002  transmits the sensor information to server  2001  (S 2003 ). In other words, when client device  2002  becomes capable of transmitting sensor information to server  2001 , client device  2002  transmits the sensor information held by client device  2002  to server  2001 . For example, an access point that enables high-speed communication using millimeter waves is provided in an intersection or the like. When client device  2002  enters the intersection, client device  2002  transmits the sensor information held by client device  2002  to server  2001  at high speed using the millimeter-wave communication. 
     Next, client device  2002  deletes from storage  2012  the sensor information that has been transmitted to server  2001  (S 2004 ). It should be noted that when sensor information that has not been transmitted to server  2001  meets predetermined conditions, client device  2002  may delete the sensor information. For example, when an obtainment time of sensor information held by client device  2002  precedes a current time by a certain time, client device  2002  may delete the sensor information from storage  2012 . In other words, when a difference between the current time and a time when a sensor obtained sensor information exceeds a predetermined time, client device  2002  may delete the sensor information from storage  2012 . Besides, when an obtainment location of sensor information held by client device  2002  is separated from a current location by a certain distance, client device  2002  may delete the sensor information from storage  2012 . In other words, when a difference between a current position of the mobile object or a sensor and a position of the mobile object or the sensor when the sensor obtained sensor information exceeds a predetermined distance, client device  2002  may delete the sensor information from storage  2012 . Accordingly, it is possible to reduce the capacity of storage  2012  of client device  2002 . 
     When client device  2002  does not finish obtaining sensor information (NO in S 2005 ), client device  2002  performs step S 2001  and the subsequent steps again. Further, when client device  2002  finishes obtaining sensor information (YES in S 2005 ), client device  2002  completes the process. 
     Client device  2002  may select sensor information to be transmitted to server  2001 , in accordance with communication conditions. For example, when high-speed communication is available, client device  2002  preferentially transmits sensor information (e.g., information obtained by LiDAR) of which the data size held in storage  2012  is large. Additionally, when high-speed communication is not readily available, client device  2002  transmits sensor information (e.g., a visible light image) which has high priority and of which the data size held in storage  2012  is small. Accordingly, client device  2002  can efficiently transmit sensor information held in storage  2012 , in accordance with network conditions 
     Client device  2002  may obtain, from server  2001 , time information indicating a current time and location information indicating a current location. Moreover, client device  2002  may determine an obtainment time and an obtainment location of sensor information based on the obtained time information and location information. In other words, client device  2002  may obtain time information from server  2001  and generate obtainment time information using the obtained time information. Client device  2002  may also obtain location information from server  2001  and generate obtainment location information using the obtained location information. 
     For example, regarding time information, server  2001  and client device  2002  perform clock synchronization using a means such as the Network Time Protocol (NTP) or the Precision Time Protocol (PTP). This enables client device  2002  to obtain accurate time information. What&#39;s more, since it is possible to synchronize clocks between server  2001  and client devices  2002 , it is possible to synchronize times included in pieces of sensor information obtained by separate client devices  2002 . As a result, server  2001  can handle sensor information indicating a synchronized time. It should be noted that a means of synchronizing clocks may be any means other than the NTP or PTP. In addition, GPS information may be used as the time information and the location information. 
     Server  2001  may specify a time or a location and obtain pieces of sensor information from client devices  2002 . For example, when an accident occurs, in order to search for a client device in the vicinity of the accident, server  2001  specifies an accident occurrence time and an accident occurrence location and broadcasts sensor information transmission requests to client devices  2002 . Then, client device  2002  having sensor information obtained at the corresponding time and location transmits the sensor information to server  2001 . In other words, client device  2002  receives, from server  2001 , a sensor information transmission request including specification information specifying a location and a time. When sensor information obtained at a location and a time indicated by the specification information is stored in storage  2012 , and client device  2002  determines that the mobile object is present in the environment in which the mobile object can transmit the sensor information to server  2001 , client device  2002  transmits, to server  2001 , the sensor information obtained at the location and the time indicated by the specification information. Consequently, server  2001  can obtain the pieces of sensor information pertaining to the occurrence of the accident from client devices  2002 , and use the pieces of sensor information for accident analysis etc. 
     It should be noted that when client device  2002  receives a sensor information transmission request from server  2001 , client device  2002  may refuse to transmit sensor information. Additionally, client device  2002  may set in advance which pieces of sensor information can be transmitted. Alternatively, server  2001  may inquire of client device  2002  each time whether sensor information can be transmitted. 
     A point may be given to client device  2002  that has transmitted sensor information to server  2001 . This point can be used in payment for, for example, gasoline expenses, electric vehicle (EV) charging expenses, a highway toll, or rental car expenses. After obtaining sensor information, server  2001  may delete information for specifying client device  2002  that has transmitted the sensor information. For example, this information is a network address of client device  2002 . Since this enables the anonymization of sensor information, a user of client device  2002  can securely transmit sensor information from client device  2002  to server  2001 . Server  2001  may include servers. For example, by servers sharing sensor information, even when one of the servers breaks down, the other servers can communicate with client device  2002 . Accordingly, it is possible to avoid service outage due to a server breakdown. 
     A specified location specified by a sensor information transmission request indicates an accident occurrence location etc., and may be different from a position of client device  2002  at a specified time specified by the sensor information transmission request. For this reason, for example, by specifying, as a specified location, a range such as within XX meters of a surrounding area, server  2001  can request information from client device  2002  within the range. Similarly, server  2001  may also specify, as a specified time, a range such as within N seconds before and after a certain time. As a result, server  2001  can obtain sensor information from client device  2002  present for a time from t-N to t+N and in a location within XX meters from absolute position S. When client device  2002  transmits three-dimensional data such as LiDAR, client device  2002  may transmit data created immediately after time t. 
     Server  2001  may separately specify information indicating, as a specified location, a location of client device  2002  from which sensor information is to be obtained, and a location at which sensor information is desirably obtained. For example, server  2001  specifies that sensor information including at least a range within YY meters from absolute position S is to be obtained from client device  2002  present within XX meters from absolute position S. When client device  2002  selects three-dimensional data to be transmitted, client device  2002  selects one or more pieces of three-dimensional data so that the one or more pieces of three-dimensional data include at least the sensor information including the specified range. Each of the one or more pieces of three-dimensional data is a random-accessible unit of data. In addition, when client device  2002  transmits a visible light image, client device  2002  may transmit pieces of temporally continuous image data including at least a frame immediately before or immediately after time t. 
     When client device  2002  can use physical networks such as 5G, Wi-Fi, or modes in 5G for transmitting sensor information, client device  2002  may select a network to be used according to the order of priority notified by server  2001 . Alternatively, client device  2002  may select a network that enables client device  2002  to ensure an appropriate bandwidth based on the size of transmit data. Alternatively, client device  2002  may select a network to be used, based on data transmission expenses etc. A transmission request from server  2001  may include information indicating a transmission deadline, for example, performing transmission when client device  2002  can start transmission by time t. When server  2001  cannot obtain sufficient sensor information within a time limit, server  2001  may issue a transmission request again. 
     Sensor information may include header information indicating characteristics of sensor data along with compressed or uncompressed sensor data. Client device  2002  may transmit header information to server  2001  via a physical network or a communication protocol that is different from a physical network or a communication protocol used for sensor data. For example, client device  2002  transmits header information to server  2001  prior to transmitting sensor data. Server  2001  determines whether to obtain the sensor data of client device  2002 , based on a result of analysis of the header information. For example, header information may include information indicating a point cloud obtainment density, an elevation angle, or a frame rate of LiDAR, or information indicating, for example, a resolution, an SN ratio, or a frame rate of a visible light image. Accordingly, server  2001  can obtain the sensor information from client device  2002  having the sensor data of determined quality. 
     As stated above, client device  2002  is provided in the mobile object, obtains sensor information that has been obtained by a sensor provided in the mobile object and indicates a surrounding state of the mobile object, and stores the sensor information into storage  2012 . Client device  2002  determines whether the mobile object is present in an environment in which the mobile object is capable of transmitting the sensor information to server  2001 , and transmits the sensor information to server  2001  when the mobile object is determined to be present in the environment in which the mobile object is capable of transmitting the sensor information to server  2001 . 
     Additionally, client device  2002  further creates, from the sensor information, three-dimensional data of a surrounding area of the mobile object, and estimates a self-location of the mobile object using the three-dimensional data created. 
     Besides, client device  2002  further transmits a transmission request for a three-dimensional map to server  2001 , and receives the three-dimensional map from server  2001 . In the estimating, client device  2002  estimates the self-location using the three-dimensional data and the three-dimensional map. 
     It should be noted that the above process performed by client device  2002  may be realized as an information transmission method for use in client device  2002 . 
     In addition, client device  2002  may include a processor and memory. Using the memory, the processor may perform the above process. 
     Next, a sensor information collection system according to the present embodiment will be described.  FIG. 21  is a diagram illustrating a configuration of the sensor information collection system according to the present embodiment. As illustrated in  FIG. 21 , the sensor information collection system according to the present embodiment includes terminal  2021 A, terminal  2021 B, communication device  2022 A, communication device  2022 B, network  2023 , data collection server  2024 , map server  2025 , and client device  2026 . It should be noted that when terminal  2021 A and terminal  2021 B are not particularly distinguished, terminal  2021 A and terminal  2021 B are also referred to as terminal  2021 . Additionally, when communication device  2022 A and communication device  2022 B are not particularly distinguished, communication device  2022 A and communication device  2022 B are also referred to as communication device  2022 . 
     Data collection server  2024  collects data such as sensor data obtained by a sensor included in terminal  2021  as position-related data in which the data is associated with a position in a three-dimensional space. 
     Sensor data is data obtained by, for example, detecting a surrounding state of terminal  2021  or an internal state of terminal  2021  using a sensor included in terminal  2021 . Terminal  2021  transmits, to data collection server  2024 , one or more pieces of sensor data collected from one or more sensor devices in locations at which direct communication with terminal  2021  is possible or at which communication with terminal  2021  is possible by the same communication system or via one or more relay devices. 
     Data included in position-related data may include, for example, information indicating an operating state, an operating log, a service use state, etc. of a terminal or a device included in the terminal. In addition, the data include in the position-related data may include, for example, information in which an identifier of terminal  2021  is associated with a position or a movement path etc. of terminal  2021 . 
     Information indicating a position included in position-related data is associated with, for example, information indicating a position in three-dimensional data such as three-dimensional map data. The details of information indicating a position will be described later. 
     Position-related data may include at least one of the above-described time information or information indicating an attribute of data included in the position-related data or a type (e.g., a model number) of a sensor that has created the data, in addition to position information that is information indicating a position. The position information and the time information may be stored in a header area of the position-related data or a header area of a frame that stores the position-related data. Further, the position information and the time information may be transmitted and/or stored as metadata associated with the position-related data, separately from the position-related data. 
     Map server  2025  is connected to, for example, network  2023 , and transmits three-dimensional data such as three-dimensional map data in response to a request from another device such as terminal  2021 . Besides, as described in the aforementioned embodiments, map server  2025  may have, for example, a function of updating three-dimensional data using sensor information transmitted from terminal  2021 . 
     Data collection server  2024  is connected to, for example, network  2023 , collects position-related data from another device such as terminal  2021 , and stores the collected position-related data into a storage of data collection server  2024  or a storage of another server. In addition, data collection server  2024  transmits, for example, metadata of collected position-related data or three-dimensional data generated based on the position-related data, to terminal  2021  in response to a request from terminal  2021 . 
     Network  2023  is, for example, a communication network such as the Internet. Terminal  2021  is connected to network  2023  via communication device  2022 . Communication device  2022  communicates with terminal  2021  using one communication system or switching between communication systems. Communication device  2022  is a communication satellite that performs communication using, for example, (1) a base station compliant with Long-Term Evolution (LTE) etc., (2) an access point (AP) for Wi-Fi or millimeter-wave communication etc., (3) a low-power wide-area (LPWA) network gateway such as SIGFOX, LoRaWAN, or Wi-SUN, or (4) a satellite communication system such as DVB-S2. 
     It should be noted that a base station may communicate with terminal  2021  using a system classified as an LPWA network such as Narrowband Internet of Things (NB IoT) or LTE-M, or switching between these systems. 
     Here, although, in the example given, terminal  2021  has a function of communicating with communication device  2022  that uses two types of communication systems, and communicates with map server  2025  or data collection server  2024  using one of the communication systems or switching between the communication systems and between communication devices  2022  to be a direct communication partner; a configuration of the sensor information collection system and terminal  2021  is not limited to this. For example, terminal  2021  need not have a function of performing communication using communication systems, and may have a function of performing communication using one of the communication systems. Terminal  2021  may also support three or more communication systems. Additionally, each terminal  2021  may support a different communication system. 
     Terminal  2021  includes, for example, the configuration of client device  902  illustrated in  FIG. 11 . Terminal  2021  estimates a self-location etc. using received three-dimensional data. Besides, terminal  2021  associates sensor data obtained from a sensor and position information obtained by self-location estimation to generate position-related data. 
     Position information appended to position-related data indicates, for example, a position in a coordinate system used for three-dimensional data. For example, the position information is coordinate values represented using a value of a latitude and a value of a longitude. Here, terminal  2021  may include, in the position information, a coordinate system serving as a reference for the coordinate values and information indicating three-dimensional data used for location estimation, along with the coordinate values. Coordinate values may also include altitude information. 
     The position information may be associated with a data unit or a space unit usable for encoding the above three-dimensional data. Such a unit is, for example, WLD, GOS, SPC, VLM, or VXL. Here, the position information is represented by, for example, an identifier for identifying a data unit such as the SPC corresponding to position-related data. It should be noted that the position information may include, for example, information indicating three-dimensional data obtained by encoding a three-dimensional space including a data unit such as the SPC or information indicating a detailed position within the SPC, in addition to the identifier for identifying the data unit such as the SPC. The information indicating the three-dimensional data is, for example, a file name of the three-dimensional data. 
     As stated above, by generating position-related data associated with position information based on location estimation using three-dimensional data, the system can give more accurate position information to sensor information than when the system appends position information based on a self-location of a client device (terminal  2021 ) obtained using a GPS to sensor information. As a result, even when another device uses the position-related data in another service, there is a possibility of more accurately determining a position corresponding to the position-related data in an actual space, by performing location estimation based on the same three-dimensional data. 
     It should be noted that although the data transmitted from terminal  2021  is the position-related data in the example given in the present embodiment, the data transmitted from terminal  2021  may be data unassociated with position information. In other words, the transmission and reception of three-dimensional data or sensor data described in the other embodiments may be performed via network  2023  described in the present embodiment. 
     Next, a different example of position information indicating a position in a three-dimensional or two-dimensional actual space or in a map space will be described. The position information appended to position-related data may be information indicating a relative position relative to a keypoint in three-dimensional data. Here, the keypoint serving as a reference for the position information is encoded as, for example, SWLD, and notified to terminal  2021  as three-dimensional data. 
     The information indicating the relative position relative to the keypoint may be, for example, information that is represented by a vector from the keypoint to the point indicated by the position information, and indicates a direction and a distance from the keypoint to the point indicated by the position information. Alternatively, the information indicating the relative position relative to the keypoint may be information indicating an amount of displacement from the keypoint to the point indicated by the position information along each of the x axis, the y axis, and the z axis. Additionally, the information indicating the relative position relative to the keypoint may be information indicating a distance from each of three or more keypoints to the point indicated by the position information. It should be noted that the relative position need not be a relative position of the point indicated by the position information represented using each keypoint as a reference, and may be a relative position of each keypoint represented with respect to the point indicated by the position information. Examples of position information based on a relative position relative to a keypoint include information for identifying a keypoint to be a reference, and information indicating the relative position of the point indicated by the position information and relative to the keypoint. When the information indicating the relative position relative to the keypoint is provided separately from three-dimensional data, the information indicating the relative position relative to the keypoint may include, for example, coordinate axes used in deriving the relative position, information indicating a type of the three-dimensional data, and/or information indicating a magnitude per unit amount (e.g., a scale) of a value of the information indicating the relative position. 
     The position information may include, for each keypoint, information indicating a relative position relative to the keypoint. When the position information is represented by relative positions relative to keypoints, terminal  2021  that intends to identify a position in an actual space indicated by the position information may calculate candidate points of the position indicated by the position information from positions of the keypoints each estimated from sensor data, and may determine that a point obtained by averaging the calculated candidate points is the point indicated by the position information. Since this configuration reduces the effects of errors when the positions of the keypoints are estimated from the sensor data, it is possible to improve the estimation accuracy for the point in the actual space indicated by the position information. Besides, when the position information includes information indicating relative positions relative to keypoints, if it is possible to detect any one of the keypoints regardless of the presence of keypoints undetectable due to a limitation such as a type or performance of a sensor included in terminal  2021 , it is possible to estimate a value of the point indicated by the position information. 
     A point identifiable from sensor data can be used as a keypoint. Examples of the point identifiable from the sensor data include a point or a point within a region that satisfies a predetermined keypoint detection condition, such as the above-described three-dimensional feature or feature of visible light data is greater than or equal to a threshold value. 
     Moreover, a marker etc. placed in an actual space may be used as a keypoint. In this case, the maker may be detected and located from data obtained using a sensor such as LiDER or a camera. For example, the marker may be represented by a change in color or luminance value (degree of reflection), or a three-dimensional shape (e.g., unevenness). Coordinate values indicating a position of the marker, or a two-dimensional bar code or a bar code etc. generated from an identifier of the marker may be also used. 
     Furthermore, a light source that transmits an optical signal may be used as a marker. When a light source of an optical signal is used as a marker, not only information for obtaining a position such as coordinate values or an identifier but also other data may be transmitted using an optical signal. For example, an optical signal may include contents of service corresponding to the position of the marker, an address for obtaining contents such as a URL, or an identifier of a wireless communication device for receiving service, and information indicating a wireless communication system etc. for connecting to the wireless communication device. The use of an optical communication device (a light source) as a marker not only facilitates the transmission of data other than information indicating a position but also makes it possible to dynamically change the data. 
     Terminal  2021  finds out a correspondence relationship of keypoints between mutually different data using, for example, a common identifier used for the data, or information or a table indicating the correspondence relationship of the keypoints between the data. When there is no information indicating a correspondence relationship between keypoints, terminal  2021  may also determine that when coordinates of a keypoint in three-dimensional data are converted into a position in a space of another three-dimensional data, a keypoint closest to the position is a corresponding keypoint. 
     When the position information based on the relative position described above is used, terminal  2021  that uses mutually different three-dimensional data or services can identify or estimate a position indicated by the position information with respect to a common keypoint included in or associated with each three-dimensional data. As a result, terminal  2021  that uses the mutually different three-dimensional data or the services can identify or estimate the same position with higher accuracy. 
     Even when map data or three-dimensional data represented using mutually different coordinate systems are used, since it is possible to reduce the effects of errors caused by the conversion of a coordinate system, it is possible to coordinate services based on more accurate position information. 
     Hereinafter, an example of functions provided by data collection server  2024  will be described. Data collection server  2024  may transfer received position-related data to another data server. When there are data servers, data collection server  2024  determines to which data server received position-related data is to be transferred, and transfers the position-related data to a data server determined as a transfer destination. 
     Data collection server  2024  determines a transfer destination based on, for example, transfer destination server determination rules preset to data collection server  2024 . The transfer destination server determination rules are set by, for example, a transfer destination table in which identifiers respectively associated with terminals  2021  are associated with transfer destination data servers. 
     Terminal  2021  appends an identifier associated with terminal  2021  to position-related data to be transmitted, and transmits the position-related data to data collection server  2024 . Data collection server  2024  determines a transfer destination data server corresponding to the identifier appended to the position-related data, based on the transfer destination server determination rules set out using the transfer destination table etc.; and transmits the position-related data to the determined data server. The transfer destination server determination rules may be specified based on a determination condition set using a time, a place, etc. at which position-related data is obtained. Here, examples of the identifier associated with transmission source terminal  2021  include an identifier unique to each terminal  2021  or an identifier indicating a group to which terminal  2021  belongs. 
     The transfer destination table need not be a table in which identifiers associated with transmission source terminals are directly associated with transfer destination data servers. For example, data collection server  2024  holds a management table that stores tag information assigned to each identifier unique to terminal  2021 , and a transfer destination table in which the pieces of tag information are associated with transfer destination data servers. Data collection server  2024  may determine a transfer destination data server based on tag information, using the management table and the transfer destination table. Here, the tag information is, for example, control information for management or control information for providing service assigned to a type, a model number, an owner of terminal  2021  corresponding to the identifier, a group to which terminal  2021  belongs, or another identifier. Moreover, in the transfer destination able, identifiers unique to respective sensors may be used instead of the identifiers associated with transmission source terminals  2021 . Furthermore, the transfer destination server determination rules may be set by client device  2026 . 
     Data collection server  2024  may determine data servers as transfer destinations, and transfer received position-related data to the data servers. According to this configuration, for example, when position-related data is automatically backed up or when, in order that position-related data is commonly used by different services, there is a need to transmit the position-related data to a data server for providing each service, it is possible to achieve data transfer as intended by changing a setting of data collection server  2024 . As a result, it is possible to reduce the number of steps necessary for building and changing a system, compared to when a transmission destination of position-related data is set for each terminal  2021 . 
     Data collection server  2024  may register, as a new transfer destination, a data server specified by a transfer request signal received from a data server; and transmit position-related data subsequently received to the data server, in response to the transfer request signal. 
     Data collection server  2024  may store position-related data received from terminal  2021  into a recording device, and transmit position-related data specified by a transmission request signal received from terminal  2021  or a data server to request source terminal  2021  or the data server in response to the transmission request signal. 
     Data collection server  2024  may determine whether position-related data is suppliable to a request source data server or terminal  2021 , and transfer or transmit the position-related data to the request source data server or terminal  2021  when determining that the position-related data is suppliable. 
     When data collection server  2024  receives a request for current position-related data from client device  2026 , even if it is not a timing for transmitting position-related data by terminal  2021 , data collection server  2024  may send a transmission request for the current position-related data to terminal  2021 , and terminal  2021  may transmit the current position-related data in response to the transmission request. 
     Although terminal  2021  transmits position information data to data collection server  2024  in the above description, data collection server  2024  may have a function of managing terminal  2021  such as a function necessary for collecting position-related data from terminal  2021  or a function used when collecting position-related data from terminal  2021 . 
     Data collection server  2024  may have a function of transmitting, to terminal  2021 , a data request signal for requesting transmission of position information data, and collecting position-related data. 
     Management information such as an address for communicating with terminal  2021  from which data is to be collected or an identifier unique to terminal  2021  is registered in advance in data collection server  2024 . Data collection server  2024  collects position-related data from terminal  2021  based on the registered management information. Management information may include information such as types of sensors included in terminal  2021 , the number of sensors included in terminal  2021 , and communication systems supported by terminal  2021 . 
     Data collection server  2024  may collect information such as an operating state or a current position of terminal  2021  from terminal  2021 . 
     Registration of management information may be instructed by client device  2026 , or a process for the registration may be started by terminal  2021  transmitting a registration request to data collection server  2024 . Data collection server  2024  may have a function of controlling communication between data collection server  2024  and terminal  2021 . 
     Communication between data collection server  2024  and terminal  2021  may be established using a dedicated line provided by a service provider such as a mobile network operator (MNO) or a mobile virtual network operator (MVNO), or a virtual dedicated line based on a virtual private network (VPN). According to this configuration, it is possible to perform secure communication between terminal  2021  and data collection server  2024 . 
     Data collection server  2024  may have a function of authenticating terminal  2021  or a function of encrypting data to be transmitted and received between data collection server  2024  and terminal  2021 . Here, the authentication of terminal  2021  or the encryption of data is performed using, for example, an identifier unique to terminal  2021  or an identifier unique to a terminal group including terminals  2021 , which is shared in advance between data collection server  2024  and terminal  2021 . Examples of the identifier include an international mobile subscriber identity (IMSI) that is a unique number stored in a subscriber identity module (SIM) card. An identifier for use in authentication and an identifier for use in encryption of data may be identical or different. 
     The authentication or the encryption of data between data collection server  2024  and terminal  2021  is feasible when both data collection server  2024  and terminal  2021  have a function of performing the process. The process does not depend on a communication system used by communication device  2022  that performs relay. Accordingly, since it is possible to perform the common authentication or encryption without considering whether terminal  2021  uses a communication system, the user&#39;s convenience of system architecture is increased. However, the expression “does not depend on a communication system used by communication device  2022  that performs relay” means a change according to a communication system is not essential. In other words, in order to improve the transfer efficiency or ensure security, the authentication or the encryption of data between data collection server  2024  and terminal  2021  may be changed according to a communication system used by a relay device. 
     Data collection server  2024  may provide client device  2026  with a User Interface (UI) that manages data collection rules such as types of position-related data collected from terminal  2021  and data collection schedules. Accordingly, a user can specify, for example, terminal  2021  from which data is to be collected using client device  2026 , a data collection time, and a data collection frequency. Additionally, data collection server  2024  may specify, for example, a region on a map from which data is to be desirably collected, and collect position-related data from terminal  2021  included in the region. 
     When the data collection rules are managed on a per terminal  2021  basis, client device  2026  presents, on a screen, a list of terminals  2021  or sensors to be managed. The user sets, for example, a necessity for data collection or a collection schedule for each item in the list. 
     When a region on a map from which data is to be desirably collected is specified, client device  2026  presents, on a screen, a two-dimensional or three-dimensional map of a region to be managed. The user selects the region from which data is to be collected on the displayed map. Examples of the region selected on the map include a circular or rectangular region having a point specified on the map as the center, or a circular or rectangular region specifiable by a drag operation. Client device  2026  may also select a region in a preset unit such as a city, an area or a block in a city, or a main road, etc. Instead of specifying a region using a map, a region may be set by inputting values of a latitude and a longitude, or a region may be selected from a list of candidate regions derived based on inputted text information. Text information is, for example, a name of a region, a city, or a landmark. 
     Moreover, data may be collected while the user dynamically changes a specified region by specifying one or more terminals  2021  and setting a condition such as within 100 meters of one or more terminals  2021 . 
     When client device  2026  includes a sensor such as a camera, a region on a map may be specified based on a position of client device  2026  in an actual space obtained from sensor data. For example, client device  2026  may estimate a self-location using sensor data, and specify, as a region from which data is to be collected, a region within a predetermined distance from a point on a map corresponding to the estimated location or a region within a distance specified by the user. Client device  2026  may also specify, as the region from which the data is to be collected, a sensing region of the sensor, that is, a region corresponding to obtained sensor data. Alternatively, client device  2026  may specify, as the region from which the data is to be collected, a region based on a location corresponding to sensor data specified by the user. Either client device  2026  or data collection server  2024  may estimate a region on a map or a location corresponding to sensor data. 
     When a region on a map is specified, data collection server  2024  may specify terminal  2021  within the specified region by collecting current position information of each terminal  2021 , and may send a transmission request for position-related data to specified terminal  2021 . When data collection server  2024  transmits information indicating a specified region to terminal  2021 , determines whether terminal  2021  is present within the specified region, and determines that terminal  2021  is present within the specified region, rather than specifying terminal  2021  within the region, terminal  2021  may transmit position-related data. 
     Data collection server  2024  transmits, to client device  2026 , data such as a list or a map for providing the above-described User Interface (UI) in an application executed by client device  2026 . Data collection server  2024  may transmit, to client device  2026 , not only the data such as the list or the map but also an application program. Additionally, the above UI may be provided as contents created using HTML displayable by a browser. It should be noted that part of data such as map data may be supplied from a server, such as map server  2025 , other than data collection server  2024 . 
     When client device  2026  receives an input for notifying the completion of an input such as pressing of a setup key by the user, client device  2026  transmits the inputted information as configuration information to data collection server  2024 . Data collection server  2024  transmits, to each terminal  2021 , a signal for requesting position-related data or notifying position-related data collection rules, based on the configuration information received from client device  2026 , and collects the position-related data. 
     Next, an example of controlling operation of terminal  2021  based on additional information added to three-dimensional or two-dimensional map data will be described. 
     In the present configuration, object information that indicates a position of a power feeding part such as a feeder antenna or a feeder coil for wireless power feeding buried under a road or a parking lot is included in or associated with three-dimensional data, and such object information is provided to terminal  2021  that is a vehicle or a drone. 
     A vehicle or a drone that has obtained the object information to get charged automatically moves so that a position of a charging part such as a charging antenna or a charging coil included in the vehicle or the drone becomes opposite to a region indicated by the object information, and such vehicle or a drone starts to charge itself. It should be noted that when a vehicle or a drone has no automatic driving function, a direction to move in or an operation to perform is presented to a driver or an operator by using an image displayed on a screen, audio, etc. When a position of a charging part calculated based on an estimated self-location is determined to fall within the region indicated by the object information or a predetermined distance from the region, an image or audio to be presented is changed to a content that puts a stop to driving or operating, and the charging is started. 
     Object information need not be information indicating a position of a power feeding part, and may be information indicating a region within which placement of a charging part results in a charging efficiency greater than or equal to a predetermined threshold value. A position indicated by object information may be represented by, for example, the central point of a region indicated by the object information, a region or a line within a two-dimensional plane, or a region, a line, or a plane within a three-dimensional space. 
     According to this configuration, since it is possible to identify the position of the power feeding antenna unidentifiable by sensing data of LiDER or an image captured by the camera, it is possible to highly accurately align a wireless charging antenna included in terminal  2021  such as a vehicle with a wireless power feeding antenna buried under a road. As a result, it is possible to increase a charging speed at the time of wireless charging and improve the charging efficiency. 
     Object information may be an object other than a power feeding antenna. For example, three-dimensional data includes, for example, a position of an AP for millimeter-wave wireless communication as object information. Accordingly, since terminal  2021  can identify the position of the AP in advance, terminal  2021  can steer a directivity of beam to a direction of the object information and start communication. As a result, it is possible to improve communication quality such as increasing transmission rates, reducing the duration of time before starting communication, and extending a communicable period. 
     Object information may include information indicating a type of an object corresponding to the object information. In addition, when terminal  2021  is present within a region in an actual space corresponding to a position in three-dimensional data of the object information or within a predetermined distance from the region, the object information may include information indicating a process to be performed by terminal  2021 . 
     Object information may be provided by a server different from a server that provides three-dimensional data. When object information is provided separately from three-dimensional data, object groups in which object information used by the same service is stored may be each provided as separate data according to a type of a target service or a target device. 
     Three-dimensional data used in combination with object information may be point cloud data of WLD or keypoint data of SWLD. 
     Embodiment 6 
     Hereinafter, a scan order of an octree representation and voxels will be described. A volume is encoded after being converted into an octree structure (made into an octree). The octree structure includes nodes and leaves. Each node has eight nodes or leaves, and each leaf has voxel (VXL) information.  FIG. 22  is a diagram showing an example structure of a volume including voxels.  FIG. 23  is a diagram showing an example of the volume shown in  FIG. 22  having been converted into the octree structure. Among the leaves shown in  FIG. 23 , leaves 1, 2, and 3 respectively represent VXL 1, VXL 2, and VXL 3, and represent VXLs including a point group (hereinafter, active VXLs). 
     An octree is represented by, for example, binary sequences of 1s and 0s. For example, when giving the nodes or the active VXLs a value of 1 and everything else a value of 0, each node and leaf is assigned with the binary sequence shown in  FIG. 23 . Thus, this binary sequence is scanned in accordance with a breadth-first or a depth-first scan order. For example, when scanning breadth-first, the binary sequence shown in A of  FIG. 24  is obtained. When scanning depth-first, the binary sequence shown in B of  FIG. 24  is obtained. The binary sequences obtained through this scanning are encoded through entropy encoding, which reduces an amount of information. 
     Depth information in the octree representation will be described next. Depth in the octree representation is used in order to control up to how fine a granularity point cloud information included in a volume is stored. Upon setting a great depth, it is possible to reproduce the point cloud information to a more precise level, but an amount of data for representing the nodes and leaves increases. Upon setting a small depth, however, the amount of data decreases, but some information that the point cloud information originally held is lost, since pieces of point cloud information including different positions and different colors are now considered as pieces of point cloud information including the same position and the same color. 
     For example,  FIG. 25  is a diagram showing an example in which the octree with a depth of 2 shown in  FIG. 23  is represented with a depth of 1. The octree shown in  FIG. 25  has a lower amount of data than the octree shown in  FIG. 23 . In other words, the binarized octree shown in  FIG. 25  has a lower bit count than the octree shown in  FIG. 23 . Leaf 1 and leaf 2 shown in  FIG. 23  are represented by leaf 1 shown in  FIG. 24 . In other words, the information on leaf 1 and leaf 2 being in different positions is lost. 
       FIG. 26  is a diagram showing a volume corresponding to the octree shown in  FIG. 25 . VXL 1 and VXL 2 shown in  FIG. 22  correspond to VXL 12 shown in  FIG. 26 . In this case, the three-dimensional data encoding device generates color information of VXL 12 shown in  FIG. 26  using color information of VXL 1 and VXL 2 shown in  FIG. 22 . For example, the three-dimensional data encoding device calculates an average value, a median, a weighted average value, or the like of the color information of VXL 1 and VXL 2 as the color information of VXL 12. In this manner, the three-dimensional data encoding device may control a reduction of the amount of data by changing the depth of the octree. 
     The three-dimensional data encoding device may set the depth information of the octree to units of worlds, units of spaces, or units of volumes. In this case, the three-dimensional data encoding device may append the depth information to header information of the world, header information of the space, or header information of the volume. In all worlds, spaces, and volumes associated with different times, the same value may be used as the depth information. In this case, the three-dimensional data encoding device may append the depth information to header information managing the worlds associated with all times. 
     Embodiment 7 
     Hereinafter, a method using a RAHT (Region Adaptive Hierarchical Transform) will be described as another method of encoding the attribute information of a three-dimensional point.  FIG. 27  is a diagram for describing the encoding of the attribute information by using a RAHT. 
     First, the three-dimensional data encoding device generates Morton codes based on the geometry information of three-dimensional points, and sorts the attribute information of the three-dimensional points in the order of the Morton codes. For example, the three-dimensional data encoding device may perform sorting in the ascending order of the Morton codes. Note that the sorting order is not limited to the order of the Morton codes, and other orders may be used. 
     Next, the three-dimensional data encoding device generates a high-frequency component and a low-frequency component of the layer L by applying the Haar conversion to the attribute information of two adjacent three-dimensional points in the order of the Morton codes. For example, the three-dimensional data encoding device may use the Haar conversion of 2×2 matrices. The generated high-frequency component is included in a coding coefficient as the high-frequency component of the layer L, and the generated low-frequency component is used as the input value for the higher layer L+1 of the layer L. 
     After generating the high-frequency component of the layer L by using the attribute information of the layer L, the three-dimensional data encoding device subsequently performs processing of the layer L+1. In the processing of the layer L+1, the three-dimensional data encoding device generates a high-frequency component and a low-frequency component of the layer L+1 by applying the Haar conversion to two low-frequency components obtained by the Haar conversion of the attribute information of the layer L. The generated high-frequency component is included in a coding coefficient as the high-frequency component of the layer L+1, and the generated low-frequency component is used as the input value for the higher layer L+2 of the layer L+1. 
     The three-dimensional data encoding device repeats such layer processing, and determines that the highest layer Lmax has been reached at the time when a low-frequency component that is input to a layer becomes one. The three-dimensional data encoding device includes the low-frequency component of the layer Lmax−1 that is input to the Layer Lmax in a coding coefficient. Then, the value of the low-frequency component or high-frequency component included in the coding coefficient is quantized, and is encoded by using entropy encoding or the like. 
     Note that, when only one three-dimensional point exists as two adjacent three-dimensional points at the time of application of the Haar conversion, the three-dimensional data encoding device may use the value of the attribute information of the existing one three-dimensional point as the input value for a higher layer. 
     In this manner, the three-dimensional data encoding device hierarchically applies the Haar conversion to the input attribute information, generates a high-frequency component and a low-frequency component of the attribute information, and performs encoding by applying quantization described later or the like. Accordingly, the coding efficiency can be improved. 
     When the attribute information is N dimensional, the three-dimensional data encoding device may independently apply the Haar conversion for each dimension, and may calculate each coding coefficient. For example, when the attribute information is color information (RGB, YUV, or the like), the three-dimensional data encoding device applies the Haar conversion for each component, and calculates each coding coefficient. 
     The three-dimensional data encoding device may apply the Haar conversion in the order of the layers L, L+1, . . . , Lmax. The closer to the layer Lmax, a coding coefficient including the more low-frequency components of the input attribute information is generated. 
     w0 and w1 shown in  FIG. 27  are the weights assigned to each three-dimensional point. For example, the three-dimensional data encoding device may calculate the weight based on the distance information between two adjacent three-dimensional points to which the Haar conversion is applied, or the like. For example, the three-dimensional data encoding device may improve the coding efficiency such that the closer the distance, the greater the weight. Note that the three-dimensional data encoding device may calculate this weight with another technique, or need not use the weight. 
     In the example shown in  FIG. 27 , the pieces of the input attribute information are a0, a1, a2, a3, a4, and a5. Additionally, Ta1, Ta5, Tb1, Tb3, Tc1, and d0 are encoded among the coding coefficients after the Haar conversion. The other coding coefficients (b0, b2, bc0 and the like) are medians, and are not encoded. 
     Specifically, in the example shown in  FIG. 27 , the high-frequency component Ta1 and the low-frequency component b0 are generated by performing the Haar conversion on a0 and a1. Here, when the weights w0 and w1 are equal, the low-frequency component b0 is the average value of a0 and a1, and the high-frequency component Ta1 is the difference between a0 and a1. 
     Since there is no attribute information to be paired with a2, a2 is used as b1 as is. Similarly, since there is no attribute information to be paired with a3, a3 is used as b2 as is. Additionally, the high-frequency component Ta5 and the low-frequency component b3 are generated by performing the Haar conversion on a4 and a5. 
     In the layer L+1, the high-frequency component Tb1 and the low-frequency component c0 are generated by performing the Haar conversion on b0 and b1. Similarly, the high-frequency component Tb3 and the low-frequency component c1 are generated by performing the Haar conversion on b2 and b3. 
     In the layer Lmax−1, the High-frequency component Tc1 and the low-frequency component d0 are generated by performing the Haar conversion on c0 and c1. 
     The three-dimensional data encoding device may encode the coding coefficients to which the Haar conversion has been applied, after quantizing the coding coefficients. For example, the three-dimensional data encoding device performs quantization by dividing the coding coefficient by the quantization scale (also called the quantization step (QS)). In this case, the smaller the quantization scale, the smaller the error (quantization error) that may occur due to quantization. Conversely, the larger the quantization scale, the larger the quantization error. 
     Note that the three-dimensional data encoding device may change the value of the quantization scale for each layer.  FIG. 28  is a diagram showing an example of setting the quantization scale for each layer. For example, the three-dimensional data encoding device sets smaller quantization scales to the higher layers, and larger quantization scales to the lower layers. Since the coding coefficients of the three-dimensional points belonging to the higher layers include more low-frequency components than the lower layers, there is a high possibility that the coding coefficients are important components in human visual characteristics and the like. Therefore, by suppressing the quantization error that may occur in the higher layers by making the quantization scales for the higher layers small, visual deterioration can be suppressed, and the coding efficiency can be improved. 
     Note that the three-dimensional data encoding device may add the quantization scale for each layer to a header or the like. Accordingly, the three-dimensional decoding device can correctly decode the quantization scale, and can appropriately decode a bitstream. 
     Additionally, the three-dimensional data encoding device may adaptively switch the value of the quantization scale according to the importance of a current three-dimensional point to be encoded. For example, the three-dimensional data encoding device uses a small quantization scale for a three-dimensional point with high importance, and uses a large quantization scale for a three-dimensional point with low importance. For example, the three-dimensional data encoding device may calculate the importance from the weight at the time of the Haar conversion, or the like. For example, the three-dimensional data encoding device may calculate the quantization scale by using the sum of w0 and w1. In this manner, by making the quantization scale of a three-dimensional point with high importance small, the quantization error becomes small, and the coding efficiency can be improved. 
     Additionally, the value of the QS may be made smaller for the higher layers. Accordingly, the higher the layer, the larger the value of the QW, and the prediction efficiency can be improved by suppressing the quantization error of the three-dimensional point. 
     Here, a coding coefficient Ta1q after quantization of the coding coefficient Ta1 of the attribute information a1 is represented by Ta1/QS_L. Note that QS may be the same value in all the layers or a part of the layers. The QW (Quantization Weight) is the value that represents the importance of a current three-dimensional point to be encoded. For example, the above-described sum of w0 and w1 may be used as the QW. Accordingly, the higher the layer, the larger the value of the QW, and the prediction efficiency can be improved by suppressing the quantization error of the three-dimensional point. 
     For example, the three-dimensional data encoding device may first initialize the values of the QWs of all the three-dimensional points with  1 , and may update the QW of each three-dimensional point by using the values of w0 and w1 at the time of the Haar conversion. Alternatively, the three-dimensional data encoding device may change the initial value according to the layers, without initializing the values of the QWs of all the three-dimensional points with a value of 1. For example, the quantization scales for the higher layers becomes small by setting larger QW initial values for the higher layers. Accordingly, since the prediction error in the higher layers can be suppressed, the prediction accuracy of the lower layers can be increased, and the coding efficiency can be improved. Note that the three-dimensional data encoding device need not necessarily use the QW. 
     When using the QW, the quantized value Ta1q of Ta1 is calculated by (Equation K1) and (Equation K2). 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               1 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   
                     Ta 
                     ⁢ 
                     1 
                     ⁢ 
                     q 
                   
                   = 
                   
                     
                       
                         
                           Ta 
                           ⁢ 
                           1 
                         
                         + 
                         
                           
                             QS 
                             ⁢ 
                             _ 
                             ⁢ 
                             L 
                           
                           2 
                         
                       
                       
                         OS_LoD 
                         ⁢ 
                         1 
                       
                     
                     × 
                     
                       QWTa 
                       ⁢ 
                       1 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     K1 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     QWTa 
                     ⁢ 
                     1 
                   
                   = 
                   
                     1 
                     + 
                     
                       
                         ∑ 
                         
                           i 
                           = 
                           0 
                         
                         1 
                       
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       
                         w 
                         i 
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     K2 
                   
                   ) 
                 
               
             
           
         
       
     
     Additionally, the three-dimensional data encoding device scans and encodes the coding coefficients (unsigned integer values) after quantization in a certain order. For example, the three-dimensional data encoding device encodes a plurality of three-dimensional points from the three-dimensional points included in the higher layers toward the lower layers in order. 
     For example, in the example shown in  FIG. 27 , the three-dimensional data encoding device encodes a plurality of three-dimensional points in the order of Tc1q Tb1q, Tb3q, Ta1q, and Ta5q from d0q included in the higher layer Lmax. Here, there is a tendency that the lower the layer L, the more likely it is that the coding coefficient after quantization becomes 0. This can be due to the following and the like. 
     Since the coding coefficient of the lower layer L shows a higher frequency component than the higher layers, there is a tendency that the coding coefficient becomes 0 depending on a current three-dimensional point. Additionally, by switching the quantization scale according to the above-described importance or the like, the lower the layer, the larger the quantization scales, and the more likely it is that the coding coefficient after quantization becomes 0. 
     In this manner, the lower the layer, the more likely it is that the coding coefficient after quantization becomes 0, and the value 0 consecutively occurs in the first code sequence.  FIG. 29  is a diagram showing an example of the first code sequence and the second code sequence. 
     The three-dimensional data encoding device counts the number of times that the value 0 occurs in the first code sequence, and encodes the number of times that the value 0 consecutively occurs, instead of the consecutive values 0. That is, the three-dimensional data encoding device generates a second code sequence by replacing the coding coefficient of the consecutive values 0 in the first code sequence with the number of consecutive times (ZeroCnt) of 0. Accordingly, when there are consecutive values 0 of the coding coefficients after quantization, the coding efficiency can be improved by encoding the number of consecutive times of 0, rather than encoding a lot of 0s. 
     Additionally, the three-dimensional data encoding device may entropy encode the value of ZeroCnt. For example, the three-dimensional data encoding device binarizes the value of ZeroCnt with the truncated unary code of the total number T of the encoded three-dimensional points, and arithmetically encodes each bit after the binarization.  FIG. 30  is a diagram showing an example of the truncated unary code in the case where the total number of encoded three-dimensional points is T. At this time, the three-dimensional data encoding device may improve the coding efficiency by using a different coding table for each bit. For example, the three-dimensional data encoding device uses coding table 1 for the first bit, uses coding table 2 for the second bit, and coding table 3 for the subsequent bits. In this manner, the three-dimensional data encoding device can improve the coding efficiency by switching the coding table for each bit. 
     Additionally, the three-dimensional data encoding device may arithmetically encode ZeroCnt after binarizing ZeroCnt with an Exponential-Golomb. Accordingly, when the value of ZeroCnt easily becomes large, the efficiency can be more improved than the binarized arithmetic encoding with the truncated unary code. Note that the three-dimensional data encoding device may add a flag for switching between using the truncated unary code and using the Exponential-Golomb to a header. Accordingly, the three-dimensional data encoding device can improve the coding efficiency by selecting the optimum binarization method. Additionally, the three-dimensional data decoding device can correctly decode a bitstream by referring to the flag included in the header to switch the binarization method. 
     The three-dimensional decoding device may convert the decoded coding coefficient after the quantization from an unsigned integer value to a signed integer value with a method contrary to the method performed by the three-dimensional data encoding device. Accordingly, when the coding coefficient is entropy encoded, the three-dimensional decoding device can appropriately decode a bitstream generated without considering the occurrence of a negative integer. Note that the three-dimensional decoding device does not necessarily need to convert the coding coefficient from an unsigned integer value to a signed integer value. For example, when decoding a bitstream including an encoded bit that has been separately entropy encoded, the three-dimensional decoding device may decode the sign bit. 
     The three-dimensional decoding device decodes the coding coefficient after the quantization converted to the signed integer value, by the inverse quantization and the inverse Haar conversion. Additionally, the three-dimensional decoding device utilizes the coding coefficient after the decoding for the prediction after the current three-dimensional point to be decoded. Specifically, the three-dimensional decoding device calculates the inverse quantized value by multiplying the coding coefficient after the quantization by the decoded quantization scale. Next, the three-dimensional decoding device obtains the decoded value by applying the inverse Haar conversion described later to the inverse quantized value. 
     For example, the three-dimensional decoding device converts the decoded unsigned integer value to a signed integer value with the following method. When the LSB (least significant bit) of the decoded unsigned integer value a2u is 1, the signed integer value Ta1q is set to −((a2u+1)&gt;&gt;1). When the LSB of the decoded unsigned integer value a2u is not 1 (when it is 0), the signed integer value Ta1q is set to (a2u&gt;&gt;1). 
     Additionally, the inverse quantized value of Ta1 is represented by Ta1q×QS_L. Here, Ta1q is the quantized value of Ta1. In addition, QS_L is the quantization step for the layer L. 
     Additionally, the QS may be the same value for all the layers or a part of the layers. In addition, the three-dimensional data encoding device may add the information indicating the QS to a header or the like. Accordingly, the three-dimensional decoding device can correctly perform inverse quantization by using the same QS as the QS used by the three-dimensional data encoding device. 
     Next, the inverse Haar conversion will be described.  FIG. 31  is a diagram for describing the inverse Haar conversion. The three-dimensional decoding device decodes the attribute value of a three-dimensional point by applying the inverse Haar conversion to the coding coefficient after the inverse quantization. 
     First, the three-dimensional decoding device generates the Morton codes based on the geometry information of three-dimensional points, and sorts the three-dimensional points in the order of the Morton codes. For example, the three-dimensional decoding device may perform the sorting in ascending order of the Morton codes. Note that the sorting order is not limited to the order of the Morton codes, and the other order may be used. 
     Next, the three-dimensional decoding device restores the attribute information of three-dimensional points that are adjacent to each other in the order of the Morton codes in the layer L, by applying the inverse Haar conversion to the coding coefficient including the low-frequency component of the layer L+1, and the coding coefficient including the high-frequency component of the layer L. For example, the three-dimensional decoding device may use the inverse Haar conversion of a 2×2 matrix. The attribute information of the restored layer L is used as the input value for the lower layer L−1. 
     The three-dimensional decoding device repeats such layer processing, and ends the processing when all the attribute information of the bottom layer is decoded. Note that, when only one three-dimensional point exists as two three-dimensional points that are adjacent to each other in the layer L−1 at the time of application of the inverse Haar conversion, the three-dimensional decoding device may assign the value of the encoding component of the layer L to the attribute value of the one existing three-dimensional point. Accordingly, the three-dimensional decoding device can correctly decode a bitstream with improved coding efficiency by applying the Haar conversion to all the values of the input attribute information. 
     When the attribute information is N dimensional, the three-dimensional decoding device may independently apply the inverse Haar conversion for each dimension, and may decode each coding coefficient. For example, when the attribute information is color information (RGB, YUV, or the like), the three-dimensional data decoding device applies the inverse Haar conversion to the coding coefficient for each component, and decodes each attribute value. 
     The three-dimensional decoding device may apply the inverse Haar conversion in the order of Layers Lmax, L+1, . . . , L. Additionally, w0 and w1 shown in  FIG. 31  are the weights assigned to each three-dimensional point. For example, the three-dimensional data decoding device may calculate the weight based on the distance information between two adjacent three-dimensional points to which the inverse Haar conversion is applied, or the like. For example, the three-dimensional data encoding device may decode a bitstream with improved coding efficiency such that the closer the distance, the greater the weight. 
     In the example shown in  FIG. 31 , the coding coefficients after the inverse quantization are Ta1, Ta5, Tb1, Tb3, Tc1, and d0, and a0, a1, a2, a3, a4, and a5 are obtained as the decoded values. 
       FIG. 32  is a diagram showing a syntax example of the attribute information (attribute_data). The attribute information (attribute_data) includes the number of consecutive zeros (ZeroCnt), the number of attribute dimensions (attribute_dimension), and the coding coefficient (value [j] [i]). 
     The number of consecutive zeros (ZeroCnt) indicates the number of times that the value 0 continues in the coding coefficient after quantization. Note that the three-dimensional data encoding device may arithmetically encode ZeroCnt after binarizing ZeroCnt. 
     Additionally, as shown in  FIG. 32 , the three-dimensional data encoding device may determine whether or not the layer L (layerL) to which the coding coefficient belongs is equal to or more than a predefined threshold value TH_layer, and may switch the information added to a bitstream according to the determination result. For example, when the determination result is true, the three-dimensional data encoding device adds all the coding coefficients of the attribute information to a bitstream. In addition, when the determination result is false, the three-dimensional data encoding device may add a part of the coding coefficients to a bitstream. 
     Specifically, when the determination result is true, the three-dimensional data encoding device adds the encoded result of the three-dimensional information of the color information RGB or YUV to a bitstream. When the determination result is false, the three-dimensional data encoding device may add a part of information such as G or Y of the color information to a bitstream, and need not to add the other components to the bitstream. In this manner, the three-dimensional data encoding device can improve the coding efficiency by not adding a part of the coding coefficients of the layer (the layer smaller than TH_layer) including the coding coefficients indicating the high-frequency component with less visually noticeable degradation to a bitstream. 
     The number of attribute dimensions (attribute_dimension) indicates the number of dimensions of the attribute information. For example, when the attribute information is the color information (RGB, YUV, or the like) of a three-dimensional point, since the color information is three-dimensional, the number of attribute dimensions is set to a value 3. When the attribute information is the reflectance, since the reflectance is one-dimensional, the number of attribute dimensions is set to a value 1. Note that the number of attribute dimensions may be added to the header of the attribute information of a bit stream or the like. 
     The coding coefficient (value [j] [i]) indicates the coding coefficient after quantization of the attribute information of the j-th dimension of the i-th three-dimensional point. For example, when the attribute information is color information, value [99] [1] indicates the coding coefficient of the second dimension (for example, the G value) of the 100th three-dimensional point. Additionally, when the attribute information is reflectance information, value [119] [0] indicates the coding coefficient of the first dimension (for example, the reflectance) of the 120th three-dimensional point. 
     Note that, when the following conditions are satisfied, the three-dimensional data encoding device may subtract the value 1 from value [j] Lit and may entropy encode the obtained value. In this case, the three-dimensional data decoding device restores the coding coefficient by adding the value 1 to value W [i] after entropy decoding. 
     The above-described conditions are (1) when attribute_dimension=1, or (2) when attribute_dimension is 1 or more, and when the values of all the dimensions are equal. For example, when the attribute information is the reflectance, since attribute_dimension=1, the three-dimensional data encoding device subtracts the value 1 from the coding coefficient to calculate value, and encodes the calculated value. The three-dimensional decoding device calculates the coding coefficient by adding the value 1 to the value after decoding. 
     More specifically, for example, when the coding coefficient of the reflectance is 10, the three-dimensional data encoding device encodes the value 9 obtained by subtracting the value 1 from the value 10 of the coding coefficient. The three-dimensional data decoding device adds the value 1 to the decoded value 9 to calculate the value 10 of the coding coefficient. 
     Additionally, since attribute_dimension=3 when the attribute information is the color, for example, when the coding coefficient after quantization of each of the components R, G, and B is the same, the three-dimensional data encoding device subtracts the value 1 from each coding coefficient, and encodes the obtained value. The three-dimensional data decoding device adds the value 1 to the value after decoding. More specifically, for example, when the coding coefficient of R, G, and B=(1, 1, 1), the three-dimensional data encoding device encodes (0, 0, 0). The three-dimensional data decoding device adds 1 to each component of (0, 0, 0) to calculate (1, 1, 1). Additionally, when the coding coefficients of R, G, and B=(2, 1, 2), the three-dimensional data encoding device encodes (2, 1, 2) as is. The three-dimensional data decoding device uses the decoded (2, 1, 2) as is as the coding coefficients. 
     In this manner, by providing ZeroCnt, since the pattern in which all the dimensions are 0 as value is not generated, the value obtained by subtracting 1 from the value indicated by value can be encoded. Therefore, the coding efficiency can be improved. 
     Additionally, value [0] [i] shown in  FIG. 32  indicates the coding coefficient after quantization of the attribute information of the first dimension of the i-th three-dimensional point. As shown in  FIG. 32 , when the layer L (layerL) to which the coding coefficient belongs is smaller than the threshold value TH_layer, the code amount may be reduced by adding the attribute information of the first dimension to a bitstream (not adding the attribute information of the second and following dimensions to the bitstream). 
     The three-dimensional data encoding device may switch the calculation method of the value of ZeroCnt depending on the value of attribute_dimension. For example, when attribute_dimension=3, the three-dimensional data encoding device may count the number of times that the values of the coding coefficients of all the components (dimensions) become 0.  FIG. 33  is a diagram showing an example of the coding coefficient and ZeroCnt in this case. For example, in the case of the color information shown in  FIG. 33 , the three-dimensional data encoding device counts the number of the consecutive coding coefficients having 0 for all of the R, G, and B components, and adds the counted number to a bitstream as ZeroCnt. Accordingly, it becomes unnecessary to encode ZeroCnt for each component, and the overhead can be reduced. Therefore, the coding efficiency can be improved. Note that the three-dimensional data encoding device may calculate ZeroCnt for each dimension even when attribute_dimension is two or more, and may add the calculated ZeroCnt to a bitstream. 
       FIG. 34  is a flowchart of the three-dimensional data encoding processing according to the present embodiment. First, the three-dimensional data encoding device encodes geometry information (geometry) (S 6601 ). For example, the three-dimensional data encoding device performs encoding by using an octree representation. 
     Next, the three-dimensional data encoding device converts the attribute information (S 6602 ). For example, after the encoding of the geometry information, when the position of a three-dimensional point is changed due to quantization or the like, the three-dimensional data encoding device reassigns the attribute information of the original three-dimensional point to the three-dimensional point after the change. Note that the three-dimensional data encoding device may interpolate the value of the attribute information according to the amount of change of the position to perform the reassignment. For example, the three-dimensional data encoding device detects N three-dimensional points before the change near the three dimensional position after the change, performs the weighted averaging of the value of the attribute information of the N three-dimensional points based on the distance from the three-dimensional position after the change to each of the N three-dimensional points, and sets the obtained value as the value of the attribute information of the three-dimensional point after the change. Additionally, when two or more three-dimensional points are changed to the same three-dimensional position due to quantization or the like, the three-dimensional data encoding device may assign the average value of the attribute information in the two or more three-dimensional points before the change as the value of the attribute information after the change. 
     Next, the three-dimensional data encoding device encodes the attribute information (S 6603 ). For example, when encoding a plurality of pieces of attribute information, the three-dimensional data encoding device may encode the plurality of pieces of attribute information in order. For example, when encoding the color and the reflectance as the attribute information, the three-dimensional data encoding device generates a bitstream to which the encoding result of the reflectance is added after the encoding result of the color. Note that a plurality of encoding results of the attribute information added to a bitstream may be in any order. 
     Additionally, the three-dimensional data encoding device may add the information indicating the start location of the encoded data of each attribute information in a bitstream to a header or the like. Accordingly, since the three-dimensional data decoding device can selectively decode the attribute information that needs to be decoded, the decoding processing of the attribute information that does not need to be decoded can be omitted. Therefore, the processing amount for the three-dimensional data decoding device can be reduced. Additionally, the three-dimensional data encoding device may encode a plurality of pieces of attribute information in parallel, and may integrate the encoding results into one bitstream. Accordingly, the three-dimensional data encoding device can encode a plurality of pieces of attribute information at high speed. 
       FIG. 35  is a flowchart of the attribute information encoding processing (S 6603 ). First, the three-dimensional data encoding device generates a coding coefficient from attribute information by the Haar conversion (S 6611 ). Next, the three-dimensional data encoding device applies quantization to the coding coefficient (S 6612 ). Next, the three-dimensional data encoding device generates encoded attribute information (bitstream) by encoding the coding coefficient after the quantization (S 6613 ). 
     Additionally, the three-dimensional data encoding device applies inverse quantization to the coding coefficient after the quantization (S 6614 ). Next, the three-dimensional decoding device decodes the attribute information by applying the inverse Haar conversion to the coding coefficient after the inverse quantization (S 6615 ). For example, the decoded attribute information is referred to in the following encoding. 
       FIG. 36  is a flowchart of the coding coefficient encoding processing (S 6613 ). First, the three-dimensional data encoding device converts a coding coefficient from a signed integer value to an unsigned integer value (S 6621 ). For example, the three-dimensional data encoding device converts a signed integer value to an unsigned integer value as follows. When signed integer value Ta1q is smaller than 0, the unsigned integer value is set to − 1 −(2×Ta1q). When the signed integer value Ta1q is equal to or more than 0, the unsigned integer value is set to 2×Ta1q. Note that, when the coding coefficient does not become a negative value, the three-dimensional data encoding device may encode the coding coefficient as the unsigned integer value as is. 
     When not all coding coefficients have been processed (No in S 6622 ), the three-dimensional data encoding device determines whether the value of the coding coefficient to be processed is zero (S 6623 ). When the value of the coding coefficient to be processed is zero (Yes in S 6623 ), the three-dimensional data encoding device increments ZeroCnt by 1 (S 6624 ), and returns to step S 6622 . 
     When the value of the coding coefficient to be processed is not zero (No in S 6623 ), the three-dimensional data encoding device encodes ZeroCnt, and resets ZeroCnt to zero (S 6625 ). Additionally, the three-dimensional data encoding device arithmetically encodes the coding coefficient to be processed (S 6626 ), and returns to step S 6622 . For example, the three-dimensional data encoding device performs binary arithmetic encoding. In addition, the three-dimensional data encoding device may subtract the value 1 from the coding coefficient, and may encode the obtained value. 
     Additionally, the processing of steps S 6623  to S 6626  is repeatedly performed for each coding coefficient. In addition, when all the coding coefficients have been processed (Yes in S 6622 ), the three-dimensional data encoding device ends the processing. 
       FIG. 37  is a flowchart of the three-dimensional data decoding processing according to the present embodiment. First, the three-dimensional decoding device decodes geometry information (geometry) from a bitstream (S 6631 ). For example, the three-dimensional data decoding device performs decoding by using an octree representation. 
     Next, the three-dimensional decoding device decodes the attribute information from the bitstream (S 6632 ). For example, when decoding a plurality of pieces of attribute information, the three-dimensional decoding device may decode the plurality of pieces of attribute information in order. For example, when decoding the color and the reflectance as the attribute information, the three-dimensional data decoding device decodes the encoding result of the color and the encoding result of the reflectance according to the order in which they are added to the bitstream. For example, when the encoding result of the reflectance is added after the encoding result of the color in a bitstream, the three-dimensional data decoding device decodes the encoding result of the color, and thereafter decodes the encoding result of the reflectance. Note that the three-dimensional data decoding device may decode the encoding results of the attribute information added to a bitstream in any order. 
     Additionally, the three-dimensional decoding device may obtain the information indicating the start location of the encoded data of each attribute information in a bitstream by decoding a header or the like. Accordingly, since the three-dimensional data decoding device can selectively decode the attribute information that needs to be decoded, the decoding processing of the attribute information that does not need to be decoded can be omitted. Therefore, the processing amount of the three-dimensional decoding device can be reduced. Additionally, the three-dimensional data decoding device may decode a plurality of pieces of attribute information in parallel, and may integrate the decoding results into one three-dimensional point cloud. Accordingly, the three-dimensional data decoding device can decode a plurality of pieces of attribute information at high speed. 
       FIG. 38  is a flowchart of the attribute information decoding processing (S 6632 ). First, the three-dimensional decoding device decodes a coding coefficient from a bitstream (S 6641 ). Next, the three-dimensional decoding device applies the inverse quantization to the coding coefficient (S 6642 ). Next, the three-dimensional decoding device decodes the attribute information by applying the inverse Haar conversion to the coding coefficient after the inverse quantization (S 6643 ). 
       FIG. 39  is a flowchart of the coding coefficient decoding processing (S 6641 ). First, the three-dimensional decoding device decodes ZeroCnt from a bitstream (S 6651 ). When not all coding coefficients have been processed (No in S 6652 ), the three-dimensional decoding device determines whether ZeroCnt is larger than 0 (S 6653 ). 
     When ZeroCnt is larger than zero (Yes in S 6653 ), the three-dimensional decoding device sets the coding coefficient to be processed to 0 (S 6654 ). Next, the three-dimensional decoding device subtracts 1 from ZeroCnt (S 6655 ), and returns to step S 6652 . 
     When ZeroCnt is zero (No in S 6653 ), the three-dimensional decoding device decodes the coding coefficient to be processed (S 6656 ). For example, the three-dimensional decoding device uses binary arithmetic decoding. Additionally, the three-dimensional decoding device may add the value 1 to the decoded coding coefficient. 
     Next, the three-dimensional decoding device decodes ZeroCnt, sets the obtained value to ZeroCnt (S 6657 ), and returns to step S 6652 . 
     Additionally, the processing of steps S 6653  to S 6657  is repeatedly performed for each coding coefficient. In addition, when all the coding coefficients have been processed (Yes in S 6652 ), the three-dimensional data encoding device converts a plurality of decoded coding coefficients from unsigned integer values to signed integer values (S 6658 ). For example, the three-dimensional data decoding device may convert the decoded coding coefficients from unsigned integer values to signed integer values as follows. When the LSB (least significant bit) of the decoded unsigned integer value Ta1u is 1, the signed integer value Ta1q is set to −((Ta1u+1)&gt;&gt;1). When the LSB of the decoded unsigned integer value Ta1u is not 1 (when it is 0), the signed integer value Ta1q is set to (Ta1u&gt;&gt;1). Note that, when the coding coefficient does not become a negative value, the three-dimensional data decoding device may use the decoded coding coefficient as is as the signed integer value. 
       FIG. 40  is a block diagram of attribute information encoder  6600  included in the three-dimensional data encoding device. Attribute information encoder  6600  includes sorter  6601 , Haar transformer  6602 , quantizer  6603 , inverse quantizer  6604 , inverse Haar converter  6605 , memory  6606 , and arithmetic encoder  6607 . 
     Sorter  6601  generates the Morton codes by using the geometry information of three-dimensional points, and sorts the plurality of three-dimensional points in the order of the Morton codes. Haar transformer  6602  generates the coding coefficient by applying the Haar conversion to the attribute information. Quantizer  6603  quantizes the coding coefficient of the attribute information. 
     Inverse quantizer  6604  inverse quantizes the coding coefficient after the quantization. Inverse Haar converter  6605  applies the inverse Haar conversion to the coding coefficient. Memory  6606  stores the values of pieces of attribute information of a plurality of decoded three-dimensional points. For example, the attribute information of the decoded three-dimensional points stored in memory  6606  may be utilized for prediction and the like of an unencoded three-dimensional point. 
     Arithmetic encoder  6607  calculates ZeroCnt from the coding coefficient after the quantization, and arithmetically encodes ZeroCnt. Additionally, arithmetic encoder  6607  arithmetically encodes the non-zero coding coefficient after the quantization. Arithmetic encoder  6607  may binarize the coding coefficient before the arithmetic encoding. In addition, arithmetic encoder  6607  may generate and encode various kinds of header information. 
       FIG. 41  is a block diagram of attribute information decoder  6610  included in the three-dimensional decoding device. Attribute information decoder  6610  includes arithmetic decoder  6611 , inverse quantizer  6612 , inverse Haar converter  6613 , and memory  6614 . 
     Arithmetic decoder  6611  arithmetically decodes ZeroCnt and the coding coefficient included in a bitstream. Note that arithmetic decoder  6611  may decode various kinds of header information. 
     Inverse quantizer  6612  inverse quantizes the arithmetically decoded coding coefficient. Inverse Haar converter  6613  applies the inverse Haar conversion to the coding coefficient after the inverse quantization. Memory  6614  stores the values of pieces of attribute information of a plurality of decoded three-dimensional points. For example, the attribute information of the decoded three-dimensional points stored in memory  6614  may be utilized for prediction of an undecoded three-dimensional point. 
     Note that, in the above-described embodiment, although the example has been shown in which the three-dimensional points are encoded in the order of the lower layers to the higher layers as the encoding order, it is not necessarily limit to this. For example, a method may be used that scans the coding coefficients after the Haar conversion in the order of the higher layers to the lower layers. Note that, also in this case, the three-dimensional data encoding device may encode the number of consecutive times of the value 0 as ZeroCnt. 
     Additionally, the three-dimensional data encoding device may switch whether or not to use the encoding method using ZeroCnt described in the present embodiment per WLD, SPC, or volume. In this case, the three-dimensional data encoding device may add the information indicating whether or not the encoding method using ZeroCnt has been applied to the header information. Accordingly, the three-dimensional decoding device can appropriately perform decoding. As an example of the switching method, for example, the three-dimensional data encoding device counts the number of times of occurrence of the coding coefficient having a value of 0 with respect to one volume. When the count value exceeds a predefined threshold value, the three-dimensional data encoding device applies the method using ZeroCnt to the next volume, and when the count value is equal to or less than the threshold value, the three-dimensional data encoding device does not apply the method using ZeroCnt to the next volume. Accordingly, since the three-dimensional data encoding device can appropriately switch whether or not to apply the encoding method using ZeroCnt according to the characteristic of a current three-dimensional point to be encoded, the coding efficiency can be improved. 
     Hereinafter, another technique (modification) of the present embodiment will be described. The three-dimensional data encoding device scans and encodes the coding coefficients (unsigned integer values) after the quantization according to a certain order. For example, the three-dimensional data encoding device encodes a plurality of three-dimensional points from the three-dimensional points included in the lower layers toward the higher layers in order. 
       FIG. 42  is a diagram showing an example of the first code sequence and the second code sequence in the case where this technique is used for the attribute information shown in  FIG. 27 . In the case of this example, the three-dimensional data encoding device encodes a plurality of coding coefficients in the order of Ta5q, Tb1q, Tb3q, Tc1q, and d0q from Ta1q included in the lower layer L. Here, there is a tendency that the lower the layer, the more likely it is that the coding coefficient after quantization becomes 0. This can be due to the following and the like. 
     Since the coding coefficients of the lower layers L show a higher frequency component than the higher layers, the coding coefficients tend to be 0 depending on the current three-dimensional point to be encoded. Additionally, by switching the quantization scale according to the above-described importance or the like. The lower the layer, the larger the quantization scale, and the coding coefficient after the quantization easily become 0. In this manner, the lower the layer, the more likely it is that the coding coefficient after the quantization becomes 0, and the value 0 is likely to be consecutively generated for the first code sequence. The three-dimensional data encoding device counts the number of times that the value 0 occurs in the first code sequence, and encodes the number of times (ZeroCnt) that the value 0 consecutively occurs, instead of the consecutive values 0. Accordingly, when there are consecutive values 0 of the coding coefficients after the quantization, the coding efficiency can be improved by encoding the number of consecutive times of 0, rather than encoding a lot of 0s. 
     Additionally, the three-dimensional data encoding device may encode the information indicating the total number of times of occurrence of the value 0. Accordingly, the overhead of encoding ZeroCnt can be reduced, and the coding efficiency can be improved. 
     For example, the three-dimensional data encoding device encodes the total number of the coding coefficients having a value of 0 as TotalZeroCnt. Accordingly, in the example shown in  FIG. 42 , at the time when the three-dimensional data decoding device decodes the second ZeroCnt (value 1) included in the second code sequence, the total number of decoded ZeroCnts will be N+1 (=TotalZeroCnt). Therefore, the three-dimensional data decoding device can identify that 0 does not occur after this. Therefore, subsequently, it becomes unnecessary for the three-dimensional data encoding device to encode ZeroCnt for each value, and the code amount can be reduced. Additionally, the three-dimensional data encoding device may entropy encode TotalZeroCnt. For example, the three-dimensional data encoding device binarizes the value of TotalZeroCnt with the truncated unary code of the total number T of the encoded three-dimensional points, and arithmetically encodes each bit after binarization. At this time, the three-dimensional data encoding device may improve the coding efficiency by using a different coding table for each bit. For example, the three-dimensional data encoding device uses coding table 1 for the first bit, uses coding table 2 for the second bit, and coding table 3 for the subsequent bits. In this manner, the three-dimensional data encoding device can improve the coding efficiency by switching the coding table for each bit. 
     Additionally, the three-dimensional data encoding device may arithmetically encode TotalZeroCnt after binarizing TotalZeroCnt with an Exponential-Golomb. Accordingly, when the value of TotalZeroCnt easily becomes large, the efficiency can be more improved than the binarized arithmetic encoding with the truncated unary code. Note that the three-dimensional data encoding device may add a flag for switching between using the truncated unary code and using the Exponential-Golomb to a header. Accordingly, the three-dimensional data encoding device can improve the coding efficiency by selecting the optimum binarization method. Additionally, the three-dimensional data decoding device can correctly decode a bitstream by referring to the flag included in the header to switch the binarization method. 
       FIG. 43  is a diagram showing a syntax example of the attribute information (attribute_data) in the present modification. The attribute information (attribute_data) shown in  FIG. 43  further includes the total number of zeros (TotalZeroCnt) in addition to the attribute information shown in  FIG. 32 . Note that the other information is the same as that in  FIG. 32 . The total number of zeros (TotalZeroCnt) indicates the total number of the coding coefficients having a value of 0 after quantization. 
     Additionally, the three-dimensional data encoding device may switch the calculation method of the values of TotalZeroCnt and ZeroCnt depending on the value of attribute_dimension. For example, when attribute_dimension=3, the three-dimensional data encoding device may count the number of times that the values of the coding coefficients of all the components (dimensions) become 0.  FIG. 44  is a diagram showing an example of the coding coefficient, ZeroCnt, and TotalZeroCnt in this case. For example, in the case of the color information shown in  FIG. 44 , the three-dimensional data encoding device counts the number of the consecutive coding coefficients having 0 for all of the R, G, and B components, and adds the counted number to a bitstream as TotalZeroCnt and ZeroCnt. Accordingly, it becomes unnecessary to encode Total ZeroCnt and ZeroCnt for each component, and the overhead can be reduced. Therefore, the coding efficiency can be improved. Note that the three-dimensional data encoding device may calculate TotalZeroCnt and ZeroCnt for each dimension even when attribute_dimension is two or more, and may add the calculated TotalZeroCnt and ZeroCnt to a bitstream. 
       FIG. 45  is a flowchart of the coding coefficient encoding processing (S 6613 ) in the present modification. First, the three-dimensional data encoding device converts the coding coefficient from a signed integer value to an unsigned integer value (S 6661 ). Next, the three-dimensional data encoding device encodes TotalZeroCnt (S 6662 ). 
     When not all coding coefficients have been processed (No in S 6663 ), the three-dimensional data encoding device determines whether the value of the coding coefficient to be processed is zero (S 6664 ). When the value of the coding coefficient to be processed is zero (Yes in S 6664 ), the three-dimensional data encoding device increments ZeroCnt by 1 (S 6665 ), and returns to step S 6663 . 
     When the value of the coding coefficient to be processed is not zero (No in S 6664 ), the three-dimensional data encoding device determines whether TotalZeroCnt is larger than 0 (S 6666 ). When TotalZeroCnt is larger than 0 (Yes in S 6666 ), the three-dimensional data encoding device encodes ZeroCnt, and sets TotalZeroCnt to TotalZeroCnt−ZeroCnt (S 6667 ). 
     After step S 6667 , or when TotalZeroCnt is 0 (No in S 6666 ), the three-dimensional data encoding device encodes the coding coefficient, resets ZeroCnt to 0 (S 6668 ), and returns to step S 6663 . For example, the three-dimensional data encoding device performs binary arithmetic encoding. Additionally, the three-dimensional data encoding device may subtract the value 1 from the coding coefficient, and encode the obtained value. 
     Additionally, the processing of steps S 6664  to S 6668  is repeatedly performed for each coding coefficient. In addition, when all the coding coefficients have been processed (Yes in S 6663 ), the three-dimensional data encoding device ends processing. 
       FIG. 46  is a flowchart of the coding coefficient decoding processing (S 6641 ) in the present modification. First, the three-dimensional decoding device decodes TotalZeroCnt from a bitstream (S 6671 ). Next, the three-dimensional decoding device decodes ZeroCnt from the bitstream, and sets TotalZeroCnt to TotalZeroCnt−ZeroCnt (S 6672 ). 
     When not all coding coefficients have been processed (No in S 6673 ), the three-dimensional data encoding device determines whether ZeroCnt is larger than 0 (S 6674 ). 
     When ZeroCnt is larger than zero (Yes in S 6674 ), the three-dimensional data decoding device sets the coding coefficient to be processed to 0 (S 6675 ). Next, the three-dimensional data decoding device subtracts 1 from ZeroCnt (S 6676 ), and returns to step S 6673 . 
     When ZeroCnt is zero (No in S 6674 ), the three-dimensional data decoding device decodes the coding coefficient to be processed (S 6677 ). For example, the three-dimensional data decoding device uses binary arithmetic decoding. Additionally, the three-dimensional data decoding device may add the value 1 to the decoded coding coefficient. 
     Next, the three-dimensional data decoding device determines whether TotalZeroCnt is larger than 0 (S 6678 ). When TotalZeroCnt is larger than 0 (Yes in S 6678 ), the three-dimensional data decoding device decodes ZeroCnt, sets the obtained value to ZeroCnt, sets TotalZeroCnt to TotalZeroCnt−ZeroCnt (S 6679 ), and returns to step S 6673 . Additionally, when TotalZeroCnt is 0 (No in S 6678 ), the three-dimensional decoding device returns to step S 6673 . 
     Additionally, the processing of steps S 6674  to S 6679  is repeatedly performed for each coding coefficient. In addition, when all the coding coefficients have been processed (Yes in S 6673 ), the three-dimensional data encoding device converts the decoded coding coefficient from an unsigned integer value to a signed integer value (S 6680 ). 
       FIG. 47  is a diagram showing another syntax example of the attribute information (attribute_data). The attribute information (attribute_data) shown in  FIG. 47  includes value [j] [i]_greater_zero_flag, value [j] [i]_greater_one_flag, and value [j] [i], instead of the coding coefficient (value [j] [i]) shown in  FIG. 32 . Note that the other information is the same as that in  FIG. 32 . 
     Value [j] [i]_greater_zero_flag indicates whether or not the value of the coding coefficient (value [j] [i]) is larger than 0. In other words, value [j] [i]_greater_zero_flag indicates whether or not the value of the coding coefficient (value [j] [i]) is 0. 
     For example, when the value of the coding coefficient is larger than 0, value [j] [i]_greater_zero_flag is set to the value 1, and when the value of the coding coefficient is 0, value [j] [i]_greater_zero_flag is set to the value 0. When the value of value [j] [i]_greater_zero_flag is 0, the three-dimensional data encoding device need not add value [j] [i] to a bitstream. In this case, the three-dimensional decoding device may determine that the value of value [j] [i] is the value 0. Accordingly, the code amount can be reduced. 
     Value [j] [i]_greater_one_flag indicates whether or not the value of the coding coefficient (value [j] [i]) is larger than 1 (is equal to or larger than 2). In other words, value [j] [i]_greater_one_flag indicates whether or not the value of the coding coefficient (value [j] [i]) is 1. 
     For example, when the value of the coding coefficient is larger than 1, value [j] [i]_greater_one_flag is set to the value 1. Otherwise (when the value of the coding coefficient is equal to or less than 1), value [j] [i]_greater_one_flag is set to the value 0. When the value of value [j] [i]_greater_one_flag is 0, the three-dimensional data encoding device need not add value [j] [i] to a bitstream. In this case, the three-dimensional decoding device may determine that the value of value [j] [i] is the value 1. 
     Value [j] [i] indicates the coding coefficient after quantization of the attribute information of the j-th dimension of the i-th three-dimensional point. For example, when the attribute information is color information, value [99] [1] indicates the coding coefficient of the second dimension (for example, the G value) of the 100th three-dimensional point. Additionally, when the attribute information is reflectance information, value [119] [0] indicates the coding coefficient of the first dimension (for example, the reflectance) of the 120th three-dimensional point. 
     When value [j] [i]_greater_zero_flag=1, and value [j] [i]_greater_one_flag=1, the three-dimensional data encoding device may add value [j] [i] to a bitstream. Additionally, the three-dimensional data encoding device may add the value obtained by subtracting 2 from value [j] [i] to the bitstream. In this case, the three-dimensional decoding device calculates the coding coefficient by adding the value 2 to the decoded value [j] [i]. 
     The three-dimensional data encoding device may entropy encode value [j] [i]_greater_zero_flag and value [j] [i]_greater_one_flag. For example, binary arithmetic encoding and binary arithmetic decoding may be used. Accordingly, the coding efficiency can be improved. 
     Embodiment 8 
     In this embodiment, a reversible (Lossless) attribute encoding will be described. To achieve high compression, attribute information included in Point Cloud Compression (PCC) data is transformed in a plurality of methods, such as Lifting, Region Adaptive Hierarchical Transform (RAHT) and other transform methods. Here, Lifting is one of transform methods using Level of Detail (LoD). 
     Important signal information tends to be included in a low-frequency component, and therefore the code amount is reduced by quantizing a high-frequency component. That is, the transform process has strong energy compression characteristics. 
     On the other hand, in order to maintain the original information while reducing the number of bits, the reversible compression is needed. Existing transforms, such as Lifting and RAHT, involves a division and a square-root operator and therefore cannot achieve reversible compression. In order to achieve an efficient and effective reversible compression, an integer-to-integer transform that is not complicated is needed. 
       FIG. 48  is a diagram showing a configuration of a three-dimensional data encoding device. As shown in  FIG. 48 , the three-dimensional data encoding device includes integer transformer  8301  and entropy encoder  8302 . Integer transformer  8301  generates a coefficient value by integer-transforming input point cloud data. Entropy encoder  8302  generates a bitstream by entropy-encoding the coefficient value. 
       FIG. 49  is a diagram showing a configuration of a three-dimensional data decoding device. As shown in  FIG. 49 , the three-dimensional data decoding device includes entropy decoder  8303  and inverse integer transformer  8304 . Entropy decoder  8303  obtains a coefficient value by decoding a bitstream. Inverse integer transformer  8304  generates output point cloud data by inverse integer-transforming the coefficient value. 
     In the following, RAHT will be describe. RAHT is an example of the transform processings applied to three-dimensional points.  FIG. 50  is a diagram for illustrating RAHT. m-th Low-frequency component L l, m  and m-th high-frequency component H l, m  in layer l are expressed by two low-frequency components C l+1, 2m  and C l+1, 2m+1  in layer l+1 according to the following (Equation O1). That is, low-frequency component L l, m  is expressed by (Equation O2), and high-frequency component H l, m  is expressed by (Equation O3). 
     A high-frequency component is encoded by quantization and entropy encoding. A low-frequency component is used in the subsequent layer as shown by (Equation O4). Coefficient α and β are updated for each upper layer. Coefficients α and β are expressed by (Equation O5) and (Equation O6), respectively. Weight W l, m  is expressed by (Equation O7). 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               2 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   
                     [ 
                     
                       
                         
                           
                             L 
                             
                               l 
                               , 
                               m 
                             
                           
                         
                       
                       
                         
                           
                             H 
                             
                               l 
                               , 
                               m 
                             
                           
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             α 
                           
                           
                             β 
                           
                         
                         
                           
                             
                               - 
                               β 
                             
                           
                           
                             α 
                           
                         
                       
                       ] 
                     
                     ⁡ 
                     
                       [ 
                       
                         
                           
                             
                               C 
                               
                                 
                                   l 
                                   + 
                                   1 
                                 
                                 , 
                                 
                                   2 
                                   ⁢ 
                                   m 
                                 
                               
                             
                           
                         
                         
                           
                             
                               C 
                               
                                 
                                   l 
                                   + 
                                   1 
                                 
                                 , 
                                 
                                   
                                     2 
                                     ⁢ 
                                     m 
                                   
                                   + 
                                   1 
                                 
                               
                             
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O1 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     L 
                     
                       l 
                       , 
                       m 
                     
                   
                   = 
                   
                     
                       
                         α 
                         ⁢ 
                         C 
                       
                       
                         
                           l 
                           + 
                           1 
                         
                         , 
                         
                           2 
                           ⁢ 
                           m 
                         
                       
                     
                     + 
                     
                       
                         β 
                         ⁢ 
                         C 
                       
                       
                         
                           l 
                           + 
                           1 
                         
                         , 
                         
                           
                             2 
                             ⁢ 
                             m 
                           
                           + 
                           1 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     
                       Eq 
                       ⁢ 
                       uation 
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O2 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     H 
                     
                       l 
                       , 
                       m 
                     
                   
                   = 
                   
                     
                       
                         α 
                         ⁢ 
                         C 
                       
                       
                         
                           l 
                           + 
                           1 
                         
                         , 
                         
                           
                             2 
                             ⁢ 
                             m 
                           
                           + 
                           1 
                         
                       
                     
                     - 
                     
                       
                         β 
                         ⁢ 
                         C 
                       
                       
                         
                           l 
                           + 
                           1 
                         
                         , 
                         
                           2 
                           ⁢ 
                           m 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O3 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     C 
                     
                       l 
                       , 
                       m 
                     
                   
                   = 
                   
                     L 
                     
                       l 
                       . 
                       m 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O4 
                   
                   ) 
                 
               
             
             
               
                 
                   α 
                   = 
                   
                     
                       
                         w 
                         
                           
                             l 
                             + 
                             1 
                           
                           , 
                           
                             2 
                             ⁢ 
                             m 
                           
                         
                       
                     
                     
                       
                         
                           w 
                           
                             
                               l 
                               + 
                               1 
                             
                             , 
                             
                               2 
                               ⁢ 
                               m 
                             
                           
                         
                         + 
                         
                           w 
                           
                             
                               l 
                               + 
                               1 
                             
                             , 
                             
                               
                                 2 
                                 ⁢ 
                                 m 
                               
                               + 
                               1 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O5 
                   
                   ) 
                 
               
             
             
               
                 
                   β 
                   = 
                   
                     
                       
                         w 
                         
                           
                             l 
                             + 
                             1 
                           
                           , 
                           
                             
                               2 
                               ⁢ 
                               m 
                             
                             + 
                             1 
                           
                         
                       
                     
                     
                       
                         
                           w 
                           
                             
                               l 
                               + 
                               1 
                             
                             , 
                             
                               2 
                               ⁢ 
                               m 
                             
                           
                         
                         + 
                         
                           w 
                           
                             
                               l 
                               + 
                               1 
                             
                             , 
                             
                               
                                 2 
                                 ⁢ 
                                 m 
                               
                               + 
                               1 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O6 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     w 
                     
                       l 
                       , 
                       m 
                     
                   
                   = 
                   
                     
                       w 
                       
                         
                           l 
                           + 
                           1 
                         
                         , 
                         
                           2 
                           ⁢ 
                           m 
                         
                       
                     
                     + 
                     
                       w 
                       
                         
                           l 
                           + 
                           1 
                         
                         , 
                         
                           
                             2 
                             ⁢ 
                             m 
                           
                           + 
                           1 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O7 
                   
                   ) 
                 
               
             
           
         
       
     
     Next, an integer-to-integer transform will be described. The RAHT process involves a square-root operator and a division. This means that information is lost in RAHT, and RAHT cannot achieve reversible compression. On the other hand, the integer-to-integer transform can achieve reversible compression. 
       FIG. 51  is a diagram for illustrating an integer-to-integer transform. In the integer-to-integer transform, a fixed value is used as a coefficient in RAHT. For example, an unnormalized Haar transform expressed by the following (Equation O8) is used. That is, low-frequency component L l, m  is expressed by (Equation O9), and high-frequency component H l, m  is expressed by (Equation O10). 
     A high-frequency component is encoded by quantization and entropy encoding. A low-frequency component is used in the subsequent layer as shown by (Equation O11). 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               3 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   
                     [ 
                     
                       
                         
                           
                             L 
                             
                               l 
                               , 
                               m 
                             
                           
                         
                       
                       
                         
                           
                             H 
                             
                               l 
                               , 
                               m 
                             
                           
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               1 
                               2 
                             
                           
                           
                             
                               1 
                               2 
                             
                           
                         
                         
                           
                             
                               - 
                               1 
                             
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                     ⁡ 
                     
                       [ 
                       
                         
                           
                             
                               C 
                               
                                 
                                   l 
                                   + 
                                   1 
                                 
                                 , 
                                 
                                   2 
                                   ⁢ 
                                   m 
                                 
                               
                             
                           
                         
                         
                           
                             
                               C 
                               
                                 
                                   l 
                                   + 
                                   1 
                                 
                                 , 
                                 
                                   
                                     2 
                                     ⁢ 
                                     m 
                                   
                                   + 
                                   1 
                                 
                               
                             
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O8 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     L 
                     
                       l 
                       , 
                       m 
                     
                   
                   = 
                   
                     
                       ( 
                       
                         
                           C 
                           
                             
                               l 
                               + 
                               1 
                             
                             , 
                             
                               2 
                               ⁢ 
                               m 
                             
                           
                         
                         + 
                         
                           C 
                           
                             
                               l 
                               + 
                               1 
                             
                             , 
                             
                               
                                 2 
                                 ⁢ 
                                 m 
                               
                               + 
                               1 
                             
                           
                         
                       
                       ) 
                     
                     / 
                     2 
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O9 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     H 
                     
                       l 
                       , 
                       m 
                     
                   
                   = 
                   
                     
                       C 
                       
                         
                           l 
                           + 
                           1 
                         
                         , 
                         
                           
                             2 
                             ⁢ 
                             m 
                           
                           + 
                           1 
                         
                       
                     
                     - 
                     
                       C 
                       
                         
                           l 
                           + 
                           1 
                         
                         , 
                         
                           2 
                           ⁢ 
                           m 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O10 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     C 
                     
                       l 
                       , 
                       m 
                     
                   
                   = 
                   
                     L 
                     
                       l 
                       , 
                       m 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                       
                           
                       
                       ⁢ 
                       
                           
                       
                     
                     ⁢ 
                     
                       O 
                       ⁢ 
                       11 
                     
                   
                   ) 
                 
               
             
           
         
       
     
     The unnormalized Haar transform can be rewritten as (Equation O12) and (Equation O13). 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               4 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   
                     
                       H 
                       
                         l 
                         , 
                         m 
                       
                     
                     = 
                     
                       
                         C 
                         
                           
                             l 
                             + 
                             1 
                           
                           , 
                           
                             
                               2 
                               ⁢ 
                               m 
                             
                             + 
                             1 
                           
                         
                       
                       - 
                       
                         C 
                         
                           
                             l 
                             + 
                             1 
                           
                           , 
                           
                             2 
                             ⁢ 
                             m 
                           
                         
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     
                       L 
                       
                         l 
                         , 
                         m 
                       
                     
                     = 
                     
                       
                         
                           C 
                           
                             
                               l 
                               + 
                               1 
                             
                             , 
                             
                               2 
                               ⁢ 
                               m 
                             
                           
                         
                         + 
                         
                           C 
                           
                             
                               l 
                               + 
                               1 
                             
                             , 
                             
                               
                                 2 
                                 ⁢ 
                                 m 
                               
                               + 
                               1 
                             
                           
                         
                       
                       2 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O12 
                   
                   ) 
                 
               
             
             
               
                 
                   
                       
                   
                   ⁢ 
                   
                     = 
                     
                       
                         C 
                         
                           
                             l 
                             + 
                             1 
                           
                           , 
                           
                             2 
                             ⁢ 
                             m 
                           
                         
                       
                       + 
                       
                         
                           H 
                           
                             l 
                             , 
                             m 
                           
                         
                         2 
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O13 
                   
                   ) 
                 
               
             
           
         
       
     
     An integer Haar transform is achieved according to (Equation O14) and (Equation O15), and an inverse integer Haar transform is achieved according to (Equation O16) and (Equation O17). Here, | | represents a floor function. Since both (Equation O15) and (Equation O16) includes |H l, m /2|, a loss caused by |H l, m /2| is cancelled by the integer Haar transform and the inverse integer Haar transform. In this way, reversible compression is achieved. Here, C i, j  is defined as an integer, and therefore, H i, j  and L i, j  are also integers. 
       [Math. 5] 
         H   l,m   =C   l+1,2m+1   −C   l+1,2m   (Equation O14)
 
         L   l,m   =C   l+1,2m   +└H   l,m /2┘  (Equation O15)
 
         C   l+1,2m   =L   l,m   −┌H   l,m /2┘  (Equation O16)
 
         C   l+1,2m+1   =H   l,m   +C   l+1,2m   (Equation O17)
 
     Therefore, an efficient implementation can be achieved by the following (Equation O18) to (Equation O21). That is, a transform can be achieved by one addition, one subtraction, and one right shifting (down shifting). 
       [Math. 6] 
         H   l,m   =C   l+1,2m+1   −C   l+1,2m   (Equation O18)
 
         L   l,m   =C   l+1,2m +( H   l,m &gt;&gt;1)  (Equation O19)
 
         C   l+1,2m   =L   l,m −( H   l,m &gt;&gt;1)  (Equation O20)
 
         C   l+1,2m+1   =H   l,m   +C   l+1,2m   (Equation O21)
 
     A recursive integer-to-integer transform will be described.  FIG. 52  is a diagram for illustrating a hierarchical transform processing. When the Haar transform is applied to an image, a pair of pieces of data is required in order to perform a transform suitable for pixel transform. In the Haar transform for a three-dimensional point cloud, an integer Haar is applied when a three-dimensional point pair, which is a pair of point clouds, can be formed, and data on three-dimensional points is moved to the subsequent layer (level) when a three-dimensional point pair is not available. Then, this process is recursively performed. 
     Next, a configuration of a three-dimensional data encoding device will be described.  FIG. 53  is a block diagram of three-dimensional data encoding device  8310 . Three-dimensional data encoding device  8310  generates encoded data (encoded stream) by encoding point cloud data (point cloud). Three-dimensional data encoding device  8310  includes geometry information encoder  8311 , lossless attribute information encoder  8312 , additional information encoder  8313 , and multiplexer  8314 . 
     Geometry information encoder  8311  generates encoded geometry information by encoding geometry information. For example, geometry information encoder  8311  encodes geometry information using an N-ary tree structure, such as an octree. Specifically, in the case of an octree, a current space is divided into eight nodes (subspaces), and 8-bit information (occupancy code) that indicates whether each node includes a point cloud or not is generated. A node including a point cloud is further divided into eight nodes, and 8-bit information that indicates whether each of the eight nodes includes a point cloud or not is generated. This process is repeated until a predetermined layer is reached or the number of the point clouds included in each node becomes smaller than or equal to a threshold. 
     Lossless attribute information encoder  8312  generates encoded attribute information, which is encoded data, by encoding attribute information using configuration information generated by geometry information encoder  8311 . 
     Additional information encoder  8313  generates encoded additional information by encoding additional information included in point cloud data. 
     Multiplexer  8314  generates encoded data (encoded stream) by multiplexing the encoded geometry information, the encoded attribute information, and the encoded additional information, and transmits the generated encoded data. The encoded additional information is used in the decoding. 
       FIG. 54  is a block diagram of lossless attribute information encoder  8312 . Lossless attribute information encoder  8312  includes integer transformer  8321  and entropy encoder  8322 . Integer transformer  8321  generates a coefficient value by performing an integer transform (such as an integer Haar transform) on attribute information. Entropy encoder  8322  generates encoded attribute information by entropy-encoding the coefficient value. 
       FIG. 55  is a block diagram of integer transformer  8321 . Integer transformer  8321  includes re-ordering unit  8323  and integer Haar transformer  8324 . Re-ordering unit  8323  re-orders attribute information based on geometry information. For example, re-ordering unit  8323  re-orders attribute information in Morton order. Integer Haar transformer  8324  generates a coefficient value by performing an integer Haar transform on the re-ordered attribute information. 
     Next, a configuration of a three-dimensional data decoding device according to this embodiment will be described.  FIG. 56  is a block diagram showing a configuration of three-dimensional data decoding device  8330 . Three-dimensional data decoding device  8330  reproduces point cloud data by decoding encoded data (encoded stream) generated by encoding the point cloud data. Three-dimensional data decoding device  8330  includes demultiplexer  8331 , a plurality of geometry information decoders  8332 , a plurality of lossless attribute information decoders  8333 , and additional information decoder  8334 . 
     Demultiplexer  8331  generates encoded geometry information, encoded attribute information, and encoded additional information by demultiplexing encoded data (encoded stream). 
     Geometry information decoder  8332  generates geometry information by decoding encoded geometry information. Lossless attribute information decoder  8333  generates attribute information by decoding encoded attribute information. For example, lossless attribute information decoder  8333  generates attribute information by performing an inverse integer transform (such as an inverse integer Haar transform) on encoded attribute information.  FIG. 57  is a block diagram of lossless attribute information decoder  8333 . Lossless attribute information decoder  8333  includes entropy decoder  8341  and inverse integer transformer  8342 . Entropy decoder  8341  generates a coefficient value by entropy-decoding encoded attribute information. Inverse integer transformer  8342  generates attribute information by performing an inverse integer transform (such as an inverse integer Haar transform) on the coefficient value. 
       FIG. 58  is a block diagram of inverse integer transformer  8342 . Inverse integer transformer  8342  includes re-ordering unit  8343  and inverse integer Haar transformer  8344 . Re-ordering unit  8343  re-orders coefficient values based on geometry information. For example, re-ordering unit  8343  re-orders coefficient values in Morton order. Inverse integer Haar transformer  8344  generates attribute information by performing an inverse integer Haar transform on the re-ordered coefficient values. 
     The three-dimensional data encoding device may add, to the header of the bitstream or the like, information that indicates which of the reversible (Lossless) encoding and the irreversible (lossy) encoding has been used. For example, the three-dimensional data encoding device may add lossless_enable_flag to the header. When lossless_enable_flag=1, the three-dimensional data decoding device decodes the reversibly encoded bitstream by applying the inverse integer Haar transform. When lossless_enable_flag=0, the three-dimensional data decoding device decodes the irreversibly encoded bitstream by applying the inverse RAHT. In this way, the three-dimensional data decoding device can properly decode the bitstream by changing the inverse transform processing in accordance with the value of lossless_enable_flag. 
     Note that the information that indicates which of the reversible encoding and the irreversible encoding has been used for encoding is not necessarily limited thereto, and the value of quantization parameter QP or quantization step Qstep can also be used, for example. For example, when the value of the quantization parameter or quantization step is a particular value (QP=4 or Qstep=1, for example), the three-dimensional data decoding device may determine that the bitstream has been encoded by reversible encoding, and decode the reversibly encoded bitstream by applying the inverse integer Haar transform. When the value of the quantization parameter or quantization step is greater than the particular value (QP=4 or Qstep=1, for example), the three-dimensional data decoding device may determine that the bitstream has been encoded by irreversible encoding, and decode the irreversibly encoded bitstream by applying the inverse RAHT. 
     Next, a lossless attribute information encoding processing will be described.  FIG. 59  is a flowchart of a lossless attribute information encoding processing. 
     First, the three-dimensional data encoding device re-orders attribute information on a three-dimensional point cloud (S 8301 ). For example, the three-dimensional data encoding device re-orders attribute information on a three-dimensional point cloud in Morton order. 
     The three-dimensional data encoding device then selects a current point to be processed from the three-dimensional point cloud (S 8302 ). Specifically, the three-dimensional data encoding device selects the leading three-dimensional point in the three-dimensional point cloud re-ordered in Morton order. 
     The three-dimensional data encoding device then determines whether or not there is a three-dimensional point pair (Point Pair), which a three-dimensional point located next to the current three-dimensional point in Morton order (S 8303 ). When there is a three-dimensional point pair (if Yes in S 8304 ), the three-dimensional data encoding device generates a coefficient value including a high-frequency component and a low-frequency component by performing the integer Haar transform using the three-dimensional point pair (S 8305 ). The three-dimensional data encoding device then encodes (entropy-encodes, for example) the generated high-frequency component, and stores the encoded high-frequency component in the bitstream (S 8306 ). The three-dimensional data encoding device also stores the low-frequency component in a memory or the like for the processing for the subsequent layer (S 8307 ). 
     On the other hand, when there is no three-dimensional point pair if No in S 8304 ), the three-dimensional data encoding device stores the attribute information on the current three-dimensional point in the memory or the like for the subsequent layer (S 8307 ). 
     When the current three-dimensional point is not the last three-dimensional point in the current layer, which is the layer to be processed (if No in S 8308 ), the three-dimensional data encoding device selects the subsequent three-dimensional point in Morton order as a current three-dimensional point (S 8302 ), and performs step S 8303  and the following process on the selected current three-dimensional point. The “subsequent three-dimensional point in Morton order” means the three-dimensional point subsequent to the three-dimensional point pair when there is a three-dimensional point pair, and refers to the three-dimensional point subsequent to the current three-dimensional point when there is no three-dimensional point pair. 
     When the current three-dimensional point is the last three-dimensional point in the current layer of Yes in S 8308 ), the three-dimensional data encoding device starts the processing for the subsequent layer (the layer directly above the current layer) (S 8309 ). When the former current layer is not the last layer (top layer) (if No in S 8310 ), the three-dimensional data encoding device selects the first three-dimensional point in Morton order in the subsequent layer as a current three-dimensional point (S 8302 ), and performs step S 8303  and the following process on the selected current three-dimensional point. 
     When the former current layer is the last layer of Yes in S 8310 ), the three-dimensional data encoding device encodes (entropy-encodes, for example) the low-frequency component generated in the last layer (top layer), and stores the encoded low-frequency component in the bitstream (S 8311 ). By the process described above, encoded attribute information is generated which includes the encoded high-frequency component for the three-dimensional point pair included in each layer and the encoded low-frequency component for the top layer. 
     Next, a lossless attribute information decoding processing will be described.  FIG. 60  is a flowchart of a lossless attribute information decoding processing. 
     First, the three-dimensional data decoding device decodes coefficient values from the bitstream (S 8321 ). The coefficient value includes the high-frequency component for the three-dimensional point pair included in each layer and the low-frequency component for the top layer. The three-dimensional data decoding device then re-orders the obtained coefficient values (S 8322 ). For example, the three-dimensional data decoding device re-orders a plurality of high-frequency components in Morton order. 
     The three-dimensional data decoding device then obtains a low-frequency component to be processed and a high-frequency component to be processed, which are the low-frequency component and the high-frequency component of the three-dimensional point pair to be processed (S 8323  and S 8324 ). Specifically, the low-frequency component to be processed for the top layer is the low-frequency component decoded from the bitstream, and the low-frequency component to be processed for the layers other than the top layer is the low-frequency component obtained by the inverse transform processing in the layer directly above the layer. The high-frequency component to be processed for the top layer is the leading high-frequency component of the high-frequency components re-ordered in Morton order. Note that, when there is no three-dimensional point pair, there is no high-frequency component to be processed. 
     When there is a three-dimensional point pair (if Yes in S 8325 ), that is, when there is a high-frequency component to be processed, the three-dimensional data decoding device generates a low-frequency component for the layer directly below the layer by performing the inverse integer Haar transform using the low-frequency component to be processed and the high-frequency component to be processed (S 8326 ). Note that, when the current layer is the bottom layer, attribute information is generated by the inverse integer Haar transform. 
     The three-dimensional data decoding device stores the generated low-frequency component in a memory or the like for the processing for the subsequent layer (S 8327 ). 
     On the other hand, when there is no three-dimensional point pair if No in S 8325 ), the three-dimensional data decoding device stores the low-frequency component to be processed in the memory or the like for the subsequent layer (S 8327 ). 
     When the coefficient value (three-dimensional point pair) to be processed is not the last coefficient value in the current layer (if No in S 8328 ), the three-dimensional data decoding device selects the subsequent three-dimensional point pair in Morton order as a three-dimensional point to be processed, and performs step S 8323  and the following process on the selected three-dimensional point pair. 
     When the coefficient value to be processed is the last coefficient value in the current layer (if Yes in S 8328 ), the three-dimensional data decoding device starts the processing for the subsequent layer (the layer directly below the layer) (S 8329 ). When the former current layer is not the last layer (bottom layer) (if No in S 8330 ), the three-dimensional data decoding device selects the first three-dimensional point pair in Morton order in the subsequent layer as a three-dimensional point pair to be processed, and performs step S 8323  and the following process on the selected three-dimensional point pair. 
     When the former current layer is the last layer of Yes in S 8330 ), the three-dimensional data decoding device ends the processing. By the processing described above, the attribute information on all the three-dimensional points is obtained. 
     Next, example configurations of integer Haar transformer  8324  and inverse integer Haar transformer  8344  will be described.  FIG. 61  is a diagram showing an example configuration of integer Haar transformer  8324 . As shown in  FIG. 61 , integer Haar transformer  8324  includes subtractor  8351 , right shifter  8352 , and adder  8353 . Here, C 1  and C 2  represent attribute information on a three-dimensional point pair for the bottom layer, and represent low-frequency components of a three-dimensional point pair obtained in the layer directly below the layer for a layer other than the bottom layer. H represents a high-frequency component of a three-dimensional point pair, and L represents a low-frequency component of a three-dimensional point pair. With the configuration in the drawing, the calculations expressed by (Equation O18) and (Equation O19) are implemented. 
       FIG. 62  is a diagram showing an example configuration of inverse integer Haar transformer  8344 . As shown in  FIG. 62 , inverse integer Haar transformer  8344  includes right shifter  8354 , subtractor  8355 , and adder  8356 . With the configuration in the drawing, the calculations expressed by (Equation O20) and (Equation O21) are implemented. 
     Note that, in at least any one of the forward transform and the inverse transform, input data may be divided into a plurality of pieces of data on a predetermined unit basis, and the resulting divisional data may be processed in parallel. In this way, the processing speed can be increased. 
     Next, an example where the encoding is switched between the reversible encoding (integer Haar transform) and the irreversible encoding (RAHT) will be described.  FIG. 63  is a diagram showing a configuration of a three-dimensional data encoding device in this case. The three-dimensional data encoding device selectively performs the reversible encoding (reversible compression) or the irreversible encoding (irreversible compression). The three-dimensional data encoding device may indicate the encoding mode with a flag or QP. 
     The three-dimensional data encoding device shown in  FIG. 63  includes re-ordering unit  8361 , switcher  8362 , RAHT unit  8363 , quantizer  8364 , integer transformer  8365 , and entropy encoder  8366 . 
     Re-ordering unit  8361  re-orders attribute information in Morton order, for example, based on geometry information. Switcher  8362  outputs the re-ordered attribute information to RAHT unit  8363  or integer transformer  8365 . For example, switcher  8362  switches between using the RAHT and using the integer Haar transform based on LOSSLESS_FLAG. Here, LOSSLESS_FLAG is a flag that indicates which of RAHT (irreversible encoding) and the integer Haar transform (reversible encoding) is to be used. The integer Haar transform (reversible encoding) is used when LOSSLESS_FLAG is on (a value of 1, for example), and RAHT (irreversible encoding) is used when LOSSLESS_FLAG is off (a value of 0, for example). 
     Alternatively, the three-dimensional data encoding device may determine to use the reversible encoding when the value of quantization parameter QP is particular value a. Here, value a is a value with which the quantized value or the value of quantization step Qstep calculated from the QP value is 1. For example, if Qstep=1 when QP=4, α=4. 
     The switching between RAHT and the integer Haar transform is not exclusively performed based on LOSSLESS_FLAG or QP value, but can be performed in any manner. For example, the three-dimensional data encoding device may add an Enable_Integer_Haar_Transform flag to the header or the like, and applies the integer Haar transform when Enable_Integer_Haar_Transform=1, and apply RAHT when Enable_Integer_Haar_Transform=0. 
     RAHT unit  8363  generates a coefficient value by applying RAHT to the attribute information. Quantizer  8364  generates a quantized coefficient by quantizing the coefficient value. integer transformer  8365  generates a coefficient value by applying the integer Haar transform on the attribute information. Entropy encoder  8366  generates encoded attribute information by entropy-encoding the quantized value generated by quantizer  8364  or the coefficient value generated by integer transformer  8365 . 
       FIG. 64  is a diagram showing a configuration of a three-dimensional data decoding device corresponding to the three-dimensional data encoding device shown in  FIG. 63 . The three-dimensional data decoding device shown in  FIG. 64  includes entropy decoder  8371 , re-ordering unit  8372 , switcher  8373 , inverse quantizer  8374 , inverse RAHT unit  8375 , and inverse integer transformer  8376 . 
     Entropy decoder  8371  generates coefficient values (or quantized coefficients) by entropy-decoding encoded attribute information. Re-ordering unit  8372  re-orders the coefficient values in Morton order, for example, based on geometry information. Switcher  8373  outputs the re-ordered coefficient values to inverse quantizer  8374  or inverse integer transformer  8376 . For example, switcher  8373  switches between using RAHT and using the integer Haar transform based on LOSSLESS_FLAG. Note that the way of switching by switcher  8373  is the same as the way of switching by switcher  8362  described above. Note that the three-dimensional data decoding device obtains LOSSLESS_FLAG, the QP value, or the Enable_Integer_Haar_Transform flag from the bitstream. 
     Inverse quantizer  8374  generates a coefficient value by inverse-quantizing the quantized coefficient. Inverse RAHT unit  8375  generates attribute information by applying inverse RAHT on the coefficient value. Inverse integer transformer  8376  generates attribute information by applying the inverse integer Haar transform on the coefficient value. 
     Note that, although no quantization processing is performed when the integer Haar transform is applied in the example shown in  FIG. 63  and  FIG. 64 , a quantization processing may be performed when the integer Haar transform is applied.  FIG. 65  is a diagram showing a configuration of a three-dimensional data encoding device in that case.  FIG. 66  is a diagram showing a configuration of a three-dimensional data decoding device in that case. 
     As shown in  FIG. 65 , quantizer  8364 A generates quantized coefficients by quantizing the coefficient value generated by RAHT unit  8363  and the coefficient value generated by integer transformer  8365 . 
     As shown in  FIG. 66 , inverse quantizer  8374 A generates coefficient values by inverse-quantizing the quantized coefficients. 
       FIG. 67  and  FIG. 68  are diagrams showing example configurations of the bitstream (encoded attribute information) generated by the three-dimensional data encoding device. For example, as shown in  FIG. 67 , LOSSLESS_FLAG is stored in the header of the bitstream. Alternatively, as shown in  FIG. 68 , the QP value is included in the header of the bitstream. The reversible encoding is applied when the QP value is predetermined value a. 
     Embodiment 9 
     In this embodiment, an integer RAHT, which is an irreversible transform closer to the reversible transform than the normal RAHT, will be described. In order to facilitate the implementation of the hardware, a fixed point RAHT can be introduced. The fixed point RAHT can be implemented according to the following (Equation O22) and (Equation O23). Here, l represents a low-frequency component, and h represents a high-frequency component. c 1  and c 2  represent attribute information on a three-dimensional point pair for the bottom layer, and represent low-frequency components of a three-dimensional point pair obtained in the layer directly below the layer for a layer other than the bottom layer. The transform is orthonormal, and (Equation O24) holds. 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               7 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   
                     [ 
                     
                       
                         
                           l 
                         
                       
                       
                         
                           h 
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             a 
                           
                           
                             b 
                           
                         
                         
                           
                             
                               - 
                               b 
                             
                           
                           
                             a 
                           
                         
                       
                       ] 
                     
                     ⁡ 
                     
                       [ 
                       
                         
                           
                             
                               c 
                               1 
                             
                           
                         
                         
                           
                             
                               c 
                               2 
                             
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O22 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     a 
                     = 
                     
                       
                         
                           w 
                           1 
                         
                       
                       
                         
                           
                             w 
                             1 
                           
                           + 
                           
                             w 
                             2 
                           
                         
                       
                     
                   
                   , 
                   
                       
                   
                   ⁢ 
                   
                     b 
                     = 
                     
                       
                         
                           w 
                           1 
                         
                       
                       
                         
                           
                             w 
                             1 
                           
                           + 
                           
                             w 
                             2 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O23 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       a 
                       2 
                     
                     + 
                     
                       b 
                       2 
                     
                   
                   = 
                   
                     
                       
                         
                           w 
                           1 
                         
                         
                           
                             w 
                             1 
                           
                           + 
                           
                             w 
                             2 
                           
                         
                       
                       + 
                       
                         
                           w 
                           2 
                         
                         
                           
                             w 
                             1 
                           
                           + 
                           
                             w 
                             2 
                           
                         
                       
                     
                     = 
                     1 
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O24 
                   
                   ) 
                 
               
             
           
         
       
     
     Weight w after the update is expressed as w=w 1 +w 2  when c 1  and c 2  are a three-dimensional point pair, and is expressed as w=w 1  when c 1  and c 2  are not a pair. 
     The above (Equation O22) is transformed into the following (Equation O25) to (Equation O29). 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               8 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   
                     [ 
                     
                       
                         
                           l 
                         
                       
                       
                         
                           h 
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               
                                 
                                   w 
                                   1 
                                 
                               
                               
                                 
                                   
                                     w 
                                     1 
                                   
                                   + 
                                   
                                     w 
                                     2 
                                   
                                 
                               
                             
                           
                           
                             
                               
                                 
                                   w 
                                   2 
                                 
                               
                               
                                 
                                   
                                     w 
                                     1 
                                   
                                   + 
                                   
                                     w 
                                     2 
                                   
                                 
                               
                             
                           
                         
                         
                           
                             
                               - 
                               
                                 
                                   
                                     w 
                                     2 
                                   
                                 
                                 
                                   
                                     
                                       w 
                                       1 
                                     
                                     + 
                                     
                                       w 
                                       2 
                                     
                                   
                                 
                               
                             
                           
                           
                             
                               
                                 
                                   w 
                                   1 
                                 
                               
                               
                                 
                                   
                                     w 
                                     1 
                                   
                                   + 
                                   
                                     w 
                                     2 
                                   
                                 
                               
                             
                           
                         
                       
                       ] 
                     
                     ⁡ 
                     
                       [ 
                       
                         
                           
                             
                               c 
                               1 
                             
                           
                         
                         
                           
                             
                               c 
                               2 
                             
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O25 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     [ 
                     
                       
                         
                           
                             l 
                             
                               
                                 
                                   w 
                                   1 
                                 
                                 + 
                                 
                                   w 
                                   2 
                                 
                               
                             
                           
                         
                       
                       
                         
                           h 
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               
                                 w 
                                 1 
                               
                               
                                 
                                   w 
                                   1 
                                 
                                 + 
                                 
                                   w 
                                   2 
                                 
                               
                             
                           
                           
                             
                               
                                 w 
                                 2 
                               
                               
                                 
                                   w 
                                   1 
                                 
                                 + 
                                 
                                   w 
                                   2 
                                 
                               
                             
                           
                         
                         
                           
                             
                               - 
                               
                                 
                                   
                                     
                                       w 
                                       1 
                                     
                                   
                                   ⁢ 
                                   
                                     
                                       w 
                                       2 
                                     
                                   
                                 
                                 
                                   
                                     
                                       w 
                                       1 
                                     
                                     + 
                                     
                                       w 
                                       2 
                                     
                                   
                                 
                               
                             
                           
                           
                             
                               
                                 
                                   
                                     w 
                                     1 
                                   
                                 
                                 ⁢ 
                                 
                                   
                                     w 
                                     2 
                                   
                                 
                               
                               
                                 
                                   
                                     w 
                                     1 
                                   
                                   + 
                                   
                                     w 
                                     2 
                                   
                                 
                               
                             
                           
                         
                       
                       ] 
                     
                     ⁡ 
                     
                       [ 
                       
                         
                           
                             
                               
                                 c 
                                 1 
                               
                               
                                 
                                   w 
                                   1 
                                 
                               
                             
                           
                         
                         
                           
                             
                               
                                 c 
                                 2 
                               
                               
                                 
                                   w 
                                   2 
                                 
                               
                             
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O26 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     [ 
                     
                       
                         
                           
                             l 
                             
                               
                                 
                                   w 
                                   1 
                                 
                                 + 
                                 
                                   w 
                                   2 
                                 
                               
                             
                           
                         
                       
                       
                         
                           
                             
                               h 
                               ⁢ 
                               
                                 
                                   
                                     w 
                                     1 
                                   
                                   + 
                                   
                                     w 
                                     2 
                                   
                                 
                               
                             
                             
                               
                                 
                                   w 
                                   1 
                                 
                                 ⁢ 
                                 
                                   w 
                                   2 
                                 
                               
                             
                           
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               
                                 w 
                                 1 
                               
                               
                                 
                                   w 
                                   1 
                                 
                                 + 
                                 
                                   w 
                                   2 
                                 
                               
                             
                           
                           
                             
                               
                                 w 
                                 2 
                               
                               
                                 
                                   w 
                                   1 
                                 
                                 + 
                                 
                                   w 
                                   2 
                                 
                               
                             
                           
                         
                         
                           
                             
                               - 
                               1 
                             
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                     ⁡ 
                     
                       [ 
                       
                         
                           
                             
                               
                                 c 
                                 1 
                               
                               
                                 
                                   w 
                                   1 
                                 
                               
                             
                           
                         
                         
                           
                             
                               
                                 c 
                                 2 
                               
                               
                                 
                                   w 
                                   2 
                                 
                               
                             
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O27 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     [ 
                     
                       
                         
                           
                             l 
                             ′ 
                           
                         
                       
                       
                         
                           
                             h 
                             ′ 
                           
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               a 
                               2 
                             
                           
                           
                             
                               b 
                               2 
                             
                           
                         
                         
                           
                             
                               - 
                               1 
                             
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                     ⁡ 
                     
                       [ 
                       
                         
                           
                             
                               c 
                               1 
                               ′ 
                             
                           
                         
                         
                           
                             
                               c 
                               2 
                               ′ 
                             
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                       
                           
                       
                       ⁢ 
                       
                           
                       
                     
                     ⁢ 
                     O28 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       l 
                       ′ 
                     
                     = 
                     
                       l 
                       
                         
                           
                             w 
                             1 
                           
                           + 
                           
                             w 
                             2 
                           
                         
                       
                     
                   
                   , 
                   
                       
                   
                   ⁢ 
                   
                     
                       h 
                       ′ 
                     
                     = 
                     
                       
                         h 
                         ⁢ 
                         
                           
                             
                               w 
                               1 
                             
                             + 
                             
                               w 
                               2 
                             
                           
                         
                       
                       
                         
                           
                             w 
                             1 
                           
                           ⁢ 
                           
                             w 
                             2 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                       
                           
                       
                       ⁢ 
                       
                           
                       
                     
                     ⁢ 
                     O29 
                   
                   ) 
                 
               
             
           
         
       
     
     Therefore, the forward transform is expressed by (Equation O30) to (Equation O32). 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               9 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   
                     [ 
                     
                       
                         
                           
                             l 
                             ′ 
                           
                         
                       
                       
                         
                           
                             h 
                             ′ 
                           
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               a 
                               2 
                             
                           
                           
                             
                               b 
                               2 
                             
                           
                         
                         
                           
                             
                               - 
                               1 
                             
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                     ⁡ 
                     
                       [ 
                       
                         
                           
                             
                               c 
                               1 
                               ′ 
                             
                           
                         
                         
                           
                             
                               c 
                               2 
                               ′ 
                             
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O30 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     h 
                     ′ 
                   
                   = 
                   
                     
                       c 
                       2 
                       ′ 
                     
                     - 
                     
                       c 
                       1 
                       ′ 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O31 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     l 
                     ′ 
                   
                   = 
                   
                     
                       
                         
                           a 
                           2 
                         
                         ⁢ 
                         
                           c 
                           1 
                           ′ 
                         
                       
                       + 
                       
                         
                           b 
                           2 
                         
                         ⁢ 
                         
                           c 
                           2 
                           ′ 
                         
                       
                     
                     = 
                     
                       
                         c 
                         1 
                         ′ 
                       
                       + 
                       
                         
                           b 
                           2 
                         
                         ⁢ 
                         
                           h 
                           ′ 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O32 
                   
                   ) 
                 
               
             
           
         
       
     
     The inverse transform is expressed by (Equation O33) to (Equation O34). 
       [Math. 10] 
         c   1   ′=l′−b   2   h′   (Equation O33)
 
         c   2   ′=h′+c   1 ′  (Equation O34)
 
     An adjusted quantization step (Aqs: Adjusted Quantization Step) is expressed by (Equation O36) based on (Equation O35). Therefore, (Equation O37) holds. In this way, the integer RAHT can be implemented by fixed point implementation of b 2 . 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               11 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   
                     h 
                     ′ 
                   
                   = 
                   
                     
                       h 
                       ⁢ 
                       
                         
                           
                             w 
                             1 
                           
                           + 
                           
                             w 
                             2 
                           
                         
                       
                     
                     
                       
                         
                           w 
                           1 
                         
                         ⁢ 
                         
                           w 
                           2 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O35 
                   
                   ) 
                 
               
             
             
               
                 
                   Aqs 
                   = 
                   
                     
                       QS 
                       ⁢ 
                       
                         
                           
                             w 
                             1 
                           
                           + 
                           
                             w 
                             2 
                           
                         
                       
                     
                     
                       
                         
                           w 
                           1 
                         
                         ⁢ 
                         
                           w 
                           2 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O36 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       h 
                       ′ 
                     
                     Aqs 
                   
                   = 
                   
                     h 
                     QS 
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O37 
                   
                   ) 
                 
               
             
           
         
       
     
     In the following, a relationship between the integer RAHT and the integer Haar transform will be described. The integer RAHT and the integer Haar transform can be implemented by a common processing. Specifically, the integer Haar transform can be implemented by setting the weights for all the layers in RAHT so that w 1 =w 2 =1. 
     That is, the forward transform in the integer RAHT is expressed by (Equation O38) to (Equation O40), and the inverse transform is expressed by (Equation O41) to (Equation O42). In addition, (Equation O43) holds. 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               12 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   
                     [ 
                     
                       
                         
                           
                             l 
                             ′ 
                           
                         
                       
                       
                         
                           
                             h 
                             ′ 
                           
                         
                       
                     
                     ] 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           
                             
                               a 
                               2 
                             
                           
                           
                             
                               b 
                               2 
                             
                           
                         
                         
                           
                             
                               - 
                               1 
                             
                           
                           
                             1 
                           
                         
                       
                       ] 
                     
                     ⁡ 
                     
                       [ 
                       
                         
                           
                             
                               c 
                               1 
                               ′ 
                             
                           
                         
                         
                           
                             
                               c 
                               2 
                               ′ 
                             
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O38 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     h 
                     ′ 
                   
                   = 
                   
                     
                       c 
                       2 
                       ′ 
                     
                     - 
                     
                       c 
                       1 
                       ′ 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O39 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     l 
                     ′ 
                   
                   = 
                   
                     
                       c 
                       1 
                       ′ 
                     
                     + 
                     
                       
                         b 
                         2 
                       
                       ⁢ 
                       
                         h 
                         ′ 
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O40 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     c 
                     1 
                     ′ 
                   
                   = 
                   
                     
                       l 
                       ′ 
                     
                     - 
                     
                       
                         b 
                         2 
                       
                       ⁢ 
                       
                         h 
                         ′ 
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                       
                           
                       
                       ⁢ 
                       
                           
                       
                     
                     ⁢ 
                     O41 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     c 
                     2 
                     ′ 
                   
                   = 
                   
                     
                       h 
                       ′ 
                     
                     + 
                     
                       c 
                       1 
                       ′ 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                       
                           
                       
                       ⁢ 
                       
                           
                       
                     
                     ⁢ 
                     O42 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     
                       a 
                       2 
                     
                     = 
                     
                       
                         w 
                         1 
                       
                       
                         
                           w 
                           1 
                         
                         + 
                         
                           w 
                           2 
                         
                       
                     
                   
                   , 
                   
                       
                   
                   ⁢ 
                   
                     
                       b 
                       2 
                     
                     = 
                     
                       
                         w 
                         2 
                       
                       
                         
                           w 
                           1 
                         
                         + 
                         
                           w 
                           2 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                       
                           
                       
                       ⁢ 
                       
                           
                       
                     
                     ⁢ 
                     O43 
                   
                   ) 
                 
               
             
           
         
       
     
     In (Equation O38) to (Equation O43), if the weight is set so that w 1 =w 2 =1, the forward transform is expressed by (Equation O44) to (Equation O45), and the inverse transform is expressed by (Equation O46) to (Equation O47). That is, the integer Haar transform is implemented. 
       [Math. 13] 
         h′=c   2   ′−c   1 ′  (Equation O44)
 
         l′=c   1   ′+h′/ 2  (Equation O45)
 
         c   1   ′=l′−h′/ 2  (Equation O46)=
 
         c   2   ′=h′+c   1 ′  (Equation O47)
 
     Next, an example will be described in which switching occurs between the irreversible encoding (RAHT), the irreversible encoding (integer RAHT) close to the reversible encoding, and the reversible encoding (integer Haar transform).  FIG. 69  is a diagram showing a configuration of a three-dimensional data encoding device in this case. The three-dimensional data encoding device selectively performs the irreversible encoding (RAHT), the irreversible encoding (integer RAHT) close to the reversible encoding, or the reversible encoding (integer Haar transform). The switching is performed based on a flag or a QP value. 
     The three-dimensional data encoding device shown in  FIG. 69  includes re-ordering unit  8401 , integer RAHT/Haar transformer  8402 , quantizer  8403 , and entropy encoder  8404 . 
     Re-ordering unit  8401  re-orders attribute information in Morton order, for example, based on geometry information. Integer RAHT/Haar transformer  8402  generates a coefficient value by transforming the attribute information by selectively using the irreversible encoding (RAHT), the irreversible encoding (integer RAHT) close to the reversible encoding, or the reversible encoding (integer Haar transform). 
     Specifically, the three-dimensional data encoding device uses the reversible encoding (integer Haar transform) when the value of quantization parameter QP is particular value α, and RAHT-HAAR_FLAG=HAAR. Here, value α is a value with which the quantized value or the value of quantization step Qstep calculated from the QP value is 1. For example, if Qstep=1 when QP=4, α=4. Alternatively, the value of α may be different between RAHT and Haar. 
     For example, when RAHT-HAAR_FLAG=RAHT, and QP is greater than α, the irreversible encoding (RAHT) is used. When RAHT-HAAR_FLAG=RAHT, and QP=α, the irreversible encoding (integer RAHT) close to the reversible encoding is used. When RAHT-HAAR_FLAG=HAAR, and QP=α, the reversible encoding (integer Haar transform) is used. When RAHT-HAAR_FLAG=HAAR, and QP is greater than a, the irreversible encoding (RAHT) may be used. 
     When RAHT-HAAR_FLAG=HAAR, integer RAHT/Haar transformer  8402  performs the Haar transform by setting w 1 =w 2 =1. 
     Quantizer  8403  generates a quantized coefficient by quantizing the coefficient value using QP. Entropy encoder  8404  generates encoded attribute information by entropy-encoding the quantized coefficient. 
       FIG. 70  is a diagram showing a configuration of a three-dimensional data decoding device corresponding to the three-dimensional data encoding device shown in  FIG. 69 . The three-dimensional data decoding device shown in  FIG. 70  includes entropy decoder  8411 , inverse quantizer  8412 , re-ordering unit  8413 , and inverse integer RAHT/Haar transformer  8414 . 
     Entropy decoder  8411  generates quantized coefficients by entropy-decoding encoded attribute information. Inverse quantizer  8412  generates coefficient values by inverse-quantizing the quantized coefficients using QP. Re-ordering unit  8413  re-orders the coefficient values in Morton order, for example, based on geometry information. 
     Inverse integer RAHT/Haar transformer  8414  generates attribute information by inverse-transforming the coefficient values by selectively using the irreversible encoding (RAHT), the irreversible encoding (integer RAHT) close to the reversible encoding, or the reversible encoding (integer Haar transform). Note that the way of switching is the same as the way of switching by integer RAHT/Haar transformer  8402  described above. Note that the three-dimensional data decoding device obtains LOSSLESS_FLAG and the QP value from the bitstream. 
       FIG. 71  is a diagram showing an example configuration of the bitstream (encoded attribute information) generated by the three-dimensional data encoding device. For example, as shown in  FIG. 71 , RAHT-HAAR_FLAG and the QP value are stored in the header of the bitstream. RAHT-HAAR_FLAG is a flag that indicates which of the irreversible encoding (RAHT), the irreversible encoding (integer RAHT) close to the reversible encoding, and the reversible encoding (integer Haar transform) is to be used. Note that RAHT-HAAR FLAG may indicate which of the reversible encoding (integer Haar transform) and the irreversible encoding (RAHT) or the irreversible encoding (integer RAHT) close to the reversible encoding is to be used. 
     In the following, an example implementation of a configuration for performing the integer RAHT will be described. The integer RAHT can be implemented as described below. B represents the integer accuracy of b 2 , and is expressed by (Equation O48). 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               14 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   B 
                   = 
                   
                     
                       ( 
                       
                         
                           w 
                           2 
                         
                         ⪡ 
                         kBit 
                       
                       ) 
                     
                     
                       
                         w 
                         1 
                       
                       + 
                       
                         w 
                         2 
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O48 
                   
                   ) 
                 
               
             
           
         
       
     
     kBit represents the accuracy of B. For example, in the case of 8-bit accuracy, kBit=8. kHalf=(1&lt;&lt;(kBit−1)) represents the accuracy that supports a rounding (such as rounding down or rounding off). The adjusted quantization step (Aqs) can be implemented by (Equation O49). 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               15 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   Aqs 
                   = 
                   
                     
                       sqrt 
                       ⁢ 
                       _integer 
                     
                     ⁢ 
                     
                       ( 
                       
                         
                           QS 
                           * 
                           QS 
                           * 
                           
                             ( 
                             
                               
                                 w 
                                 1 
                               
                               + 
                               
                                 w 
                                 2 
                               
                             
                             ) 
                           
                         
                         
                           
                             w 
                             1 
                           
                           * 
                           
                             w 
                             2 
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O49 
                   
                   ) 
                 
               
             
           
         
       
     
     Here, QS represents a quantization step (Quantization Step). The forward transform is expressed by (Equation O50) to (Equation O51). 
       [Math. 16] 
         h′=c   2   ′−c   1 ′  (Equation O50)
 
         l′=c   1 ′+(( B*h′+k Half)&gt;&gt; k Bit)  (Equation O51)
 
     The quantized high-frequency component is expressed by (Equation O52). The inverse quantization of the high-frequency component is expressed by (Equation O53). 
       [Math. 17] 
       quantized_ h ′=((Aqs&gt;&gt;1)+( h′&lt;&lt;k Bit))/Aqs  (Equation O52)
 
         h ′=((quantized_ h ′*Aqs)+ k Half)&gt;&gt; k Bit  (Equation O53)
 
     The inverse transform is expressed by (Equation O54) to (Equation O55). 
       [Math. 18] 
         c   1   ′=l ′(( B*+k Half)&gt;&gt; k Bit)  (Equation O54)
 
         c   2   ′+h′+c   1 ′  (Equation O55)
 
     In the following, an example will be described in which the integer Haar is implemented by RAHT by using a conditional flag, setting the bit accuracy of the rounding to be 0, and setting Aqs. When the integer Haar is applied, the three-dimensional data encoding device sets the weight to be 1 (w 1 =w2=1). The three-dimensional data encoding device also sets kHalf to be 0 (kHalf=0). The three-dimensional data encoding device also switches Aqs as follows. The three-dimensional data encoding device sets Aqs=QS when using the integer Haar transform. The three-dimensional data encoding device sets Aqs=sqrt_integer (((QS*QS)*(w 1 +w2))/(w 1 *w 2 )) when using the integer RAHT. Here, sqrt_integer(n) represents the integer part of the square root of n. Therefore, (Equation O56) holds. 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               19 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   B 
                   = 
                   
                     
                       
                         ( 
                         
                           1 
                           ⪡ 
                           kBit 
                         
                         ) 
                       
                       2 
                     
                     = 
                     
                       ( 
                       
                         1 
                         ⪡ 
                         
                           ( 
                           
                             kBit 
                             - 
                             1 
                           
                           ) 
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O56 
                   
                   ) 
                 
               
             
           
         
       
     
     The forward transform of the integer Haar in RAHT is expressed by (Equation O57) to (Equation O59). 
       [Math. 20] 
         h′=c   2   ′−c   1 ′  (Equation O57)
 
         l′=c   1 ′(( B*h ′+0)&gt;&gt; k Bit)= c   1 ′+( h ′&gt;&gt;1)  (Equation O58)
 
       quantized_ h ′=((Aqs&gt;&gt;1)+( h′&lt;&lt;k Bit))/Aqs  (Equation O59)
 
     When the reversible encoding is used, QS is set to be 1, and therefore, (Equation O60) holds. When the reversible encoding is used, the quantization and the inverse quantization may be skipped. 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               21 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   
                     
                       quantized_ 
                       ⁢ 
                       h 
                     
                     ′ 
                   
                   = 
                   
                     
                       
                         
                           ( 
                           
                             1 
                             ⪢ 
                             1 
                           
                           ) 
                         
                         + 
                         
                           ( 
                           
                             
                               h 
                               ′ 
                             
                             ⪡ 
                             kBit 
                           
                           ) 
                         
                       
                       1 
                     
                     = 
                     
                       
                         h 
                         ′ 
                       
                       ⪡ 
                       kBit 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O60 
                   
                   ) 
                 
               
             
           
         
       
     
     The inverse quantization of the high-frequency component is expressed by (Equation O61). The inverse integer transform is expressed by (Equation O62) to (Equation O63). 
       [Math. 22] 
         h ′=(quantized_ h ′*Aqs)&gt;&gt; k Bit  (Equation O61)
 
         c   1   ′=l ′−(( B*h ′+0)&gt;&gt; k Bit)= l ′−( h ′&gt;&gt;1)  (Equation O62)
 
         c   2   ′=h′+c   1 ′  (Equation O63)
 
     As another example of the implementation of the reversible encoding, the bits shift calculations described below may be used. These calculations are performed for the integer data type (fixed point calculation). The attribute information is shifted up with the kBit accuracy before the transform processing. 
     When applying the integer Haar, the three-dimensional data encoding device sets the weight to be 1 (w 1 =w 2=1 ). The three-dimensional data encoding device also sets kHalf to be 0 (kHalf=0). The three-dimensional data encoding device also switches Aqs as follows. The three-dimensional data encoding device sets Aqs=QS when using the integer Haar transform. The three-dimensional data encoding device sets Aqs=sqrt_integer (((QS*QS)*(w 1 +w 2 ))/(w 1 *w2)) when using the integer RAHT. Therefore, (Equation O64) holds. 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               23 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   B 
                   = 
                   
                     
                       
                         ( 
                         
                           1 
                           ⪡ 
                           kBit 
                         
                         ) 
                       
                       2 
                     
                     = 
                     
                       ( 
                       
                         1 
                         ⪡ 
                         
                           ( 
                           
                             kBit 
                             - 
                             1 
                           
                           ) 
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O64 
                   
                   ) 
                 
               
             
           
         
       
     
     As shown by (Equation O65), the attribute information is shifted up with the kBit accuracy before the transform processing. 
       [Math. 24] 
         c   i   =c   i   &lt;&lt;k Bit  (Equation O65)
 
     The forward transform of the integer Haar in RATH is expressed by (Equation O66) to (Equation O67), and is performed with the kBit accuracy. 
       [Math. 25] 
         h′=c   2   ′−c   1 ′  (Equation O66)
 
         t _ l ′=(( B*h++k Half)&gt;&gt; k Bit)  (Equation O67)
 
     In order to remove the floating-point accuracy of B for the floor function, the kBit accuracy for the low-frequency component is removed. Therefore, the low-frequency component is expressed by (Equation O68). 
       [Math. 26] 
         l′=c   1 ′+(( t _ l′&gt;&gt;k Bit)&lt;&lt; k Bit)  (Equation O68)
 
     The inverse integer transform is expressed by (Equation O69) to (Equation O71). In this way, switching from the integer RAHT can be reduced. 
       [Math. 27] 
         t _ l ′=(( B*h′+k half)&gt;&gt; k Bit)  (Equation O69)=
 
         c   1   ′=l ′(( t _ l′&gt;&gt;   k Bit)&lt;&lt; k Bit)  (Equation O70)
 
         c   2   ′=h′+c   1 ′  (Equation O71)
 
     In the following, an example configuration for the forward transform will be described.  FIG. 72  is a diagram showing an example configuration of integer RAHT/Haar transformer  8402 . Integer RAHT/Haar transformer  8402  includes left shifters  8421 ,  8422 , and  8430 , subtractor  8423 , divider  8424 , right shifters  8425 ,  8427 , and  8329 , multiplier  8426 , switcher  8428 , and adder  8431 . 
     Left shifters  8421  and  8422  shift up (shift to the left) c1 and c2 by kBit when c1 and c2 are original signals (signals located in the bottom layer of RAHT) of attribute information. As a result, the bit accuracy of the original signals increases, and therefore, the calculation accuracy of the transform processing can be improved. Therefore, the encoding efficiency can be improved. When c1 and c2 are signals in a layer higher than the bottom layer of RAHT, the kBit shift-up need not be applied. 
     Note that, when the integer Haar transform is applied, and QS=1 (which means the reversible encoding), the three-dimensional data encoding device need not apply the kBit shift-up to the original signals of the attribute information located in the bottom layer of RAHT. In this way, the reversible encoding can be achieved while reducing the processing amount. 
     Subtractor  8423  subtracts shifted-up c1 from shifted-up c2. Divider  8424  divides the value obtained by subtractor  8423  by Aqs. Here, Aqs is expressed by (Equation O72). integer_square_root(n) represents the integer part of the square root of n. That is, Aqs depends on QS (quantization step) and the weight. When the integer Haar transform is used, Aqs is set so that Aqs=QS. 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               28 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   Aqs 
                   = 
                   
                     integer_square 
                     ⁢ 
                     _root 
                     ⁢ 
                     
                       ( 
                       
                         
                           QS 
                           * 
                           QS 
                           * 
                           
                             ( 
                             
                               
                                 w 
                                 1 
                               
                               + 
                               
                                 w 
                                 2 
                               
                             
                             ) 
                           
                         
                         
                           
                             w 
                             1 
                           
                           * 
                           
                             w 
                             2 
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O72 
                   
                   ) 
                 
               
             
           
         
       
     
     Right shifter  8425  generates high-frequency component h by shifting down the value obtained by divider  8424 . Multiplier  8426  multiplies the value obtained by subtractor  8423  by B. B is expressed by (Equation O73). When the integer Haar transformer is used, the weight is set so that w 1 =w 2 =1. 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               29 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   B 
                   = 
                   
                     
                       ( 
                       
                         
                           w 
                           2 
                         
                         ⪡ 
                         kBit 
                       
                       ) 
                     
                     
                       
                         w 
                         1 
                       
                       + 
                       
                         w 
                         2 
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     O73 
                   
                   ) 
                 
               
             
           
         
       
     
     Right shifter  8427  shifts down the value obtained by multiplier  8426 . Switcher  8428  outputs the value obtained by right shifter  8427  to right shifter  8429  when the integer Haar transformer is used, and outputs the value obtained by right shifter  8427  to adder  8431  when the integer Haar transformer is not used. 
     When the integer Haar transformer is applied, right shifter  8429  shifts down the value obtained by right shifter  8427  by kBit, and left shifter  8430  shifts up the value obtained by right shifter  8427  by kBit. In this way, the values of lower-order kBit bits are set to be 0. That is, the digits after the decimal point resulting from the division by a value of 2 when the integer Haar transformer is applied can be deleted, and thus, the processing of rounding a value down (floor processing) can be achieved. Note that any method that can achieve the process of rounding a value down can be applied. 
     Note that, when QS&gt;1 (which means the irreversible encoding) in the integer Haar transformer, the kBit shift down and the kBit shift up need not be applied to the value obtained by right shifter  8427 . In this way, the accuracy after the decimal point resulting from the division by a value of 2 can be maintained when the integer Haar transformer is applied. Therefore, the calculation accuracy and the encoding efficiency are improved. 
     When the original signals (located in the bottom layer of RAHT) of the attribute information are not shifted up by kBit, the kBit shift down and the kBit shift up need not be applied to the value obtained by right shifter  8427 . In this way, the processing amount can be reduced. 
     Adder  8431  generates low-frequency component 1 by adding the value obtained by left shifter  8430  or right shifter  8427  to the value obtained by left shifter  8421 . Note that, in the calculation for the top layer, resulting low-frequency component 1 is subjected to the kBit shift down. 
     Next, an example configuration for the inverse transform will be described.  FIG. 73  is a diagram showing an example configuration of inverse integer RAHT/Haar transformer  8414 . Inverse integer RAHT/Haar transformer  8414  includes left shifters  8441  and  8447 , multipliers  8442 ,  8443 , and  8449 , right shifters  8444 ,  8446 ,  8450 , and  8452 , switcher  8445 , and subtractors  8448  and  8451 . 
     Left shifter  8441  shifts up (shifts to the left) high-frequency component h by kBit. Multiplier  8442  multiplies the value obtained by left shifter  8441  by Aqs. Note that Aqs is the same as Aqs described above with reference to  FIG. 72 . Multiplier  8443  multiplies the value obtained by multiplier  8442  by B. Note that B is the same as B described above with reference to  FIG. 72 . 
     Right shifter  8444  shifts down the value obtained by multiplier  8443 . Switcher  8445  outputs the value obtained by right shifter  8444  to right shifter  8446  when the integer Haar transformer is used, and outputs the value obtained by right shifter  8444  to subtractor  8448  when the integer Haar transformer is not used. 
     When the integer Haar transformer is applied, right shifter  8446  shifts down the value obtained by right shifter  8444  by kBit, and left shifter  8447  shifts up the value obtained by right shifter  8444  by kBit. In this way, the values of lower-order kBit bits are set to be 0. That is, the digits after the decimal point resulting from the division by a value of 2 when the integer Haar transformer is applied can be deleted, and thus, the processing of rounding a value down (floor processing) can be achieved. Note that any method that can achieve the process of rounding a value down can be applied. 
     Note that, when QS&gt;1 (which means the irreversible encoding) in the integer Haar transformer, the kBit shift down and the kBit shift up need not be applied to the value obtained by right shifter  8444 . In this way, the accuracy after the decimal point resulting from the division by a value of 2 can be maintained when the integer Haar transformer is applied. Therefore, a bitstream improved in the calculation accuracy and the encoding efficiency can be properly decoded. 
     When the decoded signals (located in the bottom layer of RAHT) of the attribute information are not shifted down by kBit, the kBit shift down and the kBit shift up need not be applied to the value obtained by right shifter  8444 . In this way, the processing amount can be reduced. 
     Subtractor  8448  subtracts the value obtained by left shifter  8447  or right shifter  8444  from low-frequency component 1. Note that, in the calculation for the top layer, low-frequency component 1 is shifted up by kBit, and subtractor  8448  subtracts the value obtained by left shifter  8447  or right shifter  8444  from shifted-up low-frequency component 1. 
     Multiplier  8449  multiplies the value obtained by subtractor  8448  by −1. Right shifter  8450  shifts down the value obtained by multiplier  8449  by kBit. Subtractor  8451  subtracts the value obtained by subtractor  8448  from the value obtained by multiplier  8442 . Right shifter  8452  shifts down the value obtained by subtractor  8451  by kBit. In this way, the original bit accuracy of c1 and c2 is recovered. By this processing, the decoding result can be obtained with the original bit accuracy while improving the calculation accuracy of the transform processing. The three-dimensional data decoding device need not apply the kBit shift down to any signal in a layer higher than the bottom layer of RAHT. 
     Note that, when the integer Haar transform is applied, and QS=1 (which means the reversible encoding), the three-dimensional data decoding device need not apply the kBit shift-up to the decoded signals of the attribute information located in the bottom layer of RAHT. In this way, a reversibly encoded bitstream can be properly decoded while reducing the processing amount. 
     As stated above, the three-dimensional data encoding device according to the present embodiment performs the process shown by  FIG. 74 . The three-dimensional data encoding device converts pieces of attribute information of three-dimensional points included in point cloud data into coefficient values (S 8401 ), and encodes the coefficient values to generate a bitstream (S 8402 ). In the converting (S 8401 ), the three-dimensional data encoding device performs weighting calculation hierarchically to generate the coefficient values belonging to one of layers, the weighting calculation separating each of the pieces of attribute information into a high-frequency component and a low-frequency component. In the weighting calculation, the three-dimensional data encoding device performs the weighting calculation using weights fixed or not fixed in the layers. The bitstream includes first information (at least one of RAHT-HAAR_FLAG or QP) indicating whether to fix the weights in the layers. 
     With this, since the three-dimensional data encoding device is capable of reducing the loss caused by the transform, by fixing the weight for a plurality of layers, the three-dimensional data encoding device is capable of improving the accuracy. 
     For example, when the weights are fixed in the layers, the weights are fixed to 1. 
     For example, as shown by  FIG. 72 , in the weighting calculation, the three-dimensional data encoding device subtracts first attribute information (e.g., c1) from second attribute information (e.g., c2) to calculate a first value, the first attribute information and the second attribute information being included in the pieces of attribute information, and divides the first value by a first coefficient (e.g., Aqs) to calculate the high-frequency component (e.g., h). The first coefficient (e.g., Aqs) depends on a quantization step (e.g., QS) and the weights (e.g., w 1 , w 2 ). 
     For example, as shown by  FIG. 72 , in the weighting calculation, the three-dimensional data encoding device multiplies the first value by a second coefficient (e.g., B) depending on the weights to calculate a second value, shifts down the second value by a predetermined bit count and shifts up the second value by the predetermined bit count to calculate a third value, and adds the third value to the first attribute information to calculate the low-frequency component (e.g., 1). 
     For example, the three-dimensional data encoding device includes a processor and memory, and the processor performs the above process using the memory. 
     The three-dimensional data decoding device according to the present embodiment performs the process shown by  FIG. 75 . The three-dimensional data decoding device obtains, from a bitstream, first information (at least one of RAHT-HAAR_FLAG or QP) indicating whether to fix weights in layers (S 8411 ), decodes coefficient values from the bitstream (S 8412 ), and reverse converts the coefficient values to generate pieces of attribute information of three-dimensional points included in point cloud data (S 8413 ). The coefficient values belong to one of the layers. In the reverse converting, the three-dimensional data decoding device performs inverse weighting calculation to generate the pieces of attribute information, the inverse weighting calculation combining the coefficient values with a high-frequency component and a low-frequency component. In the inverse weighting calculation, the three-dimensional data decoding device performs the inverse weighting calculation using the weights fixed or not fixed in the layers, according to the first information. 
     With this, since the three-dimensional data decoding device is capable of reducing the loss caused by the transform, by fixing the weight for a plurality of layers, the three-dimensional data decoding device is capable of improving the accuracy. 
     For example, when the weights are fixed in the layers, the weights are fixed to 1. 
     For example, as shown by  FIG. 73 , in the inverse weighting calculation, the three-dimensional data decoding device multiplies the high-frequency component by a first coefficient (e.g., Aqs) to calculate a first value, calculates first attribute information (e.g., c1) included in the pieces of attribute information from a second value based on the low-frequency component (e.g.,  1 ), and subtracts the second value from the first value to calculate second attribute information (e.g., c2) included in the pieces of attribute information. The first coefficient (e.g., Aqs) depends on a quantization step (e.g., QS) and the weights (e.g., w 1 , w 2 ). 
     For example, as shown by  FIG. 73 , in the inverse weighting calculation, the three-dimensional data decoding device multiplies the first value by a second coefficient (e.g., B) depending on the weights to calculate a third value, shifts down the third value by a predetermined bit count and shifts up the third value by the predetermined bit count to calculate a fourth value, and subtracts the low-frequency component from the fourth value to calculate the second value. 
     For example, the three-dimensional data decoding device includes a processor and memory, and the processor performs the above process using the memory. 
     Embodiment 10 
     In the present embodiment, a region adaptive hierarchical transform (RAHT) process or a Haar transform process using prediction will be described.  FIG. 76  is a diagram for describing a prediction process and illustrates a hierarchical structure in the RAHT process or the Haar transform process. At the time of hierarchical encoding using the RAHT or the Haar transform, a three-dimensional data encoding device may predict attribute values (items of attribute information) of a low layer from attribute values of a high layer and may encode difference values between the attribute values of the low layer and their predicted values obtained by the prediction. For example, when hierarchically repeating the encoding from a high layer toward a low layer to encode attribute values of each layer, the three-dimensional data encoding device uses attribute values calculated at the high layer (attribute values of a parent node group) to predict attribute values of the low layer (attribute values of a child node group). The three-dimensional data encoding device may encode, instead of an attribute value of each child node, a difference value resulting from subtracting a predicted value from the attribute value of each child node. According to the above, the difference values of attribute values of a low layer can be reduced by generating appropriate predicted values from attribute values of a high layer, thereby improving the coding efficiency. Note that the same prediction process may be performed by the three-dimensional data decoding device. 
       FIG. 77  is a diagram illustrating an example of the relation among nodes in an octree structure based on items of geometry information on three-dimensional points. As illustrated in  FIG. 77 , the three-dimensional data encoding device predicts an attribute value of a child node from attribute values of parent nodes or neighboring parent nodes. Here, a plurality of nodes belonging to the same layer as a parent node will be referred to as a parent node group. A plurality of child nodes of the parent node will be referred to as a child node group. Neighboring parent nodes are nodes that are included in the parent node group, are different from the parent node, and neighbor the parent node. Note that a parent node group may include some of the plurality of nodes belonging to the same layer as the parent node. For example, a parent node group may include a parent node and its plurality of neighboring parent nodes. Alternatively, a parent node group may include nodes within a predetermined distance from a parent node (or a current node). 
     An item of attribute information of a node belonging to a high layer such as a parent node is calculated from, for example, items of attribute information of a low layer of the node. For example, an item of attribute information of a parent node is an average value of a plurality of items of attribute information of a plurality of child nodes of the parent node. Note that the method for calculating an item of attribute information of a node belonging to a high layer is not limited to calculating an arithmetic average and may be another method such as calculating a weighted average. 
     For example, the three-dimensional data encoding device may calculate distances d between a current node that is a child node to be subjected to the encoding and its parent nodes or neighboring parent nodes in a three-dimensional space and uses a weighted average value calculated with the distances d as a predicted value. For example, a predicted value cp of a child node c may be calculated by the following (Equation P1) and (Equation P2). Ai denotes a value of an item of attribute information of a parent node pi, and d(c,pi) is a distance, which is a Euclidean distance for example, between the child node c and the parent node pi. The symbol n denotes the total number of parent nodes and neighboring parent nodes used for generating the predicted value. 
     
       
         
           
             [ 
             
               Math 
               . 
               
                   
               
               ⁢ 
               30 
             
             ] 
           
         
       
       
         
           
             
               
                 
                   cp 
                   = 
                   
                     
                       ∑ 
                       
                         i 
                         = 
                         0 
                       
                       n 
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       
                         w 
                         i 
                       
                       × 
                       
                         A 
                         i 
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     P1 
                   
                   ) 
                 
               
             
             
               
                 
                   
                     w 
                     i 
                   
                   = 
                   
                     
                       d 
                       ⁡ 
                       
                         ( 
                         
                           c 
                           , 
                           pi 
                         
                         ) 
                       
                     
                     
                       
                         ∑ 
                         
                           j 
                           = 
                           0 
                         
                         n 
                       
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       
                         d 
                         ⁡ 
                         
                           ( 
                           
                             c 
                             , 
                             pj 
                           
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     Equation 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     P2 
                   
                   ) 
                 
               
             
           
         
       
     
     Alternatively, the three-dimensional data encoding device may use an attribute value of a parent node or a neighboring parent node as it is as the predicted value. For example, the three-dimensional data encoding device may use an attribute value Ap of a parent node as a predicted value of a child node or may use an attribute value Anp of a neighboring parent node as the predicted value of the child node. Alternatively, the three-dimensional data encoding device may select whether to use a calculated value (e.g., a weighted average value) calculated from items of attribute information of a plurality of nodes included in a parent node group or to use an attribute value of a parent node or a neighboring parent node as it is. 
     In this case, the three-dimensional data encoding device may add information indicating which of the calculated value and the attribute value of a parent node or a neighboring parent node is used as the predicted value (prediction mode) to a bitstream for each child node group, for example. This allows the three-dimensional data encoding device to select an appropriate prediction mode for each child node group, so that the coding efficiency can be improved. In addition, by adding a prediction mode to a bitstream, the three-dimensional data decoding device can generate a predicted value using the prediction mode selected by the three-dimensional data encoding device. The three-dimensional data decoding device thus can decode the bitstream appropriately. 
     Note that, rather than being added for each child node group, a prediction mode may be added for each unit larger or smaller than the child node group. For example, the three-dimensional data encoding device adds a prediction mode for every N child node group, N being an integer greater than or equal to 1, so that the coding efficiency can be improved while the overhead for encoding the prediction mode is reduced. The three-dimensional data encoding device may add a prediction mode to a header or the like such as APS. Here, APS is a parameter set of items of attribute information for each frame. 
     Next, a first example of the encoding method with prediction will be described.  FIG. 78  is a diagram illustrating the first example of the encoding method. 
     When calculating difference values between attribute values and predicted values, the three-dimensional data encoding device applies the RAHT or the Haar transform to both the attribute values and the predicted values to calculate transform coefficients of the attribute values and transform coefficients of the predicted values. The three-dimensional data encoding device determines difference values between the transform coefficients of the attribute values and the transform coefficients of the predicted values. The difference values to be encoded thus can be decreased, so that the coding efficiency can be improved. 
     In a case where the three-dimensional data encoding device selects predicted values from between the calculated values and the attribute values of parent nodes or neighboring parent nodes (in a case where a prediction mode is added to a bitstream), for example, the three-dimensional data encoding device may use the predicted values in each prediction mode to calculate the difference values of the transform coefficients, determine a cost value from a sum of absolute values of the difference values, and select a prediction mode that minimizes the cost. The prediction mode minimizing the difference values thus can be selected appropriately, so that the coding efficiency can be improved. For example, the three-dimensional data encoding device may use the following (Equation P3) to calculate a cost value cost. 
       [Math. 31] 
       cost=Σ i=0   m   |T   i   −PT   i |+λ*Predbit  (Equation P3)
 
     Here, m denotes the number of child nodes included in a child node group. The symbol λ denotes an adjustment parameter. Predbit denotes the number of bits necessary for encoding a prediction mode. Ti denotes a transform coefficient of an attribute value, and PTi denotes a transform coefficient of a predicted value. Note that this does not limit the method for selecting the prediction mode, and the prediction mode may be selected under other conditions or based on instructions or the like from the outside. As illustrated in  FIG. 78 , the three-dimensional data encoding device applies the RAHT or the Haar transform to attribute values of a child node group to calculate transform coefficients Ti of the attribute values (S 9101 ). In addition, the three-dimensional data encoding device predicts the attribute values of the child node group from attribute values of a parent node group to generate predicted values of the child node group (S 9102 ). The three-dimensional data encoding device next applies the RAHT or the Haar transform to the predicted values to calculate transform coefficients PTi of the predicted values (S 9103 ). 
     The three-dimensional data encoding device next calculates difference values that are differences between the transform coefficients Ti of the attribute values and the transform coefficients PTi of the predicted values (S 9104 ). The three-dimensional data encoding device next quantizes the difference values (S 9105 ) and performs arithmetic encoding on the quantized difference values (S 9106 ) to generate encoded data (a bitstream). Note that, when using a lossless coding, the three-dimensional data encoding device may skip the quantization (S 9105 ). 
     Next, a first example of a decoding method for decoding the encoded data (bitstream) generated by the encoding method in the first example will be described.  FIG. 79  is a diagram illustrating the first example of a decoding method. 
     First, the three-dimensional data decoding device performs arithmetic decoding on the encoded data (bitstream) (S 9111 ) and performs inverse quantization on the resulting signal (S 9112 ) to generate the difference values of the transform coefficients of the child node group. Note that, when using a lossless decoding (when a lossless coding is used), the three-dimensional data decoding device may skip the inverse quantization (S 9112 ). 
     In addition, the three-dimensional data decoding device predicts the attribute values of the child node group from the attribute values of the parent node group to generate the predicted values (S 9113 ). Note that in a case where the three-dimensional data encoding device has made a selection as to whether to use calculated values or to use attribute values of parent nodes or neighboring parent nodes (in a case where a prediction mode is added to a bitstream) to generate predicted values, the three-dimensional data decoding device uses the decoded prediction mode to generate the predicted values. The three-dimensional data decoding device next applies the RAHT or the Haar transform to the predicted values to calculate transform coefficients PTi of the predicted values (S 9114 ). 
     The three-dimensional data decoding device next adds the transform coefficients PTi of the predicted values to the difference values of the transform coefficients of the child node group to calculate transform coefficients Ti of the child node group (S 9115 ). The three-dimensional data decoding device next applies inverse RAHT or inverse Haar transform to the transform coefficients Ti of the child node group to generate decoded values of the attribute values of the child node group (S 9116 ). The three-dimensional data decoding device thus can decode the bitstream appropriately. 
     Next, a second example of the encoding method will be described. In this second example, integer Haar transform is used in place of the RATH or the Haar transform.  FIG. 80  is a diagram illustrating the second example of the encoding method. 
     When calculating difference values between attribute values and predicted values, the three-dimensional data encoding device may apply the integer Haar transform to both the attribute values and the predicted values to calculate transform coefficients of the attribute values and transform coefficients of the predicted values and determine difference values between the transform coefficients of the attribute values and the transform coefficients of the predicted values. The three-dimensional data encoding device thus can decrease the difference values to be encoded, so that the coding efficiency can be improved. 
     The three-dimensional data encoding device may be configured such that, when selecting predicted values from between the calculated values and the attribute values of parent nodes or neighboring parent nodes (in a case where a prediction mode is added to a bitstream), for example, the three-dimensional data encoding device uses the predicted values in each prediction mode to calculate the difference values of the transform coefficients, determines a cost value from a sum of absolute values of the difference values, and selects a prediction mode that minimizes the cost. The three-dimensional data encoding device thus can appropriately select the prediction mode minimizing the difference values, so that the coding efficiency can be improved. For example, the three-dimensional data encoding device may use the above (Equation P3) to calculate a cost value cost. 
     As illustrated in  FIG. 80 , the three-dimensional data encoding device applies the integer Haar transform to attribute values of a child node group to calculate transform coefficients Ti of the attribute values (S 9101 A). In addition, the three-dimensional data encoding device predicts the attribute values of the child node group from attribute values of a parent node group to generate predicted values of the child node group (S 9102 ). 
     When applying the integer Haar transform, the three-dimensional data encoding device discards values of fractional portions of the predicted values (S 9107 ). Alternatively, the three-dimensional data encoding device may apply rounding or the like to the predicted values to set 0 to the values of the fractional portions of the predicted values. For example, when kBit bits of an attribute value represent a fractional portion of the attribute value, the three-dimensional data encoding device sets 0 to a value of the fractional portion being the kBit bits by subjecting the value to discarding (flooring process) in which a right shift by kBit and a left shift by kBit is applied to the predicted values. By converting the predicted values into integral values before the integer Haar transform is applied, transform coefficients of the predicted values after the integer Haar transform are also integral values. Thus, difference values between the transform coefficients Ti of the attribute values of the child node group and transform coefficients PTi of the predicted value of the child node group are also integral values. A lossless coding with the integer Haar transform thus can be implemented. Note that any method that sets 0 to the values of the fractional portions of the predicted values is applicable. 
     Alternatively, the three-dimensional data encoding device may store a flag indicating whether to apply the integer Haar transform in a bitstream and may set 0 to the fractional portions of the predicted values when applying the integer Haar transform or need not set 0 to the fractional portions when not applying the integer Haar transform. Note that, in a case of QS&gt;1 (lossy coding) in the integer Haar transform, the three-dimensional data encoding device need not apply the process of setting 0 to the fractional portions of the predicted values. This maintains the precision of the fractional portions of the predicted values when the integer Haar transform is applied, so that the precision in the calculation is improved. The coding efficiency thus can be improved. 
     The three-dimensional data encoding device next applies the integer Haar transform to the predicted values after the discarding to calculate the transform coefficients PTi of the predicted values (S 9103 A). The three-dimensional data encoding device next calculates difference values that are differences between the transform coefficients Ti of the attribute values and the transform coefficients PTi of the predicted values (S 9104 ). 
     Here, the difference values of the transform coefficients may be converted into integral values and then subjected to arithmetic encoding. In this case, information on their fractional portions is lost. For that reason, the three-dimensional data encoding device sets a value of 0 beforehand to values of the fractional portions of the difference values of the transform coefficients, for supporting a lossless coding. This prevents the information from being lost when the difference values are converted into the integral values before arithmetic encoding, enabling the implementation of lossless coding. 
     The three-dimensional data encoding device next quantizes the difference values (S 9105 ) and performs arithmetic encoding on the quantized difference values (S 9106 ) to generate encoded data (a bitstream). Note that, when using a lossless coding, the three-dimensional data encoding device may skip the quantization (S 9105 ). 
     Next, a second example of a decoding method for decoding the encoded data (bitstream) generated by the encoding method in the second example will be described.  FIG. 81  is a diagram illustrating the second example of a decoding method. 
     First, the three-dimensional data decoding device performs arithmetic decoding on the encoded data (bitstream) (S 9111 ) and performs inverse quantization on the resulting signal (S 9112 ) to generate the difference values of the transform coefficients of the child node group. Note that, when using a lossless decoding (when a lossless coding is used), the three-dimensional data decoding device may skip the inverse quantization (S 9112 ). 
     In addition, the three-dimensional data decoding device predicts the attribute values of the child node group from the attribute values of the parent node group to generate the predicted values (S 9113 ). Note that in a case where the three-dimensional data encoding device has made a selection as to whether to use calculated values or to use attribute values of parent nodes or neighboring parent nodes (in a case where a prediction mode is added to a bitstream) to generate predicted values, the three-dimensional data decoding device uses the decoded prediction mode to generate the predicted values. 
     When applying the integer Haar transform, the three-dimensional data decoding device discards values of fractional portions of the predicted values (S 9117 ). Alternatively, the three-dimensional data decoding device may apply rounding or the like to the predicted values to set 0 to the values of the fractional portions of the predicted values. For example, when kBit bits of an attribute value represent a fractional portion of the attribute value, the three-dimensional data decoding device may set 0 to a value of a fractional portion of a predicted value being kBit bits of the predicted value by subjecting the value to discarding (flooring process) in which a right shift by kBit and a left shift by kBit is applied to the predicted value. By converting the predicted values into integral values before the integer Haar transform is applied, transform coefficients of the predicted values after the integer Haar transform are also integral values. Thus, added values of the transform coefficients Ti of the attribute values of the child node group and transform coefficients PTi of the predicted value of the child node group are also integral values. The three-dimensional data decoding device thus can appropriately decode the bitstream resulting from the lossless coding with the integer Haar transform. Note that any method that sets 0 to the values of the fractional portions of the predicted values is applicable. 
     Alternatively, the three-dimensional data decoding device may obtain the flag indicating whether to apply the integer Haar transform in a bitstream and may set 0 to the fractional portions of the predicted values when applying the integer Haar transform or need not set 0 to the fractional portions when not applying the integer Haar transform. Note that, in a case of QS&gt;1 (lossy decoding) in the integer Haar transform, the three-dimensional data decoding device need not apply the process of setting 0 to the fractional portions of the predicted values. The three-dimensional data decoding device thus maintains the precision of the fractional portions of the predicted values when the integer Haar transform is applied, so that the precision in the calculation is improved, and the three-dimensional data decoding device can appropriately decode the bitstream with the improved coding efficiency. 
     The three-dimensional data decoding device next applies the integer Haar transform to the predicted values after the discarding to calculate the transform coefficients PTi of the predicted values (S 9114 A). The three-dimensional data decoding device next adds the transform coefficients PTi of the predicted values to the difference values of the transform coefficients of the child node group to calculate transform coefficients Ti of the child node group (S 9115 ). The three-dimensional data decoding device next applies inverse integer Haar transform to the transform coefficients Ti of the child node group to generate decoded values of the attribute values of the child node group (S 9116 A). The three-dimensional data decoding device thus can decode the bitstream appropriately. 
     Next, a third example of the encoding method will be described. In this third example, the integer Haar transform is used as in the second example. In addition, the third example differs from the second example in that a timing for performing discarding (S 9108 ) is after the integer Haar transform (S 9103 A) is applied. 
       FIG. 82  is a diagram illustrating the third example of the encoding method. The following description will be given mainly of differences from the second example, and redundant description will be omitted. 
     As illustrated in  FIG. 82 , the three-dimensional data encoding device applies the integer Haar transform to attribute values of a child node group to calculate transform coefficients Ti of the attribute values (S 9101 A). In addition, the three-dimensional data encoding device predicts the attribute values of the child node group from attribute values of a parent node group to generate predicted values of the child node group (S 9102 ). 
     The three-dimensional data encoding device next applies the integer Haar transform to the predicted values to calculate the transform coefficients PTi of the predicted values (S 9103 A). The three-dimensional data encoding device next performs the discarding on the transform coefficients PTi to set 0 to fractional portions of the transform coefficients (S 9108 ). Note that the detail of the discarding is the same as that of step S 9107  described above except that a signal to be subjected to the process is not the predicted values but the transform coefficients PTi. 
     The three-dimensional data encoding device next calculates difference values that are differences between the transform coefficients Ti of the attribute values and the transform coefficients PTi of the predicted values after the discarding (S 9104 ). 
     Next, a third example of a decoding method for decoding the encoded data (bitstream) generated by the encoding method in the third example will be described.  FIG. 83  is a diagram illustrating the third example of a decoding method. 
     First, the three-dimensional data decoding device performs arithmetic decoding on the encoded data (bitstream) (S 9111 ) and performs inverse quantization on the resulting signal (S 9112 ) to generate the difference values of the transform coefficients of the child node group. Note that, when using a lossless decoding (when a lossless coding is used), the three-dimensional data decoding device may skip the inverse quantization (S 9112 ). 
     In addition, the three-dimensional data decoding device predicts the attribute values of the child node group from the attribute values of the parent node group to generate the predicted values (S 9113 ). 
     The three-dimensional data decoding device next applies the integer Haar transform to the predicted values to calculate the transform coefficients PTi of the predicted values (S 9114 A). The three-dimensional data decoding device next performs discarding on the transform coefficients PTi to set 0 to fractional portions of the transform coefficients (S 9118 ). Note that the detail of the discarding is the same as that of step S 9117  described above except that a signal to be subjected to the process is not the predicted values but the transform coefficients PTi. 
     The three-dimensional data decoding device next adds the transform coefficients PTi of the predicted values after the discarding to the difference values of the transform coefficients of the child node group to calculate transform coefficients Ti of the child node group (S 9115 ). The three-dimensional data decoding device next applies the inverse integer Haar transform to the transform coefficients Ti of the child node group to generate decoded values of the attribute values of the child node group (S 9116 A). The three-dimensional data decoding device thus can decode the bitstream appropriately. 
     Next, a fourth example of the encoding method will be described. Through the first to third examples, the examples in which one of the transform processes are applied to the attribute values and the predicted values, and the difference values between the generated transform coefficients of the attribute values and the generated transform coefficients of the predicted values have been described. In the fourth example, the three-dimensional data encoding device calculates difference values between attribute values and predicted values and applies the RAHT or the Haar transform to the difference values to calculate transform coefficients of the difference values. The three-dimensional data encoding device thus can decrease the transform coefficients of the difference values to be encoded while suppressing an increase in a processing load, so that the coding efficiency can be improved. 
     The three-dimensional data encoding device may be configured such that, when selecting predicted values from between the calculated values and the attribute values of parent nodes or neighboring parent nodes (in a case where a prediction mode is added to a bitstream), for example, the three-dimensional data encoding device uses the predicted values in each prediction mode to calculate the difference values of the attribute values, determines a cost value described below from a sum of absolute values of the difference values, and selects a prediction mode that minimizes the cost. The three-dimensional data encoding device thus can appropriately select the prediction mode minimizing the difference values, so that the coding efficiency can be improved. For example, the three-dimensional data encoding device may use the following (Equation P4) to calculate a cost value cost. 
       [Math. 32] 
       cost=Σ i+0   m   |D   i |+λ*Predbit  (Equation. P4)
 
     Here, m denotes the number of child nodes included in a child node group. The symbol λ denotes an adjustment parameter. Predbit denotes the number of bits necessary for encoding a prediction mode. Di denotes a difference value between an attribute value and a predicted value. 
     Note that the three-dimensional data encoding device may use the following (Equation P5) to calculate a cost value cost. The three-dimensional data encoding device thus can select the prediction mode decreasing values of the transform coefficients of the difference values, so that the coding efficiency can be improved. 
       [Math. 33] 
       cost=Σ i=0   m   |T   i |+ζ*Predbit  (Equation P5)
 
     Here, Ti denotes a transform coefficient of a difference value. Note that this does not limit the method for selecting the prediction mode, and the prediction mode may be selected under other conditions or based on instructions or the like from the outside. 
       FIG. 84  is a diagram illustrating the fourth example of the encoding method. As illustrated in  FIG. 84 , the three-dimensional data encoding device predicts the attribute values of the child node group from the attribute values of the parent node group to generate the predicted values Pi (S 9121 ). The three-dimensional data encoding device next calculates difference values Di that are differences between attribute values Ai of the child node group and the predicted values Pi (S 9122 ). The three-dimensional data encoding device next applies the RAHT or the Haar transform to the difference values Di to calculate transform coefficients Ti of the difference values (S 9123 ). 
     The three-dimensional data encoding device next quantizes the transform coefficients Ti of the difference values (S 9124 ) and performs arithmetic encoding on the quantized transform coefficients Ti (S 9125 ) to generate encoded data (a bitstream). Note that, when using a lossless coding, the three-dimensional data encoding device may skip the quantization (S 9124 ). 
     Next, a fourth example of a decoding method for decoding the encoded data (bitstream) generated by the encoding method in the fourth example will be described.  FIG. 85  is a diagram illustrating the fourth example of a decoding method. 
     First, the three-dimensional data decoding device performs arithmetic decoding on the encoded data (bitstream) (S 9131 ) and performs inverse quantization on the resulting signal (S 9132 ) to generate the transform coefficients Ti of the difference values of the child node group. Note that, when using a lossless decoding (when a lossless coding is used), the three-dimensional data decoding device may skip the inverse quantization (S 9132 ). The three-dimensional data decoding device next applies inverse RAHT or inverse Haar transform to the transform coefficients Ti to generate the difference values Di of the attribute values (S 9133 ). 
     In addition, the three-dimensional data decoding device predicts the attribute values of the child node group from the attribute values of the parent node group to generate the predicted values (S 9134 ). Note that in a case where the three-dimensional data encoding device has made a selection as to whether to use calculated values or to use attribute values of parent nodes or neighboring parent nodes (in a case where a prediction mode is added to a bitstream) to generate predicted values, the three-dimensional data decoding device uses the decoded prediction mode to generate the predicted values. 
     The three-dimensional data decoding device next adds the difference values Di and the predicted values Pi to generate decoded values of the attribute values of the child node group (S 9135 ). The three-dimensional data decoding device thus can decode the bitstream appropriately. 
     Next, a fifth example of the encoding method will be described. This fifth example differs from the fourth example in that the integer Haar transform is used in place of the RATH or the Haar transform.  FIG. 86  is a diagram illustrating the fifth example of the encoding method. 
     The three-dimensional data encoding device predicts the attribute values of the child node group from the attribute values of the parent node group to generate the predicted values Pi (S 9121 ). The three-dimensional data encoding device next performs discarding on the predicted values Pi to set 0 to fractional portions of the predicted values (S 9126 ). Note that the detail of this process is the same as, for example, that of step S 9107  illustrated in  FIG. 80 . 
     The three-dimensional data encoding device next calculates difference values Di that are differences between attribute values Ai of the child node group and the predicted values Pi after the discarding (S 9122 ). The three-dimensional data encoding device next applies the integer Haar transform to the difference values Di to calculate transform coefficients Ti of the difference values (S 9123 A). 
     The three-dimensional data encoding device next quantizes the transform coefficients Ti of the difference values (S 9124 ) and performs arithmetic encoding on the quantized transform coefficients Ti (S 9125 ) to generate encoded data (a bitstream). Note that, when using a lossless coding, the three-dimensional data encoding device may skip the quantization (S 9124 ). Here, the transform coefficients of the difference values may be converted into integral values and then subjected to arithmetic encoding, when information on fractional portions of the transform coefficients is lost. In contrast, the three-dimensional data encoding device sets a value of 0 beforehand to values of the fractional portions of the transform coefficients of the difference values. This prevents the information from being lost when the transform coefficients Ti of the difference values are converted into the integral values before arithmetic encoding, enabling the implementation of lossless coding. 
     Next, a fifth example of a decoding method for decoding the encoded data (bitstream) generated by the encoding method in the fifth example will be described.  FIG. 87  is a diagram illustrating the fifth example of a decoding method. 
     First, the three-dimensional data decoding device performs arithmetic decoding on the encoded data (bitstream) (S 9131 ) and performs inverse quantization on the resulting signal (S 9132 ) to generate the transform coefficients Ti of the difference values of the child node group. Note that, when using a lossless decoding (when a lossless coding is used), the three-dimensional data decoding device may skip the inverse quantization (S 9132 ). The three-dimensional data decoding device next applies the inverse integer Haar transform to the transform coefficients Ti to generate the difference values Di of the attribute values (S 9133 A). 
     In addition, the three-dimensional data decoding device predicts the attribute values of the child node group from the attribute values of the parent node group to generate the predicted values (S 9134 ). The three-dimensional data decoding device next performs discarding on the predicted values Pi to set 0 to fractional portions of the predicted values (S 9136 ). Note that the detail of this process is the same as, for example, that of step S 9117  illustrated in  FIG. 81 . 
     The three-dimensional data decoding device next adds the difference values Di and the predicted values Pi after the discarding to generate decoded values of the attribute values of the child node group (S 9135 ). The three-dimensional data decoding device thus can decode the bitstream appropriately. 
     As described above, the three-dimensional data encoding device according to the present embodiment performs the process shown by  FIG. 88 . First, the three-dimensional data encoding device generates a predicted value of an item of attribute information of a current node in an N-ary tree structure (e.g., an octree structure) of three-dimensional points included in point cloud data, N being an integer greater than or equal to 2 (S 9141 ). Next, the three-dimensional data encoding device encodes the item of attribute information of the current node using the predicted value and a transform process (e.g., RAHT, Haar transform, or integer Haar transform) that hierarchically repeats an operation for separating each of input signals into a high-frequency component and a low-frequency component (S 9142 ). In the generating of the predicted value (S 9141 ), the three-dimensional data encoding device selects, from items of attribute information of first nodes (e.g., a parent node group), an item of attribute information of a node among the first nodes which is to be used in generating the predicted value of the current node, the first nodes including a parent node of the current node and belonging to a same layer as the parent node. 
     The three-dimensional data encoding device thus can appropriately select an item of attribute information which is to be used in generating the predicted value, so that coding efficiency can be improved. 
     For example, in the selecting, the three-dimensional data encoding device selects whether to use an item of attribute information of a second node directly as the predicted value or to calculate the predicted value from the items of attribute information of the first nodes, the second node being included in the first nodes. For example, the second node is the parent node. 
     For example, the three-dimensional data encoding device generates predicted values of third nodes (e.g., a child node group) that include the current node and belong to a same layer as the current node. In the encoding (S 9142 ), the three-dimensional data encoding device performs the transform process on items of attribute information of the third nodes to generate first transform coefficients (e.g., S 9101  in  FIG. 78 ); performs the transform process on the predicted values of the third nodes to generate second transform coefficients (e.g., S 9103 ); calculates difference values between corresponding ones of the first transform coefficients and the second transform coefficients (e.g., S 9104 ); and encodes the difference values calculated (e.g., S 9106 ). 
     For example, the transform process is an integer-to-integer transform (e.g., integer Haar transform). In the generating of the second transform coefficients, the three-dimensional data encoding device discards fractional portions of the predicted values of the third nodes (e.g., S 9107  in  FIG. 80 ), and performs the transform process on the predicted values after the discarding to generate the second transform coefficients (e.g., S 9103 A). 
     For example, the transform process is an integer-to-integer transform (e.g., integer Haar transform). In the calculating of the difference values, the three-dimensional data encoding device discards fractional portions of the second transform coefficients (e.g., S 9108  in  FIG. 82 ), and calculates the difference values using the second transform coefficients after the discarding (S 9104 ). 
     For example, the three-dimensional data encoding device includes a processor and memory. Using the memory, the processor performs the above-described process. 
     The three-dimensional data decoding device according to the present embodiment performs the process shown by  FIG. 89 . First, the three-dimensional data decoding device obtains, from a bitstream, a difference value between an item of attribute information and a predicted value of a current node in an N-ary tree structure (e.g., an octree structure) of three-dimensional points included in point cloud data, N being an integer greater than or equal to 2 (S 9151 ). Next, the three-dimensional data decoding device generates the predicted value (S 9152 ). Finally, the three-dimensional data decoding device decodes the item of attribute information of the current node using the difference value, the predicted value, and an inverse transform process of a transform process (e.g., RAHT, Haar transform, or integer Haar transform) that hierarchically repeats an operation for separating each of input signals into a high-frequency component and a low-frequency component (S 9153 ). In the generating of the predicted value (S 9152 ), the three-dimensional data decoding device selects, from items of attribute information of first nodes (e.g., a parent node group), an item of attribute information of a node among the first nodes which is to be used in generating the predicted value of the current node, the first nodes including a parent node of the current node and belonging to a same layer as the parent node. 
     The three-dimensional data decoding device thus can appropriately select an item of attribute information which is to be used in generating the predicted value, so that coding efficiency can be improved. 
     For example, in the selecting, the three-dimensional data decoding device selects whether to use an item of attribute information of a second node directly as the predicted value or to calculate the predicted value from the items of attribute information of the first nodes, the second node being included in the first nodes. For example, the second node is the parent node. 
     For example, the three-dimensional data decoding device obtains, from the bitstream, difference values of third nodes (e.g., child node group) that include the current node and belong to a same layer as the current node (e.g., S 9111  in  FIG. 79 ), and generates predicted values of the third nodes (S 9113 ). In the decoding (S 9153 ), the three-dimensional data decoding device performs the transform process on the predicted values of the third nodes to generate second transform coefficients (e.g., S 9114 ); adds a difference value among the difference values and a second transform coefficient among the second transform coefficients to generate each of first transform coefficients, the difference value corresponding to the second transform coefficient (e.g., S 9115 ); and performs the inverse transform process on the first transform coefficients to generate items of attribute information of the third nodes (e.g., S 9116 ). 
     For example, the transform process is an integer-to-integer transform (e.g., integer Haar transform). In the generating of the second transform coefficients, the three-dimensional data decoding device discards fractional portions of the predicted values of the third nodes (e.g., S 9117  in  FIG. 81 ), and performs the transform process on the predicted values after the discarding to generate the second transform coefficients (e.g., S 9114 A). 
     For example, the transform process is an integer-to-integer transform (e.g., integer Haar transform). In the generating of the first transform coefficients, the three-dimensional data decoding device discards fractional portions of the second transform coefficients (e.g., S 9118  in  FIG. 83 ), and generates the first transform coefficients using the second transform coefficients after the discarding (e.g., S 9115 ). 
     For example, the three-dimensional data decoding device includes a processor and memory. Using the memory, the processor performs the above-described process. 
     Embodiment 11 
     In this embodiment, a region adaptive hierarchical transform (RAHT) process or Haar process based on prediction will be described.  FIG. 90  is a diagram for describing a prediction process, which illustrates a hierarchical structure in a RAHT or Haar process. 
     In a hierarchical encoding based on RAHT or Haar transform, the three-dimensional data encoding device performs a hierarchical predictive encoding, which predicts an attribute value (attribute information) for a lower layer from an attribute value for a higher layer and encodes a difference value between the attribute information and a predicted value obtained by prediction. The three-dimensional data encoding device adaptively switches, based on a certain condition, whether to perform the hierarchical predictive encoding or not. The certain condition may be the condition described below. 
     Condition 1 is that the number of valid nodes is greater than a previously determined threshold (THnode). The three-dimensional data encoding device applies the hierarchical predictive encoding when the number of valid nodes is greater than the threshold, and does not apply the hierarchical predictive encoding when the number of valid nodes is smaller than or equal to the threshold. 
     Here, a valid node is a node having an attribute value used for prediction among a plurality of nodes (parent nodes and neighboring parent nodes) included in a parent node group for a child node group that is to be encoded. In other words, a valid node is a node that includes a three-dimensional point or a node a descendant node (a child node, a grandchild node or the like) of which includes a three-dimensional point. Note that a child node group includes a plurality of nodes (child nodes) to be encoded. A parent node group includes a parent node and a plurality of neighboring parent nodes. A neighboring parent node is a node that belongs to the same layer as the parent node and is neighboring to the parent node. 
     For example, in the example shown in  FIG. 90 , the valid node count, which is the total number of valid nodes included in the parent node group, is 11. For example, when THnode=5, the valid node count (=11)&gt;THnode, and therefore, the three-dimensional data encoding device encodes the child node group using the hierarchical predictive encoding. When THnode=12, the valid node count (=11)&lt;=THnode, the three-dimensional data encoding device does not encode the child node group using the hierarchical predictive encoding. In this way, when the valid node count is greater than the threshold, the three-dimensional data encoding device can generate a predicted value of high precision using the attribute value of the parent node or a neighboring parent node and therefore can improve the encoding efficiency by applying the hierarchical predictive encoding. When the valid node count is smaller than or equal to the threshold, the three-dimensional data encoding device does not apply the hierarchical predictive encoding and therefore can reduce the processing amount. 
     Note that when the three-dimensional data encoding device does not apply the hierarchical predictive encoding, the three-dimensional data encoding device applies the RAHT or Haar transform to the attribute value of the child node group and entropy-encodes the resulting transform coefficient. 
       FIG. 91  is a diagram illustrating a first example of the encoding process. When calculating the difference value between the attribute value and the predicted value, the three-dimensional data encoding device applies the RAHT or Haar transform to each of the attribute value and the predicted value to calculate a transform coefficient for the attribute value and a transform coefficient for the predicted value. The three-dimensional data encoding device determines the difference value between the transform coefficient for the attribute value and the transform coefficient for the predicted value. In this way, the difference value to be encoded can be made smaller, and therefore, the encoding efficiency can be improved. 
     Note that when the predicted value is to be selected from among a calculated value and the attribute value for the parent node or a neighboring parent node (when a prediction mode is to be added to the bitstream), the three-dimensional data encoding device may calculate difference values of the transform coefficients from predicted values for each prediction mode, determine a cost value from the absolute sum of the difference values, and select a prediction mode for which the cost value is the smallest, for example. In this way, the prediction mode for which the difference value is the smallest can be appropriately selected, and the encoding efficiency can be improved. For example, the three-dimensional data encoding device can calculate cost value cost according to the following equation (Equation R1). 
       [Math. 34] 
       cost=Σ i=0   m   |T   i   −PT   i |+λ*Predbit  (Equation R1)
 
     Here, m represents the number of child nodes included in a child node group. λ represents an adjustment parameter. Predbit represents the amount of bits for encoding a prediction mode. Ti represents a transform coefficient for an attribute value, and PTi represents a transform coefficient for a predicted value. Note that the method of selecting a prediction mode is not limited to this, and a prediction mode can be selected based on other conditions or instructions from the outside, for example. 
     As shown in  FIG. 91 , the three-dimensional data encoding device calculates transform coefficients Ti for the attribute values for the child node group by applying the RAHT or Haar transform to the attribute values (S 9501 ). 
     In the example shown in  FIG. 91 , the valid node count is 2, and the valid node count (=2)&lt;=THnode (11, for example). In this case, the three-dimensional data encoding device does not perform generation of a predicted value. For example, the three-dimensional data encoding device uses a predicted value=0. 
     The three-dimensional data encoding device then calculates difference values that are the difference between transform coefficients Ti for the attribute values and the predicted value=0 (S 9502 ). That is, the three-dimensional data encoding device directly outputs transform coefficients Ti as the difference values. 
     The three-dimensional data encoding device then quantizes the difference values (transform coefficients Ti) (S 9503 ), and arithmetically encodes the quantized difference values (S 9504 ), thereby generating encoded data (bitstream). Note that when using a lossless encoding, the three-dimensional data encoding device may skip the quantization (S 9504 ). 
     Note that when the valid node count&gt;THnode, the three-dimensional data encoding device generates a predicted value for the child node group by predicting an attribute value for the child node group from an attribute value for the parent node group. The three-dimensional data encoding device then calculates transform coefficient PTi for the predicted value by applying the RAHT or Haar transform to the predicted value. In step S 9502 , the three-dimensional data encoding device also calculates difference values that are the differences between the transform coefficients Ti for the attribute values and transform coefficient PTi for the predicted value. 
     Next, an example of a decoding process of decoding the encoded data (bitstream) generated in the first example of the encoding process described above will be described.  FIG. 92  is a diagram illustrating a first example of the decoding process. 
     First, the three-dimensional data decoding device arithmetically decodes the encoded data (bitstream) (S 9511 ), and inverse-quantizes the resulting signal (S 9512 ) to generate difference values of the transform coefficients for the child node group. Note that, when using a lossless decoding (when a lossless encoding is used), the inverse quantization (S 9512 ) may be skipped. 
     In the example shown in  FIG. 92 , the valid node count is 2, and the valid node count (=2)&lt;=THnode (11, for example). In this case, the three-dimensional data decoding device does not perform generation of a predicted value. For example, the three-dimensional data decoding device uses a predicted value=0. 
     The three-dimensional data decoding device then calculates transform coefficients Ti for the child node group by adding the predicted value=0 to the difference values of the transform coefficients for the child node group (S 9513 ). That is, the three-dimensional data decoding device directly outputs the difference values as transform coefficients Ti. 
     The three-dimensional data decoding device then applies inverse RAHT or inverse Haar transform to transform coefficients Ti for the child node group to generate decoded values of the attribute values for the child node group (S 9514 ). In this way, the three-dimensional data decoding device can appropriately decode the bitstream. 
     Note that when the valid node count&gt;THnode, the three-dimensional data decoding device generates a predicted value by predicting an attribute value for the child node group from an attribute value for the parent node group. Note that when the three-dimensional data encoding device has selected whether to use a calculated value or an attribute value for the parent node or a neighboring parent node for generation of the predicted value (when a prediction mode is added to the bitstream), the three-dimensional data decoding device generates predicted values using the decoded prediction mode. The three-dimensional data decoding device then calculates transform coefficient PTi for the predicted value by applying the RAHT or Haar transform to the predicted value. In step S 9513 , the three-dimensional data decoding device also calculates transform coefficients Ti for the child node group by adding transform coefficient PTi for the predicted value to the difference values of the transform coefficients for the child node group. 
       FIG. 93  is a diagram illustrating an example syntax of an attribute information header (attribute header). The attribute information header is a header of attribute information included in a bitstream, and is a header for a frame or for a plurality of frames. 
     As shown in  FIG. 93 , the attribute information header includes RAHTPredictionFlag (hierarchical predictive encoding flag) and THnode (first threshold information). RAHTPredictionFlag is information for switching whether or not to apply the hierarchical predictive encoding, which predicts an attribute value for a lower layer from an attribute value for a higher layer, in the hierarchical encoding based on RAHT or Haar. RAHTPredictionFlag=1 indicates that the hierarchical predictive encoding is to be applied. RAHTPredictionFlag=0 indicates that the hierarchical predictive encoding is not to be applied. 
     THnode is information for switching whether or not to apply the hierarchical encoding for each child node group. THnode is added to the attribute information header when RAHTPredictionFlag=1, and is not added to the attribute information header when RAHTPredictionFlag=0. The hierarchical predictive encoding is applied when the valid node count of the parent node group is greater than THnode, and is not applied when the valid node count is smaller than or equal to THnode. 
       FIG. 94  is a diagram illustrating another example syntax of the attribute information header. The attribute information header shown in FIG.  94  does not include RAHTPredictionFlag, although the attribute information header includes THnode. When the minimum value of the valid node count of the parent node is 1, the three-dimensional data encoding device can always apply the hierarchical predictive encoding for each child node group by setting THnode=0. Therefore, in this case, RAHTPredictionFlag can be omitted. Therefore, the data size of the header can be reduced. 
     Note that the three-dimensional data encoding device may add RAHTPredictionFlag or THnode to the header after entropy-encoding RAHTPredictionFlag or THnode. For example, the three-dimensional data encoding device may binarize and arithmetically encode each value. Alternatively, the three-dimensional data encoding device may encode each value with a fixed length in order to reduce the processing amount. 
     RAHTPredictionFlag or THnode does not always have to be added to the header. For example, the value of RAHTPredictionFlag or THnode may be defined by profile or level of a standard or the like. In this way, the bit amount of the header can be reduced. 
       FIG. 95  is a flowchart of a three-dimensional data encoding process (a switching process for the hierarchical predictive encoding). First, the three-dimensional data encoding device calculates the valid node count of the parent node group (S 9521 ). The three-dimensional data encoding device then determines whether the valid node count is greater than THnode (S 9522 ). When the valid node count is greater than THnode (if Yes in S 9522 ), the three-dimensional data encoding device performs the hierarchical predictive encoding of the attribute values of the child node group (S 9523 ). On the other hand, when the valid node count is smaller than or equal to THnode (if No in S 9522 ), the three-dimensional data encoding device performs a hierarchical non-predictive encoding of the attribute values of the child node group (S 9524 ). The hierarchical non-predictive encoding is an encoding that does not use the hierarchical predictive encoding, and is an encoding that includes no prediction process, for example. 
       FIG. 96  is a flowchart of a three-dimensional data decoding process (a switching process for the hierarchical predictive decoding). First, the three-dimensional data decoding device calculates the valid node count of the parent node group (S 9531 ). The three-dimensional data decoding device then determines whether the valid node count is greater than THnode (S 9532 ). 
     When the valid node count is greater than THnode (if Yes in S 9532 ), the three-dimensional data decoding device performs a hierarchical predictive decoding of the attribute values of the child node group (S 9533 ). Here, the hierarchical predictive decoding is a process of decoding a signal generated by the hierarchical predictive encoding described above. That is, in the hierarchical predictive decoding, a decoded value (attribute value) is generated by adding a predicted value obtained by prediction to a decoded difference value. 
     On the other hand, when the valid node count is smaller than or equal to THnode (if No in S 9532 ), the three-dimensional data decoding device performs a hierarchical non-predictive decoding of the attribute values of the child node group (S 9534 ). Here, the hierarchical non-predictive decoding is a process of decoding a signal generated by the hierarchical non-predictive encoding described above. The hierarchical non-predictive decoding is a decoding that does not use the hierarchical predictive decoding, and is a decoding that includes no prediction process, for example. 
     Next, a second example of the encoding process will be described. As a condition for switching whether to use the hierarchical predictive encoding or not, condition 2 described below may be used. 
     Condition 2 is that the valid node count of a grandparent node group is greater than a previously determined threshold (THpnode). The three-dimensional data encoding device applies the hierarchical predictive encoding when the valid node count of the grandparent node group is greater than the threshold, and does not apply the hierarchical predictive encoding when the valid node count of the grandparent node group is smaller than or equal to the threshold. Here, the grandparent node group includes a grandparent node and a neighboring node of the grandparent node. That is, the grandparent node group includes a parent node of a parent node and a parent node of a neighboring parent node. Here, the grandparent node is a parent node of a parent node of a current node. That is, the valid node count of the grandparent node is the valid node count of an encoded parent node. 
     Condition 1 and condition 2 may be combined. That is, it is possible that the three-dimensional data encoding device applies the hierarchical predictive encoding when the valid node count of the grandparent node group is greater than threshold THpnode and the valid node count of the parent node is greater than threshold THnode, and does not apply the hierarchical predictive encoding otherwise. 
       FIG. 97  is a diagram illustrating a second example of the encoding process. For example, in the example shown in  FIG. 97 , the valid node count of the grandparent node is 3. For example, when THpnode=1, the valid node count of the grandparent node (=3)&gt;THnode, and therefore, the three-dimensional data encoding device encodes the child node group using the hierarchical predictive encoding. When THpnode=5, the valid node count (=3)&lt;=THnode, and therefore, the three-dimensional data encoding device does not encode the child node group using the hierarchical predictive encoding. 
     In this way, when the valid node count of the grandparent node group is greater than the threshold, the three-dimensional data encoding device can generate a predicted value of high precision using the attribute value of the parent node or a neighboring parent node and therefore can improve the encoding efficiency by applying the hierarchical predictive encoding. When the valid node count of the grandparent node group is smaller than or equal to the threshold, the three-dimensional data encoding device does not apply the hierarchical predictive encoding and therefore can reduce the processing amount. 
     Note that when the three-dimensional data encoding device does not apply the hierarchical predictive encoding, the three-dimensional data encoding device applies the RAHT or Haar transform to the attribute value of the child node group and entropy-encodes the resulting transform coefficient, for example. 
     Note that when the valid node count of the grandparent node group is smaller than or equal to the threshold, the three-dimensional data encoding device does not apply the hierarchical predictive encoding and therefore does not have to perform the process of determining a parent node group and calculating the valid node count of the parent node group. In this way, the processing amount can be reduced. Note that when the three-dimensional data encoding device does not calculate the valid node count of the parent node group, the three-dimensional data encoding device may set the valid node count of the parent node group at 0 so that the hierarchical predictive encoding is not applied to the child nodes of the child node group to be encoded. In this way, the processing amount can be reduced. The three-dimensional data encoding device may refer to the valid node count of a higher layer than the grandparent node. 
       FIG. 98  is a diagram illustrating an example syntax of the attribute information header in the second example. The attribute information header shown in  FIG. 98  includes THpnode (second threshold information) in addition to the components of the attribute information header shown in  FIG. 93 . THpnode is information for switching whether or not to apply the hierarchical encoding for each child node group. THpnode is added to the attribute information header when RAHTPredictionFlag=1, and is not added to the attribute information header when RAHTPredictionFlag=0. The hierarchical predictive encoding is applied when the valid node count of the grandparent node group is greater than THpnode, and is not applied when the valid node count of the grandparent node group is smaller than or equal to THpnode. 
       FIG. 99  is a diagram illustrating another example syntax of the attribute information header. The attribute information header shown in  FIG. 99  includes THpnode (second threshold information) in addition to the components of the attribute information header shown in  FIG. 94 . When the minimum value of the valid node count of the grandparent node is 1, the hierarchical predictive encoding can be always applied for each child node group by setting THpnode=0. Therefore, in this case, RAHTPredictionFlag can be omitted. Therefore, the data size of the header can be reduced. 
     Note that the three-dimensional data encoding device may add RAHTPredictionFlag, THpnode, or THnode to the header after entropy-encoding RAHTPredictionFlag, THpnode, or THnode. For example, the three-dimensional data encoding device may binarize and arithmetically encode each value. Alternatively, the three-dimensional data encoding device may encode each value with a fixed length in order to reduce the processing amount. 
     RAHTPredictionFlag, THpnode, or THnode does not always have to be added to the header. For example, the value of RAHTPredictionFlag, THpnode, or THnode may be defined by profile or level of a standard or the like. In this way, the bit amount of the header can be reduced. 
       FIG. 100  is a flowchart of a three-dimensional data encoding process (a switching process for the hierarchical predictive encoding) in the second example. The process shown in  FIG. 100  is the process shown in  FIG. 95  additionally including step S 9525 . 
     First, the three-dimensional data encoding device determines whether the valid node count of the grandparent node group is greater than THpnode (S 9525 ). When the valid node count of the grandparent node group is greater than THpnode (if Yes in S 9525 ), the same processings as those in  FIG. 95  (S 9521  to S 9524 ) are performed. 
     On the other hand, when the valid node count of the grandparent node group is smaller than or equal to THpnode (if No in S 9525 ), the three-dimensional data encoding device performs the hierarchical non-predictive encoding of the attribute values of the child node group (S 9524 ). Note that when the valid node count of the grandparent node group is smaller than or equal to THpnode (if No in S 9525 ), the three-dimensional data encoding device may set the valid node count of the parent node group at 0. 
     When the valid node count of the grandparent node group is greater than THpnode (if Yes in S 9525 ), the three-dimensional data encoding device may perform the hierarchical predictive encoding of the attribute values of the child node group (S 9523 ) without performing steps S 9521  to S 9522 . 
       FIG. 101  is a flowchart of a three-dimensional data decoding process (a switching process for the hierarchical predictive decoding) in the second example. The process shown in  FIG. 101  is the process shown in  FIG. 96  additionally including step S 9535 . 
     First, the three-dimensional data decoding device determines whether the valid node count of the grandparent node group is greater than THpnode (S 9535 ). When the valid node count of the grandparent node group is greater than THpnode (if Yes in S 9535 ), the same processings as those in  FIG. 96  (S 9531  to S 9534 ) are performed. 
     On the other hand, when the valid node count of the grandparent node group is smaller than or equal to THpnode (if No in S 9535 ), the three-dimensional data decoding device performs the hierarchical non-predictive decoding of the attribute values of the child node group (S 9534 ). Note that when the valid node count of the grandparent node group is smaller than or equal to THpnode (if No in S 9535 ), the three-dimensional data decoding device may set the valid node count of the parent node group at 0. 
     When the valid node count of the grandparent node group is greater than THpnode (if Yes in S 9535 ), the three-dimensional data decoding device performs the hierarchical predictive decoding of the attribute values of the child node group (S 9533 ) without performing steps S 9531  to S 9532 . 
     Next, a third example of the encoding process will be described. As a condition for switching whether to use the hierarchical predictive encoding or not, condition 3 described below may be used. 
     Condition 3 is that the layer to which the child node group belongs is greater than a threshold (THlayer). The three-dimensional data encoding device applies the hierarchical predictive encoding when the layer to which the child node group belongs is greater than the threshold, and does not apply the hierarchical predictive encoding when the layer to which the child node group belongs is smaller than or equal to the threshold. Here, the layer is a layer for which the hierarchical encoding of the child node group to be encoded is performed with the RAHT or Haar transform, and corresponds to a value assigned to each layer. 
       FIG. 102  is a diagram illustrating a third example of the encoding process. For example, in the example shown in  FIG. 102 , the layer to which the parent node group belongs is 4, and the layer to which the child node group belongs is 1. For example, when THlayer=0, layer (=1)&gt;THlayer, and therefore, the three-dimensional data encoding device encodes the child node group using the hierarchical predictive encoding. When THlayer=4, layer (=1)&lt;=THlayer, and therefore, the three-dimensional data encoding device does not encode the child node group using the hierarchical predictive encoding. 
     In this way, for child nodes belonging to a higher layer, for which the valid node count tends to be greater, the three-dimensional data encoding device can generate a predicted value of high precision using the attribute value of the parent node or a neighboring parent node and therefore can improve the encoding efficiency by applying the hierarchical predictive encoding. On the other hand, when the layer is smaller than or equal to the threshold, the three-dimensional data encoding device does not apply the hierarchical predictive encoding and therefore can reduce the processing amount. 
     Note that when the three-dimensional data encoding device does not apply the hierarchical predictive encoding, the three-dimensional data encoding device applies the RAHT or Haar transform to the attribute value of the child node group and entropy-encodes the resulting transform coefficient, for example. 
       FIG. 103  is a diagram illustrating an example syntax of the attribute information header in the third example. The attribute information header shown in  FIG. 103  includes THlayer (third threshold information) in addition to the components of the attribute information header shown in  FIG. 98 . 
     THlayer is information for switching whether or not to apply the hierarchical predictive encoding for each layer to which the child nodes belong. THlayer is added to the attribute information header when RAHTPredictionFlag=1, and is not added to the attribute information header when RAHTPredictionFlag=0. The hierarchical predictive encoding is applied when the layer to which the child node group belongs is greater than THlayer, and is not applied when the layer to which the child node group belongs is smaller than or equal to THlayer. 
       FIG. 104  is a diagram illustrating another example syntax of the attribute information header. The attribute information header shown in  FIG. 104  includes THlayer (third threshold information) in addition to the components of the attribute information header shown in  FIG. 99 . By setting THlayer at the minimum value (−1, for example) of the layers, the hierarchical encoding can be always applied for each layer. Therefore, in this case, RAHTPredictionFlag can be omitted. Therefore, the data size of the header can be reduced. Note that THlayer [i] may be provided for each layer i for the RAHT or Haar transform, thereby indicating, for each layer, whether the hierarchical predictive encoding has been applied or not. In this way, an optimal threshold can be selected for each layer, and therefore, the encoding efficiency can be improved. 
     Note that the three-dimensional data encoding device may add RAHTPredictionFlag, THlayer, THpnode, or THnode to the header after entropy-encoding RAHTPredictionFlag, THlayer, THpnode, or THnode. For example, the three-dimensional data encoding device may binarize and arithmetically encode each value. Alternatively, the three-dimensional data encoding device may encode each value with a fixed length in order to reduce the processing amount. 
     RAHTPredictionFlag, THlayer, THpnode, or THnode does not always have to be added to the header. For example, the value of RAHTPredictionFlag, THlayer, THpnode, or THnode may be defined by profile or level of a standard or the like. In this way, the bit amount of the header can be reduced. 
       FIG. 105  is a flowchart of a three-dimensional data encoding process (a switching process for the hierarchical predictive encoding) in the third example. The process shown in  FIG. 105  is the process shown in  FIG. 100  additionally including step S 9526 . 
     First, the three-dimensional data encoding device determines whether the layer of the child node group is greater than THlayer (S 9526 ). When the layer of the child node group is greater than THlayer (if Yes in S 9526 ), the same processings as those in  FIG. 100  (S 9525  and the following steps) are performed. 
     On the other hand, when the layer of the child node group is smaller than or equal to THlayer (if No in S 9526 ), the three-dimensional data encoding device performs the hierarchical non-predictive encoding of the attribute values of the child node group (S 9524 ). 
     When the layer of the child node group is greater than THlayer (if Yes in S 9526 ), the three-dimensional data encoding device may perform the hierarchical predictive encoding of the attribute values of the child node group (S 9523 ) without performing steps S 9525  and S 9521  to S 9522 . Alternatively, the three-dimensional data encoding device may perform one of step S 9525  and steps S 9521  to S 9522 , and need not perform the other. 
       FIG. 106  is a flowchart of a three-dimensional data decoding process (a switching process for the hierarchical predictive decoding) in the third example. The process shown in  FIG. 106  is the process shown in  FIG. 101  additionally including step S 9536 . 
     First, the three-dimensional data decoding device determines whether the layer of the child node group is greater than THlayer (S 9536 ). When the layer of the child node group is greater than THlayer (if Yes in S 9536 ), the same processings as those in  FIG. 101  (S 9535  and the following steps) are performed. 
     On the other hand, when the layer of the child node group is smaller than or equal to THlayer (if No in S 9536 ), the three-dimensional data decoding device performs the hierarchical non-predictive decoding of the attribute values of the child node group (S 9534 ). 
     When the layer of the child node group is greater than THlayer (if Yes in S 9536 ), the three-dimensional data decoding device may perform the hierarchical predictive decoding of the attribute values of the child node group (S 9533 ) without performing steps S 9535  and S 9531  to S 9532 . Alternatively, the three-dimensional data decoding device may perform one of step S 9535  and steps S 9531  to S 9532 , and need not perform the other. 
     In the following, modifications of this embodiment will be described. In this embodiment, examples have been shown above in which when performing the hierarchical encoding using the RAHT or Haar transform, whether to apply the hierarchical predictive encoding or not is switched based on any one or a combination of conditions 1, 2, and 3. However, the present invention is not necessarily limited to this, and whether to apply the hierarchical predictive encoding or not can be switched in any manner. 
     For example, it is possible that the three-dimensional data encoding device applies the hierarchical predictive encoding when the absolute sum of the difference values of the transform coefficients of the child node group or the cost value is smaller than a threshold, and does not apply the hierarchical predictive encoding otherwise. In that case, the three-dimensional data encoding device may generate, for each child node group, information (PredFlag, for example) that indicates whether the hierarchical predictive encoding has been applied or not, and add the generated information to the bitstream. For example, PredFlag=1 when the hierarchical predictive encoding has been applied, and PrefFlag=0 when the hierarchical predictive encoding has not been applied. In this way, the three-dimensional data decoding device can determine whether or not to apply the hierarchical encoding for each child node by decoding PredFlag in the bitstream, and therefore can appropriately decode the bitstream. 
     Note that the three-dimensional data encoding device may arithmetically encode PredFlag after binarizing PredFlag. Alternatively, the three-dimensional data encoding device may change the encoding table for arithmetically encoding binarized data of PredFlag according to condition 1, 2, or 3. That is, the three-dimensional data encoding device may change the encoding table according to the valid node count of the parent node group, the valid node count of the grandparent node, or the layer to which the child node group belongs. In this way, the encoding efficiency can be improved by the hierarchical predictive encoding, while reducing the bit amount of PredFlag. Note that the three-dimensional data encoding device may combine the method that switches whether or not to apply the hierarchical predictive encoding based on any one or a combination of conditions 1, 2, and 3 and the method that uses PredFlag. In this way, the encoding efficiency can be improved. Note that the three-dimensional data decoding device may use the same approach as described above for selecting the encoding table used for arithmetic decoding of PredFlag. 
     In this embodiment, the three-dimensional data encoding device switches whether or not to apply the hierarchical predictive encoding for each child node group or for each layer to which the child node group belongs. However, the present invention is not necessarily limited to this. For example, the three-dimensional data encoding device may switch whether or not to apply the hierarchical predictive encoding for every N child node groups or for every M layers. Alternatively, the three-dimensional data encoding device may switch whether or not to apply the hierarchical predictive encoding on a basis of a larger unit than layer, such as slice or tile. In this way, the encoding efficiency can be improved while reducing the processing amount. 
     In this embodiment, examples have been shown above in which the three-dimensional data encoding device switches whether to apply the hierarchical encoding or not. However, the present invention is not necessarily limited to this. For example, the three-dimensional data encoding device may change the range or number of the nodes to be referred to and included in the parent node group according to the conditions described above, for example.  FIG. 107  is a diagram illustrating an example in which the range and number of the parent nodes to be referred to are changed. For example, as shown in  FIG. 107 , the three-dimensional data encoding device may reduce the range or number of parent node groups to be referred to when the layer to which the child node group belongs is smaller than or equal to threshold THlayer. In this way, the amount of processing, such as the calculation of the valid nodes of the parent node group, can be reduced. 
     As stated above, the three-dimensional data encoding device according to the present embodiment performs the process shown by  FIG. 108 . The three-dimensional data encoding device: determines whether a first valid node count is greater than a first threshold value predetermined (S 9541 ), the first valid node count being a total number of valid nodes that are nodes each including a three-dimensional point, the valid nodes being included in first nodes belonging to a layer higher than a layer of a current node in an N-ary tree structure of three-dimensional points included in point cloud data, N being an integer greater than or equal to 2; when the first valid node count is greater than the first threshold value (YES in S 9541 ), performs first encoding (e.g., layer predictive encoding) on attribute information of the current node (S 9542 ), the first encoding including a prediction process in which second nodes are used, the second nodes including a parent node of the current node and belonging to a same layer as the parent node; and when the first valid node count is less than or equal to the first threshold value (NO in S 9541 ), performs second encoding (e.g., layer non-predictive encoding) on attribute information of the current node (S 9543 ), the second encoding not including the prediction process in which the second nodes are used. 
     According to this configuration, since the three-dimensional data encoding device can appropriately select whether to use the first encoding including a prediction process, the three-dimensional encoding device can improve the encoding efficiency. 
     For example, the first nodes (e.g., a parent node group) include the parent node and nodes belonging to the same layer as the parent node. 
     For example, the first nodes (e.g., a grandparent node group) include a grandparent node of the current node and nodes belonging to a same layer as the grandparent node. 
     For example, in the second encoding, a predicted value of attribute information of the current node is set to zero. 
     For example, the three-dimensional data encoding device further generates a bitstream including attribute information of the current node encoded and first information (e.g., RAHTPredictionFlag) indicating whether the first encoding is applicable. For example, the three-dimensional data encoding device performs the process shown by  FIG. 108  when the first information indicates that the first encoding is applicable; and performs the second encoding (e.g., layer non-predictive encoding) on the attribute information of the current node when the first information fails to indicate that the first encoding is applicable (when the first information indicates that the first encoding is not applicable). 
     For example, the three-dimensional data encoding device further generates a bitstream including attribute information of the current node encoded and second information (e.g., THpnode or THnode) indicating the first threshold value. 
     For example, the three-dimensional data encoding device: determines whether a second valid node count is greater than a second threshold value predetermined, the second valid node count being a total number of valid nodes included in second nodes (e.g., a grandparent node group) including a grandparent node of the current node and nodes belonging to a same layer as the grandparent node; when the first valid node count is greater than the first threshold value, and the second valid node count is greater than the second threshold value, performs the first encoding on attribute information of the current node; and when the first valid node count is less than or equal to the first threshold value or the second valid node count is less than or equal to the second threshold value, performs the second encoding on attribute information of the current node. 
     For example, the three-dimensional data encoding device incudes a processor and memory, and the processor performs the above process using the memory. 
     The three-dimensional data decoding device according to the present embodiment performs the process shown by  FIG. 109 . The three-dimensional data decoding device: determines whether a first valid node count is greater than a first threshold value predetermined (S 9551 ), the first valid node count being a total number of valid nodes that are nodes each including a three-dimensional point, the valid nodes being included in first nodes belonging to a layer higher than a layer of a current node in an N-ary tree structure of three-dimensional points included in point cloud data, N being an integer greater than or equal to 2; when the first valid node count is greater than the first threshold value (YES in S 9551 ), performs first decoding on attribute information of the current node (S 9552 ), the first decoding including a prediction process in which second nodes are used, the second nodes including a parent node of the current node and belonging to a same layer as the parent node; and when the first valid node count is less than or equal to the first threshold value (NO in S 9551 ), performs second decoding on attribute information of the current node (S 9553 ), the second decoding not including the prediction process in which the second nodes are used. 
     According to this configuration, since the three-dimensional data decoding device can appropriately select whether to use the first decoding including a prediction process, the three-dimensional decoding device can improve the encoding efficiency. 
     For example, the first nodes (e.g., a parent node group) include the parent node and nodes belonging to the same layer as the parent node. 
     For example, the first nodes (e.g., a grandparent node group) include a grandparent node of the current node and nodes belonging to a same layer as the grandparent node. 
     For example, in the second encoding, a predicted value of attribute information of the current node is set to zero. 
     For example, the three-dimensional data decoding device further obtains first information (e.g., RAHTPredictionFlag) indicating whether the first decoding is applicable, from a bitstream including attribute information of the current node encoded. For example, the three-dimensional data decoding device performs the process shown by  FIG. 109  when the first information indicates that the first decoding is applicable; and performs the second decoding (e.g., layer non-predictive encoding) on the attribute information of the current node when the first information fails to indicate that the first decoding is applicable (when the first information indicates that the first decoding is not applicable). 
     For example, the three-dimensional data decoding device obtains second information (e.g., THpnode or THnode) indicating the first threshold value, from a bitstream including attribute information of the current node encoded. 
     For example, the three-dimensional data decoding device: determines whether a second valid node count is greater than a second threshold value predetermined, the second valid node count being a total number of valid nodes included in second nodes (e.g., a grandparent node group) including a grandparent node of the current node and nodes belonging to a same layer as the grandparent node; when the first valid node count is greater than the first threshold value, and the second valid node count is greater than the second threshold value, performs the first decoding on attribute information of the current node; and when the first valid node count is less than or equal to the first threshold value or the second valid node count is less than or equal to the second threshold value, performs the second decoding on attribute information of the current node. 
     For example, the three-dimensional data decoding device incudes a processor and memory, and the processor performs the above process using the memory. 
     Note that although it has been described here that when the first valid node count is greater than the first threshold value, the three-dimensional data encoding device performs the first encoding on the attribute information of the current node, the first encoding including a prediction process in which a plurality of second nodes are used, and the second nodes including a parent node of the current node and belonging to the same layer as the parent node, the same approach can be taken when the first valid node count is greater than or equal to the first threshold. That is, when the encoding including the prediction process is performed when the first valid node count of the parent node group is greater than or equal to the first threshold, the three-dimensional data encoding device performs the second encoding that does not include the prediction process on the attribute information of the current node when the first valid node count of the parent node group is smaller than the first threshold. 
     Similarly, although it has been described that when the first valid node count is greater than the first threshold value, the three-dimensional data decoding device performs the first decoding on the attribute information of the current node, the first decoding including a prediction process in which a plurality of second nodes are used, and the second nodes including a parent node of the current node and belonging to the same layer as the parent node, the same approach can be taken when the first valid node count is greater than or equal to the first threshold. That is, when the decoding including the prediction process is performed when the first valid node count of the parent node group is greater than or equal to the first threshold, the three-dimensional data decoding device performs the second decoding that does not include the prediction process on the attribute information of the current node when the first valid node count of the parent node group is smaller than the first threshold. 
     A three-dimensional data encoding device, a three-dimensional data decoding device, and the like according to the embodiments of the present disclosure have been described above, but the present disclosure is not limited to these embodiments. 
     Note that each of the processors included in the three-dimensional data encoding device, the three-dimensional data decoding device, and the like according to the above embodiments is typically implemented as a large-scale integrated (LSI) circuit, which is an integrated circuit (IC). These may take the form of individual chips, or may be partially or entirely packaged into a single chip. 
     Such IC is not limited to an LSI, and thus may be implemented as a dedicated circuit or a general-purpose processor. Alternatively, a field programmable gate array (FPGA) that allows for programming after the manufacture of an LSI, or a reconfigurable processor that allows for reconfiguration of the connection and the setting of circuit cells inside an LSI may be employed. 
     Moreover, in the above embodiments, the structural components may be implemented as dedicated hardware or may be realized by executing a software program suited to such structural components. Alternatively, the structural components may be implemented by a program executor such as a CPU or a processor reading out and executing the software program recorded in a recording medium such as a hard disk or a semiconductor memory. 
     The present disclosure may also be implemented as a three-dimensional data encoding method, a three-dimensional data decoding method, or the like executed by the three-dimensional data encoding device, the three-dimensional data decoding device, and the like. 
     Also, the divisions of the functional blocks shown in the block diagrams are mere examples, and thus a plurality of functional blocks may be implemented as a single functional block, or a single functional block may be divided into a plurality of functional blocks, or one or more functions may be moved to another functional block. Also, the functions of a plurality of functional blocks having similar functions may be processed by single hardware or software in a parallelized or time-divided manner. 
     Also, the processing order of executing the steps shown in the flowcharts is a mere illustration for specifically describing the present disclosure, and thus may be an order other than the shown order. Also, one or more of the steps may be executed simultaneously (in parallel) with another step. 
     A three-dimensional data encoding device, a three-dimensional data decoding device, and the like according to one or more aspects have been described above based on the embodiments, but the present disclosure is not limited to these embodiments. The one or more aspects may thus include forms achieved by making various modifications to the above embodiments that can be conceived by those skilled in the art, as well forms achieved by combining structural components in different embodiments, without materially departing from the spirit of the present disclosure. 
     Although only some exemplary embodiments of the present disclosure have been described in detail above, those skilled in the art will readily appreciate that many modifications are possible in the exemplary embodiments without materially departing from the novel teachings and advantages of the present disclosure. Accordingly, all such modifications are intended to be included within the scope of the present disclosure. 
     INDUSTRIAL APPLICABILITY 
     The present disclosure is applicable to a three-dimensional data encoding device and a three-dimensional data decoding device.