File Coverage

lib/PDL/ImageRGB-pp-cquant_c.c
Criterion Covered Total %
statement 0 42 0.0
branch 0 52 0.0
condition n/a
subroutine n/a
pod n/a
total 0 94 0.0


line stmt bran cond sub pod time code
1              
2             #line 453 "lib/PDL/PP.pm"
3             /*
4             * THIS FILE WAS GENERATED BY PDL::PP from lib/PDL/ImageRGB.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_ImageRGB
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "lib/PDL/ImageRGB-pp-cquant_c.c"
23              
24             #include "pdlppm.h" /* Local decs */
25              
26             #line 1846 "lib/PDL/PP.pm"
27             typedef struct pdl_params_cquant_c {
28             #line 29 "lib/PDL/ImageRGB-pp-cquant_c.c"
29             int psz;
30             } pdl_params_cquant_c;
31              
32              
33             #line 1857 "lib/PDL/PP.pm"
34             pdl_error pdl_cquant_c_redodims(pdl_trans *__privtrans) {
35             pdl_error PDL_err = {0, NULL, 0};
36             #line 37 "lib/PDL/ImageRGB-pp-cquant_c.c"
37 0           pdl_params_cquant_c *__params = __privtrans->params; (void)__params;
38 0           __privtrans->ind_sizes[3] = __params->psz;
39 0           __privtrans->ind_sizes[0] = 3;
40 0 0         PDL_RETERROR(PDL_err, PDL->redodims_default(__privtrans));
41 0           return PDL_err;
42             }
43              
44              
45             #line 1857 "lib/PDL/PP.pm"
46             pdl_error pdl_cquant_c_readdata(pdl_trans *__privtrans) {
47             pdl_error PDL_err = {0, NULL, 0};
48             #line 49 "lib/PDL/ImageRGB-pp-cquant_c.c"
49 0           pdl_params_cquant_c *__params = __privtrans->params; (void)__params;
50 0 0         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in cquant_c:" "broadcast.incs NULL");
51             /* broadcastloop declarations */
52             int __brcloopval;
53             register PDL_Indx __tind0,__tind1; /* counters along dim */
54 0           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
55             /* dims here are how many steps along those dims */
56 0           register PDL_Indx __tinc0_a = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
57 0           register PDL_Indx __tinc0_b = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
58 0           register PDL_Indx __tinc0_c = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
59 0           register PDL_Indx __tinc1_a = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
60 0           register PDL_Indx __tinc1_b = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
61 0           register PDL_Indx __tinc1_c = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
62             #define PDL_BROADCASTLOOP_START_cquant_c_readdata PDL_BROADCASTLOOP_START( \
63             readdata, \
64             __privtrans->broadcast, \
65             __privtrans->vtable, \
66             a_datap += __offsp[0]; \
67             b_datap += __offsp[1]; \
68             c_datap += __offsp[2]; \
69             , \
70             ( ,a_datap += __tinc1_a - __tinc0_a * __tdims0 \
71             ,b_datap += __tinc1_b - __tinc0_b * __tdims0 \
72             ,c_datap += __tinc1_c - __tinc0_c * __tdims0 \
73             ), \
74             ( ,a_datap += __tinc0_a \
75             ,b_datap += __tinc0_b \
76             ,c_datap += __tinc0_c \
77             ) \
78             )
79             #define PDL_BROADCASTLOOP_END_cquant_c_readdata PDL_BROADCASTLOOP_END( \
80             __privtrans->broadcast, \
81             a_datap -= __tinc1_a * __tdims1 + __offsp[0]; \
82             b_datap -= __tinc1_b * __tdims1 + __offsp[1]; \
83             c_datap -= __tinc1_c * __tdims1 + __offsp[2]; \
84             )
85 0           register PDL_Indx __inc_a_m = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_a_m;register PDL_Indx __inc_a_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,1)]; (void)__inc_a_n;register PDL_Indx __inc_a_o = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,2)]; (void)__inc_a_o;
86 0           register PDL_Indx __inc_b_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_b_n;register PDL_Indx __inc_b_o = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,1)]; (void)__inc_b_o;
87 0           register PDL_Indx __inc_c_m = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,0)]; (void)__inc_c_m;register PDL_Indx __inc_c_p = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,1)]; (void)__inc_c_p;
88             #ifndef PDL_DECLARE_PARAMS_cquant_c_1
89             #define PDL_DECLARE_PARAMS_cquant_c_1(PDL_TYPE_OP,PDL_PPSYM_OP) \
90             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, a, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
91             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, b, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
92             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, c, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP)
93             #endif
94             #define PDL_IF_BAD(t,f) f
95 0 0         switch (__privtrans->__datatype) { /* Start generic switch */
96 0           case PDL_B: {
97 0 0         PDL_DECLARE_PARAMS_cquant_c_1(PDL_Byte,B)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
98 0 0         PDL_BROADCASTLOOP_START_cquant_c_readdata {int status;
    0          
    0          
    0          
    0          
    0          
    0          
99 0           status = ppm_quant(a_datap, NULL, NULL, __privtrans->ind_sizes[1],
100 0           __privtrans->ind_sizes[2],b_datap, NULL, c_datap, 0,
101 0           __privtrans->ind_sizes[3], 1);
102 0 0         if (!status)
103 0 0         return PDL->make_error(PDL_EUSERERROR, "Error in cquant_c:" "ppm_quant returned error status");}PDL_BROADCASTLOOP_END_cquant_c_readdata
    0          
104 0           } break;
105 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in cquant_c: unhandled datatype(%d), only handles (B)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
106             }
107             #undef PDL_IF_BAD
108 0           return PDL_err;
109             }
110              
111             static pdl_datatypes pdl_cquant_c_vtable_gentypes[] = { PDL_B, -1 };
112             static PDL_Indx pdl_cquant_c_vtable_realdims[] = { 3, 2, 2 };
113             static char *pdl_cquant_c_vtable_parnames[] = { "a","b","c" };
114             static short pdl_cquant_c_vtable_parflags[] = {
115             PDL_PARAM_ISPHYS,
116             PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISPHYS|PDL_PARAM_ISWRITE,
117             PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISPHYS|PDL_PARAM_ISWRITE
118             };
119             static pdl_datatypes pdl_cquant_c_vtable_partypes[] = { -1, -1, -1 };
120             static PDL_Indx pdl_cquant_c_vtable_realdims_starts[] = { 0, 3, 5 };
121             static PDL_Indx pdl_cquant_c_vtable_realdims_ind_ids[] = { 0, 1, 2, 1, 2, 0, 3 };
122             static char *pdl_cquant_c_vtable_indnames[] = { "m","n","o","p" };
123             pdl_transvtable pdl_cquant_c_vtable = {
124             PDL_TRANS_DO_BROADCAST, 0, pdl_cquant_c_vtable_gentypes, 1, 3, NULL /*CORE21*/,
125             pdl_cquant_c_vtable_realdims, pdl_cquant_c_vtable_parnames,
126             pdl_cquant_c_vtable_parflags, pdl_cquant_c_vtable_partypes,
127             pdl_cquant_c_vtable_realdims_starts, pdl_cquant_c_vtable_realdims_ind_ids, 7,
128             4, pdl_cquant_c_vtable_indnames,
129             pdl_cquant_c_redodims, pdl_cquant_c_readdata, NULL,
130             NULL,
131             sizeof(pdl_params_cquant_c),"PDL::ImageRGB::cquant_c"
132             };
133              
134              
135 0           pdl_error pdl_run_cquant_c(pdl *a,pdl *b,pdl *c,int psz) {
136 0           pdl_error PDL_err = {0, NULL, 0};
137 0 0         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
138 0           pdl_trans *__privtrans = PDL->create_trans(&pdl_cquant_c_vtable);
139 0 0         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
140 0           pdl_params_cquant_c *__params = __privtrans->params;
141 0           __privtrans->pdls[0] = a;
142 0           __privtrans->pdls[1] = b;
143 0           __privtrans->pdls[2] = c;
144 0 0         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
145 0           (__params->psz) = (psz); /* CType.get_copy */
146 0 0         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
147 0           return PDL_err;
148             }