📄 tce3d.c
字号:
(1 - alpha) * (1 - alpha)*(1 - alpha) / (3*alpha + alpha*alpha*alpha) / 3; weight[0] = (1 - alpha) * (1 - alpha) * (1 - alpha) / ((1 + alpha) * (1 + alpha) * (1 + alpha)); weight[1] = (2*3*alpha + 2*alpha*alpha*alpha) / ((1 + alpha)*(1 + alpha)*(1 + alpha)); 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; } child_density = subband_significance[subband] / (subband_num_frames*subband_num_rows * subband_num_cols); p_lowerbound = 1.0 / (subband_num_frames*subband_num_rows * subband_num_cols); if (coefficients->transform_type == QCCWAVSUBBANDPYRAMID3D_DYADIC) { if (subband <= 7) { parent_subband = 0; parent_density = subband_significance[parent_subband] / (subband_num_frames*subband_num_rows * subband_num_cols) ; } else { parent_subband = subband-7; parent_density = subband_significance[parent_subband] / (subband_num_frames*subband_num_rows * subband_num_cols)*8; } } else { if ((subband % (3*coefficients->spatial_num_levels+1)) <= 3) { if ((subband % (3*coefficients->spatial_num_levels + 1)) == 0) { if ((subband / (3*coefficients->spatial_num_levels+1)) <= 1) { parent_subband = 0; parent_density = subband_significance[parent_subband] / (subband_num_frames*subband_num_rows * subband_num_cols) ; } else { parent_subband = subband - (3*coefficients->spatial_num_levels+1); parent_density = subband_significance[parent_subband] / (subband_num_frames*subband_num_rows * subband_num_cols)*2 ; } } if ((subband%(3*coefficients->spatial_num_levels+1)) == 1) { parent_subband = subband - 1; parent_density = subband_significance[parent_subband] / (subband_num_frames*subband_num_rows * subband_num_cols) ; } if ((subband%(3*coefficients->spatial_num_levels+1))==2) { parent_subband = subband - 2; parent_density = subband_significance[parent_subband] / (subband_num_frames*subband_num_rows * subband_num_cols) ; } if ((subband%(3*coefficients->spatial_num_levels+1))==3) { parent_subband = subband - 3; parent_density = subband_significance[parent_subband] / (subband_num_frames*subband_num_rows * subband_num_cols) ; } } else { parent_subband = subband - 3; parent_density = subband_significance[parent_subband] / (subband_num_frames*subband_num_rows * subband_num_cols) * 4; } } for (row = 0; row < subband_num_rows; row++) for (col = 0; col < subband_num_cols; col++) p3[row][col]=QCCWAVTCE3D_BOUNDARY_VALUE; scale = QccMathMax(child_density, p_lowerbound) / QccMathMax(parent_density, p_lowerbound); increment = 1.0 / (subband_num_frames*subband_num_rows * subband_num_cols) / QccMathMax(parent_density, p_lowerbound); // printf("IPband=%d,sunnamd_num_rows=%d,%d\n",subband,subband_num_rows,subband_num_cols ); //printf("%d,%d,%d\n",subband_origin_frame,subband_origin_row,subband_origin_col ); for (frame = 0; frame < subband_num_frames; frame++) {//aaaa current_frame = subband_origin_frame + frame; for (col = 0; col < subband_num_cols; col++) p2[col] =QCCWAVTCE3D_BOUNDARY_VALUE; ; for (row = 0; row < subband_num_rows; row++) { //aaa //printf("row=%d\n",row); current_row = subband_origin_row + row; for (col = 0; col < subband_num_cols; col++) { //aa current_col = subband_origin_col + col; p_char = &(significance_map [current_frame][current_row][current_col]); if (col == 0) p_forward =alpha * (QCCWAVTCE3D_BOUNDARY_VALUE + p2[col] + p3[row][col]); else p_forward = alpha * (p1[row][col-1] + p2[col] + p3[row][col]); if (*p_char < QCCWAVTCE3D_S) { //a p = p_forward + p_estimation[current_frame][current_row][current_col]; if (subband != 0) { //b if (coefficients->transform_type == QCCWAVSUBBANDPYRAMID3D_DYADIC) { if(subband==1) p_parent = p_estimation [0][current_row-subband_num_rows][current_col]; if(subband==2) p_parent = p_estimation [0][current_row][current_col-subband_num_cols]; if(subband==3) p_parent = p_estimation[0][current_row][current_col]; if(subband==4) p_parent = p_estimation [0][current_row-subband_num_rows] [current_col-subband_num_cols]; if(subband==5) p_parent = p_estimation [0][current_row-subband_num_rows][current_col]; if(subband==6) p_parent = p_estimation [0][current_row][current_col-subband_num_cols]; if(subband==7) p_parent = p_estimation [0][current_row-subband_num_rows] [current_col-subband_num_cols]; if(subband>7) p_parent = p_estimation [current_frame/2][current_row/2][current_col/2]; } else { if ((subband % (3*coefficients->spatial_num_levels+1)) <= 3) { if ((subband % (3*coefficients->spatial_num_levels+1)) == 0) { if ((subband / (3*coefficients->spatial_num_levels+1)) <=1 ) p_parent = p_estimation[0][current_row][current_col]; else p_parent = p_estimation [current_frame/2][current_row] [current_col]; } if ((subband % (3*coefficients->spatial_num_levels+1))==1) p_parent = p_estimation[current_frame] [current_row-subband_num_rows][current_col]; if ((subband % (3*coefficients->spatial_num_levels+1)) == 2) p_parent = p_estimation [current_frame][current_row] [current_col-subband_num_cols]; if ((subband % (3*coefficients->spatial_num_levels+1)) == 3) p_parent = p_estimation [current_frame] [current_row-subband_num_rows] [current_col-subband_num_cols]; } else p_parent = p_estimation [current_frame][current_row/2][current_col/2]; } if (p < QCCWAVTCE3D_PREDICT_THRESHOLD) { p_parent = QccMathMin(p_parent*scale, 0.8); p = p * QCCWAVTCE3D_CURRENT_SCALE + QCCWAVTCE3D_PARENT_SCALE * p_parent; } }//b if (p > 1) { // printf("p=%f ",p); p = 1; } if (QccWAVtce3DUpdateModel(model, p)) { QccErrorAddMessage("(QccWAVtceIPBand): Error calling QccWAVtceUpdateModel()"); return_value = 1; goto Error; } if (buffer->type == QCCBITBUFFER_OUTPUT) { if (coefficients->volume [current_frame][current_row][current_col] >= threshold) { symbol = 1; coefficients->volume [current_frame][current_row][current_col] -= threshold; } else symbol = 0; return_value = QccENTArithmeticEncode(&symbol, 1, model, buffer); } else { if (QccENTArithmeticDecode(buffer, model, &symbol, 1)) { return_value = 2; goto Return; } else return_value = 0; if (symbol) coefficients->volume [current_frame][current_row][current_col] = 1.5 * threshold; } v = symbol; if (symbol) {//c subband_significance[subband]++; scale += increment; *p_char = QCCWAVTCE3D_S_NEW; if (QccWAVtce3DUpdateModel(model, 0.5)) { QccErrorAddMessage("(QccWAVtce3DIPBand): Error calling QccWAVtce3DUpdateModel()"); goto Error; } if (buffer->type == QCCBITBUFFER_OUTPUT) { symbol = (int)(sign_array [current_frame] [current_row][current_col]); return_value = QccENTArithmeticEncode(&symbol, 1,model, buffer); } else { if (QccENTArithmeticDecode(buffer,model,&symbol, 1)) return_value = 2; sign_array [current_frame][current_row][current_col] = (char)symbol; } QccWAV3DUpdateNZNStatus(subband_origin_frame, subband_origin_row, subband_origin_col, subband_num_frames, subband_num_rows, subband_num_cols, frame, row, col, significance_map, subband); }//c if (return_value == 2) goto Return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -