1
/////////////////////////////////////////////////////////////////////////////
2
// $Id: TomsMoCompAll.inc,v 1.2 2005/02/05 22:21:18 mschimek Exp $
3
/////////////////////////////////////////////////////////////////////////////
4
// Copyright (c) 2002 Tom Barry All rights reserved.
5
/////////////////////////////////////////////////////////////////////////////
7
// This file is subject to the terms of the GNU General Public License as
8
// published by the Free Software Foundation. A copy of this license is
9
// included with this software distribution in the file COPYING. If you
10
// do not have a copy, you may obtain a copy by writing to the Free
11
// Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
13
// This software is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
// GNU General Public License for more details
18
// Also, this program is "Philanthropy-Ware". That is, if you like it and
19
// feel the need to reward or inspire the author then please feel free (but
20
// not obligated) to consider joining or donating to the Electronic Frontier
21
// Foundation. This will help keep cyber space free of barbed wire and bullsh*t.
22
// See www.eff.org for details
23
/////////////////////////////////////////////////////////////////////////////
26
// $Log: TomsMoCompAll.inc,v $
27
// Revision 1.2 2005/02/05 22:21:18 mschimek
28
// UseStrangeBob disabled, functions use pavgb without capability check
31
// Revision 1.1 2005/01/08 14:54:24 mschimek
32
// *** empty log message ***
34
// Revision 1.3 2002/12/10 16:32:21 adcockj
35
// Fix StrangeBob for MMX
37
// Revision 1.2 2002/11/26 21:32:14 adcockj
38
// Made new strange bob method optional
40
// Revision 1.1 2002/07/07 20:07:24 trbarry
41
// First cut at TomsMoComp, motion compensated deinterlace
44
/////////////////////////////////////////////////////////////////////////////
48
#include "DS_Deinterlace.h"
49
#include "TomsMoComp.h"
56
#define TopFirst IsOdd
59
const BYTE* pWeaveSrc;
60
const BYTE* pWeaveSrcP;
63
const BYTE* pCopySrcP;
65
MEMCPY_FUNC* pMyMemcpy;
75
BOOL FUNCT_NAME(TDeinterlaceInfo* pInfo)
77
pMyMemcpy = pInfo->pMemcpy;
79
dstp = pInfo->Overlay;
80
src_pitch = pInfo->InputPitch;
81
dst_pitch = pInfo->OverlayPitch;
82
rowsize = pInfo->LineLength;
83
RowPixels = rowsize >> 1;
84
FldHeight = pInfo->FieldHeight;
86
pCopySrc = pInfo->PictureHistory[1]->pData;
87
pCopySrcP = pInfo->PictureHistory[3]->pData;
88
pWeaveSrc = pInfo->PictureHistory[0]->pData;
89
pWeaveSrcP = pInfo->PictureHistory[2]->pData;
90
IsOdd = pInfo->PictureHistory[0]->Flags & PICTURE_INTERLACED_ODD;
93
// SSE2 support temporarily deleted
99
// if we have an odd field we copy an even field and weave an odd field
100
pCopyDest = pInfo->Overlay;
101
pWeaveDest = pInfo->Overlay + dst_pitch;
105
// if we have an ever field we copy an odd field and weave an even field
106
pCopyDest = pInfo->Overlay + dst_pitch;
107
pWeaveDest = pInfo->Overlay;
110
// copy 1st and last weave lines
111
Fieldcopy(pWeaveDest, pCopySrc, rowsize,
112
1, dst_pitch*2, src_pitch);
113
Fieldcopy(pWeaveDest+(FldHeight-1)*dst_pitch*2,
114
pCopySrc+(FldHeight-1)*src_pitch, rowsize,
115
1, dst_pitch*2, src_pitch);
117
#ifdef USE_VERTICAL_FILTER
119
// Vertical Filter currently not implemented for DScaler !!
121
// copy 1st and last lines the copy field
122
Fieldcopy(pCopyDest, pCopySrc, rowsize,
123
1, dst_pitch*2, src_pitch);
124
Fieldcopy(pCopyDest+(FldHeight-1)*dst_pitch*2,
125
pCopySrc+(FldHeight-1)*src_pitch, rowsize,
126
1, dst_pitch*2, src_pitch);
129
// copy all of the copy field
130
Fieldcopy(pCopyDest, pCopySrc, rowsize,
131
FldHeight, dst_pitch*2, src_pitch);
133
// then go fill in the hard part, being variously lazy depending upon
136
/* mhs XXX Search_Effort_n_SB uses pavgb, looks buggy. */
137
/* if(UseStrangeBob == FALSE) */
140
if (SearchEffort == 0)
145
else if (SearchEffort <= 1)
150
/* else if (SearchEffort <= 2)
155
else if (SearchEffort <= 3)
160
else if (SearchEffort <= 5)
165
else if (SearchEffort <= 9)
170
else if (SearchEffort <= 11)
175
else if (SearchEffort <= 13)
180
else if (SearchEffort <= 15)
184
else if (SearchEffort <= 19)
188
else if (SearchEffort <= 21)
200
if (SearchEffort == 0)
202
Search_Effort_0_SB();
205
else if (SearchEffort <= 1)
207
Search_Effort_1_SB();
210
/* else if (SearchEffort <= 2)
212
Search_Effort_2_SB();
215
else if (SearchEffort <= 3)
217
Search_Effort_3_SB();
220
else if (SearchEffort <= 5)
222
Search_Effort_5_SB();
225
else if (SearchEffort <= 9)
227
Search_Effort_9_SB();
230
else if (SearchEffort <= 11)
232
Search_Effort_11_SB();
235
else if (SearchEffort <= 13)
237
Search_Effort_13_SB();
240
else if (SearchEffort <= 15)
242
Search_Effort_15_SB();
244
else if (SearchEffort <= 19)
246
Search_Effort_19_SB();
248
else if (SearchEffort <= 21)
250
Search_Effort_21_SB();
255
Search_Effort_Max_SB();
263
int Fieldcopy(void *dest, const void *src, size_t count,
264
int rows, int dst_pitch, int src_pitch)
266
BYTE* pDest = (BYTE*) dest;
267
BYTE* pSrc = (BYTE*) src;
270
for (i=0; i < rows; i++)
272
MyMemCopy(pDest, pSrc, count);
281
#include "TomsMoCompAll2.inc"
283
#define USE_STRANGE_BOB
285
#include "TomsMoCompAll2.inc"