Patent ID: 8619864

Claim:
An encoder for encoding an input image, comprising: a first relation value calculator that calculates a first relation value indicating a relation between a target amount of codes and an amount of generated codes of an output stream in a past control unit time; a second relation value calculator that calculates a second relation value indicating a relation between a target amount of codes and an amount of generated codes of said output stream in a current control unit time after a coding process to a picture frame of the current control unit time is finished; and a code amount adjuster that adds stuffing bits to said picture frame after the coding process to the picture frame in said current control unit time is finished if there is a predetermined relation between said first relation value and said second relation value, wherein said first relation value calculator calculates a first cumulative target amount of codes by accumulating the target amount of codes of said output stream from a first control unit time to a previous control unit time, a first cumulative amount of generated codes by accumulating the amount of generated codes of said output stream from the first control unit time to the previous control unit time, and the relation between said first cumulative target amount of codes and said first cumulative amount of generated codes as said first relation value, and wherein said second relation value calculator calculates a second cumulative target amount of codes by accumulating the target amount of codes of said output stream by a unit of picture frame from a first picture frame to the picture frame to be processed in said current control unit time, a second cumulative amount of generated codes by accumulating the amount of generated codes of said output stream by the unit of picture frame from the first picture frame to the picture frame to be processed in said current control unit time and the relation between said second cumulative target amount of codes and said second cumulative amount of generated codes as said second relation value.