示例#1
0
文件: state.c 项目: kazutomi/xiphqt
/*Fills in the mapping from macro blocks to their corresponding fragment
   numbers in each plane.
  _mbs:     The array of macro blocks.
  _fplanes: The descriptions of the fragment planes.
  _ctype:   The chroma decimation type.*/
static void oc_mb_create_mapping(oc_mb _mbs[],
 const oc_fragment_plane _fplanes[3],int _ctype){
  oc_mb_fill_cmapping_func  mb_fill_cmapping;
  oc_mb                    *mb0;
  int                       y;
  mb0=_mbs;
  mb_fill_cmapping=OC_MB_FILL_CMAPPING_TABLE[_ctype];
  /*Loop through the Y plane super blocks.*/
  for(y=0;y<_fplanes[0].nvfrags;y+=4){
    int x;
    for(x=0;x<_fplanes[0].nhfrags;x+=4,mb0+=4){
      int ymb;
      /*Loop through the macro blocks in each super block in display order.*/
      for(ymb=0;ymb<2;ymb++){
        int xmb;
        for(xmb=0;xmb<2;xmb++){
          oc_mb *mb;
          int    mbx;
          int    mby;
          mb=mb0+OC_MB_MAP[ymb][xmb];
          mbx=x|xmb<<1;
          mby=y|ymb<<1;
          mb->x=mbx<<3;
          mb->y=mby<<3;
          /*Initialize fragment indexes to -1.*/
          memset(mb->map,0xFF,sizeof(mb->map));
          /*Make sure this macro block is within the encoded region.*/
          if(mbx>=_fplanes[0].nhfrags||mby>=_fplanes[0].nvfrags){
            mb->mode=OC_MODE_INVALID;
            continue;
          }
          /*Fill in the fragment indices for the Y plane.*/
          oc_mb_fill_ymapping(mb,_fplanes,mbx,mby);
          /*Fill in the fragment indices for the chroma planes.*/
          (*mb_fill_cmapping)(mb,_fplanes,mbx,mby);
        }
      }
    }
  }
}
示例#2
0
/*Fills in the mapping from macro blocks to their corresponding fragment
   numbers in each plane.
  _mb_maps:   The list of macro block maps.
  _mb_modes:  The list of macro block modes; macro blocks completely outside
               the coded region are marked invalid.
  _fplanes:   The descriptions of the fragment planes.
  _pixel_fmt: The chroma decimation type.*/
static void oc_mb_create_mapping(oc_mb_map _mb_maps[],
 signed char _mb_modes[],const oc_fragment_plane _fplanes[3],int _pixel_fmt){
  oc_mb_fill_cmapping_func  mb_fill_cmapping;
  unsigned                  sbi;
  int                       y;
  mb_fill_cmapping=OC_MB_FILL_CMAPPING_TABLE[_pixel_fmt];
  /*Loop through the luma plane super blocks.*/
  for(sbi=y=0;y<_fplanes[0].nvfrags;y+=4){
    int x;
    for(x=0;x<_fplanes[0].nhfrags;x+=4,sbi++){
      int ymb;
      /*Loop through the macro blocks in each super block in display order.*/
      for(ymb=0;ymb<2;ymb++){
        int xmb;
        for(xmb=0;xmb<2;xmb++){
          unsigned mbi;
          int      mbx;
          int      mby;
          mbi=sbi<<2|OC_MB_MAP[ymb][xmb];
          mbx=x|xmb<<1;
          mby=y|ymb<<1;
          /*Initialize fragment indices to -1.*/
          memset(_mb_maps[mbi],0xFF,sizeof(_mb_maps[mbi]));
          /*Make sure this macro block is within the encoded region.*/
          if(mbx>=_fplanes[0].nhfrags||mby>=_fplanes[0].nvfrags){
            _mb_modes[mbi]=OC_MODE_INVALID;
            continue;
          }
          /*Fill in the fragment indices for the luma plane.*/
          oc_mb_fill_ymapping(_mb_maps[mbi],_fplanes,mbx,mby);
          /*Fill in the fragment indices for the chroma planes.*/
          (*mb_fill_cmapping)(_mb_maps[mbi],_fplanes,mbx,mby);
        }
      }
    }
  }
}