[FFmpeg-soc] [soc]: r926 - in libavfilter: avfilter.c avfilter.h defaults.c ffmpeg.diff vf_crop.c vf_fps.c vf_overlay.c vf_passthrough.c vf_slicify.c vf_vflip.c vsrc_dummy.c vsrc_ppm.c
koorogi
subversion at mplayerhq.hu
Sat Aug 18 00:44:03 CEST 2007
Author: koorogi
Date: Sat Aug 18 00:44:03 2007
New Revision: 926
Log:
Revert braindead linked list of permissions
Modified:
libavfilter/avfilter.c
libavfilter/avfilter.h
libavfilter/defaults.c
libavfilter/ffmpeg.diff
libavfilter/vf_crop.c
libavfilter/vf_fps.c
libavfilter/vf_overlay.c
libavfilter/vf_passthrough.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 Sat Aug 18 00:44:03 2007
@@ -35,67 +35,19 @@ static AVFilter **filters = NULL;
#define link_dpad(link) link->dst-> input_pads[link->dstpad]
#define link_spad(link) link->src->output_pads[link->srcpad]
-/**
- * helper function to get a pointer to the structure telling the permissions
- * the filter has on the given picture, or to create the structure if it
- * does not yet exist.
- */
-static AVFilterPicPerms *get_perms(AVFilterPic *pic, AVFilterContext *filter)
-{
- AVFilterPicPerms *ret;
-
- for(ret = pic->perms; ret; ret = ret->next)
- if(ret->filter == filter)
- return ret;
-
- ret = av_malloc(sizeof(AVFilterPicPerms));
- ret->filter = filter;
- ret->perms = 0;
- ret->next = pic->perms;
- pic->perms = ret;
-
- return ret;
-}
-
-int avfilter_get_pic_perms(AVFilterPicRef *pic, AVFilterContext *filter)
-{
- return get_perms(pic->pic, filter)->perms;
-}
-
-void avfilter_add_pic_perms(AVFilterPicRef *pic, AVFilterContext *filter,
- int perms)
-{
- get_perms(pic->pic, filter)->perms |= perms;
-}
-
-AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, AVFilterContext *filter,
- int pmask)
+AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, int pmask)
{
- AVFilterPicPerms *pic_perms;
AVFilterPicRef *ret = av_malloc(sizeof(AVFilterPicRef));
memcpy(ret, ref, sizeof(AVFilterPicRef));
ret->perms &= pmask;
ret->pic->refcount ++;
-
- if(filter) {
- pic_perms = get_perms(ref->pic, filter);
- pic_perms->perms |= ret->perms;
- }
-
return ret;
}
void avfilter_unref_pic(AVFilterPicRef *ref)
{
- AVFilterPicPerms *perms;
-
- if(-- ref->pic->refcount == 0) {
- for(; ref->pic->perms; ref->pic->perms = perms) {
- perms = ref->pic->perms->next;
- av_free(ref->pic->perms);
- }
+ if(-- ref->pic->refcount == 0)
ref->pic->free(ref->pic);
- }
av_free(ref);
}
@@ -208,7 +160,6 @@ int avfilter_request_frame(AVFilterLink
* forcing the source filter to do it? */
void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
{
- int perms = get_perms(picref->pic, link->dst)->perms;
void (*start_frame)(AVFilterLink *, AVFilterPicRef *);
start_frame = link_dpad(link).start_frame;
@@ -216,11 +167,11 @@ void avfilter_start_frame(AVFilterLink *
start_frame = avfilter_default_start_frame;
/* prepare to copy the picture if it has insufficient permissions */
- if((link_dpad(link).min_perms & perms) != link_dpad(link).min_perms ||
- link_dpad(link).rej_perms & perms) {
+ if((link_dpad(link).min_perms & picref->perms) != link_dpad(link).min_perms ||
+ link_dpad(link).rej_perms & picref->perms) {
av_log(link->dst, AV_LOG_INFO,
"frame copy needed (have perms %x, need %x, reject %x)\n",
- perms,
+ picref->perms,
link_dpad(link).min_perms, link_dpad(link).rej_perms);
link->cur_pic = avfilter_default_get_video_buffer(link, link_dpad(link).min_perms);
Modified: libavfilter/avfilter.h
==============================================================================
--- libavfilter/avfilter.h (original)
+++ libavfilter/avfilter.h Sat Aug 18 00:44:03 2007
@@ -29,29 +29,6 @@ typedef struct AVFilterContext AVFilterC
typedef struct AVFilterLink AVFilterLink;
typedef struct AVFilterPad AVFilterPad;
-/**
- * A linked list of filters which reference this picture and the permissions
- * they each have. This is needed for the case that filter A requests a buffer
- * from filter B. Filter B gives it a buffer to use with the permissions it
- * requested, while reserving more permissions for itself to use when filter A
- * eventually passes the buffer to filter B. However, filter A does not know
- * what these permissions are to reinsert them in the reference passed to B,
- * filter B can't assume that any picture it is passed is one that it allocated.
- *
- * Rather than have each filter implement their own code to check for this
- * case, we store all the permissions here in the picture structure.
- *
- * Because the number of filters holding references to any one picture should
- * be rather low, this should not be a major source of performance problems.
- */
-typedef struct AVFilterPicPerms
-{
- AVFilterContext *filter; ///< the filter
- int perms; ///< the permissions that filter has
-
- struct AVFilterPicPerms *next;
-} AVFilterPicPerms;
-
/* TODO: look for other flags which may be useful in this structure (interlace
* flags, etc)
*/
@@ -67,7 +44,6 @@ typedef struct AVFilterPic
enum PixelFormat format; ///< colorspace
unsigned refcount; ///< number of references to this image
- AVFilterPicPerms *perms; ///< list of permissions held by filters
/** private data to be used by a custom free function */
void *priv;
@@ -105,25 +81,15 @@ typedef struct AVFilterPicRef
#define AV_PERM_REUSE 0x08 ///< can output the buffer multiple times
} AVFilterPicRef;
-/** Get the permissions the filter has to access the picture. */
-int avfilter_get_pic_perms(AVFilterPicRef *pic, AVFilterContext *filter);
-
-/** Give the filter more permissions to access the picture */
-void avfilter_add_pic_perms(AVFilterPicRef *pic, AVFilterContext *filter,
- int perms);
-
/**
* Add a new reference to a picture.
* @param ref An existing reference to the picture
- * @param ref If non-NULL, a pointer to the filter to which the permissions
- * to the picture are to be given
* @param pmask A bitmask containing the allowable permissions in the new
* reference
* @return A new reference to the picture with the same properties as the
* old, excluding any permissions denied by pmask
*/
-AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, AVFilterContext *filter,
- int pmask);
+AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, int pmask);
/**
* Remove a reference to a picture. If this is the last reference to the
@@ -256,8 +222,6 @@ int *avfilter_default_query_output_forma
AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link,
int perms);
-/** handler for get_video_buffer() which forwards the request down the chain */
-AVFilterPicRef *avfilter_next_get_video_buffer(AVFilterLink *link, int perms);
/**
* Filter definition. This defines the pads a filter contains, and all the
* callback functions used to interact with the filter.
Modified: libavfilter/defaults.c
==============================================================================
--- libavfilter/defaults.c (original)
+++ libavfilter/defaults.c Sat Aug 18 00:44:03 2007
@@ -28,13 +28,6 @@ void avfilter_default_free_video_buffer(
av_free(pic);
}
-AVFilterPicRef *avfilter_next_get_video_buffer(AVFilterLink *link, int perms)
-{
- if(!link->dst->outputs[0])
- return NULL;
- return avfilter_get_video_buffer(link->dst->outputs[0], perms);
-}
-
/* TODO: set the buffer's priv member to a context structure for the whole
* filter chain. This will allow for a buffer pool instead of the constant
* alloc & free cycle currently implemented. */
@@ -48,9 +41,6 @@ AVFilterPicRef *avfilter_default_get_vid
ref->h = link->h;
ref->perms = perms;
- /* we always give the destination filter read access by default */
- avfilter_add_pic_perms(ref, link->dst, AV_PERM_READ);
-
pic->refcount = 1;
pic->format = link->format;
pic->free = avfilter_default_free_video_buffer;
@@ -72,7 +62,7 @@ void avfilter_default_start_frame(AVFilt
if(out) {
out->outpic = avfilter_get_video_buffer(out, AV_PERM_WRITE);
out->outpic->pts = picref->pts;
- avfilter_start_frame(out, avfilter_ref_pic(out->outpic, out->dst, ~0));
+ avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
}
}
Modified: libavfilter/ffmpeg.diff
==============================================================================
--- libavfilter/ffmpeg.diff (original)
+++ libavfilter/ffmpeg.diff Sat Aug 18 00:44:03 2007
@@ -208,7 +208,7 @@ Index: ffplay.c
if(pkt->data == flush_pkt.data){
avcodec_flush_buffers(is->video_st->codec);
continue;
-@@ -1361,31 +1396,217 @@
+@@ -1361,31 +1396,216 @@
/* NOTE: ipts is the PTS of the _first_ picture beginning in
this packet, if any */
global_video_pkt_pts= pkt->pts;
@@ -285,7 +285,7 @@ Index: ffplay.c
+ picref->pic->format, picref->w, picref->h);
+
+ picref->pts = pts;
-+ avfilter_start_frame(link, avfilter_ref_pic(picref, link->dst, ~0));
++ avfilter_start_frame(link, avfilter_ref_pic(picref, ~0));
+ avfilter_draw_slice(link, 0, picref->h);
+ avfilter_end_frame(link);
+ avfilter_unref_pic(picref);
@@ -368,8 +368,7 @@ Index: ffplay.c
+ .inputs = (AVFilterPad[]) {{ .name = "default",
+ .type = AV_PAD_VIDEO,
+ .end_frame = output_end_frame,
-+ .query_formats = output_query_formats,
-+ .min_perms = AV_PERM_READ, },
++ .query_formats = output_query_formats, },
+ { .name = NULL }},
+ .outputs = (AVFilterPad[]) {{ .name = NULL }},
+};
@@ -438,7 +437,7 @@ Index: ffplay.c
av_free(frame);
return 0;
}
-@@ -2136,6 +2357,12 @@
+@@ -2136,6 +2356,12 @@
/* free all pictures */
for(i=0;i<VIDEO_PICTURE_QUEUE_SIZE; i++) {
vp = &is->pictq[i];
@@ -451,7 +450,7 @@ Index: ffplay.c
if (vp->bmp) {
SDL_FreeYUVOverlay(vp->bmp);
vp->bmp = NULL;
-@@ -2488,6 +2715,9 @@
+@@ -2488,6 +2714,9 @@
#endif
{ "sync", HAS_ARG | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
{ "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
Modified: libavfilter/vf_crop.c
==============================================================================
--- libavfilter/vf_crop.c (original)
+++ libavfilter/vf_crop.c Sat Aug 18 00:44:03 2007
@@ -122,9 +122,7 @@ static int config_output(AVFilterLink *l
static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
{
CropContext *crop = link->dst->priv;
- AVFilterPicRef *ref2 = avfilter_ref_pic(picref,
- link->dst->outputs[0]->dst,
- ~0);
+ AVFilterPicRef *ref2 = avfilter_ref_pic(picref, ~0);
int i;
ref2->w = crop->cw;
@@ -174,8 +172,7 @@ AVFilter vf_crop =
.start_frame = start_frame,
.draw_slice = draw_slice,
.query_formats = query_in_formats,
- .config_props = config_input,
- .get_video_buffer= avfilter_next_get_video_buffer, },
+ .config_props = config_input, },
{ .name = NULL}},
.outputs = (AVFilterPad[]) {{ .name = "default",
.type = AV_PAD_VIDEO,
Modified: libavfilter/vf_fps.c
==============================================================================
--- libavfilter/vf_fps.c (original)
+++ libavfilter/vf_fps.c Sat Aug 18 00:44:03 2007
@@ -94,9 +94,7 @@ static int request_frame(AVFilterLink *l
if(avfilter_request_frame(link->src->inputs[0]))
return -1;
- avfilter_start_frame(link, avfilter_ref_pic(fps->pic,
- link->dst->outputs[0]->dst,
- ~AV_PERM_WRITE));
+ avfilter_start_frame(link, avfilter_ref_pic(fps->pic, ~AV_PERM_WRITE));
avfilter_draw_slice (link, 0, fps->pic->h);
avfilter_end_frame (link);
@@ -120,8 +118,7 @@ AVFilter vf_fps =
.start_frame = start_frame,
.draw_slice = draw_slice,
.query_formats = query_formats,
- .end_frame = end_frame,
- .get_video_buffer= avfilter_next_get_video_buffer, },
+ .end_frame = end_frame, },
{ .name = NULL}},
.outputs = (AVFilterPad[]) {{ .name = "default",
.type = AV_PAD_VIDEO,
Modified: libavfilter/vf_overlay.c
==============================================================================
--- libavfilter/vf_overlay.c (original)
+++ libavfilter/vf_overlay.c Sat Aug 18 00:44:03 2007
@@ -207,9 +207,7 @@ static int request_frame(AVFilterLink *l
pic->pts = over->pics[!lower_timestamp(over)][0]->pts;
/* and send it to the next filter */
- avfilter_start_frame(link, avfilter_ref_pic(pic,
- link->dst->outputs[0]->dst,
- ~0));
+ avfilter_start_frame(link, avfilter_ref_pic(pic, ~0));
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 Sat Aug 18 00:44:03 2007
@@ -68,8 +68,7 @@ AVFilter vf_passthrough =
.start_frame = start_frame,
.draw_slice = draw_slice,
.query_formats = query_formats,
- .end_frame = end_frame,
- .get_video_buffer= avfilter_next_get_video_buffer, },
+ .end_frame = end_frame, },
{ .name = NULL}},
.outputs = (AVFilterPad[]) {{ .name = "default",
.type = AV_PAD_VIDEO },
Modified: libavfilter/vf_slicify.c
==============================================================================
--- libavfilter/vf_slicify.c (original)
+++ libavfilter/vf_slicify.c Sat Aug 18 00:44:03 2007
@@ -62,12 +62,8 @@ static int config_props(AVFilterLink *li
static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
{
- AVFilterPicRef *ref2 = avfilter_ref_pic(picref,
- link->dst->outputs[0]->dst,
- ~0);
-
avfilter_default_start_frame(link, picref);
- avfilter_start_frame(link->dst->outputs[0], ref2);
+ avfilter_start_frame(link->dst->outputs[0], avfilter_ref_pic(picref, ~0));
}
static void end_frame(AVFilterLink *link)
@@ -102,8 +98,7 @@ AVFilter vf_slicify =
.draw_slice = draw_slice,
.query_formats = query_formats,
.config_props = config_props,
- .end_frame = end_frame,
- .get_video_buffer= avfilter_next_get_video_buffer, },
+ .end_frame = end_frame, },
{ .name = NULL}},
.outputs = (AVFilterPad[]) {{ .name = "default",
.type = AV_PAD_VIDEO, },
Modified: libavfilter/vf_vflip.c
==============================================================================
--- libavfilter/vf_vflip.c (original)
+++ libavfilter/vf_vflip.c Sat Aug 18 00:44:03 2007
@@ -61,9 +61,7 @@ static int config_input(AVFilterLink *li
static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
{
FlipContext *flip = link->dst->priv;
- AVFilterPicRef *ref2 = avfilter_ref_pic(picref,
- link->dst->outputs[0]->dst,
- ~0);
+ AVFilterPicRef *ref2 = avfilter_ref_pic(picref, ~0);
int i;
ref2->data[0] += (ref2->h-1) * ref2->linesize[0];
@@ -97,8 +95,7 @@ AVFilter vf_vflip =
.start_frame = start_frame,
.draw_slice = draw_slice,
.query_formats = query_in_formats,
- .config_props = config_input,
- .get_video_buffer= avfilter_next_get_video_buffer, },
+ .config_props = config_input, },
{ .name = NULL}},
.outputs = (AVFilterPad[]) {{ .name = "default",
.type = AV_PAD_VIDEO, },
Modified: libavfilter/vsrc_dummy.c
==============================================================================
--- libavfilter/vsrc_dummy.c (original)
+++ libavfilter/vsrc_dummy.c Sat Aug 18 00:44:03 2007
@@ -55,9 +55,7 @@ static int request_frame(AVFilterLink *l
pic = avfilter_get_video_buffer(link, AV_PERM_WRITE);
pic->pts =
ctx->pts += 30;
- avfilter_start_frame(link, avfilter_ref_pic(pic,
- link->dst->outputs[0]->dst,
- ~0));
+ avfilter_start_frame(link, avfilter_ref_pic(pic, ~0));
row = pic->data[0];
for(y = 0; y < pic->h; y ++) {
Modified: libavfilter/vsrc_ppm.c
==============================================================================
--- libavfilter/vsrc_ppm.c (original)
+++ libavfilter/vsrc_ppm.c Sat Aug 18 00:44:03 2007
@@ -87,8 +87,7 @@ static int request_frame(AVFilterLink *l
ppm->in = NULL;
} else ppm->pic->pts += 30;
- out = avfilter_ref_pic(ppm->pic, link->dst->outputs[0]->dst,
- ~AV_PERM_WRITE);
+ out = avfilter_ref_pic(ppm->pic, ~AV_PERM_WRITE);
avfilter_start_frame(link, out);
avfilter_draw_slice(link, 0, out->h);
avfilter_end_frame(link);
More information about the FFmpeg-soc
mailing list