An encoding device includes an extracting unit that extracts, from voxel data expressing a three-dimensional shape by a collection of voxels arranged at lattice positions in a space, (i) structure information indicating presence/absence of a voxel at each lattice position and (ii) attribute information including an attribute value of each voxel; a structure encoding unit that encodes the structure information by determining a structure code corresponding to the structure information on a structure element having at least lattice position according to first context information indicating presence/absence of voxel at at least one predetermined lattice position around the structure element; and an attribute encoding unit that encodes an attribute value of a voxel of interest into an attribute code using second context information indicating presence/absence of a voxel at at least one predetermined lattice position around the voxel of interest.
Encoding device, decoding device, and non-transitory computer readable medium