internal void decode_ac_coefficients(JPEGBinaryReader JPEGStream, float[] zz) { int num; for (num = 1; num < 64; num++) { int num2 = ACTable.Decode(JPEGStream); int num3 = num2 >> 4; num2 &= 0xF; if (num2 != 0) { num += num3; num3 = JPEGStream.ReadBits(num2); num2 = HuffmanTable.Extend(num3, num2); zz[num] = num2; } else { if (num3 != 15) { break; } num += 15; } } }
public void DecodeDCRefine(JPEGBinaryReader stream, float[] dest) { if (stream.ReadBits(1) == 1) { dest[0] = (int)dest[0] | (1 << successiveLow); } }
/// <summary> /// Generated from text on F-23, F.13 - Huffman decoded of AC coefficients /// on ISO DIS 10918-1. Requirements and Guidelines. /// </summary> internal void decode_ac_coefficients(JPEGBinaryReader JPEGStream, float[] zz) { for (int k = 1; k < 64; k++) { int s = ACTable.Decode(JPEGStream); int r = s >> 4; s &= 15; if (s != 0) { k += r; r = (int)JPEGStream.ReadBits(s); s = (int)HuffmanTable.Extend(r, s); zz[k] = s; } else { if (r != 15) { //throw new JPEGMarkerFoundException(); return; } k += 15; } } }
public float decode_dc_coefficient(JPEGBinaryReader JPEGStream) { int num = DCTable.Decode(JPEGStream); float num2 = JPEGStream.ReadBits(num); num2 = HuffmanTable.Extend((int)num2, num); return(previousDC += num2); }
public void DecodeDCFirst(JPEGBinaryReader stream, float[] dest) { int num = DCTable.Decode(stream); num = HuffmanTable.Extend(stream.ReadBits(num), num); num = (int)previousDC + num; previousDC = num; dest[0] = num << successiveLow; }
public int Decode(JPEGBinaryReader JPEGStream) { int index = 0; short num2 = (short)JPEGStream.ReadBits(1); while (num2 > this.maxcode[index]) { index++; num2 = (short)(num2 << 1); num2 = (short)(num2 | ((short)JPEGStream.ReadBits(1))); } int num3 = this.huffval[num2 + this.valptr[index]]; if (num3 < 0) { num3 = 0x100 + num3; } return(num3); }
/// <summary> /// Generated from text on F-22, F.2.2.1 - Huffman decoding of DC /// coefficients on ISO DIS 10918-1. Requirements and Guidelines. /// </summary> /// <param name="JPEGStream">Stream that contains huffman bits</param> /// <returns>DC coefficient</returns> public float decode_dc_coefficient(JPEGBinaryReader JPEGStream) { int t = DCTable.Decode(JPEGStream); float diff = JPEGStream.ReadBits(t); diff = HuffmanTable.Extend((int)diff, t); diff = (previousDC + diff); previousDC = diff; return(diff); }
public void DecodeDCFirst(JPEGBinaryReader stream, float[] dest) { float[] numArray = new float[0x40]; int t = this.DCTable.Decode(stream); t = HuffmanTable.Extend(stream.ReadBits(t), t); t = ((int)this.previousDC) + t; this.previousDC = t; dest[0] = t << this.successiveLow; }
public void DecodeACFirst(JPEGBinaryReader stream, float[] zz) { if (stream.eob_run > 0) { stream.eob_run--; return; } for (int k = spectralStart; k <= spectralEnd; k++) { int s = ACTable.Decode(stream); int r = s >> 4; s &= 15; if (s != 0) { k += r; r = (int)stream.ReadBits(s); s = (int)HuffmanTable.Extend(r, s); zz[k] = s << successiveLow; } else { if (r != 15) { stream.eob_run = 1 << r; if (r != 0) { stream.eob_run += stream.ReadBits(r); } stream.eob_run--; break; } k += 15; } } }
/// <summary>Figure F.16 - Reads the huffman code bit-by-bit.</summary> public int Decode(JPEGBinaryReader JPEGStream) { int i = 0; short code = (short)JPEGStream.ReadBits(1); while (code > maxcode[i]) { i++; code <<= 1; code |= (short)JPEGStream.ReadBits(1); } int val = huffval[code + (valptr[i])]; if (val < 0) { val = 256 + val; } return(val); }
public void DecodeACFirst(JPEGBinaryReader stream, float[] zz) { if (stream.eob_run > 0) { stream.eob_run--; return; } int num = spectralStart; int num3; while (true) { if (num > spectralEnd) { return; } int num2 = ACTable.Decode(stream); num3 = num2 >> 4; num2 &= 0xF; if (num2 != 0) { num += num3; num3 = stream.ReadBits(num2); num2 = HuffmanTable.Extend(num3, num2); zz[num] = num2 << successiveLow; } else { if (num3 != 15) { break; } num += 15; } num++; } stream.eob_run = 1 << num3; if (num3 != 0) { stream.eob_run += stream.ReadBits(num3); } stream.eob_run--; }
public void DecodeDCFirst(JPEGBinaryReader stream, float[] dest) { //float[] datablock = new float[64]; int s = DCTable.Decode(stream); int r = stream.ReadBits(s); s = HuffmanTable.Extend(r, s); s = (int)previousDC + s; previousDC = s; dest[0] = s << successiveLow; }
public void DecodeACFirst(JPEGBinaryReader stream, float[] zz) { if (stream.eob_run > 0) { stream.eob_run--; } else { for (int i = this.spectralStart; i <= this.spectralEnd; i++) { int t = this.ACTable.Decode(stream); int n = t >> 4; t &= 15; if (t != 0) { i += n; t = HuffmanTable.Extend(stream.ReadBits(t), t); zz[i] = t << this.successiveLow; } else { if (n != 15) { stream.eob_run = ((int)1) << n; if (n != 0) { stream.eob_run += stream.ReadBits(n); } stream.eob_run--; break; } i += 15; } } } }
public int Decode(JPEGBinaryReader JPEGStream) { int num = 0; short num2; for (num2 = (short)JPEGStream.ReadBits(1); num2 > maxcode[num]; num2 = (short)(num2 | (short)JPEGStream.ReadBits(1))) { num++; num2 = (short)(num2 << 1); } int num3 = huffval[num2 + valptr[num]]; if (num3 < 0) { num3 = 256 + num3; } return(num3); }
internal void decode_ac_coefficients(JPEGBinaryReader JPEGStream, float[] zz) { for (int i = 1; i < 0x40; i++) { int t = this.ACTable.Decode(JPEGStream); int num3 = t >> 4; t &= 15; if (t != 0) { i += num3; zz[i] = HuffmanTable.Extend(JPEGStream.ReadBits(t), t); } else { if (num3 != 15) { break; } i += 15; } } }
public void DecodeACRefine(JPEGBinaryReader stream, float[] dest) { int p1 = 1 << successiveLow; int m1 = (-1) << successiveLow; int k = spectralStart; if (stream.eob_run == 0) { for (; k <= spectralEnd; k++) { #region Decode and check S int s = ACTable.Decode(stream); int r = s >> 4; s &= 15; if (s != 0) { if (s != 1) { throw new Exception("Decode Error"); } if (stream.ReadBits(1) == 1) { s = p1; } else { s = m1; } } else { if (r != 15) { stream.eob_run = 1 << r; if (r > 0) { stream.eob_run += stream.ReadBits(r); } break; } } // if (s != 0) #endregion // Apply the update do { if (dest[k] != 0) { if (stream.ReadBits(1) == 1) { if (((int)dest[k] & p1) == 0) { if (dest[k] >= 0) { dest[k] += p1; } else { dest[k] += m1; } } } } else { if (--r < 0) { break; } } k++; } while (k <= spectralEnd); if ((s != 0) && k < 64) { dest[k] = s; } } // for k = start ... end } if (stream.eob_run > 0) { for (; k <= spectralEnd; k++) { if (dest[k] != 0) { if (stream.ReadBits(1) == 1) { if (((int)dest[k] & p1) == 0) { if (dest[k] >= 0) { dest[k] += p1; } else { dest[k] += m1; } } } } } stream.eob_run--; } }
public void DecodeACRefine(JPEGBinaryReader stream, float[] dest) { int num = ((int)1) << this.successiveLow; int num2 = ((int)(-1)) << this.successiveLow; int spectralStart = this.spectralStart; if (stream.eob_run == 0) { while (spectralStart <= this.spectralEnd) { int num4 = this.ACTable.Decode(stream); int n = num4 >> 4; num4 &= 15; if (num4 != 0) { if (num4 != 1) { throw new Exception("Decode Error"); } if (stream.ReadBits(1) == 1) { num4 = num; } else { num4 = num2; } } else if (n != 15) { stream.eob_run = ((int)1) << n; if (n > 0) { stream.eob_run += stream.ReadBits(n); } break; } do { if (dest[spectralStart] != 0f) { if ((stream.ReadBits(1) == 1) && ((((int)dest[spectralStart]) & num) == 0)) { if (dest[spectralStart] >= 0f) { dest[spectralStart] += num; } else { dest[spectralStart] += num2; } } } else if (--n < 0) { break; } spectralStart++; }while (spectralStart <= this.spectralEnd); if ((num4 != 0) && (spectralStart < 0x40)) { dest[spectralStart] = num4; } spectralStart++; } } if (stream.eob_run > 0) { while (spectralStart <= this.spectralEnd) { if (((dest[spectralStart] != 0f) && (stream.ReadBits(1) == 1)) && ((((int)dest[spectralStart]) & num) == 0)) { if (dest[spectralStart] >= 0f) { dest[spectralStart] += num; } else { dest[spectralStart] += num2; } } spectralStart++; } stream.eob_run--; } }
public void DecodeACRefine(JPEGBinaryReader stream, float[] dest) { int num = 1 << successiveLow; int num2 = -1 << successiveLow; int i = spectralStart; if (stream.eob_run == 0) { for (; i <= spectralEnd; i++) { int num3 = ACTable.Decode(stream); int num4 = num3 >> 4; num3 &= 0xF; if (num3 != 0) { if (num3 != 1) { throw new Exception("Decode Error"); } num3 = ((stream.ReadBits(1) != 1) ? num2 : num); } else if (num4 != 15) { stream.eob_run = 1 << num4; if (num4 > 0) { stream.eob_run += stream.ReadBits(num4); } break; } do { if (dest[i] != 0f) { if (stream.ReadBits(1) == 1 && ((int)dest[i] & num) == 0) { if (dest[i] >= 0f) { dest[i] += num; } else { dest[i] += num2; } } } else if (--num4 < 0) { break; } i++; }while (i <= spectralEnd); if (num3 != 0 && i < 64) { dest[i] = num3; } } } if (stream.eob_run <= 0) { return; } for (; i <= spectralEnd; i++) { if (dest[i] != 0f && stream.ReadBits(1) == 1 && ((int)dest[i] & num) == 0) { if (dest[i] >= 0f) { dest[i] += num; } else { dest[i] += num2; } } } stream.eob_run--; }