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

Comparing CV/CV.xs (file contents):
Revision 1.63 by root, Sun Nov 28 23:26:51 2021 UTC vs.
Revision 1.70 by root, Thu Jun 8 15:42:03 2023 UTC

303 303
304MODULE = Gtk2::CV PACKAGE = Gtk2::CV 304MODULE = Gtk2::CV PACKAGE = Gtk2::CV
305 305
306PROTOTYPES: ENABLE 306PROTOTYPES: ENABLE
307 307
308void
309_exit (int code)
310
308# calculate the common prefix length of two strings 311# calculate the common prefix length of two strings
309# missing function in perl. really :) 312# missing function in perl. really :)
310int 313int
311common_prefix_length (a, b) 314common_prefix_length (a, b)
312 unsigned char *a = (unsigned char *)SvPVutf8_nolen ($arg); 315 unsigned char *a = (unsigned char *)SvPVutf8_nolen ($arg);
318 { 321 {
319 RETVAL += (*a & 0xc0) != 0x80; 322 RETVAL += (*a & 0xc0) != 0x80;
320 a++, b++; 323 a++, b++;
321 } 324 }
322 325
326 OUTPUT:
327 RETVAL
328
329int
330common_prefix_length_byte (a, b)
331 unsigned char *a = (unsigned char *)SvPVbyte_nolen ($arg);
332 unsigned char *b = (unsigned char *)SvPVbyte_nolen ($arg);
333 CODE:
334 RETVAL = 0;
335 while (*a == *b && *a)
336 a++, b++, RETVAL++;
323 OUTPUT: 337 OUTPUT:
324 RETVAL 338 RETVAL
325 339
326const char * 340const char *
327magic (SV *path_or_data) 341magic (SV *path_or_data)
482 if (data_len >= ofs + 2 + 1 + 11) 496 if (data_len >= ofs + 2 + 1 + 11)
483 if (!memcmp (data + ofs, "\x21\xff\x0bNETSCAPE2.0", sizeof ("\x21\xff\x0bNETSCAPE2.0") - 1)) 497 if (!memcmp (data + ofs, "\x21\xff\x0bNETSCAPE2.0", sizeof ("\x21\xff\x0bNETSCAPE2.0") - 1))
484 RETVAL = "video/gif"; 498 RETVAL = "video/gif";
485 } 499 }
486 } 500 }
501 else if (data_len >= 0x8000 + 6
502 && data[0x8000+1] == (U8)'B'
503 && data[0x8000+2] == (U8)'E'
504 && data[0x8000+3] == (U8)'A'
505 && data[0x8000+4] == (U8)'0'
506 && data[0x8000+5] == (U8)'1')
507 RETVAL = "video/iso-bluray";
508 else if (data_len >= 0x8000 + 6
509 && data[0x8000+1] == (U8)'C'
510 && data[0x8000+2] == (U8)'D'
511 && data[0x8000+3] == (U8)'0'
512 && data[0x8000+4] == (U8)'0'
513 && data[0x8000+5] == (U8)'1')
514 RETVAL = "video/iso9660";
487 515
488 else 516 else
489 XSRETURN_UNDEF; 517 XSRETURN_UNDEF;
490} 518}
491 OUTPUT: 519 OUTPUT:
589 JxlBasicInfo info; 617 JxlBasicInfo info;
590 const uint8_t *next_in = (uint8_t *)SvPVbyte_nolen (image_data); 618 const uint8_t *next_in = (uint8_t *)SvPVbyte_nolen (image_data);
591 size_t avail_in = SvCUR (image_data); 619 size_t avail_in = SvCUR (image_data);
592 const char *error = 0; 620 const char *error = 0;
593 JxlDecoderStatus status; 621 JxlDecoderStatus status;
622 static void *runner_cache;
594 void *runner = 0; 623 void *runner = 0;
595 struct bmff_box box;
596 624
597 RETVAL = 0; 625 RETVAL = 0;
626
627 if (runner_cache)
628 runner = runner_cache;
629 else
630 runner = JxlThreadParallelRunnerCreate (0, JxlThreadParallelRunnerDefaultNumWorkerThreads ());
631
632 runner_cache = 0;
598 633
599 perlinterp_release (); 634 perlinterp_release ();
600 635
601 dec = JxlDecoderCreate (0); 636 dec = JxlDecoderCreate (0);
602 637
603 error = "JxlDecoderCreate failed"; 638 error = "JxlDecoderCreate failed";
604 if (!dec) 639 if (!dec)
605 goto done; 640 goto done;
606
607 runner = JxlThreadParallelRunnerCreate (0, JxlThreadParallelRunnerDefaultNumWorkerThreads ());
608 641
609 status = JxlDecoderSetParallelRunner (dec, JxlThreadParallelRunner, runner); 642 status = JxlDecoderSetParallelRunner (dec, JxlThreadParallelRunner, runner);
610 error = "JxlDecoderSetParallelRunner failed"; 643 error = "JxlDecoderSetParallelRunner failed";
611 if (status != JXL_DEC_SUCCESS) 644 if (status != JXL_DEC_SUCCESS)
612 goto done; 645 goto done;
688 721
689 done: 722 done:
690 if (dec) 723 if (dec)
691 JxlDecoderDestroy (dec); 724 JxlDecoderDestroy (dec);
692 725
726 perlinterp_acquire ();
727
693 if (runner) 728 if (runner_cache)
694 JxlThreadParallelRunnerDestroy (runner); 729 JxlThreadParallelRunnerDestroy (runner);
695 730
696 perlinterp_acquire (); 731 runner_cache = runner;
697 732
698 if (error) 733 if (error)
699 { 734 {
700 if (RETVAL) 735 if (RETVAL)
701 g_object_unref (RETVAL); 736 g_object_unref (RETVAL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines