Encoder part 1