]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/imgconvert_template.h
add pointer to the parent context for use with av_log()
[ffmpeg] / libavcodec / imgconvert_template.h
index 07dbb654dc79b8429577c169cb4c3b12135aee93..b5f5cbe77a5e931ca33504324cd848f1cd4729cd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Templates for image convertion routines
+ * templates for image conversion routines
  * Copyright (c) 2001, 2002, 2003 Fabrice Bellard.
  *
  * This file is part of FFmpeg.
@@ -410,16 +410,20 @@ static void glue(pal8_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src,
     }
 }
 
-#if !defined(FMT_RGBA32) && defined(RGBA_OUT)
+// RGB24 has optimised routines
+#if !defined(FMT_RGB32) && !defined(FMT_RGB24)
 /* alpha support */
 
-static void glue(rgba32_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src,
+static void glue(rgb32_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src,
                                       int width, int height)
 {
     const uint8_t *s;
     uint8_t *d;
     int src_wrap, dst_wrap, j, y;
-    unsigned int v, r, g, b, a;
+    unsigned int v, r, g, b;
+#ifdef RGBA_OUT
+    unsigned int a;
+#endif
 
     s = src->data[0];
     src_wrap = src->linesize[0] - width * 4;
@@ -430,11 +434,15 @@ static void glue(rgba32_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src,
     for(y=0;y<height;y++) {
         for(j = 0;j < width; j++) {
             v = ((const uint32_t *)(s))[0];
-            a = (v >> 24) & 0xff;
             r = (v >> 16) & 0xff;
             g = (v >> 8) & 0xff;
             b = v & 0xff;
+#ifdef RGBA_OUT
+            a = (v >> 24) & 0xff;
             RGBA_OUT(d, r, g, b, a);
+#else
+            RGB_OUT(d, r, g, b);
+#endif
             s += 4;
             d += BPP;
         }
@@ -443,13 +451,16 @@ static void glue(rgba32_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src,
     }
 }
 
-static void glue(RGB_NAME, _to_rgba32)(AVPicture *dst, const AVPicture *src,
+static void glue(RGB_NAME, _to_rgb32)(AVPicture *dst, const AVPicture *src,
                                        int width, int height)
 {
     const uint8_t *s;
     uint8_t *d;
     int src_wrap, dst_wrap, j, y;
-    unsigned int r, g, b, a;
+    unsigned int r, g, b;
+#ifdef RGBA_IN
+    unsigned int a;
+#endif
 
     s = src->data[0];
     src_wrap = src->linesize[0] - width * BPP;
@@ -459,8 +470,13 @@ static void glue(RGB_NAME, _to_rgba32)(AVPicture *dst, const AVPicture *src,
 
     for(y=0;y<height;y++) {
         for(j = 0;j < width; j++) {
+#ifdef RGBA_IN
             RGBA_IN(r, g, b, a, s);
             ((uint32_t *)(d))[0] = (a << 24) | (r << 16) | (g << 8) | b;
+#else
+            RGB_IN(r, g, b, s);
+            ((uint32_t *)(d))[0] = (0xff << 24) | (r << 16) | (g << 8) | b;
+#endif
             d += 4;
             s += BPP;
         }
@@ -469,7 +485,7 @@ static void glue(RGB_NAME, _to_rgba32)(AVPicture *dst, const AVPicture *src,
     }
 }
 
-#endif /* !defined(FMT_RGBA32) && defined(RGBA_IN) */
+#endif /* !defined(FMT_RGB32) */
 
 #ifndef FMT_RGB24
 
@@ -772,7 +788,7 @@ static void rgb24_to_yuvj444p(AVPicture *dst, const AVPicture *src,
 
 #endif /* FMT_RGB24 */
 
-#if defined(FMT_RGB24) || defined(FMT_RGBA32)
+#if defined(FMT_RGB24) || defined(FMT_RGB32)
 
 static void glue(RGB_NAME, _to_pal8)(AVPicture *dst, const AVPicture *src,
                                      int width, int height)
@@ -818,7 +834,7 @@ static void glue(RGB_NAME, _to_pal8)(AVPicture *dst, const AVPicture *src,
     build_rgb_palette(dst->data[1], has_alpha);
 }
 
-#endif /* defined(FMT_RGB24) || defined(FMT_RGBA32) */
+#endif /* defined(FMT_RGB24) || defined(FMT_RGB32) */
 
 #ifdef RGBA_IN
 
@@ -856,4 +872,4 @@ static int glue(get_alpha_info_, RGB_NAME)(const AVPicture *src,
 #undef BPP
 #undef RGB_NAME
 #undef FMT_RGB24
-#undef FMT_RGBA32
+#undef FMT_RGB32