[FFmpeg-soc] [soc]: r911 - in libavfilter: avfilter.c avfilter.h avfiltergraph.c ffmpeg.diff vf_crop.c vf_fps.c vf_overlay.c vf_passthrough.c vf_rgb2bgr.c vf_slicify.c vf_vflip.c vsrc_dummy.c vsrc_ppm.c

koorogi subversion at mplayerhq.hu
Fri Aug 17 16:39:11 CEST 2007


Author: koorogi
Date: Fri Aug 17 16:39:11 2007
New Revision: 911

Log:
Remove the data parameter from draw_slice().  It's unneeded and often more
work than it's worth.


Modified:
   libavfilter/avfilter.c
   libavfilter/avfilter.h
   libavfilter/avfiltergraph.c
   libavfilter/ffmpeg.diff
   libavfilter/vf_crop.c
   libavfilter/vf_fps.c
   libavfilter/vf_overlay.c
   libavfilter/vf_passthrough.c
   libavfilter/vf_rgb2bgr.c
   libavfilter/vf_slicify.c
   libavfilter/vf_vflip.c
   libavfilter/vsrc_dummy.c
   libavfilter/vsrc_ppm.c

Modified: libavfilter/avfilter.c
==============================================================================
--- libavfilter/avfilter.c	(original)
+++ libavfilter/avfilter.c	Fri Aug 17 16:39:11 2007
@@ -179,12 +179,12 @@ void avfilter_end_frame(AVFilterLink *li
     end_frame(link);
 }
 
-void avfilter_draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int h)
+void avfilter_draw_slice(AVFilterLink *link, int y, int h)
 {
     if(!link->dst->input_pads[link->dstpad].draw_slice)
         return;
 
-    link->dst->input_pads[link->dstpad].draw_slice(link, data, y, h);
+    link->dst->input_pads[link->dstpad].draw_slice(link, y, h);
 }
 
 static int filter_cmp(const void *aa, const void *bb)

Modified: libavfilter/avfilter.h
==============================================================================
--- libavfilter/avfilter.h	(original)
+++ libavfilter/avfilter.h	Fri Aug 17 16:39:11 2007
@@ -161,7 +161,7 @@ struct AVFilterPad
      *
      * Input video pads only.
      */
-    void (*draw_slice)(AVFilterLink *link, uint8_t *data[4], int y, int height);
+    void (*draw_slice)(AVFilterLink *link, int y, int height);
 
     /**
      * Frame request callback.  A call to this should result in at least one
@@ -330,11 +330,10 @@ void avfilter_end_frame(AVFilterLink *li
 /**
  * Send a slice to the next filter
  * @param link The output link over which the frame is being sent
- * @param data Start of the picture data for this slice
  * @param y    Offset in pixels from the top of the image for this slice
  * @param h    Height of this slice in pixels
  */
-void avfilter_draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int h);
+void avfilter_draw_slice(AVFilterLink *link, int y, int h);
 
 /** Initialize the filter system.  Registers all builtin filters */
 void avfilter_init(void);

Modified: libavfilter/avfiltergraph.c
==============================================================================
--- libavfilter/avfiltergraph.c	(original)
+++ libavfilter/avfiltergraph.c	Fri Aug 17 16:39:11 2007
@@ -163,13 +163,12 @@ static AVFilterPicRef *link_out_get_vide
         return avfilter_get_video_buffer(link2, perms);
 }
 
-static void link_out_draw_slice(AVFilterLink *link, uint8_t *data[4], int y,
-                                int height)
+static void link_out_draw_slice(AVFilterLink *link, int y, int height)
 {
     AVFilterLink *link2 = get_extern_output_link(link);
 
     if(link2)
-        avfilter_draw_slice(link2, data, y, height);
+        avfilter_draw_slice(link2, y, height);
 }
 
 /** dummy filter used to help export filters pads outside the graph */
@@ -215,11 +214,11 @@ static AVFilterPicRef *graph_in_get_vide
     return NULL;
 }
 
-static void graph_in_draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int height)
+static void graph_in_draw_slice(AVFilterLink *link, int y, int height)
 {
     AVFilterLink *link2 = get_intern_input_link(link);
     if(link2)
-        avfilter_draw_slice(link2, data, y, height);
+        avfilter_draw_slice(link2, y, height);
 }
 
 static int *graph_in_query_formats(AVFilterLink *link)

Modified: libavfilter/ffmpeg.diff
==============================================================================
--- libavfilter/ffmpeg.diff	(original)
+++ libavfilter/ffmpeg.diff	Fri Aug 17 16:39:11 2007
@@ -286,7 +286,7 @@ Index: ffplay.c
 +
 +    picref->pts = pts;
 +    avfilter_start_frame(link, avfilter_ref_pic(picref, ~0));
