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

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

?? readpic.c

?? mp3解碼程序vc++環境下運行
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* readpic.c, 從avi文件中讀取源圖像數據*/

#include <windows.h>
#include <vfw.h>
#include <stdio.h>
#include <stdlib.h>
#include "global.h"#include "video.h"

static void conv444to422(unsigned char[], unsigned char[]);
static void conv422to420(unsigned char[], unsigned char[]);

unsigned int u, v, bpscanl, dib_offset, j, hblank, vblank, hcrop, vcrop, topblank;
int x, y;
float R, G, B;

// RGB->YUV 轉換常數

const float RY = (77.0/256.0), GY = (150.0/256.0), BY = (29.0/256.0);
const float RU = (-44.0/256.0), GU = (-87.0/256.0), BU = (131.0/256.0);
const float RV = (131.0/256.0), GV = (-110.0/256.0), BV = (-21.0/256.0);

static short PACKED_Y[4] = { 29, 150, 77, 0 };
static short PACKED_U[4] = { 131, -87, -44, 0 };
static short PACKED_V[4] = { -21, -110, 131, 0 };
static short PACKED_RY[4] = { 77, 77, 77, 77 };
static short PACKED_GY[4] = { 150, 150, 150, 150 };
static short PACKED_BY[4] = { 29, 29, 29, 29 };
static short PACKED_RU[4] = { -44, -44, -44, -44 };
static short PACKED_GU[4] = { -87, -87, -87, -87 };
static short PACKED_BU[4] = { 131, 131, 131, 131 };
static short PACKED_RV[4] = { 131, 131, 131, 131 };
static short PACKED_GV[4] = { -110, -110, -110, -110 };
static short PACKED_BV[4] = { -21, -21, -21, -21 };
static short PACKED_128[4] = { 128, 128, 128, 128 };
static short PACKED_0[4] = { 0, 0, 0, 0 };
static unsigned char PACKED_128B[8] = { 128, 128, 128, 128, 128, 128, 128, 128 };
static long PACKED_128L[2] = { 128, 128 };
static short PACKED_0x07[4] = { 0x07, 0x07, 0x07, 0x07 };
static short PACKED_0xf8[4] = { 0xf8, 0xf8, 0xf8, 0xf8 };

// conv444to422 and conv522to420 constants
static short PACKED_228[4] = { 228, 228, 228, 228 };
static short PACKED_70[4] = { 70, 70, 70, 70 };
static short PACKED_MINUS37[4] = { -37, -37, -37, -37 };
static short PACKED_MINUS21[4] = { -21, -21, -21, -21 };
static short PACKED_11[4] = { 11, 11, 11, 11 };
static short PACKED_5[4] = { 5, 5, 5, 5 };
static long PACKED_256[2] = { 256, 256 };
static short PACKED_255[4] = { 255, 255, 255, 255 };
/

const int Tolerance  = 10;
const int Filtersize = 6;

#define MAX(a, b) ((a)>(b)?(a):(b))
#define MIN(a, b) ((a)<(b)?(a):(b))

/*
下面的程序是一個軟濾波器,它用像素周圍與之最接近的值進行替代
 
*/

void softfilter(unsigned char* dest, unsigned char* src, int width, int height)
{
  int refval, aktval, upperval, lowerval, numvalues, sum, rowindex;
  int x, y, fx, fy, fy1, fy2, fx1, fx2;

  for(y = 0; y < height; y++)
  {
    for(x = 0; x < width; x++)
    {
      refval    = src[x+y*width];
      upperval  = refval + Tolerance;
      lowerval  = refval - Tolerance;

      numvalues = 1;
      sum       = refval;
      
      fy1 = MAX(y-Filtersize,   0);
      fy2 = MIN(y+Filtersize+1, height);

      for (fy = fy1; fy<fy2; fy++)
      {
        rowindex = fy*width;
        fx1      = MAX(x-Filtersize,   0)     + rowindex;
        fx2      = MIN(x+Filtersize+1, width) + rowindex;

        for (fx = fx1; fx<fx2; fx++)
        {
          aktval = src[fx];
          if ((lowerval-aktval)*(upperval-aktval)<0)
          {
            numvalues ++;
            sum += aktval;
          }
        } //for fx
      } //for fy
      
      dest[x+y*width] = sum/numvalues;
    }
  }
}


