[FFmpeg-devel] [PATCH] lavfi: add perms and aperms filters.
Stefano Sabatini
stefasab at gmail.com
Thu Mar 14 22:58:35 CET 2013
On date Thursday 2013-03-14 22:06:15 +0100, Clément Bœsch encoded:
[...]
> Something was not working as expected with RO -> RW, patch updated.
> And extra bonus FATE patch. I'll push all of this in 3 days if I see no
> comments.
>
> --
> Clément B.
> From 0b49709256743328e9fb2dd483324a50934fce5f Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <ubitux at gmail.com>
> Date: Wed, 13 Mar 2013 05:59:20 +0100
> Subject: [PATCH 1/2] lavfi: add perms and aperms filters.
>
> TODO: bump micro
> TODO: Changelog
> ---
> doc/filters.texi | 37 ++++++++++
> libavfilter/Makefile | 2 +
> libavfilter/allfilters.c | 2 +
> libavfilter/f_perms.c | 186 +++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 227 insertions(+)
> create mode 100644 libavfilter/f_perms.c
[...]
> +static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> +{
> + int ret;
> + AVFilterContext *ctx = inlink->dst;
> + PermsContext *perms = ctx->priv;
> + AVFrame *out = frame;
> + enum perm in_perm = av_frame_is_writable(frame) ? RW : RO;
> + enum perm out_perm;
> +
> + switch (perms->mode) {
> + case MODE_TOGGLE: out_perm = in_perm == RO ? RW : RO; break;
> + case MODE_RANDOM: out_perm = av_lfg_get(&perms->lfg) & 1 ? RW : RO; break;
> + case MODE_RO: out_perm = RO; break;
> + case MODE_RW: out_perm = RW; break;
> + default: out_perm = in_perm; break;
> + }
> +
> + av_log(ctx, AV_LOG_VERBOSE, "%s -> %s%s\n",
> + perm_str[in_perm], perm_str[out_perm],
> + in_perm == out_perm ? " (no-op)" : "");
> +
> + if (in_perm == RO && out_perm == RW) {
> + if ((ret = av_frame_make_writable(frame)) < 0)
> + return ret;
> + } else if (in_perm == RW && out_perm == RO) {
> + out = av_frame_clone(frame);
> + if (!out)
> + return AVERROR(ENOMEM);
> + }
> +
> + ret = ff_filter_frame(ctx->outputs[0], out);
> +
> + if (in_perm == RW && out_perm == RO)
> + av_frame_free(&frame);
> + return ret;
So you were cloning and then removing the reference before passing the
frame along, too bad I missed it.
> +}
[...]
> From 01ba7a8149c5fe5a7358d23ed1ee9343d6e15487 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <ubitux at gmail.com>
> Date: Thu, 14 Mar 2013 21:59:42 +0100
> Subject: [PATCH 2/2] fate: test both direct and indirect paths in hqdn3d and
> gradfun.
>
> ---
> tests/fate/filter.mak | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tests/fate/filter.mak b/tests/fate/filter.mak
> index 139ba38..3b36bd1 100644
> --- a/tests/fate/filter.mak
> +++ b/tests/fate/filter.mak
> @@ -45,12 +45,12 @@ fate-filter-yadif-mode1: CMD = framecrc -flags bitexact -idct simple -i $(SAMPLE
> FATE_FILTER-$(CONFIG_YADIF_FILTER) += $(FATE_YADIF)
>
> FATE_HQDN3D += fate-filter-hqdn3d
> -fate-filter-hqdn3d: CMD = framecrc -idct simple -i $(SAMPLES)/smjpeg/scenwin.mjpg -vf hqdn3d -an
> -FATE_FILTER-$(call ALLYES, SMJPEG_DEMUXER MJPEG_DECODER HQDN3D_FILTER) += $(FATE_HQDN3D)
> +fate-filter-hqdn3d: CMD = framecrc -idct simple -i $(SAMPLES)/smjpeg/scenwin.mjpg -vf perms=random,hqdn3d -an
> +FATE_FILTER-$(call ALLYES, SMJPEG_DEMUXER MJPEG_DECODER PERMS_FILTER HQDN3D_FILTER) += $(FATE_HQDN3D)
>
> FATE_GRADFUN += fate-filter-gradfun
> -fate-filter-gradfun: CMD = framecrc -i $(SAMPLES)/vmd/12.vmd -vf "sws_flags=+accurate_rnd+bitexact;gradfun=10:8" -an -frames:v 20
> -FATE_FILTER-$(call ALLYES, VMD_DEMUXER VMDVIDEO_DECODER GRADFUN_FILTER) += $(FATE_GRADFUN)
> +fate-filter-gradfun: CMD = framecrc -i $(SAMPLES)/vmd/12.vmd -vf "sws_flags=+accurate_rnd+bitexact;format=gray,perms=random,gradfun=10:8" -an -frames:v 20
> +FATE_FILTER-$(call ALLYES, VMD_DEMUXER VMDVIDEO_DECODER FORMAT_FILTER PERMS_FILTER GRADFUN_FILTER) += $(FATE_GRADFUN)
That's an user case for which it would be useful to specify a fixed seed.
LGTM but I suggest to wait one day or something so more people can
have a look at it. Thanks.
--
FFmpeg = Free Fiendish Multimedia Perennial Empowered Gospel
More information about the ffmpeg-devel
mailing list