📄 epr_band.c
字号:
&& band_smod == e_smod_2OF2 && daty_id == e_tid_uchar) decode_func = decode_line_uchar_2_of_2_to_uchar; else if (band_daty == e_tid_ushort && band_smod == e_smod_1OF1 && daty_id == e_tid_ushort) decode_func = decode_line_ushort_1_of_1_to_ushort; else if (band_daty == e_tid_float && band_smod == e_smod_1OF1 && daty_id == e_tid_uchar) decode_func = decode_line_uchar_1_of_1_to_float; else if (band_daty == e_tid_float && band_smod == e_smod_1OF1 && daty_id == e_tid_char) decode_func = decode_line_char_1_of_1_to_float; else if (band_daty == e_tid_float && band_smod == e_smod_1OF1 && daty_id == e_tid_ushort) decode_func = decode_line_ushort_1_of_1_to_float; else if (band_daty == e_tid_float && band_smod == e_smod_1OF1 && daty_id == e_tid_short) decode_func = decode_line_short_1_of_1_to_float; else if (band_daty == e_tid_float && band_smod == e_smod_1OF2 && daty_id == e_tid_short) decode_func = decode_line_short_1_of_2_to_float; else if (band_daty == e_tid_float && band_smod == e_smod_2OF2 && daty_id == e_tid_short) decode_func = decode_line_short_2_of_2_to_float; else if (band_daty == e_tid_float && band_smod == e_smod_1OF2 && daty_id == e_tid_uchar) decode_func = decode_line_uchar_1_of_2_to_float; else if (band_daty == e_tid_float && band_smod == e_smod_2OF2 && daty_id == e_tid_uchar) decode_func = decode_line_uchar_2_of_2_to_float; else if (band_daty == e_tid_float && band_smod == e_smod_2TOF && daty_id == e_tid_uchar) decode_func = decode_line_uchar_2_to_f_to_float; else if (band_daty == e_tid_ulong && band_smod == e_smod_3TOI && daty_id == e_tid_uchar) decode_func = decode_line_uchar_3_to_i_to_ulong; else { return NULL; } return decode_func;}EPR_FArrayTransformer select_transform_array_function(EPR_EDataTypeId band_daty, EPR_EDataTypeId daty_id){ EPR_FArrayTransformer transform_array_func; if (band_daty == e_tid_float && daty_id == e_tid_short) transform_array_func = transform_array_short_to_float; else if (band_daty == e_tid_float && daty_id == e_tid_ushort) transform_array_func = transform_array_ushort_to_float; else if (band_daty == e_tid_float && daty_id == e_tid_long) transform_array_func = transform_array_long_to_float; else if (band_daty == e_tid_float && daty_id == e_tid_ulong) transform_array_func = transform_array_ulong_to_float; else { return NULL; } return transform_array_func;}void decode_line_uchar_1_of_1_to_float(void* source_array, EPR_SBandId* band_id, int offset_x, int raster_width, int step_x, void* raster_buffer, int raster_pos) { int x, x1, x2; uchar* sa = (uchar*) source_array; float* buf = (float*) raster_buffer; x1 = offset_x; x2 = x1 + raster_width - 1; if (band_id->scaling_method == e_smid_log) { for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = (float)pow(10, band_id->scaling_offset + band_id->scaling_factor * sa[x]); } } else if (band_id->scaling_method == e_smid_lin){ for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = band_id->scaling_offset + band_id->scaling_factor * sa[x]; } } else { for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = sa[x]; } }}void decode_line_char_1_of_1_to_float(void* source_array, EPR_SBandId* band_id, int offset_x, int raster_width, int step_x, void* raster_buffer, int raster_pos) { int x, x1, x2; char* sa = (char*) source_array; float* buf = (float*) raster_buffer; x1 = offset_x; x2 = x1 + raster_width - 1; if (band_id->scaling_method == e_smid_log) { for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = (float)pow(10, band_id->scaling_offset + band_id->scaling_factor * sa[x]); } } else if (band_id->scaling_method == e_smid_lin){ for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = band_id->scaling_offset + band_id->scaling_factor * sa[x]; } } else { for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = sa[x]; } }}void decode_line_ushort_1_of_1_to_float(void* source_array, EPR_SBandId* band_id, int offset_x, int raster_width, int step_x, void* raster_buffer, int raster_pos) { int x, x1, x2; ushort* sa = (ushort*) source_array; float* buf = (float*) raster_buffer; x1 = offset_x; x2 = x1 + raster_width - 1; if (band_id->scaling_method == e_smid_log) { for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = (float)pow(10, band_id->scaling_offset + band_id->scaling_factor * sa[x]); } } else if (band_id->scaling_method == e_smid_lin){ for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = band_id->scaling_offset + band_id->scaling_factor * sa[x]; } } else { for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = sa[x]; } }}void decode_line_short_1_of_1_to_float(void* source_array, EPR_SBandId* band_id, int offset_x, int raster_width, int step_x, void* raster_buffer, int raster_pos) { int x, x1, x2; short* sa = (short*) source_array; float* buf = (float*) raster_buffer; x1 = offset_x; x2 = x1 + raster_width - 1; if (band_id->scaling_method == e_smid_log) { for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = (float)pow(10, band_id->scaling_offset + band_id->scaling_factor * sa[x]); } } else if (band_id->scaling_method == e_smid_lin){ for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = band_id->scaling_offset + band_id->scaling_factor * sa[x]; } } else { for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = sa[x]; } }}void decode_line_short_1_of_2_to_float(void* source_array, EPR_SBandId* band_id, int offset_x, int raster_width, int step_x, void* raster_buffer, int raster_pos) { int x, x1, x2; short* sa = (short*) source_array; float* buf = (float*) raster_buffer; x1 = offset_x; x2 = x1 + raster_width - 1; if (band_id->scaling_method == e_smid_log) { for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = (float)pow(10, band_id->scaling_offset + band_id->scaling_factor * sa[2 * x]); } } else if (band_id->scaling_method == e_smid_lin){ for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = band_id->scaling_offset + band_id->scaling_factor * sa[2 * x]; } } else { for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = (float)(sa[2 * x]); } }}void decode_line_short_2_of_2_to_float(void* source_array, EPR_SBandId* band_id, int offset_x, int raster_width, int step_x, void* raster_buffer, int raster_pos) { int x, x1, x2; short* sa = (short*) source_array; float* buf = (float*) raster_buffer; x1 = offset_x; x2 = x1 + raster_width - 1; if (band_id->scaling_method == e_smid_log) { for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = (float)pow(10, band_id->scaling_offset + band_id->scaling_factor * sa[2 * x + 1]); } } else if (band_id->scaling_method == e_smid_lin){ for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = band_id->scaling_offset + band_id->scaling_factor * sa[2 * x + 1]; } } else { for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = (float)(sa[2 * x + 1]); } }}void decode_line_uchar_1_of_2_to_uchar(void* source_array, EPR_SBandId* band_id, int offset_x, int raster_width, int step_x, void* raster_buffer, int raster_pos) { int x, x1, x2; uchar* sa = (uchar*) source_array; uchar* buf = (uchar*) raster_buffer; x1 = offset_x; x2 = x1 + raster_width - 1; for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = sa[2 * x]; }}void decode_line_uchar_2_of_2_to_uchar(void* source_array, EPR_SBandId* band_id, int offset_x, int raster_width, int step_x, void* raster_buffer, int raster_pos) { int x, x1, x2; uchar* sa = (uchar*) source_array; uchar* buf = (uchar*) raster_buffer; x1 = offset_x; x2 = x1 + raster_width - 1; for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = sa[2 * x + 1]; }}void decode_line_ushort_1_of_1_to_ushort(void* source_array, EPR_SBandId* band_id, int offset_x, int raster_width, int step_x, void* raster_buffer, int raster_pos) { int x, x1, x2; ushort* sa = (ushort*) source_array; ushort* buf = (ushort*) raster_buffer; x1 = offset_x; x2 = x1 + raster_width - 1; for (x = x1; x <= x2; x += step_x) { buf[raster_pos++] = sa[x]; }}void decode_line_uchar_2_to_f_to_float(void* source_array, EPR_SBandId* band_id, int offset_x, int raster_width, int step_x, void* raster_buffer, int raster_pos){ int x, x1, x2, shi; uchar* sa = (uchar*) source_array; float* buf = (float*) raster_buffer; x1 = offset_x; x2 = x1 + raster_width - 1; if (band_id->scaling_method == e_smid_log) { for (x = x1; x <= x2; x += step_x) { shi = (((sa[2 * x] & 0xff)) | ((sa[2 * x + 1] & 0xff) << 8)) & 0xffff; buf[raster_pos++] = (float)pow(10, band_id->scaling_offset + band_id->scaling_factor * shi); } } else if (band_id->scaling_method == e_smid_lin){ for (x = x1; x <= x2; x += step_x) { shi = (((sa[2 * x] & 0xff)) | ((sa[2 * x + 1] & 0xff) << 8)) & 0xffff; buf[raster_pos++] = band_id->scaling_offset + band_id->scaling_factor * shi; } } else { for (x = x1; x <= x2; x += step_x) { shi = (((sa[2 * x] & 0xff)) | ((sa[2 * x + 1] & 0xff) << 8)) & 0xffff; buf[raster_pos++] = (float)shi; } }}void decode_line_uchar_1_of_2_to_float(void* source_array, EPR_SBandId* band_id, int offset_x, int raster_width,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -