1 /***************************************************************************
2 ADM_vidFastConvolution.cpp - description
3 -------------------
4 begin : Sat Nov 23 2002
5 copyright : (C) 2002 by mean
6 email : fixounet@free.fr
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18 #include "ADM_vidConvolution.hxx"
19 #include "convolution_desc.cpp"
20
21
22 DECLARE_VIDEO_FILTER_PARTIALIZABLE( AVDMFastVideoMean, // Class
23 1,0,0, // Version
24 ADM_UI_ALL, // UI
25 VF_NOISE, // Category
26 "Mean", // internal name (must be uniq!)
27 QT_TRANSLATE_NOOP("mean","Mean convolution."), // Display name
28 QT_TRANSLATE_NOOP("mean","3x3 convolution filter :mean.") // Description
29 );
30
31 /**
32 \fn getConfiguration
33 */
34
getConfiguration(void)35 const char *AVDMFastVideoMean::getConfiguration(void)
36 {
37 static char str[]="Mean(fast)";
38 return (char *)str;
39
40 }
41 /**
42 \fn doLine
43 */
44
doLine(uint8_t * pred,uint8_t * cur,uint8_t * next,uint8_t * out,uint32_t w)45 uint8_t AVDMFastVideoMean::doLine(uint8_t *pred,
46 uint8_t *cur,
47 uint8_t *next,
48 uint8_t *out,
49 uint32_t w)
50 {
51 uint8_t a1,a2,a3;
52 uint8_t b1,b2,b3;
53 uint8_t c1,c2,c3;
54 int32_t o;
55
56 a2=*pred++;a3=*pred++;
57 b2=*cur++;b3=*cur++;
58 c2=*next++;c3=*next++;
59
60 *out++=b2;
61 w--;
62
63 while(w>1)
64 {
65 a1=a2;
66 a2=a3;
67 a3=*pred++;
68 b1=b2;
69 b2=b3;
70 b3=*cur++;
71 c1=c2;
72 c2=c3;
73 c3=*next++;
74
75 //
76 o=a1+a2+a3+b1+b2+b3+c1+c2+c3;
77 o/=9;
78
79 *out++=o;
80 w--;
81 }
82 *out++=b3;
83 return 1;
84 }
85