coders
Class ProgressiveDivisibilityEncoder

java.lang.Object
  extended by coders.Encoder
      extended by coders.ProgressiveDivisibilityEncoder

public class ProgressiveDivisibilityEncoder
extends Encoder

Author:
Jonathan L Dautrich Jr.

Field Summary
private  int achievedCapacity
           
private  int adjustmentCount
           
private  int escapeCount
           
private  java.util.LinkedList<java.lang.Integer> integerPayload
           
private  int n
           
private  boolean suppressPayloadCapacityErrors
           
 java.util.ArrayList<java.lang.Integer> tempCEmbedding
           
private  int transformableCount
           
 
Fields inherited from class coders.Encoder
encoded, encodedBitmap, originalBitmap, payload, psnr, psnrComputed
 
Constructor Summary
ProgressiveDivisibilityEncoder(Bitmap originalBitmap, BitSequence payload, int n)
           
 
Method Summary
 void encode()
          This method uses the progressive divisibility method to encode the specified payload, along with corrective information, into the bitmap.
 int getAchievedCapacity()
           
 void setPayloadCapacityErrorSuppression(boolean suppress)
           
 
Methods inherited from class coders.Encoder
computePSNR, getEncodedBitmap, getOriginalBitmap, getPayload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tempCEmbedding

public java.util.ArrayList<java.lang.Integer> tempCEmbedding

n

private final int n

integerPayload

private java.util.LinkedList<java.lang.Integer> integerPayload

achievedCapacity

private int achievedCapacity

transformableCount

private int transformableCount

adjustmentCount

private int adjustmentCount

escapeCount

private int escapeCount

suppressPayloadCapacityErrors

private boolean suppressPayloadCapacityErrors
Constructor Detail

ProgressiveDivisibilityEncoder

public ProgressiveDivisibilityEncoder(Bitmap originalBitmap,
                                      BitSequence payload,
                                      int n)
Method Detail

encode

public void encode()
This method uses the progressive divisibility method to encode the specified payload, along with corrective information, into the bitmap. It has two phases.

In the first phase, we consider each pixel. If the pixel can be transformed (satisfies divisibility constraint and thus information can be stored within it that causes it to no longer satisfy the divisibility constraint), it is transformed, but no data is embedded. If it cannot be transformed, it is adjusted to satisfy the divisibility constraint and its corrective data is added to the list of correction values (cValues).

In the second phase, we go through every pixel in reverse order. If it had note been transformed, it is ignored. If it had been transformed, data is embedded in it. The decoder will require each pixel to be restored to its original value before it can extract information from the subsequent pixel. Thus the corrective values must be embedded first, as they will be needed to restore up-coming pixels during decoding.

Only values between 1 and n inclusive can be embedded, but values from 0 to n inclusive may need to be encoded as corrective data. We thus implement a special escape value. Whenever we want embed a (0) or (1), we will embed a (1) followed by a (1) or (2) respectively. This allows us to keep the embedded data within range. A special escaped pair (1), (n) will be embedded to indicate the end of the corrective data and the beginning of the payload data, so that the payload data is unencumbered by the escape sequence limitations.

Specified by:
encode in class Encoder

getAchievedCapacity

public int getAchievedCapacity()

setPayloadCapacityErrorSuppression

public void setPayloadCapacityErrorSuppression(boolean suppress)