printf to mp_msg
authorAlban Bedel <albeu@free.fr>
Thu, 2 May 2002 11:00:16 +0000 (11:00 +0000)
committerAlban Bedel <albeu@free.fr>
Thu, 2 May 2002 11:00:16 +0000 (11:00 +0000)
Originally committed as revision 5938 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc

postproc/swscale.c
postproc/swscale_template.c
postproc/yuv2rgb.c

index 7bca3c39b9243b16d9cdbddc2a8e544e565e74b4..d5a788a2849b8f143b6397cad839a68bc12dab54 100644 (file)
@@ -62,6 +62,7 @@ untested special converters
 #include "../libvo/img_format.h"
 #include "rgb2rgb.h"
 #include "../libvo/fastmemcpy.h"
+#include "../mp_msg.h"
 #undef MOVNTQ
 #undef PAVGB
 
@@ -936,8 +937,8 @@ static inline void initFilter(int16_t **outFilter, int16_t **filterPos, int *out
        filter= (double*)memalign(8, filterSize*dstW*sizeof(double));
        *outFilterSize= filterSize;
 
-       if((flags&SWS_PRINT_INFO) && verbose)
-               printf("SwScaler: reducing / aligning filtersize %d -> %d\n", filter2Size, filterSize);
+       if(flags&SWS_PRINT_INFO)
+               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: reducing / aligning filtersize %d -> %d\n", filter2Size, filterSize);
        /* try to reduce the filter-size (step2 reduce it) */
        for(i=0; i<dstW; i++)
        {
@@ -1452,19 +1453,19 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
 
        if(!isSupportedIn(srcFormat)) 
        {
-               fprintf(stderr, "swScaler: %s is not supported as input format\n", vo_format_name(srcFormat));
+               mp_msg(MSGT_SWS,MSGL_ERR,"swScaler: %s is not supported as input format\n", vo_format_name(srcFormat));
                return NULL;
        }
        if(!isSupportedOut(dstFormat))
        {
-               fprintf(stderr, "swScaler: %s is not supported as output format\n", vo_format_name(dstFormat));
+                mp_msg(MSGT_SWS,MSGL_ERR,"swScaler: %s is not supported as output format\n", vo_format_name(dstFormat));
                return NULL;
        }
 
        /* sanity check */
        if(srcW<4 || srcH<1 || dstW<8 || dstH<1) //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code
        {
-               fprintf(stderr, "swScaler: %dx%d -> %dx%d is invalid scaling dimension\n", 
+                mp_msg(MSGT_SWS,MSGL_ERR,"swScaler: %dx%d -> %dx%d is invalid scaling dimension\n", 
                        srcW, srcH, dstW, dstH);
                return NULL;
        }
@@ -1513,7 +1514,7 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
                        c->swScale= planarYuvToBgr;
 
                        if(flags&SWS_PRINT_INFO)
-                               printf("SwScaler: using unscaled %s -> %s special converter\n", 
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using unscaled %s -> %s special converter\n", 
                                        vo_format_name(srcFormat), vo_format_name(dstFormat));
                        return c;
                }
@@ -1524,7 +1525,7 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
                        c->swScale= simpleCopy;
 
                        if(flags&SWS_PRINT_INFO)
-                               printf("SwScaler: using unscaled %s -> %s special converter\n", 
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using unscaled %s -> %s special converter\n", 
                                        vo_format_name(srcFormat), vo_format_name(dstFormat));
                        return c;
                }
@@ -1536,7 +1537,7 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
                        c->swScale= bgr32to24Wrapper;
 
                        if(flags&SWS_PRINT_INFO)
-                               printf("SwScaler: using unscaled %s -> %s special converter\n", 
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using unscaled %s -> %s special converter\n", 
                                        vo_format_name(srcFormat), vo_format_name(dstFormat));
                        return c;
                }
@@ -1548,7 +1549,7 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
                        c->swScale= bgr24to32Wrapper;
 
                        if(flags&SWS_PRINT_INFO)
