meandeinterlacer.cpp

来自「linux下实现视频播放的播放器」· C++ 代码 · 共 82 行

CPP
82
字号
/* *  Copyright (C) 2005-2008  gulikoza, mtrooper * *  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. *//* $Id$ */#include "MeanDeinterlacer.h"//#define DEBUG#include "log.h"#define MODULE "BlendDeinterlacer"MeanDeinterlacer::MeanDeinterlacer(){#ifdef HAVE_ALTIVEC_H	if(SDL_HasAltiVec()) {	    Merge = MergeAltivec;	    EndMerge = NULL;	    LOG_MSG("Using Altivec optimizations");	} else#endif#if (C_HOSTCPU == X86) || (C_HOSTCPU == X86_64)	if(SDL_HasSSE2()) {	    Merge = MergeSSE2;	    EndMerge = EndMMX;	    LOG_MSG("Using SSE2 optimizations");	} else	if(SDL_HasSSE()) {	    Merge = MergeMMXEXT;	    EndMerge = EndMMX;	    LOG_MSG("Using SSE optimizations");	} else	if(SDL_Has3DNow()) {	    Merge = Merge3DNow;	    EndMerge = End3DNow;	    LOG_MSG("Using 3DNow optimizations");	} else#endif	{	    Merge = MergeGeneric;	    EndMerge = NULL;	}}void MeanDeinterlacer::Render(unsigned char * ptr[],  unsigned char * src[], deint * d){    /* Copy image and skip lines */    register int j = d->height>>1;    register unsigned int k = 0;    while(j--) {	// Y        Merge(ptr[2], src[2], src[2] + d->src_pitch[2], d->width);        src[2] += d->src_pitch[2]<<1;        ptr[2] += d->dst_pitch[2];	// U & V        Merge(ptr[k], src[k], src[k] + d->src_pitch[k], d->width>>1);        src[k] += d->src_pitch[k]<<1;        ptr[k] += d->dst_pitch[k];        k = (k+1)&1;    }    if(EndMerge) EndMerge();}

⌨️ 快捷键说明

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