亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jpegencoder.java

?? JavaExplorer是一個獨立于平臺的瀏覽器
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
// Version 1.0a// Copyright (C) 1998, James R. Weeks and BioElectroMech.// Visit BioElectroMech at www.obrador.com.  Email James@obrador.com.// See license.txt for details about the allowed used of this software.// This software is based in part on the work of the Independent JPEG Group.// See IJGreadme.txt for details about the Independent JPEG Group's license.// This encoder is inspired by the Java Jpeg encoder by Florian Raemy,// studwww.eurecom.fr/~raemy.// It borrows a great deal of code and structure from the Independent// Jpeg Group's Jpeg 6a library, Copyright Thomas G. Lane.// See license.txt for details.package javaexplorer.io.encoder;import java.awt.*;import java.awt.image.*;import java.io.*;import java.util.*;/** JpegEncoder - The JPEG main program which performs a jpeg compression of* an image.*//** Writes images to stream in JPEG format. */public class JpegEncoder {    static int Quality;    static int defaultQuality = 75;    static {        setQuality(50);    }    public static int[] jpegNaturalOrder = {        0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33,        40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43,        36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53,        60, 61, 54, 47, 55, 62, 63,    };    Thread runner;    BufferedOutputStream outStream;    Image image;    JpegInfo JpegObj;    Huffman Huf;    DCT dct;    int imageHeight;    int imageWidth;    int code;    public JpegEncoder(Image image, int quality, OutputStream out) {        /*        * Quality of the image.        * 0 to 100 and from bad image quality, high compression to good        * image quality low compression        */        Quality = quality;        /*        * Getting picture information        * It takes the Width, Height and RGB scans of the image.        */        JpegObj = new JpegInfo(image);        imageHeight = JpegObj.imageHeight;        imageWidth = JpegObj.imageWidth;        outStream = new BufferedOutputStream(out);        dct = new DCT(Quality);        Huf = new Huffman(imageWidth, imageHeight);    }    /** Specifies the image quality (0-100). 0 is poorest image quality,            highest compression, and 100 is best image quality, lowest compression. */    public static void setQuality(int quality) {        if (quality < 0) {            quality = 0;        }        if (quality > 100) {            quality = 100;        }        Quality = quality;    }    public static int getQuality() {        return Quality;    }    public void Compress() {        WriteHeaders(outStream);        WriteCompressedData(outStream);        WriteEOI(outStream);        try {            outStream.flush();        } catch (IOException e) {            System.out.println("IO Error: " + e.getMessage());        }    }    public void WriteCompressedData(BufferedOutputStream outStream) {        int offset;        int i;        int j;        int r;        int c;        int a;        int b;        int temp = 0;        int comp;        int xpos;        int ypos;        int xblockoffset;        int yblockoffset;        float[][] inputArray;        float[][] dctArray1 = new float[8][8];        double[][] dctArray2 = new double[8][8];        int[] dctArray3 = new int[8 * 8];        /*         * This method controls the compression of the image.         * Starting at the upper left of the image, it compresses 8x8 blocks         * of data until the entire image has been compressed.         */        int[] lastDCvalue = new int[JpegObj.NumberOfComponents];        int[] zeroArray = new int[64]; // initialized to hold all zeros        int Width = 0;        int Height = 0;        int nothing = 0;        int not;        int MinBlockWidth;        int MinBlockHeight;        // This initial setting of MinBlockWidth and MinBlockHeight is done to        // ensure they start with values larger than will actually be the case.        MinBlockWidth = (((imageWidth % 8) != 0)            ? ((int) (Math.floor((double) imageWidth / 8.0) + 1) * 8) : imageWidth);        MinBlockHeight = (((imageHeight % 8) != 0)            ? ((int) (Math.floor((double) imageHeight / 8.0) + 1) * 8)            : imageHeight);        for (comp = 0; comp < JpegObj.NumberOfComponents; comp++) {            MinBlockWidth = Math.min(MinBlockWidth, JpegObj.BlockWidth[comp]);            MinBlockHeight = Math.min(MinBlockHeight, JpegObj.BlockHeight[comp]);        }        xpos = 0;        for (r = 0; r < MinBlockHeight; r++) {            for (c = 0; c < MinBlockWidth; c++) {                xpos = c * 8;                ypos = r * 8;                for (comp = 0; comp < JpegObj.NumberOfComponents; comp++) {                    Width = JpegObj.BlockWidth[comp];                    Height = JpegObj.BlockHeight[comp];                    inputArray = (float[][]) JpegObj.Components[comp];                    for (i = 0; i < JpegObj.VsampFactor[comp]; i++) {                        for (j = 0; j < JpegObj.HsampFactor[comp]; j++) {                            xblockoffset = j * 8;                            yblockoffset = i * 8;                            for (a = 0; a < 8; a++) {                                for (b = 0; b < 8; b++) {                                    // I believe this is where the dirty line at the bottom of the image is                                    // coming from.  I need to do a check here to make sure I'm not reading past                                    // image data.                                    // This seems to not be a big issue right now. (04/04/98)                                    dctArray1[a][b] = inputArray[ypos +                                        yblockoffset + a][xpos + xblockoffset +                                        b];                                }                            }                            // The following code commented out because on some images this technique                            // results in poor right and bottom borders.                            //                        if ((!JpegObj.lastColumnIsDummy[comp] || c < Width - 1) && (!JpegObj.lastRowIsDummy[comp] || r < Height - 1)) {                            dctArray2 = dct.forwardDCT(dctArray1);                            dctArray3 = dct.quantizeBlock(dctArray2,                                    JpegObj.QtableNumber[comp]);                            //                        }                            //                        else {                            //                           zeroArray[0] = dctArray3[0];                            //                           zeroArray[0] = lastDCvalue[comp];                            //                           dctArray3 = zeroArray;                            //                        }                            Huf.HuffmanBlockEncoder(outStream, dctArray3,                                lastDCvalue[comp], JpegObj.DCtableNumber[comp],                                JpegObj.ACtableNumber[comp]);                            lastDCvalue[comp] = dctArray3[0];                        }                    }                }            }        }    }    public void WriteEOI(BufferedOutputStream out) {        byte[] EOI = { (byte) 0xFF, (byte) 0xD9 };        WriteMarker(EOI, out);    }    public void WriteHeaders(BufferedOutputStream out) {        int i;        int j;        int index;        int offset;        int length;        int[] tempArray;        // the SOI marker        byte[] SOI = { (byte) 0xFF, (byte) 0xD8 };        WriteMarker(SOI, out);        // The order of the following headers is quiet inconsequential.        // the JFIF header        byte[] JFIF = new byte[18];        JFIF[0] = (byte) 0xff;        JFIF[1] = (byte) 0xe0;        JFIF[2] = (byte) 0x00;        JFIF[3] = (byte) 0x10;        JFIF[4] = (byte) 0x4a;        JFIF[5] = (byte) 0x46;        JFIF[6] = (byte) 0x49;        JFIF[7] = (byte) 0x46;        JFIF[8] = (byte) 0x00;        JFIF[9] = (byte) 0x01;        JFIF[10] = (byte) 0x00;        JFIF[11] = (byte) 0x00;        JFIF[12] = (byte) 0x00;        JFIF[13] = (byte) 0x01;        JFIF[14] = (byte) 0x00;        JFIF[15] = (byte) 0x01;        JFIF[16] = (byte) 0x00;        JFIF[17] = (byte) 0x00;        WriteArray(JFIF, out);        // Comment Header        String comment = new String();        comment = JpegObj.getComment();        length = comment.length();        byte[] COM = new byte[length + 4];        COM[0] = (byte) 0xFF;        COM[1] = (byte) 0xFE;        COM[2] = (byte) ((length >> 8) & 0xFF);        COM[3] = (byte) (length & 0xFF);        java.lang.System.arraycopy(JpegObj.Comment.getBytes(), 0, COM, 4,            JpegObj.Comment.length());        WriteArray(COM, out);        // The DQT header        // 0 is the luminance index and 1 is the chrominance index        byte[] DQT = new byte[134];        DQT[0] = (byte) 0xFF;        DQT[1] = (byte) 0xDB;        DQT[2] = (byte) 0x00;        DQT[3] = (byte) 0x84;        offset = 4;        for (i = 0; i < 2; i++) {            DQT[offset++] = (byte) ((0 << 4) + i);            tempArray = (int[]) dct.quantum[i];            for (j = 0; j < 64; j++) {                DQT[offset++] = (byte) tempArray[jpegNaturalOrder[j]];            }        }        WriteArray(DQT, out);        // Start of Frame Header        byte[] SOF = new byte[19];        SOF[0] = (byte) 0xFF;        SOF[1] = (byte) 0xC0;        SOF[2] = (byte) 0x00;        SOF[3] = (byte) 17;        SOF[4] = (byte) JpegObj.Precision;        SOF[5] = (byte) ((JpegObj.imageHeight >> 8) & 0xFF);        SOF[6] = (byte) ((JpegObj.imageHeight) & 0xFF);        SOF[7] = (byte) ((JpegObj.imageWidth >> 8) & 0xFF);        SOF[8] = (byte) ((JpegObj.imageWidth) & 0xFF);        SOF[9] = (byte) JpegObj.NumberOfComponents;        index = 10;        for (i = 0; i < SOF[9]; i++) {            SOF[index++] = (byte) JpegObj.CompID[i];            SOF[index++] = (byte) ((JpegObj.HsampFactor[i] << 4) +                JpegObj.VsampFactor[i]);            SOF[index++] = (byte) JpegObj.QtableNumber[i];        }        WriteArray(SOF, out);        // The DHT Header        byte[] DHT1;        // The DHT Header        byte[] DHT2;        // The DHT Header        byte[] DHT3;        // The DHT Header        byte[] DHT4;        int bytes;        int temp;        int oldindex;        int intermediateindex;        length = 2;        index = 4;        oldindex = 4;        DHT1 = new byte[17];        DHT4 = new byte[4];        DHT4[0] = (byte) 0xFF;        DHT4[1] = (byte) 0xC4;        for (i = 0; i < 4; i++) {            bytes = 0;            DHT1[index++ - oldindex] = (byte) ((int[]) Huf.bits.elementAt(i))[0];            for (j = 1; j < 17; j++) {                temp = ((int[]) Huf.bits.elementAt(i))[j];                DHT1[index++ - oldindex] = (byte) temp;                bytes += temp;            }            intermediateindex = index;            DHT2 = new byte[bytes];            for (j = 0; j < bytes; j++) {                DHT2[index++ - intermediateindex] = (byte) ((int[]) Huf.val.elementAt(i))[j];            }            DHT3 = new byte[index];            java.lang.System.arraycopy(DHT4, 0, DHT3, 0, oldindex);            java.lang.System.arraycopy(DHT1, 0, DHT3, oldindex, 17);            java.lang.System.arraycopy(DHT2, 0, DHT3, oldindex + 17, bytes);            DHT4 = DHT3;            oldindex = index;        }        DHT4[2] = (byte) (((index - 2) >> 8) & 0xFF);        DHT4[3] = (byte) ((index - 2) & 0xFF);        WriteArray(DHT4, out);        // Start of Scan Header        byte[] SOS = new byte[14];        SOS[0] = (byte) 0xFF;        SOS[1] = (byte) 0xDA;        SOS[2] = (byte) 0x00;        SOS[3] = (byte) 12;        SOS[4] = (byte) JpegObj.NumberOfComponents;        index = 5;        for (i = 0; i < SOS[4]; i++) {            SOS[index++] = (byte) JpegObj.CompID[i];            SOS[index++] = (byte) ((JpegObj.DCtableNumber[i] << 4) +                JpegObj.ACtableNumber[i]);        }        SOS[index++] = (byte) JpegObj.Ss;        SOS[index++] = (byte) JpegObj.Se;        SOS[index++] = (byte) ((JpegObj.Ah << 4) + JpegObj.Al);        WriteArray(SOS, out);    }    void WriteMarker(byte[] data, BufferedOutputStream out) {        try {            out.write(data, 0, 2);        } catch (IOException e) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美成人高清电影在线| 91精品免费在线| 中文字幕乱码日本亚洲一区二区| 国产精品自拍网站| 中文字幕av一区二区三区| 99r精品视频| 亚洲精选一二三| 欧美日韩国产一区| 麻豆91在线播放| 久久久99免费| 91视频在线看| 婷婷开心激情综合| 国产亚洲一区二区三区| 91在线精品一区二区| 亚洲成av人片观看| 久久综合精品国产一区二区三区| 国产东北露脸精品视频| 夜色激情一区二区| 精品免费国产二区三区| 成人午夜短视频| 亚洲第一成年网| 久久亚洲一区二区三区四区| 色狠狠桃花综合| 麻豆精品一二三| 亚洲免费观看在线视频| 日韩一级大片在线观看| 成人黄色综合网站| 视频一区二区不卡| 国产精品理论片在线观看| 欧美肥妇bbw| www.在线欧美| 免费成人小视频| 亚洲欧美日韩一区二区三区在线观看| 欧美一区二区在线免费播放| 99久久精品国产一区二区三区| 午夜亚洲国产au精品一区二区 | 日本电影欧美片| 久久99久久99小草精品免视看| 亚洲精品视频在线| 久久久久97国产精华液好用吗| 色婷婷综合五月| 狠狠色狠狠色综合| 亚洲地区一二三色| 国产精品污www在线观看| 欧美女孩性生活视频| 99久久久国产精品免费蜜臀| 极品少妇xxxx精品少妇| 亚洲一区欧美一区| 中文字幕亚洲不卡| 欧美精品一区二区精品网| 欧美日韩一区高清| 国产成人福利片| 久久黄色级2电影| 日日摸夜夜添夜夜添亚洲女人| 成人欧美一区二区三区1314| 久久噜噜亚洲综合| 欧美日韩精品三区| 欧洲av在线精品| caoporen国产精品视频| 国产一区二区毛片| 日产国产欧美视频一区精品 | 91福利国产精品| 国产精品99精品久久免费| 丝袜亚洲另类欧美| 亚洲精品久久久久久国产精华液| 综合色中文字幕| 国产欧美日韩麻豆91| 精品国产一区二区三区忘忧草| 4438x成人网最大色成网站| 日本高清成人免费播放| 91黄视频在线观看| 欧洲精品在线观看| 在线亚洲免费视频| 色久综合一二码| 91福利在线播放| 欧美日韩一区二区在线视频| 在线免费不卡电影| 欧美视频在线一区| 51久久夜色精品国产麻豆| 精品视频在线免费| 91麻豆精品国产自产在线观看一区 | 91精品国产全国免费观看 | 欧美三级视频在线| 久久精品一区四区| 国产欧美一区二区精品性| 国产精品―色哟哟| 亚洲免费av在线| 亚洲高清在线精品| 首页国产欧美久久| 国产在线精品不卡| 国产不卡在线一区| 日本精品视频一区二区三区| 欧美日韩国产系列| 精品美女一区二区| 欧美国产一区在线| 亚洲一区在线观看免费观看电影高清 | 中文字幕亚洲综合久久菠萝蜜| 亚洲亚洲精品在线观看| 亚洲国产精品一区二区久久 | 岛国一区二区三区| bt欧美亚洲午夜电影天堂| 色88888久久久久久影院野外| 欧美三级在线看| 久久一二三国产| 亚洲免费成人av| 喷白浆一区二区| 成人小视频免费在线观看| 欧美亚日韩国产aⅴ精品中极品| 欧美肥妇free| 国产精品无人区| 天堂影院一区二区| 国产精品456| 欧美综合天天夜夜久久| 精品免费日韩av| 一区二区三区影院| 国产尤物一区二区| 久久综合给合久久狠狠狠97色69| 国产精品美女久久久久久久久久久| 亚洲一区二区免费视频| 国产精品88av| 欧美肥大bbwbbw高潮| 中文字幕av不卡| 成人国产精品视频| 色综合色狠狠综合色| 欧美一区二区三区在线看| 国产精品超碰97尤物18| 蜜桃久久久久久久| 91久久精品一区二区三区| 久久久久国产精品厨房| 亚洲国产美国国产综合一区二区| 国产麻豆91精品| 欧美日本免费一区二区三区| 中文字幕一区不卡| 国产一区二区三区四| 欧美美女激情18p| 亚洲黄色录像片| 粉嫩绯色av一区二区在线观看| 91精品蜜臀在线一区尤物| 一区二区三区波多野结衣在线观看 | 午夜精品在线看| 91色在线porny| 久久久九九九九| 黄色成人免费在线| 91精品国产免费| 午夜婷婷国产麻豆精品| 在线精品视频免费观看| 国产精品国产自产拍在线| 国产麻豆9l精品三级站| 日韩久久精品一区| 日韩av中文字幕一区二区 | 欧美v国产在线一区二区三区| 亚洲成年人影院| 欧美自拍丝袜亚洲| 亚洲人成伊人成综合网小说| 成人福利视频网站| 日本一区二区免费在线| 国产精品一二三区在线| www国产亚洲精品久久麻豆| 久久99久久99精品免视看婷婷 | 久久久久久久免费视频了| 久久99蜜桃精品| 欧美成人精品1314www| 久久精品99国产精品日本| 日韩欧美区一区二| 精品制服美女丁香| 91蝌蚪porny| 一二三四社区欧美黄| 成人精品鲁一区一区二区| 国产人成一区二区三区影院| 九色|91porny| 久久久99久久| 丁香激情综合五月| √…a在线天堂一区| 色综合网站在线| 亚洲男人的天堂av| 欧美色涩在线第一页| 视频一区二区三区在线| 日韩免费视频线观看| 国产综合久久久久久久久久久久| 久久综合九色欧美综合狠狠| 国产成人一区在线| 亚洲日本乱码在线观看| 欧美在线色视频| 老司机午夜精品99久久| 久久欧美中文字幕| 91小视频免费看| 亚洲午夜免费福利视频| 欧美一区国产二区| 丁香婷婷综合色啪| 亚洲国产你懂的| 精品久久久久香蕉网| 99精品久久久久久| 日韩国产欧美在线视频| 51久久夜色精品国产麻豆| 狠狠色丁香婷婷综合久久片| 国产视频一区在线播放| 在线观看三级视频欧美| 免费黄网站欧美| 亚洲国产成人私人影院tom | www.亚洲激情.com|