From patchwork Sat Nov 2 16:29:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 16083 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id EFA8C4498FB for ; Sat, 2 Nov 2019 18:29:37 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CE95568AFAE; Sat, 2 Nov 2019 18:29:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1F2FC68AFAE for ; Sat, 2 Nov 2019 18:29:31 +0200 (EET) X-Originating-IP: 213.47.68.29 Received: from localhost (213-47-68-29.cable.dynamic.surfer.at [213.47.68.29]) (Authenticated sender: michael@niedermayer.cc) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 327F5E0003 for ; Sat, 2 Nov 2019 16:29:29 +0000 (UTC) Date: Sat, 2 Nov 2019 17:29:29 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20191102162929.GI3340@michaelspb> References: <20191101120924.17853-1-onemda@gmail.com> <20191101140602.GZ3340@michaelspb> <20191101182945.GA3340@michaelspb> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [FFmpeg-devel] [PATCH] avfilter: add eval video filter X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On Fri, Nov 01, 2019 at 09:38:39PM +0100, Paul B Mahol wrote: > On 11/1/19, Michael Niedermayer wrote: > > On Fri, Nov 01, 2019 at 04:50:38PM +0100, Paul B Mahol wrote: > >> On 11/1/19, Michael Niedermayer wrote: > >> > On Fri, Nov 01, 2019 at 01:09:24PM +0100, Paul B Mahol wrote: > >> >> Signed-off-by: Paul B Mahol > >> >> --- > >> >> doc/filters.texi | 78 +++++ > >> >> libavfilter/Makefile | 1 + > >> >> libavfilter/allfilters.c | 1 + > >> >> libavfilter/vf_eval.c | 687 > >> >> +++++++++++++++++++++++++++++++++++++++ > >> >> 4 files changed, 767 insertions(+) > >> >> create mode 100644 libavfilter/vf_eval.c > >> > > >> > This looks like it duplicates code from vf_geq.c > >> > also this should be integrated with or in vf_geq.c > >> > > >> > IIUC this was written because geq is GPL, but i had already agreed to > >> > relicense the code in it i wrote to LGPL, so iam not sure why you wrote > >> > this. > >> > > >> > Who disagreed to relicnce their contribution to geq to avoid this extra > >> > work you did ? > >> > Or did noone disagree ? then i do not understand why you wrote a > >> > seperate > >> > filter > >> > >> Do I need to contact all on blame list of vf_geq? or also mplayer devs > >> that touched geq in mplayer? > > > > all who touched it MINUS anyone who made a change that is totally not > > in the current version (there are several developers in mplayer who > > made auch changes) > > also in case of mplayer you may need to look at the commit messages > > some developers did apply patches from others. > > > > I took a quick look and these are the people i saw > > carl, ubitux, ivan, ods15, Alexis Ballier, derek, Marc-Antoine Arnaud, > > Nicolas George, Stefano and Paul > > reimar, zuxy and diego > > I do not think I can contact ods15. His change was this below (the others seems obviously not in the ffmpeg geq code) i didnt check the one below before because its big. But if we cannot contact him, then this should be checked Does any of this prevail in the ffmpeg geq code ? (if so tell me what and ill rewrite that) Thanks commit dd09bf52982fef6b29acfbcd5fa5c7cb46994c3b Author: ods15 Date: Fri Oct 27 19:40:48 2006 +0000 update vf_geq to new ff_eval API git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@20471 b3059339-0415-0410-9bf9-f77b7e298cf2 diff --git a/libmpcodecs/vf_geq.c b/libmpcodecs/vf_geq.c index da33eac71..e8b8c0918 100644 --- a/libmpcodecs/vf_geq.c +++ b/libmpcodecs/vf_geq.c @@ -27,18 +27,12 @@ #include "mp_msg.h" #include "cpudetect.h" -#if 1 -double ff_eval(char *s, double *const_value, const char **const_name, - double (**func1)(void *, double), const char **func1_name, - double (**func2)(void *, double, double), char **func2_name, - void *opaque); -#endif - // Needed to bring in lrintf. #define HAVE_AV_CONFIG_H #include "libavcodec/avcodec.h" #include "libavcodec/dsputil.h" +#include "libavcodec/eval.h" #include "libavutil/common.h" /* FIXME: common.h defines printf away when HAVE_AV_CONFIG @@ -57,7 +51,7 @@ double ff_eval(char *s, double *const_value, const char **const_name, struct vf_priv_s { - char eq[3][2000]; + AVEvalExpr * e[3]; int framenum; mp_image_t *mpi; }; @@ -120,25 +114,6 @@ static double cr(struct vf_instance_s* vf, double x, double y){ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; int x,y, plane; - static const char *const_names[]={ - "PI", - "E", - "X", - "Y", - "W", - "H", - "N", - "SW", - "SH", - NULL - }; - static const char *func2_names[]={ - "lum", - "cb", - "cr", - "p", - NULL - }; if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // no DR, so get a new image! hope we'll get DR buffer: @@ -157,13 +132,6 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ int h= mpi->h >> (plane ? mpi->chroma_y_shift : 0); uint8_t *dst = dmpi->planes[plane]; int dst_stride= dmpi->stride[plane]; - double (*func2[])(void *, double, double)={ - lum, - cb, - cr, - plane==0 ? lum : (plane==1 ? cb : cr), - NULL - }; double const_values[]={ M_PI, M_E, @@ -176,11 +144,12 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ h/(double)mpi->h, 0 }; + if (!vf->priv->e[plane]) continue; for(y=0; ypriv->eq[plane], const_values, const_names, NULL, NULL, func2, func2_names, vf); + dst[x+y* dst_stride]= ff_parse_eval(vf->priv->e[plane], const_values, vf); } } } @@ -199,6 +168,9 @@ static void uninit(struct vf_instance_s* vf){ //===========================================================================// static int open(vf_instance_t *vf, char* args){ + char eq[3][2000] = { { 0 }, { 0 }, { 0 } }; + int plane; + vf->config=config; vf->put_image=put_image; // vf->get_image=get_image; @@ -206,10 +178,45 @@ static int open(vf_instance_t *vf, char* args){ vf->priv=av_malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); - if (args) sscanf(args, "%1999s:%1999s:%1999s", vf->priv->eq[0], vf->priv->eq[1], vf->priv->eq[2]); + if (args) sscanf(args, "%1999s:%1999s:%1999s", eq[0], eq[1], eq[2]); + + if (!eq[1][0]) strncpy(eq[1], eq[0], sizeof(eq[0])-1); + if (!eq[2][0]) strncpy(eq[2], eq[1], sizeof(eq[0])-1); - if(!vf->priv->eq[1][0]) strncpy(vf->priv->eq[1], vf->priv->eq[0], sizeof(vf->priv->eq[0])-1); - if(!vf->priv->eq[2][0]) strncpy(vf->priv->eq[2], vf->priv->eq[1], sizeof(vf->priv->eq[0])-1); + for(plane=0; plane<3; plane++){ + static const char *const_names[]={ + "PI", + "E", + "X", + "Y", + "W", + "H", + "N", + "SW", + "SH", + NULL + }; + static const char *func2_names[]={ + "lum", + "cb", + "cr", + "p", + NULL + }; + double (*func2[])(void *, double, double)={ + lum, + cb, + cr, + plane==0 ? lum : (plane==1 ? cb : cr), + NULL + }; + char * a; + vf->priv->e[plane] = ff_parse(eq[plane], const_names, NULL, NULL, func2, func2_names, &a); + + if (!vf->priv->e[plane]) { + mp_msg(MSGT_VFILTER, MSGL_ERR, "geq: error loading equation `%s': %s\n", eq[plane], a); + } + } return 1; }