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

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

?? 2x2.c

?? 32位操作系統OS/2的MPEG播放機
?? C
字號:
/*
 * Copyright (c) 1992 The Regents of the University of California.
 * All rights reserved.
 * 
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice and the following
 * two paragraphs appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 */

#include "video.h"
#include "dither.h"
#include "proto.h"

#define RAND_ERR_RANGE 7
#define RAND_ERR_SUBVAL 3

/* Array containing actual pixel values for each possible 2x2 dither pattern. */

static unsigned char *dith_a;

/* Arrays mapping lum, cr, and cb values to portions of dither pattern code. 
   The addtion of one value from each array yields a valid dither pattern
   code.
*/

static int lval_a[256+RAND_ERR_RANGE-1];
static int rval_a[256+RAND_ERR_RANGE-1];
static int bval_a[256+RAND_ERR_RANGE-1];

/* Range of possible dither patterns in each channel. */

#define L_DITH_RANGE (((LUM_RANGE-1)*4)+1)
#define CR_DITH_RANGE (((CR_RANGE-1)*4)+1)
#define CB_DITH_RANGE (((CB_RANGE-1)*4)+1)

/* Arrays of random error terms added to break up contours. */

static int *randval_a;
static int **randptr_a;


/*
 *--------------------------------------------------------------
 *
 *  Init2x2Dither--
 *
 *	Initializes structures used for 2x2 dithering.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	None.
 *
 *--------------------------------------------------------------
 */

void
Init2x2Dither()
{  
  unsigned char *dith_ca;
  int numcodes;
  int l_range, cr_range, cb_range;
  int p1, p2, p3, p4;
  int l_dith, cr_dith, cb_dith;
  int big_part, small_part;
  int i, j;

  l_range = L_DITH_RANGE;
  cr_range = CR_DITH_RANGE;
  cb_range = CB_DITH_RANGE;

  numcodes =  l_range * cr_range * cb_range;

  dith_a = (unsigned char *) malloc(numcodes*4);

  dith_ca =  dith_a;

  for (i=0; i<numcodes; i++) {
    l_dith = i  % l_range;

    big_part = l_dith / 4;
    small_part = l_dith % 4;

    p1 = big_part + ((small_part > 0) ? 1 : 0);
    p2 = big_part + ((small_part > 2) ? 1 : 0);
    p3 = big_part;
    p4 = big_part + ((small_part > 1) ? 1 : 0);

    p1 *= CR_RANGE * CB_RANGE;
    p2 *= CR_RANGE * CB_RANGE;
    p3 *= CR_RANGE * CB_RANGE;
    p4 *= CR_RANGE * CB_RANGE;

    cr_dith = (i/l_range) % cr_range;

    big_part = cr_dith / 4;
    small_part = cr_dith % 4;

    p1 += (big_part + ((small_part > 0) ? 1 : 0))*CB_RANGE;
    p2 += (big_part + ((small_part > 2) ? 1 : 0))*CB_RANGE;
    p3 += (big_part)*CB_RANGE;
    p4 += (big_part + ((small_part > 1) ? 1 : 0))*CB_RANGE;

    cb_dith = (i/(cr_range*l_range)) % cb_range;

    big_part = cb_dith / 4;
    small_part = cb_dith % 4;

    p1 += (big_part + ((small_part > 0) ? 1 : 0));
    p2 += (big_part + ((small_part > 2) ? 1 : 0));
    p3 += (big_part);
    p4 += (big_part + ((small_part > 1) ? 1 : 0));

    *dith_ca++ = p1;
    *dith_ca++ = p2;
    *dith_ca++ = p3;
    *dith_ca++ = p4;
  }

  for (i=RAND_ERR_SUBVAL; i<256+RAND_ERR_SUBVAL; i++) {
    j = i-RAND_ERR_SUBVAL;
    lval_a[i] = (j * L_DITH_RANGE)/256;
    rval_a[i] = (j * CR_DITH_RANGE)/256;
    bval_a[i] = (j * CB_DITH_RANGE)/256;

    bval_a[i] *= CR_DITH_RANGE * L_DITH_RANGE * 4;
    rval_a[i] *= L_DITH_RANGE * 4;
    lval_a[i] *= 4;
  }

  for (i=0; i<RAND_ERR_SUBVAL; i++) {
    lval_a[i] = lval_a[RAND_ERR_SUBVAL];
    rval_a[i] = rval_a[RAND_ERR_SUBVAL];
    bval_a[i] = bval_a[RAND_ERR_SUBVAL];
  }

   for(i=256+RAND_ERR_SUBVAL; i<256+RAND_ERR_RANGE-1; i++) {
     lval_a[i] = lval_a[255+RAND_ERR_SUBVAL];
     rval_a[i] = rval_a[255+RAND_ERR_SUBVAL];
     bval_a[i] = bval_a[255+RAND_ERR_SUBVAL];
   }
}


