Commit 94c4def2 authored by Luca Abeni's avatar Luca Abeni

Use libavutil in libswscale, and allow it to be built out of the mplayer tree

Originally committed as revision 19148 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
parent 918a4591
......@@ -11,10 +11,12 @@
#include "config.h"
#include "rgb2rgb.h"
#include "swscale.h"
#include "cpudetect.h"
#include "mangle.h"
#include "swscale_internal.h"
#include "x86_cpu.h"
#include "bswap.h"
#ifdef USE_FASTMEMCPY
#include "libvo/fastmemcpy.h"
#endif
#define FAST_BGR2YV12 // use 7 bit coeffs instead of 15bit
......
......@@ -22,10 +22,8 @@
#include <inttypes.h>
#include <stdarg.h>
#include "config.h"
#include "swscale.h"
#include "libvo/img_format.h"
#include "img_format.h"
static int testFormat[]={
IMGFMT_YVU9,
......@@ -120,8 +118,8 @@ static void doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcForma
if(ssdY>100 || ssdU>100 || ssdV>100){
printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\n",
vo_format_name(srcFormat), srcW, srcH,
vo_format_name(dstFormat), dstW, dstH,
sws_format_name(srcFormat), srcW, srcH,
sws_format_name(dstFormat), dstW, dstH,
flags,
ssdY, ssdU, ssdV);
}
......@@ -163,8 +161,8 @@ static void selfTest(uint8_t *src[3], int stride[3], int w, int h){
if(!dstFormat) break;
// if(!isSupportedOut(dstFormat)) continue;
printf("%s -> %s\n",
vo_format_name(srcFormat),
vo_format_name(dstFormat));
sws_format_name(srcFormat),
sws_format_name(dstFormat));
srcW= w;
srcH= h;
......
This diff is collapsed.
......@@ -29,6 +29,15 @@
extern "C" {
#endif
#define AV_STRINGIFY(s) AV_TOSTRING(s)
#define AV_TOSTRING(s) #s
#define LIBSWSCALE_VERSION_INT ((0<<16)+(5<<8)+0)
#define LIBSWSCALE_VERSION 0.5.0
#define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT
#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
/* values for the flags, the stuff on the command line is different */
#define SWS_FAST_BILINEAR 1
#define SWS_BILINEAR 2
......
......@@ -23,20 +23,20 @@
#include <altivec.h>
#endif
#include "avutil.h"
#ifdef CONFIG_DARWIN
#define AVV(x...) (x)
#else
#define AVV(x...) {x}
#endif
#include "mp_msg.h"
#define MSG_WARN(args...) mp_msg(MSGT_SWS,MSGL_WARN, ##args )
#define MSG_FATAL(args...) mp_msg(MSGT_SWS,MSGL_FATAL, ##args )
#define MSG_ERR(args...) mp_msg(MSGT_SWS,MSGL_ERR, ##args )
#define MSG_V(args...) mp_msg(MSGT_SWS,MSGL_V, ##args )
#define MSG_DBG2(args...) mp_msg(MSGT_SWS,MSGL_DBG2, ##args )
#define MSG_INFO(args...) mp_msg(MSGT_SWS,MSGL_INFO, ##args )
#define MSG_WARN(args...) av_log(NULL, AV_LOG_DEBUG, ##args )
#define MSG_FATAL(args...) av_log(NULL, AV_LOG_ERROR, ##args )
#define MSG_ERR(args...) av_log(NULL, AV_LOG_ERROR, ##args )
#define MSG_V(args...) av_log(NULL, AV_LOG_INFO, ##args )
#define MSG_DBG2(args...) av_log(NULL, AV_LOG_DEBUG, ##args )
#define MSG_INFO(args...) av_log(NULL, AV_LOG_INFO, ##args )
#define MAX_FILTER_SIZE 256
......@@ -164,4 +164,6 @@ typedef struct SwsContext{
SwsFunc yuv2rgb_get_func_ptr (SwsContext *c);
int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation);
char *sws_format_name(int format);
#endif
......@@ -36,12 +36,10 @@
#include <assert.h>
#include "config.h"
//#include "video_out.h"
#include "rgb2rgb.h"
#include "swscale.h"
#include "swscale_internal.h"
#include "mangle.h"
#include "libvo/img_format.h" //FIXME try to reduce dependency of such stuff
#include "img_format.h" //FIXME try to reduce dependency of such stuff
#ifdef HAVE_MLIB
#include "yuv2rgb_mlib.c"
......@@ -692,7 +690,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
switch (bpp) {
case 32:
table_start= table_32 = malloc ((197 + 2*682 + 256 + 132) * sizeof (uint32_t));
table_start= table_32 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint32_t));
entry_size = sizeof (uint32_t);
table_r = table_32 + 197;
......@@ -708,7 +706,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
break;
case 24:
table_start= table_8 = malloc ((256 + 2*232) * sizeof (uint8_t));
table_start= table_8 = av_malloc ((256 + 2*232) * sizeof (uint8_t));
entry_size = sizeof (uint8_t);
table_r = table_g = table_b = table_8 + 232;
......@@ -719,7 +717,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
case 15:
case 16:
table_start= table_16 = malloc ((197 + 2*682 + 256 + 132) * sizeof (uint16_t));
table_start= table_16 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint16_t));
entry_size = sizeof (uint16_t);
table_r = table_16 + 197;
......@@ -750,7 +748,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
break;
case 8:
table_start= table_332 = malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t));
table_start= table_332 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t));
entry_size = sizeof (uint8_t);
table_r = table_332 + 197;
......@@ -784,7 +782,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
break;
case 4:
case 4|128:
table_start= table_121 = malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t));
table_start= table_121 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t));
entry_size = sizeof (uint8_t);
table_r = table_121 + 197;
......@@ -815,7 +813,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
break;
case 1:
table_start= table_1 = malloc (256*2 * sizeof (uint8_t));
table_start= table_1 = av_malloc (256*2 * sizeof (uint8_t));
entry_size = sizeof (uint8_t);
table_g = table_1;
......@@ -842,7 +840,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
c->table_bU[i] = table_b + entry_size * div_round (cbu * (i-128), 76309);
}
if(c->yuvTable) free(c->yuvTable);
av_free(c->yuvTable);
c->yuvTable= table_start;
return 0;
}
......@@ -74,8 +74,7 @@
#include "rgb2rgb.h"
#include "swscale.h"
#include "swscale_internal.h"
#include "mangle.h"
#include "libvo/img_format.h" //FIXME try to reduce dependency of such stuff
#include "img_format.h" //FIXME try to reduce dependency of such stuff
#undef PROFILE_THE_BEAST
#undef INC_SCALING
......@@ -868,7 +867,7 @@ altivec_yuv2packedX (SwsContext *c,
static int printed_error_message;
if(!printed_error_message) {
MSG_ERR("altivec_yuv2packedX doesn't support %s output\n",
vo_format_name(c->dstFormat));
sws_format_name(c->dstFormat));
printed_error_message=1;
}
return;
......@@ -943,7 +942,7 @@ altivec_yuv2packedX (SwsContext *c,
default:
/* Unreachable, I think. */
MSG_ERR("altivec_yuv2packedX doesn't support %s output\n",
vo_format_name(c->dstFormat));
sws_format_name(c->dstFormat));
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment