Commit 04db5794 authored by Mickaël Raulet's avatar Mickaël Raulet Committed by Anton Khirnov
Browse files

hevc: templatize pred_planar


Signed-off-by: default avatarAnton Khirnov <anton@khirnov.net>
parent 0ba5299a
...@@ -349,58 +349,34 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int ...@@ -349,58 +349,34 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int
} }
} }
static void FUNC(pred_planar_0)(uint8_t *_src, const uint8_t *_top, static av_always_inline void FUNC(pred_planar)(uint8_t *_src, const uint8_t *_top,
const uint8_t *_left, const uint8_t *_left, ptrdiff_t stride,
ptrdiff_t stride) int trafo_size)
{ {
int x, y; int x, y;
pixel *src = (pixel *)_src; pixel *src = (pixel *)_src;
const pixel *top = (const pixel *)_top; const pixel *top = (const pixel *)_top;
const pixel *left = (const pixel *)_left; const pixel *left = (const pixel *)_left;
for (y = 0; y < 4; y++) int size = 1 << trafo_size;
for (x = 0; x < 4; x++) for (y = 0; y < size; y++)
POS(x, y) = ((3 - x) * left[y] + (x + 1) * top[4] + for (x = 0; x < size; x++)
(3 - y) * top[x] + (y + 1) * left[4] + 4) >> 3; POS(x, y) = ((size - 1 - x) * left[y] + (x + 1) * top[size] +
(size - 1 - y) * top[x] + (y + 1) * left[size] + size) >> (trafo_size + 1);
} }
static void FUNC(pred_planar_1)(uint8_t *_src, const uint8_t *_top, #define PRED_PLANAR(size)\
const uint8_t *_left, ptrdiff_t stride) static void FUNC(pred_planar_ ## size)(uint8_t *src, const uint8_t *top, \
{ const uint8_t *left, ptrdiff_t stride) \
int x, y; { \
pixel *src = (pixel *)_src; FUNC(pred_planar)(src, top, left, stride, size + 2); \
const pixel *top = (const pixel *)_top;
const pixel *left = (const pixel *)_left;
for (y = 0; y < 8; y++)
for (x = 0; x < 8; x++)
POS(x, y) = ((7 - x) * left[y] + (x + 1) * top[8] +
(7 - y) * top[x] + (y + 1) * left[8] + 8) >> 4;
} }
static void FUNC(pred_planar_2)(uint8_t *_src, const uint8_t *_top, PRED_PLANAR(0)
const uint8_t *_left, ptrdiff_t stride) PRED_PLANAR(1)
{ PRED_PLANAR(2)
int x, y; PRED_PLANAR(3)
pixel *src = (pixel *)_src;
const pixel *top = (const pixel *)_top;
const pixel *left = (const pixel *)_left;
for (y = 0; y < 16; y++)
for (x = 0; x < 16; x++)
POS(x, y) = ((15 - x) * left[y] + (x + 1) * top[16] +
(15 - y) * top[x] + (y + 1) * left[16] + 16) >> 5;
}
static void FUNC(pred_planar_3)(uint8_t *_src, const uint8_t *_top, #undef PRED_PLANAR
const uint8_t *_left, ptrdiff_t stride)
{
int x, y;
pixel *src = (pixel *)_src;
const pixel *top = (const pixel *)_top;
const pixel *left = (const pixel *)_left;
for (y = 0; y < 32; y++)
for (x = 0; x < 32; x++)
POS(x, y) = ((31 - x) * left[y] + (x + 1) * top[32] +
(31 - y) * top[x] + (y + 1) * left[32] + 32) >> 6;
}
static void FUNC(pred_dc)(uint8_t *_src, const uint8_t *_top, static void FUNC(pred_dc)(uint8_t *_src, const uint8_t *_top,
const uint8_t *_left, const uint8_t *_left,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment