[MPlayer-cvslog] r25780 - in trunk/libswscale: swscale-example.c swscale.c swscale_template.c

benoit subversion at mplayerhq.hu
Thu Jan 17 16:49:32 CET 2008


Author: benoit
Date: Thu Jan 17 16:49:31 2008
New Revision: 25780

Log:
Change (a == NULL) condition to (!a) and (a != NULL) condition to (a).


Modified:
   trunk/libswscale/swscale-example.c
   trunk/libswscale/swscale.c
   trunk/libswscale/swscale_template.c

Modified: trunk/libswscale/swscale-example.c
==============================================================================
--- trunk/libswscale/swscale-example.c	(original)
+++ trunk/libswscale/swscale-example.c	Thu Jan 17 16:49:31 2008
@@ -76,7 +76,7 @@ static int doTest(uint8_t *ref[3], int r
         src[i]= (uint8_t*) malloc(srcStride[i]*srcH);
         dst[i]= (uint8_t*) malloc(dstStride[i]*dstH);
         out[i]= (uint8_t*) malloc(refStride[i]*h);
-        if (src[i] == NULL || dst[i] == NULL || out[i] == NULL) {
+        if (!src[i] || !dst[i] || !out[i]) {
             perror("Malloc");
             res = -1;
 
@@ -86,7 +86,7 @@ static int doTest(uint8_t *ref[3], int r
 
     dstContext = outContext = NULL;
     srcContext= sws_getContext(w, h, PIX_FMT_YUV420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
-    if (srcContext == NULL) {
+    if (!srcContext) {
         fprintf(stderr, "Failed to get %s ---> %s\n",
                 sws_format_name(PIX_FMT_YUV420P),
                 sws_format_name(srcFormat));
@@ -95,7 +95,7 @@ static int doTest(uint8_t *ref[3], int r
         goto end;
     }
     dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);
-    if (dstContext == NULL) {
+    if (!dstContext) {
         fprintf(stderr, "Failed to get %s ---> %s\n",
                 sws_format_name(srcFormat),
                 sws_format_name(dstFormat));
@@ -104,7 +104,7 @@ static int doTest(uint8_t *ref[3], int r
         goto end;
     }
     outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUV420P, flags, NULL, NULL, NULL);
-    if (outContext == NULL) {
+    if (!outContext) {
         fprintf(stderr, "Failed to get %s ---> %s\n",
                 sws_format_name(dstFormat),
                 sws_format_name(PIX_FMT_YUV420P));

Modified: trunk/libswscale/swscale.c
==============================================================================
--- trunk/libswscale/swscale.c	(original)
+++ trunk/libswscale/swscale.c	Thu Jan 17 16:49:31 2008
@@ -388,7 +388,7 @@ static inline void yuv2yuvXinC(int16_t *
         dest[i]= av_clip_uint8(val>>19);
     }
 
-    if (uDest != NULL)
+    if (uDest)
         for (i=0; i<chrDstW; i++)
         {
             int u=1<<18;
@@ -421,7 +421,7 @@ static inline void yuv2nv12XinC(int16_t 
         dest[i]= av_clip_uint8(val>>19);
     }
 
-    if (uDest == NULL)
+    if (!uDest)
         return;
 
     if (dstFormat == PIX_FMT_NV12)
@@ -2050,7 +2050,7 @@ SwsContext *sws_getContext(int srcW, int
 #endif
 #endif /* RUNTIME_CPUDETECT */
     if (clip_table[512] != 255) globalInit();
-    if (rgb15to16 == NULL) sws_rgb2rgb_init(flags);
+    if (!rgb15to16) sws_rgb2rgb_init(flags);
 
     unscaled = (srcW == dstW && srcH == dstH);
     needsDither= (isBGR(dstFormat) || isRGB(dstFormat))
@@ -2097,14 +2097,14 @@ SwsContext *sws_getContext(int srcW, int
     c->vRounder= 4* 0x0001000100010001ULL;
 
     usesHFilter= usesVFilter= 0;
-    if (dstFilter->lumV!=NULL && dstFilter->lumV->length>1) usesVFilter=1;
-    if (dstFilter->lumH!=NULL && dstFilter->lumH->length>1) usesHFilter=1;
-    if (dstFilter->chrV!=NULL && dstFilter->chrV->length>1) usesVFilter=1;
-    if (dstFilter->chrH!=NULL && dstFilter->chrH->length>1) usesHFilter=1;
-    if (srcFilter->lumV!=NULL && srcFilter->lumV->length>1) usesVFilter=1;
-    if (srcFilter->lumH!=NULL && srcFilter->lumH->length>1) usesHFilter=1;
-    if (srcFilter->chrV!=NULL && srcFilter->chrV->length>1) usesVFilter=1;
-    if (srcFilter->chrH!=NULL && srcFilter->chrH->length>1) usesHFilter=1;
+    if (dstFilter->lumV && dstFilter->lumV->length>1) usesVFilter=1;
+    if (dstFilter->lumH && dstFilter->lumH->length>1) usesHFilter=1;
+    if (dstFilter->chrV && dstFilter->chrV->length>1) usesVFilter=1;
+    if (dstFilter->chrH && dstFilter->chrH->length>1) usesHFilter=1;
+    if (srcFilter->lumV && srcFilter->lumV->length>1) usesVFilter=1;
+    if (srcFilter->lumH && srcFilter->lumH->length>1) usesHFilter=1;
+    if (srcFilter->chrV && srcFilter->chrV->length>1) usesVFilter=1;
+    if (srcFilter->chrH && srcFilter->chrH->length>1) usesHFilter=1;
 
     getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat);
     getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
@@ -2964,7 +2964,7 @@ struct SwsContext *sws_getCachedContext(
     if (!param)
         param = default_param;
 
-    if (context != NULL) {
+    if (context) {
         if (context->srcW != srcW || context->srcH != srcH ||
             context->srcFormat != srcFormat ||
             context->dstW != dstW || context->dstH != dstH ||
@@ -2975,7 +2975,7 @@ struct SwsContext *sws_getCachedContext(
             context = NULL;
         }
     }
-    if (context == NULL) {
+    if (!context) {
         return sws_getContext(srcW, srcH, srcFormat,
                               dstW, dstH, dstFormat, flags,
                               srcFilter, dstFilter, param);

Modified: trunk/libswscale/swscale_template.c
==============================================================================
--- trunk/libswscale/swscale_template.c	(original)
+++ trunk/libswscale/swscale_template.c	Thu Jan 17 16:49:31 2008
@@ -973,7 +973,7 @@ static inline void RENAME(yuv2yuv1)(int1
                                     uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW)
 {
 #ifdef HAVE_MMX
-    if (uDest != NULL)
+    if (uDest)
     {
         asm volatile(
             YSCALEYUV2YV121
@@ -1010,7 +1010,7 @@ static inline void RENAME(yuv2yuv1)(int1
         dest[i]= val;
     }
 
-    if (uDest != NULL)
+    if (uDest)
         for (i=0; i<chrDstW; i++)
         {
             int u=chrSrc[i]>>7;



More information about the MPlayer-cvslog mailing list