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

Comparing CV/CV.xs (file contents):
Revision 1.4 by root, Sat Nov 8 18:22:21 2003 UTC vs.
Revision 1.35 by root, Tue Mar 7 16:45:53 2006 UTC

1#include "EXTERN.h" 1#include "EXTERN.h"
2#include "perl.h" 2#include "perl.h"
3#include "XSUB.h" 3#include "XSUB.h"
4 4
5#include <string.h>
6#include <setjmp.h>
7#include <math.h>
8
9#include <magic.h>
10
11#include <jpeglib.h>
12#include <glib.h>
13#include <gtk/gtk.h>
5#include <gdk-pixbuf/gdk-pixbuf.h> 14#include <gdk-pixbuf/gdk-pixbuf.h>
6 15
7#include <gperl.h> 16#include <gperl.h>
8#include <gtk2perl.h> 17#include <gtk2perl.h>
9 18
19#define IW 80 /* MUST match Schnauzer.pm! */
20#define IH 60 /* MUST match Schnauzer.pm! */
21
22#define RAND (seed = (seed + 7141) * 54773 % 134456)
23
24#define LINELENGTH 240
25
26#define ELLIPSIS "\xe2\x80\xa6"
27
28struct jpg_err_mgr
29{
30 struct jpeg_error_mgr err;
31 jmp_buf setjmp_buffer;
32};
33
34static void
35cv_error_exit (j_common_ptr cinfo)
36{
37 longjmp (((struct jpg_err_mgr *)cinfo->err)->setjmp_buffer, 99);
38}
39
40static void
41cv_error_output (j_common_ptr cinfo)
42{
43 return;
44}
45
46static void
47rgb_to_hsv (unsigned int r, unsigned int g, unsigned int b,
48 unsigned int *h, unsigned int *s, unsigned int *v)
49{
50 unsigned int mx = r; if (g > mx) mx = g; if (b > mx) mx = b;
51 unsigned int mn = r; if (g < mn) mn = g; if (b < mn) mn = b;
52 unsigned int delta = mx - mn;
53
54 *v = mx;
55
56 *s = mx ? delta * 255 / mx : 0;
57
58 if (delta == 0)
59 *h = 0;
60 else
61 {
62 if (r == mx)
63 *h = ((int)g - (int)b) * 255 / (int)(delta * 3);
64 else if (g == mx)
65 *h = ((int)b - (int)r) * 255 / (int)(delta * 3) + 52;
66 else if (b == mx)
67 *h = ((int)r - (int)g) * 255 / (int)(delta * 3) + 103;
68
69 *h &= 255;
70 }
71}
72
10static guint32 a85_val; 73static guint32 a85_val;
11static guint a85_cnt; 74static guint a85_cnt;
12static guchar a85_buf[80], *a85_ptr; 75static guchar a85_buf[LINELENGTH], *a85_ptr;
13 76
14static void 77static void
15a85_init (void) 78a85_init (void)
16{ 79{
17 a85_cnt = 4; 80 a85_cnt = 4;
47 } 110 }
48 } 111 }
49 112
50} 113}
51 114
115static void
52a85_finish (PerlIO *fp) 116a85_finish (PerlIO *fp)
53{ 117{
54 while (a85_cnt != 4) 118 while (a85_cnt != 4)
55 a85_push (fp, 0); 119 a85_push (fp, 0);
56 120
59 *a85_ptr++ = '\n'; 123 *a85_ptr++ = '\n';
60 124
61 PerlIO_write (fp, a85_buf, a85_ptr - a85_buf); 125 PerlIO_write (fp, a85_buf, a85_ptr - a85_buf);
62} 126}
63 127
128/////////////////////////////////////////////////////////////////////////////
129
64MODULE = Gtk2::CV PACKAGE = Gtk2::CV::ImageWindow 130MODULE = Gtk2::CV PACKAGE = Gtk2::CV
65 131
66PROTOTYPES: ENABLE 132PROTOTYPES: ENABLE
67 133
134# missing function in perl. really :)
135int
136common_prefix_length (a, b)
137 unsigned char *a = (unsigned char *)SvPVutf8_nolen ($arg);
138 unsigned char *b = (unsigned char *)SvPVutf8_nolen ($arg);
139 CODE:
140 RETVAL = 0;
141
142 while (*a == *b && *a)
143 {
144 RETVAL += (*a & 0xc0) != 0x80;
145 a++, b++;
146 }
147
148 OUTPUT:
149 RETVAL
150
151const char *
152magic (const char *path)
153 CODE:
154{
155 static magic_t cookie;
156
157 if (!cookie)
158 {
159 cookie = magic_open (MAGIC_NONE);
160
161 if (cookie)
162 magic_load (cookie, 0);
163 else
164 XSRETURN_UNDEF;
165 }
166
167 RETVAL = magic_file (cookie, path);
168}
169 OUTPUT:
170 RETVAL
171
172const char *
173magic_mime (const char *path)
174 CODE:
175{
176 static magic_t cookie;
177
178 if (!cookie)
179 {
180 cookie = magic_open (MAGIC_MIME);
181
182 if (cookie)
183 magic_load (cookie, 0);
184 else
185 XSRETURN_UNDEF;
186 }
187
188 RETVAL = magic_file (cookie, path);
189}
190 OUTPUT:
191 RETVAL
192
193# missing in Gtk2 perl module
194
195gboolean
196gdk_net_wm_supports (GdkAtom property)
197 CODE:
198#if defined(GDK_WINDOWING_X11) && !defined(GDK_MULTIHEAD_SAFE)
199 RETVAL = gdk_net_wm_supports (property);
200#else
201 RETVAL = 0;
202#endif
203 OUTPUT:
204 RETVAL
205
68GdkPixbuf_noinc * 206GdkPixbuf_noinc *
69transpose (GdkPixbuf *pb) 207dealpha_expose (GdkPixbuf *pb)
70 CODE: 208 CODE:
71{ 209{
72 int w = gdk_pixbuf_get_width (pb); 210 int w = gdk_pixbuf_get_width (pb);
73 int h = gdk_pixbuf_get_height (pb); 211 int h = gdk_pixbuf_get_height (pb);
74 int bpp = gdk_pixbuf_get_has_alpha (pb) ? 4 : 3; 212 int bpp = gdk_pixbuf_get_n_channels (pb);
75 int x, y, i; 213 int x, y, i;
76 guchar *src = gdk_pixbuf_get_pixels (pb), *dst; 214 guchar *src = gdk_pixbuf_get_pixels (pb), *dst;
77 int sstr = gdk_pixbuf_get_rowstride (pb), dstr; 215 int sstr = gdk_pixbuf_get_rowstride (pb), dstr;
78 216
79 RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, bpp == 4, 8, h, w); 217 RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 0, 8, w, h);
80 218
81 dst = gdk_pixbuf_get_pixels (RETVAL); 219 dst = gdk_pixbuf_get_pixels (RETVAL);
82 dstr = gdk_pixbuf_get_rowstride (RETVAL); 220 dstr = gdk_pixbuf_get_rowstride (RETVAL);
83 221
84 for (y = 0; y < h; y++)
85 for (x = 0; x < w; x++) 222 for (x = 0; x < w; x++)
223 for (y = 0; y < h; y++)
86 for (i = 0; i < bpp; i++) 224 for (i = 0; i < 3; i++)
87 dst[y * bpp + x * dstr + i] = src[x * bpp + y * sstr + i]; 225 dst[x * 3 + y * dstr + i] = src[x * bpp + y * sstr + i];
88} 226}
89 OUTPUT: 227 OUTPUT:
90 RETVAL 228 RETVAL
91 229
92GdkPixbuf_noinc * 230GdkPixbuf_noinc *
93flop (GdkPixbuf *pb) 231rotate (GdkPixbuf *pb, int angle)
94 CODE: 232 CODE:
95{ 233 RETVAL = gdk_pixbuf_rotate_simple (pb, angle == 0 ? GDK_PIXBUF_ROTATE_NONE
96 int w = gdk_pixbuf_get_width (pb); 234 : angle == 90 ? GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE
97 int h = gdk_pixbuf_get_height (pb); 235 : angle == 180 ? GDK_PIXBUF_ROTATE_UPSIDEDOWN
98 int bpp = gdk_pixbuf_get_has_alpha (pb) ? 4 : 3; 236 : angle == 270 ? GDK_PIXBUF_ROTATE_CLOCKWISE
99 int x, y, i; 237 : angle);
100 guchar *src = gdk_pixbuf_get_pixels (pb), *dst; 238 OUTPUT:
101 int sstr = gdk_pixbuf_get_rowstride (pb), dstr; 239 RETVAL
102 240
103 RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, bpp == 4, 8, w, h); 241GdkPixbuf_noinc *
242load_jpeg (SV *path, int thumbnail=0)
243 CODE:
244{
245 struct jpeg_decompress_struct cinfo;
246 struct jpg_err_mgr jerr;
247 guchar *data;
248 int rs;
249 FILE *fp;
250 volatile GdkPixbuf *pb = 0;
104 251
252 RETVAL = 0;
253
254 fp = fopen (SvPVbyte_nolen (path), "rb");
255
256 if (!fp)
257 XSRETURN_UNDEF;
258
259 cinfo.err = jpeg_std_error (&jerr.err);
260
261 jerr.err.error_exit = cv_error_exit;
262 jerr.err.output_message = cv_error_output;
263
264 if ((rs = setjmp (jerr.setjmp_buffer)))
265 {
266 fclose (fp);
267 jpeg_destroy_decompress (&cinfo);
268
269 if (pb)
270 g_object_unref ((gpointer)pb);
271
272 XSRETURN_UNDEF;
273 }
274
275 jpeg_create_decompress (&cinfo);
276
277 jpeg_stdio_src (&cinfo, fp);
278 jpeg_read_header (&cinfo, TRUE);
279
280 cinfo.dct_method = JDCT_DEFAULT;
281 cinfo.do_fancy_upsampling = FALSE; /* worse quality, but nobody compained so far, and gdk-pixbuf does the same */
282 cinfo.do_block_smoothing = FALSE;
283 cinfo.out_color_space = JCS_RGB;
284 cinfo.quantize_colors = FALSE;
285
286 cinfo.scale_num = 1;
287 cinfo.scale_denom = 1;
288
289 jpeg_calc_output_dimensions (&cinfo);
290
291 if (thumbnail)
292 {
293 cinfo.dct_method = JDCT_FASTEST;
294 cinfo.do_fancy_upsampling = FALSE;
295
296 while (cinfo.scale_denom < 8
297 && cinfo.output_width >= IW*4
298 && cinfo.output_height >= IH*4)
299 {
300 cinfo.scale_denom <<= 1;
301 jpeg_calc_output_dimensions (&cinfo);
302 }
303 }
304
305 pb = RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 0, 8, cinfo.output_width, cinfo.output_height);
306 if (!RETVAL)
307 longjmp (jerr.setjmp_buffer, 2);
308
105 dst = gdk_pixbuf_get_pixels (RETVAL); 309 data = gdk_pixbuf_get_pixels (RETVAL);
106 dstr = gdk_pixbuf_get_rowstride (RETVAL); 310 rs = gdk_pixbuf_get_rowstride (RETVAL);
107 311
312 if (cinfo.output_components != 3)
313 longjmp (jerr.setjmp_buffer, 3);
314
315 jpeg_start_decompress (&cinfo);
316
317 while (cinfo.output_scanline < cinfo.output_height)
318 {
319 int remaining = cinfo.output_height - cinfo.output_scanline;
320 JSAMPROW rp[4];
321
322 rp [0] = data + cinfo.output_scanline * rs;
323 rp [1] = (guchar *)rp [0] + rs;
324 rp [2] = (guchar *)rp [1] + rs;
325 rp [3] = (guchar *)rp [2] + rs;
326
327 jpeg_read_scanlines (&cinfo, rp, remaining < 4 ? remaining : 4);
328 }
329
330 jpeg_finish_decompress (&cinfo);
331 fclose (fp);
332 jpeg_destroy_decompress (&cinfo);
333}
334 OUTPUT:
335 RETVAL
336
337void
338compare (GdkPixbuf *a, GdkPixbuf *b)
339 PPCODE:
340{
341 int w = gdk_pixbuf_get_width (a);
342 int h = gdk_pixbuf_get_height (a);
343 int sa = gdk_pixbuf_get_rowstride (a);
344 int sb = gdk_pixbuf_get_rowstride (b);
345
346 guchar *pa = gdk_pixbuf_get_pixels (a);
347 guchar *pb = gdk_pixbuf_get_pixels (b);
348
349 int x, y;
350
351 assert (w == gdk_pixbuf_get_width (b));
352 assert (h == gdk_pixbuf_get_height (b));
353
354 assert (gdk_pixbuf_get_n_channels (a) == 3);
355 assert (gdk_pixbuf_get_n_channels (b) == 3);
356
357 double diff = 0.;
358 int peak = 0;
359
360 if (w && h)
108 for (y = 0; y < h; y++) 361 for (y = 0; y < h; y++)
362 {
363 guchar *pa_ = pa + y * sa;
364 guchar *pb_ = pb + y * sb;
365
109 for (x = 0; x < w; x++) 366 for (x = 0; x < w; x++)
110 for (i = 0; i < bpp; i++) 367 {
111 dst[(w - 1 - x) * bpp + y * dstr + i] = src[x * bpp + y * sstr + i]; 368 int d;
369
370 d = ((int)*pa_++) - ((int)*pb_++); diff += d*d; peak = MAX (peak, abs (d));
371 d = ((int)*pa_++) - ((int)*pb_++); diff += d*d; peak = MAX (peak, abs (d));
372 d = ((int)*pa_++) - ((int)*pb_++); diff += d*d; peak = MAX (peak, abs (d));
373 }
374 }
375
376 EXTEND (SP, 2);
377 PUSHs (sv_2mortal (newSVnv (sqrt (diff / (w * h * 3. * 255. * 255.)))));
378 PUSHs (sv_2mortal (newSVnv (peak / 255.)));
112} 379}
113 OUTPUT: 380
114 RETVAL 381#############################################################################
115 382
116MODULE = Gtk2::CV PACKAGE = Gtk2::CV::Schnauzer 383MODULE = Gtk2::CV PACKAGE = Gtk2::CV::Schnauzer
117 384
385SV *
386foldcase (SV *pathsv)
387 PROTOTYPE: $
388 CODE:
389{
390 STRLEN plen;
391 U8 *path = (U8 *)SvPVutf8 (pathsv, plen);
392 U8 *pend = path + plen;
393 U8 dst [plen * 6 * 3], *dstp = dst;
394
395 while (path < pend)
396 {
397 U8 ch = *path;
398
399 if (ch >= 'a' && ch <= 'z')
400 *dstp++ = *path++;
401 else if (ch >= '0' && ch <= '9')
402 {
403 STRLEN el, nl = 0;
404 while (*path >= '0' && *path <= '9' && path < pend)
405 path++, nl++;
406
407 for (el = nl; el < 6; el++)
408 *dstp++ = '0';
409
410 memcpy (dstp, path - nl, nl);
411 dstp += nl;
412 }
413 else
414 {
415 STRLEN cl;
416 to_utf8_fold (path, dstp, &cl);
417 dstp += cl;
418 path += is_utf8_char (path);
419 }
420 }
421
422 RETVAL = newSVpvn ((const char *)dst, dstp - dst);
423}
424 OUTPUT:
425 RETVAL
426
118GdkPixbuf_noinc * 427GdkPixbuf_noinc *
119p7_to_pb (int w, int h, guchar *src) 428p7_to_pb (int w, int h, SV *src_sv)
429 PROTOTYPE: @
120 CODE: 430 CODE:
121{ 431{
122 int x, y; 432 int x, y;
123 guchar *dst, *d; 433 guchar *dst, *d;
124 int dstr; 434 int dstr;
435 guchar *src = (guchar *)SvPVbyte_nolen (src_sv);
125 436
126 RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 0, 8, w, h); 437 RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 0, 8, w, h);
127 dst = gdk_pixbuf_get_pixels (RETVAL); 438 dst = gdk_pixbuf_get_pixels (RETVAL);
128 dstr = gdk_pixbuf_get_rowstride (RETVAL); 439 dstr = gdk_pixbuf_get_rowstride (RETVAL);
129 440
138 } 449 }
139} 450}
140 OUTPUT: 451 OUTPUT:
141 RETVAL 452 RETVAL
142 453
454#############################################################################
455
456MODULE = Gtk2::CV PACKAGE = Gtk2::CV::PostScript
457
458void
459dump_ascii85 (PerlIO *fp, GdkPixbuf *pb)
460 CODE:
461{
462 int w = gdk_pixbuf_get_width (pb);
463 int h = gdk_pixbuf_get_height (pb);
464 int x, y, i;
465 guchar *dst;
466 int bpp = gdk_pixbuf_get_n_channels (pb);
467 guchar *src = gdk_pixbuf_get_pixels (pb);
468 int sstr = gdk_pixbuf_get_rowstride (pb);
469
470 a85_init ();
471
472 for (y = 0; y < h; y++)
473 for (x = 0; x < w; x++)
474 for (i = 0; i < (bpp < 3 ? 1 : 3); i++)
475 a85_push (fp, src [x * bpp + y * sstr + i]);
476
477 a85_finish (fp);
478}
479
480void
481dump_binary (PerlIO *fp, GdkPixbuf *pb)
482 CODE:
483{
484 int w = gdk_pixbuf_get_width (pb);
485 int h = gdk_pixbuf_get_height (pb);
486 int x, y, i;
487 guchar *dst;
488 int bpp = gdk_pixbuf_get_n_channels (pb);
489 guchar *src = gdk_pixbuf_get_pixels (pb);
490 int sstr = gdk_pixbuf_get_rowstride (pb);
491
492 for (y = 0; y < h; y++)
493 for (x = 0; x < w; x++)
494 for (i = 0; i < (bpp < 3 ? 1 : 3); i++)
495 PerlIO_putc (fp, src [x * bpp + y * sstr + i]);
496}
497
498#############################################################################
499
500MODULE = Gtk2::CV PACKAGE = Gtk2::CV
501
143SV * 502SV *
144pb_to_p7 (GdkPixbuf *pb) 503pb_to_hv84 (GdkPixbuf *pb)
145 CODE: 504 CODE:
146{ 505{
147 int w = gdk_pixbuf_get_width (pb); 506 int w = gdk_pixbuf_get_width (pb);
148 int h = gdk_pixbuf_get_height (pb); 507 int h = gdk_pixbuf_get_height (pb);
149 int x, y; 508 int x, y;
150 guchar *dst; 509 guchar *dst;
151 int bpp = gdk_pixbuf_get_has_alpha (pb) ? 4 : 3; 510 int bpp = gdk_pixbuf_get_n_channels (pb);
152 guchar *src = gdk_pixbuf_get_pixels (pb); 511 guchar *src = gdk_pixbuf_get_pixels (pb);
153 int sstr = gdk_pixbuf_get_rowstride (pb); 512 int sstr = gdk_pixbuf_get_rowstride (pb);
154 513
155 RETVAL = newSV (w * h); 514 RETVAL = newSV (6 * 8 * 12 / 8);
156 SvPOK_only (RETVAL); 515 SvPOK_only (RETVAL);
157 SvCUR_set (RETVAL, w * h); 516 SvCUR_set (RETVAL, 6 * 8 * 12 / 8);
158 517
159 dst = SvPVX (RETVAL); 518 dst = (guchar *)SvPVX (RETVAL);
519
520 /* some primitive error distribution + random dithering */
160 521
161 for (y = 0; y < h; y++) 522 for (y = 0; y < h; y++)
162 { 523 {
163 /* use a very primitive form of error distribution. */ 524 guchar *p = src + y * sstr;
164 int er = 0, eg = 0, eb = 0;
165 525
166 for (x = 0; x < w; x++) 526 for (x = 0; x < w; x += 2)
167 { 527 {
168 int r, g, b; 528 unsigned int r, g, b, h, s, v, H, V1, V2;
169 guchar *p = src + x * bpp + y * sstr;
170 529
171 r = ((p[0] + er) * 7 + 128) / 255; 530 if (bpp == 3)
172 g = ((p[1] + eg) * 7 + 128) / 255; 531 r = *p++, g = *p++, b = *p++;
173 b = ((p[2] + eb) * 3 + 128) / 255; 532 else if (bpp == 1)
533 r = g = b = *p++;
534 else
535 abort ();
174 536
175 r = r > 7 ? 7 : r < 0 ? 0 : r; 537 rgb_to_hsv (r, g, b, &h, &s, &v);
176 g = g > 7 ? 7 : g < 0 ? 0 : g;
177 b = b > 3 ? 3 : b < 0 ? 0 : b;
178 538
179 er += p[0] - (r * 255 + 4) / 7; 539 H = (h * 15 / 255) << 4;
180 eg += p[1] - (g * 255 + 4) / 7; 540 V1 = v;
181 eb += p[2] - (b * 255 + 2) / 3;
182 541
183 *dst++ = r << 5 | g << 2 | b; 542 if (bpp == 3)
543 r = *p++, g = *p++, b = *p++;
544 else if (bpp == 1)
545 r = g = b = *p++;
546 else
547 abort ();
548
549 rgb_to_hsv (r, g, b, &h, &s, &v);
550
551 H |= h * 15 / 255;
552 V2 = v;
553
554 *dst++ = H;
555 *dst++ = V1;
556 *dst++ = V2;
184 } 557 }
185 } 558 }
186} 559}
187 OUTPUT: 560 OUTPUT:
188 RETVAL 561 RETVAL
189 562
563SV *
564hv84_to_av (unsigned char *hv84)
565 CODE:
566{
567 int i = 72 / 3;
568 AV *av = newAV ();
569
570 RETVAL = (SV *)newRV_noinc ((SV *)av);
571 while (i--)
572 {
573 int h = *hv84++;
574 int v1 = *hv84++;
575 int v2 = *hv84++;
576
577 av_push (av, newSViv (v1));
578 av_push (av, newSViv ((h >> 4) * 255 / 15));
579 av_push (av, newSViv (v2));
580 av_push (av, newSViv ((h & 15) * 255 / 15));
581 }
582}
583 OUTPUT:
584 RETVAL
585
586#############################################################################
587
190MODULE = Gtk2::CV PACKAGE = Gtk2::CV::PostScript 588MODULE = Gtk2::CV PACKAGE = Gtk2::CV::Plugin::RCluster
191 589
192void 590SV *
193dump_pb (PerlIO *fp, GdkPixbuf *pb) 591make_histograms (SV *ar)
194 CODE: 592 CODE:
195{ 593{
196 int w = gdk_pixbuf_get_width (pb); 594 int i;
197 int h = gdk_pixbuf_get_height (pb); 595 AV *av, *result;
198 int x, y, i;
199 guchar *dst;
200 int bpp = gdk_pixbuf_get_has_alpha (pb) ? 4 : 3;
201 guchar *src = gdk_pixbuf_get_pixels (pb);
202 int sstr = gdk_pixbuf_get_rowstride (pb);
203 596
204 a85_init (); 597 if (!SvROK (ar) || SvTYPE (SvRV (ar)) != SVt_PVAV)
598 croak ("Not an array ref as first argument to make_histogram");
205 599
206 for (y = 0; y < h; y++) 600 av = (AV *) SvRV (ar);
207 for (x = 0; x < w; x++) 601 result = newAV ();
602
603 for (i = 0; i <= av_len (av); ++i)
604 {
605 const int HISTSIZE = 64;
606
607 int j;
608 SV *sv = *av_fetch (av, i, 1);
609 STRLEN len;
610 char *buf = SvPVbyte (sv, len);
611
612 int tmphist[HISTSIZE];
613 float *hist;
614
615 SV *histsv = newSV (HISTSIZE * sizeof (float) + 1);
616 SvPOK_on (histsv);
617 SvCUR_set (histsv, HISTSIZE * sizeof (float));
618 hist = (float *)SvPVX (histsv);
619
620 Zero (tmphist, sizeof (tmphist), char);
621
622 for (j = len; j--; )
623 {
624 unsigned int idx
625 = ((*buf & 0xc0) >> 2)
626 | ((*buf & 0x18) >> 1)
627 | (*buf & 0x03);
628
629 ++tmphist[idx];
630 ++buf;
631 }
632
208 for (i = 0; i < 3; i++) 633 for (j = 0; j < HISTSIZE; ++j)
209 a85_push (fp, src [x * bpp + y * sstr + i]); 634 hist[j] = (float)tmphist[j] / (len + 1e-30);
210 635
211 a85_finish (fp); 636 av_push (result, histsv);
212} 637 }
213 638
639 RETVAL = newRV_noinc ((SV *)result);
640}
641 OUTPUT:
642 RETVAL
214 643
215 644
216

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines