Merge commit '7acdd3a1275bcd9cad48f9632169f6bbaeb39d84'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 9 Aug 2014 19:49:55 +0000 (21:49 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 9 Aug 2014 19:49:55 +0000 (21:49 +0200)
* commit '7acdd3a1275bcd9cad48f9632169f6bbaeb39d84':
  hevc_filter: avoid excessive calls to ff_hevc_get_ref_list()

Conflicts:
libavcodec/hevc_filter.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/hevc_filter.c

@@@ -594,12 -608,40 +594,14 @@@ void ff_hevc_deblocking_boundary_streng
          boundary_upper = 0;
  
      if (boundary_upper) {
-             int yp_pu = (y0 - 1) >> log2_min_pu_size;
-             int yq_pu =  y0      >> log2_min_pu_size;
-             int yp_tu = (y0 - 1) >> log2_min_tu_size;
-             int yq_tu =  y0      >> log2_min_tu_size;
-             RefPicList *top_refPicList = ff_hevc_get_ref_list(s, s->ref,
-                                                               x0, y0 - 1);
+         RefPicList *rpl_top = (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ?
+                               ff_hevc_get_ref_list(s, s->ref, x0, y0 - 1) :
+                               s->ref->refPicList;
 -
+         int yp_pu = (y0 - 1) >> log2_min_pu_size;
+         int yq_pu =  y0      >> log2_min_pu_size;
+         int yp_tu = (y0 - 1) >> log2_min_tu_size;
+         int yq_tu =  y0      >> log2_min_tu_size;
 -        for (i = 0; i < (1 << log2_trafo_size); i += 4) {
 -            int x_pu = (x0 + i) >> log2_min_pu_size;
 -            int x_tu = (x0 + i) >> log2_min_tu_size;
 -            MvField *top  = &tab_mvf[yp_pu * min_pu_width + x_pu];
 -            MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
 -            uint8_t top_cbf_luma  = s->cbf_luma[yp_tu * min_tu_width + x_tu];
 -            uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu];
 -
 -            bs = boundary_strength(s, curr, curr_cbf_luma,
 -                                   top, top_cbf_luma, rpl_top, 1);
 -            if (bs)
 -                s->horizontal_bs[((x0 + i) + y0 * s->bs_width) >> 2] = bs;
 -        }
 -    }
 -
 -    // bs for TU internal horizontal PU boundaries
 -    if (log2_trafo_size > s->sps->log2_min_pu_size && !is_intra) {
 -        RefPicList *rpl = s->ref->refPicList;
 -
 -        for (j = 8; j < (1 << log2_trafo_size); j += 8) {
 -            int yp_pu = (y0 + j - 1) >> log2_min_pu_size;
 -            int yq_pu = (y0 + j)     >> log2_min_pu_size;
 -            int yp_tu = (y0 + j - 1) >> log2_min_tu_size;
 -            int yq_tu = (y0 + j)     >> log2_min_tu_size;
 -
              for (i = 0; i < (1 << log2_trafo_size); i += 4) {
                  int x_pu = (x0 + i) >> log2_min_pu_size;
                  int x_tu = (x0 + i) >> log2_min_tu_size;
                  uint8_t top_cbf_luma  = s->cbf_luma[yp_tu * min_tu_width + x_tu];
                  uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu];
  
 -                bs = boundary_strength(s, curr, curr_cbf_luma,
 -                                       top, top_cbf_luma, rpl, 0);
 -                if (bs)
 -                    s->horizontal_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
 +                if (curr->pred_flag == PF_INTRA || top->pred_flag == PF_INTRA)
 +                    bs = 2;
 +                else if (curr_cbf_luma || top_cbf_luma)
 +                    bs = 1;
 +                else
-                     bs = boundary_strength(s, curr, top, top_refPicList);
++                    bs = boundary_strength(s, curr, top, rpl_top);
 +                s->horizontal_bs[((x0 + i) + y0 * s->bs_width) >> 2] = bs;
              }
 -        }
      }
  
      // bs for vertical TU boundaries
          boundary_left = 0;
  
      if (boundary_left) {
-             int xp_pu = (x0 - 1) >> log2_min_pu_size;
-             int xq_pu =  x0      >> log2_min_pu_size;
-             int xp_tu = (x0 - 1) >> log2_min_tu_size;
-             int xq_tu =  x0      >> log2_min_tu_size;
-             RefPicList *left_refPicList = ff_hevc_get_ref_list(s, s->ref,
-                                                                x0 - 1, y0);
+         RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ?
+                                ff_hevc_get_ref_list(s, s->ref, x0 - 1, y0) :
+                                s->ref->refPicList;
 -
+         int xp_pu = (x0 - 1) >> log2_min_pu_size;
+         int xq_pu =  x0      >> log2_min_pu_size;
+         int xp_tu = (x0 - 1) >> log2_min_tu_size;
+         int xq_tu =  x0      >> log2_min_tu_size;
  
 -        for (i = 0; i < (1 << log2_trafo_size); i += 4) {
 -            int y_pu      = (y0 + i) >> log2_min_pu_size;
 -            int y_tu      = (y0 + i) >> log2_min_tu_size;
 -            MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
 -            MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
 -
 -            uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu];
 -            uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu];
 +            for (i = 0; i < (1 << log2_trafo_size); i += 4) {
 +                int y_pu      = (y0 + i) >> log2_min_pu_size;
 +                int y_tu      = (y0 + i) >> log2_min_tu_size;
 +                MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
 +                MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
 +                uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu];
 +                uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu];
  
 -            bs = boundary_strength(s, curr, curr_cbf_luma,
 -                                   left, left_cbf_luma, rpl_left, 1);
 -            if (bs)
 -                s->vertical_bs[(x0 >> 3) + ((y0 + i) >> 2) * s->bs_width] = bs;
 -        }
 +                if (curr->pred_flag == PF_INTRA || left->pred_flag == PF_INTRA)
 +                    bs = 2;
 +                else if (curr_cbf_luma || left_cbf_luma)
 +                    bs = 1;
 +                else
