📄 tce3d.c
字号:
int v; double filter_coef; filter_coef = (1 - alpha) * (1 - alpha)*(1 - alpha) / (3*alpha + alpha*alpha*alpha) / 3; subband_significance[subband] = 0.0; if (QccWAVSubbandPyramid3DSubbandSize(coefficients, subband, &subband_num_frames, &subband_num_rows, &subband_num_cols)) { QccErrorAddMessage("(QccWAVtce3DIPBand): Error calling QccWAVSubbandPyramid3DSubbandSize()"); goto Error; } if (QccWAVSubbandPyramid3DSubbandOffsets(coefficients, subband, &subband_origin_frame, &subband_origin_row, &subband_origin_col)) { QccErrorAddMessage("(QccWAVtce3DIPBand): Error calling QccWAVSubbandPyramid3DSubbandOffsets()"); goto Error; } if ((p1 = QccMatrixAlloc(subband_num_rows, subband_num_cols)) == NULL) { QccErrorAddMessage("(QccWAVtce3DIPBand): Error calling QccMatrixAlloc()"); goto Error; } if ((p2 = QccVectorAlloc(subband_num_cols)) == NULL) { QccErrorAddMessage("(QccWAVtce3DIPBand): Error calling QccVectorAlloc()"); goto Error; } if ((p3 = QccMatrixAlloc(subband_num_rows,subband_num_cols)) == NULL) { QccErrorAddMessage("(QccWAVtce3DIPBand): Error calling QccMatrixAlloc()"); goto Error; } if ((p4 = QccMatrixAlloc(subband_num_rows,subband_num_cols)) == NULL) { QccErrorAddMessage("(QccWAVtce3DIPBand): Error calling QccMatrixAlloc()"); goto Error; } if ((p5 = QccVectorAlloc(subband_num_cols)) == NULL) { QccErrorAddMessage("(QccWAVtce3DIPBand): Error calling QccVectorAlloc()"); goto Error; } for (row = 0; row < subband_num_rows; row++) for (col = 0; col < subband_num_cols; col++) p3[row][col]=QCCWAVTCE3D_BOUNDARY_VALUE; for (frame = subband_num_frames - 1; frame >= 0; frame--) {//bbb current_frame=subband_origin_frame+frame; for (col = 0; col < subband_num_cols; col++) p2[col] = QCCWAVTCE3D_BOUNDARY_VALUE; for (row = subband_num_rows - 1; row >= 0; row--) {//bb current_row = subband_origin_row + row; for (col = subband_num_cols - 1; col >= 0; col--) { current_col = subband_origin_col + col; p_char = &(significance_map [current_frame][current_row][current_col]); if (col == (subband_num_cols-1) ) p[current_frame][current_row][current_col] = alpha * (QCCWAVTCE3D_BOUNDARY_VALUE + p2[col] + p3[row][col]); else p[current_frame][current_row][current_col] = alpha *(p1[row][col+1]+p2[col]+p3[row][col]); if (*p_char == QCCWAVTCE3D_S) { if (col == subband_num_cols-1 ) p1[row][col] = alpha * QCCWAVTCE3D_BOUNDARY_VALUE + filter_coef * QCCWAVTCE3D_REFINE_HOLDER; else p1[row][col] = alpha * p1[row][col+1] + filter_coef * QCCWAVTCE3D_REFINE_HOLDER; subband_significance[subband] += QCCWAVTCE3D_REFINE_HOLDER; } else { v = (*p_char == QCCWAVTCE3D_S_NEW); if (col == (subband_num_cols-1) ) p1[row][col] = alpha * QCCWAVTCE3D_BOUNDARY_VALUE + filter_coef * v; else p1[row][col] = alpha * p1[row][col+1] + filter_coef * v; subband_significance[subband] += v; } p2[col] = p1[row][col] + alpha * p2[col]; } for (col = 0; col < subband_num_cols; col++) { p_char = &(significance_map [current_frame][current_row][subband_origin_col + col]); if(col==0) p2[col] = p2[col] + alpha * QCCWAVTCE3D_BOUNDARY_VALUE; else p2[col] = p2[col] + alpha * p4[row][col-1]; p3[row][col]=p2[col]+alpha*p3[row][col]; if (*p_char == QCCWAVTCE3D_S) { if(col==0) p4[row][col] = alpha * QCCWAVTCE3D_BOUNDARY_VALUE + filter_coef * QCCWAVTCE3D_REFINE_HOLDER; else p4[row][col] = alpha * p4[row][col-1] + filter_coef * QCCWAVTCE3D_REFINE_HOLDER; } else { v = (*p_char == QCCWAVTCE3D_S_NEW); if(col==0) p4[row][col] = alpha * QCCWAVTCE3D_BOUNDARY_VALUE + filter_coef * v; else p4[row][col] = alpha* p4[row][col-1] + filter_coef *v; } } }//bb for (col = 0; col < subband_num_cols; col++) p5[col] = QCCWAVTCE3D_BOUNDARY_VALUE; for (row = 0; row < subband_num_rows; row++) for (col = 0; col < subband_num_cols; col++) { p3[row][col] = p3[row][col] + alpha*p5[col]; if (col == 0) p5[col] = p1[row][col]+alpha*p5[col] + alpha*QCCWAVTCE3D_BOUNDARY_VALUE; else p5[col] = p1[row][col] + alpha*p5[col] + alpha*p4[row][col-1]; } }//bbb return_value = 0; goto Return; Error: return_value = 1; Return: QccVectorFree(p2); QccVectorFree(p5); QccMatrixFree(p1, subband_num_rows); QccMatrixFree(p3, subband_num_rows); QccMatrixFree(p4, subband_num_rows); return(return_value);}static int QccWAV3DUpdateNZNStatus(int subband_origin_frame, int subband_origin_row, int subband_origin_col, int subband_num_frame, int subband_num_row, int subband_num_col, int frame, int row, int col, char ***significance_map, int subband){ //Updata neighbors int current_frame, current_row, current_col; int shifted_frame, shifted_row, shifted_col; current_frame = subband_origin_frame + frame; current_row = subband_origin_row + row; current_col = subband_origin_col + col; //previous frame if (frame > 0) { if (row > 0) { shifted_frame = current_frame - 1; shifted_row = current_row - 1; shifted_col = current_col; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map [shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; if (col > 0) { shifted_frame = current_frame - 1; shifted_row = current_row - 1; shifted_col = current_col - 1; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; } if (col < subband_num_col - 1) { shifted_frame = current_frame - 1; shifted_row = current_row - 1; shifted_col = current_col + 1; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; } } if (row < subband_num_row - 1) { shifted_frame = current_frame - 1; shifted_row = current_row + 1; shifted_col = current_col; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; if (col > 0) { shifted_frame = current_frame - 1; shifted_row = current_row + 1; shifted_col = current_col - 1; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; } if (col < subband_num_col - 1) { shifted_frame = current_frame - 1; shifted_row = current_row + 1; shifted_col = current_col + 1; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; } } if (col > 0) { shifted_frame = current_frame - 1; shifted_row = current_row; shifted_col = current_col - 1; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; } if (col < subband_num_col - 1) { shifted_frame = current_frame - 1; shifted_row = current_row; shifted_col = current_col + 1; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; } { shifted_frame = current_frame - 1; shifted_row = current_row; shifted_col = current_col; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; } } //next frame if (frame < subband_num_frame - 1) { if (row > 0) { shifted_frame = current_frame + 1; shifted_row = current_row - 1; shifted_col = current_col; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; if (col > 0) { shifted_frame = current_frame + 1; shifted_row = current_row - 1; shifted_col = current_col - 1; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; } if (col < subband_num_col - 1) { shifted_frame = current_frame + 1; shifted_row = current_row - 1; shifted_col = current_col + 1; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; } } if (row < subband_num_row - 1) { shifted_frame = current_frame+ 1; shifted_row = current_row + 1; shifted_col = current_col; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; if (col > 0) { shifted_frame = current_frame + 1; shifted_row = current_row + 1; shifted_col = current_col - 1; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; } if (col < subband_num_col - 1) { shifted_frame = current_frame + 1; shifted_row = current_row + 1; shifted_col = current_col + 1; if (significance_map [shifted_frame][shifted_row][shifted_col] < QCCWAVTCE3D_S) significance_map[shifted_frame][shifted_row][shifted_col] = QCCWAVTCE3D_NZN_NEW; } } if (col > 0) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -