Example #1
0
vsip_mview_uc *vsip_tmatrixview_uc(
     const vsip_tview_uc *v,
     vsip_tmslice slice,
     vsip_index index)
{
      vsip_mview_uc *mview = (vsip_mview_uc*)NULL;
      vsip_block_uc *block = v->block;
      vsip_offset off = v->offset;
      if(slice == VSIP_TMYX){
          off += index * v->z_stride;
          mview = vsip_mbind_uc(block,off,
                         v->y_stride,v->y_length,
                         v->x_stride,v->x_length);
      } else if(slice == VSIP_TMZX){
          off += index * v->y_stride;
          mview = vsip_mbind_uc(block,off,
                         v->z_stride,v->z_length,
                         v->x_stride,v->x_length);
      } else if(slice == VSIP_TMZY){
          off += index * v->x_stride;
          mview = vsip_mbind_uc(block,off,
                         v->z_stride,v->z_length,
                         v->y_stride,v->y_length);
      }
      return mview;
}
Example #2
0
vsip_mview_uc* (vsip_msubview_uc)(
  const vsip_mview_uc* v,
  vsip_index i, 
  vsip_index j, 
  vsip_length m, 
  vsip_length n) {
    return vsip_mbind_uc(v->block,
                         v->offset + i * v->col_stride + j * v->row_stride,
                         v->col_stride,
                         m,
                         v->row_stride,
                         n);
}
vsip_mview_uc* (vsip_mcreate_uc)(
  vsip_length col_length, 
  vsip_length row_length, 
  vsip_major major, 
  vsip_memory_hint mem_hint) {
   vsip_block_uc* b = VI_blockcreate_uc(
             (size_t)(col_length * row_length), mem_hint);
   vsip_mview_uc* v = (vsip_mview_uc*)NULL;
   if(b != NULL){

      v = (major == VSIP_ROW)
      ?
      vsip_mbind_uc(b, (vsip_offset)0,
          (vsip_stride)row_length, col_length,
          (vsip_stride)1, row_length)
      :
      vsip_mbind_uc(b, (vsip_offset)0,
          (vsip_stride)1,col_length,
          (vsip_stride)col_length, row_length);
    
      if(v == (vsip_mview_uc*)NULL) VI_blockdestroy_uc(b);
   }
   return v;
}