1 | /***************************************************************************
|
---|
2 | *
|
---|
3 | * Copyright 2000 by David Demirdjian. All rights reserved.
|
---|
4 | *
|
---|
5 | * Developed by David Demirdjian
|
---|
6 | *
|
---|
7 | * Permission to use, copy, or modify this software and its documentation
|
---|
8 | * for educational and research purposes only and without fee is hereby
|
---|
9 | * granted, provided that this copyright notice and the original authors's
|
---|
10 | * names appear on all copies and supporting documentation. If individual
|
---|
11 | * files are separated from this distribution directory structure, this
|
---|
12 | * copyright notice must be included. For any other uses of this software,
|
---|
13 | * in original or modified form, including but not limited to distribution
|
---|
14 | * in whole or in part, specific prior permission must be obtained from
|
---|
15 | * MIT. These programs shall not be used, rewritten, or adapted as the
|
---|
16 | * basis of a commercial software or hardware product without first
|
---|
17 | * obtaining appropriate licenses from David Demirdjian. The author makes
|
---|
18 | * no representations about the suitability of this software for any purpose.
|
---|
19 | * It is provided "as is" without express or implied warranty.
|
---|
20 | *
|
---|
21 | **************************************************************************/
|
---|
22 | typedef unsigned char uchar;
|
---|
23 | typedef unsigned short ushort;
|
---|
24 | #include "processingMMX.h"
|
---|
25 | #include <math.h>
|
---|
26 |
|
---|
27 |
|
---|
28 | // Filter stereoBuffer for a given disparity ...
|
---|
29 | //input:
|
---|
30 | //- [ptBuff-backStep, ptBuff] contains pixels filtered with sum_row
|
---|
31 | // [ptBuff, ptBuff+subImageSize] contains raw pixels
|
---|
32 | //- [ptBuff16, ptBuff16+2*backStep] contains pixels filtered with sum_row*avg_col
|
---|
33 | //output:
|
---|
34 | //- [ptBuff-backStep, ptBuff+subImageSize-backStep] contains filtered pixels
|
---|
35 | //- [ptBuff16, ptBuff16+2*backStep] contains pixels filtered with sum_row*avg_col
|
---|
36 | void StereoBuffer::filterSAD(int maskX, int maskY, uchar* ptBuff, ushort* ptBuff16,
|
---|
37 | int backStep, int subImageSize, int offset)
|
---|
38 | {
|
---|
39 | // ptBuff16 data from [0] to [backStep] come from previous iter
|
---|
40 | // sum_Row_mmx fills ptBuff16 from [2*backStep] to [2*backStep+subImageSize]
|
---|
41 | sum_Row_mmx(ptBuff , ptBuff16+2*backStep, subImageSize, maskX);
|
---|
42 | // avg_Col process data in ptBuff16 from [0] to [subImageSize]
|
---|
43 | avg_Col_mmx(ptBuff16+backStep , ptBuff-backStep,subImageSize, width, maskY);
|
---|
44 | // then copy ptBuff16 data [subImageSize] to [2*backStep+subImageSize]
|
---|
45 | // to [0] to [2*backStep] for next turn
|
---|
46 | copyMMX(ptBuff16, ptBuff16+subImageSize, 2*backStep*sizeof(short));
|
---|
47 | // init. SAD score
|
---|
48 | //initMinimumCorrelation(ptBuff-backStep, 0, imDepth+offset-backStep,
|
---|
49 | // corrScore+offset-backStep,
|
---|
50 | // corrScoreSec+offset-backStep, subImageSize);
|
---|
51 | } |
---|