1 /*****************************************************************************
2 * Copyright (C) 2013 x265 project
4 * Authors: Steve Borho <steve@borho.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
20 * This program is also available under a commercial proprietary license.
21 * For more information, contact us at license @ x265.com.
22 *****************************************************************************/
24 #ifndef X265_MOTIONESTIMATE_H
25 #define X265_MOTIONESTIMATE_H
27 #include "primitives.h"
28 #include "reference.h"
33 // private x265 namespace
35 class MotionEstimate
: public BitCost
39 /* Aligned copy of original pixels, extra room for manual alignment */
41 intptr_t fencLumaStride
;
54 /* subpel generation buffers */
58 MotionEstimate
& operator =(const MotionEstimate
&);
62 static const int COST_MAX
= 1 << 28;
70 void setSearchMethod(int i
) { searchMethod
= i
; }
72 void setSubpelRefine(int i
) { subpelRefine
= i
; }
74 /* Methods called at slice setup */
76 void setSourcePlane(pixel
*Y
, intptr_t luma
)
79 fencLumaStride
= luma
;
82 void setSourcePU(intptr_t offset
, int pwidth
, int pheight
);
84 /* buf*() and motionEstimate() methods all use cached fenc pixels and thus
85 * require setSourcePU() to be called prior. */
87 inline int bufSAD(pixel
*fref
, intptr_t stride
) { return sad(fenc
, FENC_STRIDE
, fref
, stride
); }
89 inline int bufSA8D(pixel
*fref
, intptr_t stride
) { return sa8d(fenc
, FENC_STRIDE
, fref
, stride
); }
91 inline int bufSATD(pixel
*fref
, intptr_t stride
) { return satd(fenc
, FENC_STRIDE
, fref
, stride
); }
93 int motionEstimate(ReferencePlanes
*ref
, const MV
& mvmin
, const MV
& mvmax
, const MV
& qmvp
, int numCandidates
, const MV
* mvc
, int merange
, MV
& outQMv
);
95 int subpelCompare(ReferencePlanes
* ref
, const MV
&qmv
, pixelcmp_t
);
99 inline void StarPatternSearch(ReferencePlanes
*ref
,
111 #endif // ifndef X265_MOTIONESTIMATE_H