⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tdeinterlace.h

📁 the De-interlace video processing developed with C++ enviroment in Motion adaptive in 3D and Bi-indi
💻 H
字号:
/*
**                TDeinterlace v1.0b4 for AviSynth 2.5.x
**
**   TDeinterlace is a bi-directionally motion adaptive deinterlacer.
**   It also uses a couple modified forms of ela interpolation which 
**   help to reduce "jaggy" edges in places where interpolation must 
**   be used. TDeinterlace currently supports YV12 and YUY2 colorspaces.
**   
**   Copyright (C) 2004-2005 Kevin Stone
**
**   This program 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 of the License, or
**   (at your option) any later version.
**
**   This program 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 this program; if not, write to the Free Software
**   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#include <windows.h>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <malloc.h>
#include "internal.h"
#define VERSION "v1.0b4"
#define DATE "08/14/2005"

class TDeinterlace : public GenericVideoFilter
{
	int mode, order, field, ovrDefault, type, mtnmode;
	int mthreshL, mthreshC, map, cthresh, MI, link;
	int countOvr, nfrms, nfrms2, orderS, fieldS;
	int mthreshLS, mthreshCS, typeS, cthresh6, AP;
	int xhalf, yhalf, xshift, yshift, blockx, blocky;
	int *input, *cArray, APType;
	unsigned int passHint;
	unsigned long accumN, accumP;
	bool debug, sharp, hints, full, chroma;
	bool autoFO, useClip2, tryWeave, denoise;
	const char* ovr;
	char buf[120];
	PClip clip2;
	void TDeinterlace::createMotionMapYV12(PVideoFrame &prv2, PVideoFrame &prv, 
		PVideoFrame &src, PVideoFrame &nxt, PVideoFrame &nxt2, PVideoFrame &mask, int n);
	void TDeinterlace::createMotionMapYUY2(PVideoFrame &prv2, PVideoFrame &prv, 
		PVideoFrame &src, PVideoFrame &nxt, PVideoFrame &nxt2, PVideoFrame &mask, int n);
	void TDeinterlace::createMotionMap2YV12(PVideoFrame &prv2, PVideoFrame &prv, 
		PVideoFrame &src, PVideoFrame &nxt, PVideoFrame &nxt2, PVideoFrame &mask, int n);
	void TDeinterlace::createMotionMap2YUY2(PVideoFrame &prv2, PVideoFrame &prv, 
		PVideoFrame &src, PVideoFrame &nxt, PVideoFrame &nxt2, PVideoFrame &mask, int n);
	void TDeinterlace::linkFULL_YV12(PVideoFrame &mask);
	void TDeinterlace::linkYtoUV_YV12(PVideoFrame &mask);
	void TDeinterlace::linkUVtoY_YV12(PVideoFrame &mask);
	void TDeinterlace::linkFULL_YUY2(PVideoFrame &mask);
	void TDeinterlace::linkYtoUV_YUY2(PVideoFrame &mask);
	void TDeinterlace::linkUVtoY_YUY2(PVideoFrame &mask);
	void TDeinterlace::denoiseYV12(PVideoFrame &mask);
	void TDeinterlace::denoiseYUY2(PVideoFrame &mask);
	void TDeinterlace::subtractFieldsYV12(PVideoFrame &prv, PVideoFrame &src, PVideoFrame &nxt);
	void TDeinterlace::subtractFieldsYUY2(PVideoFrame &prv, PVideoFrame &src, PVideoFrame &nxt);
	void TDeinterlace::mapColorsYV12(PVideoFrame &dst, PVideoFrame &mask);
	void TDeinterlace::mapColorsYUY2(PVideoFrame &dst, PVideoFrame &mask);
	void TDeinterlace::mapMergeYV12(PVideoFrame &dst, PVideoFrame &mask, 
		PVideoFrame &prv, PVideoFrame &src, PVideoFrame &nxt);
	void TDeinterlace::mapMergeYUY2(PVideoFrame &dst, PVideoFrame &mask, 
		PVideoFrame &prv, PVideoFrame &src, PVideoFrame &nxt);
	void TDeinterlace::smartELADeintYV12(PVideoFrame &dst, PVideoFrame &mask, 
		PVideoFrame &prv, PVideoFrame &src, PVideoFrame &nxt);
	void TDeinterlace::smartELADeintYUY2(PVideoFrame &dst, PVideoFrame &mask, 
		PVideoFrame &prv, PVideoFrame &src, PVideoFrame &nxt);
	void TDeinterlace::cubicDeintYV12(PVideoFrame &dst, PVideoFrame &mask, 
		PVideoFrame &prv, PVideoFrame &src, PVideoFrame &nxt);
	void TDeinterlace::cubicDeintYUY2(PVideoFrame &dst, PVideoFrame &mask, 
		PVideoFrame &prv, PVideoFrame &src, PVideoFrame &nxt);
	void TDeinterlace::kernelDeintYV12(PVideoFrame &dst, PVideoFrame &mask, 
		PVideoFrame &prv, PVideoFrame &src, PVideoFrame &nxt);
	void TDeinterlace::kernelDeintYUY2(PVideoFrame &dst, PVideoFrame &mask, 
		PVideoFrame &prv, PVideoFrame &src, PVideoFrame &nxt);
	unsigned char TDeinterlace::cubicInt(unsigned char p1, unsigned char p2, 
		unsigned char p3, unsigned char p4);
	bool TDeinterlace::checkCombedYUY2(PVideoFrame &src, IScriptEnvironment *env);
	bool TDeinterlace::checkCombedYV12(PVideoFrame &src, IScriptEnvironment *env);
	void TDeinterlace::createWeaveFrameYUY2(PVideoFrame &dst, PVideoFrame &prv, 
		PVideoFrame &src, PVideoFrame &nxt, IScriptEnvironment *env);
	void TDeinterlace::createWeaveFrameYV12(PVideoFrame &dst, PVideoFrame &prv, 
		PVideoFrame &src, PVideoFrame &nxt, IScriptEnvironment *env);
	PVideoFrame TDeinterlace::GetFrameYV12(int n, IScriptEnvironment* env);
	PVideoFrame TDeinterlace::GetFrameYUY2(int n, IScriptEnvironment* env);
	void TDeinterlace::ELADeintYUY2(PVideoFrame &dst, PVideoFrame &mask, 
		PVideoFrame &prv, PVideoFrame &src, PVideoFrame &nxt);
	void TDeinterlace::ELADeintYV12(PVideoFrame &dst, PVideoFrame &mask, 
		PVideoFrame &prv, PVideoFrame &src, PVideoFrame &nxt);
	void TDeinterlace::apPostCheck(PVideoFrame &dst, PVideoFrame &mask, IScriptEnvironment *env);
	void TDeinterlace::copyForUpsize(PVideoFrame &dst, PVideoFrame &src, int np, IScriptEnvironment *env);
	void TDeinterlace::setMaskForUpsize(PVideoFrame &msk, int np);
	void TDeinterlace::copyFrame(PVideoFrame &dst, PVideoFrame &src, IScriptEnvironment *env);

public:
	PVideoFrame __stdcall TDeinterlace::GetFrame(int n, IScriptEnvironment* env);
	TDeinterlace::TDeinterlace(PClip _child, int _mode, int _order, int _field, int _mthreshL, 
		int _mthreshC, int _map, const char* _ovr, int _ovrDefault, int _type, bool _debug, 
		int _mtnmode, bool _sharp, bool _hints, PClip _clip2, bool _full, int _cthresh, 
		bool _chroma, int _MI, bool _tryWeave, int _link, bool _denoise, int _AP, 
		int _blockx, int _blocky, int _APType, IScriptEnvironment* env);
	TDeinterlace::~TDeinterlace();
	static int TDeinterlace::getHint(PVideoFrame &src, unsigned int &storeHint, int &hintField);
	static void TDeinterlace::putHint(PVideoFrame &src, unsigned int hint, int fieldt);
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -