📄 tce3d.c
字号:
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; } } //current frame { if (row > 0) { shifted_frame = current_frame ; 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; 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 ; 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; 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 ; 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 ; 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 ; 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 ; 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; } } return(0);}static int QccWAVtce3DNZNPass(QccWAVSubbandPyramid3D *coefficients, char ***significance_map, char ***sign_array, double threshold, double *subband_significance, QccENTArithmeticModel *model, QccBitBuffer *buffer, int *max_coefficient_bits){ int subband,num_subbands; int return_value; int subband_origin_frame; int subband_origin_row; int subband_origin_col; int subband_num_frames; int subband_num_rows; int subband_num_cols; int frame,row, col; int current_frame, current_row, current_col; int symbol; double p = 0.5; if (coefficients->transform_type == QCCWAVSUBBANDPYRAMID3D_DYADIC) num_subbands = QccWAVSubbandPyramid3DNumLevelsToNumSubbandsDyadic(coefficients->spatial_num_levels); else num_subbands = QccWAVSubbandPyramid3DNumLevelsToNumSubbandsPacket(coefficients->temporal_num_levels, coefficients->spatial_num_levels); for (subband = 0; subband < num_subbands; subband++) { if ((threshold - 0.000001) < pow((double)2, (double)(max_coefficient_bits[subband]))) { if (QccWAVSubbandPyramid3DSubbandSize(coefficients, subband, &subband_num_frames, &subband_num_rows, &subband_num_cols)) { QccErrorAddMessage("(QccWAVtce3DNZNPass): Error calling QccWAVSubbandPyramid3DSubbandSize()"); return(1); } if (QccWAVSubbandPyramid3DSubbandOffsets(coefficients, subband, &subband_origin_frame, &subband_origin_row, &subband_origin_col)) { QccErrorAddMessage("(QccWAVtce3DNZNPass): Error calling QccWAVSubbandPyramid3DSubbandOffsets()"); return(1); } for (frame = 0; frame < subband_num_frames; frame++) { current_frame = subband_origin_frame + frame; for (row = 0; row < subband_num_rows; row++) { current_row = subband_origin_row + row; for (col = 0; col < subband_num_cols; col++) { current_col = subband_origin_col + col; if (significance_map [current_frame][current_row][current_col] == QCCWAVTCE3D_NZN) { if (QccWAVtce3DUpdateModel(model, p)) { QccErrorAddMessage("(QccWAVtceNZNPass): Error calling QccWAVtceUpdateModel()"); return_value = 1; return(1); } 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); if (return_value == 1) return(1); else { if (return_value == 2) return(2); } } else { if (QccENTArithmeticDecode(buffer, model, &symbol, 1)) return(2); if (symbol) coefficients->volume [current_frame][current_row][current_col] = 1.5 * threshold; } p = p * QCCWAVTCE3D_ALPHA_1D + symbol * QCCWAVTCE3D_ALPHA_1D_O; if (symbol) { subband_significance[subband]++; significance_map [current_frame][current_row][current_col] = QCCWAVTCE3D_S_NEW; if (QccWAVtce3DUpdateModel(model, 0.5)) { QccErrorAddMessage("(QccWAVtce3DNZNPass): Error calling QccWAVtce3DUpdateModel()"); return(1); } if (buffer->type == QCCBITBUFFER_OUTPUT) { symbol = (int)(sign_array [current_frame] [current_row] [current_col]); return_value = QccENTArithmeticEncode(&symbol, 1, model, buffer); if (return_value == 1) return(1); else { if (return_value == 2) return(2); } } else { if (QccENTArithmeticDecode(buffer, model, &symbol, 1)) return(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); } } } } } } } return(0);}static int QccWAVtce3DIPBand(QccWAVSubbandPyramid3D *coefficients, char ***significance_map, char ***sign_array, double ***p_estimation, double *subband_significance, int subband, double threshold, QccENTArithmeticModel *model, QccBitBuffer *buffer, double alpha){ int return_value; int subband_origin_frame; int subband_origin_row; int subband_origin_col; int subband_num_frames; int subband_num_rows; int subband_num_cols; int frame,row, col; int current_frame, current_row, current_col; QccMatrix p1 = NULL; QccVector p2 = NULL; QccMatrix p3 = NULL; QccMatrix p4 = NULL; QccVector p5 = NULL; double p; double p_forward; double p_parent = 0; int parent_subband; double scale; double parent_density = 0; double child_density; int v; int symbol; double p_lowerbound = 0; double weight[2]; double filter_coef; double increment; char *p_char; // initialization all the constants filter_coef =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -