The invention relates to a coding apparatus for embedding second data into
first data without deteriorating the first data and a decoding apparatus
for decoding coded data into original first data and second data without
deteriorating those data. The invention provides a coding apparatus which
has a memory for storing at least partial data of first data, and embeds
second data into the first data by rearranging, according to the second
data, the at least partial data of the first data that is stored in the
memory. The invention also provides a coding apparatus for decoding coded
data in which second data is embedded and at least partial data of the
coded data has been subjected to rearrangement by using one of a
plurality of rearrangement patterns. The decoding apparatus calculates
correlation between adjacent data for each rearrangement pattern, and
decodes the original first data and the second data according to a
rearrangement pattern that is determined based on the correlation.