-                               printf("SwScaler: using unscaled %s -> %s special converter\n", 
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using unscaled %s -> %s special converter\n", 
                                        vo_format_name(srcFormat), vo_format_name(dstFormat));
                        return c;
                }
@@ -1559,7 +1560,7 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
                        c->swScale= bgr15to16Wrapper;
 
                        if(flags&SWS_PRINT_INFO)
-                               printf("SwScaler: using unscaled %s -> %s special converter\n", 
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using unscaled %s -> %s special converter\n", 
                                        vo_format_name(srcFormat), vo_format_name(dstFormat));
                        return c;
                }
@@ -1570,7 +1571,7 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
                        c->swScale= bgr24toyv12Wrapper;
 
                        if(flags&SWS_PRINT_INFO)
-                               printf("SwScaler: using unscaled %s -> %s special converter\n", 
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using unscaled %s -> %s special converter\n", 
                                        vo_format_name(srcFormat), vo_format_name(dstFormat));
                        return c;
                }
@@ -1582,7 +1583,7 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
                if(!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR))
                {
                        if(flags&SWS_PRINT_INFO)
-                               fprintf(stderr, "SwScaler: output Width is not a multiple of 32 -> no MMX2 scaler\n");
+                               mp_msg(MSGT_SWS,MSGL_WARN,"SwScaler: output Width is not a multiple of 32 -> no MMX2 scaler\n");
                }
        }
        else
@@ -1720,35 +1721,35 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
                char *dither= "";
 #endif
                if(flags&SWS_FAST_BILINEAR)
-                       fprintf(stderr, "\nSwScaler: FAST_BILINEAR scaler, ");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: FAST_BILINEAR scaler, ");
                else if(flags&SWS_BILINEAR)
-                       fprintf(stderr, "\nSwScaler: BILINEAR scaler, ");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: BILINEAR scaler, ");
                else if(flags&SWS_BICUBIC)
-                       fprintf(stderr, "\nSwScaler: BICUBIC scaler, ");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: BICUBIC scaler, ");
                else if(flags&SWS_X)
-                       fprintf(stderr, "\nSwScaler: Experimental scaler, ");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: Experimental scaler, ");
                else if(flags&SWS_POINT)
-                       fprintf(stderr, "\nSwScaler: Nearest Neighbor / POINT scaler, ");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: Nearest Neighbor / POINT scaler, ");
                else if(flags&SWS_AREA)
-                       fprintf(stderr, "\nSwScaler: Area Averageing scaler, ");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: Area Averageing scaler, ");
                else
-                       fprintf(stderr, "\nSwScaler: ehh flags invalid?! ");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: ehh flags invalid?! ");
 
                if(dstFormat==IMGFMT_BGR15 || dstFormat==IMGFMT_BGR16)
-                       fprintf(stderr, "from %s to%s %s ", 
+                       mp_msg(MSGT_SWS,MSGL_INFO,"from %s to%s %s ", 
                                vo_format_name(srcFormat), dither, vo_format_name(dstFormat));
                else
-                       fprintf(stderr, "from %s to %s ", 
+                       mp_msg(MSGT_SWS,MSGL_INFO,"from %s to %s ", 
                                vo_format_name(srcFormat), vo_format_name(dstFormat));
 
                if(cpuCaps.hasMMX2)
-                       fprintf(stderr, "using MMX2\n");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"using MMX2\n");
                else if(cpuCaps.has3DNow)
-                       fprintf(stderr, "using 3DNOW\n");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"using 3DNOW\n");
                else if(cpuCaps.hasMMX)
-                       fprintf(stderr, "using MMX\n");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"using MMX\n");
                else
-                       fprintf(stderr, "using C\n");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"using C\n");
        }
 
        if((flags & SWS_PRINT_INFO) && verbose)
@@ -1756,70 +1757,70 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
                if(cpuCaps.hasMMX)
                {
                        if(c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR))
