📄 blenddeinterlacer.cpp
字号:
/* * 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 "BlendDeinterlacer.h"//#define DEBUG#include "log.h"#define MODULE "BlendDeinterlacer"BlendDeinterlacer::BlendDeinterlacer(){#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 BlendDeinterlacer::Render(unsigned char * ptr[], unsigned char * src[], deint * d){ /* First line: simple copy */ SDL_memcpy(ptr[2], src[2], d->width); src[2] += d->src_pitch[2]; ptr[2] += d->dst_pitch[2]; /* Remaining lines: mean value */ register int j = d->height - 1; while(j--) { // Y Merge(ptr[2], src[2], src[2] + d->src_pitch[2], d->width); src[2] += d->src_pitch[2]; ptr[2] += d->dst_pitch[2]; } if(EndMerge) EndMerge(); // Use optimized MemCopy and copy both chroma planes if(d->src_pitch[0] == d->dst_pitch[0]) { MemCopy(ptr[0], src[0], d->src_pitch[0] * (d->height>>1)); MemCopy(ptr[1], src[1], d->src_pitch[1] * (d->height>>1)); return; } j = d->height; register unsigned int k = 0; // U & V while(j--) { SDL_memcpy(ptr[k], src[k], d->width>>1); src[k] += d->src_pitch[k]; ptr[k] += d->dst_pitch[k]; k = (k+1)&1; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -