示例#1
0
    // Token: 0x06002819 RID: 10265 RVA: 0x00091C0C File Offset: 0x0008FE0C
    private void InitCategoryfloat()
    {
        int num  = 1;
        int num2 = 2;

        for (int i = 1; i <= 15; i++)
        {
            for (int j = num; j < num2; j++)
            {
                this.category[32767 + j] = i;
                global::JPGEncoder.BitString bitString = default(global::JPGEncoder.BitString);
                bitString.length        = i;
                bitString.value         = j;
                this.bitcode[32767 + j] = bitString;
            }
            for (int j = -(num2 - 1); j <= -num; j++)
            {
                this.category[32767 + j] = i;
                global::JPGEncoder.BitString bitString = default(global::JPGEncoder.BitString);
                bitString.length        = i;
                bitString.value         = num2 - 1 + j;
                this.bitcode[32767 + j] = bitString;
            }
            num  <<= 1;
            num2 <<= 1;
        }
    }
示例#2
0
    // Token: 0x0600281B RID: 10267 RVA: 0x00091D1C File Offset: 0x0008FF1C
    private void WriteBits(global::JPGEncoder.BitString bs)
    {
        int value = bs.value;
        int i     = bs.length - 1;

        while (i >= 0)
        {
            if (((long)value & (long)((ulong)Convert.ToUInt32(1 << i))) != 0L)
            {
                this.bytenew |= Convert.ToUInt32(1 << this.bytepos);
            }
            i--;
            this.bytepos--;
            if (this.bytepos < 0)
            {
                if (this.bytenew == 255u)
                {
                    this.WriteByte(byte.MaxValue);
                    this.WriteByte(0);
                }
                else
                {
                    this.WriteByte((byte)this.bytenew);
                }
                this.bytepos = 7;
                this.bytenew = 0u;
            }
        }
    }
示例#3
0
    // Token: 0x06002824 RID: 10276 RVA: 0x0009243C File Offset: 0x0009063C
    private float ProcessDU(float[] CDU, float[] fdtbl, float DC, global::JPGEncoder.BitString[] HTDC, global::JPGEncoder.BitString[] HTAC)
    {
        global::JPGEncoder.BitString bs  = HTAC[0];
        global::JPGEncoder.BitString bs2 = HTAC[240];
        float[] array = this.FDCTQuant(CDU, fdtbl);
        for (int i = 0; i < 64; i++)
        {
            this.DU[this.ZigZag[i]] = (int)array[i];
        }
        int num = (int)((float)this.DU[0] - DC);

        DC = (float)this.DU[0];
        if (num == 0)
        {
            this.WriteBits(HTDC[0]);
        }
        else
        {
            this.WriteBits(HTDC[this.category[32767 + num]]);
            this.WriteBits(this.bitcode[32767 + num]);
        }
        int num2 = 63;

        while (num2 > 0 && this.DU[num2] == 0)
        {
            num2--;
        }
        if (num2 == 0)
        {
            this.WriteBits(bs);
            return(DC);
        }
        for (int i = 1; i <= num2; i++)
        {
            int num3 = i;
            while (this.DU[i] == 0 && i <= num2)
            {
                i++;
            }
            int num4 = i - num3;
            if (num4 >= 16)
            {
                for (int j = 1; j <= num4 / 16; j++)
                {
                    this.WriteBits(bs2);
                }
                num4 &= 15;
            }
            this.WriteBits(HTAC[num4 * 16 + this.category[32767 + this.DU[i]]]);
            this.WriteBits(this.bitcode[32767 + this.DU[i]]);
        }
        if (num2 != 63)
        {
            this.WriteBits(bs);
        }
        return(DC);
    }
示例#4
0
    // Token: 0x06002817 RID: 10263 RVA: 0x00091B10 File Offset: 0x0008FD10
    private global::JPGEncoder.BitString[] ComputeHuffmanTbl(byte[] nrcodes, byte[] std_table)
    {
        int num  = 0;
        int num2 = 0;

        global::JPGEncoder.BitString[] array = new global::JPGEncoder.BitString[256];
        for (int i = 1; i <= 16; i++)
        {
            for (int j = 1; j <= (int)nrcodes[i]; j++)
            {
                array[(int)std_table[num2]]        = default(global::JPGEncoder.BitString);
                array[(int)std_table[num2]].value  = num;
                array[(int)std_table[num2]].length = i;
                num2++;
                num++;
            }
            num *= 2;
        }
        return(array);
    }