示例#1
0
文件: Motion.cs 项目: mono/csdirac
 private void InitializeRender(int k, VideoFormat f)
 {
     chroma_h_shift = f.ChromaHShift();
     chroma_v_shift = f.ChromaVShift();
     yblen = par.yblen_luma;
     xblen = par.xblen_luma;
     ybsep = par.ybsep_luma;
     xbsep = par.xbsep_luma;
     if(k != 0) {
         yblen >>= chroma_v_shift;
         ybsep >>= chroma_v_shift;
         xbsep >>= chroma_h_shift;
         xblen >>= chroma_h_shift;
     }
     yoffset = (yblen - ybsep) >> 1;
     xoffset = (xblen - xbsep) >> 1;
     /* initialize obmc weight */
     weight_y = new short[yblen];
     weight_x = new short[xblen];
     obmc = new short[xblen*yblen];
     for(int i = 0; i < xblen; i++) {
         short wx;
         if(xoffset == 0) {
         wx = 8;
         } else if( i < 2*xoffset) {
         wx = Util.GetRamp(i, xoffset);
         } else if(xblen - 1 - i < 2*xoffset) {
         wx = Util.GetRamp(xblen - 1 - i, xoffset);
         } else {
         wx = 8;
         }
         weight_x[i] = wx;
     }
     for(int j = 0; j < yblen; j++) {
         short wy;
         if(yoffset == 0) {
         wy = 8;
         } else if(j < 2*yoffset) {
         wy = Util.GetRamp(j, yoffset);
         } else if(yblen - 1 - j < 2*yoffset) {
         wy = Util.GetRamp(yblen - 1 - j, yoffset);
         } else {
         wy = 8;
         }
         weight_y[j] = wy;
     }
 }