示例#1
0
void image_data_stats_block(image_data *_this,const unsigned char *_data,
 int _stride,int _bi,int _bj,intra_stats *_stats){
  int       b_sz;
  int       mode;
  od_coeff *ref;
  double   *pred;
  int       j;
  int       i;
  double    buf[B_SZ_MAX*B_SZ_MAX];
  b_sz=1<<_this->b_sz_log;
#if MASK_BLOCKS
  if(!_this->mask[_this->nxblocks*_bj+_bi]){
    return;
  }
#endif
  mode=_this->mode[_this->nxblocks*_bj+_bi];
  ref=&_this->fdct[_this->fdct_stride*b_sz*(_bj+1)+b_sz*(_bi+1)];
  pred=&_this->pred[_this->pred_stride*b_sz*_bj+b_sz*_bi];
  for(j=0;j<b_sz;j++){
    for(i=0;i<b_sz;i++){
      buf[b_sz*j+i]=ref[_this->fdct_stride*j+i]-pred[_this->pred_stride*j+i];
    }
  }
  intra_stats_update(_stats,_data,_stride,mode,ref,_this->fdct_stride,buf,b_sz);
}
示例#2
0
文件: intra_stats.c 项目: ekr/daala
static void vp8_stats_block(intra_stats_ctx *_ctx,const unsigned char *_data,
 int _stride,int _bi,int _bj,int _mode,const unsigned char *_pred){
  int      j;
  int      i;
  od_coeff ref[B_SZ*B_SZ];
  od_coeff buf[B_SZ*B_SZ];
  double   res[B_SZ*B_SZ];
  (void)_bi;
  (void)_bj;
  /* Compute reference transform coefficients. */
  for(j=0;j<B_SZ;j++){
    for(i=0;i<B_SZ;i++){
      ref[B_SZ*j+i]=(_data[_stride*j+i]-128)*INPUT_SCALE;
    }
  }
#if B_SZ_LOG>=OD_LOG_BSIZE0&&B_SZ_LOG<OD_LOG_BSIZE0+OD_NBSIZES
  (*OD_FDCT_2D[B_SZ_LOG-OD_LOG_BSIZE0])(ref,B_SZ,ref,B_SZ);
#else
# error "Need an fDCT implementation for this block size."
#endif
  /* Compute residual transform coefficients. */
  for(j=0;j<B_SZ;j++){
    for(i=0;i<B_SZ;i++){
      buf[B_SZ*j+i]=(_data[_stride*j+i]-_pred[B_SZ*j+i])*INPUT_SCALE;
    }
  }
#if B_SZ_LOG>=OD_LOG_BSIZE0&&B_SZ_LOG<OD_LOG_BSIZE0+OD_NBSIZES
  (*OD_FDCT_2D[B_SZ_LOG-OD_LOG_BSIZE0])(buf,B_SZ,buf,B_SZ);
#else
# error "Need an fDCT implementation for this block size."
#endif
  for(j=0;j<B_SZ;j++){
    for(i=0;i<B_SZ;i++){
      res[B_SZ*j+i]=buf[B_SZ*j+i];
    }
  }
  intra_stats_update(&_ctx->st_vp8,_data,_stride,_mode,ref,B_SZ,res,B_SZ);
}