-+    avfilter_draw_slice(link, picref->data, 0, picref->h);
++    avfilter_draw_slice(link, 0, picref->h);
 +    avfilter_end_frame(link);
 +    avfilter_unref_pic(picref);
 +

Modified: libavfilter/vf_crop.c
==============================================================================
--- libavfilter/vf_crop.c	(original)
+++ libavfilter/vf_crop.c	Fri Aug 17 16:39:11 2007
@@ -148,37 +148,24 @@ static void end_frame(AVFilterLink *link
     avfilter_end_frame(link->dst->outputs[0]);
 }
 
-static void draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int h)
+static void draw_slice(AVFilterLink *link, int y, int h)
 {
     AVFilterContext *ctx = link->dst;
-    AVFilterPicRef *pic = link->cur_pic;
     CropContext *crop = ctx->priv;
 
-    uint8_t *src[4];
     int top = y;
     int height = h;
-    int i;
 
     if(y >= crop->cy + crop->ch || y + h <= crop->cy) return;
 
-    memcpy(src, data, sizeof(uint8_t *) * 4);
-
     if(top < crop->cy) {
         height -=  crop->cy - top;
-        src[0] += (crop->cy - top) * pic->linesize[0];
-        for(i = 0; i < 4; i ++)
-            if(src[i])
-                src[i] += (crop->cy >> crop->vsub) * pic->linesize[i];
         top     =  crop->cy;
     }
     if(top + height > crop->cy + crop->ch)
         height = crop->cy + crop->ch - top;
-    src[0] += crop->cx * crop->bpp;
-    for(i = 0; i < 4; i ++)
-        if(src[i])
-            src[i] += crop->cx >> crop->hsub;
 
-    avfilter_draw_slice(ctx->outputs[0], src, top - crop->cy, height);
+    avfilter_draw_slice(ctx->outputs[0], top - crop->cy, height);
 }
 
 AVFilter vf_crop =

Modified: libavfilter/vf_fps.c
==============================================================================
--- libavfilter/vf_fps.c	(original)
+++ libavfilter/vf_fps.c	Fri Aug 17 16:39:11 2007
@@ -82,7 +82,7 @@ static void end_frame(AVFilterLink *link
 {
 }
 
-static void draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int h)
+static void draw_slice(AVFilterLink *link, int y, int h)
 {
 }
 
@@ -95,7 +95,7 @@ static int request_frame(AVFilterLink *l
             return -1;
 
     avfilter_start_frame(link, avfilter_ref_pic(fps->pic, ~AV_PERM_WRITE));
-    avfilter_draw_slice (link, fps->pic->data, 0, fps->pic->h);
+    avfilter_draw_slice (link, 0, fps->pic->h);
     avfilter_end_frame  (link);
 
     fps->pts += fps->timebase;

Modified: libavfilter/vf_overlay.c
==============================================================================
--- libavfilter/vf_overlay.c	(original)
+++ libavfilter/vf_overlay.c	Fri Aug 17 16:39:11 2007
@@ -133,7 +133,7 @@ static void end_frame(AVFilterLink *link
 {
 }
 
-static void draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int h)
+static void draw_slice(AVFilterLink *link, int y, int h)
 {
 }
 
@@ -208,7 +208,7 @@ static int request_frame(AVFilterLink *l
 
     /* and send it to the next filter */
     avfilter_start_frame(link, avfilter_ref_pic(pic, ~0));
-    avfilter_draw_slice (link, pic->data, 0, pic->h);
+    avfilter_draw_slice (link, 0, pic->h);
     avfilter_end_frame  (link);
     avfilter_unref_pic(pic);
 

Modified: libavfilter/vf_passthrough.c
==============================================================================
--- libavfilter/vf_passthrough.c	(original)
+++ libavfilter/vf_passthrough.c	Fri Aug 17 16:39:11 2007
@@ -53,9 +53,9 @@ static void end_frame(AVFilterLink *link
     avfilter_end_frame(link->dst->outputs[0]);
 }
 
-static void draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int h)
+static void draw_slice(AVFilterLink *link, int y, int h)
 {
-    avfilter_draw_slice(link->dst->outputs[0], data, y, h);
+    avfilter_draw_slice(link->dst->outputs[0], y, h);
 }
 
 AVFilter vf_passthrough =

Modified: libavfilter/vf_rgb2bgr.c
==============================================================================
--- libavfilter/vf_rgb2bgr.c	(original)
+++ libavfilter/vf_rgb2bgr.c	Fri Aug 17 16:39:11 2007
@@ -41,16 +41,15 @@ static int *query_out_formats(AVFilterLi
     return avfilter_make_format_list(1, format);
 }
 
-static void draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int h)
+static void draw_slice(AVFilterLink *link, int y, int h)
 {
+    AVFilterPicRef *curpic = link->cur_pic;
     AVFilterPicRef *outpic = link->dst->outputs[0]->outpic;
-    uint8_t *out[4];
     uint8_t *row[2], *cur[2];
     int i, j;
 
-    row[0] = data[0];
-    row[1] = out[0] = &outpic->data[0][y * outpic->linesize[0]];
-    out[1] = out[2] = out[3] = 0;
+    row[0] = &curpic->data[0][y * curpic->linesize[0]];
+    row[1] = &outpic->data[0][y * outpic->linesize[0]];
     for(i = 0; i < h; i ++) {
         cur[0] = row[0];
         cur[1] = row[1];
@@ -65,7 +64,7 @@ static void draw_slice(AVFilterLink *lin
         row[0] += link->cur_pic->linesize[0];
         row[1] += outpic->       linesize[0];
     }
-    avfilter_draw_slice(link->dst->outputs[0], out, y, h);
+    avfilter_draw_slice(link->dst->outputs[0], y, h);
 }
 
 AVFilter vf_rgb2bgr =

Modified: libavfilter/vf_slicify.c
==============================================================================
--- libavfilter/vf_slicify.c	(original)
+++ libavfilter/vf_slicify.c	Fri Aug 17 16:39:11 2007
@@ -72,25 +72,17 @@ static void end_frame(AVFilterLink *link
     avfilter_end_frame(link->dst->outputs[0]);
 }
 
-static void draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int h)
+static void draw_slice(AVFilterLink *link, int y, int h)
 {
     SliceContext *slice = link->dst->priv;
-    uint8_t *src[4];
     int y2, i;
 
-    memcpy(src, data, sizeof(src));
-
     for(y2 = y; y2 + slice->h <= y + h; y2 += slice->h) {
-        avfilter_draw_slice(link->dst->outputs[0], src, y2, slice->h);
-        src[0] += link->cur_pic->linesize[0] * slice->h;
-        src[3] += link->cur_pic->linesize[3] * slice->h;
-        /* TODO: make sure this works once other filters support YUV too */
-        for(i = 1; i < 3; i ++)
-            src[i] += link->cur_pic->linesize[i] * (slice->h >> slice->vshift);
+        avfilter_draw_slice(link->dst->outputs[0], y2, slice->h);
     }
 
     if(y2 < y + h)
-        avfilter_draw_slice(link->dst->outputs[0], src, y2, y + h - y2);
+        avfilter_draw_slice(link->dst->outputs[0], y2, y + h - y2);
 }
 
 AVFilter vf_slicify =

Modified: libavfilter/vf_vflip.c
==============================================================================
--- libavfilter/vf_vflip.c	(original)
+++ libavfilter/vf_vflip.c	Fri Aug 17 16:39:11 2007
@@ -85,23 +85,12 @@ static void end_frame(AVFilterLink *link
     avfilter_end_frame(link->dst->outputs[0]);
 }
 
-static void draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int h)
+static void draw_slice(AVFilterLink *link, int y, int h)
 {
     AVFilterContext *ctx = link->dst;
     AVFilterPicRef *pic = link->cur_pic;
-    FlipContext *flip = ctx->priv;
-
-    uint8_t *src[4];
-    int i;
-
-    memcpy(src, data, sizeof(src));
 
-    src[0] += (y+h-1) * pic->linesize[0];
-    for(i = 0; i < 4; i ++)
-        if(src[i])
-            src[i] += (((y+h) >> flip->vsub)-1) * pic->linesize[i];
-
-    avfilter_draw_slice(ctx->outputs[0], src, pic->h - (y+h), h);
+    avfilter_draw_slice(ctx->outputs[0], pic->h - (y+h), h);
 }
 
 AVFilter vf_vflip =

Modified: libavfilter/vsrc_dummy.c
==============================================================================
--- libavfilter/vsrc_dummy.c	(original)
+++ libavfilter/vsrc_dummy.c	Fri Aug 17 16:39:11 2007
@@ -68,7 +68,7 @@ static int request_frame(AVFilterLink *l
         row += pic->linesize[0];
     }
 
-    avfilter_draw_slice(link, pic->data, 0, pic->h);
+    avfilter_draw_slice(link, 0, pic->h);
 
     avfilter_end_frame(link);
     avfilter_unref_pic(pic);

Modified: libavfilter/vsrc_ppm.c
==============================================================================
--- libavfilter/vsrc_ppm.c	(original)
+++ libavfilter/vsrc_ppm.c	Fri Aug 17 16:39:11 2007
@@ -89,7 +89,7 @@ static int request_frame(AVFilterLink *l
 
     out = avfilter_ref_pic(ppm->pic, ~AV_PERM_WRITE);
     avfilter_start_frame(link, out);
-    avfilter_draw_slice(link, out->data, 0, out->h);
+    avfilter_draw_slice(link, 0, out->h);
     avfilter_end_frame(link);
 
     return 0;



More information about the FFmpeg-soc mailing list