hevc/intra_pred: optimize EXTEND_()*
Process 4 pixels at once. Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
a1c2b48018
commit
4c390b1ba9
@ -41,14 +41,14 @@ static av_always_inline void FUNC(intra_pred)(HEVCContext *s, int x0, int y0,
|
|||||||
MVF_PU(x, y).is_intra
|
MVF_PU(x, y).is_intra
|
||||||
#define MIN_TB_ADDR_ZS(x, y) \
|
#define MIN_TB_ADDR_ZS(x, y) \
|
||||||
s->pps->min_tb_addr_zs[(y) * s->sps->min_tb_width + (x)]
|
s->pps->min_tb_addr_zs[(y) * s->sps->min_tb_width + (x)]
|
||||||
#define EXTEND_LEFT(ptr, start, length) \
|
|
||||||
for (i = (start); i > (start) - (length); i--) \
|
#define EXTEND(ptr, val, len) \
|
||||||
ptr[i - 1] = ptr[i]
|
do { \
|
||||||
#define EXTEND_RIGHT(ptr, start, length) \
|
pixel4 pix = PIXEL_SPLAT_X4(val); \
|
||||||
for (i = (start); i < (start) + (length); i++) \
|
for (i = 0; i < (len); i += 4) \
|
||||||
ptr[i] = ptr[i - 1]
|
AV_WN4P(ptr + i, pix); \
|
||||||
#define EXTEND_UP(ptr, start, length) EXTEND_LEFT(ptr, start, length)
|
} while (0)
|
||||||
#define EXTEND_DOWN(ptr, start, length) EXTEND_RIGHT(ptr, start, length)
|
|
||||||
#define EXTEND_LEFT_CIP(ptr, start, length) \
|
#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)) \
|
if (!IS_INTRA(i - 1, -1)) \
|
||||||
@ -233,12 +233,10 @@ static av_always_inline void FUNC(intra_pred)(HEVCContext *s, int x0, int y0,
|
|||||||
if (cand_bottom_left || cand_left) {
|
if (cand_bottom_left || cand_left) {
|
||||||
EXTEND_DOWN_CIP(left, j, size_max_y - j);
|
EXTEND_DOWN_CIP(left, j, size_max_y - j);
|
||||||
}
|
}
|
||||||
if (!cand_left) {
|
if (!cand_left)
|
||||||
EXTEND_DOWN(left, 0, size);
|
EXTEND(left, left[-1], size);
|
||||||
}
|
if (!cand_bottom_left)
|
||||||
if (!cand_bottom_left) {
|
EXTEND(left + size, left[size - 1], size);
|
||||||
EXTEND_DOWN(left, size, size);
|
|
||||||
}
|
|
||||||
if (x0 != 0 && y0 != 0) {
|
if (x0 != 0 && y0 != 0) {
|
||||||
EXTEND_UP_CIP(left, size_max_y - 1, size_max_y);
|
EXTEND_UP_CIP(left, size_max_y - 1, size_max_y);
|
||||||
} else if (x0 == 0) {
|
} else if (x0 == 0) {
|
||||||
@ -255,42 +253,38 @@ static av_always_inline void FUNC(intra_pred)(HEVCContext *s, int x0, int y0,
|
|||||||
// Infer the unavailable samples
|
// Infer the unavailable samples
|
||||||
if (!cand_bottom_left) {
|
if (!cand_bottom_left) {
|
||||||
if (cand_left) {
|
if (cand_left) {
|
||||||
EXTEND_DOWN(left, size, size);
|
EXTEND(left + size, left[size - 1], size);
|
||||||
} else if (cand_up_left) {
|
} else if (cand_up_left) {
|
||||||
EXTEND_DOWN(left, 0, 2 * size);
|
EXTEND(left, left[-1], 2 * size);
|
||||||
cand_left = 1;
|
cand_left = 1;
|
||||||
} else if (cand_up) {
|
} else if (cand_up) {
|
||||||
left[-1] = top[0];
|
left[-1] = top[0];
|
||||||
EXTEND_DOWN(left, 0, 2 * size);
|
EXTEND(left, left[-1], 2 * size);
|
||||||
cand_up_left = 1;
|
cand_up_left = 1;
|
||||||
cand_left = 1;
|
cand_left = 1;
|
||||||
} else if (cand_up_right) {
|
} else if (cand_up_right) {
|
||||||
EXTEND_LEFT(top, size, size);
|
EXTEND(top, top[size], size);
|
||||||
left[-1] = top[0];
|
left[-1] = top[size];
|
||||||
EXTEND_DOWN(left, 0, 2 * size);
|
EXTEND(left, left[-1], 2 * size);
|
||||||
cand_up = 1;
|
cand_up = 1;
|
||||||
cand_up_left = 1;
|
cand_up_left = 1;
|
||||||
cand_left = 1;
|
cand_left = 1;
|
||||||
} else { // No samples available
|
} else { // No samples available
|
||||||
top[0] = left[-1] = (1 << (BIT_DEPTH - 1));
|
left[-1] = (1 << (BIT_DEPTH - 1));
|
||||||
EXTEND_RIGHT(top, 1, 2 * size - 1);
|
EXTEND(top, left[-1], 2 * size);
|
||||||
EXTEND_DOWN(left, 0, 2 * size);
|
EXTEND(left, left[-1], 2 * size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cand_left) {
|
if (!cand_left)
|
||||||
EXTEND_UP(left, size, size);
|
EXTEND(left, left[size], size);
|
||||||
}
|
|
||||||
if (!cand_up_left) {
|
if (!cand_up_left) {
|
||||||
left[-1] = left[0];
|
left[-1] = left[0];
|
||||||
}
|
}
|
||||||
if (!cand_up) {
|
if (!cand_up)
|
||||||
top[0] = left[-1];
|
EXTEND(top, left[-1], size);
|
||||||
EXTEND_RIGHT(top, 1, size - 1);
|
if (!cand_up_right)
|
||||||
}
|
EXTEND(top + size, top[size - 1], size);
|
||||||
if (!cand_up_right) {
|
|
||||||
EXTEND_RIGHT(top, size, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
top[-1] = left[-1];
|
top[-1] = left[-1];
|
||||||
|
|
||||||
@ -542,9 +536,6 @@ static void FUNC(pred_angular_3)(uint8_t *src, const uint8_t *top,
|
|||||||
#undef MVF_PU
|
#undef MVF_PU
|
||||||
#undef MVF
|
#undef MVF
|
||||||
#undef PU
|
#undef PU
|
||||||
#undef EXTEND_LEFT
|
#undef EXTEND
|
||||||
#undef EXTEND_RIGHT
|
|
||||||
#undef EXTEND_UP
|
|
||||||
#undef EXTEND_DOWN
|
|
||||||
#undef MIN_TB_ADDR_ZS
|
#undef MIN_TB_ADDR_ZS
|
||||||
#undef POS
|
#undef POS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user