docs: private static BitmapFactory.Options getDecodeOptionsForStream(
        EncodedImage encodedImage, Bitmap.Config bitmapConfig) {
      final BitmapFactory.Options options = new BitmapFactory.Options();
      // Sample size should ONLY be different than 1 when downsampling is enabled in the pipeline
      options.inSampleSize = encodedImage.getSampleSize();
      options.inJustDecodeBounds = true;
      // fill outWidth and outHeight
      BitmapFactory.decodeStream(encodedImage.getInputStream(), null, options);
      if (options.outWidth == -1 || options.outHeight == -1) {
        throw new IllegalArgumentException();
      }
  
      options.inJustDecodeBounds = false;
      options.inDither = true;
      options.inPreferredConfig = bitmapConfig;
      options.inMutable = true;
  
      return options;
    }