/*
 *--------------------------------------------------------------
 *
 * RandInit --
 *
 *	Initializes the random values used for 2x2 dithering.
 *
 * Results:
 *	randval_a filled with random values.
 *      randptr_a filled with random pointers to random value arrays.
 *
 * Side effects:
 *      None.
 *
 *--------------------------------------------------------------
 */

void RandInit(h, w)
     int h, w;
{
  int i;

  randval_a = (int *) malloc(w*5*sizeof(int));
  randptr_a = (int **) malloc(h*sizeof(int *));


#ifdef NO_LRAND48
  for (i=0; i<w*5; i++) {
#ifdef OS2
/* @@@ AK, Called rand() on OS/2 */
    extern int rand(void);
    #define random() rand()
#else
    long int random();
#endif
    randval_a[i] = random() % RAND_ERR_RANGE;
  }

  for (i=0; i<h; i++) {
#ifdef OS2
/* @@@ AK, Called rand() on OS/2 */
    extern int rand(void);
    #define random() rand()
#else
    long int random();
#endif

    randptr_a[i] = randval_a + (random() % (w*2));
  }
#else /* NO_LRAND48 */

  for (i=0; i<w*5; i++) {
    long int lrand48();
    
    randval_a[i] = lrand48() % RAND_ERR_RANGE;
  }
  
  for (i=0; i<h; i++) {
    long int lrand48();

    randptr_a[i] = randval_a + (lrand48() % (w*2));
  }
#endif
  
}


/*
 *--------------------------------------------------------------
 *
 *  PostInit2x2Dither--
 *
 *	Remaps color numbers in dither patterns to actual pixel
 *      values allocated by the X server.
 *
 * Results:
 *      None.
 *
 * Side effects:
 *      None.
 *
 *--------------------------------------------------------------
 */

void
PostInit2x2Dither() 
{
/* @@@ See comments accompanying definition of pixel array */
#ifndef OS2
  unsigned char *dith_ca;
  int i;

  dith_ca = dith_a;

  for (i=0; i < (L_DITH_RANGE * CR_DITH_RANGE * CB_DITH_RANGE); i++) {
    
    *dith_ca = pixel[*dith_ca];
    dith_ca++;
    *dith_ca = pixel[*dith_ca];
    dith_ca++;
    *dith_ca = pixel[*dith_ca];
    dith_ca++;
    *dith_ca = pixel[*dith_ca];
    dith_ca++;
  }
#endif
}


/*
 *--------------------------------------------------------------
 *
 * Twox2DitherImage --
 *
 *	Dithers lum, cr, and cb channels togethor using predefined
 *      and computed 2x2 dither patterns. Each possible combination of
 *      lum, cr, and cb values combines to point to a particular dither
 *      pattern (2x2) which is used to represent the pixel. This assumes
 *      That the display plane is 4 times larger than the lumianance 
 *      plane. 
 *
 * Results:
 *      None.
 *
 * Side effects:
 *      None.
 *
 *--------------------------------------------------------------
 */

void 
Twox2DitherImage(lum, cr, cb, out, h, w)
    unsigned char *lum;
    unsigned char *cr;
    unsigned char *cb;
    unsigned char *out;
    int w, h;
{
  int i, j;
  unsigned short *o1, *o2, *o3, *o4;
  unsigned char *l1, *l2, *base;
  unsigned char B, R;
  unsigned short *dith_ca;
  int big_adv = 3*w;
  int b_val, r_val, l_val;
  int *randvalptr;
  int randval;
  static int first = 1;

  if (first) {
    RandInit(h, w);
    first = 0;
  }

  o1 = (unsigned short *)out;
  o2 = (unsigned short *)(out+(2*w));
  o3 = (unsigned short *)(out+(4*w));
  o4 = (unsigned short *)(out+(6*w));
  l1 = lum;
  l2 = lum+w;

  for (i=0; i<h; i+=2) {
    for(j=0; j<w; j+= 4) {
 
      B = cb[0];
      b_val = bval_a[B];
      R = cr[0];
      r_val = rval_a[R];
      base = dith_a + b_val + r_val;

      l_val = lval_a[l1[0]];
      dith_ca = (unsigned short *)(base + l_val);
      o1[0] = dith_ca[0];
      o2[0] = dith_ca[1];

      l_val = lval_a[l1[1]];
      dith_ca = (unsigned short *)(base + l_val);
      o1[1] = dith_ca[0];
      o2[1] = dith_ca[1];

      l_val = lval_a[l2[0]];
      dith_ca = (unsigned short *)(base + l_val);
      o3[0] = dith_ca[0];
      o4[0] = dith_ca[1];

      l_val = lval_a[l2[1]];
      dith_ca = (unsigned short *)(base + l_val);
      o3[1] = dith_ca[0];
      o4[1] = dith_ca[1];

      B = cb[1];
      b_val = bval_a[B];
      R = cr[1];
      r_val = rval_a[R];
      base = dith_a + b_val + r_val;

      l_val = lval_a[l1[2]];
      dith_ca = (unsigned short *)(base + l_val);
      o1[2] = dith_ca[0];
      o2[2] = dith_ca[1];

      l_val = lval_a[l1[3]];
      dith_ca = (unsigned short *)(base + l_val);
      o1[3] = dith_ca[0];
      o2[3] = dith_ca[1];

      l_val = lval_a[l2[2]];
      dith_ca = (unsigned short *)(base + l_val);
      o3[2] = dith_ca[0];
      o4[2] = dith_ca[1];

      l_val = lval_a[l2[3]];
      dith_ca = (unsigned short *)(base + l_val);
      o3[3] = dith_ca[0];
      o4[3] = dith_ca[1];

      o1 += 4;
      o2 += 4;
      o3 += 4;
      o4 += 4;
      l1 += 4;
      l2 += 4;
      cb += 2;
      cr += 2;
    }    

    l1 += w;
    l2 += w;
    o1 += big_adv;
    o2 += big_adv;
    o3 += big_adv;
    o4 += big_adv;
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91小视频免费看| 日韩精品一区二区三区在线播放 | 欧美国产激情一区二区三区蜜月| 国产精品狼人久久影院观看方式| 日韩激情一二三区| 波多野结衣在线一区| 日韩一级免费观看| 亚洲高清在线精品| 91免费在线播放| 国产亚洲午夜高清国产拍精品 | 蜜桃视频免费观看一区| 不卡一二三区首页| 国产午夜精品美女毛片视频| 日日摸夜夜添夜夜添精品视频| 99久久国产综合精品色伊| 久久综合狠狠综合久久综合88| 亚洲丰满少妇videoshd| 一本到不卡精品视频在线观看| 欧美国产欧美亚州国产日韩mv天天看完整 | 国产精品亲子乱子伦xxxx裸| 偷窥国产亚洲免费视频| 91天堂素人约啪| 久久婷婷成人综合色| 亚洲成av人片观看| 日本久久一区二区三区| 国产午夜亚洲精品午夜鲁丝片| 五月婷婷另类国产| 欧美探花视频资源| 国产精品18久久久久久vr| 91久久精品国产91性色tv| 国产精品你懂的在线欣赏| 国内欧美视频一区二区| 日韩精品最新网址| 首页欧美精品中文字幕| 欧美日韩不卡一区二区| 一区二区三区美女| 91在线云播放| 亚洲欧美精品午睡沙发| 欧美无砖专区一中文字| 久久 天天综合| 日韩成人av影视| 亚洲成av人综合在线观看| 国产精品三级电影| 久久久美女毛片| 日韩一区二区电影网| 欧美一区二区视频在线观看2020 | 琪琪久久久久日韩精品| 国产精品成人免费| 综合欧美亚洲日本| 国产精品卡一卡二| 国产精品网曝门| 久久久国产一区二区三区四区小说| 日韩一区二区高清| 久久婷婷国产综合精品青草| 久久精品人人做人人综合| 精品国产青草久久久久福利| 欧美电影免费观看高清完整版在线观看| 欧美日韩一区二区三区在线| 欧美日韩综合一区| 中文字幕一区二区三区在线播放| 2020国产精品自拍| 亚洲欧洲日本在线| 国产成人免费网站| 9l国产精品久久久久麻豆| 日本免费新一区视频| 久久久久久亚洲综合影院红桃 | 青青草伊人久久| av资源网一区| 欧美主播一区二区三区美女| 在线观看av不卡| 日本一区二区成人| 成人的网站免费观看| 亚洲成av人片www| 久久精品国产澳门| 国产精品蜜臀在线观看| 欧美日韩视频在线第一区 | 91亚洲永久精品| 91久久精品一区二区三区| 久久综合久久综合亚洲| 亚洲最大的成人av| 成人精品亚洲人成在线| 91精品国产综合久久福利| 亚洲人成网站色在线观看| 毛片av一区二区| 欧美videos大乳护士334| 亚洲午夜成aⅴ人片| 99精品视频免费在线观看| 日韩色视频在线观看| 一区二区三区色| 99久久久精品| 国产亚洲欧美日韩俺去了| 国产福利91精品一区| www久久久久| 高清不卡一区二区| 国产蜜臀av在线一区二区三区| 国产福利91精品| 国产精品天干天干在线综合| 国产激情一区二区三区| 欧美顶级少妇做爰| 国产精品久久久久久户外露出| 欧美色涩在线第一页| 91精品黄色片免费大全| 麻豆一区二区三| 国产清纯在线一区二区www| 欧美一区二区二区| 91搞黄在线观看| 色综合久久88色综合天天6| 成人av电影免费观看| 成人综合婷婷国产精品久久蜜臀| 美洲天堂一区二卡三卡四卡视频| 午夜视频在线观看一区| 亚洲一区二区三区中文字幕| 蜜乳av一区二区| 日本午夜精品一区二区三区电影 | 国产精品色哟哟网站| 久久久不卡影院| 国产亚洲欧美一级| 国产区在线观看成人精品| 中文字幕不卡一区| 18涩涩午夜精品.www| 国产精品国产三级国产| 国产精品久久久久久久久免费樱桃 | 狠狠色丁香久久婷婷综| 精品在线亚洲视频| 国内成人精品2018免费看| 国产精品一区三区| 成人av资源站| 色综合久久中文字幕综合网| 91精彩视频在线观看| 欧美老女人在线| 精品成人免费观看| 欧美国产精品专区| 亚洲综合另类小说| 青青青伊人色综合久久| 国产福利一区二区三区在线视频| 国产一区二区91| yourporn久久国产精品| 欧美三级欧美一级| 精品国产乱码久久久久久久久| 久久久91精品国产一区二区精品| 国产精品欧美久久久久一区二区| 一区二区在线观看免费| 青青草国产精品97视觉盛宴| 国产一区二区三区视频在线播放| 成人一区二区在线观看| 欧美日本免费一区二区三区| 日韩精品中午字幕| 亚洲美女视频在线| 久久99精品久久只有精品| jlzzjlzz欧美大全| 91精品婷婷国产综合久久性色| 久久青草国产手机看片福利盒子| 亚洲男人天堂av网| 国产一区二区三区在线观看免费| 日本韩国欧美一区| 欧美成人vps| 一区二区三区小说| 国产一区二区在线影院| 欧美性猛交xxxx乱大交退制版| 国产亚洲精品超碰| 午夜视频一区在线观看| 丁香另类激情小说| 欧美猛男男办公室激情| 日本一二三不卡| 免费在线欧美视频| 色综合久久99| 国产精品毛片高清在线完整版| 日韩中文字幕91| 欧美在线你懂得| 国产欧美精品一区aⅴ影院 | 99re这里都是精品| 久久婷婷色综合| 久久er精品视频| 91精品免费观看| 亚洲成人免费影院| 91亚洲午夜精品久久久久久| 久久综合网色—综合色88| 水蜜桃久久夜色精品一区的特点| 99精品国产视频| 国产精品毛片高清在线完整版| 国产精品中文字幕日韩精品| 欧美精品久久天天躁| 一区二区三区在线观看国产 | 538在线一区二区精品国产| 亚洲日本在线观看| 99麻豆久久久国产精品免费| 国产女人aaa级久久久级 | 日本成人在线视频网站| 日本高清不卡视频| 蜜臀va亚洲va欧美va天堂| 91精品在线观看入口| 亚洲444eee在线观看| 欧美日韩精品一区二区三区四区| 亚洲男同性视频| 欧美性一二三区| 五月天激情综合| 制服丝袜中文字幕一区| 日韩二区三区四区| 日韩免费在线观看| 国内一区二区视频|