ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CV/CV.xs
(Generate patch)

Comparing CV/CV.xs (file contents):
Revision 1.13 by root, Tue Feb 8 11:03:30 2005 UTC vs.
Revision 1.14 by root, Tue Feb 8 12:51:12 2005 UTC

266 SvCUR_set (histsv, 256); 266 SvCUR_set (histsv, 256);
267 hist = SvPVX (histsv); 267 hist = SvPVX (histsv);
268 268
269 Zero (tmphist, 256, int); 269 Zero (tmphist, 256, int);
270 270
271 j = len;
272
271 while (len--) 273 while (len--)
272 ++tmphist[(unsigned char)*buf++]; 274 ++tmphist[(unsigned char)*buf++ & 0xda];
275
276 len = j;
273 277
274 bigst = 1; 278 bigst = 1;
275 for (j = 0; j < 256; ++j) 279 for (j = 0; j < 256; ++j)
276 if (tmphist[j] > bigst) 280 if (tmphist[j] > bigst)
277 bigst = tmphist[j]; 281 bigst = tmphist[j];
278 282
279 for (j = 0; j < 256; ++j) 283 for (j = 0; j < 256; ++j)
280 hist[j] = tmphist[j] * 255 / bigst; 284 hist[j] = tmphist[j] * 255 / (len == 0 ? 1 : len);//bigst;
281 285
282 av_push (result, histsv); 286 av_push (result, histsv);
283 } 287 }
284 288
285 RETVAL = newRV_noinc ((SV *)result); 289 RETVAL = newRV_noinc ((SV *)result);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines