An absolute encoder comprising: a scale in which a plurality of marks, comprising a plurality of types of marks (2a,2c), are arranged into arrangements with a space between any adjacent two marks of the plurality of marks and a spatial periodicity with each period including a mark and a space, wherein each of the arrangements comprises plural consecutive marks, and wherein each of the plurality of types of mark corresponds to a value of a code; a detector including a plurality of elements arranged along a direction corresponding to a direction in which the plurality of marks are arranged, and configured to detect one of the arrangements by the plurality of elements and to output periodic signals with a plurality of periods; and a signal processor configured to perform quantization of an amplitude with respect to each period of the periodic signals with the plurality of periods output from the detector to generate a data string, and further configured to generate, based on the generated data string, first position data which represents an absolute position of the scale or the detector, and has a resolution of the period, wherein the signal processor is configured, in the quantization process, to obtain a plurality of threshold values, each of the plurality of threshold values being used for obtaining a value of the code corresponding thereto and the plurality of threshold values respectively corresponding to one of the arrangements and being obtained based on an upper reference curve and a lower reference curve which are determined using respectively a higher group and a lower group of representative values out of a plurality of representative values, wherein each of the plurality of representative values is a representative value for a period of the periodic signals with the plurality of periods. a scale in which a plurality of marks, comprising a plurality of types of marks (2a,2c), are arranged into arrangements with a space between any adjacent two marks of the plurality of marks and a spatial periodicity with each period including a mark and a space, wherein each of the arrangements comprises plural consecutive marks, and wherein each of the plurality of types of mark corresponds to a value of a code; a detector including a plurality of elements arranged along a direction corresponding to a direction in which the plurality of marks are arranged, and configured to detect one of the arrangements by the plurality of elements and to output periodic signals with a plurality of periods; and a signal processor configured to perform quantization of an amplitude with respect to each period of the periodic signals with the plurality of periods output from the detector to generate a data string, and further configured to generate, based on the generated data string, first position data which represents an absolute position of the scale or the detector, and has a resolution of the period, wherein the signal processor is configured, in the quantization process, to obtain a plurality of threshold values, each of the plurality of threshold values being used for obtaining a value of the code corresponding thereto and the plurality of threshold values respectively corresponding to one of the arrangements and being obtained based on an upper reference curve and a lower reference curve which are determined using respectively a higher group and a lower group of representative values out of a plurality of representative values, wherein each of the plurality of representative values is a representative value for a period of the periodic signals with the plurality of periods.