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

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

?? zigzag.java

?? Free Software Foundation Inc.公司用java寫的jpeg解碼器。一個優秀的圖像解碼器面向對象模型。
?? JAVA
字號:
/* ZigZag.java --
   Copyright (C)  2005  Free Software Foundation, Inc.

This file is part of GNU Classpath.

GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING.  If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.

Linking this library statically or dynamically with other modules is
making a combined work based on this library.  Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.

As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module.  An independent module is a module which is not derived from
or based on this library.  If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so.  If you do not wish to do so, delete this
exception statement from your version. */

package gnu.javax.imageio.jpeg;

/**
 * This class implements the Zig Zag Algorithm on any array with
 * the same amount of rows and columns. It takes a matrix and in turn builds an
 * encoded byte array (or double array) from it. The adverse is also true, this
 * will take a byte or double array and build a matrix based on the zig zag
 * algorithm.
 * <p>This is used exclusively in the JPEG DCT encoding.</p>
 */
public class ZigZag
{
  public final static boolean ZIGZAG_FORWARD = true;
  public final static boolean ZIGZAG_BACKWARD = false;
  public final static int ZIGZAG_8X8_MAP[] =
  {
   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
  };

  /**
   * Encodes a matrix of equal width and height to a byte array.
   * 
   * @param matrix
   *
   * @return
   */
  public static byte[] encode(byte[][] matrix)
  {
    byte[] buffer = new byte[matrix.length ^ 2];
    boolean direction = ZigZag.ZIGZAG_FORWARD;
    int x = 0, y = 0, index = 0;
    for (int zigIndex = 0; zigIndex < (matrix.length * 2 - 1);
         zigIndex++, direction = !direction)
      {
        if (direction == ZigZag.ZIGZAG_FORWARD)
          {
            while (x >= 0 && y != matrix.length)
              {
                if (x == matrix.length)
                  {
                    x--;
                    y++;
                  }
                buffer[index] = matrix[x][y];
                y++;
                x--;
                index++;
              }
            x++;
          }
        else
          {
            while (y >= 0 && x != matrix.length)
              {
                if (y == matrix.length)
                  {
                    y--;
                    x++;
                  }
                buffer[index] = matrix[x][y];
                y--;
                x++;
                index++;
              }
            y++;
          }
      }
    return (buffer);
  }

  /**
   * Encodes a matrix of equal width and height to a double array
   * 
   * @param matrix
   *
   * @return
   */
  public static double[] encode(double[][] matrix)
  {
    double[] buffer = new double[matrix.length * matrix.length];
    boolean direction = ZigZag.ZIGZAG_FORWARD;
    int x = 0, y = 0, index = 0;
    for (int zigIndex = 0; zigIndex < (matrix.length * 2 - 1);
         zigIndex++, direction = !direction)
      {
        if (direction == ZigZag.ZIGZAG_FORWARD)
          {
            while (x >= 0 && y != matrix.length)
              {
                if (x == matrix.length)
                  {
                    x--;
                    y++;
                  }
                buffer[index] = matrix[x][y];
                y++;
                x--;
                index++;
              }
            x++;
          }
        else
          {
            while (y >= 0 && x != matrix.length)
              {
                if (y == matrix.length)
                  {
                    y--;
                    x++;
                  }
                buffer[index] = matrix[x][y];
                y--;
                x++;
                index++;
              }
            y++;
          }
      }
    return (buffer);
  }

  /**
   * Encodes a matrix of equal width and height to a float array
   * 
   * @param matrix
   *
   * @return
   */
  public static float[] encode(float[][] matrix)
  {
    float[] buffer = new float[matrix.length * matrix.length];
    boolean direction = ZigZag.ZIGZAG_FORWARD;
    int x = 0, y = 0, index = 0;
    for (int zigIndex = 0; zigIndex < (matrix.length * 2 - 1);
         zigIndex++, direction = !direction)
      {
        if (direction == ZigZag.ZIGZAG_FORWARD)
          {
            while (x >= 0 && y != matrix.length)
              {
                if (x == matrix.length)
                  {
                    x--;
                    y++;
                  }
                buffer[index] = matrix[x][y];
                y++;
                x--;
                index++;
              }
            x++;
          }
        else
          {
            while (y >= 0 && x != matrix.length)
              {
                if (y == matrix.length)
                  {
                    y--;
                    x++;
                  }
                buffer[index] = matrix[x][y];
                y--;
                x++;
                index++;
              }
            y++;
          }
      }
    return (buffer);
  }

  /**
   * Encodes a matrix of equal width and height to a float array
   * 
   * @param matrix
   *
   * @return
   */
  public static short[] encode(short[][] matrix)
  {
    short[] buffer = new short[matrix.length * matrix.length];
    boolean direction = ZigZag.ZIGZAG_FORWARD;
    int x = 0, y = 0, index = 0;
    for (int zigIndex = 0; zigIndex < (matrix.length * 2 - 1);
         zigIndex++, direction = !direction)
      {
        if (direction == ZigZag.ZIGZAG_FORWARD)
          {
            while (x >= 0 && y != matrix.length)
              {
                if (x == matrix.length)
                  {
                    x--;
                    y++;
                  }
                buffer[index] = matrix[x][y];
                y++;
                x--;
                index++;
              }
            x++;
          }
        else
          {
            while (y >= 0 && x != matrix.length)
              {
                if (y == matrix.length)
                  {
                    y--;
                    x++;
                  }
                buffer[index] = matrix[x][y];
                y--;
                x++;
                index++;
              }
            y++;
          }
      }
    return (buffer);
  }

  /**
   * Convert a double array into a matrix with the same amount of columns and
   * rows with length sqrt(double array length)
   * 
   * @param data
   *
   * @return
   */
  public static double[][] decode(double[] data)
  {
    return decode(data, (int) Math.sqrt(data.length),
                  (int) Math.sqrt(data.length));
  }

  /**
   * Convert a byte array into a matrix with the same amount of columns and
   * rows with length sqrt(double array length)
   * 
   * @param data
   *
   * @return
   */
  public static byte[][] decode(byte[] data)
  {
    return decode(data, (int) Math.sqrt(data.length),
                  (int) Math.sqrt(data.length));
  }

  public static int[][] decode(int[] data)
  {
    return decode(data, (int) Math.sqrt(data.length),
                  (int) Math.sqrt(data.length));
  }

  public static byte[][] decode(byte[] data, int width, int height)
  {
    byte[][] buffer = new byte[height][width];

    for (int v = 0; v < height; v++)
      for (int z = 0; z < width; z++)
        buffer[v][z] = 11;

    boolean dir = ZigZag.ZIGZAG_FORWARD;
    int xindex = 0, yindex = 0, dataindex = 0;

    while (xindex < width && yindex < height && dataindex < data.length)
      {
        buffer[yindex][xindex] = data[dataindex];
        dataindex++;
        
        if (dir == ZigZag.ZIGZAG_FORWARD)
          {
            if (yindex == 0 || xindex == (width - 1))
              {
                dir = ZigZag.ZIGZAG_BACKWARD;
                if (xindex == (width - 1))
                  yindex++;
                else
                  xindex++;
              }
            else
              {
                yindex--;
                xindex++;
              }
          }
        else
          { /* Backwards */
            if (xindex == 0 || yindex == (height - 1))
              {
                dir = ZigZag.ZIGZAG_FORWARD;
                if (yindex == (height - 1))
                  xindex++;
                else
                  yindex++;
              }
            else
              {
                yindex++;
                xindex--;
              }
          }
      }
    return (buffer);
  }

  public static double[][] decode(double[] data, int width, int height)
  {
    double[][] buffer = new double[height][width];

    for (int v = 0; v < height; v++)
      for (int z = 0; z < width; z++)
        buffer[v][z] = 11;

    boolean dir = ZigZag.ZIGZAG_FORWARD;
    int xindex = 0, yindex = 0, dataindex = 0;

    while (xindex < width && yindex < height && dataindex < data.length)
      {
        buffer[yindex][xindex] = data[dataindex];
        dataindex++;
        System.err.println("Setting " + dataindex + " to row: " + yindex
                           + " column: " + xindex + " yourval:"
                           + (yindex*8+xindex));
        if (dir == ZigZag.ZIGZAG_FORWARD)
          {
            if (yindex == 0 || xindex == (width - 1))
              {
                dir = ZigZag.ZIGZAG_BACKWARD;
                if (xindex == (width - 1))
                  yindex++;
                else
                  xindex++;
              }
            else
              {
                yindex--;
                xindex++;
              }
          }
        else
          { /* Backwards */
            if (xindex == 0 || yindex == (height - 1))
              {
                dir = ZigZag.ZIGZAG_FORWARD;
                if (yindex == (height - 1))
                  xindex++;
                else
                  yindex++;
              }
            else
              {
                yindex++;
                xindex--;
              }
          }
      }
    return (buffer);
  }

  public static float[][] decode(float[] data, int width, int height)
  {
    float[][] buffer = new float[height][width];
    
    for (int v = 0; v < height; v++)
      for (int z = 0; z < width; z++)
        buffer[v][z] = 11;
    
    boolean dir = ZigZag.ZIGZAG_FORWARD;
    int xindex = 0, yindex = 0, dataindex = 0;
    
    while (xindex < width && yindex < height && dataindex < data.length)
      {
        buffer[yindex][xindex] = data[dataindex];
        dataindex++;
        
        if (dir == ZigZag.ZIGZAG_FORWARD)
          {
            if (yindex == 0 || xindex == (width - 1))
              {
                dir = ZigZag.ZIGZAG_BACKWARD;
                if (xindex == (width - 1))
                  yindex++;
                else
                  xindex++;
              }
            else
              {
                yindex--;
                xindex++;
              }
          }
        else
          { /* Backwards */
            if (xindex == 0 || yindex == (height - 1))
              {
                dir = ZigZag.ZIGZAG_FORWARD;
                if (yindex == (height - 1))
                  xindex++;
                else
                  yindex++;
              }
            else
              {
                yindex++;
                xindex--;
              }
          }
      }
    return (buffer);
  }

  public static int[][] decode(int[] data, int width, int height)
  {
    int[][] buffer = new int[height][width];

    for (int v = 0; v < height; v++)
      for (int z = 0; z < width; z++)
        buffer[v][z] = 11;

    boolean dir = ZigZag.ZIGZAG_FORWARD;
    int xindex = 0, yindex = 0, dataindex = 0;

    while (xindex < width && yindex < height && dataindex < data.length)
      {
        buffer[yindex][xindex] = data[dataindex];
        dataindex++;

        if (dir == ZigZag.ZIGZAG_FORWARD)
          {
            if (yindex == 0 || xindex == (width - 1))
              {
                dir = ZigZag.ZIGZAG_BACKWARD;
                if (xindex == (width - 1))
                  yindex++;
                else
                  xindex++;
              }
            else
              {
                yindex--;
                xindex++;
              }
          }
        else
          { /* Backwards */
            if (xindex == 0 || yindex == (height - 1))
              {
                dir = ZigZag.ZIGZAG_FORWARD;
                if (yindex == (height - 1))
                  xindex++;
                else
                  yindex++;
              }
            else
              {
                yindex++;
                xindex--;
              }
          }
      }
    return (buffer);
  }

  public static double[][] decode8x8_map(double input[])
  {
    double[][] output = new double[8][8];
    for(int i=0; i < 64 ; i++)
      output[ZIGZAG_8X8_MAP[i]/8][ZIGZAG_8X8_MAP[i]%8] = input[i];
    return (output);
  }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产精品一区二区三区| 在线精品视频免费播放| 不卡视频免费播放| 欧美在线三级电影| 精品国产a毛片| 一区二区三区蜜桃| 国产一区二区三区日韩| 欧美日韩高清一区二区三区| 国产日产精品1区| 婷婷亚洲久悠悠色悠在线播放| 国产成人在线视频网站| 欧美一区二区精美| 一区二区三区在线免费视频| 国产乱理伦片在线观看夜一区 | 亚洲视频精选在线| 国产自产v一区二区三区c| 欧美午夜电影一区| 国产精品成人免费| 国产乱码精品一品二品| 欧美一卡2卡三卡4卡5免费| 最近日韩中文字幕| 成人国产视频在线观看| 精品成人一区二区| 美女视频一区在线观看| 欧美日韩精品专区| 亚洲自拍偷拍麻豆| 在线视频国内自拍亚洲视频| 国产精品免费看片| 国产69精品久久久久777| 欧美大片拔萝卜| 奇米一区二区三区| 91精品久久久久久蜜臀| 日韩国产在线观看| 欧美日韩不卡一区| 丝袜a∨在线一区二区三区不卡| 在线一区二区视频| 亚洲国产视频在线| 欧美日产在线观看| 日韩电影一二三区| 日韩欧美一级精品久久| 久久国内精品自在自线400部| 欧美丰满美乳xxx高潮www| 国产精品香蕉一区二区三区| 日韩三级免费观看| 久久se这里有精品| 久久久亚洲精品石原莉奈| 国产一区二区三区av电影| 久久精品亚洲精品国产欧美| 国产在线麻豆精品观看| 国产亚洲精品超碰| 成人av在线电影| 亚洲欧美视频在线观看视频| 欧美在线看片a免费观看| 五月天视频一区| 日韩一区二区免费在线电影| 激情综合色播激情啊| 国产日本欧美一区二区| 91麻豆蜜桃一区二区三区| 亚洲精品国产一区二区精华液| 在线观看国产一区二区| 免费观看91视频大全| 久久精品视频在线免费观看| 成人av中文字幕| 亚洲国产美国国产综合一区二区| 宅男在线国产精品| 成人亚洲一区二区一| 亚洲一区二区视频在线| 久久综合久久鬼色中文字| 成人av免费在线播放| 天天做天天摸天天爽国产一区| 欧美不卡123| 色系网站成人免费| 欧美日韩在线不卡| 九九九精品视频| 亚洲色图20p| 精品精品欲导航| 色婷婷国产精品久久包臀| 麻豆视频观看网址久久| 中文字幕在线免费不卡| 日韩限制级电影在线观看| 成a人片亚洲日本久久| 日本欧美大码aⅴ在线播放| 国产精品久久久一本精品| 日韩一区二区三区四区| 91在线视频官网| 麻豆精品国产传媒mv男同| 国产精品久久影院| 欧美成人性战久久| 欧美午夜片在线看| av在线这里只有精品| 久久狠狠亚洲综合| 午夜精品免费在线| 玉足女爽爽91| 亚洲国产精品精华液ab| 精品久久人人做人人爰| 欧美三级电影网站| 91麻豆文化传媒在线观看| 国产一区999| 久久国产三级精品| 日韩精品欧美精品| 亚洲成人tv网| 亚洲精品国久久99热| 亚洲天堂网中文字| 欧美国产一区视频在线观看| 久久一区二区三区国产精品| 制服丝袜中文字幕亚洲| 欧美三级中文字| 色8久久精品久久久久久蜜| 成人高清免费在线播放| 国产成人精品一区二区三区四区| 麻豆91在线观看| 日本aⅴ亚洲精品中文乱码| 亚洲高清免费视频| 亚洲国产中文字幕| 午夜欧美大尺度福利影院在线看 | 中文字幕一区二区三| 国产精品情趣视频| 国产精品久久99| 中文字幕一区二区视频| 国产精品家庭影院| 伊人性伊人情综合网| 亚洲精品日韩一| 一区二区三区四区亚洲| 一区二区三区四区视频精品免费| 综合久久久久综合| 亚洲激情男女视频| 亚洲在线视频一区| 亚洲第一综合色| 日韩av成人高清| 久久99精品一区二区三区| 精品无码三级在线观看视频| 极品美女销魂一区二区三区 | 91精品久久久久久蜜臀| 精品少妇一区二区三区| 久久免费看少妇高潮| 日本一区二区在线不卡| 亚洲视频一区二区免费在线观看 | 国产69精品一区二区亚洲孕妇| 成人av免费在线观看| 日本久久电影网| 91超碰这里只有精品国产| 精品国产免费人成在线观看| 国产视频亚洲色图| 亚洲色图制服诱惑 | 美美哒免费高清在线观看视频一区二区 | 国产日韩亚洲欧美综合| 亚洲人成网站色在线观看| 亚洲国产va精品久久久不卡综合| 男女男精品视频网| 99久久精品久久久久久清纯| 欧美午夜影院一区| 久久综合精品国产一区二区三区| 中文字幕一区二区三区在线观看 | 日本一区二区三区国色天香| 亚洲色图20p| 精品一区二区三区欧美| 91麻豆文化传媒在线观看| 日韩女优毛片在线| 亚洲精品你懂的| 久久国产综合精品| 91久久精品国产91性色tv | 欧美日韩视频在线一区二区 | 欧美人妇做爰xxxⅹ性高电影| 久久久国产午夜精品| 亚洲成人激情av| 国产成人精品综合在线观看 | 中文字幕视频一区二区三区久| 五月天欧美精品| 成人精品国产福利| 欧美不卡一区二区三区四区| 一区二区三区四区中文字幕| 国产美女娇喘av呻吟久久| 欧美片在线播放| 国产精品激情偷乱一区二区∴| 狂野欧美性猛交blacked| 在线免费观看不卡av| 国产情人综合久久777777| 琪琪久久久久日韩精品| 色狠狠av一区二区三区| 国产精品久久夜| 国精产品一区一区三区mba桃花| 欧美色综合影院| 国产精品人成在线观看免费| 黄色精品一二区| 欧美一二三区精品| 视频一区二区三区入口| 在线观看国产精品网站| 中文字幕第一区二区| 久久不见久久见免费视频1| 777a∨成人精品桃花网| 午夜精品久久久久影视| 91福利区一区二区三区| 亚洲欧美视频在线观看| 99综合电影在线视频| 中文字幕免费不卡| 国产成人精品影视| 日本一区二区三区四区在线视频 | 亚洲激情图片qvod| 日本二三区不卡| 亚洲精品日日夜夜|