diff --git a/libavcodec/Makefile b/libavcodec/Makefile index fe0e1d028d..03d75541c7 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -29,6 +29,13 @@ ASM_OBJS += armv4l/jrevdct_arm.o OBJS += armv4l/dsputil_arm.o endif +# sun mediaLib specific stuff +# currently only works when libavcodec is used in mplayer +ifeq ($(HAVE_MLIB),yes) +OBJS += mlib/dsputil_mlib.o +CFLAGS += $(MLIB_INC) +endif + SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s) LIB= libavcodec.a @@ -58,8 +65,8 @@ depend: clean: rm -f *.o *~ *.a i386/*.o i386/*~ \ armv4l/*.o armv4l/*~ \ + mlib/*.o mlib/*~ \ libac3/*.o libac3/*~ \ - mpglib/*.o mpglib/*~ \ apiexample $(TESTS) distclean: clean diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index abbca19daa..b0cea56bda 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -413,6 +413,7 @@ void block_permute(INT16 *block) void dsputil_init(void) { int i, j; + int use_permuted_idct; for(i=0;i<256;i++) cropTbl[i + MAX_NEG_CROP] = i; for(i=0;i +#include +#include +#include + + +static void put_pixels_mlib (uint8_t * dest, const uint8_t * ref, + int stride, int height) +{ + assert(height == 16 || height == 8); + if (height == 16) + mlib_VideoCopyRef_U8_U8_8x16(dest, (uint8_t *)ref, stride); + else + mlib_VideoCopyRef_U8_U8_8x8 (dest, (uint8_t *)ref, stride); +} + +static void put_pixels_x2_mlib (uint8_t * dest, const uint8_t * ref, + int stride, int height) +{ + assert(height == 16 || height == 8); + if (height == 16) + mlib_VideoInterpX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); + else + mlib_VideoInterpX_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); +} + +static void put_pixels_y2_mlib (uint8_t * dest, const uint8_t * ref, + int stride, int height) +{ + assert(height == 16 || height == 8); + if (height == 16) + mlib_VideoInterpY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); + else + mlib_VideoInterpY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); +} + +static void put_pixels_xy2_mlib(uint8_t * dest, const uint8_t * ref, + int stride, int height) +{ + assert(height == 16 || height == 8); + if (height == 16) + mlib_VideoInterpXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); + else + mlib_VideoInterpXY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); +} + +static void avg_pixels_mlib (uint8_t * dest, const uint8_t * ref, + int stride, int height) +{ + assert(height == 16 || height == 8); + if (height == 16) + mlib_VideoCopyRefAve_U8_U8_8x16(dest, (uint8_t *)ref, stride); + else + mlib_VideoCopyRefAve_U8_U8_8x8 (dest, (uint8_t *)ref, stride); +} + +static void avg_pixels_x2_mlib (uint8_t * dest, const uint8_t * ref, + int stride, int height) +{ + assert(height == 16 || height == 8); + if (height == 16) + mlib_VideoInterpAveX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); + else + mlib_VideoInterpAveX_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); +} + +static void avg_pixels_y2_mlib (uint8_t * dest, const uint8_t * ref, + int stride, int height) +{ + assert(height == 16 || height == 8); + if (height == 16) + mlib_VideoInterpAveY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); + else + mlib_VideoInterpAveY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); +} + +static void avg_pixels_xy2_mlib (uint8_t * dest, const uint8_t * ref, + int stride, int height) +{ + assert(height == 16 || height == 8); + if (height == 16) + mlib_VideoInterpAveXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride); + else + mlib_VideoInterpAveXY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride); +} + + +static void add_pixels_clamped_mlib(const DCTELEM *block, UINT8 *pixels, int line_size) +{ + mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size); +} + + +void ff_idct_mlib(DCTELEM *data) +{ + mlib_VideoIDCT8x8_S16_S16 (data, data); +} + + +void ff_fdct_mlib(DCTELEM *data) +{ + mlib_VideoDCT8x8_S16_S16 (data, data); +} + +void dsputil_init_mlib(void) +{ + av_fdct = ff_fdct_mlib; + ff_idct = ff_idct_mlib; + + put_pixels_tab[0] = put_pixels_mlib; + put_pixels_tab[1] = put_pixels_x2_mlib; + put_pixels_tab[2] = put_pixels_y2_mlib; + put_pixels_tab[3] = put_pixels_xy2_mlib; + + avg_pixels_tab[0] = avg_pixels_mlib; + avg_pixels_tab[1] = avg_pixels_x2_mlib; + avg_pixels_tab[2] = avg_pixels_y2_mlib; + avg_pixels_tab[3] = avg_pixels_xy2_mlib; + + put_no_rnd_pixels_tab[0] = put_pixels_mlib; + + add_pixels_clamped = add_pixels_clamped_mlib; +}