Commit 0e4ea7dd authored by lucabe's avatar lucabe

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


git-svn-id: file:///var/local/repositories/mplayer/trunk/libswscale@19148 b3059339-0415-0410-9bf9-f77b7e298cf2
parent 3eeb53ba
...@@ -11,10 +11,12 @@ ...@@ -11,10 +11,12 @@
#include "config.h" #include "config.h"
#include "rgb2rgb.h" #include "rgb2rgb.h"
#include "swscale.h" #include "swscale.h"
#include "cpudetect.h" #include "swscale_internal.h"
#include "mangle.h" #include "x86_cpu.h"
#include "bswap.h" #include "bswap.h"
#ifdef USE_FASTMEMCPY
#include "libvo/fastmemcpy.h" #include "libvo/fastmemcpy.h"
#endif
#define FAST_BGR2YV12 // use 7 bit coeffs instead of 15bit #define FAST_BGR2YV12 // use 7 bit coeffs instead of 15bit
......
...@@ -22,10 +22,8 @@ ...@@ -22,10 +22,8 @@
#include <inttypes.h> #include <inttypes.h>
#include <stdarg.h> #include <stdarg.h>
#include "config.h"
#include "swscale.h" #include "swscale.h"
#include "libvo/img_format.h" #include "img_format.h"
static int testFormat[]={ static int testFormat[]={
IMGFMT_YVU9, IMGFMT_YVU9,
...@@ -120,8 +118,8 @@ static void doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcForma ...@@ -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){ if(ssdY>100 || ssdU>100 || ssdV>100){
printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\n", printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\n",
vo_format_name(srcFormat), srcW, srcH, sws_format_name(srcFormat), srcW, srcH,
vo_format_name(dstFormat), dstW, dstH, sws_format_name(dstFormat), dstW, dstH,
flags, flags,
ssdY, ssdU, ssdV); ssdY, ssdU, ssdV);
} }
...@@ -163,8 +161,8 @@ static void selfTest(uint8_t *src[3], int stride[3], int w, int h){ ...@@ -163,8 +161,8 @@ static void selfTest(uint8_t *src[3], int stride[3], int w, int h){
if(!dstFormat) break; if(!dstFormat) break;
// if(!isSupportedOut(dstFormat)) continue; // if(!isSupportedOut(dstFormat)) continue;
printf("%s -> %s\n", printf("%s -> %s\n",
vo_format_name(srcFormat), sws_format_name(srcFormat),
vo_format_name(dstFormat)); sws_format_name(dstFormat));
srcW= w; srcW= w;
srcH= h; srcH= h;
......
This diff is collapsed.
...@@ -29,6 +29,15 @@ ...@@ -29,6 +29,15 @@
extern "C" { extern "C" {
#endif #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 */ /* values for the flags, the stuff on the command line is different */
#define SWS_FAST_BILINEAR 1 #define SWS_FAST_BILINEAR 1
#define SWS_BILINEAR 2 #define SWS_BILINEAR 2
......
...@@ -23,20 +23,20 @@ ...@@ -23,20 +23,20 @@
#include <altivec.h> #include <altivec.h>
#endif #endif
#include "avutil.h"
#ifdef CONFIG_DARWIN #ifdef CONFIG_DARWIN
#define AVV(x...) (x) #define AVV(x...) (x)
#else #else
#define AVV(x...) {x} #define AVV(x...) {x}
#endif #endif
#include "mp_msg.h" #define MSG_WARN(args...) av_log(NULL, AV_LOG_DEBUG, ##args )
#define MSG_FATAL(args...) av_log(NULL, AV_LOG_ERROR, ##args )
#define MSG_WARN(args...) mp_msg(MSGT_SWS,MSGL_WARN, ##args ) #define MSG_ERR(args...) av_log(NULL, AV_LOG_ERROR, ##args )
#define MSG_FATAL(args...) mp_msg(MSGT_SWS,MSGL_FATAL, ##args ) #define MSG_V(args...) av_log(NULL, AV_LOG_INFO, ##args )
#define MSG_ERR(args...) mp_msg(MSGT_SWS,MSGL_ERR, ##args ) #define MSG_DBG2(args...) av_log(NULL, AV_LOG_DEBUG, ##args )
#define MSG_V(args...) mp_msg(MSGT_SWS,MSGL_V, ##args ) #define MSG_INFO(args...) av_log(NULL, AV_LOG_INFO, ##args )
#define MSG_DBG2(args...) mp_msg(MSGT_SWS,MSGL_DBG2, ##args )
#define MSG_INFO(args...) mp_msg(MSGT_SWS,MSGL_INFO, ##args )
#define MAX_FILTER_SIZE 256 #define MAX_FILTER_SIZE 256
...@@ -164,4 +164,6 @@ typedef struct SwsContext{ ...@@ -164,4 +164,6 @@ typedef struct SwsContext{
SwsFunc yuv2rgb_get_func_ptr (SwsContext *c); 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); 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 #endif
...@@ -36,12 +36,10 @@ ...@@ -36,12 +36,10 @@
#include <assert.h> #include <assert.h>
#include "config.h" #include "config.h"
//#include "video_out.h"
#include "rgb2rgb.h" #include "rgb2rgb.h"
#include "swscale.h" #include "swscale.h"
#include "swscale_internal.h" #include "swscale_internal.h"
#include "mangle.h" #include "img_format.h" //FIXME try to reduce dependency of such stuff
#include "libvo/img_format.h" //FIXME try to reduce dependency of such stuff
#ifdef HAVE_MLIB #ifdef HAVE_MLIB
#include "yuv2rgb_mlib.c" #include "yuv2rgb_mlib.c"
...@@ -692,7 +690,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, ...@@ -692,7 +690,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
switch (bpp) { switch (bpp) {
case 32: 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); entry_size = sizeof (uint32_t);
table_r = table_32 + 197; table_r = table_32 + 197;
...@@ -708,7 +706,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, ...@@ -708,7 +706,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
break; break;
case 24: 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); entry_size = sizeof (uint8_t);
table_r = table_g = table_b = table_8 + 232; 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, ...@@ -719,7 +717,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
case 15: case 15:
case 16: 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); entry_size = sizeof (uint16_t);
table_r = table_16 + 197; table_r = table_16 + 197;
...@@ -750,7 +748,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, ...@@ -750,7 +748,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
break; break;
case 8: 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); entry_size = sizeof (uint8_t);
table_r = table_332 + 197; table_r = table_332 + 197;
...@@ -784,7 +782,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, ...@@ -784,7 +782,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
break; break;
case 4: case 4:
case 4|128: 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); entry_size = sizeof (uint8_t);
table_r = table_121 + 197; table_r = table_121 + 197;
...@@ -815,7 +813,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, ...@@ -815,7 +813,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
break; break;
case 1: 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); entry_size = sizeof (uint8_t);
table_g = table_1; table_g = table_1;
...@@ -842,7 +840,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, ...@@ -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); 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; c->yuvTable= table_start;
return 0; return 0;
} }
...@@ -74,8 +74,7 @@ ...@@ -74,8 +74,7 @@
#include "rgb2rgb.h" #include "rgb2rgb.h"
#include "swscale.h" #include "swscale.h"
#include "swscale_internal.h" #include "swscale_internal.h"
#include "mangle.h" #include "img_format.h" //FIXME try to reduce dependency of such stuff
#include "libvo/img_format.h" //FIXME try to reduce dependency of such stuff
#undef PROFILE_THE_BEAST #undef PROFILE_THE_BEAST
#undef INC_SCALING #undef INC_SCALING
...@@ -868,7 +867,7 @@ altivec_yuv2packedX (SwsContext *c, ...@@ -868,7 +867,7 @@ altivec_yuv2packedX (SwsContext *c,
static int printed_error_message; static int printed_error_message;
if(!printed_error_message) { if(!printed_error_message) {
MSG_ERR("altivec_yuv2packedX doesn't support %s output\n", MSG_ERR("altivec_yuv2packedX doesn't support %s output\n",
vo_format_name(c->dstFormat)); sws_format_name(c->dstFormat));
printed_error_message=1; printed_error_message=1;
} }
return; return;
...@@ -943,7 +942,7 @@ altivec_yuv2packedX (SwsContext *c, ...@@ -943,7 +942,7 @@ altivec_yuv2packedX (SwsContext *c,
default: default:
/* Unreachable, I think. */ /* Unreachable, I think. */
MSG_ERR("altivec_yuv2packedX doesn't support %s output\n", MSG_ERR("altivec_yuv2packedX doesn't support %s output\n",
vo_format_name(c->dstFormat)); sws_format_name(c->dstFormat));
return; 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