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

📄 fmo.c

📁 jm61 的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:

  switch(FmoMode)
  {
  case 4:
    if(img->slice_group_change_direction == 0)
      FmoBoxoutClockwise (img, inp, XSize, YSize, MBAmap);
    else 
      FmoBoxoutCounterClockwise (img, inp, XSize, YSize, MBAmap);
    break;
  case 5:
    if(img->slice_group_change_direction == 0)
      FmoRasterScan (img, inp, XSize, YSize, MBAmap);
    else
      FmoInverseRasterScan (img, inp, XSize, YSize, MBAmap);
    break;
  case 6:
    if(img->slice_group_change_direction == 0)
      FmoWipeRight (img, inp, XSize, YSize, MBAmap);
    else
      FmoWipeLeft (img, inp, XSize, YSize, MBAmap);
    break;
  }

/*
{
int xx, yy;
for (yy=0;yy<YSize; yy++) {
for (xx=0; xx<XSize;xx++) printf ("%d ", MBAmap [yy*XSize+xx]);
printf ("\n"); }
printf ("\n");
}
*/

  return 0;
}

int FmoWipeLeft(struct img_par *img, struct inp_par *inp, int XSize, int YSize, int *MBAmap)
{
  int i, x, y, n;

  x = XSize-1; 
  y = YSize-1;

  n = (img->slice_group_change_cycle+1) * (img->slice_group_change_rate_minus1+1);

  for(i=0; i<n; i++)
  {
    // update the MBAmap unit of the MB (x,y)
    MBAmap[y*XSize+x] = 0;

    // go to the next MB
    if(y > 0) y--;
    else if(x > 0)
    {
      y = YSize-1;
      x--;
    }
    else 
      break;
  }

  return 0;
}

int FmoWipeRight(struct img_par *img, struct inp_par *inp, int XSize, int YSize, int *MBAmap)
{
  int i, x, y, n;

  x = 0; 
  y = 0;

  n = (img->slice_group_change_cycle+1) * (img->slice_group_change_rate_minus1+1);

  for(i=0; i<n; i++)
  {
    // update the MBAmap unit of the MB (x,y)
    MBAmap[y*XSize+x] = 0;

    // go to the next MB
    if(y < YSize-1) y++;
    else if(x < XSize-1)
    {
      y = 0;
      x++;
    }
    else 
      break;
  }

  return 0;
}

int FmoInverseRasterScan(struct img_par *img, struct inp_par *inp, int XSize, int YSize, int *MBAmap)
{
  int i, x, y, n, nextMBnum;

  x = XSize -1; 
  y = YSize -1;

  n = (img->slice_group_change_cycle+1) * (img->slice_group_change_rate_minus1+1);
  nextMBnum = y * XSize + x;

  for(i=0; i<n; i++)
  {
    // update the next MBAmap unit
    MBAmap[nextMBnum] = 0;

    // go to the next MB
    nextMBnum--;
    // check whether passed already the last MB in the evolving period
    if( nextMBnum < 0 ) 
      break;
  }

  return 0;
}

int FmoRasterScan(struct img_par *img, struct inp_par *inp, int XSize, int YSize, int *MBAmap)
{
  int i, x, y, n, nextMBnum;

  x = 0; 
  y = 0;

  n = (img->slice_group_change_cycle+1) * (img->slice_group_change_rate_minus1+1);
  nextMBnum = y * XSize + x;

  for(i=0; i<n; i++)
  {
    // update the next MBAmap unit
    MBAmap[nextMBnum] = 0;

    // go to the next MB
    nextMBnum++;
    // check whether passed already the last MB in the evolving period
    if( nextMBnum >= XSize*YSize ) 
      break;
  }

  return 0;
}

