@@ -165,41 +165,41 @@ __kernel void pyrUp_unrolled(__global const uchar * src, int src_step, int src_o
165
165
166
166
// (x,y)
167
167
sum = co3 * s_srcPatch [1 + (ly >> 1 )][1 + ((lx - 2 ) >> 1 )];
168
- sum = sum + co1 * s_srcPatch [1 + (ly >> 1 )][1 + ((lx ) >> 1 )];
169
- sum = sum + co3 * s_srcPatch [1 + (ly >> 1 )][1 + ((lx + 2 ) >> 1 )];
168
+ sum = mad ( co1 , s_srcPatch [1 + (ly >> 1 )][1 + ((lx ) >> 1 )], sum ) ;
169
+ sum = mad ( co3 , s_srcPatch [1 + (ly >> 1 )][1 + ((lx + 2 ) >> 1 )], sum ) ;
170
170
171
171
s_dstPatch [1 + get_local_id (1 )][lx ] = sum ;
172
172
173
173
// (x+1,y)
174
174
sum = co2 * s_srcPatch [1 + (ly >> 1 )][1 + ((lx + 1 - 1 ) >> 1 )];
175
- sum = sum + co2 * s_srcPatch [1 + (ly >> 1 )][1 + ((lx + 1 + 1 ) >> 1 )];
175
+ sum = mad ( co2 , s_srcPatch [1 + (ly >> 1 )][1 + ((lx + 1 + 1 ) >> 1 )], sum ) ;
176
176
s_dstPatch [1 + get_local_id (1 )][lx + 1 ] = sum ;
177
177
178
178
if (ly < 1 )
179
179
{
180
180
// (x,y)
181
181
sum = co3 * s_srcPatch [0 ][1 + ((lx - 2 ) >> 1 )];
182
- sum = sum + co1 * s_srcPatch [0 ][1 + ((lx ) >> 1 )];
183
- sum = sum + co3 * s_srcPatch [0 ][1 + ((lx + 2 ) >> 1 )];
182
+ sum = mad ( co1 , s_srcPatch [0 ][1 + ((lx ) >> 1 )], sum ) ;
183
+ sum = mad ( co3 , s_srcPatch [0 ][1 + ((lx + 2 ) >> 1 )], sum ) ;
184
184
s_dstPatch [0 ][lx ] = sum ;
185
185
186
186
// (x+1,y)
187
187
sum = co2 * s_srcPatch [0 ][1 + ((lx + 1 - 1 ) >> 1 )];
188
- sum = sum + co2 * s_srcPatch [0 ][1 + ((lx + 1 + 1 ) >> 1 )];
188
+ sum = mad ( co2 , s_srcPatch [0 ][1 + ((lx + 1 + 1 ) >> 1 )], sum ) ;
189
189
s_dstPatch [0 ][lx + 1 ] = sum ;
190
190
}
191
191
192
192
if (ly > 2 * LOCAL_SIZE - 3 )
193
193
{
194
194
// (x,y)
195
195
sum = co3 * s_srcPatch [LOCAL_SIZE + 1 ][1 + ((lx - 2 ) >> 1 )];
196
- sum = sum + co1 * s_srcPatch [LOCAL_SIZE + 1 ][1 + ((lx ) >> 1 )];
197
- sum = sum + co3 * s_srcPatch [LOCAL_SIZE + 1 ][1 + ((lx + 2 ) >> 1 )];
196
+ sum = mad ( co1 , s_srcPatch [LOCAL_SIZE + 1 ][1 + ((lx ) >> 1 )], sum ) ;
197
+ sum = mad ( co3 , s_srcPatch [LOCAL_SIZE + 1 ][1 + ((lx + 2 ) >> 1 )], sum ) ;
198
198
s_dstPatch [LOCAL_SIZE + 1 ][lx ] = sum ;
199
199
200
200
// (x+1,y)
201
201
sum = co2 * s_srcPatch [LOCAL_SIZE + 1 ][1 + ((lx + 1 - 1 ) >> 1 )];
202
- sum = sum + co2 * s_srcPatch [LOCAL_SIZE + 1 ][1 + ((lx + 1 + 1 ) >> 1 )];
202
+ sum = mad ( co2 , s_srcPatch [LOCAL_SIZE + 1 ][1 + ((lx + 1 + 1 ) >> 1 )], sum ) ;
203
203
s_dstPatch [LOCAL_SIZE + 1 ][lx + 1 ] = sum ;
204
204
}
205
205
@@ -211,24 +211,24 @@ __kernel void pyrUp_unrolled(__global const uchar * src, int src_step, int src_o
211
211
{
212
212
// (x,y)
213
213
sum = co3 * s_dstPatch [1 + get_local_id (1 ) - 1 ][lx ];
214
- sum = sum + co1 * s_dstPatch [1 + get_local_id (1 ) ][lx ];
215
- sum = sum + co3 * s_dstPatch [1 + get_local_id (1 ) + 1 ][lx ];
214
+ sum = mad ( co1 , s_dstPatch [1 + get_local_id (1 ) ][lx ], sum ) ;
215
+ sum = mad ( co3 , s_dstPatch [1 + get_local_id (1 ) + 1 ][lx ], sum ) ;
216
216
storepix (convertToT (sum ), dstData + dst_y * dst_step + dst_x * PIXSIZE );
217
217
218
218
// (x+1,y)
219
219
sum = co3 * s_dstPatch [1 + get_local_id (1 ) - 1 ][lx + 1 ];
220
- sum = sum + co1 * s_dstPatch [1 + get_local_id (1 ) ][lx + 1 ];
221
- sum = sum + co3 * s_dstPatch [1 + get_local_id (1 ) + 1 ][lx + 1 ];
220
+ sum = mad ( co1 , s_dstPatch [1 + get_local_id (1 ) ][lx + 1 ], sum ) ;
221
+ sum = mad ( co3 , s_dstPatch [1 + get_local_id (1 ) + 1 ][lx + 1 ], sum ) ;
222
222
storepix (convertToT (sum ), dstData + dst_y * dst_step + (dst_x + 1 ) * PIXSIZE );
223
223
224
224
// (x,y+1)
225
225
sum = co2 * s_dstPatch [1 + get_local_id (1 ) ][lx ];
226
- sum = sum + co2 * s_dstPatch [1 + get_local_id (1 ) + 1 ][lx ];
226
+ sum = mad ( co2 , s_dstPatch [1 + get_local_id (1 ) + 1 ][lx ], sum ) ;
227
227
storepix (convertToT (sum ), dstData + (dst_y + 1 ) * dst_step + dst_x * PIXSIZE );
228
228
229
229
// (x+1,y+1)
230
230
sum = co2 * s_dstPatch [1 + get_local_id (1 ) ][lx + 1 ];
231
- sum = sum + co2 * s_dstPatch [1 + get_local_id (1 ) + 1 ][lx + 1 ];
231
+ sum = mad ( co2 , s_dstPatch [1 + get_local_id (1 ) + 1 ][lx + 1 ], sum ) ;
232
232
storepix (convertToT (sum ), dstData + (dst_y + 1 ) * dst_step + (dst_x + 1 ) * PIXSIZE );
233
233
}
234
234
}
0 commit comments