Beispiel #1
0
  static void MBfilter(
      int hev_threshold, /* detect high edge variance */
      int interior_limit, /* possibly disable filter */
      int edge_limit,
      Segment seg) {
    int p3 = u2s(seg.P3), p2 = u2s(seg.P2), p1 = u2s(seg.P1), p0 = u2s(seg.P0);
    int q0 = u2s(seg.Q0), q1 = u2s(seg.Q1), q2 = u2s(seg.Q2), q3 = u2s(seg.Q3);
    if (filter_yes(interior_limit, edge_limit, q3, q2, q1, q0, p0, p1, p2, p3)) {
      if (!hev(hev_threshold, p1, p0, q0, q1)) {
        // Same as the initial calculation in "common_adjust",
        // w is something like twice the edge difference
        int w = c(c(p1 - q1) + 3 * (q0 - p0));

        // 9/64 is approximately 9/63 = 1/7 and 1<<7 = 128 = 2*64.
        // So this a, used to adjust the pixels adjacent to the edge,
        // is something like 3/7 the edge difference.
        int a = (27 * w + 63) >> 7;

        seg.Q0 = s2u(q0 - a);
        seg.P0 = s2u(p0 + a);
        // Next two are adjusted by 2/7 the edge difference
        a = (18 * w + 63) >> 7;
        // System.out.println("a: "+a);
        seg.Q1 = s2u(q1 - a);
        seg.P1 = s2u(p1 + a);
        // Last two are adjusted by 1/7 the edge difference
        a = (9 * w + 63) >> 7;
        seg.Q2 = s2u(q2 - a);
        seg.P2 = s2u(p2 + a);
      } else
        // if hev, do simple filter
        common_adjust(true, seg); // using outer taps
    }
  }
Beispiel #2
0
 private static Segment getSegH(SubBlock rsb, SubBlock lsb, int a) {
   Segment seg = new Segment();
   int[][] rdest = rsb.getDest();
   int[][] ldest = lsb.getDest();
   seg.P0 = ldest[3][a];
   seg.P1 = ldest[2][a];
   seg.P2 = ldest[1][a];
   seg.P3 = ldest[0][a];
   seg.Q0 = rdest[0][a];
   seg.Q1 = rdest[1][a];
   seg.Q2 = rdest[2][a];
   seg.Q3 = rdest[3][a];
   return seg;
 }
Beispiel #3
0
  private static Segment getSegV(SubBlock bsb, SubBlock tsb, int a) {
    Segment seg = new Segment();
    int[][] bdest = bsb.getDest();
    int[][] tdest = tsb.getDest();

    seg.P0 = tdest[a][3];
    seg.P1 = tdest[a][2];
    seg.P2 = tdest[a][1];
    seg.P3 = tdest[a][0];
    seg.Q0 = bdest[a][0];
    seg.Q1 = bdest[a][1];
    seg.Q2 = bdest[a][2];
    seg.Q3 = bdest[a][3];
    return seg;
  }
Beispiel #4
0
  public static void subblock_filter(
      int hev_threshold, /*
														 * detect high edge
														 * variance
														 */
      int interior_limit, /* possibly disable filter */
      int edge_limit,
      Segment seg) {
    int p3 = u2s(seg.P3), p2 = u2s(seg.P2), p1 = u2s(seg.P1), p0 = u2s(seg.P0);
    int q0 = u2s(seg.Q0), q1 = u2s(seg.Q1), q2 = u2s(seg.Q2), q3 = u2s(seg.Q3);
    if (filter_yes(interior_limit, edge_limit, q3, q2, q1, q0, p0, p1, p2, p3)) {
      boolean hv = hev(hev_threshold, p1, p0, q0, q1);
      int a = (common_adjust(hv, seg) + 1) >> 1;
      if (!hv) {
        seg.Q1 = s2u(q1 - a);
        seg.P1 = s2u(p1 + a);
      }
    } else {
    }
  }