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

Comparing CV/CV.xs (file contents):
Revision 1.18 by root, Wed Jul 20 09:06:37 2005 UTC vs.
Revision 1.21 by root, Sat Jul 23 03:25:51 2005 UTC

225 { 225 {
226 cinfo.dct_method = JDCT_FASTEST; 226 cinfo.dct_method = JDCT_FASTEST;
227 cinfo.do_fancy_upsampling = FALSE; 227 cinfo.do_fancy_upsampling = FALSE;
228 228
229 while (cinfo.scale_denom < 8 229 while (cinfo.scale_denom < 8
230 && (cinfo.output_width >> 1) >= IW 230 && cinfo.output_width >= IW*4
231 && (cinfo.output_height >> 1) >= IH) 231 && cinfo.output_height >= IH*4)
232 { 232 {
233 cinfo.scale_denom <<= 1; 233 cinfo.scale_denom <<= 1;
234 jpeg_calc_output_dimensions (&cinfo); 234 jpeg_calc_output_dimensions (&cinfo);
235 } 235 }
236 } 236 }
281 U8 *pend = path + plen; 281 U8 *pend = path + plen;
282 U8 dst [plen * 6 * 3], *dstp = dst; 282 U8 dst [plen * 6 * 3], *dstp = dst;
283 283
284 while (path < pend) 284 while (path < pend)
285 { 285 {
286 U8 ch = *path;
287
286 if (*path >= '0' && *path <= '9') 288 if (ch >= 'a' && ch <= 'z')
289 *dstp++ = *path++;
290 else if (ch >= '0' && ch <= '9')
287 { 291 {
288 STRLEN el, nl = 0; 292 STRLEN el, nl = 0;
289 while (*path >= '0' && *path <= '9') 293 while (*path >= '0' && *path <= '9' && path < pend)
290 path++, nl++; 294 path++, nl++;
291 295
292 for (el = nl; el < 6; el++) 296 for (el = nl; el < 6; el++)
293 *dstp++ = '0'; 297 *dstp++ = '0';
294 298
309 OUTPUT: 313 OUTPUT:
310 RETVAL 314 RETVAL
311 315
312GdkPixbuf_noinc * 316GdkPixbuf_noinc *
313p7_to_pb (int w, int h, guchar *src) 317p7_to_pb (int w, int h, guchar *src)
318 PROTOTYPE: @
314 CODE: 319 CODE:
315{ 320{
316 int x, y; 321 int x, y;
317 guchar *dst, *d; 322 guchar *dst, *d;
318 int dstr; 323 int dstr;
390 } 395 }
391} 396}
392 OUTPUT: 397 OUTPUT:
393 RETVAL 398 RETVAL
394 399
395SV *
396make_histogram (SV *ar)
397 CODE:
398{
399 int i;
400 AV *av, *result;
401
402 if (!SvROK (ar) || SvTYPE (SvRV (ar)) != SVt_PVAV)
403 croak ("Not an array ref as first argument to make_histogram");
404
405 av = (AV *) SvRV (ar);
406 result = newAV ();
407
408 for (i = 0; i <= av_len (av); ++i)
409 {
410 const int HISTSIZE = 64;
411
412 int j;
413 SV *sv = *av_fetch (av, i, 1);
414 STRLEN len;
415 char *buf = SvPVbyte (sv, len);
416
417 int tmphist[HISTSIZE];
418 float *hist;
419
420 SV *histsv = newSV (HISTSIZE * sizeof (float) + 1);
421 SvPOK_on (histsv);
422 SvCUR_set (histsv, HISTSIZE * sizeof (float));
423 hist = (float *)SvPVX (histsv);
424
425 Zero (tmphist, sizeof (tmphist), char);
426
427 for (j = len; j--; )
428 {
429 unsigned int idx
430 = ((*buf & 0xc0) >> 2)
431 | ((*buf & 0x18) >> 1)
432 | (*buf & 0x03);
433
434 ++tmphist[idx];
435 ++buf;
436 }
437
438 for (j = 0; j < HISTSIZE; ++j)
439 hist[j] = (float)tmphist[j] / (len + 1e-30);
440
441 av_push (result, histsv);
442 }
443
444 RETVAL = newRV_noinc ((SV *)result);
445}
446 OUTPUT:
447 RETVAL
448
449############################################################################# 400#############################################################################
450 401
451MODULE = Gtk2::CV PACKAGE = Gtk2::CV::PostScript 402MODULE = Gtk2::CV PACKAGE = Gtk2::CV::PostScript
452 403
453void 404void
576 } 527 }
577} 528}
578 OUTPUT: 529 OUTPUT:
579 RETVAL 530 RETVAL
580 531
532#############################################################################
581 533
534MODULE = Gtk2::CV PACKAGE = Gtk2::CV::Plugin::RCluster
582 535
536SV *
537make_histograms (SV *ar)
538 CODE:
539{
540 int i;
541 AV *av, *result;
542
543 if (!SvROK (ar) || SvTYPE (SvRV (ar)) != SVt_PVAV)
544 croak ("Not an array ref as first argument to make_histogram");
545
546 av = (AV *) SvRV (ar);
547 result = newAV ();
548
549 for (i = 0; i <= av_len (av); ++i)
550 {
551 const int HISTSIZE = 64;
552
553 int j;
554 SV *sv = *av_fetch (av, i, 1);
555 STRLEN len;
556 char *buf = SvPVbyte (sv, len);
557
558 int tmphist[HISTSIZE];
559 float *hist;
560
561 SV *histsv = newSV (HISTSIZE * sizeof (float) + 1);
562 SvPOK_on (histsv);
563 SvCUR_set (histsv, HISTSIZE * sizeof (float));
564 hist = (float *)SvPVX (histsv);
565
566 Zero (tmphist, sizeof (tmphist), char);
567
568 for (j = len; j--; )
569 {
570 unsigned int idx
571 = ((*buf & 0xc0) >> 2)
572 | ((*buf & 0x18) >> 1)
573 | (*buf & 0x03);
574
575 ++tmphist[idx];
576 ++buf;
577 }
578
579 for (j = 0; j < HISTSIZE; ++j)
580 hist[j] = (float)tmphist[j] / (len + 1e-30);
581
582 av_push (result, histsv);
583 }
584
585 RETVAL = newRV_noinc ((SV *)result);
586}
587 OUTPUT:
588 RETVAL
589
590

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines