Merge commit '4c390b1ba98e6aec787aa0e7ea57ed7cb38283b7'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 19 May 2014 12:28:02 +0000 (14:28 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 19 May 2014 12:28:49 +0000 (14:28 +0200)
* commit '4c390b1ba98e6aec787aa0e7ea57ed7cb38283b7':
  hevc/intra_pred: optimize EXTEND_()*

Conflicts:
libavcodec/hevcpred_template.c

See: 053fdacde76a38186dc9db658572e38686efe0c4
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/hevcpred_template.c

@@@ -37,36 -38,37 +37,41 @@@ static av_always_inline void FUNC(intra
  #define MVF_PU(x, y) \
      MVF(PU(x0 + ((x) << hshift)), PU(y0 + ((y) << vshift)))
  #define IS_INTRA(x, y) \
 -    MVF_PU(x, y).is_intra
 +    (MVF_PU(x, y).pred_flag == PF_INTRA)
  #define MIN_TB_ADDR_ZS(x, y) \
      s->pps->min_tb_addr_zs[(y) * s->sps->min_tb_width + (x)]
- #define EXTEND(ptr, start, length)                                             \
-         for (i = start; i < (start) + (length); i += 4)                        \
-             AV_WN4P(&(ptr[i]), a)
+ #define EXTEND(ptr, val, len)         \
+ do {                                  \
+     pixel4 pix = PIXEL_SPLAT_X4(val); \
+     for (i = 0; i < (len); i += 4)    \
+         AV_WN4P(ptr + i, pix);        \
+ } while (0)
 +#define EXTEND_RIGHT_CIP(ptr, start, length)                                   \
 +        for (i = start; i < (start) + (length); i += 4)                        \
 +            if (!IS_INTRA(i, -1))                                              \
 +                AV_WN4P(&ptr[i], a);                                           \
 +            else                                                               \
 +                a = PIXEL_SPLAT_X4(ptr[i+3])
  #define EXTEND_LEFT_CIP(ptr, start, length) \
 -        for (i = (start); i > (start) - (length); i--) \
 +        for (i = start; i > (start) - (length); i--) \
              if (!IS_INTRA(i - 1, -1)) \
                  ptr[i - 1] = ptr[i]
 -#define EXTEND_RIGHT_CIP(ptr, start, length) \
 -        for (i = (start); i < (start) + (length); i++) \
 -            if (!IS_INTRA(i, -1)) \
 -                ptr[i] = ptr[i - 1]
 -#define EXTEND_UP_CIP(ptr, start, length) \
 -        for (i = (start); i > (start) - (length); i--) \
 -            if (!IS_INTRA(-1, i - 1)) \
 -                ptr[i - 1] = ptr[i]
 -#define EXTEND_UP_CIP_0(ptr, start, length) \
 -        for (i = (start); i > (start) - (length); i--) \
 -            ptr[i - 1] = ptr[i]
 -#define EXTEND_DOWN_CIP(ptr, start, length) \
 -        for (i = (start); i < (start) + (length); i++) \
 -            if (!IS_INTRA(-1, i)) \
 -                ptr[i] = ptr[i - 1]
 -    HEVCLocalContext *lc = &s->HEVClc;
 +#define EXTEND_UP_CIP(ptr, start, length)                                      \
 +        for (i = (start); i > (start) - (length); i -= 4)                      \
 +            if (!IS_INTRA(-1, i - 3))                                          \
 +                AV_WN4P(&ptr[i - 3], a);                                       \
 +            else                                                               \
 +                a = PIXEL_SPLAT_X4(ptr[i - 3])
 +#define EXTEND_DOWN_CIP(ptr, start, length)                                    \
 +        for (i = start; i < (start) + (length); i += 4)                        \
 +            if (!IS_INTRA(-1, i))                                              \
 +                AV_WN4P(&ptr[i], a);                                           \
 +            else                                                               \
 +                a = PIXEL_SPLAT_X4(ptr[i + 3])
 +
 +    HEVCLocalContext *lc = s->HEVClc;
      int i;
      int hshift = s->sps->hshift[c_idx];
      int vshift = s->sps->vshift[c_idx];
                  left[-1] = top[-1];
                  j        = 0;
              }
 +            left[-1] = top[-1];
              if (cand_bottom_left || cand_left) {
 -                EXTEND_DOWN_CIP(left, j, size_max_y - j);
 +                a = PIXEL_SPLAT_X4(left[-1]);
 +                EXTEND_DOWN_CIP(left, 0, size_max_y);
              }
-             if (!cand_left) {
-                 a = PIXEL_SPLAT_X4(left[-1]);
-                 EXTEND(left, 0, size);
-             }
-             if (!cand_bottom_left) {
-                 a = PIXEL_SPLAT_X4(left[size - 1]);
-                 EXTEND(left, size, size);
-             }
+             if (!cand_left)
+                 EXTEND(left, left[-1], size);
+             if (!cand_bottom_left)
+                 EXTEND(left + size, left[size - 1], size);
              if (x0 != 0 && y0 != 0) {
 +                a = PIXEL_SPLAT_X4(left[size_max_y - 1]);
                  EXTEND_UP_CIP(left, size_max_y - 1, size_max_y);
 +                if (!IS_INTRA(-1, - 1))
 +                    left[-1] = left[0];
              } else if (x0 == 0) {
 -                EXTEND_UP_CIP_0(left, size_max_y - 1, size_max_y);
 +                a = PIXEL_SPLAT_X4(left[size_max_y - 1]);
 +                EXTEND(left, 0, size_max_y);
              } else {
 -                EXTEND_UP_CIP(left, size_max_y - 1, size_max_y - 1);
 +                a = PIXEL_SPLAT_X4(left[size_max_y - 1]);
 +                EXTEND_UP_CIP(left, size_max_y - 1, size_max_y);
              }
              top[-1] = left[-1];
              if (y0 != 0) {