[FFmpeg-devel] [PATCH] Add debug facilities for avfilter.c
Michael Niedermayer
michaelni
Mon Oct 5 00:32:40 CEST 2009
On Sun, Oct 04, 2009 at 06:40:12PM +0200, Stefano Sabatini wrote:
> Hi all,
>
> these trace messages can be a real pain-saver when debugging complex
> filterchains, while I believe they don't clutter the code so much.
>
> The result in the output is something like:
> avfilter_request_frame(): link[0x8f8f410 w:564 h:348 src:vflip dst:ffplay_output]: requesting frame
> avfilter_request_frame(): link[0x8f8f350 w:564 h:348 src:hflip dst:vflip]: requesting frame
> avfilter_request_frame(): link[0x8f8f070 w:564 h:348 src:pad dst:hflip]: requesting frame
> avfilter_request_frame(): link[0x8f8ede0 w:464 h:348 src:ffplay_input dst:pad]: requesting frame
> avfilter_get_video_buffer(): link[0x8f8ede0 w:464 h:348 src:ffplay_input dst:pad]: getting picref [w:464 h:348]
> avfilter_get_video_buffer(): link[0x8f8f070 w:564 h:348 src:pad dst:hflip]: getting picref [w:564 h:348]
> avfilter_get_video_buffer(): link[0x8f8f350 w:564 h:348 src:hflip dst:vflip]: getting picref [w:564 h:348]
> avfilter_get_video_buffer(): link[0x8f8f410 w:564 h:348 src:vflip dst:ffplay_output]: getting picref [w:564 h:348]
> avfilter_get_video_buffer(): link[0x8f8f410 w:564 h:348 src:vflip dst:ffplay_output]: returning picref: picref[data[0x97d16f0, 0x98025f0, 0x980e9b0, (nil)] linesize[576, 288, 288, 0] pts:0 564x348]
> avfilter_get_video_buffer(): link[0x8f8f350 w:564 h:348 src:hflip dst:vflip]: returning picref: picref[data[0x98023b0, 0x980e890, 0x981ac50, (nil)] linesize[-576, -288, -288, 0] pts:0 564x348]
> avfilter_get_video_buffer(): link[0x8f8f070 w:564 h:348 src:pad dst:hflip]: returning picref: picref[data[0x98023b0, 0x980e890, 0x981ac50, (nil)] linesize[-576, -288, -288, 0] pts:0 564x348]
> avfilter_get_video_buffer(): link[0x8f8ede0 w:464 h:348 src:ffplay_input dst:pad]: returning picref: picref[data[0x98023b0, 0x980e890, 0x981ac50, (nil)] linesize[-576, -288, -288, 0] pts:0 564x348]
> avfilter_start_frame(): link[0x8f8ede0 w:464 h:348 src:ffplay_input dst:pad]: starting frame picref[data[0x98023b0, 0x980e890, 0x981ac50, (nil)] linesize[-576, -288, -288, 0] pts:800000 564x348]
> avfilter_start_frame(): link[0x8f8f070 w:564 h:348 src:pad dst:hflip]: starting frame picref[data[0x98023b0, 0x980e890, 0x981ac50, (nil)] linesize[-576, -288, -288, 0] pts:800000 564x348]
> avfilter_get_video_buffer(): link[0x8f8f350 w:564 h:348 src:hflip dst:vflip]: getting picref [w:564 h:348]
> avfilter_get_video_buffer(): link[0x8f8f410 w:564 h:348 src:vflip dst:ffplay_output]: getting picref [w:564 h:348]
> avfilter_get_video_buffer(): link[0x8f8f410 w:564 h:348 src:vflip dst:ffplay_output]: returning picref: picref[data[0x9864450, 0x9895350, 0x98a1710, (nil)] linesize[576, 288, 288, 0] pts:0 564x348]
> avfilter_get_video_buffer(): link[0x8f8f350 w:564 h:348 src:hflip dst:vflip]: returning picref: picref[data[0x9895110, 0x98a15f0, 0x98ad9b0, (nil)] linesize[-576, -288, -288, 0] pts:0 564x348]
> avfilter_start_frame(): link[0x8f8f350 w:564 h:348 src:hflip dst:vflip]: starting frame picref[data[0x9895110, 0x98a15f0, 0x98ad9b0, (nil)] linesize[-576, -288, -288, 0] pts:800000 564x348]
> avfilter_start_frame(): link[0x8f8f410 w:564 h:348 src:vflip dst:ffplay_output]: starting frame picref[data[0x9864450, 0x9895350, 0x98a1710, (nil)] linesize[576, 288, 288, 0] pts:800000 564x348]
> avfilter_draw_slice(): link[0x8f8ede0 w:464 h:348 src:ffplay_input dst:pad]: drawing slice y:0 h:348
> avfilter_draw_slice(): link[0x8f8f070 w:564 h:348 src:pad dst:hflip]: drawing slice y:0 h:348
> avfilter_draw_slice(): link[0x8f8f350 w:564 h:348 src:hflip dst:vflip]: drawing slice y:0 h:348
> avfilter_draw_slice(): link[0x8f8f410 w:564 h:348 src:vflip dst:ffplay_output]: drawing slice y:0 h:348
"avfilter_" unneeded, so is ()
w:X h:Y -> s:XxY
src:vflip dst:ffplay_output -> vflip->ffplay_output
and the stuf above would be more readable if you could do something about
variable size fields so that things are vertically aligned
>
> By default they are completely disabled, to enable them is sufficient to
> de-comment the DEBUG symbol definition.
>
> Regards.
> --
> FFmpeg = Funny and Fast Merciful Picky Enhancing Gospel
> avfilter.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 47 insertions(+)
> 16de016cde39d4efe4f8e30d00314ca8d7afa5da debug-system.patch
> Index: ffmpeg-vfilters/ffmpeg/libavfilter/avfilter.c
> ===================================================================
> --- ffmpeg-vfilters.orig/ffmpeg/libavfilter/avfilter.c 2009-10-04 17:47:08.000000000 +0200
> +++ ffmpeg-vfilters/ffmpeg/libavfilter/avfilter.c 2009-10-04 18:30:15.000000000 +0200
> @@ -22,6 +22,8 @@
> #include "libavcodec/imgconvert.h"
> #include "avfilter.h"
>
> +/* #define DEBUG */
> +
> unsigned avfilter_version(void) {
> return LIBAVFILTER_VERSION_INT;
> }
> @@ -160,10 +162,29 @@
> return 0;
> }
>
> +#define DPRINT_PICREF(dst, dst_size, picref) snprintf(dst, dst_size, \
> + "picref[data[%p, %p, %p, %p] linesize[%d, %d, %d, %d] pts:%"PRId64" %dx%d]", \
> + picref->data[0], picref->data[1], picref->data[2], picref->data[3], \
> + picref->linesize[0], picref->linesize[1], picref->linesize[2], picref->linesize[3], \
> + picref->pts, picref->w, picref->h)
> +
> +#define DPRINT_LINK(dst_, dst_size_, link_) snprintf(dst_, dst_size_, \
> + "link[%p w:%d h:%d src:%s dst:%s]", link_, link_->w, link_->h, \
> + link_->src ? link_->src->filter->name : "", \
> + link_->dst ? link_->dst->filter->name : "")
> +
these could be functions
> AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
> {
> AVFilterPicRef *ret = NULL;
>
> +#ifdef DEBUG
> + char picref_buf[256], link_buf[256];
> +
> + DPRINT_LINK(link_buf, sizeof(link_buf), link);
> + av_log(NULL, AV_LOG_DEBUG, "%s(): %s: getting picref [w:%d h:%d]\n",
> + __func__, link_buf, w, h);
> +#endif
the buffers and snprintf() are useless, a single av_log call is enough
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I wish the Xiph folks would stop pretending they've got something they
do not. Somehow I fear this will remain a wish. -- M?ns Rullg?rd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091005/e85a893a/attachment.pgp>
More information about the ffmpeg-devel
mailing list