Adaptive coding: Difference between revisions

Content deleted Content added
complete rewrite
Added examples to contrast adaptive with static. removed one error.
Line 1:
'''Adaptive coding''' is a technique that is frequently usedrefers to increase the efficiencyvariants of various [[entropy encoding]] methods, byof reducing[[lossless thedata overheadcompression]]. thatThey theare encoderparticularly needssuited to sendstreaming to the decoder to start the processdata, andas bythey moreadapt accurately reflectingto localized changes in the characteristics of the data., and Itdon't alsorequire resultsa infirst some methods that ordinarily require two passespass over the data (such as [[Huffman coding]]) being able to completecalculate itsa jobprobability with just one pass over the datamodel. The cost paid for these advantages is that the encoder and decoder must be more complex to keep their states synchronized, and more computational power is needed to keep adapting the encoder/decoder state.
 
Almost all [[data compression]] methods involve the use of a ''model'', a prediction of the composition of the data. When the data matches the prediction made by the model, the encoder can usually transmit the content of the data at a lower information cost, by making reference to the model. While sometimes the model is implicit in the compression method (for instance, in [[run-length encoding]]), in most methods it is separate, and because both the encoder and the decoder need to use the model, it must be transmitted with the data.
 
In adaptive coding, the encoder and decoder are instead equipped with identical rules about how they will alter their models in response to the actual content of the data, and otherwise start with a blank slate, meaning that no initial model needs to be transmitted. As the data is transmitted, both encoder and decoder adapt their models, so that unless the character of the data changes radically, the model becomes better-adapted to the data it's handling and compresses it more efficiently.
 
'''''Adaptive Method'''''<br>
'''Encoder'''
# Initialize the data model as per agreement.
# While there is more data to send
## Encode the next symbol using the data model and send it.
## Modify the data model based on the last symbol.
 
'''Decoder'''
# Initialize the data model as per agreement.
# While there is more data to receive
## Decode the next symbol using the data model and output it.
## Modify the data model based on the decoded symbol.
 
Any adaptive coding method has a corresponding ''static model'' method, in which the data model is precalculated and then transmitted with the data.
 
'''''Static Method'''''<br>
'''Encoder'''
# Initialize the data model based on a first pass over the data.
# Transmit the data model.
# While there is more data to send
## Encode the next symbol using the data model and send it.
 
'''Decoder'''
# Receive the data model.
# While there is more data to receive
## Decode the next symbol using the data model and output it.