| 1 |
|
| |
| 2 |
|
| #line 453 "lib/PDL/PP.pm" |
| 3 |
|
| /* |
| 4 |
|
| * THIS FILE WAS GENERATED BY PDL::PP from lib/PDL/Image2D.pd! Do not modify! |
| 5 |
|
| */ |
| 6 |
|
| |
| 7 |
|
| #define PDL_FREE_CODE(trans, destroy, comp_free_code, ntpriv_free_code) \ |
| 8 |
|
| if (destroy) { \ |
| 9 |
|
| comp_free_code \ |
| 10 |
|
| } \ |
| 11 |
|
| if ((trans)->dims_redone) { \ |
| 12 |
|
| ntpriv_free_code \ |
| 13 |
|
| } |
| 14 |
|
| |
| 15 |
|
| #include "EXTERN.h" |
| 16 |
|
| #include "perl.h" |
| 17 |
|
| #include "XSUB.h" |
| 18 |
|
| #include "pdl.h" |
| 19 |
|
| #include "pdlcore.h" |
| 20 |
|
| #define PDL PDL_Image2D |
| 21 |
|
| extern Core* PDL; /* Structure hold core C functions */ |
| 22 |
|
| #line 23 "lib/PDL/Image2D-pp-polyfill_pp.c" |
| 23 |
|
| void polyfill(PDL_Long *image, int wx, int wy, float *ps, int n, PDL_Long col, int *ierr); |
| 24 |
|
| |
| 25 |
|
| |
| 26 |
|
| |
| 27 |
|
| #line 1888 "lib/PDL/PP.pm" |
| 28 |
|
| pdl_error pdl_polyfill_pp_redodims(pdl_trans *__privtrans) { |
| 29 |
|
| pdl_error PDL_err = {0, NULL, 0}; |
| 30 |
|
| #line 31 "lib/PDL/Image2D-pp-polyfill_pp.c" |
| 31 |
2 |
| __privtrans->ind_sizes[3] = 2; |
| 32 |
2 |
▶ | PDL_RETERROR(PDL_err, PDL->redodims_default(__privtrans)); |
Branch: 1 branch
| Branch | True | False | Total |
| PDL_RETERROR(PDL_err, PDL->redodims_default(__privtrans)); |
0 |
2 |
2 |
|
| 33 |
2 |
| return PDL_err; |
| 34 |
|
| } |
| 35 |
|
| |
| 36 |
|
| |
| 37 |
|
| #line 1888 "lib/PDL/PP.pm" |
| 38 |
|
| pdl_error pdl_polyfill_pp_readdata(pdl_trans *__privtrans) { |
| 39 |
|
| pdl_error PDL_err = {0, NULL, 0}; |
| 40 |
|
| #line 41 "lib/PDL/Image2D-pp-polyfill_pp.c" |
| 41 |
2 |
▶ | if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in polyfill_pp:" "broadcast.incs NULL"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in polyfill_pp:" "broadcast.incs NULL"); |
0 |
2 |
2 |
|
| 42 |
|
| /* broadcastloop declarations */ |
| 43 |
|
| int __brcloopval; |
| 44 |
|
| register PDL_Indx __tind0,__tind1; /* counters along dim */ |
| 45 |
2 |
| register PDL_Indx __tnpdls = __privtrans->broadcast.npdls; |
| 46 |
|
| /* dims here are how many steps along those dims */ |
| 47 |
2 |
| register PDL_Indx __tinc0_ps = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0); |
| 48 |
2 |
| register PDL_Indx __tinc0_col = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0); |
| 49 |
2 |
| register PDL_Indx __tinc0_im = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0); |
| 50 |
2 |
| register PDL_Indx __tinc1_ps = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1); |
| 51 |
2 |
| register PDL_Indx __tinc1_col = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1); |
| 52 |
2 |
| register PDL_Indx __tinc1_im = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1); |
| 53 |
|
| #define PDL_BROADCASTLOOP_START_polyfill_pp_readdata PDL_BROADCASTLOOP_START( \ |
| 54 |
|
| readdata, \ |
| 55 |
|
| __privtrans->broadcast, \ |
| 56 |
|
| __privtrans->vtable, \ |
| 57 |
|
| ps_datap += __offsp[0]; \ |
| 58 |
|
| col_datap += __offsp[1]; \ |
| 59 |
|
| im_datap += __offsp[2]; \ |
| 60 |
|
| , \ |
| 61 |
|
| ( ,ps_datap += __tinc1_ps - __tinc0_ps * __tdims0 \ |
| 62 |
|
| ,col_datap += __tinc1_col - __tinc0_col * __tdims0 \ |
| 63 |
|
| ,im_datap += __tinc1_im - __tinc0_im * __tdims0 \ |
| 64 |
|
| ), \ |
| 65 |
|
| ( ,ps_datap += __tinc0_ps \ |
| 66 |
|
| ,col_datap += __tinc0_col \ |
| 67 |
|
| ,im_datap += __tinc0_im \ |
| 68 |
|
| ) \ |
| 69 |
|
| ) |
| 70 |
|
| #define PDL_BROADCASTLOOP_END_polyfill_pp_readdata PDL_BROADCASTLOOP_END( \ |
| 71 |
|
| __privtrans->broadcast, \ |
| 72 |
|
| ps_datap -= __tinc1_ps * __tdims1 + __offsp[0]; \ |
| 73 |
|
| col_datap -= __tinc1_col * __tdims1 + __offsp[1]; \ |
| 74 |
|
| im_datap -= __tinc1_im * __tdims1 + __offsp[2]; \ |
| 75 |
|
| ) |
| 76 |
2 |
| register PDL_Indx __inc_im_m = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,0)]; (void)__inc_im_m;register PDL_Indx __inc_im_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,1)]; (void)__inc_im_n; |
| 77 |
2 |
| register PDL_Indx __inc_ps_two = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_ps_two;register PDL_Indx __inc_ps_np = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,1)]; (void)__inc_ps_np; |
| 78 |
|
| #ifndef PDL_DECLARE_PARAMS_polyfill_pp_1 |
| 79 |
|
| #define PDL_DECLARE_PARAMS_polyfill_pp_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_ps,PDL_PPSYM_PARAM_ps,PDL_TYPE_PARAM_col,PDL_PPSYM_PARAM_col) \ |
| 80 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ps, ps, (__privtrans->pdls[0]), 1, PDL_PPSYM_PARAM_ps) \ |
| 81 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_col, col, (__privtrans->pdls[1]), 1, PDL_PPSYM_PARAM_col) \ |
| 82 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_OP, im, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) |
| 83 |
|
| #endif |
| 84 |
|
| #define PDL_IF_BAD(t,f) f |
| 85 |
2 |
▶ | switch (__privtrans->__datatype) { /* Start generic switch */ |
Branch: 1 branch
| Branch | True | False | Total |
| switch (__privtrans->__datatype) { /* Start generic switch */ |
2 |
0 |
2 |
|
| 86 |
2 |
| case PDL_L: { |
| 87 |
2 |
▶ | PDL_DECLARE_PARAMS_polyfill_pp_1(PDL_Long,L,PDL_Float,F,PDL_Long,L) |
Branch: 9 branches
| Branch | True | False | Total |
| PDL_DECLARE_PARAMS_polyfill_pp_1(PDL_Long,L,PDL_Float,F,PDL_Long,L) |
0 |
2 |
2 |
| PDL_DECLARE_PARAMS_polyfill_pp_1(PDL_Long,L,PDL_Float,F,PDL_Long,L) |
2 |
0 |
2 |
| PDL_DECLARE_PARAMS_polyfill_pp_1(PDL_Long,L,PDL_Float,F,PDL_Long,L) |
0 |
2 |
2 |
| PDL_DECLARE_PARAMS_polyfill_pp_1(PDL_Long,L,PDL_Float,F,PDL_Long,L) |
0 |
2 |
2 |
| PDL_DECLARE_PARAMS_polyfill_pp_1(PDL_Long,L,PDL_Float,F,PDL_Long,L) |
2 |
0 |
2 |
| PDL_DECLARE_PARAMS_polyfill_pp_1(PDL_Long,L,PDL_Float,F,PDL_Long,L) |
0 |
2 |
2 |
| PDL_DECLARE_PARAMS_polyfill_pp_1(PDL_Long,L,PDL_Float,F,PDL_Long,L) |
0 |
2 |
2 |
| PDL_DECLARE_PARAMS_polyfill_pp_1(PDL_Long,L,PDL_Float,F,PDL_Long,L) |
2 |
0 |
2 |
| PDL_DECLARE_PARAMS_polyfill_pp_1(PDL_Long,L,PDL_Float,F,PDL_Long,L) |
0 |
2 |
2 |
|
| 88 |
2 |
| {int ierr = 0, nerr; |
| 89 |
8 |
▶ | PDL_BROADCASTLOOP_START_polyfill_pp_readdata |
Branch: 7 branches
| Branch | True | False | Total |
| PDL_BROADCASTLOOP_START_polyfill_pp_readdata |
0 |
2 |
2 |
| PDL_BROADCASTLOOP_START_polyfill_pp_readdata |
0 |
2 |
2 |
| PDL_BROADCASTLOOP_START_polyfill_pp_readdata |
0 |
2 |
2 |
| PDL_BROADCASTLOOP_START_polyfill_pp_readdata |
0 |
2 |
2 |
| PDL_BROADCASTLOOP_START_polyfill_pp_readdata |
0 |
2 |
2 |
| PDL_BROADCASTLOOP_START_polyfill_pp_readdata |
2 |
2 |
4 |
| PDL_BROADCASTLOOP_START_polyfill_pp_readdata |
2 |
2 |
4 |
|
| 90 |
2 |
| polyfill(im_datap, __privtrans->ind_sizes[0], __privtrans->ind_sizes[1], ps_datap, __privtrans->ind_sizes[2], (col_datap)[0], &nerr); |
| 91 |
2 |
| ierr = PDLMAX(ierr, nerr); |
| 92 |
2 |
▶ | PDL_BROADCASTLOOP_END_polyfill_pp_readdata |
Branch: 2 branches
| Branch | True | False | Total |
| PDL_BROADCASTLOOP_END_polyfill_pp_readdata |
0 |
2 |
2 |
| PDL_BROADCASTLOOP_END_polyfill_pp_readdata |
0 |
2 |
2 |
|
| 93 |
2 |
▶ | if (ierr) warn("errors during polygonfilling"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (ierr) warn("errors during polygonfilling"); |
0 |
2 |
2 |
|
| 94 |
|
| } |
| 95 |
2 |
| } break; |
| 96 |
0 |
| default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in polyfill_pp: unhandled datatype(%d), only handles (L)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype); |
| 97 |
|
| } |
| 98 |
|
| #undef PDL_IF_BAD |
| 99 |
2 |
| return PDL_err; |
| 100 |
|
| } |
| 101 |
|
| |
| 102 |
|
| static pdl_datatypes pdl_polyfill_pp_vtable_gentypes[] = { PDL_L, -1 }; |
| 103 |
|
| static PDL_Indx pdl_polyfill_pp_vtable_realdims[] = { 2, 0, 2 }; |
| 104 |
|
| static char *pdl_polyfill_pp_vtable_parnames[] = { "ps","col","im" }; |
| 105 |
|
| static short pdl_polyfill_pp_vtable_parflags[] = { |
| 106 |
|
| PDL_PARAM_ISPHYS|PDL_PARAM_ISTYPED, |
| 107 |
|
| PDL_PARAM_ISTYPED, |
| 108 |
|
| PDL_PARAM_ISPHYS|PDL_PARAM_ISWRITE |
| 109 |
|
| }; |
| 110 |
|
| static pdl_datatypes pdl_polyfill_pp_vtable_partypes[] = { PDL_F, PDL_L, -1 }; |
| 111 |
|
| static PDL_Indx pdl_polyfill_pp_vtable_realdims_starts[] = { 0, 2, 2 }; |
| 112 |
|
| static PDL_Indx pdl_polyfill_pp_vtable_realdims_ind_ids[] = { 3, 2, 0, 1 }; |
| 113 |
|
| static char *pdl_polyfill_pp_vtable_indnames[] = { "m","n","np","two" }; |
| 114 |
|
| pdl_transvtable pdl_polyfill_pp_vtable = { |
| 115 |
|
| PDL_TRANS_DO_BROADCAST|PDL_TRANS_BADIGNORE, 0, pdl_polyfill_pp_vtable_gentypes, 2, 3, NULL /*CORE21*/, |
| 116 |
|
| pdl_polyfill_pp_vtable_realdims, pdl_polyfill_pp_vtable_parnames, |
| 117 |
|
| pdl_polyfill_pp_vtable_parflags, pdl_polyfill_pp_vtable_partypes, |
| 118 |
|
| pdl_polyfill_pp_vtable_realdims_starts, pdl_polyfill_pp_vtable_realdims_ind_ids, 4, |
| 119 |
|
| 4, pdl_polyfill_pp_vtable_indnames, |
| 120 |
|
| pdl_polyfill_pp_redodims, pdl_polyfill_pp_readdata, NULL, |
| 121 |
|
| NULL, |
| 122 |
|
| 0,"PDL::Image2D::polyfill_pp" |
| 123 |
|
| }; |
| 124 |
|
| |
| 125 |
|
| |
| 126 |
2 |
| pdl_error pdl_run_polyfill_pp(pdl *im,pdl *ps,pdl *col) { |
| 127 |
2 |
| pdl_error PDL_err = {0, NULL, 0}; |
| 128 |
2 |
▶ | if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0}; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0}; |
0 |
2 |
2 |
|
| 129 |
2 |
| pdl_trans *__privtrans = PDL->create_trans(&pdl_polyfill_pp_vtable); |
| 130 |
2 |
▶ | if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans"); |
0 |
2 |
2 |
|
| 131 |
2 |
| __privtrans->pdls[0] = ps; |
| 132 |
2 |
| __privtrans->pdls[1] = col; |
| 133 |
2 |
| __privtrans->pdls[2] = im; |
| 134 |
2 |
▶ | PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans)); |
Branch: 1 branch
| Branch | True | False | Total |
| PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans)); |
0 |
2 |
2 |
|
| 135 |
2 |
▶ | PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans)); |
Branch: 1 branch
| Branch | True | False | Total |
| PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans)); |
0 |
2 |
2 |
|
| 136 |
2 |
| return PDL_err; |
| 137 |
|
| } |