Patent ID: 8032645

Claim:
A coding apparatus comprising: a coding unit for generating each of frames of coded data by coding inputted data; a storage unit for storing the frames of the coded data generated by the coding unit; a packetization unit for packetizing n (n being an integer equal to or greater than 1) of the frames of the coded data stored in the storage unit into at least one packet having a fixed length; and a control unit for generating control information indicating a data size of all the frames of the coded data stored in the storage unit, a header size of a header assigned to the n frames of the coded data and a payload size of the packet, and outputting the control information to the coding unit, wherein the coding unit: judges whether or not a frame of the coded data generated by the coding unit is a specified frame of the coded data; and when the coding unit judges that the frame of the coded data is the specified frame of the coded data: (1) calculates an outer candidate value, which is a target value of a data size of a next frame of the coded data to be generated next, to make a sum of data sizes of the n of the frames of the coded data and the header size to be an integral multiple of the payload size of the packet, based on the payload size, the header size, and the data size of all the frames which are indicated by the control information; and (2) determines whether or not the outer candidate value results in a differential value that is smaller than a threshold value, and (3) when the differential value is smaller than the threshold value, generates the next frame of the coded data by adjusting the data size of the coded data so as to match the data size of the coded data to the outer candidate value.