void readframe(lCurFrame,frame)unsigned char *frame[];
unsigned long	lCurFrame;{
	int h, w;
	int lblank, rblank;	unsigned char	*lpframeY, *lpframeU, *lpframeV;
	unsigned int pixsz;
	unsigned char *lpColor;
	unsigned int palletized;
    int file;

    for(file=0;file<numAviFiles;file++)
        if ((lCurFrame/frame_repl) < nextFileFrames[file])
            break;

        lpbi = AVIStreamGetFrame(pget[file], lCurFrame/frame_repl-((file==0)?0:nextFileFrames[file-1]));

    if(!lpbi && !fake_bad_frames)
	{
		fprintf(stderr, "\ncould not retrieve video frame %i!\n", lCurFrame);
		fprintf(stderr, "\npossibly corrupt avi file, try -e option.");
		exit(25);
	}
	else if(!lpbi && fake_bad_frames)
	{
        for(file=0;file<numAviFiles;file++)
            if ((last_good_video_frame) < nextFileFrames[file])
                break;
		lpbi = AVIStreamGetFrame(pget[file], last_good_video_frame);
		bad_frame_count++;
	}
	else if(lpbi)
	{
		last_good_video_frame = lCurFrame/frame_repl;
	}

	pixsz = lpbi->biBitCount;
	if((pixsz!=8)&&(pixsz!=16)&&(pixsz!=24)&&(pixsz!=32))
	{
		fprintf(stderr, "\ncan only handle 8 bit palettized, or 16, 24, or 32 bit RGB video!");
		exit(26);
	}

	if(pixsz==8)
		palletized=1;
	else
		palletized=0;


	if (lpbi->biCompression != BI_RGB) // does not support BI_BITFIELDS
	{
		fprintf(stderr, "\ncan not handle compressed DIBs from codec!");
		exit(27);
	}

	lpColor = (unsigned char *)lpbi + lpbi->biSize; 

	if(palletized)
		dib_offset = sizeof(BITMAPINFOHEADER) + lpbi->biClrUsed * 4;
	else
		dib_offset = sizeof(BITMAPINFOHEADER); // offset past bitmap header
	lpbitmp = (unsigned char *)lpbi + dib_offset; // pointer to actual bitmap

	switch(pixsz)
	{
	case 8:
		bpscanl = (unsigned int)(((lpbi->biWidth + 3)>>2)<<2);
		break;
	case 16:
		bpscanl = (unsigned int)(lpbi->biWidth * 2);
		break;
	case 24:
		bpscanl = ((((unsigned int)lpbi->biWidth * 3 + 3)>>2)<<2);
		break;
	case 32:
		bpscanl = (unsigned int)(lpbi->biWidth * 4);
		break;
	default:
		fprintf(stderr, "\ninternal error: illegal pixsz value\n");
		exit(28); 
	}
	if(width>lpbi->biWidth)
		hblank = width - lpbi->biWidth;
	else
		hblank=0;

	if(height>lpbi->biHeight)
		vblank = height - lpbi->biHeight;
	else
		vblank=0;

	if(width<lpbi->biWidth)
		hcrop = lpbi->biWidth - width;
	else
		hcrop=0;

	if(height<lpbi->biHeight)
		vcrop = lpbi->biHeight - height;
	else
		vcrop=0;

	if(vertical_size>lpbi->biHeight)
		topblank = (vertical_size - lpbi->biHeight)/2;
	else
		topblank = 0;

	// 將RGB DIB 轉化成 YUV (4:2:0)
	lpframeY = (unsigned char *)frame[0];
	lpframeU = (unsigned char *)frame[1];
	lpframeV = (unsigned char *)frame[2];

	j = topblank;
	while(j > 0)
	{
		for(x = 0; x < width; x++)
		{
			*lpframeY++ = 0;
			Ubuffer[x + (j - 1)*width] = 128;
			Vbuffer[x + (j - 1)*width] = 128;
		}
		j--;
	}

	switch(pixsz)
	{
		case 8:
			lpcurscanl = (unsigned char *)(lpbitmp + ((lpbi->biHeight - 1 - (vcrop/2)) * bpscanl) + ((hcrop/2)));
			lpframeU = Ubuffer+(hblank/2)+topblank*width;
			lpframeV = Vbuffer+(hblank/2)+topblank*width;

			h = lpbi->biHeight - (int) vcrop;
			lblank = hblank/2;
			rblank = hblank - lblank;

			do
			{
			
				if(lblank > 0)
				{
					memset(lpframeY, 0, lblank);
					memset(lpframeU, 128, lblank);
					memset(lpframeV, 128, lblank);
					lpframeY += lblank;
					lpframeU += lblank;
					lpframeV += lblank;
				}

				w = lpbi->biWidth - (int) hcrop;
				lpcurpix = lpcurscanl;

				do
				{
					R = (float) lpColor[*lpcurpix * 4 + 2];
					G = (float) lpColor[*lpcurpix * 4 + 1];
					B = (float) lpColor[*lpcurpix * 4 + 0];
					lpcurpix++;

					*lpframeY++ = (int)(RY*R + GY*G + BY*B);
					*lpframeU++ = (int)(RU*R + GU*G + BU*B + 128);
					*lpframeV++ = (int)(RV*R + GV*G + BV*B + 128);
				} while(--w);

				if(rblank > 0)
				{
					memset(lpframeY, 0, rblank);
					memset(lpframeU, 128, rblank);
					memset(lpframeV, 128, rblank);
					lpframeY += rblank;
					lpframeU += rblank;
					lpframeV += rblank;
				}

				lpcurscanl -= bpscanl;
			} while(--h);
			break;

		case 16:
			lpcurscanl = (unsigned char *)(lpbitmp + ((lpbi->biHeight - 1 - (vcrop/2)) * bpscanl) + ((hcrop/2) * 2));
			lpframeU = Ubuffer+(hblank/2)+topblank*width;
			lpframeV = Vbuffer+(hblank/2)+topblank*width;

			h = lpbi->biHeight - (int) vcrop;
			lblank = hblank/2;
			rblank = hblank - lblank;

			do
			{
				if(lblank > 0)
				{
					memset(lpframeY, 0, lblank);
					memset(lpframeU, 128, lblank);
					memset(lpframeV, 128, lblank);
					lpframeY += lblank;
					lpframeU += lblank;
					lpframeV += lblank;
				}

				if(cpu_MMX)
				{
					w = (lpbi->biWidth-(int)hcrop) >> 2;

					_asm
					{
						mov esi, lpcurscanl		;// esi = lpcurscanl
						mov ecx, lpframeY		;// ecx = lpframeY
						mov edx, lpframeU		;// edx = lpframeU
						mov edi, lpframeV		;// edi = lpframeV
						movq mm6, PACKED_128	;// mm6 = (128, 128, 128, 128)
readframe__l1:
						movq mm0, [esi]			;// mm0 = 4 words into esi[0..7]
						movq mm3, mm0
						movq mm6, mm0
						psrlw mm0, 7
						psrlw mm3, 2
						psllw mm6, 3
						pand mm0, PACKED_0xf8
						pand mm3, PACKED_0xf8
						pand mm6, PACKED_0xf8
						por mm0, PACKED_0x07	;// red is in mm0
						por mm3, PACKED_0x07	;// green is in mm3
						por mm6, PACKED_0x07	;// blue is in mm6
						movq mm1, mm0
						movq mm2, mm0
						movq mm4, mm3
						movq mm5, mm3
						pmullw mm0, PACKED_RY	;// mm0 *= (RY, RY, RY, RY)
						pmullw mm1, PACKED_RU	;// mm1 *= (RU, RU, RU, RU)
						pmullw mm2, PACKED_RV	;// mm2 *= (RV, RV, RV, RV)
						pmullw mm3, PACKED_GY	;// mm3 *= (GY, GY, GY, GY)
						pmullw mm4, PACKED_GU	;// mm4 *= (GU, GU, GU, GU)
						pmullw mm5, PACKED_GV	;// mm5 *= (GV, GV, GV, GV)
						paddw mm0, mm3			;// mm0 += mm3
						paddw mm1, mm4			;// mm1 += mm4
						paddw mm2, mm5			;// mm2 += mm5
						movq mm7, mm6
						movq mm3, mm6
						pmullw mm6, PACKED_BY	;// mm6 *= (RY, RY, RY, RY)
						pmullw mm7, PACKED_BU	;// mm7 *= (RY, RY, RY, RY)
						pmullw mm3, PACKED_BV	;// mm3 *= (RY, RY, RY, RY)
						paddw mm0, mm6			;// mm0 += mm6
						paddw mm1, mm7			;// mm1 += mm7
						paddw mm2, mm3			;// mm2 += mm3
						paddusw mm0, PACKED_128	;// mm0 += (128, 128, 128, 128)
						paddusw mm1, PACKED_128	;// mm1 += (128, 128, 128, 128)
						paddusw mm2, PACKED_128	;// mm2 += (128, 128, 128, 128)
						psrlw mm0, 8			;// shift mm0 and round to lower
						psrlw mm1, 8			;// shift mm1 and round to lower
						psrlw mm2, 8			;// shift mm2 and round to lower
						packuswb mm0, mm0		;// pack 4 words into the lower 4 bytes of mm0
						packuswb mm1, mm1		;// pack 4 words into the lower 4 bytes of mm1
						packuswb mm2, mm2		;// pack 4 words into the lower 4 bytes of mm2
						paddb mm1, PACKED_128B	;// mm1 += (128, 128, 128, 128, 128, 128, 128, 128)
						paddb mm2, PACKED_128B	;// mm2 += (128, 128, 128, 128, 128, 128, 128, 128)
						movd [ecx], mm0			;// store mm0 into ecx[0..7]
						movd [edx], mm1			;// store mm1 into edx[0..7]
						movd [edi], mm2			;// store mm2 into edi[0..7]

						add esi, 8				;// esi += 8
						add ecx, 4				;// edx += 4
						add edx, 4				;// edx += 4
						add edi, 4				;// edi += 4;
						dec dword ptr w			;// decrement w
						jnz readframe__l1		;// loop while not zero
						mov lpframeY, ecx		;// update lpframeY
						mov lpframeU, edx		;// update lpframeU
						mov lpframeV, edi		;// update lpframeV
						emms					;// empty MMX state
					}
				}
				else
				{
					w = lpbi->biWidth - (int) hcrop;
					lpcurpixw = (unsigned short *) lpcurscanl;

					do
					{
						R = (float)(((*lpcurpixw >> 7) & 0xf8)|0x07);
						G = (float)(((*lpcurpixw >> 2) & 0xf8)|0x07);
						B = (float)(((*lpcurpixw << 3) & 0xf8)|0x07);
						lpcurpixw++;

						*lpframeY++ = (int)(RY*R + GY*G + BY*B);
						*lpframeU++ = (int)(RU*R + GU*G + BU*B + 128);
						*lpframeV++ = (int)(RV*R + GV*G + BV*B + 128);
					} while(--w);
				}

				// take care of any blank pixels on the right
				if(rblank > 0)
				{

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
奇米在线7777在线精品| 欧美日韩久久不卡| 欧美日韩在线一区二区| 久久综合久色欧美综合狠狠| 亚洲一区二区三区在线| 国产成人精品三级| 精品精品欲导航| 日日摸夜夜添夜夜添亚洲女人| 成人午夜短视频| 久久九九国产精品| 久久精品国产亚洲a| 欧美日韩国产影片| 亚洲一区二区在线免费看| 成人h动漫精品一区二区| 亚洲精品一区二区三区在线观看 | 91免费观看视频在线| 精品国内二区三区| 免费在线成人网| 欧美男生操女生| 亚洲第一成人在线| 欧美日韩一区二区三区四区| 亚洲欧美韩国综合色| 99视频热这里只有精品免费| 国产精品欧美一区喷水| 国产suv精品一区二区6| 久久久午夜精品理论片中文字幕| 美腿丝袜一区二区三区| 欧美一级xxx| 日本一不卡视频| 欧美日韩国产a| 午夜精品免费在线| 欧美军同video69gay| 午夜av电影一区| 91精品国产综合久久蜜臀| 五月婷婷欧美视频| 日韩欧美一区二区三区在线| 美洲天堂一区二卡三卡四卡视频| 日韩三级中文字幕| 黄网站免费久久| 国产欧美日韩激情| 波波电影院一区二区三区| 亚洲欧美日韩成人高清在线一区| 色拍拍在线精品视频8848| 一区二区三区免费网站| 欧美精品乱人伦久久久久久| 麻豆精品在线视频| 国产欧美一区二区精品性色 | 麻豆久久一区二区| 久久婷婷综合激情| www.亚洲人| 亚洲综合免费观看高清完整版在线| 在线免费观看日本欧美| 日韩激情av在线| 久久伊人中文字幕| 99精品偷自拍| 天天射综合影视| 久久精品人人做人人综合| 色诱视频网站一区| 蜜臀精品一区二区三区在线观看| 国产三区在线成人av| 色综合中文字幕国产 | 麻豆极品一区二区三区| 国产亚洲短视频| 在线亚洲一区观看| 免费观看在线综合色| 国产精品久久综合| 欧美丰满美乳xxx高潮www| 国产一区二区福利| 一区二区高清免费观看影视大全 | 91搞黄在线观看| 韩国一区二区三区| 亚洲国产日韩在线一区模特 | 丁香桃色午夜亚洲一区二区三区| 一区二区三区日韩欧美| 精品99一区二区三区| 在线一区二区三区做爰视频网站| 国产一区在线不卡| 午夜免费久久看| 亚洲天堂福利av| 久久九九国产精品| 91精品久久久久久蜜臀| 高清av一区二区| 日本亚洲电影天堂| 一区二区三区中文在线| 国产婷婷色一区二区三区四区| 欧美中文字幕一区二区三区亚洲 | 日本一区二区不卡视频| 91精品国产色综合久久不卡蜜臀| youjizz国产精品| 久久精品国产精品亚洲红杏| 美女网站一区二区| 一区二区三区精品在线观看| 久久精品亚洲麻豆av一区二区| 欧美日韩卡一卡二| 91亚洲午夜精品久久久久久| 国产精品99久久不卡二区| 日本一区中文字幕| 亚洲高清免费观看高清完整版在线观看| 国产亚洲一区二区三区四区 | 色哦色哦哦色天天综合| 粉嫩13p一区二区三区| 久久精品久久综合| 美脚の诱脚舐め脚责91| 亚洲成人午夜电影| 亚洲午夜激情av| 一区二区三区四区视频精品免费| 国产精品欧美精品| 国产蜜臀97一区二区三区| 国产亚洲欧洲一区高清在线观看| 日韩亚洲欧美中文三级| 一区二区三区四区不卡视频| 中文文精品字幕一区二区| 精品国产伦一区二区三区观看体验| 欧美一级日韩一级| 日韩一区二区免费在线电影| 日韩精品一区二区三区swag| 日韩精品一区二区三区四区 | 国产精品激情偷乱一区二区∴| 久久亚洲精华国产精华液 | 国产在线一区二区综合免费视频| 久久er精品视频| 国产高清精品网站| 粉嫩高潮美女一区二区三区 | 国产精品女人毛片| 中文字幕精品—区二区四季| 中日韩av电影| 亚洲欧美另类久久久精品| 夜夜嗨av一区二区三区网页| 香蕉加勒比综合久久| 免费在线观看成人| 国产·精品毛片| 欧美在线观看一区二区| 欧美一区二区三区免费视频| 欧美成人伊人久久综合网| 国产日韩欧美制服另类| 日韩伦理av电影| 日韩福利电影在线| 国产99精品视频| 在线欧美一区二区| 精品免费视频一区二区| 国产精品美日韩| 一区二区三区四区在线播放| 秋霞午夜av一区二区三区| 成人黄色在线网站| 精品视频123区在线观看| 精品欧美一区二区久久| 亚洲日本在线看| 美美哒免费高清在线观看视频一区二区 | 国内精品伊人久久久久av一坑 | 亚洲视频网在线直播| 日韩在线一区二区| 成人毛片视频在线观看| 777午夜精品免费视频| 中文字幕乱码日本亚洲一区二区| 亚洲国产乱码最新视频| 国内成人自拍视频| 欧美日韩亚洲高清一区二区| 国产亚洲一区二区在线观看| 亚洲电影在线播放| 成人爽a毛片一区二区免费| 欧美丰满嫩嫩电影| 亚洲欧美日韩中文播放| 久久精品国产99国产| 色激情天天射综合网| 久久久精品国产免费观看同学| 亚洲综合小说图片| 成人动漫在线一区| 精品日韩av一区二区| 午夜精品一区二区三区电影天堂| 成人激情图片网| 精品精品国产高清a毛片牛牛| 亚洲综合色在线| 99精品欧美一区二区蜜桃免费| 欧美xxx久久| 五月天网站亚洲| 91黄色在线观看| 中文字幕欧美一区| 国产精品一区2区| 精品国产乱码久久久久久1区2区| 亚洲一区二区三区四区五区黄| 北岛玲一区二区三区四区| 久久久久久久性| 精品一区二区在线播放| 欧美一级日韩免费不卡| 日韩精品久久理论片| 欧美三区免费完整视频在线观看| 亚洲素人一区二区| 成人av免费在线| 中文字幕av在线一区二区三区| 国产精品一级片| 26uuu国产日韩综合| 另类人妖一区二区av| 日韩欧美在线观看一区二区三区| 亚洲一级片在线观看| 欧美日韩在线电影| 亚洲综合清纯丝袜自拍| 欧美日韩精品专区| 日本不卡中文字幕| 欧美不卡一二三| 国产精品亚洲一区二区三区妖精|