Esempio n. 1
0
 /// <summary>
 /// A more-efficient overload that resuses a TJDecompressor instance and byte array.
 /// </summary>
 /// <param name="compressed"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="dec"></param>
 /// <param name="raw">May be null</param>
 public void Decode(byte[] compressed, out int width, out int height, turbojpegCLI.TJDecompressor dec, ref byte[] raw)
 {
     dec.setSourceImage(compressed, compressed.Length);
     width  = dec.getWidth();
     height = dec.getHeight();
     if (raw == null)
     {
         raw = dec.decompress(turbojpegCLI.PixelFormat.BGR, turbojpegCLI.Flag.NONE);
     }
     else
     {
         dec.decompress(raw, turbojpegCLI.PixelFormat.BGR, turbojpegCLI.Flag.NONE);
     }
 }
Esempio n. 2
0
 public override byte[] Decode(byte[] compressed, out int width, out int height)
 {
     using (turbojpegCLI.TJDecompressor dec = new turbojpegCLI.TJDecompressor())
     {
         dec.setSourceImage(compressed, compressed.Length);
         width  = dec.getWidth();
         height = dec.getHeight();
         return(dec.decompress(turbojpegCLI.PixelFormat.BGR, turbojpegCLI.Flag.NONE));
     }
 }