60 if (Data->
nline < 1) {
77 if (Valid_mask == NULL) {
99 if (Width_line > Data->
nline) {
102 if ((Width_line & 1) == 0) {
112 if (Width_sample < 1) {
115 if (Width_sample > Data->
nsample) {
118 if ((Width_sample & 1) == 0) {
126 if (Data_smoothed == NULL) {
144 for (iline = 0 ; iline < Data->
nline ; iline++) {
145 for (isample = 0 ; isample < Data->
nsample ; isample++) {
146 double window_sum = 0.0;
156 if (!Valid_mask->
data.
u8[iline][isample]) {
168 for (wline = iline - ((Width_line - 1) / 2) ;
169 wline <= iline + ((Width_line - 1) / 2) ; wline++) {
170 for (wsample = isample - ((Width_sample - 1) / 2) ;
171 wsample <= isample + ((Width_sample - 1) / 2) ; wsample++) {
173 if ((wline >= 0 && wline < Data->nline) &&
174 (wsample >= 0 && wsample < Data->
nsample) &&
175 Valid_mask->
data.
u8[wline][wsample]) {
176 window_sum += Data->
data.
f[wline][wsample];
178 window_sum += Data->
data.
f[iline][isample];
188 data_smoothed_tmp.
data.
f[iline][isample] =
189 window_sum / (double)count;
198 *Data_smoothed = data_smoothed_tmp;
HDFFCLIBAPI intf intf intf * count
MTKt_status MtkDataBufferAllocate(int nline, int nsample, MTKt_DataType datatype, MTKt_DataBuffer *databuf)
Allocate Data Buffer.
#define MTK_ERR_CODE_JUMP(code)
2-dimensional Data Buffer
#define MTKT_DATABUFFER_INIT
MTKt_status MtkDataBufferFree(MTKt_DataBuffer *databuf)
Free data buffer.
MTKt_status MtkSmoothData(const MTKt_DataBuffer *Data, const MTKt_DataBuffer *Valid_mask, int Width_line, int Width_sample, MTKt_DataBuffer *Data_smoothed)
Smooth the given array with a boxcar average of the specified width. The algorithm is similar to the ...
#define MTK_ERR_COND_JUMP(code)