?? rdwtblock.c
字號:
predicted_frame.matrix[row][col]; return_value = 0; goto Return; Error: return_value = 1; Return: QccVIDRDWTBlockBlockFree(&reference_block); QccWAVSubbandPyramidFree(&predicted_frame); return(return_value);}static int QccVIDRDWTBlockEncodeHeader(QccBitBuffer *output_buffer, int num_rows, int num_cols, int start_frame_num, int end_frame_num, int blocksize, int num_levels, int target_bit_cnt){ if (QccBitBufferPutInt(output_buffer, num_rows)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeHeader): Error calling QccBitBufferPutInt()"); return(1); } if (QccBitBufferPutInt(output_buffer, num_cols)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeHeader): Error calling QccBitBufferPutInt()"); return(1); } if (QccBitBufferPutInt(output_buffer, start_frame_num)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeHeader): Error calling QccBitBufferPutInt()"); return(1); } if (QccBitBufferPutInt(output_buffer, end_frame_num)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeHeader): Error calling QccBitBufferPutInt()"); return(1); } if (QccBitBufferPutInt(output_buffer, blocksize)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeHeader): Error calling QccBitBufferPutInt()"); return(1); } if (QccBitBufferPutInt(output_buffer, num_levels)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeHeader): Error calling QccBitBufferPutInt()"); return(1); } if (QccBitBufferPutInt(output_buffer, target_bit_cnt)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeHeader): Error calling QccBitBufferPutInt()"); return(1); } if (QccBitBufferFlush(output_buffer)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeHeader): Error calling QccBitBufferFlush()"); return(1); } return(0);}static int QccVIDRDWTBlockDecodeFrame(); static int QccVIDRDWTBlockEncodeFrame(QccWAVSubbandPyramid *current_frame, QccMatrix *reconstructed_frame_rdwt, QccMatrix *reference_frame_rdwt, QccWAVSubbandPyramid ****reference_frame_phases, int blocksize, int num_levels, int subpixel_accuracy, const QccWAVWavelet *wavelet, QccBitBuffer *output_buffer, QccBitBuffer *input_buffer, QccVIDMotionVectorsTable *mvd_table, QccIMGImageComponent *motion_vector_horizontal, QccIMGImageComponent *motion_vector_vertical, int read_motion_vectors, int target_bit_cnt, QccVIDRDWTBlockStatistics *statistics, const QccFilter *filter1, const QccFilter *filter2, const QccFilter *filter3){ int return_value; int num_rows; int num_cols; int intraframe; double image_mean; int start_position; start_position = output_buffer->bit_cnt; num_rows = current_frame->num_rows; num_cols = current_frame->num_cols; intraframe = (motion_vector_horizontal == NULL) || (motion_vector_vertical == NULL); if (statistics != NULL) statistics->intraframe = intraframe; if (intraframe) if (QccWAVSubbandPyramidSubtractMean(current_frame, &image_mean, NULL)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeFrame): Error calling QccWAVSubbandPyramidSubtractMean()"); goto Error; } if (QccWAVSubbandPyramidDWT(current_frame, num_levels, wavelet)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeFrame): Error calling QccWAVSubbandPyramidDWT()"); goto Error; } if (!intraframe) { if (!read_motion_vectors) { if (QccVIDRDWTBlockMotionEstimation(reference_frame_phases, current_frame, motion_vector_horizontal, motion_vector_vertical, blocksize, subpixel_accuracy)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeFrame): Error calling QccVIDRDWTBlockMotionEstimation()"); goto Error; } if (QccVIDMotionVectorsEncode(motion_vector_horizontal, motion_vector_vertical, NULL, subpixel_accuracy, output_buffer)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeFrame): Error calling QccVIDMotionVectorsEncode()"); goto Error; } } if (QccVIDRDWTBlockMotionCompensation(reference_frame_phases, current_frame, motion_vector_horizontal, motion_vector_vertical, blocksize, subpixel_accuracy)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeFrame): Error calling QccVIDRDWTBlockMotionCompensation()"); goto Error; } if (statistics != NULL) statistics->motion_vector_bits = output_buffer->bit_cnt - start_position; if (output_buffer->bit_cnt > start_position + target_bit_cnt) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeFrame): Rate is not sufficient to store all motion vectors for frame"); goto Error; } image_mean = 0; } else if (statistics != NULL) statistics->motion_vector_bits = 0; if (QccSPIHTEncode2(current_frame, NULL, image_mean, output_buffer, start_position + target_bit_cnt, 1, NULL)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeFrame): Error calling QccSPIHTEncode2()"); goto Error; } if (statistics != NULL) statistics->intraframe_bits = output_buffer->bit_cnt - start_position - statistics->motion_vector_bits; if (QccBitBufferFlush(output_buffer)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeFrame): Error calling QccBitBufferFlush()"); goto Error; } if (QccVIDRDWTBlockDecodeFrame(current_frame, reconstructed_frame_rdwt, reference_frame_rdwt, reference_frame_phases, blocksize, num_levels, subpixel_accuracy, target_bit_cnt, wavelet, input_buffer, mvd_table, read_motion_vectors, motion_vector_horizontal, motion_vector_vertical, filter1, filter2, filter3)) { QccErrorAddMessage("(QccVIDRDWTBlockEncodeFrame): Error calling QccVIDRDWTBlockDecodeFrame()"); goto Error; } return_value = 0; goto Return; Error: return_value = 1; Return: return(return_value);}int QccVIDRDWTBlockDecodeHeader(QccBitBuffer *input_buffer, int *num_rows, int *num_cols, int *start_frame_num, int *end_frame_num, int *blocksize, int *num_levels, int *target_bit_cnt){ int val; if (QccBitBufferGetInt(input_buffer, &val)) { QccErrorAddMessage("(QccVIDRDWTBlockDecodeHeader): Error calling QccBitBufferGetInt()"); return(1); } if (num_rows != NULL) *num_rows = val; if (QccBitBufferGetInt(input_buffer, &val)) { QccErrorAddMessage("(QccVIDRDWTBlockDecodeHeader): Error calling QccBitBufferGetInt()"); return(1); } if (num_cols != NULL) *num_cols = val; if (QccBitBufferGetInt(input_buffer, &val)) { QccErrorAddMessage("(QccVIDRDWTBlockDecodeHeader): Error calling QccBitBufferGetInt()"); return(1); } if (start_frame_num != NULL) *start_frame_num = val; if (QccBitBufferGetInt(input_buffer, &val)) { QccErrorAddMessage("(QccVIDRDWTBlockDecodeHeader): Error calling QccBitBufferGetInt()"); return(1); } if (end_frame_num != NULL) *end_frame_num = val; if (QccBitBufferGetInt(input_buffer, &val)) { QccErrorAddMessage("(QccVIDRDWTBlockDecodeHeader): Error calling QccBitBufferGetInt()"); return(1); } if (blocksize != NULL) *blocksize = val; if (QccBitBufferGetInt(input_buffer, &val)) { QccErrorAddMessage("(QccVIDRDWTBlockDecodeHeader): Error calling QccBitBufferGetInt()"); return(1); } if (num_levels != NULL) *num_levels = val; if (QccBitBufferGetInt(input_buffer, &val)) { QccErrorAddMessage("(QccVIDRDWTBlockDecodeHeader): Error calling QccBitBufferGetInt()"); return(1); } if (target_bit_cnt != NULL) *target_bit_cnt = val; if (QccBitBufferFlush(input_buffer)) { QccErrorAddMessage("(QccVIDRDWTBlockDecodeHeader): Error calling QccBitBufferFlush()"); return(1); } return(0);}static int QccVIDRDWTBlockDecodeFrame(QccWAVSubbandPyramid *current_frame, QccMatrix *reconstructed_frame_rdwt, QccMatrix *reference_frame_rdwt, QccWAVSubbandPyramid ****reference_frame_phases, int blocksize, int num_levels, int subpixel_accuracy, int target_bit_cnt, const QccWAVWavelet *wavelet, QccBitBuffer *input_buffer, const QccVIDMotionVectorsTable *mvd_table, int read_motion_vectors, QccIMGImageComponent *motion_vector_horizontal, QccIMGImageComponent *motion_vector_vertical, const QccFilter *filter1, const QccFilter *filter2, const QccFilter *filter3){ int return_value; int num_rows; int num_cols; int reference_num_rows; int reference_num_cols; double image_mean; int max_coefficient_bits; int arithmetic_coded; int intraframe; int start_position; start_position = input_buffer->bit_cnt; num_rows = current_frame->num_rows; num_cols = current_frame->num_cols; if (QccVIDMotionEstimationCalcReferenceFrameSize(num_rows, num_cols, &reference_num_rows, &reference_num_cols, subpixel_accuracy)) { QccErrorAddMessage("(QccVIDRDWTBlockDecodeFrame): Error calling QccVIDMotionEstimationCalcReferenceFrameSize()"); goto Error; } intraframe = (motion_vector_horizontal == NULL) || (motion_vector_vertical == NULL); if ((!intraframe) && (!read_motion_vectors))
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -