[FFmpeg-cvslog] r30433 - in trunk/libswscale: swscale.c swscale_internal.h swscale_template.c utils.c

michael subversion
Tue Jan 26 08:40:15 CET 2010


Author: michael
Date: Tue Jan 26 08:40:14 2010
New Revision: 30433

Log:
Rename isRGB() and isBGR() as their meaning is confusing.

Modified:
   trunk/libswscale/swscale.c
   trunk/libswscale/swscale_internal.h
   trunk/libswscale/swscale_template.c
   trunk/libswscale/utils.c

Modified: trunk/libswscale/swscale.c
==============================================================================
--- trunk/libswscale/swscale.c	Mon Jan 25 23:46:09 2010	(r30432)
+++ trunk/libswscale/swscale.c	Tue Jan 26 08:40:14 2010	(r30433)
@@ -90,8 +90,8 @@ untested special converters
            (x)==PIX_FMT_PAL8        \
         || (x)==PIX_FMT_YUYV422     \
         || (x)==PIX_FMT_UYVY422     \
-        || isRGB(x)                 \
-        || isBGR(x)                 \
+        || isRGBinInt(x)                 \
+        || isBGRinInt(x)                 \
     )
 #define usePal(x) (av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL)
 
@@ -1437,8 +1437,8 @@ static int rgb2rgbWrapper(SwsContext *c,
     void (*conv)(const uint8_t *src, uint8_t *dst, long src_size)=NULL;
 
     /* BGR -> BGR */
-    if (  (isBGR(srcFormat) && isBGR(dstFormat))
-       || (isRGB(srcFormat) && isRGB(dstFormat))) {
+    if (  (isBGRinInt(srcFormat) && isBGRinInt(dstFormat))
+       || (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) {
         switch(srcId | (dstId<<4)) {
         case 0x34: conv= rgb16to15; break;
         case 0x36: conv= rgb24to15; break;
@@ -1453,8 +1453,8 @@ static int rgb2rgbWrapper(SwsContext *c,
         case 0x84: conv= rgb16to32; break;
         case 0x86: conv= rgb24to32; break;
         }
-    } else if (  (isBGR(srcFormat) && isRGB(dstFormat))
-             || (isRGB(srcFormat) && isBGR(dstFormat))) {
+    } else if (  (isBGRinInt(srcFormat) && isRGBinInt(dstFormat))
+             || (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {
         switch(srcId | (dstId<<4)) {
         case 0x33: conv= rgb15tobgr15; break;
         case 0x34: conv= rgb16tobgr15; break;
@@ -1660,16 +1660,16 @@ void ff_get_unscaled_swscale(SwsContext 
     const int dstH = c->dstH;
     int needsDither;
 
-    needsDither= (isBGR(dstFormat) || isRGB(dstFormat))
+    needsDither= (isBGRinInt(dstFormat) || isRGBinInt(dstFormat))
         &&  c->dstFormatBpp < 24
-        && (c->dstFormatBpp < c->srcFormatBpp || (!(isRGB(srcFormat) || isBGR(srcFormat))));
+        && (c->dstFormatBpp < c->srcFormatBpp || (!(isRGBinInt(srcFormat) || isBGRinInt(srcFormat))));
 
     /* yv12_to_nv12 */
     if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) && (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)) {
         c->swScale= PlanarToNV12Wrapper;
     }
     /* yuv2bgr */
-    if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P || srcFormat==PIX_FMT_YUVA420P) && (isBGR(dstFormat) || isRGB(dstFormat))
+    if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P || srcFormat==PIX_FMT_YUVA420P) && (isBGRinInt(dstFormat) || isRGBinInt(dstFormat))
         && !(flags & SWS_ACCURATE_RND) && !(dstH&1)) {
         c->swScale= ff_yuv2rgb_get_func_ptr(c);
     }
@@ -1683,8 +1683,8 @@ void ff_get_unscaled_swscale(SwsContext 
         c->swScale= bgr24toyv12Wrapper;
 
     /* RGB/BGR -> RGB/BGR (no dither needed forms) */
-    if (  (isBGR(srcFormat) || isRGB(srcFormat))
-        && (isBGR(dstFormat) || isRGB(dstFormat))
+    if (  (isBGRinInt(srcFormat) || isRGBinInt(srcFormat))
+        && (isBGRinInt(dstFormat) || isRGBinInt(dstFormat))
         && srcFormat != PIX_FMT_BGR8      && dstFormat != PIX_FMT_BGR8
         && srcFormat != PIX_FMT_RGB8      && dstFormat != PIX_FMT_RGB8
         && srcFormat != PIX_FMT_BGR4      && dstFormat != PIX_FMT_BGR4

Modified: trunk/libswscale/swscale_internal.h
==============================================================================
--- trunk/libswscale/swscale_internal.h	Mon Jan 25 23:46:09 2010	(r30432)
+++ trunk/libswscale/swscale_internal.h	Tue Jan 26 08:40:14 2010	(r30433)
@@ -385,7 +385,7 @@ const char *sws_format_name(enum PixelFo
            (x)==PIX_FMT_GRAY16BE    \
         || (x)==PIX_FMT_GRAY16LE    \
     )
-#define isRGB(x)        (           \
+#define isRGBinInt(x)   (           \
            (x)==PIX_FMT_RGB48BE     \
         || (x)==PIX_FMT_RGB48LE     \
         || (x)==PIX_FMT_RGB32       \
@@ -399,7 +399,7 @@ const char *sws_format_name(enum PixelFo
         || (x)==PIX_FMT_MONOBLACK   \
         || (x)==PIX_FMT_MONOWHITE   \
     )
-#define isBGR(x)        (           \
+#define isBGRinInt(x)   (           \
            (x)==PIX_FMT_BGR32       \
         || (x)==PIX_FMT_BGR32_1     \
         || (x)==PIX_FMT_BGR24       \

Modified: trunk/libswscale/swscale_template.c
==============================================================================
--- trunk/libswscale/swscale_template.c	Mon Jan 25 23:46:09 2010	(r30432)
+++ trunk/libswscale/swscale_template.c	Tue Jan 26 08:40:14 2010	(r30433)
@@ -3048,7 +3048,7 @@ static void RENAME(sws_init_swScale)(Sws
         break;
     }
 
-    if (c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))) {
+    if (c->srcRange != c->dstRange && !(isRGBinInt(c->dstFormat) || isBGRinInt(c->dstFormat))) {
         if (c->srcRange) {
             c->lumConvertRange = RENAME(lumRangeFromJpeg);
             c->chrConvertRange = RENAME(chrRangeFromJpeg);

Modified: trunk/libswscale/utils.c
==============================================================================
--- trunk/libswscale/utils.c	Mon Jan 25 23:46:09 2010	(r30432)
+++ trunk/libswscale/utils.c	Tue Jan 26 08:40:14 2010	(r30433)
@@ -121,8 +121,8 @@ int sws_isSupportedInput(enum PixelForma
         || (x)==PIX_FMT_YUV444P     \
         || (x)==PIX_FMT_YUV422P     \
         || (x)==PIX_FMT_YUV411P     \
-        || isRGB(x)                 \
-        || isBGR(x)                 \
+        || isRGBinInt(x)                 \
+        || isBGRinInt(x)                 \
         || (x)==PIX_FMT_NV12        \
         || (x)==PIX_FMT_NV21        \
         || (x)==PIX_FMT_GRAY16BE    \
@@ -872,14 +872,14 @@ SwsContext *sws_getContext(int srcW, int
     getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
 
     // reuse chroma for 2 pixels RGB/BGR unless user wants full chroma interpolation
-    if ((isBGR(dstFormat) || isRGB(dstFormat)) && !(flags&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
+    if ((isBGRinInt(dstFormat) || isRGBinInt(dstFormat)) && !(flags&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
 
     // drop some chroma lines if the user wants it
     c->vChrDrop= (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;
     c->chrSrcVSubSample+= c->vChrDrop;
 
     // drop every other pixel for chroma calculation unless user wants full chroma
-    if ((isBGR(srcFormat) || isRGB(srcFormat)) && !(flags&SWS_FULL_CHR_H_INP)
+    if ((isBGRinInt(srcFormat) || isRGBinInt(srcFormat)) && !(flags&SWS_FULL_CHR_H_INP)
       && srcFormat!=PIX_FMT_RGB8      && srcFormat!=PIX_FMT_BGR8
       && srcFormat!=PIX_FMT_RGB4      && srcFormat!=PIX_FMT_BGR4
       && srcFormat!=PIX_FMT_RGB4_BYTE && srcFormat!=PIX_FMT_BGR4_BYTE
@@ -903,7 +903,7 @@ SwsContext *sws_getContext(int srcW, int
     sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], srcRange, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] /* FIXME*/, dstRange, 0, 1<<16, 1<<16);
 
     /* unscaled special cases */
-    if (unscaled && !usesHFilter && !usesVFilter && (srcRange == dstRange || isBGR(dstFormat) || isRGB(dstFormat))) {
+    if (unscaled && !usesHFilter && !usesVFilter && (srcRange == dstRange || isBGRinInt(dstFormat) || isRGBinInt(dstFormat))) {
         ff_get_unscaled_swscale(c);
 
         if (c->swScale) {



More information about the ffmpeg-cvslog mailing list