-                     bs = boundary_strength(s, curr, left, left_refPicList);
++                    bs = boundary_strength(s, curr, left, rpl_left);
 +                s->vertical_bs[(x0 + (y0 + i) * s->bs_width) >> 2] = bs;
 +            }
      }
  
 -    // bs for TU internal vertical PU boundaries
      if (log2_trafo_size > log2_min_pu_size && !is_intra) {
-         RefPicList *refPicList = ff_hevc_get_ref_list(s, s->ref,
-                                                            x0,
-                                                            y0);
+         RefPicList *rpl = s->ref->refPicList;
 +        // bs for TU internal horizontal PU boundaries
 +        for (j = 8; j < (1 << log2_trafo_size); j += 8) {
 +            int yp_pu = (y0 + j - 1) >> log2_min_pu_size;
 +            int yq_pu = (y0 + j)     >> log2_min_pu_size;
 +
 +            for (i = 0; i < (1 << log2_trafo_size); i += 4) {
 +                int x_pu = (x0 + i) >> log2_min_pu_size;
 +                MvField *top  = &tab_mvf[yp_pu * min_pu_width + x_pu];
 +                MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
 +
-                 bs = boundary_strength(s, curr, top, refPicList);
++                bs = boundary_strength(s, curr, top, rpl);
 +                s->horizontal_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
 +            }
 +        }
 +
 +        // bs for TU internal vertical PU boundaries
          for (j = 0; j < (1 << log2_trafo_size); j += 4) {
              int y_pu = (y0 + j) >> log2_min_pu_size;
 -            int y_tu = (y0 + j) >> log2_min_tu_size;
  
              for (i = 8; i < (1 << log2_trafo_size); i += 8) {
                  int xp_pu = (x0 + i - 1) >> log2_min_pu_size;
                  int xq_pu = (x0 + i)     >> log2_min_pu_size;
 -                int xp_tu = (x0 + i - 1) >> log2_min_tu_size;
 -                int xq_tu = (x0 + i)     >> log2_min_tu_size;
                  MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
                  MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
 -                uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu];
 -                uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu];
  
-                 bs = boundary_strength(s, curr, left, refPicList);
 -                bs = boundary_strength(s, curr, curr_cbf_luma,
 -                                       left, left_cbf_luma, rpl, 0);
 -                if (bs)
 -                    s->vertical_bs[((x0 + i) >> 3) + ((y0 + j) >> 2) * s->bs_width] = bs;
++                bs = boundary_strength(s, curr, left, rpl);
 +                s->vertical_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
              }
          }
      }