annotate plugins/crazychat/filter.c @ 13691:87b027bb1f15

[gaim-migrate @ 16094] SF Patch #1462332 from cbanal "When updating an avatar and the accounts vcard / info is empty. The resulting vCard xml that is sent does not contain the proper attributes. This causes the vCard update to be ignored by the jabber server." I'm not 100% positive about this, but it seems right. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 25 Apr 2006 17:19:45 +0000
parents ed017b9c532d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11218
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
1 #include "cc_interface.h"
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
2 #include "filter.h"
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
3 #include "stdio.h"
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
4
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
5 #define coef_0 .0022
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
6 #define coef_1 .0174
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
7 #define coef_2 .0737
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
8 #define coef_3 .1662
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
9 #define coef_4 .2405
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
10
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
11 filter_bank* Filter_Initialize (void)
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
12 {
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
13 filter_bank* new_filter;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
14 new_filter=(filter_bank*)malloc(sizeof(filter_bank));
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
15 memset(new_filter,0,sizeof(filter_bank));
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
16 // fprintf(stderr,"RESETTING FILTER BANK *******************\n");
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
17 return new_filter;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
18 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
19
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
20 void Filter_Destroy (filter_bank *f)
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
21 {
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
22 free(f);
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
23 }
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
24
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
25 void filter(struct cc_features *features, filter_bank *f)
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
26 {
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
27
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
28 f->head_size[9]=f->head_size[8];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
29 f->head_size[8]=f->head_size[7];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
30 f->head_size[7]=f->head_size[6];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
31 f->head_size[6]=f->head_size[5];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
32 f->head_size[5]=f->head_size[4];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
33 f->head_size[4]=f->head_size[3];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
34 f->head_size[3]=f->head_size[2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
35 f->head_size[2]=f->head_size[1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
36 f->head_size[1]=f->head_size[0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
37 f->head_size[0]=features->head_size;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
38
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
39 features->head_size=(guint8) ( (coef_0*(f->head_size[0]+f->head_size[9]))+(coef_1*(f->head_size[1]+f->head_size[8])) +
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
40 (coef_2*(f->head_size[2]+f->head_size[7])) + (coef_3*(f->head_size[3]+f->head_size[6]))
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
41 + (coef_4*(f->head_size[4]+f->head_size[5])));
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
42
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
43
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
44
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
45 f->head_z_rot[9]=f->head_z_rot[8];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
46 f->head_z_rot[8]=f->head_z_rot[7];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
47 f->head_z_rot[7]=f->head_z_rot[6];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
48 f->head_z_rot[6]=f->head_z_rot[5];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
49 f->head_z_rot[5]=f->head_z_rot[4];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
50 f->head_z_rot[4]=f->head_z_rot[3];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
51 f->head_z_rot[3]=f->head_z_rot[2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
52 f->head_z_rot[2]=f->head_z_rot[1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
53 f->head_z_rot[1]=f->head_z_rot[0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
54 f->head_z_rot[0]=features->head_z_rot;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
55
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
56 features->head_z_rot=(guint8) ( (coef_0*(f->head_z_rot[0]+f->head_z_rot[9]))+(coef_1*(f->head_z_rot[1]+f->head_z_rot[8])) +
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
57 (coef_2*(f->head_z_rot[2]+f->head_z_rot[7])) + (coef_3*(f->head_z_rot[3]+f->head_z_rot[6]))
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
58 + (coef_4*(f->head_z_rot[4]+f->head_z_rot[5])));
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
59
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
60
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
61 f->head_y_rot[9]=f->head_y_rot[8];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
62 f->head_y_rot[8]=f->head_y_rot[7];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
63 f->head_y_rot[7]=f->head_y_rot[6];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
64 f->head_y_rot[6]=f->head_y_rot[5];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
65 f->head_y_rot[5]=f->head_y_rot[4];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
66 f->head_y_rot[4]=f->head_y_rot[3];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
67 f->head_y_rot[3]=f->head_y_rot[2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
68 f->head_y_rot[2]=f->head_y_rot[1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
69 f->head_y_rot[1]=f->head_y_rot[0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
70 f->head_y_rot[0]=features->head_y_rot;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
71
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
72 features->head_y_rot=(guint8) ( (coef_0*(f->head_y_rot[0]+f->head_y_rot[9]))+(coef_1*(f->head_y_rot[1]+f->head_y_rot[8])) +
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
73 (coef_2*(f->head_y_rot[2]+f->head_y_rot[7])) + (coef_3*(f->head_y_rot[3]+f->head_y_rot[6]))
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
74 + (coef_4*(f->head_y_rot[4]+f->head_y_rot[5])));
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
75
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
76
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
77 f->xfilt[9]=f->xfilt[8];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
78 f->xfilt[8]=f->xfilt[7];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
79 f->xfilt[7]=f->xfilt[6];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
80 f->xfilt[6]=f->xfilt[5];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
81 f->xfilt[5]=f->xfilt[4];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
82 f->xfilt[4]=f->xfilt[3];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
83 f->xfilt[3]=f->xfilt[2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
84 f->xfilt[2]=f->xfilt[1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
85 f->xfilt[1]=f->xfilt[0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
86 f->xfilt[0]=features->x;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
87
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
88 features->x=(guint8) ( (coef_0*(f->xfilt[0]+f->xfilt[9]))+(coef_1*(f->xfilt[1]+f->xfilt[8])) +
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
89 (coef_2*(f->xfilt[2]+f->xfilt[7])) + (coef_3*(f->xfilt[3]+f->xfilt[6]))
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
90 + (coef_4*(f->xfilt[4]+f->xfilt[5])));
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
91
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
92
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
93 f->yfilt[9]=f->yfilt[8];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
94 f->yfilt[8]=f->yfilt[7];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
95 f->yfilt[7]=f->yfilt[6];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
96 f->yfilt[6]=f->yfilt[5];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
97 f->yfilt[5]=f->yfilt[4];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
98 f->yfilt[4]=f->yfilt[3];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
99 f->yfilt[3]=f->yfilt[2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
100 f->yfilt[2]=f->yfilt[1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
101 f->yfilt[1]=f->yfilt[0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
102 f->yfilt[0]=features->y;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
103
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
104 features->y=(guint8) ( (coef_0*(f->yfilt[0]+f->yfilt[9]))+(coef_1*(f->yfilt[1]+f->yfilt[8])) +
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
105 (coef_2*(f->yfilt[2]+f->yfilt[7])) + (coef_3*(f->yfilt[3]+f->yfilt[6]))
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
106 + (coef_4*(f->yfilt[4]+f->yfilt[5])));
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
107
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
108
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
109 f->mouth_open[9]=f->mouth_open[8];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
110 f->mouth_open[8]=f->mouth_open[7];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
111 f->mouth_open[7]=f->mouth_open[6];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
112 f->mouth_open[6]=f->mouth_open[5];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
113 f->mouth_open[5]=f->mouth_open[4];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
114 f->mouth_open[4]=f->mouth_open[3];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
115 f->mouth_open[3]=f->mouth_open[2];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
116 f->mouth_open[2]=f->mouth_open[1];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
117 f->mouth_open[1]=f->mouth_open[0];
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
118 f->mouth_open[0]=features->mouth_open;
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
119
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
120 features->mouth_open=(guint8) ( (coef_0*(f->mouth_open[0]+f->mouth_open[9]))+(coef_1*(f->mouth_open[1]+f->mouth_open[8])) +
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
121 (coef_2*(f->mouth_open[2]+f->mouth_open[7])) + (coef_3*(f->mouth_open[3]+f->mouth_open[6]))
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
122 + (coef_4*(f->mouth_open[4]+f->mouth_open[5])));
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
123
ed017b9c532d [gaim-migrate @ 13350]
Charlie Stockman <chuckleberry>
parents:
diff changeset
124 }