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

📄 dcttce.c

📁 spiht for linux this is used to decod and encode vedio i wich all enjoy
💻 C
📖 第 1 页 / 共 5 页
字号:
  if ((p2 = QccVectorAlloc(subband_num_cols)) == NULL)    {      QccErrorAddMessage("(QccWAVdcttceIPBand): Error calling QccVectorAlloc()");      goto Error;    }    child_density =    subband_significance[subband] / (subband_num_rows * subband_num_cols);  p_lowerbound = 1.0 / (subband_num_rows * subband_num_cols);    if (subband <= 3)    {      parent_subband = 0;      parent_density =        subband_significance[0] / (subband_num_rows * subband_num_cols);    }  else    {      parent_subband = subband - 3;      parent_density =        subband_significance[parent_subband] /        (subband_num_rows * subband_num_cols) * 4;    }    for (col = 0; col < subband_num_cols; col++)    p2[col] = p_estimation[subband_origin_row][subband_origin_col + col] *      2 * (1 + alpha_h) / (2*alpha_v + 2*alpha_h);    scale =    QccMathMax(child_density, p_lowerbound) /    QccMathMax(parent_density, p_lowerbound);   increment =    1.0 / (subband_num_rows * subband_num_cols) /    QccMathMax(parent_density, p_lowerbound);    for (row = 0; row < subband_num_rows; row++)    {          p1 = p2[0]*(1 - alpha_v)/(1 + alpha_h);      current_row = subband_origin_row + row;      for (col = 0; col < subband_num_cols; col++)        {             current_col = subband_origin_col + col;          p_char = &(significance_map[current_row][current_col]);          p_forward = alpha_h*p1 + alpha_v*p2[col];                    if (*p_char < QCCWAVDCTTCE_S)            {                    p = p_forward + p_estimation[current_row][current_col];              if (subband != 0)                {                   if (subband <= 3)                    p_parent = p_estimation[row][col];                  else                    p_parent = p_estimation[current_row/2][current_col/2];                  if (p < QCCWAVTCE_PREDICT_THRESHOLD)                    {                                p_parent = QccMathMin(p_parent*scale, 0.8);                      p =                        p * QCCWAVTCE_CURRENT_SCALE +                        QCCWAVTCE_PARENT_SCALE * p_parent;                    }                }                            if (QccWAVdcttceUpdateModel(model, p))                {                  QccErrorAddMessage("(QccWAVdcttceIPBand): Error calling QccWAVdcttceUpdateModel()");                  return_value = 1;                  goto Error;                }              if (buffer->type == QCCBITBUFFER_OUTPUT)                {                  if (coefficients->matrix[current_row][current_col] >=                      threshold)                    {                      symbol = 1;                      coefficients->matrix[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->matrix[current_row][current_col] =                      1.5 * threshold;                }              v = symbol;                            if (symbol)                {                  subband_significance[subband]++;                  scale += increment;                  *p_char = QCCWAVDCTTCE_S_NEW;                                    if (QccWAVdcttceUpdateModel(model, 0.5))                    {                      QccErrorAddMessage("(QccWAVdcttceIPBand): Error calling QccWAVdcttceUpdateModel()");                      goto Error;                    }                                    if (buffer->type == QCCBITBUFFER_OUTPUT)                    {                      symbol = (int)(sign_array[current_row][current_col]);                      return_value =                        QccENTArithmeticEncode(&symbol, 1,model, buffer);                          }                  else                    {                      if (QccENTArithmeticDecode(buffer,model,&symbol, 1))                        return_value = 2;                            sign_array[current_row][current_col] = (char)symbol;                    }                  QccWAVUpdateNZNStatus(subband_origin_row,                                        subband_origin_col,                                        subband_num_rows,                                        subband_num_cols,                                        row,                                        col,                                        significance_map,                                        subband);                }                                if (return_value == 2)                goto Return;              else                {                  if (return_value)                    {                      QccErrorAddMessage("(QccWAVdcttceIPBand): QccWAVdcttceIPBand()");                      goto Error;                    }                }                  p1 = alpha_h * p1 + filter_coef * v;              p2[col] = p1 + alpha_v * p2[col];            }          else            {                  p1 = alpha_h * p1 + filter_coef * QCCWAVTCE_REFINE_HOLDER;              p2[col] = p1 + alpha_v * p2[col];            }          p_estimation[subband_origin_row + row][subband_origin_col + col] =            p_forward;        }            p3 = p2[subband_num_cols-1]*(1 - alpha_v)/(1 + alpha_h);        for (col = subband_num_cols - 1; col >= 0; col--)        {             p2[col] = p2[col] + alpha_h * p3;          p_char = &(significance_map[current_row][subband_origin_col + col]);          if (*p_char == QCCWAVDCTTCE_S)            p3 = alpha_h * p3 + filter_coef * QCCWAVTCE_REFINE_HOLDER;            else            {              v = (*p_char == QCCWAVDCTTCE_S_NEW);              p3 = alpha_h * p3 + filter_coef * v;            }        }    }    for (row = subband_num_rows - 1; row >= 0; row--)    {      p1 = p2[subband_num_cols-1]*(1 - alpha_v)/(1 + alpha_h);       current_row = subband_origin_row + row;      for (col = subband_num_cols-1; col >=0; col--)        {             current_col = subband_origin_col + col;           p_char = &(significance_map[current_row][current_col]);          p_estimation[current_row][current_col] +=            alpha_h*p1 + alpha_v*p2[col];          if (*p_char == QCCWAVDCTTCE_S)            {              p_estimation[current_row][current_col]=                QCCWAVTCE_REFINE_HOLDER * weight[0] +                p_estimation[current_row][current_col] * weight[1];              p1 = alpha_h * p1 + filter_coef * QCCWAVTCE_REFINE_HOLDER;            }          else            {              v = (*p_char == QCCWAVDCTTCE_S_NEW);              p_estimation[current_row][current_col] =                v * weight[0] +                p_estimation[current_row][current_col] * weight[1];              p1 = alpha_h * p1 + filter_coef * v;            }              p2[col] = p1 + alpha_v * p2[col];           }            p3 = p2[0]*(1 - alpha_v)/(1 + alpha_h);      for (col = 0; col < subband_num_cols; col++)        {          p2[col] = p2[col] + alpha_h * p3;          current_col = subband_origin_col + col;           p_char = &(significance_map[current_row][current_col]);          if (*p_char == QCCWAVDCTTCE_S)            p3 = alpha_h * p3 + filter_coef * QCCWAVTCE_REFINE_HOLDER;          else            {              v = (*p_char == QCCWAVDCTTCE_S_NEW);              p3 = alpha_h * p3 + filter_coef * v;            }                }    }    return_value = 0;  goto Return; Error:  return_value = 1; Return:   QccVectorFree(p2);   return(return_value); }static int QccWAVdcttceIPPass(QccWAVSubbandPyramid *coefficients,                                  char **significance_map,                              char **sign_array,                              double threshold,                              double **p_estimation,                              double *subband_significance,                              QccENTArithmeticModel *model,                              QccBitBuffer *buffer,                              int *max_coefficient_bits){  int return_value;  int subband;  int num_subbands;     num_subbands =    QccWAVSubbandPyramidNumLevelsToNumSubbands(coefficients->num_levels);    for (subband = 0; subband < num_subbands; subband++)    {      if ((threshold - 0.000001) <          pow((double)2, (double)max_coefficient_bits[subband]))        {          return_value =            QccWAVdcttceRevEst(coefficients,                               significance_map,                               subband,                               subband_significance,                               p_estimation);          if (return_value == 1)            {              QccErrorAddMessage("(QccWAVdcttceIPPass): Error calling QccWAVdcttceRevEst()");              return(1);            }          else            {              if (return_value == 2)                return(2);            }                    return_value = QccWAVdcttceIPBand(coefficients,                                            significance_map,                                            sign_array,                                            p_estimation,                                            subband_significance,                                            subband,                                            threshold,                                            model,                                            buffer);          if (return_value == 1)            {              QccErrorAddMessage("(QccWAVdcttceIPPass): Error calling QccWAVdcttceIPBand()");              return(1);            }          else            {              if (return_value == 2)                return(2);            }        }    }     return(0);}static int QccWAVdcttceNZNPass(QccWAVSubbandPyramid *coefficients,                                   char **significance_map,                               char **sign_array,                               double threshold,                               double** p_estimation,                               double *subband_significance,                               QccENTArithmeticModel *model,                               QccBitBuffer *buffer,                               int *max_coefficient_bits){   int return_value;  int subband;  int num_subbands;  int subband_origin_row;  int subband_origin_col;  int subband_num_rows;  int subband_num_cols;  int row, col;  int current_row, current_col;  int symbol;  double p = 0.5;    num_subbands =    QccWAVSubbandPyramidNumLevelsToNumSubbands(coefficients->num_levels);    for (subband = 0; subband < num_subbands; subband++)    {      if ((threshold - 0.000001) <          pow((double)2, (double)(max_coefficient_bits[subband]-1)))        {             if (QccWAVSubbandPyramidSubbandSize(coefficients,                                              subband,                                              &subband_num_rows,                                              &subband_num_cols))            {              QccErrorAddMessage("(QccWAVdcttceNZNPass): Error calling QccWAVSubbandPyramidSubbandSize()");              return(1);            }          if (QccWAVSubbandPyramidSubbandOffsets(coefficients,                                                 subband,                                                 &subband_origin_row,                                                 &subband_origin_col))            {              QccErrorAddMessage("(QccWAVdcttceNZNPass): Error calling QccWAVSubbandPyramidSubbandOffsets()");              return(1);            }                    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_row][current_col] == QCCWAVDCTTCE_NZN)                    {                      if (QccWAVdcttceUpdateModel(model, p))                        {                          QccErrorAddMessage("(QccWAVdcttceNZNPass): Error calling QccWAVdcttceUpdateModel()");                          return_value = 1;                          return(1);                        }                      if (buffer->type == QCCBITBUFFER_OUTPUT)                        {                          if (coefficients->matrix[current_row][current_col] >=                              threshold)                            {                              symbol = 1;                              coefficients->matrix[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)

⌨️ 快捷键说明

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