An encoder includes processing circuitry, a block memory, and a frame memory. The processing circuitry defines at least one parameter for each of plural types of segment_ids, splits an image into blocks, assigns, to each of the blocks, segment_id according to a type of the block, among the plural types of segment_ids, and sequentially encodes the blocks. In encoding the blocks, the processing circuitry identifies segment_id of a current block to be encoded, and encodes the current block using the at least one parameter defined for identified segment_id. The at least one parameter includes seg_context_idx for identifying probability information associated with context used in context-based adaptive binary arithmetic coding (CABAC).