~ubuntu-branches/ubuntu/maverick/zapping/maverick

« back to all changes in this revision

Viewing changes to plugins/deinterlace/DI_TomsMoComp/TomsMoCompAll.inc

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-03-08 23:19:08 UTC
  • mfrom: (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050308231908-oip7rfv6lcmo8c0e
Tags: 0.9.2-2ubuntu1
Rebuilt for Python transition (2.3 -> 2.4)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
/////////////////////////////////////////////////////////////////////////////
 
6
//
 
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.
 
12
//
 
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
 
17
//
 
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
/////////////////////////////////////////////////////////////////////////////
 
24
// CVS Log
 
25
//
 
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
 
29
// and look buggy.
 
30
//
 
31
// Revision 1.1  2005/01/08 14:54:24  mschimek
 
32
// *** empty log message ***
 
33
//
 
34
// Revision 1.3  2002/12/10 16:32:21  adcockj
 
35
// Fix StrangeBob for MMX
 
36
//
 
37
// Revision 1.2  2002/11/26 21:32:14  adcockj
 
38
// Made new strange bob method optional
 
39
//
 
40
// Revision 1.1  2002/07/07 20:07:24  trbarry
 
41
// First cut at TomsMoComp, motion compensated deinterlace
 
42
//
 
43
//
 
44
/////////////////////////////////////////////////////////////////////////////
 
45
 
 
46
 
 
47
#include "windows.h"
 
48
#include "DS_Deinterlace.h"
 
49
#include "TomsMoComp.h"
 
50
 
 
51
int  Max_Frames;
 
52
int  PrevFrame;
 
53
int  PrevInFrame;
 
54
int  dropFrame;
 
55
BOOL IsOdd;
 
56
#define TopFirst IsOdd
 
57
unsigned char* dstp;
 
58
 
 
59
const BYTE* pWeaveSrc;
 
60
const BYTE* pWeaveSrcP;
 
61
BYTE* pWeaveDest;
 
62
const BYTE* pCopySrc;
 
63
const BYTE* pCopySrcP;
 
64
BYTE* pCopyDest;
 
65
MEMCPY_FUNC* pMyMemcpy;
 
66
 
 
67
int src_pitch;
 
68
int dst_pitch;
 
69
int rowsize;
 
70
int RowPixels;
 
71
int height;
 
72
int FldHeight;
 
73
int BadAlign;
 
74
 
 
75
BOOL FUNCT_NAME(TDeinterlaceInfo* pInfo)
 
76
{
 
77
        pMyMemcpy = pInfo->pMemcpy;
 
78
 
 
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;
 
85
       
 
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;
 
91
 
 
92
#ifdef IS_SSE2
 
93
// SSE2 support temporarily deleted
 
94
 
 
95
#endif
 
96
 
 
97
    if(IsOdd)
 
98
    {
 
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;
 
102
        }
 
103
    else
 
104
    {
 
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;
 
108
 
 
109
        }
 
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);
 
116
 
 
117
#ifdef USE_VERTICAL_FILTER
 
118
 
 
119
// Vertical Filter currently not implemented for DScaler !!
 
120
 
 
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);
 
127
#else
 
128
 
 
129
        // copy all of the copy field
 
130
        Fieldcopy(pCopyDest, pCopySrc, rowsize, 
 
131
                                FldHeight, dst_pitch*2, src_pitch);
 
132
#endif  
 
133
        // then go fill in the hard part, being variously lazy depending upon
 
134
        // SearchEffort
 
135
 
 
136
    /* mhs XXX Search_Effort_n_SB uses pavgb, looks buggy. */
 
137
    /* if(UseStrangeBob == FALSE) */
 
138
    if (1)
 
139
    {
 
140
                if (SearchEffort == 0)
 
141
                {
 
142
                        Search_Effort_0();
 
143
                }
 
144
 
 
145
                else if (SearchEffort <= 1)
 
146
                {
 
147
                        Search_Effort_1();
 
148
                }
 
149
 
 
150
        /*      else if (SearchEffort <= 2)
 
151
                {
 
152
                        Search_Effort_2();
 
153
                }
 
154
        */
 
155
                else if (SearchEffort <= 3)
 
156
                {
 
157
                        Search_Effort_3();
 
158
                }
 
159
 
 
160
                else if (SearchEffort <= 5)
 
161
                {
 
162
                        Search_Effort_5();
 
163
                }
 
164
 
 
165
                else if (SearchEffort <= 9)
 
166
                {
 
167
                        Search_Effort_9();
 
168
                }
 
169
 
 
170
                else if (SearchEffort <= 11)
 
171
                {
 
172
                        Search_Effort_11();
 
173
                }
 
174
 
 
175
                else if (SearchEffort <= 13)
 
176
                {
 
177
                        Search_Effort_13();
 
178
                }
 
179
 
 
180
                else if (SearchEffort <= 15)
 
181
                {
 
182
                        Search_Effort_15();
 
183
                }
 
184
                else if (SearchEffort <= 19)
 
185
                {
 
186
                        Search_Effort_19();
 
187
                }
 
188
                else if (SearchEffort <= 21)
 
189
                {
 
190
                        Search_Effort_21();
 
191
                }
 
192
 
 
193
                else 
 
194
                {
 
195
                        Search_Effort_Max();
 
196
                }
 
197
        }
 
198
        else
 
199
        {
 
200
                if (SearchEffort == 0)
 
201
                {
 
202
                        Search_Effort_0_SB();
 
203
                }
 
204
 
 
205
                else if (SearchEffort <= 1)
 
206
                {
 
207
                        Search_Effort_1_SB();
 
208
                }
 
209
 
 
210
        /*      else if (SearchEffort <= 2)
 
211
                {
 
212
                        Search_Effort_2_SB();
 
213
                }
 
214
        */
 
215
                else if (SearchEffort <= 3)
 
216
                {
 
217
                        Search_Effort_3_SB();
 
218
                }
 
219
 
 
220
                else if (SearchEffort <= 5)
 
221
                {
 
222
                        Search_Effort_5_SB();
 
223
                }
 
224
 
 
225
                else if (SearchEffort <= 9)
 
226
                {
 
227
                        Search_Effort_9_SB();
 
228
                }
 
229
 
 
230
                else if (SearchEffort <= 11)
 
231
                {
 
232
                        Search_Effort_11_SB();
 
233
                }
 
234
 
 
235
                else if (SearchEffort <= 13)
 
236
                {
 
237
                        Search_Effort_13_SB();
 
238
                }
 
239
 
 
240
                else if (SearchEffort <= 15)
 
241
                {
 
242
                        Search_Effort_15_SB();
 
243
                }
 
244
                else if (SearchEffort <= 19)
 
245
                {
 
246
                        Search_Effort_19_SB();
 
247
                }
 
248
                else if (SearchEffort <= 21)
 
249
                {
 
250
                        Search_Effort_21_SB();
 
251
                }
 
252
 
 
253
                else 
 
254
                {
 
255
                        Search_Effort_Max_SB();
 
256
                }
 
257
        }
 
258
        __asm emms;
 
259
 
 
260
    return TRUE;
 
261
}
 
262
 
 
263
int Fieldcopy(void *dest, const void *src, size_t count, 
 
264
                                int rows, int dst_pitch, int src_pitch)
 
265
{
 
266
BYTE* pDest = (BYTE*) dest;
 
267
BYTE* pSrc = (BYTE*) src;
 
268
int i;
 
269
        
 
270
        for (i=0; i < rows; i++)
 
271
        {
 
272
                MyMemCopy(pDest, pSrc, count);
 
273
                pSrc += src_pitch;
 
274
                pDest += dst_pitch;
 
275
        }
 
276
        return 0;
 
277
}
 
278
 
 
279
 
 
280
 
 
281
#include "TomsMoCompAll2.inc"
 
282
 
 
283
#define USE_STRANGE_BOB
 
284
 
 
285
#include "TomsMoCompAll2.inc"