-                               printf("SwScaler: using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
                        else
                        {
                                if(c->hLumFilterSize==4)
-                                       printf("SwScaler: using 4-tap MMX scaler for horizontal luminance scaling\n");
+                                       mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 4-tap MMX scaler for horizontal luminance scaling\n");
                                else if(c->hLumFilterSize==8)
-                                       printf("SwScaler: using 8-tap MMX scaler for horizontal luminance scaling\n");
+                                       mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 8-tap MMX scaler for horizontal luminance scaling\n");
                                else
-                                       printf("SwScaler: using n-tap MMX scaler for horizontal luminance scaling\n");
+                                       mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using n-tap MMX scaler for horizontal luminance scaling\n");
 
                                if(c->hChrFilterSize==4)
-                                       printf("SwScaler: using 4-tap MMX scaler for horizontal chrominance scaling\n");
+                                       mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 4-tap MMX scaler for horizontal chrominance scaling\n");
                                else if(c->hChrFilterSize==8)
-                                       printf("SwScaler: using 8-tap MMX scaler for horizontal chrominance scaling\n");
+                                       mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 8-tap MMX scaler for horizontal chrominance scaling\n");
                                else
-                                       printf("SwScaler: using n-tap MMX scaler for horizontal chrominance scaling\n");
+                                       mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using n-tap MMX scaler for horizontal chrominance scaling\n");
                        }
                }
                else
                {
 #ifdef ARCH_X86
-                       printf("SwScaler: using X86-Asm scaler for horizontal scaling\n");
+                       mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using X86-Asm scaler for horizontal scaling\n");
 #else
                        if(flags & SWS_FAST_BILINEAR)
-                               printf("SwScaler: using FAST_BILINEAR C scaler for horizontal scaling\n");
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using FAST_BILINEAR C scaler for horizontal scaling\n");
                        else
-                               printf("SwScaler: using C scaler for horizontal scaling\n");
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using C scaler for horizontal scaling\n");
 #endif
                }
                if(isPlanarYUV(dstFormat))
                {
                        if(c->vLumFilterSize==1)
-                               printf("SwScaler: using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C");
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C");
                        else
-                               printf("SwScaler: using n-tap %s scaler for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C");
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using n-tap %s scaler for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C");
                }
                else
                {
                        if(c->vLumFilterSize==1 && c->vChrFilterSize==2)
-                               printf("SwScaler: using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
                                       "SwScaler:       2-tap scaler for vertical chrominance scaling (BGR)\n",cpuCaps.hasMMX ? "MMX" : "C");
                        else if(c->vLumFilterSize==2 && c->vChrFilterSize==2)
-                               printf("SwScaler: using 2-tap linear %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C");
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 2-tap linear %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C");
                        else
-                               printf("SwScaler: using n-tap %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C");
+                               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using n-tap %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C");
                }
 
                if(dstFormat==IMGFMT_BGR24)
-                       printf("SwScaler: using %s YV12->BGR24 Converter\n",
+                       mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using %s YV12->BGR24 Converter\n",
                                cpuCaps.hasMMX2 ? "MMX2" : (cpuCaps.hasMMX ? "MMX" : "C"));
                else if(dstFormat==IMGFMT_BGR32)
-                       printf("SwScaler: using %s YV12->BGR32 Converter\n", cpuCaps.hasMMX ? "MMX" : "C");
+                       mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using %s YV12->BGR32 Converter\n", cpuCaps.hasMMX ? "MMX" : "C");
                else if(dstFormat==IMGFMT_BGR16)
-                       printf("SwScaler: using %s YV12->BGR16 Converter\n", cpuCaps.hasMMX ? "MMX" : "C");
+                       mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using %s YV12->BGR16 Converter\n", cpuCaps.hasMMX ? "MMX" : "C");
                else if(dstFormat==IMGFMT_BGR15)
-                       printf("SwScaler: using %s YV12->BGR15 Converter\n", cpuCaps.hasMMX ? "MMX" : "C");
+                       mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using %s YV12->BGR15 Converter\n", cpuCaps.hasMMX ? "MMX" : "C");
 
-               printf("SwScaler: %dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
+               mp_msg(MSGT_SWS,MSGL_V,"SwScaler: %dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
        }
        if((flags & SWS_PRINT_INFO) && verbose>1)
        {
-               printf("SwScaler:Lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
+               mp_msg(MSGT_SWS,MSGL_DBG2,"SwScaler:Lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
                        c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc);
-               printf("SwScaler:Chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
+               mp_msg(MSGT_SWS,MSGL_DBG2,"SwScaler:Chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
                        c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc);
        }
 
index e76020eab7a48e0799e2afae012ac9805232ea98..89ca6111c30b63d0dbf904b4a20c4b108145a189 100644 (file)
@@ -2667,7 +2667,7 @@ static void RENAME(swScale)(SwsContext *c, uint8_t* srcParam[], int srcStridePar
                static int firstTime=1; //FIXME move this into the context perhaps
                if(flags & SWS_PRINT_INFO && firstTime)
                {
-                       fprintf(stderr, "SwScaler: Warning: dstStride is not aligned!\n"
+                       mp_msg(MSGT_SWS,MSGL_WARN,"SwScaler: Warning: dstStride is not aligned!\n"
                                        "SwScaler:          ->cannot do aligned memory acesses anymore\n");
                        firstTime=0;
                }
index 321c320a7aea8a18c9dd08eeaf6d7b1d2e9152fc..ac5f8b7e91ac6f2377ce3f767f60b5c68a0730ce 100644 (file)
@@ -37,6 +37,7 @@
 #include "rgb2rgb.h"
 #include "../cpudetect.h"
 #include "../mangle.h"
+#include "../mp_msg.h"
 
 #ifdef HAVE_MLIB
 #include "yuv2rgb_mlib.c"
@@ -157,9 +158,9 @@ void yuv2rgb_init (int bpp, int mode)
        if (yuv2rgb == NULL /*&& (config.flags & VO_MMX_ENABLE)*/) {
                yuv2rgb = yuv2rgb_init_MMX2 (bpp, mode);
                if (yuv2rgb != NULL)
-                       printf ("Using MMX2 for colorspace transform\n");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"Using MMX2 for colorspace transform\n");
                else
-                       printf ("Cannot init MMX2 colorspace transform\n");
+                       mp_msg(MSGT_SWS,MSGL_WARN,"Cannot init MMX2 colorspace transform\n");
        }
     }
     else if(gCpuCaps.hasMMX)
@@ -167,9 +168,9 @@ void yuv2rgb_init (int bpp, int mode)
        if (yuv2rgb == NULL /*&& (config.flags & VO_MMX_ENABLE)*/) {
                yuv2rgb = yuv2rgb_init_MMX (bpp, mode);
                if (yuv2rgb != NULL)
-                       printf ("Using MMX for colorspace transform\n");
+                       mp_msg(MSGT_SWS,MSGL_INFO,"Using MMX for colorspace transform\n");
                else
-                       printf ("Cannot init MMX colorspace transform\n");
+                       mp_msg(MSGT_SWS,MSGL_WARN,"Cannot init MMX colorspace transform\n");
        }
     }
 #endif
@@ -177,11 +178,11 @@ void yuv2rgb_init (int bpp, int mode)
     if (yuv2rgb == NULL /*&& (config.flags & VO_MLIB_ENABLE)*/) {
        yuv2rgb = yuv2rgb_init_mlib (bpp, mode);
        if (yuv2rgb != NULL)
-           printf ("Using mlib for colorspace transform\n");
+           mp_msg(MSGT_SWS,MSGL_INFO,"Using mlib for colorspace transform\n");
     }
 #endif
     if (yuv2rgb == NULL) {
-       printf ("No accelerated colorspace conversion found\n");
+       mp_msg(MSGT_SWS,MSGL_INFO,"No accelerated colorspace conversion found\n");
        yuv2rgb_c_init (bpp, mode);
        yuv2rgb = (yuv2rgb_fun)yuv2rgb_c;
     }
@@ -489,7 +490,7 @@ static void yuv2rgb_c_init (int bpp, int mode)
        break;
 
     default:
-       printf ("%ibpp not supported by yuv2rgb\n", bpp);
+       mp_msg(MSGT_SWS,MSGL_ERR,"%ibpp not supported by yuv2rgb\n", bpp);
        //exit (1);
     }