@VisibleForTesting
  public static BitmapFactory.Options getBitmapFactoryOptions(
      int sampleSize, Bitmap.Config bitmapConfig) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inDither = true; // known to improve picture quality at low cost
    options.inPreferredConfig = bitmapConfig;
    // Decode the image into a 'purgeable' bitmap that lives on the ashmem heap
    options.inPurgeable = true;
    // Enable copy of of bitmap to enable purgeable decoding by filedescriptor
    options.inInputShareable = true;
    // Sample size should ONLY be different than 1 when downsampling is enabled in the pipeline
    options.inSampleSize = sampleSize;
    options.inMutable = true; // no known perf difference; allows postprocessing to work
    return options;
  }
Decodes a byteArray containing jpeg encoded bytes into a purgeable bitmap

<p>Adds a JFIF End-Of-Image marker if needed before decoding.

@param bytesRef the byte buffer that contains the encoded bytes
@param length the number of encoded bytes in the buffer
@param options the options passed to the BitmapFactory
@return
imagepipeline-native/src/main/java/com/facebook/imagepipeline/nativecode/DalvikPurgeableDecoder.java