org.diracvideo.Jirac.Vector.Scale C# (CSharp) Method

Scale() public method

public Scale ( int h_shift, int v_shift ) : Vector
h_shift int
v_shift int
return Vector
        public Vector Scale(int h_shift, int v_shift)
        {
            Vector o = new Vector();
            o.namespace_global = namespace_global;
            o.pred_mode = pred_mode;
            o.dx[0] = dx[0] >> h_shift;
            o.dx[1] = dx[1] >> h_shift;
            o.dy[0] = dy[0] >> v_shift;
            o.dy[1] = dy[1] >> v_shift;
            return o;
        }

Usage Example

Exemplo n.º 1
0
 private short PredictPixel(Vector mv, int x,  int y, int k)
 {
     if(mv.namespace_global) {
         for(int i = 0; i < par.num_refs; i++) {
         par.global[i].GetVector(mv, x, y, i);
         }
         if(k != 0)
         mv = mv.Scale(chroma_h_shift, chroma_v_shift);
     }
     short weight = (short)(par.picture_weight_1 + par.picture_weight_2);
     short val = 0;
     int px, py;
     switch(mv.pred_mode) {
     case 1:
         px = (x << par.mv_precision) + mv.dx[0];
         py = (y << par.mv_precision) + mv.dy[0];
         val = (short)(weight*PredictSubPixel(0, px, py));
         break;
     case 2:
         px = (x << par.mv_precision) + mv.dx[1];
         py = (y << par.mv_precision) + mv.dy[1];
         val = (short)(weight*PredictSubPixel(1, px, py));
         break;
     case 3:
         px = (x << par.mv_precision) + mv.dx[0];
         py = (y << par.mv_precision) + mv.dy[0];
         val = (short)(par.picture_weight_1*PredictSubPixel(0, px, py));
         px = (x << par.mv_precision) + mv.dx[1];
         py = (x << par.mv_precision) + mv.dy[1];
         val += (short)(par.picture_weight_2*PredictSubPixel(1, px, py));
         break;
     default:
         break;
     }
     return (short)Util.RoundShift(val, par.picture_weight_bits);
 }