int FmoBoxoutCounterClockwise (struct img_par *img, struct inp_par *inp, int XSize, int YSize, int *MBAmap)
{
  int i, n;
  int W = XSize, H = YSize;
  
  int x = ( XSize - 1 ) / 2;
  int y = ( YSize - 1) / 2;
  int directx = 0;
  int directy = 1;
  int left = x;
  int right = x;
  int top = y;
  int bottom = y;

  n = (img->slice_group_change_cycle+1) * (img->slice_group_change_rate_minus1+1);

  for(i=0; i<n; i++)
  {
    // update the MBAmap unit of the MB (x,y)
    MBAmap[y*XSize+x] = 0;

    // go to the next mb (x, y)
    if ( directx == -1 && directy == 0 )
    {
      if (x > left) x--;
      else if (x == 0)
      {
        y = bottom + 1;
        bottom++;
        directx = 1;
        directy = 0;
      }
      else if (x == left)
      {
        x--;
        left--;
        directx = 0;
        directy = 1;
      }
    }
    else if ( directx == 1 && directy == 0 )
    {
      if (x < right) x++;
      else if (x == W - 1)
      {
        y = top - 1;
        top--;
        directx = -1;
        directy = 0;
      }
      else if (x == right)
      {
        x++;
        right++;
        directx = 0;
        directy = -1;
      }
    }
    else if ( directx == 0 && directy == -1 )
    {
      if ( y > top) y--;
      else if (y == 0)
      {
        x = left - 1;
        left--;
        directx = 0;
        directy = 1;
      }
      else if (y == top)
      {
        y--;
        top--;
        directx = -1;
        directy = 0;
      }
    }
    else if ( directx == 0 && directy == 1 )
    {
      if (y < bottom) y++;
      else if (y == H - 1)
      {
        x = right+1;
        right++;
        directx = 0;
        directy = -1;
      }
      else if (y == bottom)
      {
        y++;
        bottom++;
        directx = 1;
        directy = 0;
      }
    }

    // check whether passed already the last MB in the evolving period
    if( !(left >= 0 && right < W && top >= 0 && bottom < H) ) 
      break;
  }

  return 0;
}

int FmoBoxoutClockwise (struct img_par *img, struct inp_par *inp, int XSize, int YSize, int *MBAmap)
{
  int i, n;
  int W = XSize, H = YSize;
  
  int x = XSize / 2;
  int y = YSize / 2;
  int directx = -1;
  int directy = 0;
  int left = x;
  int right = x;
  int top = y;
  int bottom = y;

  n = (img->slice_group_change_cycle+1) * (img->slice_group_change_rate_minus1+1);

  for(i=0; i<n; i++)
  {
    // update the MBAmap unit of the MB (x,y)
    MBAmap[y*XSize+x] = 0;

    // go to the next mb (x, y)
    if ( directx == -1 && directy == 0 )
    {
      if (x > left) x--;
      else if (x == 0)
      {
        y = top - 1;
        top--;
        directx = 1;
        directy = 0;
      }
      else if (x == left)
      {
        x--;
        left--;
        directx = 0;
        directy = -1;
      }
    }
    else if ( directx == 1 && directy == 0 )
    {
      if (x < right) x++;
      else if (x == W - 1)
      {
        y = bottom + 1;
        bottom++;
        directx = -1;
        directy = 0;
      }
      else if (x == right)
      {
        x++;
        right++;
        directx = 0;
        directy = 1;
      }
    }
    else if ( directx == 0 && directy == -1 )
    {
      if ( y > top) y--;
      else if (y == 0)
      {
        x = right + 1;
        right++;
        directx = 0;
        directy = 1;
      }
      else if (y == top)
      {
        y--;
        top--;
        directx = 1;
        directy = 0;
      }
    }
    else if ( directx == 0 && directy == 1 )
    {
      if (y < bottom) y++;
      else if (y == H - 1)
      {
        x = left - 1;
        left--;
        directx = 0;
        directy = -1;
      }
      else if (y == bottom)
      {
        y++;
        bottom++;
        directx = -1;
        directy = 0;
      }
    }

    // check whether passed already the last MB in the evolving period
    if( !(left >= 0 && right < W && top >= 0 && bottom < H) ) 
      break;
  }

  return 0;
}
// End JVT-D097


⌨️ 快捷键说明

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