⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spatialblock.c

📁 QccPack-0.54-1 released (2007-04-30) is being developed and tested on Fedora Core Linux. QccPack pro
💻 C
📖 第 1 页 / 共 3 页
字号:
                                    input_buffer,                                    mvd_table,                                    read_motion_vectors,                                    motion_vector_horizontal,                                    motion_vector_vertical,                                    filter1,                                    filter2,                                    filter3))    {      QccErrorAddMessage("(QccVIDSpatialBlockEncodeFrame): Error calling QccVIDSpatialBlockDecodeFrame()");      goto Error;    }    return_value = 0;  goto Return; Error:  return_value = 1; Return:  return(return_value);}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){  int val;    if (QccBitBufferGetInt(input_buffer, &val))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeHeader): Error calling QccBitBufferGetInt()");      return(1);    }  if (num_rows != NULL)    *num_rows = val;    if (QccBitBufferGetInt(input_buffer, &val))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeHeader): Error calling QccBitBufferGetInt()");      return(1);    }  if (num_cols != NULL)    *num_cols = val;    if (QccBitBufferGetInt(input_buffer, &val))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeHeader): Error calling QccBitBufferGetInt()");      return(1);    }  if (start_frame_num != NULL)    *start_frame_num = val;    if (QccBitBufferGetInt(input_buffer, &val))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeHeader): Error calling QccBitBufferGetInt()");      return(1);    }  if (end_frame_num != NULL)    *end_frame_num = val;    if (QccBitBufferGetInt(input_buffer, &val))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeHeader): Error calling QccBitBufferGetInt()");      return(1);    }  if (blocksize != NULL)    *blocksize = val;    if (QccBitBufferGetInt(input_buffer, &val))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeHeader): Error calling QccBitBufferGetInt()");      return(1);    }  if (num_levels != NULL)    *num_levels = val;    if (QccBitBufferGetInt(input_buffer, &val))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeHeader): Error calling QccBitBufferGetInt()");      return(1);    }  if (target_bit_cnt != NULL)    *target_bit_cnt = val;    if (QccBitBufferFlush(input_buffer))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeHeader): Error calling QccBitBufferFlush()");      return(1);    }    return(0);}static int QccVIDSpatialBlockDecodeFrame(QccIMGImageComponent *current_frame,                                         QccIMGImageComponent                                         *reference_frame,                                         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;  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;    intraframe =    (motion_vector_horizontal == NULL) || (motion_vector_vertical == NULL);    if ((!intraframe) && (!read_motion_vectors))    if (QccVIDMotionVectorsDecode(motion_vector_horizontal,                                  motion_vector_vertical,                                  NULL,                                  subpixel_accuracy,                                  input_buffer))      {        QccErrorAddMessage("(QccVIDSpatialBlockDecodeFrame): Error calling QccVIDMotionVectorsDecode()");        goto Error;      }    if (QccMatrixZero((QccMatrix)current_frame->image,                    num_rows, num_cols))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeFrame): Error calling QccMatrixZero()");      goto Error;    }    if (QccSPIHTDecodeHeader(input_buffer,                           &num_levels,                           &num_rows,                           &num_cols,                           &image_mean,                           &max_coefficient_bits,                           &arithmetic_coded))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeFrame): Error calling QccSPIHTDecodeHeader()");      goto Error;    }    if (QccSPIHTDecode(input_buffer,                     current_frame,                     NULL,                     num_levels,                     wavelet,                     NULL,                     image_mean,                     max_coefficient_bits,                     start_position + target_bit_cnt,                     arithmetic_coded))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeFrame):Error calling QccSPIHTDecode()");      goto Error;    }    if (QccBitBufferFlush(input_buffer))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeFrame):Error calling QccBitBufferFlush()");      goto Error;    }    if (!intraframe)    if (QccVIDSpatialBlockInverseMotionCompensation(current_frame,                                                    reference_frame,                                                    motion_vector_horizontal,                                                    motion_vector_vertical,                                                    blocksize,                                                    subpixel_accuracy))      {	QccErrorAddMessage("(QccVIDSpatialBlockDecodeFrame): Error calling QccVIDSpatialBlockInverseMotionCompensation()");        goto Error;      }    if (QccVIDMotionEstimationCreateReferenceFrame(current_frame,                                                 reference_frame,                                                 subpixel_accuracy,                                                 filter1,                                                 filter2,                                                 filter3))    {      QccErrorAddMessage("(QccVIDSpatialBlockDecodeFrame): Error calling QccVIDMotionEstimationCreateReferenceFrame()");      goto Error;    }    return_value = 0;  goto Return; Error:  return_value = 1; Return:  return(return_value);}int 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){  int return_value;  QccIMGImageComponent current_frame;  QccIMGImageComponent reference_frame;  QccIMGImageComponent motion_vector_horizontal;  QccIMGImageComponent motion_vector_vertical;  QccVIDMotionVectorsTable mvd_table;  int frame = 0;  int num_rows, num_cols;  int reference_num_rows, reference_num_cols;  QccBitBuffer input_buffer;  QccVIDSpatialBlockStatistics statistics;    QccBitBufferInitialize(&input_buffer);  QccIMGImageComponentInitialize(&current_frame);  QccIMGImageComponentInitialize(&reference_frame);  QccIMGImageComponentInitialize(&motion_vector_horizontal);  QccIMGImageComponentInitialize(&motion_vector_vertical);  QccVIDMotionVectorsTableInitialize(&mvd_table);    if (QccIMGImageSequenceStartRead(image_sequence))    {      QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccIMGImageSequenceStartRead()");      goto Error;    }    if (QccIMGImageGetSize(&image_sequence->current_frame,                         &num_rows, &num_cols))    {      QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccIMGImageGetSize()");      goto Error;    }    if ((num_rows % blocksize) || (num_cols % blocksize))    {      QccErrorAddMessage("(QccVIDSpatialBlockEncode): Image size is not an integer multiple of block size");      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("(QccVIDSpatialBlockEncode): 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("(QccVIDSpatialBlockEncode): Error calling QccIMGImageComponentAlloc()");      goto Error;    }    if (QccVIDMotionEstimationCalcReferenceFrameSize(num_rows,                                                   num_cols,                                                   &reference_num_rows,                                                   &reference_num_cols,                                                   subpixel_accuracy))    {      QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccVIDMotionEstimationCalcReferenceFrameSize()");      goto Error;    }    reference_frame.num_rows = reference_num_rows;  reference_frame.num_cols = reference_num_cols;  if (QccIMGImageComponentAlloc(&reference_frame))    {      QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccIMGImageComponentAlloc()");      goto Error;    }    QccStringCopy(input_buffer.filename, output_buffer->filename);  input_buffer.type = QCCBITBUFFER_INPUT;  if (QccBitBufferStart(&input_buffer))    {      QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccBitBufferStart()");      goto Error;    }    if (QccVIDSpatialBlockEncodeHeader(output_buffer,                                     num_rows,                                     num_cols,                                     image_sequence->start_frame_num,                                     image_sequence->end_frame_num,                                     blocksize,                                     num_levels,                                     target_bit_cnt))    {      QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccVIDSpatialBlockEncodeHeader()");      goto Error;    }    if (QccVIDSpatialBlockDecodeHeader(&input_buffer,                                     NULL, NULL, NULL, NULL, NULL, NULL, NULL))    {      QccErrorAddMessage("(QccVIDSpatialBlockEncodeFrame): Error calling QccVIDSpatialBlockDecodeHeader()");      goto Error;    }    if (QccVIDMotionVectorsTableCreate(&mvd_table))    {      QccErrorAddMessage("(QccVIDSpatialBlockEncode): Error calling QccVIDMotionVectorsTableCreate()");      goto Error;    }    if (!quiet)    {      printf("===========================================================\n");      printf("\n");      printf("  Spatial Block -- encoding sequence:\n      %s\n         to\n      %s\n\n",             image_sequence->filename,             output_buffer->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");    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -