Browse Source

Move check into if statement

pull/298/head
James Jackson-South 9 years ago
parent
commit
0ff77ec6d6
  1. 48
      src/ImageSharp/Formats/Jpeg/Port/Components/ScanDecoder.cs

48
src/ImageSharp/Formats/Jpeg/Port/Components/ScanDecoder.cs

@ -622,29 +622,31 @@ namespace ImageSharp.Formats.Jpeg.Port.Components
// TODO: Adding this code introduces error into the decoder. // TODO: Adding this code introduces error into the decoder.
// It doesn't appear to speed anything up either. // It doesn't appear to speed anything up either.
// if (this.bitsUnRead < 8) // if (this.bitsUnRead < 8)
// { // {
// if (this.bitsCount <= 0) // if (this.bitsCount <= 0)
// { // {
// code = (short)this.ReadBit(stream); // code = (short)this.ReadBit(stream);
// this.bitsUnRead += 8; // if (this.endOfStreamReached || this.unexpectedMarkerReached)
// } // {
// if (this.endOfStreamReached || this.unexpectedMarkerReached) // return -1;
// { // }
// return -1; //
// } // this.bitsUnRead += 8;
// this.accumulator = (this.accumulator << 8) | this.bitsData; // }
// int lutIndex = (this.accumulator >> (this.bitsUnRead - 8)) & 0xFF; //
// int v = tree.Lookahead[lutIndex]; // this.accumulator = (this.accumulator << 8) | this.bitsData;
// if (v != 0) // int lutIndex = (this.accumulator >> (8 - this.bitsUnRead)) & 0xFF;
// { // int v = tree.Lookahead[lutIndex];
// int nb = (v & 0xFF) - 1; // if (v != 0)
// this.bitsCount -= nb - 1; // {
// this.bitsUnRead -= nb; // int nb = (v & 0xFF) - 1;
// v = v >> 8; // this.bitsCount -= nb - 1;
// return (short)v; // this.bitsUnRead -= nb;
// } // v = v >> 8;
// } // return (short)v;
// }
// }
if (code == -1) if (code == -1)
{ {
code = (short)this.ReadBit(stream); code = (short)this.ReadBit(stream);

Loading…
Cancel
Save