* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "dsputil.h"
+#include "mathops.h"
+#include "rnd_avg.h"
#ifndef BIT_DEPTH
#define BIT_DEPTH 8
#endif
-#ifdef AVCODEC_H264_HIGH_DEPTH_H
+#ifdef AVCODEC_BIT_DEPTH_TEMPLATE_C
# undef pixel
# undef pixel2
# undef pixel4
# undef av_clip_pixel
# undef PIXEL_SPLAT_X4
#else
-# define AVCODEC_H264_HIGH_DEPTH_H
+# define AVCODEC_BIT_DEPTH_TEMPLATE_C
#endif
#if BIT_DEPTH > 8
# define pixel4 uint32_t
# define dctcoef int16_t
-# define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
+# define INIT_CLIP const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
# define no_rnd_avg_pixel4 no_rnd_avg32
# define rnd_avg_pixel4 rnd_avg32
# define AV_RN2P AV_RN16
# define CLIP(a) cm[a]
#endif
-#if BIT_DEPTH == 8
-# define FUNC(a) a ## _8
-# define FUNCC(a) a ## _8_c
-#elif BIT_DEPTH == 9
-# define FUNC(a) a ## _9
-# define FUNCC(a) a ## _9_c
-#elif BIT_DEPTH == 10
-# define FUNC(a) a ## _10
-# define FUNCC(a) a ## _10_c
-#endif
+#define FUNC3(a, b, c) a ## _ ## b ## c
+#define FUNC2(a, b, c) FUNC3(a, b, c)
+#define FUNC(a) FUNC2(a, BIT_DEPTH,)
+#define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)