📄 spatialblock.c
字号:
if (!quiet) printf(" Frame: %d\n", image_sequence->start_frame_num); if (QccVIDSpatialBlockEncodeFrame(¤t_frame, &reference_frame, blocksize, num_levels, subpixel_accuracy, wavelet, output_buffer, &input_buffer, &mvd_table, NULL, NULL, 0, target_bit_cnt, &statistics, filter1, filter2, filter3)) { QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccVIDSpatialBlockEncodeFrame()"); goto Error; } if (!quiet) QccVIDSpatialBlockPrintStatistics(&statistics); for (frame = image_sequence->start_frame_num + 1; frame <= image_sequence->end_frame_num; frame++) { if (!quiet) printf(" Frame: %d\n", frame); if (QccIMGImageSequenceIncrementFrameNum(image_sequence)) { QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccIMGImageSequenceIncrementFrameNum()"); goto Error; } if (QccIMGImageSequenceReadFrame(image_sequence)) { QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccIMGImageSequenceReadFrame()"); goto Error; } if ((mv_filename != NULL) && read_motion_vectors) if (QccVIDMotionVectorsReadFile(&motion_vector_horizontal, &motion_vector_vertical, mv_filename, frame)) { QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccVIDMotionVectorsReadFile()"); goto Error; } if (QccVIDSpatialBlockEncodeFrame(¤t_frame, &reference_frame, blocksize, num_levels, subpixel_accuracy, wavelet, output_buffer, &input_buffer, &mvd_table, &motion_vector_horizontal, &motion_vector_vertical, read_motion_vectors, target_bit_cnt, &statistics, filter1, filter2, filter3)) { QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccVIDSpatialBlockEncodeFrame()"); goto Error; } if ((mv_filename != NULL) && (!read_motion_vectors)) if (QccVIDMotionVectorsWriteFile(&motion_vector_horizontal, &motion_vector_vertical, mv_filename, frame)) { QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccVIDMotionVectorsWriteFile()"); goto Error; } if (!quiet) QccVIDSpatialBlockPrintStatistics(&statistics); } if (QccBitBufferEnd(&input_buffer)) { QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccBitBufferEnd()"); goto Error; } return_value = 0; goto Return; Error: return_value = 1; Return: QccIMGImageComponentFree(&motion_vector_horizontal); QccIMGImageComponentFree(&motion_vector_vertical); QccIMGImageComponentFree(&reference_frame); QccVIDMotionVectorsTableFree(&mvd_table); return(return_value);} int QccVIDSpatialBlockDecode(QccIMGImageSequence *image_sequence, const QccFilter *filter1, const QccFilter *filter2, const QccFilter *filter3, int subpixel_accuracy, QccBitBuffer *input_buffer, int target_bit_cnt, int blocksize, int num_levels, const QccWAVWavelet *wavelet, const QccString mv_filename, int quiet){ int return_value; int num_rows, num_cols; int reference_num_rows, reference_num_cols; QccIMGImageComponent current_frame; QccIMGImageComponent reference_frame; QccIMGImageComponent motion_vector_horizontal; QccIMGImageComponent motion_vector_vertical; QccVIDMotionVectorsTable mvd_table; int frame; QccIMGImageComponentInitialize(¤t_frame); QccIMGImageComponentInitialize(&reference_frame); QccIMGImageComponentInitialize(&motion_vector_horizontal); QccIMGImageComponentInitialize(&motion_vector_vertical); QccVIDMotionVectorsTableInitialize(&mvd_table); image_sequence->current_frame_num = image_sequence->start_frame_num; if (QccIMGImageGetSize(&image_sequence->current_frame, &num_rows, &num_cols)) { QccErrorAddMessage("(QccVIDSpatialBlockDecode): Error calling QccIMGImageGetSize()"); goto Error; } current_frame.num_rows = num_rows; current_frame.num_cols = num_cols; current_frame.image = image_sequence->current_frame.Y.image; motion_vector_horizontal.num_rows = num_rows / blocksize; motion_vector_horizontal.num_cols = num_cols / blocksize; if (QccIMGImageComponentAlloc(&motion_vector_horizontal)) { QccErrorAddMessage("(QccVIDSpatialBlockDecode): Error calling QccIMGImageComponentAlloc()"); goto Error; } motion_vector_vertical.num_rows = num_rows / blocksize; motion_vector_vertical.num_cols = num_cols / blocksize; if (QccIMGImageComponentAlloc(&motion_vector_vertical)) { QccErrorAddMessage("(QccVIDSpatialBlockDecode): Error calling QccIMGImageComponentAlloc()"); goto Error; } if (QccVIDMotionEstimationCalcReferenceFrameSize(num_rows, num_cols, &reference_num_rows, &reference_num_cols, subpixel_accuracy)) { QccErrorAddMessage("(QccVIDSpatialBlockDecode): Error calling QccVIDMotionEstimationCalcReferenceFrameSize()"); goto Error; } reference_frame.num_rows = reference_num_rows; reference_frame.num_cols = reference_num_cols; if (QccIMGImageComponentAlloc(&reference_frame)) { QccErrorAddMessage("(QccVIDSpatialBlockDecode): Error calling QccIMGImageComponentAlloc()"); goto Error; } if (QccVIDMotionVectorsTableCreate(&mvd_table)) { QccErrorAddMessage("(QccVIDSpatialBlockDecode): Error calling QccVIDMotionVectorsTableCreate()"); goto Error; } if (!quiet) { printf("===========================================================\n"); printf("\n"); printf(" Spatial Block -- decoding sequence:\n %s\n to\n %s\n\n", input_buffer->filename, image_sequence->filename); printf(" Frame size: %d x %d\n", num_cols, num_rows); printf(" Start frame: %d\n", image_sequence->start_frame_num); printf(" End frame: %d\n\n", image_sequence->end_frame_num); printf("===========================================================\n"); printf("\n"); } if (!quiet) printf(" Frame %d\n", image_sequence->start_frame_num); if (QccVIDSpatialBlockDecodeFrame(¤t_frame, &reference_frame, blocksize, num_levels, subpixel_accuracy, target_bit_cnt, wavelet, input_buffer, &mvd_table, 0, NULL, NULL, filter1, filter2, filter3)) { QccErrorAddMessage("(QccVIDSpatialBlockDecode): Error calling QccVIDSpatialBlockDecodeFrame()"); goto Error; } if (QccIMGImageSequenceWriteFrame(image_sequence)) { QccErrorAddMessage("(QccVIDSpatialBlockDecode): Error calling QccIMGImageSequenceWriteFrame()"); goto Error; } for (frame = image_sequence->start_frame_num + 1; frame <= image_sequence->end_frame_num; frame++) { if (QccIMGImageSequenceIncrementFrameNum(image_sequence)) { QccErrorAddMessage("(QccVIDSpatialBlockDecode): Error calling QccIMGImageSequenceIncrementFrameNum()"); goto Error; } if (!quiet) printf(" Frame %d\n", image_sequence->current_frame_num); if (mv_filename != NULL) if (QccVIDMotionVectorsReadFile(&motion_vector_horizontal, &motion_vector_vertical, mv_filename, frame)) { QccErrorAddMessage("(QccVIDSpatialBlockDecode): Error calling QccVIDMotionVectorsReadFile()"); goto Error; } if (QccVIDSpatialBlockDecodeFrame(¤t_frame, &reference_frame, blocksize, num_levels, subpixel_accuracy, target_bit_cnt, wavelet, input_buffer, &mvd_table, (mv_filename != NULL), &motion_vector_horizontal, &motion_vector_vertical, filter1, filter2, filter3)) { QccErrorAddMessage("(QccVIDSpatialBlockDecode): Error calling QccVIDSpatialBlockDecodeFrame()"); goto Error; } if (QccIMGImageSequenceWriteFrame(image_sequence)) { QccErrorAddMessage("(QccVIDSpatialBlockDecode(): Error calling QccIMGImageSequenceWriteFrame()"); goto Error; } } return_value = 0; goto Return; Error: return_value = 1; Return: QccIMGImageComponentFree(&motion_vector_horizontal); QccIMGImageComponentFree(&motion_vector_vertical); QccIMGImageComponentFree(&reference_frame); QccVIDMotionVectorsTableFree(&mvd_table); return(return_value);}#elseint QccVIDSpatialBlockEncode(QccIMGImageSequence *image_sequence, const QccFilter *filter1, const QccFilter *filter2, const QccFilter *filter3, int subpixel_accuracy, QccBitBuffer *output_buffer, int blocksize, int num_levels, int target_bit_cnt, const QccWAVWavelet *wavelet, const QccString mv_filename, int read_motion_vectors, int quiet){ QccErrorAddMessage("(QccVIDSpatialBlockEncode): Optional QccSPIHT module is not available -- spatial-block coder is consequently not supported"); return(1);}int QccVIDSpatialBlockDecodeHeader(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){ QccErrorAddMessage("(QccVIDSpatialBlockEncode): Optional QccSPIHT module is not available -- spatial-block coder is consequently not supported"); return(1);}int QccVIDSpatialBlockDecode(QccIMGImageSequence *image_sequence, const QccFilter *filter1, const QccFilter *filter2, const QccFilter *filter3, int subpixel_accuracy, QccBitBuffer *input_buffer, int target_bit_cnt, int blocksize, int num_levels, const QccWAVWavelet *wavelet, const QccString mv_filename, int quiet){ QccErrorAddMessage("(QccVIDSpatialBlockEncode): Optional QccSPIHT module is not available -- spatial-block coder is consequently not supported"); return(1);}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -