| 1 | /* |
| 2 | * motiondetect_internal.h |
| 3 | * |
| 4 | * Copyright (C) Georg Martius - February 2011 |
| 5 | * georg dot martius at web dot de |
| 6 | * Copyright (C) Alexey Osipov - Jule 2011 |
| 7 | * simba at lerlan dot ru |
| 8 | * speed optimizations (threshold, spiral, SSE, asm) |
| 9 | * |
| 10 | * This file is part of vid.stab video stabilization library |
| 11 | * |
| 12 | * vid.stab is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License, |
| 14 | * as published by the Free Software Foundation; either version 2, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * vid.stab is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with GNU Make; see the file COPYING. If not, write to |
| 24 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
| 25 | * |
| 26 | */ |
| 27 | |
| 28 | #ifndef MOTIONDETECT_INTERNAL_H |
| 29 | #define MOTIONDETECT_INTERNAL_H |
| 30 | |
| 31 | #include "motiondetect.h" |
| 32 | |
| 33 | /* type for a function that calculates the transformation of a certain field |
| 34 | */ |
| 35 | typedef LocalMotion (*calcFieldTransFunc)(VSMotionDetect*, VSMotionDetectFields*, |
| 36 | const Field*, int); |
| 37 | |
| 38 | /* type for a function that calculates the contrast of a certain field |
| 39 | */ |
| 40 | typedef double (*contrastSubImgFunc)(VSMotionDetect*, const Field*); |
| 41 | |
| 42 | |
| 43 | int initFields(VSMotionDetect* md, VSMotionDetectFields* fs, |
| 44 | int fieldSize, int maxShift, int stepSize, short border, |
| 45 | int spacing, double contrastThreshold ); |
| 46 | |
| 47 | double contrastSubImgPlanar(VSMotionDetect* md, const Field* field); |
| 48 | double contrastSubImgPacked(VSMotionDetect* md, const Field* field); |
| 49 | double contrastSubImg(unsigned char* const I, const Field* field, |
| 50 | int width, int height, int bytesPerPixel); |
| 51 | |
| 52 | |
| 53 | int cmp_contrast_idx(const void *ci1, const void* ci2); |
| 54 | VSVector selectfields(VSMotionDetect* md, VSMotionDetectFields* fields, |
| 55 | contrastSubImgFunc contrastfunc); |
| 56 | |
| 57 | LocalMotion calcFieldTransPlanar(VSMotionDetect* md, VSMotionDetectFields* fields, |
| 58 | const Field* field, int fieldnum); |
| 59 | LocalMotion calcFieldTransPacked(VSMotionDetect* md, VSMotionDetectFields* fields, |
| 60 | const Field* field, int fieldnum); |
| 61 | LocalMotions calcTransFields(VSMotionDetect* md, VSMotionDetectFields* fields, |
| 62 | calcFieldTransFunc fieldfunc, |
| 63 | contrastSubImgFunc contrastfunc); |
| 64 | |
| 65 | |
| 66 | void drawFieldScanArea(VSMotionDetect* md, const LocalMotion* motion, int maxShift); |
| 67 | void drawField(VSMotionDetect* md, const LocalMotion* motion, short box); |
| 68 | void drawFieldTrans(VSMotionDetect* md, const LocalMotion* motion, int color); |
| 69 | void drawBox(unsigned char* I, int width, int height, int bytesPerPixel, |
| 70 | int x, int y, int sizex, int sizey, unsigned char color); |
| 71 | void drawRectangle(unsigned char* I, int width, int height, int bytesPerPixel, |
| 72 | int x, int y, int sizex, int sizey, unsigned char color); |
| 73 | |
| 74 | void drawLine(unsigned char* I, int width, int height, int bytesPerPixel, |
| 75 | Vec* a, Vec* b, int thickness, unsigned char color); |
| 76 | |
| 77 | unsigned int compareSubImg_thr(unsigned char* const I1, unsigned char* const I2, |
| 78 | const Field* field, int width1, int width2, int height, |
| 79 | int bytesPerPixel, |
| 80 | int d_x, int d_y, unsigned int threshold); |
| 81 | |
| 82 | #endif /* MOTIONDETECT_INTERNAL_H */ |
| 83 | |
| 84 | /* |
| 85 | * Local variables: |
| 86 | * c-file-style: "stroustrup" |
| 87 | * c-file-offsets: ((case-label . *) (statement-case-intro . *)) |
| 88 | * indent-tabs-mode: nil |
| 89 | * c-basic-offset: 2 t |
| 90 | * End: |
| 91 | * |
| 92 | * vim: expandtab shiftwidth=2: |
| 93 | */ |