[FFmpeg-soc] [soc]: r4735 - libavfilter/vf_negate.c

stefano subversion at mplayerhq.hu
Tue Jul 21 01:40:05 CEST 2009


Author: stefano
Date: Tue Jul 21 01:40:05 2009
New Revision: 4735

Log:
Add support for PIX_FMT_MONOWHITE and PIX_FMT_MONOBLACK.

Modified:
   libavfilter/vf_negate.c

Modified: libavfilter/vf_negate.c
==============================================================================
--- libavfilter/vf_negate.c	Mon Jul 20 15:33:15 2009	(r4734)
+++ libavfilter/vf_negate.c	Tue Jul 21 01:40:05 2009	(r4735)
@@ -30,11 +30,13 @@ typedef struct
 static int query_formats(AVFilterContext *ctx)
 {
     avfilter_set_common_formats(ctx,
-        avfilter_make_format_list(10,
+        avfilter_make_format_list(12,
                 PIX_FMT_YUV444P,  PIX_FMT_YUV422P,  PIX_FMT_YUV420P,
                 PIX_FMT_YUV411P,  PIX_FMT_YUV410P,
                 PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P,
-                PIX_FMT_YUV440P,  PIX_FMT_YUVJ440P));
+                PIX_FMT_YUV440P,  PIX_FMT_YUVJ440P,
+                PIX_FMT_MONOWHITE, PIX_FMT_MONOBLACK));
+
     return 0;
 }
 
@@ -68,6 +70,16 @@ static void draw_slice(AVFilterLink *lin
     uint8_t *inrow, *outrow;
     int i, j, plane;
 
+    if (link->format == PIX_FMT_MONOWHITE || link->format == PIX_FMT_MONOBLACK) {
+        inrow  = in ->data[0] + y * in ->linesize[0];
+        outrow = out->data[0] + y * out->linesize[0];
+        for (i = 0; i < h; i++) {
+            for (j = 0; j < link->w >> 3; j++)
+                outrow[j] = ~inrow[j];
+            inrow  += in-> linesize[0];
+            outrow += out->linesize[0];
+        }
+    } else {
     /* luma plane */
     inrow  = in-> data[0] + y * in-> linesize[0];
     outrow = out->data[0] + y * out->linesize[0];
@@ -90,6 +102,7 @@ static void draw_slice(AVFilterLink *lin
             outrow += out->linesize[plane];
         }
     }
+    }
 
     avfilter_draw_slice(link->dst->outputs[0], y, h);
 }


More information about the FFmpeg-soc mailing list