aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-19 14:28:02 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-19 14:28:49 +0200
commit454920187f152fc9d058225095cc8291c55c4f4a (patch)
treed2f480423d88b11c95d329549f50eaaf28db8e97
parent8447658550006996d30e232b1d77614c92a4cc5e (diff)
parent4c390b1ba98e6aec787aa0e7ea57ed7cb38283b7 (diff)
downloadffmpeg-454920187f152fc9d058225095cc8291c55c4f4a.tar.gz
Merge commit '4c390b1ba98e6aec787aa0e7ea57ed7cb38283b7'
* commit '4c390b1ba98e6aec787aa0e7ea57ed7cb38283b7': hevc/intra_pred: optimize EXTEND_()* Conflicts: libavcodec/hevcpred_template.c See: 053fdacde76a38186dc9db658572e38686efe0c4 Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/hevcpred_template.c60
1 files changed, 25 insertions, 35 deletions
diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c
index ad99a8493e..991e2e7bcf 100644
--- a/libavcodec/hevcpred_template.c
+++ b/libavcodec/hevcpred_template.c
@@ -40,9 +40,14 @@ static av_always_inline void FUNC(intra_pred)(HEVCContext *s, int x0, int y0,
(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)) \
@@ -229,14 +234,10 @@ static av_always_inline void FUNC(intra_pred)(HEVCContext *s, int x0, int y0,
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);
@@ -259,49 +260,38 @@ static av_always_inline void FUNC(intra_pred)(HEVCContext *s, int x0, int y0,
// Infer the unavailable samples
if (!cand_bottom_left) {
if (cand_left) {
- a = PIXEL_SPLAT_X4(left[size-1]);
- EXTEND(left, size, size);
+ EXTEND(left + size, left[size - 1], size);
} else if (cand_up_left) {
- a = PIXEL_SPLAT_X4(left[-1]);
- EXTEND(left, 0, 2 * size);
+ EXTEND(left, left[-1], 2 * size);
cand_left = 1;
} else if (cand_up) {
left[-1] = top[0];
- a = PIXEL_SPLAT_X4(left[-1]);
- EXTEND(left, 0, 2 * size);
+ EXTEND(left, left[-1], 2 * size);
cand_up_left = 1;
cand_left = 1;
} else if (cand_up_right) {
+ EXTEND(top, top[size], size);
left[-1] = top[size];
- a = PIXEL_SPLAT_X4(left[-1]);
- EXTEND(top, 0, size);
- EXTEND(left, 0, 2 * size);
+ EXTEND(left, left[-1], 2 * size);
cand_up = 1;
cand_up_left = 1;
cand_left = 1;
} else { // No samples available
left[-1] = (1 << (BIT_DEPTH - 1));
- a = PIXEL_SPLAT_X4(left[-1]);
- EXTEND(top, 0, 2 * size);
- EXTEND(left, 0, 2 * size);
+ EXTEND(top, left[-1], 2 * size);
+ EXTEND(left, left[-1], 2 * size);
}
}
- if (!cand_left) {
- a = PIXEL_SPLAT_X4(left[size]);
- EXTEND(left, 0, size);
- }
+ if (!cand_left)
+ EXTEND(left, left[size], size);
if (!cand_up_left) {
left[-1] = left[0];
}
- if (!cand_up) {
- a = PIXEL_SPLAT_X4(left[-1]);
- EXTEND(top, 0, size);
- }
- if (!cand_up_right) {
- a = PIXEL_SPLAT_X4(top[size-1]);
- EXTEND(top, size, size);
- }
+ if (!cand_up)
+ EXTEND(top, left[-1], size);
+ if (!cand_up_right)
+ EXTEND(top + size, top[size - 1], size);
top[-1] = left[-1];