Commit 0144fe69 authored by Diego Biurrun's avatar Diego Biurrun

Remove Sun medialib glue code.

It is obscure, most likely unused and not bit-exact compared to
libavcodec due to a different IDCT transform algorithm.
parent 9b027c0d
......@@ -194,7 +194,6 @@ External library support:
--enable-libxavs enable AVS encoding via xavs [no]
--enable-libxvid enable Xvid encoding via xvidcore,
native MPEG-4/Xvid encoder exists [no]
--enable-mlib enable Sun medialib [no]
--enable-openssl enable openssl [no]
--enable-zlib enable zlib [autodetect]
......@@ -970,7 +969,6 @@ CONFIG_LIST="
lsp
mdct
memalign_hack
mlib
mpegaudiodsp
network
nonfree
......@@ -2967,7 +2965,6 @@ enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
die "ERROR: libx264 version must be >= 0.118."; }
enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
......@@ -3227,7 +3224,6 @@ echo "network support ${network-no}"
echo "threading support ${thread_type-no}"
echo "safe bitstream reader ${safe_bitstream_reader-no}"
echo "SDL support ${sdl-no}"
echo "Sun medialib support ${mlib-no}"
echo "libdxva2 enabled ${dxva2-no}"
echo "libva enabled ${vaapi-no}"
echo "libvdpau enabled ${vdpau-no}"
......
......@@ -663,8 +663,6 @@ OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o
OBJS-$(HAVE_PTHREADS) += pthread.o
OBJS-$(HAVE_W32THREADS) += pthread.o
OBJS-$(CONFIG_MLIB) += mlib/dsputil_mlib.o \
# inverse.o contains the ff_inverse table definition, which is used by
# the FASTDIV macro (from libavutil); since referencing the external
# table has a negative effect on performance, copy it in libavcodec as
......@@ -696,7 +694,7 @@ HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen \
dv_tablegen motionpixels_tablegen mpegaudio_tablegen \
pcm_tablegen qdm2_tablegen sinewin_tablegen
DIRS = alpha arm bfin mlib ppc ps2 sh4 sparc x86
DIRS = alpha arm bfin ppc ps2 sh4 sparc x86
CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
......
......@@ -1680,7 +1680,6 @@ typedef struct AVCodecContext {
#define FF_DCT_FASTINT 1
#define FF_DCT_INT 2
#define FF_DCT_MMX 3
#define FF_DCT_MLIB 4
#define FF_DCT_ALTIVEC 5
#define FF_DCT_FAAN 6
......@@ -1731,7 +1730,6 @@ typedef struct AVCodecContext {
#define FF_IDCT_SIMPLEMMX 3
#define FF_IDCT_LIBMPEG2MMX 4
#define FF_IDCT_PS2 5
#define FF_IDCT_MLIB 6
#define FF_IDCT_ARM 7
#define FF_IDCT_ALTIVEC 8
#define FF_IDCT_SH4 9
......
......@@ -3138,7 +3138,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
if (HAVE_MMX) dsputil_init_mmx (c, avctx);
if (ARCH_ARM) dsputil_init_arm (c, avctx);
if (CONFIG_MLIB) dsputil_init_mlib (c, avctx);
if (HAVE_VIS) dsputil_init_vis (c, avctx);
if (ARCH_ALPHA) dsputil_init_alpha (c, avctx);
if (ARCH_PPC) dsputil_init_ppc (c, avctx);
......
......@@ -643,7 +643,6 @@ static inline int get_penalty_factor(int lambda, int lambda2, int type){
void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx);
void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);
void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx);
void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx);
void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
......
/*
* Sun mediaLib optimized DSP utils
* Copyright (c) 2001 Fabrice Bellard
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavcodec/dsputil.h"
#include "libavcodec/mpegvideo.h"
#include <mlib_types.h>
#include <mlib_status.h>
#include <mlib_sys.h>
#include <mlib_algebra.h>
#include <mlib_video.h>
/* misc */
static void get_pixels_mlib(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
{
int i;
for (i=0;i<8;i++) {
mlib_VectorConvert_S16_U8_Mod((mlib_s16 *)block, (mlib_u8 *)pixels, 8);
pixels += line_size;
block += 8;
}
}
static void diff_pixels_mlib(DCTELEM *restrict block, const uint8_t *s1, const uint8_t *s2, int line_size)
{
int i;
for (i=0;i<8;i++) {
mlib_VectorSub_S16_U8_Mod((mlib_s16 *)block, (mlib_u8 *)s1, (mlib_u8 *)s2, 8);
s1 += line_size;
s2 += line_size;
block += 8;
}
}
static void add_pixels_clamped_mlib(const DCTELEM *block, uint8_t *pixels, int line_size)
{
mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size);
}
/* put block, width 16 pixel, height 8/16 */
static void put_pixels16_mlib (uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 8:
mlib_VideoCopyRef_U8_U8_16x8(dest, (uint8_t *)ref, stride);
break;
case 16:
mlib_VideoCopyRef_U8_U8_16x16(dest, (uint8_t *)ref, stride);
break;
default:
assert(0);
}
}
static void put_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 8:
mlib_VideoInterpX_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
break;
case 16:
mlib_VideoInterpX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
break;
default:
assert(0);
}
}
static void put_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 8:
mlib_VideoInterpY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
break;
case 16:
mlib_VideoInterpY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
break;
default:
assert(0);
}
}
static void put_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 8:
mlib_VideoInterpXY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
break;
case 16:
mlib_VideoInterpXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
break;
default:
assert(0);
}
}
/* put block, width 8 pixel, height 4/8/16 */
static void put_pixels8_mlib (uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 4:
mlib_VideoCopyRef_U8_U8_8x4(dest, (uint8_t *)ref, stride);
break;
case 8:
mlib_VideoCopyRef_U8_U8_8x8(dest, (uint8_t *)ref, stride);
break;
case 16:
mlib_VideoCopyRef_U8_U8_8x16(dest, (uint8_t *)ref, stride);
break;
default:
assert(0);
}
}
static void put_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 4:
mlib_VideoInterpX_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
break;
case 8:
mlib_VideoInterpX_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
break;
case 16:
mlib_VideoInterpX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
break;
default:
assert(0);
}
}
static void put_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 4:
mlib_VideoInterpY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
break;
case 8:
mlib_VideoInterpY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
break;
case 16:
mlib_VideoInterpY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
break;
default:
assert(0);
}
}
static void put_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 4:
mlib_VideoInterpXY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
break;
case 8:
mlib_VideoInterpXY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
break;
case 16:
mlib_VideoInterpXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
break;
default:
assert(0);
}
}
/* average block, width 16 pixel, height 8/16 */
static void avg_pixels16_mlib (uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 8:
mlib_VideoCopyRefAve_U8_U8_16x8(dest, (uint8_t *)ref, stride);
break;
case 16:
mlib_VideoCopyRefAve_U8_U8_16x16(dest, (uint8_t *)ref, stride);
break;
default:
assert(0);
}
}
static void avg_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 8:
mlib_VideoInterpAveX_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
break;
case 16:
mlib_VideoInterpAveX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
break;
default:
assert(0);
}
}
static void avg_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 8:
mlib_VideoInterpAveY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
break;
case 16:
mlib_VideoInterpAveY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
break;
default:
assert(0);
}
}
static void avg_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 8:
mlib_VideoInterpAveXY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
break;
case 16:
mlib_VideoInterpAveXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
break;
default:
assert(0);
}
}
/* average block, width 8 pixel, height 4/8/16 */
static void avg_pixels8_mlib (uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 4:
mlib_VideoCopyRefAve_U8_U8_8x4(dest, (uint8_t *)ref, stride);
break;
case 8:
mlib_VideoCopyRefAve_U8_U8_8x8(dest, (uint8_t *)ref, stride);
break;
case 16:
mlib_VideoCopyRefAve_U8_U8_8x16(dest, (uint8_t *)ref, stride);
break;
default:
assert(0);
}
}
static void avg_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 4:
mlib_VideoInterpAveX_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
break;
case 8:
mlib_VideoInterpAveX_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
break;
case 16:
mlib_VideoInterpAveX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
break;
default:
assert(0);
}
}
static void avg_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 4:
mlib_VideoInterpAveY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
break;
case 8:
mlib_VideoInterpAveY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
break;
case 16:
mlib_VideoInterpAveY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
break;
default:
assert(0);
}
}
static void avg_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref,
int stride, int height)
{
switch (height) {
case 4:
mlib_VideoInterpAveXY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
break;
case 8:
mlib_VideoInterpAveXY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
break;
case 16:
mlib_VideoInterpAveXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
break;
default:
assert(0);
}
}
/* swap byte order of a buffer */
static void bswap_buf_mlib(uint32_t *dst, const uint32_t *src, int w)
{
mlib_VectorReverseByteOrder_U32_U32(dst, src, w);
}
/* transformations */
static void ff_idct_put_mlib(uint8_t *dest, int line_size, DCTELEM *data)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
mlib_VideoIDCT8x8_S16_S16 (data, data);
for(i=0;i<8;i++) {
dest[0] = cm[data[0]];
dest[1] = cm[data[1]];
dest[2] = cm[data[2]];
dest[3] = cm[data[3]];
dest[4] = cm[data[4]];
dest[5] = cm[data[5]];
dest[6] = cm[data[6]];
dest[7] = cm[data[7]];
dest += line_size;
data += 8;
}
}
static void ff_idct_add_mlib(uint8_t *dest, int line_size, DCTELEM *data)
{
mlib_VideoIDCT8x8_S16_S16 (data, data);
mlib_VideoAddBlock_U8_S16(dest, (mlib_s16 *)data, line_size);
}
static void ff_idct_mlib(DCTELEM *data)
{
mlib_VideoIDCT8x8_S16_S16 (data, data);
}
static void ff_fdct_mlib(DCTELEM *data)
{
mlib_VideoDCT8x8_S16_S16 (data, data);
}
void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx)
{
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
c->diff_pixels = diff_pixels_mlib;
c->add_pixels_clamped = add_pixels_clamped_mlib;
if (!high_bit_depth) {
c->get_pixels = get_pixels_mlib;
c->put_pixels_tab[0][0] = put_pixels16_mlib;
c->put_pixels_tab[0][1] = put_pixels16_x2_mlib;
c->put_pixels_tab[0][2] = put_pixels16_y2_mlib;
c->put_pixels_tab[0][3] = put_pixels16_xy2_mlib;
c->put_pixels_tab[1][0] = put_pixels8_mlib;
c->put_pixels_tab[1][1] = put_pixels8_x2_mlib;
c->put_pixels_tab[1][2] = put_pixels8_y2_mlib;
c->put_pixels_tab[1][3] = put_pixels8_xy2_mlib;
c->avg_pixels_tab[0][0] = avg_pixels16_mlib;
c->avg_pixels_tab[0][1] = avg_pixels16_x2_mlib;
c->avg_pixels_tab[0][2] = avg_pixels16_y2_mlib;
c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mlib;
c->avg_pixels_tab[1][0] = avg_pixels8_mlib;
c->avg_pixels_tab[1][1] = avg_pixels8_x2_mlib;
c->avg_pixels_tab[1][2] = avg_pixels8_y2_mlib;
c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mlib;
c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mlib;
c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mlib;
}
c->bswap_buf = bswap_buf_mlib;
}
void MPV_common_init_mlib(MpegEncContext *s)
{
if(s->avctx->dct_algo==FF_DCT_AUTO || s->avctx->dct_algo==FF_DCT_MLIB){
s->dsp.fdct = ff_fdct_mlib;
}
if(s->avctx->idct_algo==FF_IDCT_MLIB){
s->dsp.idct_put= ff_idct_put_mlib;
s->dsp.idct_add= ff_idct_add_mlib;
s->dsp.idct = ff_idct_mlib;
s->dsp.idct_permutation_type= FF_NO_IDCT_PERM;
}
}
......@@ -191,8 +191,6 @@ av_cold int ff_dct_common_init(MpegEncContext *s)
MPV_common_init_mmx(s);
#elif ARCH_ALPHA
MPV_common_init_axp(s);
#elif CONFIG_MLIB
MPV_common_init_mlib(s);
#elif HAVE_MMI
MPV_common_init_mmi(s);
#elif ARCH_ARM
......
......@@ -697,7 +697,6 @@ int MPV_encode_end(AVCodecContext *avctx);
int MPV_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data);
void MPV_common_init_mmx(MpegEncContext *s);
void MPV_common_init_axp(MpegEncContext *s);
void MPV_common_init_mlib(MpegEncContext *s);
void MPV_common_init_mmi(MpegEncContext *s);
void MPV_common_init_arm(MpegEncContext *s);
void MPV_common_init_altivec(MpegEncContext *s);
......
......@@ -201,7 +201,6 @@ static const AVOption options[]={
{"fastint", "fast integer", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_FASTINT }, INT_MIN, INT_MAX, V|E, "dct"},
{"int", "accurate integer", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_INT }, INT_MIN, INT_MAX, V|E, "dct"},
{"mmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_MMX }, INT_MIN, INT_MAX, V|E, "dct"},
{"mlib", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_MLIB }, INT_MIN, INT_MAX, V|E, "dct"},
{"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_ALTIVEC }, INT_MIN, INT_MAX, V|E, "dct"},
{"faan", "floating point AAN DCT", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_FAAN }, INT_MIN, INT_MAX, V|E, "dct"},
{"lumi_mask", "compresses bright areas stronger than medium ones", OFFSET(lumi_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E},
......@@ -216,7 +215,6 @@ static const AVOption options[]={
{"simplemmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"libmpeg2mmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_LIBMPEG2MMX }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"ps2", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_PS2 }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"mlib", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_MLIB }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"arm", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ALTIVEC }, INT_MIN, INT_MAX, V|E|D, "idct"},
{"sh4", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SH4 }, INT_MIN, INT_MAX, V|E|D, "idct"},
......
......@@ -9,7 +9,6 @@ OBJS = input.o options.o output.o rgb2rgb.o swscale.o \
OBJS-$(ARCH_BFIN) += bfin/internal_bfin.o \
bfin/swscale_bfin.o \
bfin/yuv2rgb_bfin.o
OBJS-$(CONFIG_MLIB) += mlib/yuv2rgb_mlib.o
OBJS-$(HAVE_ALTIVEC) += ppc/swscale_altivec.o \
ppc/yuv2rgb_altivec.o \
ppc/yuv2yuv_altivec.o
......@@ -25,4 +24,4 @@ OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
TESTPROGS = colorspace swscale
DIRS = bfin mlib ppc sparc x86
DIRS = bfin ppc sparc x86
/*
* software YUV to RGB converter using mediaLib
*
* Copyright (C) 2003 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of Libav.
*