summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-19 14:10:13 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-19 14:10:13 +0200
commit8447658550006996d30e232b1d77614c92a4cc5e (patch)
tree049e2d57d62f1946b625f9c21035af5d7c664033 /libavcodec
parent93318983c3e565b3079362ec69cf3362febc5004 (diff)
parenta1c2b48018b09d2613f075ec0748c95bd520ac00 (diff)
Merge commit 'a1c2b48018b09d2613f075ec0748c95bd520ac00'
* commit 'a1c2b48018b09d2613f075ec0748c95bd520ac00': hevc: templatize intra_pred Conflicts: libavcodec/hevc.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/hevc.c10
-rw-r--r--libavcodec/hevcpred.c5
-rw-r--r--libavcodec/hevcpred.h14
-rw-r--r--libavcodec/hevcpred_template.c16
4 files changed, 32 insertions, 13 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index c9fa31900f..b14ed117b9 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -834,18 +834,18 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0,
int trafo_size = 1 << log2_trafo_size;
ff_hevc_set_neighbour_available(s, x0, y0, trafo_size, trafo_size);
- s->hpc.intra_pred(s, x0, y0, log2_trafo_size, 0);
+ s->hpc.intra_pred[log2_trafo_size - 2](s, x0, y0, 0);
if (log2_trafo_size > 2) {
trafo_size = trafo_size << (s->sps->hshift[1] - 1);
ff_hevc_set_neighbour_available(s, x0, y0, trafo_size, trafo_size);
- s->hpc.intra_pred(s, x0, y0, log2_trafo_size - 1, 1);
- s->hpc.intra_pred(s, x0, y0, log2_trafo_size - 1, 2);
+ s->hpc.intra_pred[log2_trafo_size - 3](s, x0, y0, 1);
+ s->hpc.intra_pred[log2_trafo_size - 3](s, x0, y0, 2);
} else if (blk_idx == 3) {
trafo_size = trafo_size << s->sps->hshift[1];
ff_hevc_set_neighbour_available(s, xBase, yBase,
trafo_size, trafo_size);
- s->hpc.intra_pred(s, xBase, yBase, log2_trafo_size, 1);
- s->hpc.intra_pred(s, xBase, yBase, log2_trafo_size, 2);
+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 1);
+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 2);
}
}
diff --git a/libavcodec/hevcpred.c b/libavcodec/hevcpred.c
index e4987f8eca..4dfbfbfed0 100644
--- a/libavcodec/hevcpred.c
+++ b/libavcodec/hevcpred.c
@@ -42,7 +42,10 @@ void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth)
#define FUNC(a, depth) a ## _ ## depth
#define HEVC_PRED(depth) \
- hpc->intra_pred = FUNC(intra_pred, depth); \
+ hpc->intra_pred[0] = FUNC(intra_pred_2, depth); \
+ hpc->intra_pred[1] = FUNC(intra_pred_3, depth); \
+ hpc->intra_pred[2] = FUNC(intra_pred_4, depth); \
+ hpc->intra_pred[3] = FUNC(intra_pred_5, depth); \
hpc->pred_planar[0] = FUNC(pred_planar_0, depth); \
hpc->pred_planar[1] = FUNC(pred_planar_1, depth); \
hpc->pred_planar[2] = FUNC(pred_planar_2, depth); \
diff --git a/libavcodec/hevcpred.h b/libavcodec/hevcpred.h
index 4dead2ecdc..7f14a76da1 100644
--- a/libavcodec/hevcpred.h
+++ b/libavcodec/hevcpred.h
@@ -29,13 +29,15 @@
struct HEVCContext;
typedef struct HEVCPredContext {
- void (*intra_pred)(struct HEVCContext *s, int x0, int y0, int log2_size, int c_idx);
+ void (*intra_pred[4])(struct HEVCContext *s, int x0, int y0, int c_idx);
- void(*pred_planar[4])(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride);
- void(*pred_dc)(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride,
- int log2_size, int c_idx);
- void(*pred_angular[4])(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride,
- int c_idx, int mode);
+ void (*pred_planar[4])(uint8_t *src, const uint8_t *top,
+ const uint8_t *left, ptrdiff_t stride);
+ void (*pred_dc)(uint8_t *src, const uint8_t *top, const uint8_t *left,
+ ptrdiff_t stride, int log2_size, int c_idx);
+ void (*pred_angular[4])(uint8_t *src, const uint8_t *top,
+ const uint8_t *left, ptrdiff_t stride,
+ int c_idx, int mode);
} HEVCPredContext;
void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth);
diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c
index ece40ddbaf..ad99a8493e 100644
--- a/libavcodec/hevcpred_template.c
+++ b/libavcodec/hevcpred_template.c
@@ -27,7 +27,8 @@
#define POS(x, y) src[(x) + stride * (y)]
-static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int c_idx)
+static av_always_inline void FUNC(intra_pred)(HEVCContext *s, int x0, int y0,
+ int log2_size, int c_idx)
{
#define PU(x) \
((x) >> s->sps->log2_min_pu_size)
@@ -362,6 +363,19 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int
}
}
+#define INTRA_PRED(size) \
+static void FUNC(intra_pred_ ## size)(HEVCContext *s, int x0, int y0, int c_idx) \
+{ \
+ FUNC(intra_pred)(s, x0, y0, size, c_idx); \
+}
+
+INTRA_PRED(2)
+INTRA_PRED(3)
+INTRA_PRED(4)
+INTRA_PRED(5)
+
+#undef INTRA_PRED
+
static av_always_inline void FUNC(pred_planar)(uint8_t *_src, const uint8_t *_top,
const uint8_t *_left, ptrdiff_t stride,
int trafo_size)