51 int number_sample_out;
65 if (Source->
nline < 1) {
82 if (Source_mask == NULL) {
102 if (Size_factor < 1) {
105 if (Source->
nline % Size_factor != 0) {
108 if (Source->
nsample % Size_factor != 0) {
116 if (Result == NULL) {
124 if (Result_mask == NULL) {
132 number_line_out = Source->
nline / Size_factor;
133 number_sample_out = Source->
nsample / Size_factor;
151 for (iline = 0; iline < number_line_out ; iline++) {
152 for (isample = 0; isample < number_sample_out; isample++) {
153 int rline_start, rsample_start;
154 int rline_end, rsample_end;
158 rline_start = iline * Size_factor;
159 rsample_start = isample * Size_factor;
160 rline_end = rline_start + Size_factor;
161 rsample_end = rsample_start + Size_factor;
168 for (rline = rline_start ; rline < rline_end ; rline++) {
169 for (rsample = rsample_start ; rsample < rsample_end ; rsample++) {
170 if (Source_mask->
data.
u8[rline][rsample]) {
171 sum += Source->
data.
f[rline][rsample];
178 result_tmp.
data.
f[iline][isample] = sum /
count;
179 result_mask_tmp.
data.
u8[iline][isample] = 1;
181 result_mask_tmp.
data.
u8[iline][isample] = 0;
195 *Result = result_tmp;
196 *Result_mask = result_mask_tmp;
HDFFCLIBAPI intf intf intf * count
MTKt_status MtkDataBufferAllocate(int nline, int nsample, MTKt_DataType datatype, MTKt_DataBuffer *databuf)
Allocate Data Buffer.
MTKt_status MtkDownsample(const MTKt_DataBuffer *Source, const MTKt_DataBuffer *Source_mask, int Size_factor, MTKt_DataBuffer *Result, MTKt_DataBuffer *Result_mask)
Downsample data by averaging pixels.
2-dimensional Data Buffer
#define MTKT_DATABUFFER_INIT
MTKt_status MtkDataBufferFree(MTKt_DataBuffer *databuf)
Free data buffer.
#define MTK_ERR_CODE_MSG_JUMP(code, msg)
#define MTK_ERR_COND_JUMP(code)