Changeset 859
- Timestamp:
- Jun 3, 2004, 5:15:47 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 2 edited
-
image/psImage.c (modified) (7 diffs)
-
mathtypes/psImage.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImage.c
r824 r859 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-06-0 1 22:42:57 $11 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-06-04 03:15:47 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 238 238 } 239 239 } 240 psFree(children); 241 242 image->nChildren = 0; 243 image->children = NULL; 244 240 245 241 246 return numFreed; … … 292 297 out = OUT->data.OUTTYPE[row]; \ 293 298 for (int col=0;col<numCols;col++) { \ 294 in[col] = (ps##INTYPE) out[col]; \299 out[col] = (ps##OUTTYPE) in[col]; \ 295 300 } \ 296 301 } \ … … 340 345 } 341 346 342 switch (type) { 347 // XXX - GCC had problems with the length? of the above macro. The original 348 // macro code here is commented out and the preprocessor output is pasted below it 349 // (effectively to the end of the function) 350 // We need to find out what is doing on here and move back to the macro version. 351 #if 0 352 switch (type) 353 { 343 354 case PS_TYPE_S8: 344 355 PSIMAGE_ELEMENT_ASSIGN(output,input,S8); … … 355 366 case PS_TYPE_U8: 356 367 PSIMAGE_ELEMENT_ASSIGN(output,input,U8); 357 break;358 368 case PS_TYPE_U16: 359 369 PSIMAGE_ELEMENT_ASSIGN(output,input,U16); … … 381 391 psImageFree(output); 382 392 return NULL; 393 } 394 #endif 395 396 #if 1 397 switch (type) { 398 case PS_TYPE_S8: 399 switch (input->type.type) { 400 case PS_TYPE_S8: { 401 psS8 *in; 402 psS8 *out; 403 for (int row = 0; row < numRows; row++) { 404 in = input->data.S8[row]; 405 out = output->data.S8[row]; 406 for (int col = 0; col < numCols; col++) { 407 out[col] = (psS8) in[col]; 408 } 409 } 410 }; 411 break; 412 case PS_TYPE_S16: { 413 psS16 *in; 414 psS8 *out; 415 for (int row = 0; row < numRows; row++) { 416 in = input->data.S16[row]; 417 out = output->data.S8[row]; 418 for (int col = 0; col < numCols; col++) { 419 out[col] = (psS8) in[col]; 420 } 421 } 422 }; 423 break; 424 case PS_TYPE_S32: { 425 psS32 *in; 426 psS8 *out; 427 for (int row = 0; row < numRows; row++) { 428 in = input->data.S32[row]; 429 out = output->data.S8[row]; 430 for (int col = 0; col < numCols; col++) { 431 out[col] = (psS8) in[col]; 432 } 433 } 434 }; 435 break; 436 case PS_TYPE_S64: { 437 psS64 *in; 438 psS8 *out; 439 for (int row = 0; row < numRows; row++) { 440 in = input->data.S64[row]; 441 out = output->data.S8[row]; 442 for (int col = 0; col < numCols; col++) { 443 out[col] = (psS8) in[col]; 444 } 445 } 446 }; 447 break; 448 case PS_TYPE_U8: { 449 psU8 *in; 450 psS8 *out; 451 for (int row = 0; row < numRows; row++) { 452 in = input->data.U8[row]; 453 out = output->data.S8[row]; 454 for (int col = 0; col < numCols; col++) { 455 out[col] = (psS8) in[col]; 456 } 457 } 458 }; 459 break; 460 case PS_TYPE_U16: { 461 psU16 *in; 462 psS8 *out; 463 for (int row = 0; row < numRows; row++) { 464 in = input->data.U16[row]; 465 out = output->data.S8[row]; 466 for (int col = 0; col < numCols; col++) { 467 out[col] = (psS8) in[col]; 468 } 469 } 470 }; 471 break; 472 case PS_TYPE_U32: { 473 psU32 *in; 474 psS8 *out; 475 for (int row = 0; row < numRows; row++) { 476 in = input->data.U32[row]; 477 out = output->data.S8[row]; 478 for (int col = 0; col < numCols; col++) { 479 out[col] = (psS8) in[col]; 480 } 481 } 482 }; 483 break; 484 case PS_TYPE_U64: { 485 psU64 *in; 486 psS8 *out; 487 for (int row = 0; row < numRows; row++) { 488 in = input->data.U64[row]; 489 out = output->data.S8[row]; 490 for (int col = 0; col < numCols; col++) { 491 out[col] = (psS8) in[col]; 492 } 493 } 494 }; 495 break; 496 case PS_TYPE_F32: { 497 psF32 *in; 498 psS8 *out; 499 for (int row = 0; row < numRows; row++) { 500 in = input->data.F32[row]; 501 out = output->data.S8[row]; 502 for (int col = 0; col < numCols; col++) { 503 out[col] = (psS8) in[col]; 504 } 505 } 506 }; 507 break; 508 case PS_TYPE_F64: { 509 psF64 *in; 510 psS8 *out; 511 for (int row = 0; row < numRows; row++) { 512 in = input->data.F64[row]; 513 out = output->data.S8[row]; 514 for (int col = 0; col < numCols; col++) { 515 out[col] = (psS8) in[col]; 516 } 517 } 518 }; 519 break; 520 case PS_TYPE_C32: { 521 psC32 *in; 522 psS8 *out; 523 for (int row = 0; row < numRows; row++) { 524 in = input->data.C32[row]; 525 out = output->data.S8[row]; 526 for (int col = 0; col < numCols; col++) { 527 out[col] = (psS8) in[col]; 528 } 529 } 530 }; 531 break; 532 case PS_TYPE_PTR: 533 psError (__func__, "Can't copy image from a matrix of pointers."); 534 psImageFree (output); 535 return ((void *) 0); 536 default: 537 break; 538 }; 539 break; 540 case PS_TYPE_S16: 541 switch (input->type.type) { 542 case PS_TYPE_S8: { 543 psS8 *in; 544 psS16 *out; 545 for (int row = 0; row < numRows; row++) { 546 in = input->data.S8[row]; 547 out = output->data.S16[row]; 548 for (int col = 0; col < numCols; col++) { 549 out[col] = (psS16) in[col]; 550 } 551 } 552 }; 553 break; 554 case PS_TYPE_S16: { 555 psS16 *in; 556 psS16 *out; 557 for (int row = 0; row < numRows; row++) { 558 in = input->data.S16[row]; 559 out = output->data.S16[row]; 560 for (int col = 0; col < numCols; col++) { 561 out[col] = (psS16) in[col]; 562 } 563 } 564 }; 565 break; 566 case PS_TYPE_S32: { 567 psS32 *in; 568 psS16 *out; 569 for (int row = 0; row < numRows; row++) { 570 in = input->data.S32[row]; 571 out = output->data.S16[row]; 572 for (int col = 0; col < numCols; col++) { 573 out[col] = (psS16) in[col]; 574 } 575 } 576 }; 577 break; 578 case PS_TYPE_S64: { 579 psS64 *in; 580 psS16 *out; 581 for (int row = 0; row < numRows; row++) { 582 in = input->data.S64[row]; 583 out = output->data.S16[row]; 584 for (int col = 0; col < numCols; col++) { 585 out[col] = (psS16) in[col]; 586 } 587 } 588 }; 589 break; 590 case PS_TYPE_U8: { 591 psU8 *in; 592 psS16 *out; 593 for (int row = 0; row < numRows; row++) { 594 in = input->data.U8[row]; 595 out = output->data.S16[row]; 596 for (int col = 0; col < numCols; col++) { 597 out[col] = (psS16) in[col]; 598 } 599 } 600 }; 601 break; 602 case PS_TYPE_U16: { 603 psU16 *in; 604 psS16 *out; 605 for (int row = 0; row < numRows; row++) { 606 in = input->data.U16[row]; 607 out = output->data.S16[row]; 608 for (int col = 0; col < numCols; col++) { 609 out[col] = (psS16) in[col]; 610 } 611 } 612 }; 613 break; 614 case PS_TYPE_U32: { 615 psU32 *in; 616 psS16 *out; 617 for (int row = 0; row < numRows; row++) { 618 in = input->data.U32[row]; 619 out = output->data.S16[row]; 620 for (int col = 0; col < numCols; col++) { 621 out[col] = (psS16) in[col]; 622 } 623 } 624 }; 625 break; 626 case PS_TYPE_U64: { 627 psU64 *in; 628 psS16 *out; 629 for (int row = 0; row < numRows; row++) { 630 in = input->data.U64[row]; 631 out = output->data.S16[row]; 632 for (int col = 0; col < numCols; col++) { 633 out[col] = (psS16) in[col]; 634 } 635 } 636 }; 637 break; 638 case PS_TYPE_F32: { 639 psF32 *in; 640 psS16 *out; 641 for (int row = 0; row < numRows; row++) { 642 in = input->data.F32[row]; 643 out = output->data.S16[row]; 644 for (int col = 0; col < numCols; col++) { 645 out[col] = (psS16) in[col]; 646 } 647 } 648 }; 649 break; 650 case PS_TYPE_F64: { 651 psF64 *in; 652 psS16 *out; 653 for (int row = 0; row < numRows; row++) { 654 in = input->data.F64[row]; 655 out = output->data.S16[row]; 656 for (int col = 0; col < numCols; col++) { 657 out[col] = (psS16) in[col]; 658 } 659 } 660 }; 661 break; 662 case PS_TYPE_C32: { 663 psC32 *in; 664 psS16 *out; 665 for (int row = 0; row < numRows; row++) { 666 in = input->data.C32[row]; 667 out = output->data.S16[row]; 668 for (int col = 0; col < numCols; col++) { 669 out[col] = (psS16) in[col]; 670 } 671 } 672 }; 673 break; 674 case PS_TYPE_PTR: 675 psError (__func__, "Can't copy image from a matrix of pointers."); 676 psImageFree (output); 677 return ((void *) 0); 678 default: 679 break; 680 }; 681 break; 682 case PS_TYPE_S32: 683 switch (input->type.type) { 684 case PS_TYPE_S8: { 685 psS8 *in; 686 psS32 *out; 687 for (int row = 0; row < numRows; row++) { 688 in = input->data.S8[row]; 689 out = output->data.S32[row]; 690 for (int col = 0; col < numCols; col++) { 691 out[col] = (psS32) in[col]; 692 } 693 } 694 }; 695 break; 696 case PS_TYPE_S16: { 697 psS16 *in; 698 psS32 *out; 699 for (int row = 0; row < numRows; row++) { 700 in = input->data.S16[row]; 701 out = output->data.S32[row]; 702 for (int col = 0; col < numCols; col++) { 703 out[col] = (psS32) in[col]; 704 } 705 } 706 }; 707 break; 708 case PS_TYPE_S32: { 709 psS32 *in; 710 psS32 *out; 711 for (int row = 0; row < numRows; row++) { 712 in = input->data.S32[row]; 713 out = output->data.S32[row]; 714 for (int col = 0; col < numCols; col++) { 715 out[col] = (psS32) in[col]; 716 } 717 } 718 }; 719 break; 720 case PS_TYPE_S64: { 721 psS64 *in; 722 psS32 *out; 723 for (int row = 0; row < numRows; row++) { 724 in = input->data.S64[row]; 725 out = output->data.S32[row]; 726 for (int col = 0; col < numCols; col++) { 727 out[col] = (psS32) in[col]; 728 } 729 } 730 }; 731 break; 732 case PS_TYPE_U8: { 733 psU8 *in; 734 psS32 *out; 735 for (int row = 0; row < numRows; row++) { 736 in = input->data.U8[row]; 737 out = output->data.S32[row]; 738 for (int col = 0; col < numCols; col++) { 739 out[col] = (psS32) in[col]; 740 } 741 } 742 }; 743 break; 744 case PS_TYPE_U16: { 745 psU16 *in; 746 psS32 *out; 747 for (int row = 0; row < numRows; row++) { 748 in = input->data.U16[row]; 749 out = output->data.S32[row]; 750 for (int col = 0; col < numCols; col++) { 751 out[col] = (psS32) in[col]; 752 } 753 } 754 }; 755 break; 756 case PS_TYPE_U32: { 757 psU32 *in; 758 psS32 *out; 759 for (int row = 0; row < numRows; row++) { 760 in = input->data.U32[row]; 761 out = output->data.S32[row]; 762 for (int col = 0; col < numCols; col++) { 763 out[col] = (psS32) in[col]; 764 } 765 } 766 }; 767 break; 768 case PS_TYPE_U64: { 769 psU64 *in; 770 psS32 *out; 771 for (int row = 0; row < numRows; row++) { 772 in = input->data.U64[row]; 773 out = output->data.S32[row]; 774 for (int col = 0; col < numCols; col++) { 775 out[col] = (psS32) in[col]; 776 } 777 } 778 }; 779 break; 780 case PS_TYPE_F32: { 781 psF32 *in; 782 psS32 *out; 783 for (int row = 0; row < numRows; row++) { 784 in = input->data.F32[row]; 785 out = output->data.S32[row]; 786 for (int col = 0; col < numCols; col++) { 787 out[col] = (psS32) in[col]; 788 } 789 } 790 }; 791 break; 792 case PS_TYPE_F64: { 793 psF64 *in; 794 psS32 *out; 795 for (int row = 0; row < numRows; row++) { 796 in = input->data.F64[row]; 797 out = output->data.S32[row]; 798 for (int col = 0; col < numCols; col++) { 799 out[col] = (psS32) in[col]; 800 } 801 } 802 }; 803 break; 804 case PS_TYPE_C32: { 805 psC32 *in; 806 psS32 *out; 807 for (int row = 0; row < numRows; row++) { 808 in = input->data.C32[row]; 809 out = output->data.S32[row]; 810 for (int col = 0; col < numCols; col++) { 811 out[col] = (psS32) in[col]; 812 } 813 } 814 }; 815 break; 816 case PS_TYPE_PTR: 817 psError (__func__, "Can't copy image from a matrix of pointers."); 818 psImageFree (output); 819 return ((void *) 0); 820 default: 821 break; 822 }; 823 break; 824 case PS_TYPE_S64: 825 switch (input->type.type) { 826 case PS_TYPE_S8: { 827 psS8 *in; 828 psS64 *out; 829 for (int row = 0; row < numRows; row++) { 830 in = input->data.S8[row]; 831 out = output->data.S64[row]; 832 for (int col = 0; col < numCols; col++) { 833 out[col] = (psS64) in[col]; 834 } 835 } 836 }; 837 break; 838 case PS_TYPE_S16: { 839 psS16 *in; 840 psS64 *out; 841 for (int row = 0; row < numRows; row++) { 842 in = input->data.S16[row]; 843 out = output->data.S64[row]; 844 for (int col = 0; col < numCols; col++) { 845 out[col] = (psS64) in[col]; 846 } 847 } 848 }; 849 break; 850 case PS_TYPE_S32: { 851 psS32 *in; 852 psS64 *out; 853 for (int row = 0; row < numRows; row++) { 854 in = input->data.S32[row]; 855 out = output->data.S64[row]; 856 for (int col = 0; col < numCols; col++) { 857 out[col] = (psS64) in[col]; 858 } 859 } 860 }; 861 break; 862 case PS_TYPE_S64: { 863 psS64 *in; 864 psS64 *out; 865 for (int row = 0; row < numRows; row++) { 866 in = input->data.S64[row]; 867 out = output->data.S64[row]; 868 for (int col = 0; col < numCols; col++) { 869 out[col] = (psS64) in[col]; 870 } 871 } 872 }; 873 break; 874 case PS_TYPE_U8: { 875 psU8 *in; 876 psS64 *out; 877 for (int row = 0; row < numRows; row++) { 878 in = input->data.U8[row]; 879 out = output->data.S64[row]; 880 for (int col = 0; col < numCols; col++) { 881 out[col] = (psS64) in[col]; 882 } 883 } 884 }; 885 break; 886 case PS_TYPE_U16: { 887 psU16 *in; 888 psS64 *out; 889 for (int row = 0; row < numRows; row++) { 890 in = input->data.U16[row]; 891 out = output->data.S64[row]; 892 for (int col = 0; col < numCols; col++) { 893 out[col] = (psS64) in[col]; 894 } 895 } 896 }; 897 break; 898 case PS_TYPE_U32: { 899 psU32 *in; 900 psS64 *out; 901 for (int row = 0; row < numRows; row++) { 902 in = input->data.U32[row]; 903 out = output->data.S64[row]; 904 for (int col = 0; col < numCols; col++) { 905 out[col] = (psS64) in[col]; 906 } 907 } 908 }; 909 break; 910 case PS_TYPE_U64: { 911 psU64 *in; 912 psS64 *out; 913 for (int row = 0; row < numRows; row++) { 914 in = input->data.U64[row]; 915 out = output->data.S64[row]; 916 for (int col = 0; col < numCols; col++) { 917 out[col] = (psS64) in[col]; 918 } 919 } 920 }; 921 break; 922 case PS_TYPE_F32: { 923 psF32 *in; 924 psS64 *out; 925 for (int row = 0; row < numRows; row++) { 926 in = input->data.F32[row]; 927 out = output->data.S64[row]; 928 for (int col = 0; col < numCols; col++) { 929 out[col] = (psS64) in[col]; 930 } 931 } 932 }; 933 break; 934 case PS_TYPE_F64: { 935 psF64 *in; 936 psS64 *out; 937 for (int row = 0; row < numRows; row++) { 938 in = input->data.F64[row]; 939 out = output->data.S64[row]; 940 for (int col = 0; col < numCols; col++) { 941 out[col] = (psS64) in[col]; 942 } 943 } 944 }; 945 break; 946 case PS_TYPE_C32: { 947 psC32 *in; 948 psS64 *out; 949 for (int row = 0; row < numRows; row++) { 950 in = input->data.C32[row]; 951 out = output->data.S64[row]; 952 for (int col = 0; col < numCols; col++) { 953 out[col] = (psS64) in[col]; 954 } 955 } 956 }; 957 break; 958 case PS_TYPE_PTR: 959 psError (__func__, "Can't copy image from a matrix of pointers."); 960 psImageFree (output); 961 return ((void *) 0); 962 default: 963 break; 964 }; 965 break; 966 case PS_TYPE_U8: 967 switch (input->type.type) { 968 case PS_TYPE_S8: { 969 psS8 *in; 970 psU8 *out; 971 for (int row = 0; row < numRows; row++) { 972 in = input->data.S8[row]; 973 out = output->data.U8[row]; 974 for (int col = 0; col < numCols; col++) { 975 out[col] = (psU8) in[col]; 976 } 977 } 978 }; 979 break; 980 case PS_TYPE_S16: { 981 psS16 *in; 982 psU8 *out; 983 for (int row = 0; row < numRows; row++) { 984 in = input->data.S16[row]; 985 out = output->data.U8[row]; 986 for (int col = 0; col < numCols; col++) { 987 out[col] = (psU8) in[col]; 988 } 989 } 990 }; 991 break; 992 case PS_TYPE_S32: { 993 psS32 *in; 994 psU8 *out; 995 for (int row = 0; row < numRows; row++) { 996 in = input->data.S32[row]; 997 out = output->data.U8[row]; 998 for (int col = 0; col < numCols; col++) { 999 out[col] = (psU8) in[col]; 1000 } 1001 } 1002 }; 1003 break; 1004 case PS_TYPE_S64: { 1005 psS64 *in; 1006 psU8 *out; 1007 for (int row = 0; row < numRows; row++) { 1008 in = input->data.S64[row]; 1009 out = output->data.U8[row]; 1010 for (int col = 0; col < numCols; col++) { 1011 out[col] = (psU8) in[col]; 1012 } 1013 } 1014 }; 1015 break; 1016 case PS_TYPE_U8: { 1017 psU8 *in; 1018 psU8 *out; 1019 for (int row = 0; row < numRows; row++) { 1020 in = input->data.U8[row]; 1021 out = output->data.U8[row]; 1022 for (int col = 0; col < numCols; col++) { 1023 out[col] = (psU8) in[col]; 1024 } 1025 } 1026 }; 1027 break; 1028 case PS_TYPE_U16: { 1029 psU16 *in; 1030 psU8 *out; 1031 for (int row = 0; row < numRows; row++) { 1032 in = input->data.U16[row]; 1033 out = output->data.U8[row]; 1034 for (int col = 0; col < numCols; col++) { 1035 out[col] = (psU8) in[col]; 1036 } 1037 } 1038 }; 1039 break; 1040 case PS_TYPE_U32: { 1041 psU32 *in; 1042 psU8 *out; 1043 for (int row = 0; row < numRows; row++) { 1044 in = input->data.U32[row]; 1045 out = output->data.U8[row]; 1046 for (int col = 0; col < numCols; col++) { 1047 out[col] = (psU8) in[col]; 1048 } 1049 } 1050 }; 1051 break; 1052 case PS_TYPE_U64: { 1053 psU64 *in; 1054 psU8 *out; 1055 for (int row = 0; row < numRows; row++) { 1056 in = input->data.U64[row]; 1057 out = output->data.U8[row]; 1058 for (int col = 0; col < numCols; col++) { 1059 out[col] = (psU8) in[col]; 1060 } 1061 } 1062 }; 1063 break; 1064 case PS_TYPE_F32: { 1065 psF32 *in; 1066 psU8 *out; 1067 for (int row = 0; row < numRows; row++) { 1068 in = input->data.F32[row]; 1069 out = output->data.U8[row]; 1070 for (int col = 0; col < numCols; col++) { 1071 out[col] = (psU8) in[col]; 1072 } 1073 } 1074 }; 1075 break; 1076 case PS_TYPE_F64: { 1077 psF64 *in; 1078 psU8 *out; 1079 for (int row = 0; row < numRows; row++) { 1080 in = input->data.F64[row]; 1081 out = output->data.U8[row]; 1082 for (int col = 0; col < numCols; col++) { 1083 out[col] = (psU8) in[col]; 1084 } 1085 } 1086 }; 1087 break; 1088 case PS_TYPE_C32: { 1089 psC32 *in; 1090 psU8 *out; 1091 for (int row = 0; row < numRows; row++) { 1092 in = input->data.C32[row]; 1093 out = output->data.U8[row]; 1094 for (int col = 0; col < numCols; col++) { 1095 out[col] = (psU8) in[col]; 1096 } 1097 } 1098 }; 1099 break; 1100 case PS_TYPE_PTR: 1101 psError (__func__, "Can't copy image from a matrix of pointers."); 1102 psImageFree (output); 1103 return ((void *) 0); 1104 default: 1105 break; 1106 }; 1107 break; 1108 case PS_TYPE_U16: 1109 switch (input->type.type) { 1110 case PS_TYPE_S8: { 1111 psS8 *in; 1112 psU16 *out; 1113 for (int row = 0; row < numRows; row++) { 1114 in = input->data.S8[row]; 1115 out = output->data.U16[row]; 1116 for (int col = 0; col < numCols; col++) { 1117 out[col] = (psU16) in[col]; 1118 } 1119 } 1120 }; 1121 break; 1122 case PS_TYPE_S16: { 1123 psS16 *in; 1124 psU16 *out; 1125 for (int row = 0; row < numRows; row++) { 1126 in = input->data.S16[row]; 1127 out = output->data.U16[row]; 1128 for (int col = 0; col < numCols; col++) { 1129 out[col] = (psU16) in[col]; 1130 } 1131 } 1132 }; 1133 break; 1134 case PS_TYPE_S32: { 1135 psS32 *in; 1136 psU16 *out; 1137 for (int row = 0; row < numRows; row++) { 1138 in = input->data.S32[row]; 1139 out = output->data.U16[row]; 1140 for (int col = 0; col < numCols; col++) { 1141 out[col] = (psU16) in[col]; 1142 } 1143 } 1144 }; 1145 break; 1146 case PS_TYPE_S64: { 1147 psS64 *in; 1148 psU16 *out; 1149 for (int row = 0; row < numRows; row++) { 1150 in = input->data.S64[row]; 1151 out = output->data.U16[row]; 1152 for (int col = 0; col < numCols; col++) { 1153 out[col] = (psU16) in[col]; 1154 } 1155 } 1156 }; 1157 break; 1158 case PS_TYPE_U8: { 1159 psU8 *in; 1160 psU16 *out; 1161 for (int row = 0; row < numRows; row++) { 1162 in = input->data.U8[row]; 1163 out = output->data.U16[row]; 1164 for (int col = 0; col < numCols; col++) { 1165 out[col] = (psU16) in[col]; 1166 } 1167 } 1168 }; 1169 break; 1170 case PS_TYPE_U16: { 1171 psU16 *in; 1172 psU16 *out; 1173 for (int row = 0; row < numRows; row++) { 1174 in = input->data.U16[row]; 1175 out = output->data.U16[row]; 1176 for (int col = 0; col < numCols; col++) { 1177 out[col] = (psU16) in[col]; 1178 } 1179 } 1180 }; 1181 break; 1182 case PS_TYPE_U32: { 1183 psU32 *in; 1184 psU16 *out; 1185 for (int row = 0; row < numRows; row++) { 1186 in = input->data.U32[row]; 1187 out = output->data.U16[row]; 1188 for (int col = 0; col < numCols; col++) { 1189 out[col] = (psU16) in[col]; 1190 } 1191 } 1192 }; 1193 break; 1194 case PS_TYPE_U64: { 1195 psU64 *in; 1196 psU16 *out; 1197 for (int row = 0; row < numRows; row++) { 1198 in = input->data.U64[row]; 1199 out = output->data.U16[row]; 1200 for (int col = 0; col < numCols; col++) { 1201 out[col] = (psU16) in[col]; 1202 } 1203 } 1204 }; 1205 break; 1206 case PS_TYPE_F32: { 1207 psF32 *in; 1208 psU16 *out; 1209 for (int row = 0; row < numRows; row++) { 1210 in = input->data.F32[row]; 1211 out = output->data.U16[row]; 1212 for (int col = 0; col < numCols; col++) { 1213 out[col] = (psU16) in[col]; 1214 } 1215 } 1216 }; 1217 break; 1218 case PS_TYPE_F64: { 1219 psF64 *in; 1220 psU16 *out; 1221 for (int row = 0; row < numRows; row++) { 1222 in = input->data.F64[row]; 1223 out = output->data.U16[row]; 1224 for (int col = 0; col < numCols; col++) { 1225 out[col] = (psU16) in[col]; 1226 } 1227 } 1228 }; 1229 break; 1230 case PS_TYPE_C32: { 1231 psC32 *in; 1232 psU16 *out; 1233 for (int row = 0; row < numRows; row++) { 1234 in = input->data.C32[row]; 1235 out = output->data.U16[row]; 1236 for (int col = 0; col < numCols; col++) { 1237 out[col] = (psU16) in[col]; 1238 } 1239 } 1240 }; 1241 break; 1242 case PS_TYPE_PTR: 1243 psError (__func__, "Can't copy image from a matrix of pointers."); 1244 psImageFree (output); 1245 return ((void *) 0); 1246 default: 1247 break; 1248 }; 1249 break; 1250 case PS_TYPE_U32: 1251 switch (input->type.type) { 1252 case PS_TYPE_S8: { 1253 psS8 *in; 1254 psU32 *out; 1255 for (int row = 0; row < numRows; row++) { 1256 in = input->data.S8[row]; 1257 out = output->data.U32[row]; 1258 for (int col = 0; col < numCols; col++) { 1259 out[col] = (psU32) in[col]; 1260 } 1261 } 1262 }; 1263 break; 1264 case PS_TYPE_S16: { 1265 psS16 *in; 1266 psU32 *out; 1267 for (int row = 0; row < numRows; row++) { 1268 in = input->data.S16[row]; 1269 out = output->data.U32[row]; 1270 for (int col = 0; col < numCols; col++) { 1271 out[col] = (psU32) in[col]; 1272 } 1273 } 1274 }; 1275 break; 1276 case PS_TYPE_S32: { 1277 psS32 *in; 1278 psU32 *out; 1279 for (int row = 0; row < numRows; row++) { 1280 in = input->data.S32[row]; 1281 out = output->data.U32[row]; 1282 for (int col = 0; col < numCols; col++) { 1283 out[col] = (psU32) in[col]; 1284 } 1285 } 1286 }; 1287 break; 1288 case PS_TYPE_S64: { 1289 psS64 *in; 1290 psU32 *out; 1291 for (int row = 0; row < numRows; row++) { 1292 in = input->data.S64[row]; 1293 out = output->data.U32[row]; 1294 for (int col = 0; col < numCols; col++) { 1295 out[col] = (psU32) in[col]; 1296 } 1297 } 1298 }; 1299 break; 1300 case PS_TYPE_U8: { 1301 psU8 *in; 1302 psU32 *out; 1303 for (int row = 0; row < numRows; row++) { 1304 in = input->data.U8[row]; 1305 out = output->data.U32[row]; 1306 for (int col = 0; col < numCols; col++) { 1307 out[col] = (psU32) in[col]; 1308 } 1309 } 1310 }; 1311 break; 1312 case PS_TYPE_U16: { 1313 psU16 *in; 1314 psU32 *out; 1315 for (int row = 0; row < numRows; row++) { 1316 in = input->data.U16[row]; 1317 out = output->data.U32[row]; 1318 for (int col = 0; col < numCols; col++) { 1319 out[col] = (psU32) in[col]; 1320 } 1321 } 1322 }; 1323 break; 1324 case PS_TYPE_U32: { 1325 psU32 *in; 1326 psU32 *out; 1327 for (int row = 0; row < numRows; row++) { 1328 in = input->data.U32[row]; 1329 out = output->data.U32[row]; 1330 for (int col = 0; col < numCols; col++) { 1331 out[col] = (psU32) in[col]; 1332 } 1333 } 1334 }; 1335 break; 1336 case PS_TYPE_U64: { 1337 psU64 *in; 1338 psU32 *out; 1339 for (int row = 0; row < numRows; row++) { 1340 in = input->data.U64[row]; 1341 out = output->data.U32[row]; 1342 for (int col = 0; col < numCols; col++) { 1343 out[col] = (psU32) in[col]; 1344 } 1345 } 1346 }; 1347 break; 1348 case PS_TYPE_F32: { 1349 psF32 *in; 1350 psU32 *out; 1351 for (int row = 0; row < numRows; row++) { 1352 in = input->data.F32[row]; 1353 out = output->data.U32[row]; 1354 for (int col = 0; col < numCols; col++) { 1355 out[col] = (psU32) in[col]; 1356 } 1357 } 1358 }; 1359 break; 1360 case PS_TYPE_F64: { 1361 psF64 *in; 1362 psU32 *out; 1363 for (int row = 0; row < numRows; row++) { 1364 in = input->data.F64[row]; 1365 out = output->data.U32[row]; 1366 for (int col = 0; col < numCols; col++) { 1367 out[col] = (psU32) in[col]; 1368 } 1369 } 1370 }; 1371 break; 1372 case PS_TYPE_C32: { 1373 psC32 *in; 1374 psU32 *out; 1375 for (int row = 0; row < numRows; row++) { 1376 in = input->data.C32[row]; 1377 out = output->data.U32[row]; 1378 for (int col = 0; col < numCols; col++) { 1379 out[col] = (psU32) in[col]; 1380 } 1381 } 1382 }; 1383 break; 1384 case PS_TYPE_PTR: 1385 psError (__func__, "Can't copy image from a matrix of pointers."); 1386 psImageFree (output); 1387 return ((void *) 0); 1388 default: 1389 break; 1390 }; 1391 break; 1392 case PS_TYPE_U64: 1393 switch (input->type.type) { 1394 case PS_TYPE_S8: { 1395 psS8 *in; 1396 psU64 *out; 1397 for (int row = 0; row < numRows; row++) { 1398 in = input->data.S8[row]; 1399 out = output->data.U64[row]; 1400 for (int col = 0; col < numCols; col++) { 1401 out[col] = (psU64) in[col]; 1402 } 1403 } 1404 }; 1405 break; 1406 case PS_TYPE_S16: { 1407 psS16 *in; 1408 psU64 *out; 1409 for (int row = 0; row < numRows; row++) { 1410 in = input->data.S16[row]; 1411 out = output->data.U64[row]; 1412 for (int col = 0; col < numCols; col++) { 1413 out[col] = (psU64) in[col]; 1414 } 1415 } 1416 }; 1417 break; 1418 case PS_TYPE_S32: { 1419 psS32 *in; 1420 psU64 *out; 1421 for (int row = 0; row < numRows; row++) { 1422 in = input->data.S32[row]; 1423 out = output->data.U64[row]; 1424 for (int col = 0; col < numCols; col++) { 1425 out[col] = (psU64) in[col]; 1426 } 1427 } 1428 }; 1429 break; 1430 case PS_TYPE_S64: { 1431 psS64 *in; 1432 psU64 *out; 1433 for (int row = 0; row < numRows; row++) { 1434 in = input->data.S64[row]; 1435 out = output->data.U64[row]; 1436 for (int col = 0; col < numCols; col++) { 1437 out[col] = (psU64) in[col]; 1438 } 1439 } 1440 }; 1441 break; 1442 case PS_TYPE_U8: { 1443 psU8 *in; 1444 psU64 *out; 1445 for (int row = 0; row < numRows; row++) { 1446 in = input->data.U8[row]; 1447 out = output->data.U64[row]; 1448 for (int col = 0; col < numCols; col++) { 1449 out[col] = (psU64) in[col]; 1450 } 1451 } 1452 }; 1453 break; 1454 case PS_TYPE_U16: { 1455 psU16 *in; 1456 psU64 *out; 1457 for (int row = 0; row < numRows; row++) { 1458 in = input->data.U16[row]; 1459 out = output->data.U64[row]; 1460 for (int col = 0; col < numCols; col++) { 1461 out[col] = (psU64) in[col]; 1462 } 1463 } 1464 }; 1465 break; 1466 case PS_TYPE_U32: { 1467 psU32 *in; 1468 psU64 *out; 1469 for (int row = 0; row < numRows; row++) { 1470 in = input->data.U32[row]; 1471 out = output->data.U64[row]; 1472 for (int col = 0; col < numCols; col++) { 1473 out[col] = (psU64) in[col]; 1474 } 1475 } 1476 }; 1477 break; 1478 case PS_TYPE_U64: { 1479 psU64 *in; 1480 psU64 *out; 1481 for (int row = 0; row < numRows; row++) { 1482 in = input->data.U64[row]; 1483 out = output->data.U64[row]; 1484 for (int col = 0; col < numCols; col++) { 1485 out[col] = (psU64) in[col]; 1486 } 1487 } 1488 }; 1489 break; 1490 case PS_TYPE_F32: { 1491 psF32 *in; 1492 psU64 *out; 1493 for (int row = 0; row < numRows; row++) { 1494 in = input->data.F32[row]; 1495 out = output->data.U64[row]; 1496 for (int col = 0; col < numCols; col++) { 1497 out[col] = (psU64) in[col]; 1498 } 1499 } 1500 }; 1501 break; 1502 case PS_TYPE_F64: { 1503 psF64 *in; 1504 psU64 *out; 1505 for (int row = 0; row < numRows; row++) { 1506 in = input->data.F64[row]; 1507 out = output->data.U64[row]; 1508 for (int col = 0; col < numCols; col++) { 1509 out[col] = (psU64) in[col]; 1510 } 1511 } 1512 }; 1513 break; 1514 case PS_TYPE_C32: { 1515 psC32 *in; 1516 psU64 *out; 1517 for (int row = 0; row < numRows; row++) { 1518 in = input->data.C32[row]; 1519 out = output->data.U64[row]; 1520 for (int col = 0; col < numCols; col++) { 1521 out[col] = (psU64) in[col]; 1522 } 1523 } 1524 }; 1525 break; 1526 case PS_TYPE_PTR: 1527 psError (__func__, "Can't copy image from a matrix of pointers."); 1528 psImageFree (output); 1529 return ((void *) 0); 1530 default: 1531 break; 1532 }; 1533 break; 1534 case PS_TYPE_F32: 1535 switch (input->type.type) { 1536 case PS_TYPE_S8: { 1537 psS8 *in; 1538 psF32 *out; 1539 for (int row = 0; row < numRows; row++) { 1540 in = input->data.S8[row]; 1541 out = output->data.F32[row]; 1542 for (int col = 0; col < numCols; col++) { 1543 out[col] = (psF32) in[col]; 1544 } 1545 } 1546 }; 1547 break; 1548 case PS_TYPE_S16: { 1549 psS16 *in; 1550 psF32 *out; 1551 for (int row = 0; row < numRows; row++) { 1552 in = input->data.S16[row]; 1553 out = output->data.F32[row]; 1554 for (int col = 0; col < numCols; col++) { 1555 out[col] = (psF32) in[col]; 1556 } 1557 } 1558 }; 1559 break; 1560 case PS_TYPE_S32: { 1561 psS32 *in; 1562 psF32 *out; 1563 for (int row = 0; row < numRows; row++) { 1564 in = input->data.S32[row]; 1565 out = output->data.F32[row]; 1566 for (int col = 0; col < numCols; col++) { 1567 out[col] = (psF32) in[col]; 1568 } 1569 } 1570 }; 1571 break; 1572 case PS_TYPE_S64: { 1573 psS64 *in; 1574 psF32 *out; 1575 for (int row = 0; row < numRows; row++) { 1576 in = input->data.S64[row]; 1577 out = output->data.F32[row]; 1578 for (int col = 0; col < numCols; col++) { 1579 out[col] = (psF32) in[col]; 1580 } 1581 } 1582 }; 1583 break; 1584 case PS_TYPE_U8: { 1585 psU8 *in; 1586 psF32 *out; 1587 for (int row = 0; row < numRows; row++) { 1588 in = input->data.U8[row]; 1589 out = output->data.F32[row]; 1590 for (int col = 0; col < numCols; col++) { 1591 out[col] = (psF32) in[col]; 1592 } 1593 } 1594 }; 1595 break; 1596 case PS_TYPE_U16: { 1597 psU16 *in; 1598 psF32 *out; 1599 for (int row = 0; row < numRows; row++) { 1600 in = input->data.U16[row]; 1601 out = output->data.F32[row]; 1602 for (int col = 0; col < numCols; col++) { 1603 out[col] = (psF32) in[col]; 1604 } 1605 } 1606 }; 1607 break; 1608 case PS_TYPE_U32: { 1609 psU32 *in; 1610 psF32 *out; 1611 for (int row = 0; row < numRows; row++) { 1612 in = input->data.U32[row]; 1613 out = output->data.F32[row]; 1614 for (int col = 0; col < numCols; col++) { 1615 out[col] = (psF32) in[col]; 1616 } 1617 } 1618 }; 1619 break; 1620 case PS_TYPE_U64: { 1621 psU64 *in; 1622 psF32 *out; 1623 for (int row = 0; row < numRows; row++) { 1624 in = input->data.U64[row]; 1625 out = output->data.F32[row]; 1626 for (int col = 0; col < numCols; col++) { 1627 out[col] = (psF32) in[col]; 1628 } 1629 } 1630 }; 1631 break; 1632 case PS_TYPE_F32: { 1633 psF32 *in; 1634 psF32 *out; 1635 for (int row = 0; row < numRows; row++) { 1636 in = input->data.F32[row]; 1637 out = output->data.F32[row]; 1638 for (int col = 0; col < numCols; col++) { 1639 out[col] = (psF32) in[col]; 1640 } 1641 } 1642 }; 1643 break; 1644 case PS_TYPE_F64: { 1645 psF64 *in; 1646 psF32 *out; 1647 for (int row = 0; row < numRows; row++) { 1648 in = input->data.F64[row]; 1649 out = output->data.F32[row]; 1650 for (int col = 0; col < numCols; col++) { 1651 out[col] = (psF32) in[col]; 1652 } 1653 } 1654 }; 1655 break; 1656 case PS_TYPE_C32: { 1657 psC32 *in; 1658 psF32 *out; 1659 for (int row = 0; row < numRows; row++) { 1660 in = input->data.C32[row]; 1661 out = output->data.F32[row]; 1662 for (int col = 0; col < numCols; col++) { 1663 out[col] = (psF32) in[col]; 1664 } 1665 } 1666 }; 1667 break; 1668 case PS_TYPE_PTR: 1669 psError (__func__, "Can't copy image from a matrix of pointers."); 1670 psImageFree (output); 1671 return ((void *) 0); 1672 default: 1673 break; 1674 }; 1675 break; 1676 case PS_TYPE_F64: 1677 switch (input->type.type) { 1678 case PS_TYPE_S8: { 1679 psS8 *in; 1680 psF64 *out; 1681 for (int row = 0; row < numRows; row++) { 1682 in = input->data.S8[row]; 1683 out = output->data.F64[row]; 1684 for (int col = 0; col < numCols; col++) { 1685 out[col] = (psF64) in[col]; 1686 } 1687 } 1688 }; 1689 break; 1690 case PS_TYPE_S16: { 1691 psS16 *in; 1692 psF64 *out; 1693 for (int row = 0; row < numRows; row++) { 1694 in = input->data.S16[row]; 1695 out = output->data.F64[row]; 1696 for (int col = 0; col < numCols; col++) { 1697 out[col] = (psF64) in[col]; 1698 } 1699 } 1700 }; 1701 break; 1702 case PS_TYPE_S32: { 1703 psS32 *in; 1704 psF64 *out; 1705 for (int row = 0; row < numRows; row++) { 1706 in = input->data.S32[row]; 1707 out = output->data.F64[row]; 1708 for (int col = 0; col < numCols; col++) { 1709 out[col] = (psF64) in[col]; 1710 } 1711 } 1712 }; 1713 break; 1714 case PS_TYPE_S64: { 1715 psS64 *in; 1716 psF64 *out; 1717 for (int row = 0; row < numRows; row++) { 1718 in = input->data.S64[row]; 1719 out = output->data.F64[row]; 1720 for (int col = 0; col < numCols; col++) { 1721 out[col] = (psF64) in[col]; 1722 } 1723 } 1724 }; 1725 break; 1726 case PS_TYPE_U8: { 1727 psU8 *in; 1728 psF64 *out; 1729 for (int row = 0; row < numRows; row++) { 1730 in = input->data.U8[row]; 1731 out = output->data.F64[row]; 1732 for (int col = 0; col < numCols; col++) { 1733 out[col] = (psF64) in[col]; 1734 } 1735 } 1736 }; 1737 break; 1738 case PS_TYPE_U16: { 1739 psU16 *in; 1740 psF64 *out; 1741 for (int row = 0; row < numRows; row++) { 1742 in = input->data.U16[row]; 1743 out = output->data.F64[row]; 1744 for (int col = 0; col < numCols; col++) { 1745 out[col] = (psF64) in[col]; 1746 } 1747 } 1748 }; 1749 break; 1750 case PS_TYPE_U32: { 1751 psU32 *in; 1752 psF64 *out; 1753 for (int row = 0; row < numRows; row++) { 1754 in = input->data.U32[row]; 1755 out = output->data.F64[row]; 1756 for (int col = 0; col < numCols; col++) { 1757 out[col] = (psF64) in[col]; 1758 } 1759 } 1760 }; 1761 break; 1762 case PS_TYPE_U64: { 1763 psU64 *in; 1764 psF64 *out; 1765 for (int row = 0; row < numRows; row++) { 1766 in = input->data.U64[row]; 1767 out = output->data.F64[row]; 1768 for (int col = 0; col < numCols; col++) { 1769 out[col] = (psF64) in[col]; 1770 } 1771 } 1772 }; 1773 break; 1774 case PS_TYPE_F32: { 1775 psF32 *in; 1776 psF64 *out; 1777 for (int row = 0; row < numRows; row++) { 1778 in = input->data.F32[row]; 1779 out = output->data.F64[row]; 1780 for (int col = 0; col < numCols; col++) { 1781 out[col] = (psF64) in[col]; 1782 } 1783 } 1784 }; 1785 break; 1786 case PS_TYPE_F64: { 1787 psF64 *in; 1788 psF64 *out; 1789 for (int row = 0; row < numRows; row++) { 1790 in = input->data.F64[row]; 1791 out = output->data.F64[row]; 1792 for (int col = 0; col < numCols; col++) { 1793 out[col] = (psF64) in[col]; 1794 } 1795 } 1796 }; 1797 break; 1798 case PS_TYPE_C32: { 1799 psC32 *in; 1800 psF64 *out; 1801 for (int row = 0; row < numRows; row++) { 1802 in = input->data.C32[row]; 1803 out = output->data.F64[row]; 1804 for (int col = 0; col < numCols; col++) { 1805 out[col] = (psF64) in[col]; 1806 } 1807 } 1808 }; 1809 break; 1810 case PS_TYPE_PTR: 1811 psError (__func__, "Can't copy image from a matrix of pointers."); 1812 psImageFree (output); 1813 return ((void *) 0); 1814 default: 1815 break; 1816 }; 1817 break; 1818 case PS_TYPE_C32: 1819 switch (input->type.type) { 1820 case PS_TYPE_S8: { 1821 psS8 *in; 1822 psC32 *out; 1823 for (int row = 0; row < numRows; row++) { 1824 in = input->data.S8[row]; 1825 out = output->data.C32[row]; 1826 for (int col = 0; col < numCols; col++) { 1827 out[col] = (psC32) in[col]; 1828 } 1829 } 1830 }; 1831 break; 1832 case PS_TYPE_S16: { 1833 psS16 *in; 1834 psC32 *out; 1835 for (int row = 0; row < numRows; row++) { 1836 in = input->data.S16[row]; 1837 out = output->data.C32[row]; 1838 for (int col = 0; col < numCols; col++) { 1839 out[col] = (psC32) in[col]; 1840 } 1841 } 1842 }; 1843 break; 1844 case PS_TYPE_S32: { 1845 psS32 *in; 1846 psC32 *out; 1847 for (int row = 0; row < numRows; row++) { 1848 in = input->data.S32[row]; 1849 out = output->data.C32[row]; 1850 for (int col = 0; col < numCols; col++) { 1851 out[col] = (psC32) in[col]; 1852 } 1853 } 1854 }; 1855 break; 1856 case PS_TYPE_S64: { 1857 psS64 *in; 1858 psC32 *out; 1859 for (int row = 0; row < numRows; row++) { 1860 in = input->data.S64[row]; 1861 out = output->data.C32[row]; 1862 for (int col = 0; col < numCols; col++) { 1863 out[col] = (psC32) in[col]; 1864 } 1865 } 1866 }; 1867 break; 1868 case PS_TYPE_U8: { 1869 psU8 *in; 1870 psC32 *out; 1871 for (int row = 0; row < numRows; row++) { 1872 in = input->data.U8[row]; 1873 out = output->data.C32[row]; 1874 for (int col = 0; col < numCols; col++) { 1875 out[col] = (psC32) in[col]; 1876 } 1877 } 1878 }; 1879 break; 1880 case PS_TYPE_U16: { 1881 psU16 *in; 1882 psC32 *out; 1883 for (int row = 0; row < numRows; row++) { 1884 in = input->data.U16[row]; 1885 out = output->data.C32[row]; 1886 for (int col = 0; col < numCols; col++) { 1887 out[col] = (psC32) in[col]; 1888 } 1889 } 1890 }; 1891 break; 1892 case PS_TYPE_U32: { 1893 psU32 *in; 1894 psC32 *out; 1895 for (int row = 0; row < numRows; row++) { 1896 in = input->data.U32[row]; 1897 out = output->data.C32[row]; 1898 for (int col = 0; col < numCols; col++) { 1899 out[col] = (psC32) in[col]; 1900 } 1901 } 1902 }; 1903 break; 1904 case PS_TYPE_U64: { 1905 psU64 *in; 1906 psC32 *out; 1907 for (int row = 0; row < numRows; row++) { 1908 in = input->data.U64[row]; 1909 out = output->data.C32[row]; 1910 for (int col = 0; col < numCols; col++) { 1911 out[col] = (psC32) in[col]; 1912 } 1913 } 1914 }; 1915 break; 1916 case PS_TYPE_F32: { 1917 psF32 *in; 1918 psC32 *out; 1919 for (int row = 0; row < numRows; row++) { 1920 in = input->data.F32[row]; 1921 out = output->data.C32[row]; 1922 for (int col = 0; col < numCols; col++) { 1923 out[col] = (psC32) in[col]; 1924 } 1925 } 1926 }; 1927 break; 1928 case PS_TYPE_F64: { 1929 psF64 *in; 1930 psC32 *out; 1931 for (int row = 0; row < numRows; row++) { 1932 in = input->data.F64[row]; 1933 out = output->data.C32[row]; 1934 for (int col = 0; col < numCols; col++) { 1935 out[col] = (psC32) in[col]; 1936 } 1937 } 1938 }; 1939 break; 1940 case PS_TYPE_C32: { 1941 psC32 *in; 1942 psC32 *out; 1943 for (int row = 0; row < numRows; row++) { 1944 in = input->data.C32[row]; 1945 out = output->data.C32[row]; 1946 for (int col = 0; col < numCols; col++) { 1947 out[col] = (psC32) in[col]; 1948 } 1949 } 1950 }; 1951 break; 1952 case PS_TYPE_PTR: 1953 psError (__func__, "Can't copy image from a matrix of pointers."); 1954 psImageFree (output); 1955 return ((void *) 0); 1956 default: 1957 break; 1958 }; 1959 break; 1960 case PS_TYPE_C64: 1961 switch (input->type.type) { 1962 case PS_TYPE_S8: { 1963 psS8 *in; 1964 psC64 *out; 1965 for (int row = 0; row < numRows; row++) { 1966 in = input->data.S8[row]; 1967 out = output->data.C64[row]; 1968 for (int col = 0; col < numCols; col++) { 1969 out[col] = (psC64) in[col]; 1970 } 1971 } 1972 }; 1973 break; 1974 case PS_TYPE_S16: { 1975 psS16 *in; 1976 psC64 *out; 1977 for (int row = 0; row < numRows; row++) { 1978 in = input->data.S16[row]; 1979 out = output->data.C64[row]; 1980 for (int col = 0; col < numCols; col++) { 1981 out[col] = (psC64) in[col]; 1982 } 1983 } 1984 }; 1985 break; 1986 case PS_TYPE_S32: { 1987 psS32 *in; 1988 psC64 *out; 1989 for (int row = 0; row < numRows; row++) { 1990 in = input->data.S32[row]; 1991 out = output->data.C64[row]; 1992 for (int col = 0; col < numCols; col++) { 1993 out[col] = (psC64) in[col]; 1994 } 1995 } 1996 }; 1997 break; 1998 case PS_TYPE_S64: { 1999 psS64 *in; 2000 psC64 *out; 2001 for (int row = 0; row < numRows; row++) { 2002 in = input->data.S64[row]; 2003 out = output->data.C64[row]; 2004 for (int col = 0; col < numCols; col++) { 2005 out[col] = (psC64) in[col]; 2006 } 2007 } 2008 }; 2009 break; 2010 case PS_TYPE_U8: { 2011 psU8 *in; 2012 psC64 *out; 2013 for (int row = 0; row < numRows; row++) { 2014 in = input->data.U8[row]; 2015 out = output->data.C64[row]; 2016 for (int col = 0; col < numCols; col++) { 2017 out[col] = (psC64) in[col]; 2018 } 2019 } 2020 }; 2021 break; 2022 case PS_TYPE_U16: { 2023 psU16 *in; 2024 psC64 *out; 2025 for (int row = 0; row < numRows; row++) { 2026 in = input->data.U16[row]; 2027 out = output->data.C64[row]; 2028 for (int col = 0; col < numCols; col++) { 2029 out[col] = (psC64) in[col]; 2030 } 2031 } 2032 }; 2033 break; 2034 case PS_TYPE_U32: { 2035 psU32 *in; 2036 psC64 *out; 2037 for (int row = 0; row < numRows; row++) { 2038 in = input->data.U32[row]; 2039 out = output->data.C64[row]; 2040 for (int col = 0; col < numCols; col++) { 2041 out[col] = (psC64) in[col]; 2042 } 2043 } 2044 }; 2045 break; 2046 case PS_TYPE_U64: { 2047 psU64 *in; 2048 psC64 *out; 2049 for (int row = 0; row < numRows; row++) { 2050 in = input->data.U64[row]; 2051 out = output->data.C64[row]; 2052 for (int col = 0; col < numCols; col++) { 2053 out[col] = (psC64) in[col]; 2054 } 2055 } 2056 }; 2057 break; 2058 case PS_TYPE_F32: { 2059 psF32 *in; 2060 psC64 *out; 2061 for (int row = 0; row < numRows; row++) { 2062 in = input->data.F32[row]; 2063 out = output->data.C64[row]; 2064 for (int col = 0; col < numCols; col++) { 2065 out[col] = (psC64) in[col]; 2066 } 2067 } 2068 }; 2069 break; 2070 case PS_TYPE_F64: { 2071 psF64 *in; 2072 psC64 *out; 2073 for (int row = 0; row < numRows; row++) { 2074 in = input->data.F64[row]; 2075 out = output->data.C64[row]; 2076 for (int col = 0; col < numCols; col++) { 2077 out[col] = (psC64) in[col]; 2078 } 2079 } 2080 }; 2081 break; 2082 case PS_TYPE_C32: { 2083 psC32 *in; 2084 psC64 *out; 2085 for (int row = 0; row < numRows; row++) { 2086 in = input->data.C32[row]; 2087 out = output->data.C64[row]; 2088 for (int col = 0; col < numCols; col++) { 2089 out[col] = (psC64) in[col]; 2090 } 2091 } 2092 }; 2093 break; 2094 case PS_TYPE_PTR: 2095 psError (__func__, "Can't copy image from a matrix of pointers."); 2096 psImageFree (output); 2097 return ((void *) 0); 2098 default: 2099 break; 2100 }; 2101 break; 2102 case PS_TYPE_PTR: 2103 psError (__func__, "Can't copy image into a matrix of pointers."); 2104 psImageFree (output); 2105 return ((void *) 0); 383 2106 } 384 2107 … … 575 2298 } 576 2299 2300 #endif 2301 577 2302 return 0; 578 2303 } -
trunk/psLib/src/mathtypes/psImage.c
r824 r859 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-06-0 1 22:42:57 $11 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-06-04 03:15:47 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 238 238 } 239 239 } 240 psFree(children); 241 242 image->nChildren = 0; 243 image->children = NULL; 244 240 245 241 246 return numFreed; … … 292 297 out = OUT->data.OUTTYPE[row]; \ 293 298 for (int col=0;col<numCols;col++) { \ 294 in[col] = (ps##INTYPE) out[col]; \299 out[col] = (ps##OUTTYPE) in[col]; \ 295 300 } \ 296 301 } \ … … 340 345 } 341 346 342 switch (type) { 347 // XXX - GCC had problems with the length? of the above macro. The original 348 // macro code here is commented out and the preprocessor output is pasted below it 349 // (effectively to the end of the function) 350 // We need to find out what is doing on here and move back to the macro version. 351 #if 0 352 switch (type) 353 { 343 354 case PS_TYPE_S8: 344 355 PSIMAGE_ELEMENT_ASSIGN(output,input,S8); … … 355 366 case PS_TYPE_U8: 356 367 PSIMAGE_ELEMENT_ASSIGN(output,input,U8); 357 break;358 368 case PS_TYPE_U16: 359 369 PSIMAGE_ELEMENT_ASSIGN(output,input,U16); … … 381 391 psImageFree(output); 382 392 return NULL; 393 } 394 #endif 395 396 #if 1 397 switch (type) { 398 case PS_TYPE_S8: 399 switch (input->type.type) { 400 case PS_TYPE_S8: { 401 psS8 *in; 402 psS8 *out; 403 for (int row = 0; row < numRows; row++) { 404 in = input->data.S8[row]; 405 out = output->data.S8[row]; 406 for (int col = 0; col < numCols; col++) { 407 out[col] = (psS8) in[col]; 408 } 409 } 410 }; 411 break; 412 case PS_TYPE_S16: { 413 psS16 *in; 414 psS8 *out; 415 for (int row = 0; row < numRows; row++) { 416 in = input->data.S16[row]; 417 out = output->data.S8[row]; 418 for (int col = 0; col < numCols; col++) { 419 out[col] = (psS8) in[col]; 420 } 421 } 422 }; 423 break; 424 case PS_TYPE_S32: { 425 psS32 *in; 426 psS8 *out; 427 for (int row = 0; row < numRows; row++) { 428 in = input->data.S32[row]; 429 out = output->data.S8[row]; 430 for (int col = 0; col < numCols; col++) { 431 out[col] = (psS8) in[col]; 432 } 433 } 434 }; 435 break; 436 case PS_TYPE_S64: { 437 psS64 *in; 438 psS8 *out; 439 for (int row = 0; row < numRows; row++) { 440 in = input->data.S64[row]; 441 out = output->data.S8[row]; 442 for (int col = 0; col < numCols; col++) { 443 out[col] = (psS8) in[col]; 444 } 445 } 446 }; 447 break; 448 case PS_TYPE_U8: { 449 psU8 *in; 450 psS8 *out; 451 for (int row = 0; row < numRows; row++) { 452 in = input->data.U8[row]; 453 out = output->data.S8[row]; 454 for (int col = 0; col < numCols; col++) { 455 out[col] = (psS8) in[col]; 456 } 457 } 458 }; 459 break; 460 case PS_TYPE_U16: { 461 psU16 *in; 462 psS8 *out; 463 for (int row = 0; row < numRows; row++) { 464 in = input->data.U16[row]; 465 out = output->data.S8[row]; 466 for (int col = 0; col < numCols; col++) { 467 out[col] = (psS8) in[col]; 468 } 469 } 470 }; 471 break; 472 case PS_TYPE_U32: { 473 psU32 *in; 474 psS8 *out; 475 for (int row = 0; row < numRows; row++) { 476 in = input->data.U32[row]; 477 out = output->data.S8[row]; 478 for (int col = 0; col < numCols; col++) { 479 out[col] = (psS8) in[col]; 480 } 481 } 482 }; 483 break; 484 case PS_TYPE_U64: { 485 psU64 *in; 486 psS8 *out; 487 for (int row = 0; row < numRows; row++) { 488 in = input->data.U64[row]; 489 out = output->data.S8[row]; 490 for (int col = 0; col < numCols; col++) { 491 out[col] = (psS8) in[col]; 492 } 493 } 494 }; 495 break; 496 case PS_TYPE_F32: { 497 psF32 *in; 498 psS8 *out; 499 for (int row = 0; row < numRows; row++) { 500 in = input->data.F32[row]; 501 out = output->data.S8[row]; 502 for (int col = 0; col < numCols; col++) { 503 out[col] = (psS8) in[col]; 504 } 505 } 506 }; 507 break; 508 case PS_TYPE_F64: { 509 psF64 *in; 510 psS8 *out; 511 for (int row = 0; row < numRows; row++) { 512 in = input->data.F64[row]; 513 out = output->data.S8[row]; 514 for (int col = 0; col < numCols; col++) { 515 out[col] = (psS8) in[col]; 516 } 517 } 518 }; 519 break; 520 case PS_TYPE_C32: { 521 psC32 *in; 522 psS8 *out; 523 for (int row = 0; row < numRows; row++) { 524 in = input->data.C32[row]; 525 out = output->data.S8[row]; 526 for (int col = 0; col < numCols; col++) { 527 out[col] = (psS8) in[col]; 528 } 529 } 530 }; 531 break; 532 case PS_TYPE_PTR: 533 psError (__func__, "Can't copy image from a matrix of pointers."); 534 psImageFree (output); 535 return ((void *) 0); 536 default: 537 break; 538 }; 539 break; 540 case PS_TYPE_S16: 541 switch (input->type.type) { 542 case PS_TYPE_S8: { 543 psS8 *in; 544 psS16 *out; 545 for (int row = 0; row < numRows; row++) { 546 in = input->data.S8[row]; 547 out = output->data.S16[row]; 548 for (int col = 0; col < numCols; col++) { 549 out[col] = (psS16) in[col]; 550 } 551 } 552 }; 553 break; 554 case PS_TYPE_S16: { 555 psS16 *in; 556 psS16 *out; 557 for (int row = 0; row < numRows; row++) { 558 in = input->data.S16[row]; 559 out = output->data.S16[row]; 560 for (int col = 0; col < numCols; col++) { 561 out[col] = (psS16) in[col]; 562 } 563 } 564 }; 565 break; 566 case PS_TYPE_S32: { 567 psS32 *in; 568 psS16 *out; 569 for (int row = 0; row < numRows; row++) { 570 in = input->data.S32[row]; 571 out = output->data.S16[row]; 572 for (int col = 0; col < numCols; col++) { 573 out[col] = (psS16) in[col]; 574 } 575 } 576 }; 577 break; 578 case PS_TYPE_S64: { 579 psS64 *in; 580 psS16 *out; 581 for (int row = 0; row < numRows; row++) { 582 in = input->data.S64[row]; 583 out = output->data.S16[row]; 584 for (int col = 0; col < numCols; col++) { 585 out[col] = (psS16) in[col]; 586 } 587 } 588 }; 589 break; 590 case PS_TYPE_U8: { 591 psU8 *in; 592 psS16 *out; 593 for (int row = 0; row < numRows; row++) { 594 in = input->data.U8[row]; 595 out = output->data.S16[row]; 596 for (int col = 0; col < numCols; col++) { 597 out[col] = (psS16) in[col]; 598 } 599 } 600 }; 601 break; 602 case PS_TYPE_U16: { 603 psU16 *in; 604 psS16 *out; 605 for (int row = 0; row < numRows; row++) { 606 in = input->data.U16[row]; 607 out = output->data.S16[row]; 608 for (int col = 0; col < numCols; col++) { 609 out[col] = (psS16) in[col]; 610 } 611 } 612 }; 613 break; 614 case PS_TYPE_U32: { 615 psU32 *in; 616 psS16 *out; 617 for (int row = 0; row < numRows; row++) { 618 in = input->data.U32[row]; 619 out = output->data.S16[row]; 620 for (int col = 0; col < numCols; col++) { 621 out[col] = (psS16) in[col]; 622 } 623 } 624 }; 625 break; 626 case PS_TYPE_U64: { 627 psU64 *in; 628 psS16 *out; 629 for (int row = 0; row < numRows; row++) { 630 in = input->data.U64[row]; 631 out = output->data.S16[row]; 632 for (int col = 0; col < numCols; col++) { 633 out[col] = (psS16) in[col]; 634 } 635 } 636 }; 637 break; 638 case PS_TYPE_F32: { 639 psF32 *in; 640 psS16 *out; 641 for (int row = 0; row < numRows; row++) { 642 in = input->data.F32[row]; 643 out = output->data.S16[row]; 644 for (int col = 0; col < numCols; col++) { 645 out[col] = (psS16) in[col]; 646 } 647 } 648 }; 649 break; 650 case PS_TYPE_F64: { 651 psF64 *in; 652 psS16 *out; 653 for (int row = 0; row < numRows; row++) { 654 in = input->data.F64[row]; 655 out = output->data.S16[row]; 656 for (int col = 0; col < numCols; col++) { 657 out[col] = (psS16) in[col]; 658 } 659 } 660 }; 661 break; 662 case PS_TYPE_C32: { 663 psC32 *in; 664 psS16 *out; 665 for (int row = 0; row < numRows; row++) { 666 in = input->data.C32[row]; 667 out = output->data.S16[row]; 668 for (int col = 0; col < numCols; col++) { 669 out[col] = (psS16) in[col]; 670 } 671 } 672 }; 673 break; 674 case PS_TYPE_PTR: 675 psError (__func__, "Can't copy image from a matrix of pointers."); 676 psImageFree (output); 677 return ((void *) 0); 678 default: 679 break; 680 }; 681 break; 682 case PS_TYPE_S32: 683 switch (input->type.type) { 684 case PS_TYPE_S8: { 685 psS8 *in; 686 psS32 *out; 687 for (int row = 0; row < numRows; row++) { 688 in = input->data.S8[row]; 689 out = output->data.S32[row]; 690 for (int col = 0; col < numCols; col++) { 691 out[col] = (psS32) in[col]; 692 } 693 } 694 }; 695 break; 696 case PS_TYPE_S16: { 697 psS16 *in; 698 psS32 *out; 699 for (int row = 0; row < numRows; row++) { 700 in = input->data.S16[row]; 701 out = output->data.S32[row]; 702 for (int col = 0; col < numCols; col++) { 703 out[col] = (psS32) in[col]; 704 } 705 } 706 }; 707 break; 708 case PS_TYPE_S32: { 709 psS32 *in; 710 psS32 *out; 711 for (int row = 0; row < numRows; row++) { 712 in = input->data.S32[row]; 713 out = output->data.S32[row]; 714 for (int col = 0; col < numCols; col++) { 715 out[col] = (psS32) in[col]; 716 } 717 } 718 }; 719 break; 720 case PS_TYPE_S64: { 721 psS64 *in; 722 psS32 *out; 723 for (int row = 0; row < numRows; row++) { 724 in = input->data.S64[row]; 725 out = output->data.S32[row]; 726 for (int col = 0; col < numCols; col++) { 727 out[col] = (psS32) in[col]; 728 } 729 } 730 }; 731 break; 732 case PS_TYPE_U8: { 733 psU8 *in; 734 psS32 *out; 735 for (int row = 0; row < numRows; row++) { 736 in = input->data.U8[row]; 737 out = output->data.S32[row]; 738 for (int col = 0; col < numCols; col++) { 739 out[col] = (psS32) in[col]; 740 } 741 } 742 }; 743 break; 744 case PS_TYPE_U16: { 745 psU16 *in; 746 psS32 *out; 747 for (int row = 0; row < numRows; row++) { 748 in = input->data.U16[row]; 749 out = output->data.S32[row]; 750 for (int col = 0; col < numCols; col++) { 751 out[col] = (psS32) in[col]; 752 } 753 } 754 }; 755 break; 756 case PS_TYPE_U32: { 757 psU32 *in; 758 psS32 *out; 759 for (int row = 0; row < numRows; row++) { 760 in = input->data.U32[row]; 761 out = output->data.S32[row]; 762 for (int col = 0; col < numCols; col++) { 763 out[col] = (psS32) in[col]; 764 } 765 } 766 }; 767 break; 768 case PS_TYPE_U64: { 769 psU64 *in; 770 psS32 *out; 771 for (int row = 0; row < numRows; row++) { 772 in = input->data.U64[row]; 773 out = output->data.S32[row]; 774 for (int col = 0; col < numCols; col++) { 775 out[col] = (psS32) in[col]; 776 } 777 } 778 }; 779 break; 780 case PS_TYPE_F32: { 781 psF32 *in; 782 psS32 *out; 783 for (int row = 0; row < numRows; row++) { 784 in = input->data.F32[row]; 785 out = output->data.S32[row]; 786 for (int col = 0; col < numCols; col++) { 787 out[col] = (psS32) in[col]; 788 } 789 } 790 }; 791 break; 792 case PS_TYPE_F64: { 793 psF64 *in; 794 psS32 *out; 795 for (int row = 0; row < numRows; row++) { 796 in = input->data.F64[row]; 797 out = output->data.S32[row]; 798 for (int col = 0; col < numCols; col++) { 799 out[col] = (psS32) in[col]; 800 } 801 } 802 }; 803 break; 804 case PS_TYPE_C32: { 805 psC32 *in; 806 psS32 *out; 807 for (int row = 0; row < numRows; row++) { 808 in = input->data.C32[row]; 809 out = output->data.S32[row]; 810 for (int col = 0; col < numCols; col++) { 811 out[col] = (psS32) in[col]; 812 } 813 } 814 }; 815 break; 816 case PS_TYPE_PTR: 817 psError (__func__, "Can't copy image from a matrix of pointers."); 818 psImageFree (output); 819 return ((void *) 0); 820 default: 821 break; 822 }; 823 break; 824 case PS_TYPE_S64: 825 switch (input->type.type) { 826 case PS_TYPE_S8: { 827 psS8 *in; 828 psS64 *out; 829 for (int row = 0; row < numRows; row++) { 830 in = input->data.S8[row]; 831 out = output->data.S64[row]; 832 for (int col = 0; col < numCols; col++) { 833 out[col] = (psS64) in[col]; 834 } 835 } 836 }; 837 break; 838 case PS_TYPE_S16: { 839 psS16 *in; 840 psS64 *out; 841 for (int row = 0; row < numRows; row++) { 842 in = input->data.S16[row]; 843 out = output->data.S64[row]; 844 for (int col = 0; col < numCols; col++) { 845 out[col] = (psS64) in[col]; 846 } 847 } 848 }; 849 break; 850 case PS_TYPE_S32: { 851 psS32 *in; 852 psS64 *out; 853 for (int row = 0; row < numRows; row++) { 854 in = input->data.S32[row]; 855 out = output->data.S64[row]; 856 for (int col = 0; col < numCols; col++) { 857 out[col] = (psS64) in[col]; 858 } 859 } 860 }; 861 break; 862 case PS_TYPE_S64: { 863 psS64 *in; 864 psS64 *out; 865 for (int row = 0; row < numRows; row++) { 866 in = input->data.S64[row]; 867 out = output->data.S64[row]; 868 for (int col = 0; col < numCols; col++) { 869 out[col] = (psS64) in[col]; 870 } 871 } 872 }; 873 break; 874 case PS_TYPE_U8: { 875 psU8 *in; 876 psS64 *out; 877 for (int row = 0; row < numRows; row++) { 878 in = input->data.U8[row]; 879 out = output->data.S64[row]; 880 for (int col = 0; col < numCols; col++) { 881 out[col] = (psS64) in[col]; 882 } 883 } 884 }; 885 break; 886 case PS_TYPE_U16: { 887 psU16 *in; 888 psS64 *out; 889 for (int row = 0; row < numRows; row++) { 890 in = input->data.U16[row]; 891 out = output->data.S64[row]; 892 for (int col = 0; col < numCols; col++) { 893 out[col] = (psS64) in[col]; 894 } 895 } 896 }; 897 break; 898 case PS_TYPE_U32: { 899 psU32 *in; 900 psS64 *out; 901 for (int row = 0; row < numRows; row++) { 902 in = input->data.U32[row]; 903 out = output->data.S64[row]; 904 for (int col = 0; col < numCols; col++) { 905 out[col] = (psS64) in[col]; 906 } 907 } 908 }; 909 break; 910 case PS_TYPE_U64: { 911 psU64 *in; 912 psS64 *out; 913 for (int row = 0; row < numRows; row++) { 914 in = input->data.U64[row]; 915 out = output->data.S64[row]; 916 for (int col = 0; col < numCols; col++) { 917 out[col] = (psS64) in[col]; 918 } 919 } 920 }; 921 break; 922 case PS_TYPE_F32: { 923 psF32 *in; 924 psS64 *out; 925 for (int row = 0; row < numRows; row++) { 926 in = input->data.F32[row]; 927 out = output->data.S64[row]; 928 for (int col = 0; col < numCols; col++) { 929 out[col] = (psS64) in[col]; 930 } 931 } 932 }; 933 break; 934 case PS_TYPE_F64: { 935 psF64 *in; 936 psS64 *out; 937 for (int row = 0; row < numRows; row++) { 938 in = input->data.F64[row]; 939 out = output->data.S64[row]; 940 for (int col = 0; col < numCols; col++) { 941 out[col] = (psS64) in[col]; 942 } 943 } 944 }; 945 break; 946 case PS_TYPE_C32: { 947 psC32 *in; 948 psS64 *out; 949 for (int row = 0; row < numRows; row++) { 950 in = input->data.C32[row]; 951 out = output->data.S64[row]; 952 for (int col = 0; col < numCols; col++) { 953 out[col] = (psS64) in[col]; 954 } 955 } 956 }; 957 break; 958 case PS_TYPE_PTR: 959 psError (__func__, "Can't copy image from a matrix of pointers."); 960 psImageFree (output); 961 return ((void *) 0); 962 default: 963 break; 964 }; 965 break; 966 case PS_TYPE_U8: 967 switch (input->type.type) { 968 case PS_TYPE_S8: { 969 psS8 *in; 970 psU8 *out; 971 for (int row = 0; row < numRows; row++) { 972 in = input->data.S8[row]; 973 out = output->data.U8[row]; 974 for (int col = 0; col < numCols; col++) { 975 out[col] = (psU8) in[col]; 976 } 977 } 978 }; 979 break; 980 case PS_TYPE_S16: { 981 psS16 *in; 982 psU8 *out; 983 for (int row = 0; row < numRows; row++) { 984 in = input->data.S16[row]; 985 out = output->data.U8[row]; 986 for (int col = 0; col < numCols; col++) { 987 out[col] = (psU8) in[col]; 988 } 989 } 990 }; 991 break; 992 case PS_TYPE_S32: { 993 psS32 *in; 994 psU8 *out; 995 for (int row = 0; row < numRows; row++) { 996 in = input->data.S32[row]; 997 out = output->data.U8[row]; 998 for (int col = 0; col < numCols; col++) { 999 out[col] = (psU8) in[col]; 1000 } 1001 } 1002 }; 1003 break; 1004 case PS_TYPE_S64: { 1005 psS64 *in; 1006 psU8 *out; 1007 for (int row = 0; row < numRows; row++) { 1008 in = input->data.S64[row]; 1009 out = output->data.U8[row]; 1010 for (int col = 0; col < numCols; col++) { 1011 out[col] = (psU8) in[col]; 1012 } 1013 } 1014 }; 1015 break; 1016 case PS_TYPE_U8: { 1017 psU8 *in; 1018 psU8 *out; 1019 for (int row = 0; row < numRows; row++) { 1020 in = input->data.U8[row]; 1021 out = output->data.U8[row]; 1022 for (int col = 0; col < numCols; col++) { 1023 out[col] = (psU8) in[col]; 1024 } 1025 } 1026 }; 1027 break; 1028 case PS_TYPE_U16: { 1029 psU16 *in; 1030 psU8 *out; 1031 for (int row = 0; row < numRows; row++) { 1032 in = input->data.U16[row]; 1033 out = output->data.U8[row]; 1034 for (int col = 0; col < numCols; col++) { 1035 out[col] = (psU8) in[col]; 1036 } 1037 } 1038 }; 1039 break; 1040 case PS_TYPE_U32: { 1041 psU32 *in; 1042 psU8 *out; 1043 for (int row = 0; row < numRows; row++) { 1044 in = input->data.U32[row]; 1045 out = output->data.U8[row]; 1046 for (int col = 0; col < numCols; col++) { 1047 out[col] = (psU8) in[col]; 1048 } 1049 } 1050 }; 1051 break; 1052 case PS_TYPE_U64: { 1053 psU64 *in; 1054 psU8 *out; 1055 for (int row = 0; row < numRows; row++) { 1056 in = input->data.U64[row]; 1057 out = output->data.U8[row]; 1058 for (int col = 0; col < numCols; col++) { 1059 out[col] = (psU8) in[col]; 1060 } 1061 } 1062 }; 1063 break; 1064 case PS_TYPE_F32: { 1065 psF32 *in; 1066 psU8 *out; 1067 for (int row = 0; row < numRows; row++) { 1068 in = input->data.F32[row]; 1069 out = output->data.U8[row]; 1070 for (int col = 0; col < numCols; col++) { 1071 out[col] = (psU8) in[col]; 1072 } 1073 } 1074 }; 1075 break; 1076 case PS_TYPE_F64: { 1077 psF64 *in; 1078 psU8 *out; 1079 for (int row = 0; row < numRows; row++) { 1080 in = input->data.F64[row]; 1081 out = output->data.U8[row]; 1082 for (int col = 0; col < numCols; col++) { 1083 out[col] = (psU8) in[col]; 1084 } 1085 } 1086 }; 1087 break; 1088 case PS_TYPE_C32: { 1089 psC32 *in; 1090 psU8 *out; 1091 for (int row = 0; row < numRows; row++) { 1092 in = input->data.C32[row]; 1093 out = output->data.U8[row]; 1094 for (int col = 0; col < numCols; col++) { 1095 out[col] = (psU8) in[col]; 1096 } 1097 } 1098 }; 1099 break; 1100 case PS_TYPE_PTR: 1101 psError (__func__, "Can't copy image from a matrix of pointers."); 1102 psImageFree (output); 1103 return ((void *) 0); 1104 default: 1105 break; 1106 }; 1107 break; 1108 case PS_TYPE_U16: 1109 switch (input->type.type) { 1110 case PS_TYPE_S8: { 1111 psS8 *in; 1112 psU16 *out; 1113 for (int row = 0; row < numRows; row++) { 1114 in = input->data.S8[row]; 1115 out = output->data.U16[row]; 1116 for (int col = 0; col < numCols; col++) { 1117 out[col] = (psU16) in[col]; 1118 } 1119 } 1120 }; 1121 break; 1122 case PS_TYPE_S16: { 1123 psS16 *in; 1124 psU16 *out; 1125 for (int row = 0; row < numRows; row++) { 1126 in = input->data.S16[row]; 1127 out = output->data.U16[row]; 1128 for (int col = 0; col < numCols; col++) { 1129 out[col] = (psU16) in[col]; 1130 } 1131 } 1132 }; 1133 break; 1134 case PS_TYPE_S32: { 1135 psS32 *in; 1136 psU16 *out; 1137 for (int row = 0; row < numRows; row++) { 1138 in = input->data.S32[row]; 1139 out = output->data.U16[row]; 1140 for (int col = 0; col < numCols; col++) { 1141 out[col] = (psU16) in[col]; 1142 } 1143 } 1144 }; 1145 break; 1146 case PS_TYPE_S64: { 1147 psS64 *in; 1148 psU16 *out; 1149 for (int row = 0; row < numRows; row++) { 1150 in = input->data.S64[row]; 1151 out = output->data.U16[row]; 1152 for (int col = 0; col < numCols; col++) { 1153 out[col] = (psU16) in[col]; 1154 } 1155 } 1156 }; 1157 break; 1158 case PS_TYPE_U8: { 1159 psU8 *in; 1160 psU16 *out; 1161 for (int row = 0; row < numRows; row++) { 1162 in = input->data.U8[row]; 1163 out = output->data.U16[row]; 1164 for (int col = 0; col < numCols; col++) { 1165 out[col] = (psU16) in[col]; 1166 } 1167 } 1168 }; 1169 break; 1170 case PS_TYPE_U16: { 1171 psU16 *in; 1172 psU16 *out; 1173 for (int row = 0; row < numRows; row++) { 1174 in = input->data.U16[row]; 1175 out = output->data.U16[row]; 1176 for (int col = 0; col < numCols; col++) { 1177 out[col] = (psU16) in[col]; 1178 } 1179 } 1180 }; 1181 break; 1182 case PS_TYPE_U32: { 1183 psU32 *in; 1184 psU16 *out; 1185 for (int row = 0; row < numRows; row++) { 1186 in = input->data.U32[row]; 1187 out = output->data.U16[row]; 1188 for (int col = 0; col < numCols; col++) { 1189 out[col] = (psU16) in[col]; 1190 } 1191 } 1192 }; 1193 break; 1194 case PS_TYPE_U64: { 1195 psU64 *in; 1196 psU16 *out; 1197 for (int row = 0; row < numRows; row++) { 1198 in = input->data.U64[row]; 1199 out = output->data.U16[row]; 1200 for (int col = 0; col < numCols; col++) { 1201 out[col] = (psU16) in[col]; 1202 } 1203 } 1204 }; 1205 break; 1206 case PS_TYPE_F32: { 1207 psF32 *in; 1208 psU16 *out; 1209 for (int row = 0; row < numRows; row++) { 1210 in = input->data.F32[row]; 1211 out = output->data.U16[row]; 1212 for (int col = 0; col < numCols; col++) { 1213 out[col] = (psU16) in[col]; 1214 } 1215 } 1216 }; 1217 break; 1218 case PS_TYPE_F64: { 1219 psF64 *in; 1220 psU16 *out; 1221 for (int row = 0; row < numRows; row++) { 1222 in = input->data.F64[row]; 1223 out = output->data.U16[row]; 1224 for (int col = 0; col < numCols; col++) { 1225 out[col] = (psU16) in[col]; 1226 } 1227 } 1228 }; 1229 break; 1230 case PS_TYPE_C32: { 1231 psC32 *in; 1232 psU16 *out; 1233 for (int row = 0; row < numRows; row++) { 1234 in = input->data.C32[row]; 1235 out = output->data.U16[row]; 1236 for (int col = 0; col < numCols; col++) { 1237 out[col] = (psU16) in[col]; 1238 } 1239 } 1240 }; 1241 break; 1242 case PS_TYPE_PTR: 1243 psError (__func__, "Can't copy image from a matrix of pointers."); 1244 psImageFree (output); 1245 return ((void *) 0); 1246 default: 1247 break; 1248 }; 1249 break; 1250 case PS_TYPE_U32: 1251 switch (input->type.type) { 1252 case PS_TYPE_S8: { 1253 psS8 *in; 1254 psU32 *out; 1255 for (int row = 0; row < numRows; row++) { 1256 in = input->data.S8[row]; 1257 out = output->data.U32[row]; 1258 for (int col = 0; col < numCols; col++) { 1259 out[col] = (psU32) in[col]; 1260 } 1261 } 1262 }; 1263 break; 1264 case PS_TYPE_S16: { 1265 psS16 *in; 1266 psU32 *out; 1267 for (int row = 0; row < numRows; row++) { 1268 in = input->data.S16[row]; 1269 out = output->data.U32[row]; 1270 for (int col = 0; col < numCols; col++) { 1271 out[col] = (psU32) in[col]; 1272 } 1273 } 1274 }; 1275 break; 1276 case PS_TYPE_S32: { 1277 psS32 *in; 1278 psU32 *out; 1279 for (int row = 0; row < numRows; row++) { 1280 in = input->data.S32[row]; 1281 out = output->data.U32[row]; 1282 for (int col = 0; col < numCols; col++) { 1283 out[col] = (psU32) in[col]; 1284 } 1285 } 1286 }; 1287 break; 1288 case PS_TYPE_S64: { 1289 psS64 *in; 1290 psU32 *out; 1291 for (int row = 0; row < numRows; row++) { 1292 in = input->data.S64[row]; 1293 out = output->data.U32[row]; 1294 for (int col = 0; col < numCols; col++) { 1295 out[col] = (psU32) in[col]; 1296 } 1297 } 1298 }; 1299 break; 1300 case PS_TYPE_U8: { 1301 psU8 *in; 1302 psU32 *out; 1303 for (int row = 0; row < numRows; row++) { 1304 in = input->data.U8[row]; 1305 out = output->data.U32[row]; 1306 for (int col = 0; col < numCols; col++) { 1307 out[col] = (psU32) in[col]; 1308 } 1309 } 1310 }; 1311 break; 1312 case PS_TYPE_U16: { 1313 psU16 *in; 1314 psU32 *out; 1315 for (int row = 0; row < numRows; row++) { 1316 in = input->data.U16[row]; 1317 out = output->data.U32[row]; 1318 for (int col = 0; col < numCols; col++) { 1319 out[col] = (psU32) in[col]; 1320 } 1321 } 1322 }; 1323 break; 1324 case PS_TYPE_U32: { 1325 psU32 *in; 1326 psU32 *out; 1327 for (int row = 0; row < numRows; row++) { 1328 in = input->data.U32[row]; 1329 out = output->data.U32[row]; 1330 for (int col = 0; col < numCols; col++) { 1331 out[col] = (psU32) in[col]; 1332 } 1333 } 1334 }; 1335 break; 1336 case PS_TYPE_U64: { 1337 psU64 *in; 1338 psU32 *out; 1339 for (int row = 0; row < numRows; row++) { 1340 in = input->data.U64[row]; 1341 out = output->data.U32[row]; 1342 for (int col = 0; col < numCols; col++) { 1343 out[col] = (psU32) in[col]; 1344 } 1345 } 1346 }; 1347 break; 1348 case PS_TYPE_F32: { 1349 psF32 *in; 1350 psU32 *out; 1351 for (int row = 0; row < numRows; row++) { 1352 in = input->data.F32[row]; 1353 out = output->data.U32[row]; 1354 for (int col = 0; col < numCols; col++) { 1355 out[col] = (psU32) in[col]; 1356 } 1357 } 1358 }; 1359 break; 1360 case PS_TYPE_F64: { 1361 psF64 *in; 1362 psU32 *out; 1363 for (int row = 0; row < numRows; row++) { 1364 in = input->data.F64[row]; 1365 out = output->data.U32[row]; 1366 for (int col = 0; col < numCols; col++) { 1367 out[col] = (psU32) in[col]; 1368 } 1369 } 1370 }; 1371 break; 1372 case PS_TYPE_C32: { 1373 psC32 *in; 1374 psU32 *out; 1375 for (int row = 0; row < numRows; row++) { 1376 in = input->data.C32[row]; 1377 out = output->data.U32[row]; 1378 for (int col = 0; col < numCols; col++) { 1379 out[col] = (psU32) in[col]; 1380 } 1381 } 1382 }; 1383 break; 1384 case PS_TYPE_PTR: 1385 psError (__func__, "Can't copy image from a matrix of pointers."); 1386 psImageFree (output); 1387 return ((void *) 0); 1388 default: 1389 break; 1390 }; 1391 break; 1392 case PS_TYPE_U64: 1393 switch (input->type.type) { 1394 case PS_TYPE_S8: { 1395 psS8 *in; 1396 psU64 *out; 1397 for (int row = 0; row < numRows; row++) { 1398 in = input->data.S8[row]; 1399 out = output->data.U64[row]; 1400 for (int col = 0; col < numCols; col++) { 1401 out[col] = (psU64) in[col]; 1402 } 1403 } 1404 }; 1405 break; 1406 case PS_TYPE_S16: { 1407 psS16 *in; 1408 psU64 *out; 1409 for (int row = 0; row < numRows; row++) { 1410 in = input->data.S16[row]; 1411 out = output->data.U64[row]; 1412 for (int col = 0; col < numCols; col++) { 1413 out[col] = (psU64) in[col]; 1414 } 1415 } 1416 }; 1417 break; 1418 case PS_TYPE_S32: { 1419 psS32 *in; 1420 psU64 *out; 1421 for (int row = 0; row < numRows; row++) { 1422 in = input->data.S32[row]; 1423 out = output->data.U64[row]; 1424 for (int col = 0; col < numCols; col++) { 1425 out[col] = (psU64) in[col]; 1426 } 1427 } 1428 }; 1429 break; 1430 case PS_TYPE_S64: { 1431 psS64 *in; 1432 psU64 *out; 1433 for (int row = 0; row < numRows; row++) { 1434 in = input->data.S64[row]; 1435 out = output->data.U64[row]; 1436 for (int col = 0; col < numCols; col++) { 1437 out[col] = (psU64) in[col]; 1438 } 1439 } 1440 }; 1441 break; 1442 case PS_TYPE_U8: { 1443 psU8 *in; 1444 psU64 *out; 1445 for (int row = 0; row < numRows; row++) { 1446 in = input->data.U8[row]; 1447 out = output->data.U64[row]; 1448 for (int col = 0; col < numCols; col++) { 1449 out[col] = (psU64) in[col]; 1450 } 1451 } 1452 }; 1453 break; 1454 case PS_TYPE_U16: { 1455 psU16 *in; 1456 psU64 *out; 1457 for (int row = 0; row < numRows; row++) { 1458 in = input->data.U16[row]; 1459 out = output->data.U64[row]; 1460 for (int col = 0; col < numCols; col++) { 1461 out[col] = (psU64) in[col]; 1462 } 1463 } 1464 }; 1465 break; 1466 case PS_TYPE_U32: { 1467 psU32 *in; 1468 psU64 *out; 1469 for (int row = 0; row < numRows; row++) { 1470 in = input->data.U32[row]; 1471 out = output->data.U64[row]; 1472 for (int col = 0; col < numCols; col++) { 1473 out[col] = (psU64) in[col]; 1474 } 1475 } 1476 }; 1477 break; 1478 case PS_TYPE_U64: { 1479 psU64 *in; 1480 psU64 *out; 1481 for (int row = 0; row < numRows; row++) { 1482 in = input->data.U64[row]; 1483 out = output->data.U64[row]; 1484 for (int col = 0; col < numCols; col++) { 1485 out[col] = (psU64) in[col]; 1486 } 1487 } 1488 }; 1489 break; 1490 case PS_TYPE_F32: { 1491 psF32 *in; 1492 psU64 *out; 1493 for (int row = 0; row < numRows; row++) { 1494 in = input->data.F32[row]; 1495 out = output->data.U64[row]; 1496 for (int col = 0; col < numCols; col++) { 1497 out[col] = (psU64) in[col]; 1498 } 1499 } 1500 }; 1501 break; 1502 case PS_TYPE_F64: { 1503 psF64 *in; 1504 psU64 *out; 1505 for (int row = 0; row < numRows; row++) { 1506 in = input->data.F64[row]; 1507 out = output->data.U64[row]; 1508 for (int col = 0; col < numCols; col++) { 1509 out[col] = (psU64) in[col]; 1510 } 1511 } 1512 }; 1513 break; 1514 case PS_TYPE_C32: { 1515 psC32 *in; 1516 psU64 *out; 1517 for (int row = 0; row < numRows; row++) { 1518 in = input->data.C32[row]; 1519 out = output->data.U64[row]; 1520 for (int col = 0; col < numCols; col++) { 1521 out[col] = (psU64) in[col]; 1522 } 1523 } 1524 }; 1525 break; 1526 case PS_TYPE_PTR: 1527 psError (__func__, "Can't copy image from a matrix of pointers."); 1528 psImageFree (output); 1529 return ((void *) 0); 1530 default: 1531 break; 1532 }; 1533 break; 1534 case PS_TYPE_F32: 1535 switch (input->type.type) { 1536 case PS_TYPE_S8: { 1537 psS8 *in; 1538 psF32 *out; 1539 for (int row = 0; row < numRows; row++) { 1540 in = input->data.S8[row]; 1541 out = output->data.F32[row]; 1542 for (int col = 0; col < numCols; col++) { 1543 out[col] = (psF32) in[col]; 1544 } 1545 } 1546 }; 1547 break; 1548 case PS_TYPE_S16: { 1549 psS16 *in; 1550 psF32 *out; 1551 for (int row = 0; row < numRows; row++) { 1552 in = input->data.S16[row]; 1553 out = output->data.F32[row]; 1554 for (int col = 0; col < numCols; col++) { 1555 out[col] = (psF32) in[col]; 1556 } 1557 } 1558 }; 1559 break; 1560 case PS_TYPE_S32: { 1561 psS32 *in; 1562 psF32 *out; 1563 for (int row = 0; row < numRows; row++) { 1564 in = input->data.S32[row]; 1565 out = output->data.F32[row]; 1566 for (int col = 0; col < numCols; col++) { 1567 out[col] = (psF32) in[col]; 1568 } 1569 } 1570 }; 1571 break; 1572 case PS_TYPE_S64: { 1573 psS64 *in; 1574 psF32 *out; 1575 for (int row = 0; row < numRows; row++) { 1576 in = input->data.S64[row]; 1577 out = output->data.F32[row]; 1578 for (int col = 0; col < numCols; col++) { 1579 out[col] = (psF32) in[col]; 1580 } 1581 } 1582 }; 1583 break; 1584 case PS_TYPE_U8: { 1585 psU8 *in; 1586 psF32 *out; 1587 for (int row = 0; row < numRows; row++) { 1588 in = input->data.U8[row]; 1589 out = output->data.F32[row]; 1590 for (int col = 0; col < numCols; col++) { 1591 out[col] = (psF32) in[col]; 1592 } 1593 } 1594 }; 1595 break; 1596 case PS_TYPE_U16: { 1597 psU16 *in; 1598 psF32 *out; 1599 for (int row = 0; row < numRows; row++) { 1600 in = input->data.U16[row]; 1601 out = output->data.F32[row]; 1602 for (int col = 0; col < numCols; col++) { 1603 out[col] = (psF32) in[col]; 1604 } 1605 } 1606 }; 1607 break; 1608 case PS_TYPE_U32: { 1609 psU32 *in; 1610 psF32 *out; 1611 for (int row = 0; row < numRows; row++) { 1612 in = input->data.U32[row]; 1613 out = output->data.F32[row]; 1614 for (int col = 0; col < numCols; col++) { 1615 out[col] = (psF32) in[col]; 1616 } 1617 } 1618 }; 1619 break; 1620 case PS_TYPE_U64: { 1621 psU64 *in; 1622 psF32 *out; 1623 for (int row = 0; row < numRows; row++) { 1624 in = input->data.U64[row]; 1625 out = output->data.F32[row]; 1626 for (int col = 0; col < numCols; col++) { 1627 out[col] = (psF32) in[col]; 1628 } 1629 } 1630 }; 1631 break; 1632 case PS_TYPE_F32: { 1633 psF32 *in; 1634 psF32 *out; 1635 for (int row = 0; row < numRows; row++) { 1636 in = input->data.F32[row]; 1637 out = output->data.F32[row]; 1638 for (int col = 0; col < numCols; col++) { 1639 out[col] = (psF32) in[col]; 1640 } 1641 } 1642 }; 1643 break; 1644 case PS_TYPE_F64: { 1645 psF64 *in; 1646 psF32 *out; 1647 for (int row = 0; row < numRows; row++) { 1648 in = input->data.F64[row]; 1649 out = output->data.F32[row]; 1650 for (int col = 0; col < numCols; col++) { 1651 out[col] = (psF32) in[col]; 1652 } 1653 } 1654 }; 1655 break; 1656 case PS_TYPE_C32: { 1657 psC32 *in; 1658 psF32 *out; 1659 for (int row = 0; row < numRows; row++) { 1660 in = input->data.C32[row]; 1661 out = output->data.F32[row]; 1662 for (int col = 0; col < numCols; col++) { 1663 out[col] = (psF32) in[col]; 1664 } 1665 } 1666 }; 1667 break; 1668 case PS_TYPE_PTR: 1669 psError (__func__, "Can't copy image from a matrix of pointers."); 1670 psImageFree (output); 1671 return ((void *) 0); 1672 default: 1673 break; 1674 }; 1675 break; 1676 case PS_TYPE_F64: 1677 switch (input->type.type) { 1678 case PS_TYPE_S8: { 1679 psS8 *in; 1680 psF64 *out; 1681 for (int row = 0; row < numRows; row++) { 1682 in = input->data.S8[row]; 1683 out = output->data.F64[row]; 1684 for (int col = 0; col < numCols; col++) { 1685 out[col] = (psF64) in[col]; 1686 } 1687 } 1688 }; 1689 break; 1690 case PS_TYPE_S16: { 1691 psS16 *in; 1692 psF64 *out; 1693 for (int row = 0; row < numRows; row++) { 1694 in = input->data.S16[row]; 1695 out = output->data.F64[row]; 1696 for (int col = 0; col < numCols; col++) { 1697 out[col] = (psF64) in[col]; 1698 } 1699 } 1700 }; 1701 break; 1702 case PS_TYPE_S32: { 1703 psS32 *in; 1704 psF64 *out; 1705 for (int row = 0; row < numRows; row++) { 1706 in = input->data.S32[row]; 1707 out = output->data.F64[row]; 1708 for (int col = 0; col < numCols; col++) { 1709 out[col] = (psF64) in[col]; 1710 } 1711 } 1712 }; 1713 break; 1714 case PS_TYPE_S64: { 1715 psS64 *in; 1716 psF64 *out; 1717 for (int row = 0; row < numRows; row++) { 1718 in = input->data.S64[row]; 1719 out = output->data.F64[row]; 1720 for (int col = 0; col < numCols; col++) { 1721 out[col] = (psF64) in[col]; 1722 } 1723 } 1724 }; 1725 break; 1726 case PS_TYPE_U8: { 1727 psU8 *in; 1728 psF64 *out; 1729 for (int row = 0; row < numRows; row++) { 1730 in = input->data.U8[row]; 1731 out = output->data.F64[row]; 1732 for (int col = 0; col < numCols; col++) { 1733 out[col] = (psF64) in[col]; 1734 } 1735 } 1736 }; 1737 break; 1738 case PS_TYPE_U16: { 1739 psU16 *in; 1740 psF64 *out; 1741 for (int row = 0; row < numRows; row++) { 1742 in = input->data.U16[row]; 1743 out = output->data.F64[row]; 1744 for (int col = 0; col < numCols; col++) { 1745 out[col] = (psF64) in[col]; 1746 } 1747 } 1748 }; 1749 break; 1750 case PS_TYPE_U32: { 1751 psU32 *in; 1752 psF64 *out; 1753 for (int row = 0; row < numRows; row++) { 1754 in = input->data.U32[row]; 1755 out = output->data.F64[row]; 1756 for (int col = 0; col < numCols; col++) { 1757 out[col] = (psF64) in[col]; 1758 } 1759 } 1760 }; 1761 break; 1762 case PS_TYPE_U64: { 1763 psU64 *in; 1764 psF64 *out; 1765 for (int row = 0; row < numRows; row++) { 1766 in = input->data.U64[row]; 1767 out = output->data.F64[row]; 1768 for (int col = 0; col < numCols; col++) { 1769 out[col] = (psF64) in[col]; 1770 } 1771 } 1772 }; 1773 break; 1774 case PS_TYPE_F32: { 1775 psF32 *in; 1776 psF64 *out; 1777 for (int row = 0; row < numRows; row++) { 1778 in = input->data.F32[row]; 1779 out = output->data.F64[row]; 1780 for (int col = 0; col < numCols; col++) { 1781 out[col] = (psF64) in[col]; 1782 } 1783 } 1784 }; 1785 break; 1786 case PS_TYPE_F64: { 1787 psF64 *in; 1788 psF64 *out; 1789 for (int row = 0; row < numRows; row++) { 1790 in = input->data.F64[row]; 1791 out = output->data.F64[row]; 1792 for (int col = 0; col < numCols; col++) { 1793 out[col] = (psF64) in[col]; 1794 } 1795 } 1796 }; 1797 break; 1798 case PS_TYPE_C32: { 1799 psC32 *in; 1800 psF64 *out; 1801 for (int row = 0; row < numRows; row++) { 1802 in = input->data.C32[row]; 1803 out = output->data.F64[row]; 1804 for (int col = 0; col < numCols; col++) { 1805 out[col] = (psF64) in[col]; 1806 } 1807 } 1808 }; 1809 break; 1810 case PS_TYPE_PTR: 1811 psError (__func__, "Can't copy image from a matrix of pointers."); 1812 psImageFree (output); 1813 return ((void *) 0); 1814 default: 1815 break; 1816 }; 1817 break; 1818 case PS_TYPE_C32: 1819 switch (input->type.type) { 1820 case PS_TYPE_S8: { 1821 psS8 *in; 1822 psC32 *out; 1823 for (int row = 0; row < numRows; row++) { 1824 in = input->data.S8[row]; 1825 out = output->data.C32[row]; 1826 for (int col = 0; col < numCols; col++) { 1827 out[col] = (psC32) in[col]; 1828 } 1829 } 1830 }; 1831 break; 1832 case PS_TYPE_S16: { 1833 psS16 *in; 1834 psC32 *out; 1835 for (int row = 0; row < numRows; row++) { 1836 in = input->data.S16[row]; 1837 out = output->data.C32[row]; 1838 for (int col = 0; col < numCols; col++) { 1839 out[col] = (psC32) in[col]; 1840 } 1841 } 1842 }; 1843 break; 1844 case PS_TYPE_S32: { 1845 psS32 *in; 1846 psC32 *out; 1847 for (int row = 0; row < numRows; row++) { 1848 in = input->data.S32[row]; 1849 out = output->data.C32[row]; 1850 for (int col = 0; col < numCols; col++) { 1851 out[col] = (psC32) in[col]; 1852 } 1853 } 1854 }; 1855 break; 1856 case PS_TYPE_S64: { 1857 psS64 *in; 1858 psC32 *out; 1859 for (int row = 0; row < numRows; row++) { 1860 in = input->data.S64[row]; 1861 out = output->data.C32[row]; 1862 for (int col = 0; col < numCols; col++) { 1863 out[col] = (psC32) in[col]; 1864 } 1865 } 1866 }; 1867 break; 1868 case PS_TYPE_U8: { 1869 psU8 *in; 1870 psC32 *out; 1871 for (int row = 0; row < numRows; row++) { 1872 in = input->data.U8[row]; 1873 out = output->data.C32[row]; 1874 for (int col = 0; col < numCols; col++) { 1875 out[col] = (psC32) in[col]; 1876 } 1877 } 1878 }; 1879 break; 1880 case PS_TYPE_U16: { 1881 psU16 *in; 1882 psC32 *out; 1883 for (int row = 0; row < numRows; row++) { 1884 in = input->data.U16[row]; 1885 out = output->data.C32[row]; 1886 for (int col = 0; col < numCols; col++) { 1887 out[col] = (psC32) in[col]; 1888 } 1889 } 1890 }; 1891 break; 1892 case PS_TYPE_U32: { 1893 psU32 *in; 1894 psC32 *out; 1895 for (int row = 0; row < numRows; row++) { 1896 in = input->data.U32[row]; 1897 out = output->data.C32[row]; 1898 for (int col = 0; col < numCols; col++) { 1899 out[col] = (psC32) in[col]; 1900 } 1901 } 1902 }; 1903 break; 1904 case PS_TYPE_U64: { 1905 psU64 *in; 1906 psC32 *out; 1907 for (int row = 0; row < numRows; row++) { 1908 in = input->data.U64[row]; 1909 out = output->data.C32[row]; 1910 for (int col = 0; col < numCols; col++) { 1911 out[col] = (psC32) in[col]; 1912 } 1913 } 1914 }; 1915 break; 1916 case PS_TYPE_F32: { 1917 psF32 *in; 1918 psC32 *out; 1919 for (int row = 0; row < numRows; row++) { 1920 in = input->data.F32[row]; 1921 out = output->data.C32[row]; 1922 for (int col = 0; col < numCols; col++) { 1923 out[col] = (psC32) in[col]; 1924 } 1925 } 1926 }; 1927 break; 1928 case PS_TYPE_F64: { 1929 psF64 *in; 1930 psC32 *out; 1931 for (int row = 0; row < numRows; row++) { 1932 in = input->data.F64[row]; 1933 out = output->data.C32[row]; 1934 for (int col = 0; col < numCols; col++) { 1935 out[col] = (psC32) in[col]; 1936 } 1937 } 1938 }; 1939 break; 1940 case PS_TYPE_C32: { 1941 psC32 *in; 1942 psC32 *out; 1943 for (int row = 0; row < numRows; row++) { 1944 in = input->data.C32[row]; 1945 out = output->data.C32[row]; 1946 for (int col = 0; col < numCols; col++) { 1947 out[col] = (psC32) in[col]; 1948 } 1949 } 1950 }; 1951 break; 1952 case PS_TYPE_PTR: 1953 psError (__func__, "Can't copy image from a matrix of pointers."); 1954 psImageFree (output); 1955 return ((void *) 0); 1956 default: 1957 break; 1958 }; 1959 break; 1960 case PS_TYPE_C64: 1961 switch (input->type.type) { 1962 case PS_TYPE_S8: { 1963 psS8 *in; 1964 psC64 *out; 1965 for (int row = 0; row < numRows; row++) { 1966 in = input->data.S8[row]; 1967 out = output->data.C64[row]; 1968 for (int col = 0; col < numCols; col++) { 1969 out[col] = (psC64) in[col]; 1970 } 1971 } 1972 }; 1973 break; 1974 case PS_TYPE_S16: { 1975 psS16 *in; 1976 psC64 *out; 1977 for (int row = 0; row < numRows; row++) { 1978 in = input->data.S16[row]; 1979 out = output->data.C64[row]; 1980 for (int col = 0; col < numCols; col++) { 1981 out[col] = (psC64) in[col]; 1982 } 1983 } 1984 }; 1985 break; 1986 case PS_TYPE_S32: { 1987 psS32 *in; 1988 psC64 *out; 1989 for (int row = 0; row < numRows; row++) { 1990 in = input->data.S32[row]; 1991 out = output->data.C64[row]; 1992 for (int col = 0; col < numCols; col++) { 1993 out[col] = (psC64) in[col]; 1994 } 1995 } 1996 }; 1997 break; 1998 case PS_TYPE_S64: { 1999 psS64 *in; 2000 psC64 *out; 2001 for (int row = 0; row < numRows; row++) { 2002 in = input->data.S64[row]; 2003 out = output->data.C64[row]; 2004 for (int col = 0; col < numCols; col++) { 2005 out[col] = (psC64) in[col]; 2006 } 2007 } 2008 }; 2009 break; 2010 case PS_TYPE_U8: { 2011 psU8 *in; 2012 psC64 *out; 2013 for (int row = 0; row < numRows; row++) { 2014 in = input->data.U8[row]; 2015 out = output->data.C64[row]; 2016 for (int col = 0; col < numCols; col++) { 2017 out[col] = (psC64) in[col]; 2018 } 2019 } 2020 }; 2021 break; 2022 case PS_TYPE_U16: { 2023 psU16 *in; 2024 psC64 *out; 2025 for (int row = 0; row < numRows; row++) { 2026 in = input->data.U16[row]; 2027 out = output->data.C64[row]; 2028 for (int col = 0; col < numCols; col++) { 2029 out[col] = (psC64) in[col]; 2030 } 2031 } 2032 }; 2033 break; 2034 case PS_TYPE_U32: { 2035 psU32 *in; 2036 psC64 *out; 2037 for (int row = 0; row < numRows; row++) { 2038 in = input->data.U32[row]; 2039 out = output->data.C64[row]; 2040 for (int col = 0; col < numCols; col++) { 2041 out[col] = (psC64) in[col]; 2042 } 2043 } 2044 }; 2045 break; 2046 case PS_TYPE_U64: { 2047 psU64 *in; 2048 psC64 *out; 2049 for (int row = 0; row < numRows; row++) { 2050 in = input->data.U64[row]; 2051 out = output->data.C64[row]; 2052 for (int col = 0; col < numCols; col++) { 2053 out[col] = (psC64) in[col]; 2054 } 2055 } 2056 }; 2057 break; 2058 case PS_TYPE_F32: { 2059 psF32 *in; 2060 psC64 *out; 2061 for (int row = 0; row < numRows; row++) { 2062 in = input->data.F32[row]; 2063 out = output->data.C64[row]; 2064 for (int col = 0; col < numCols; col++) { 2065 out[col] = (psC64) in[col]; 2066 } 2067 } 2068 }; 2069 break; 2070 case PS_TYPE_F64: { 2071 psF64 *in; 2072 psC64 *out; 2073 for (int row = 0; row < numRows; row++) { 2074 in = input->data.F64[row]; 2075 out = output->data.C64[row]; 2076 for (int col = 0; col < numCols; col++) { 2077 out[col] = (psC64) in[col]; 2078 } 2079 } 2080 }; 2081 break; 2082 case PS_TYPE_C32: { 2083 psC32 *in; 2084 psC64 *out; 2085 for (int row = 0; row < numRows; row++) { 2086 in = input->data.C32[row]; 2087 out = output->data.C64[row]; 2088 for (int col = 0; col < numCols; col++) { 2089 out[col] = (psC64) in[col]; 2090 } 2091 } 2092 }; 2093 break; 2094 case PS_TYPE_PTR: 2095 psError (__func__, "Can't copy image from a matrix of pointers."); 2096 psImageFree (output); 2097 return ((void *) 0); 2098 default: 2099 break; 2100 }; 2101 break; 2102 case PS_TYPE_PTR: 2103 psError (__func__, "Can't copy image into a matrix of pointers."); 2104 psImageFree (output); 2105 return ((void *) 0); 383 2106 } 384 2107 … … 575 2298 } 576 2299 2300 #endif 2301 577 2302 return 0; 578 2303 }
Note:
See TracChangeset
for help on using the changeset viewer.
