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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? decoder.java

?? J2ME MPEG4 解碼代碼。 以及使用方法。
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
import java.io.*;

public class Decoder {
	private Queue mQueue 		    = null;
    private InputBitStream mInput   = null;
    private VideoRenderer mRenderer = null;

    private Picture[] mPictureStore = new Picture[3];
    private int mCurrent = 0, mPrevious = -1, mFuture = -1;

    private MotionVector mForward   = new MotionVector();
    private MotionVector mBackward  = new MotionVector();

    private Idct mIdct 			    = new Idct();
    private Vlc mVlc 			    = new Vlc();

    private int mPictureCodingType;

    private int mWidth;
    private int mHeight;

    private int mMacroblockWidth;	// Width in macroblock units
    private int mMacroblockHeight;	// Height in macroblock units

    private int mMacroblockRow;
    private int mMacroblockCol;

    // Default intra quantization matrix
    private static final short[] DefaultIntraQuantizerMatrix = {
        8, 16, 19, 22, 26, 27, 29, 34,
        16, 16, 22, 24, 27, 29, 34, 37,
        19, 22, 26, 27, 29, 34, 34, 38,
        22, 22, 26, 27, 29, 34, 37, 40,
        22, 26, 27, 29, 32, 35, 40, 48,
        26, 27, 29, 32, 35, 40, 48, 58,
        26, 27, 29, 34, 38, 46, 56, 69,
        27, 29, 35, 38, 46, 56, 69, 83
    };

    // Default non-intra quantization matrix
    private static final short[] DefaultNonIntraQuantizerMatrix = {
        16, 16, 16, 16, 16, 16, 16, 16,
        16, 16, 16, 16, 16, 16, 16, 16,
        16, 16, 16, 16, 16, 16, 16, 16,
        16, 16, 16, 16, 16, 16, 16, 16,
        16, 16, 16, 16, 16, 16, 16, 16,
        16, 16, 16, 16, 16, 16, 16, 16,
        16, 16, 16, 16, 16, 16, 16, 16,
        16, 16, 16, 16, 16, 16, 16, 16
    };

    private short[] IntraQuantizerMatrix 	= new short[64];
    private short[] NonIntraQuantizerMatrix = new short[64];

    // Zig-zag scan matrix
    private static final byte[] ScanMatrix = {
        0,  1,  5,  6, 14, 15, 27, 28,
        2,  4,  7, 13, 16, 26, 29, 42,
        3,  8, 12, 17, 25, 30, 41, 43,
        9, 11, 18, 24, 31, 40, 44, 53,
       10, 19, 23, 32, 39, 45, 52, 54,
       20, 22, 33, 38, 46, 51, 55, 60,
       21, 34, 37, 47, 50, 56, 59, 61,
       35, 36, 48, 49, 57, 58, 62, 63
    };


    /*
     * Start codes are reserved bit patterns that do not otherwise 
     * occur in the video stream. All start codes are byte aligned.
     */
    private static final int START_CODE 		  = 0x000001;		// 24-bit code

    private static final int PICTURE_START_CODE   = 0x00000100;
    private static final int SLICE_START_CODE     = 0x00000101;	// through 0x000001af

    private static final int USER_DATA_START_CODE = 0x000001b2;
    private static final int SEQUENCE_HEADER_CODE = 0x000001b3;
    private static final int EXTENSION_START_CODE = 0x000001b5;
    private static final int SEQUENCE_END_CODE    = 0x000001b7;
    private static final int GROUP_START_CODE     = 0x000001b8;

    /**
     * Constructs MPEG decoder
     * 
     * @param queue  Playout queue
     * @param input  Video bitstream
     * @param player Canvas canvas
     */
    public Decoder(Queue queue, InputBitStream input, VideoRenderer renderer) {
    	mQueue    = queue;
    	mInput    = input;
        mRenderer = renderer;
    }

    /*
     * Remove any zero bit and zero byte stuffing and locates the next
     * start code. See ISO/IEC 11172-2 Section 2.3
     */
    private void nextStartCode() throws IOException {
        while (!mInput.isByteAligned())
            mInput.getBits(1);

        while (mInput.nextBits(24) != START_CODE)
            mInput.getBits(8);
    }

    public void start() throws IOException {
        nextStartCode();

        /*
         * A video sequence starts with a sequence header and is 
         * followed by one or more groups of pictures and is ended 
         * by a SEQUENCE_END_CODE. Immediately before each of the 
         * groups of pictures there may be a sequence header.
         */

         do {
             parseSequenceHeader();

             mRenderer.setSize(mWidth, mHeight);

             mPictureStore[0] = new Picture(mMacroblockWidth, mMacroblockHeight);
             mPictureStore[1] = new Picture(mMacroblockWidth, mMacroblockHeight);
             mPictureStore[2] = new Picture(mMacroblockWidth, mMacroblockHeight);

             do {
                 parseGroupOfPictures();
             } while (mInput.nextBits(32) == GROUP_START_CODE);

         } while (mInput.nextBits(32) == SEQUENCE_HEADER_CODE);

         int sequenceEndCode = mInput.getBits(32);
    }

    /*
     * All fields in each sequence header with the exception of
     * the quantization matrices shall have the same values as
     * in the first sequence header.
     */
    private void parseSequenceHeader() throws IOException {
        int sequenceHeaderCode = mInput.getBits(32);

        mWidth = mInput.getBits(12);
        mHeight = mInput.getBits(12);

        mMacroblockWidth = (mWidth + 15) >> 4;
        mMacroblockHeight = (mHeight + 15) >> 4;

        int pelAspectRatio = mInput.getBits(4);
        int pictureRate = mInput.getBits(4);

        int bitRate = mInput.getBits(18);
        int markerBit = mInput.getBits(1);	// Should be == 0x1

        int vbvBufferSize = mInput.getBits(10);

//        int minimumBufferSize = vbvBufferSize << 14;

        int constrainedParameterFlag = mInput.getBits(1);

        boolean loadIntraQuantizerMatrix = (mInput.getBits(1) == 1);
        if (loadIntraQuantizerMatrix)
            loadIntraQuantizerMatrix();
        else
            loadDefaultIntraQuantizerMatrix();

        boolean loadNonIntraQuantizerMatrix = (mInput.getBits(1) == 1);
        if (loadNonIntraQuantizerMatrix)
            loadNonIntraQuantizerMatrix();
        else
            loadDefaultNonIntraQuantizerMatrix();

        nextStartCode();

        if (mInput.nextBits(32) == EXTENSION_START_CODE) {
            mInput.getBits(32);

            while (mInput.nextBits(24) != START_CODE) {
                int sequenceExtensionData = mInput.getBits(8);
            }

            nextStartCode();
        }

        if (mInput.nextBits(32) == USER_DATA_START_CODE) {
            mInput.getBits(32);

            while (mInput.nextBits(24) != START_CODE) {
                int userData = mInput.getBits(8);
            }

            nextStartCode();
        }
    }

    /*
     * This is a list of sixty-four 8-bit unsigned integers.
     * The value for [0][0] shall always be 8. For the 8-bit 
     * unsigned integers, the value zero is forbidden.
     * The new values shall be in effect until the next occurrence
     * of a sequence header.
     */
    private void loadIntraQuantizerMatrix() throws IOException {
        for (int i = 0; i < 64; ++i) {
            int value = mInput.getBits(8);
            IntraQuantizerMatrix[i] = (short)(value & 0xff);
        }
    }

    private void loadDefaultIntraQuantizerMatrix() {
    	System.arraycopy(DefaultIntraQuantizerMatrix, 0, IntraQuantizerMatrix, 0, 64);
    }

    /*
     * This is a list of sixty-four 8-bit unsigned integers.
     * For the 8-bit unsigned integers, the value zero is forbidden.
     * The new values shall be in effect until the next occurrence 
     * of a sequence header.
     */
    private void loadNonIntraQuantizerMatrix() throws IOException {
        for (int i = 0; i < 64; ++i) {
            int value = mInput.getBits(8);
            NonIntraQuantizerMatrix[i] = (short)(value & 0xff);
        }
    }

    private void loadDefaultNonIntraQuantizerMatrix() {
    	System.arraycopy(DefaultNonIntraQuantizerMatrix, 0, NonIntraQuantizerMatrix, 0, 64);
    }

    /*
     * The first coded picture in a group of pictures is an I-Picture. 
     * The order of the pictures in the coded stream is the order in 
     * which the decoder processes them in normal play. In particular, 
     * adjacent B-Pictures in the coded stream are in display order. 
     * The last coded picture, in display order, of a group of pictures 
     * is either an I-Picture or a P-Picture.
     */
    private void parseGroupOfPictures() throws IOException {
        int groupStartCode = mInput.getBits(32);
        int timeCode = mInput.getBits(25);
        boolean closedGop = mInput.getBits(1) == 1;
        boolean brokenLink = mInput.getBits(1) == 1;

        nextStartCode();

        if (mInput.nextBits(32) == EXTENSION_START_CODE) {
            mInput.getBits(32);

            while (mInput.nextBits(24) != START_CODE) {
                int groupExtensionData = mInput.getBits(8);
            }

            nextStartCode();
        }

        if (mInput.nextBits(32) == USER_DATA_START_CODE) {
            mInput.getBits(32);

            while (mInput.nextBits(24) != START_CODE) {
                int userData = mInput.getBits(8);
            }

            nextStartCode();
        }

        // Reset picture store indexes
        if (closedGop) {
        	mPrevious = mFuture = -1;
        }

    	do {
    		parsePicture();

    		// Send picture to player
    		mQueue.put(mPictureStore[mCurrent]);
/*
            try {
            	Thread.sleep(100);
            } catch(InterruptedException ignore) {}
*/
    		// Store current picture in Previous or Future Picture Store
    		// Refer to section 2-D.2.4
           	if (mPictureCodingType == Picture.I_TYPE || mPictureCodingType == Picture.P_TYPE) {
           		if (mPrevious == -1)
           		{
           			mPrevious = mCurrent;
           		}
           		else if (mFuture == -1)
           		{
           			mFuture = mCurrent;
           		}
           		else
           		{
           			mFuture = mCurrent;
           		}

           		mCurrent = (mCurrent + 1) % 3;
            }

    	} while (mInput.nextBits(32) == PICTURE_START_CODE);
    }

    // Only present in P and B pictures
    private int mForwardF;
    private int mForwardRSize;

    private int mBackwardF;
    private int mBackwardRSize;

    private void parsePicture() throws IOException {
        int pictureStartCode = mInput.getBits(32);
        int temporalReference = mInput.getBits(10);
        mPictureCodingType = mInput.getBits(3);
        int vbvDelay = mInput.getBits(16);

        // This data is to be used later by the player
        mPictureStore[mCurrent].mTime = temporalReference;
        mPictureStore[mCurrent].mType = mPictureCodingType;

		// "Copy" picture from Future Picture Store to Previous Picture Store
		// Refer to section 2-D.2.4
        if (mPictureCodingType == Picture.I_TYPE || mPictureCodingType == Picture.P_TYPE)
        	if (mFuture != -1)
        		mPrevious = mFuture;

        if (mPictureCodingType == Picture.P_TYPE || mPictureCodingType == Picture.B_TYPE) {
            boolean fullPelForwardVector = mInput.getBits(1) == 1;
            int forwardFCode = mInput.getBits(3);  // Can't be 0
            mForwardRSize = forwardFCode - 1;
            mForwardF = 1 << mForwardRSize;

            mForward.init(mForwardF, fullPelForwardVector);
        }

        if (mPictureCodingType == Picture.B_TYPE) {
            boolean fullPelBackwardVector = mInput.getBits(1) == 1;
            int backwardFCode = mInput.getBits(3); // Can't be 0
            mBackwardRSize = backwardFCode - 1;
            mBackwardF = 1 << mBackwardRSize;

            mBackward.init(mBackwardF, fullPelBackwardVector);
        }

        int extraBitPicture = 0;
        while (mInput.nextBits(1) == 0x1) {
            extraBitPicture = mInput.getBits(1);
            int extraInformationPicture = mInput.getBits(8);
        }
        extraBitPicture = mInput.getBits(1);

        nextStartCode();

        if (mInput.nextBits(32) == EXTENSION_START_CODE) {
            mInput.getBits(32);

            while (mInput.nextBits(24) != START_CODE) {
                int pictureExtensionData = mInput.getBits(8);
            }

            nextStartCode();
        }

        if (mInput.nextBits(32) == USER_DATA_START_CODE) {
            mInput.getBits(32);

            while (mInput.nextBits(24) != START_CODE) {
                int userData = mInput.getBits(8);
            }

            nextStartCode();
        }

        do {
            parseSlice();
        } while (mInput.nextBits(32) == SLICE_START_CODE);
    }

    // Predictors
    private int mDctDcYPast;
    private int mDctDcCbPast;
    private int mDctDcCrPast;

    private int mPastIntraAddress;
    private int mMacroblockAddress;
    private int mQuantizerScale;

    /*
     * A slice is a series of an arbitrary number of macroblocks with 
     * the order of macroblocks starting from the upper-left of the 
     * picture and proceeding by raster-scan order from left to right 
     * and top to bottom. Every slice shall contain at least one 
     * macroblock. Slices shall not overlap and there shall be no gaps 
     * between slices.
     */
    private void parseSlice() throws IOException {
        int sliceStartCode = mInput.getBits(32);   // Ranging from 0x00000101 - 0x000001af
        int sliceVerticalPosition = sliceStartCode & 0xff; // Range: 0x01 - 0xaf

        mDctDcYPast = mDctDcCbPast = mDctDcCrPast = 1024; // See ISO-11172-2 page 35

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品一区二| 欧美国产日韩在线观看| 国产乱人伦偷精品视频免下载| 国产精品三级电影| 欧美色图12p| jizzjizzjizz欧美| 久久不见久久见免费视频7| 亚洲嫩草精品久久| 国产亚洲精品中文字幕| 精品视频一区 二区 三区| 成人精品一区二区三区四区| 精品综合久久久久久8888| 亚洲h在线观看| 一区二区三区精品视频在线| 中文无字幕一区二区三区| 7799精品视频| 欧美三级在线播放| 本田岬高潮一区二区三区| 国产精品一区二区在线观看不卡| 日韩专区在线视频| 亚洲国产视频一区| 亚洲免费观看高清完整版在线观看熊| 国产三级精品三级| 久久久欧美精品sm网站| 91精品国模一区二区三区| 欧美日韩一区中文字幕| 欧美在线三级电影| 91国偷自产一区二区三区成为亚洲经典| 岛国一区二区三区| 国产成人av电影在线| 国模娜娜一区二区三区| 麻豆91在线观看| 欧美a级一区二区| 蜜臀av亚洲一区中文字幕| 色综合久久88色综合天天免费| 成人永久看片免费视频天堂| 国产精品一卡二| 国产乱淫av一区二区三区| 国产美女视频一区| 国产高清亚洲一区| 国产成人免费在线观看| 国产69精品久久99不卡| 成人午夜激情影院| 成人动漫在线一区| av电影一区二区| 色哟哟日韩精品| 欧洲精品一区二区| 欧美日韩国产精品成人| 在线成人高清不卡| 日韩欧美中文字幕一区| 日韩欧美激情四射| 久久久精品欧美丰满| 欧美激情一区不卡| 亚洲精品视频在线| 天天综合色天天综合色h| 天天综合色天天综合| 久久国产精品露脸对白| 国产麻豆成人精品| 成人激情免费电影网址| 91丨九色porny丨蝌蚪| 欧美在线啊v一区| 日韩欧美一区二区不卡| 国产亚洲一区字幕| 亚洲欧美经典视频| 日韩高清一区二区| 国产精品一区专区| 91久久精品午夜一区二区| 5566中文字幕一区二区电影| 欧美mv日韩mv亚洲| 18涩涩午夜精品.www| 亚洲一区二区三区影院| 麻豆精品新av中文字幕| 国产91精品久久久久久久网曝门 | 国产精品福利电影一区二区三区四区| 亚洲欧美一区二区在线观看| 亚洲mv在线观看| 国产麻豆精品视频| 欧美写真视频网站| 久久一二三国产| 亚洲国产欧美在线人成| 韩国女主播一区| 欧美性受xxxx| 久久久久久久久久久久久久久99| 成人一区二区三区视频 | 欧美亚洲丝袜传媒另类| 欧美大片国产精品| 亚洲乱码日产精品bd| 久久国产综合精品| 色综合久久综合网| 久久精品免费在线观看| 午夜视频一区在线观看| 国产a精品视频| 欧美一卡二卡三卡| 亚洲精品欧美综合四区| 国产一区二区看久久| 欧美日韩亚洲综合一区二区三区| 国产日产欧美一区| 蜜乳av一区二区| 欧洲视频一区二区| 亚洲欧洲在线观看av| 久久精品国产色蜜蜜麻豆| 在线观看区一区二| 国产精品久久久久影院老司| 久久国产精品72免费观看| 色一区在线观看| 国产欧美日韩麻豆91| 老司机免费视频一区二区| 欧美日韩在线直播| 中文字幕一区av| 福利一区福利二区| 亚洲国产aⅴ成人精品无吗| 不卡免费追剧大全电视剧网站| 日韩欧美久久久| 日韩vs国产vs欧美| 欧美日韩日日摸| 亚洲乱码中文字幕| 91网站在线观看视频| 国产色综合一区| 国产一区二区精品在线观看| 欧美大胆一级视频| 日韩av中文字幕一区二区| 欧美在线观看一区二区| 中文字幕日本不卡| 成人一道本在线| 久久久99久久| 国产在线视频一区二区| 精品毛片乱码1区2区3区| 日本美女一区二区| 69堂精品视频| 蜜桃av一区二区三区| 日韩美一区二区三区| 免费精品视频在线| 日韩三级.com| 玖玖九九国产精品| 亚洲精品一线二线三线无人区| 美国毛片一区二区三区| 日韩女同互慰一区二区| 极品尤物av久久免费看| 久久蜜臀中文字幕| 国产福利一区二区三区视频| 久久久久久99久久久精品网站| 国产精品影音先锋| 国产精品久久精品日日| 91色porny在线视频| 一区二区日韩电影| 制服丝袜亚洲播放| 精品一区二区三区视频在线观看| 久久亚洲精品小早川怜子| 国产99一区视频免费| 国产精品国产三级国产aⅴ中文| 97成人超碰视| 亚洲成人免费电影| 欧美岛国在线观看| 成人小视频免费观看| 亚洲免费色视频| 欧美精品一二三| 国产一区二区三区不卡在线观看| 国产精品久久久久一区| 91成人国产精品| 蜜臀av性久久久久蜜臀aⅴ流畅 | av电影在线观看完整版一区二区| 成人激情视频网站| 亚洲一区二三区| 3d成人h动漫网站入口| 精彩视频一区二区三区| 国产欧美日韩三区| 精品视频123区在线观看| 美日韩黄色大片| 国产精品无人区| 欧美亚洲高清一区| 精品一区二区在线免费观看| 国产精品嫩草99a| 538在线一区二区精品国产| 国产精品一区在线观看你懂的| 亚洲精品美国一| 欧美videos中文字幕| 色婷婷久久综合| 久久97超碰色| 亚洲乱码中文字幕综合| 精品国一区二区三区| 色呦呦国产精品| 国产主播一区二区三区| 夜夜精品浪潮av一区二区三区| 欧美电影精品一区二区| 色猫猫国产区一区二在线视频| 久久精品99国产精品| 亚洲码国产岛国毛片在线| 精品黑人一区二区三区久久| 色综合久久综合中文综合网| 精品在线一区二区三区| 亚洲美女淫视频| 欧美激情一区二区三区四区| 在线成人免费观看| 色婷婷av一区二区三区大白胸| 极品美女销魂一区二区三区免费| 一区二区在线免费| 国产精品久久久久三级| 久久一区二区三区国产精品| 欧美日韩高清一区二区不卡| 99久久免费精品高清特色大片|