summaryrefslogtreecommitdiff
path: root/libavcodec/ffv1.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-08-07 23:37:17 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-08-08 00:27:43 +0200
commit74314f1f5f9ef69700eb18b85a8260e2754a31ef (patch)
tree097e9b61add9b11061b63f17dea74c21d8061ff5 /libavcodec/ffv1.h
parent22d13e4290c8fdba57485e1b501f6a92283a10db (diff)
downloadffmpeg-74314f1f5f9ef69700eb18b85a8260e2754a31ef.tar.gz
avcodec/ffv1: template functions to allow data types different from int16_t
This is required for >= 16bit RGB support I tried it without templates but its too much duplicated code Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/ffv1.h')
-rw-r--r--libavcodec/ffv1.h37
1 files changed, 6 insertions, 31 deletions
diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
index d9398e55c7..5f4a340a87 100644
--- a/libavcodec/ffv1.h
+++ b/libavcodec/ffv1.h
@@ -158,37 +158,6 @@ static av_always_inline int fold(int diff, int bits)
return diff;
}
-static inline int predict(int16_t *src, int16_t *last)
-{
- const int LT = last[-1];
- const int T = last[0];
- const int L = src[-1];
-
- return mid_pred(L, L + T - LT, T);
-}
-
-static inline int get_context(PlaneContext *p, int16_t *src,
- int16_t *last, int16_t *last2)
-{
- const int LT = last[-1];
- const int T = last[0];
- const int RT = last[1];
- const int L = src[-1];
-
- if (p->quant_table[3][127]) {
- const int TT = last2[0];
- const int LL = src[-2];
- return p->quant_table[0][(L - LT) & 0xFF] +
- p->quant_table[1][(LT - T) & 0xFF] +
- p->quant_table[2][(T - RT) & 0xFF] +
- p->quant_table[3][(LL - L) & 0xFF] +
- p->quant_table[4][(TT - T) & 0xFF];
- } else
- return p->quant_table[0][(L - LT) & 0xFF] +
- p->quant_table[1][(LT - T) & 0xFF] +
- p->quant_table[2][(T - RT) & 0xFF];
-}
-
static inline void update_vlc_state(VlcState *const state, const int v)
{
int drift = state->drift;
@@ -223,4 +192,10 @@ static inline void update_vlc_state(VlcState *const state, const int v)
state->count = count;
}
+#define TYPE int16_t
+#define RENAME(name) name
+#include "ffv1_template.c"
+#undef TYPE
+#undef RENAME
+
#endif /* AVCODEC_FFV1_H */