[PATCH] Implement pixdesctest filter
Hi, this filter is useful for testing/pedagogical purposes, so I'd like to commit it even if we don't still have a test for lavfi. Regards. -- FFmpeg = Friendly and Fiendish Majestic Picky Elaborated Guru
On Tue, Feb 02, 2010 at 12:08:14AM +0100, Stefano Sabatini wrote:
Hi, this filter is useful for testing/pedagogical purposes, so I'd like to commit it even if we don't still have a test for lavfi. [...] +static av_cold void uninit(AVFilterContext *ctx) +{ + PixdescTestContext *priv = ctx->priv; + av_free(priv->line);
please use av_freep() for everything except local variables avoids double frees and access to freed memory [...]
+static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) +{ + PixdescTestContext *priv = inlink->dst->priv; + int i, c, w = inlink->w; + + AVFilterPicRef *inpic = inlink->cur_pic; + AVFilterPicRef *outpic = inlink->dst->outputs[0]->outpic; + + /* clear destination picture */ + for (c = 0; c < priv->pix_desc->nb_components; c++) { + int h1 = c == 1 || c == 2 ? h>>priv->pix_desc->log2_chroma_h : h; + int y1 = c == 1 || c == 2 ? y>>priv->pix_desc->log2_chroma_h : y;
does that work with odd y/h ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch
On date Tuesday 2010-02-02 12:34:04 +0100, Michael Niedermayer encoded:
On Tue, Feb 02, 2010 at 12:08:14AM +0100, Stefano Sabatini wrote:
Hi, this filter is useful for testing/pedagogical purposes, so I'd like to commit it even if we don't still have a test for lavfi. [...] +static av_cold void uninit(AVFilterContext *ctx) +{ + PixdescTestContext *priv = ctx->priv; + av_free(priv->line);
please use av_freep() for everything except local variables avoids double frees and access to freed memory
[...]
+static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) +{ + PixdescTestContext *priv = inlink->dst->priv; + int i, c, w = inlink->w; + + AVFilterPicRef *inpic = inlink->cur_pic; + AVFilterPicRef *outpic = inlink->dst->outputs[0]->outpic; + + /* clear destination picture */ + for (c = 0; c < priv->pix_desc->nb_components; c++) { + int h1 = c == 1 || c == 2 ? h>>priv->pix_desc->log2_chroma_h : h; + int y1 = c == 1 || c == 2 ? y>>priv->pix_desc->log2_chroma_h : y;
does that work with odd y/h ?
Tested, we have them the same problem as in the pad filter, so I'll suspend this review until I'll have fixed somehow the problem in lsws. In attachment an updated patch. Regards. -- FFmpeg = Fantastic and Foolish Mega Philosophical Elastic Glue
On date Saturday 2010-02-06 00:48:47 +0100, Stefano Sabatini encoded:
On date Tuesday 2010-02-02 12:34:04 +0100, Michael Niedermayer encoded:
On Tue, Feb 02, 2010 at 12:08:14AM +0100, Stefano Sabatini wrote:
Hi, this filter is useful for testing/pedagogical purposes, so I'd like to commit it even if we don't still have a test for lavfi. [...] +static av_cold void uninit(AVFilterContext *ctx) +{ + PixdescTestContext *priv = ctx->priv; + av_free(priv->line);
please use av_freep() for everything except local variables avoids double frees and access to freed memory
[...]
+static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) +{ + PixdescTestContext *priv = inlink->dst->priv; + int i, c, w = inlink->w; + + AVFilterPicRef *inpic = inlink->cur_pic; + AVFilterPicRef *outpic = inlink->dst->outputs[0]->outpic; + + /* clear destination picture */ + for (c = 0; c < priv->pix_desc->nb_components; c++) { + int h1 = c == 1 || c == 2 ? h>>priv->pix_desc->log2_chroma_h : h; + int y1 = c == 1 || c == 2 ? y>>priv->pix_desc->log2_chroma_h : y;
does that work with odd y/h ?
Tested, we have them the same problem as in the pad filter, so I'll suspend this review until I'll have fixed somehow the problem in lsws.
In attachment an updated patch.
The problem was fixed after Michael fix to libswscale (which we have still to document...). Filter and test in attachment. Note that I have a problem with this test, the generated list of input/output formats currently depends on the endianness of the system, that also means that the reference file should be generated accordingly. I'll eventually commit the test after the filter, as we'll find a satisfying solution to that problem. Regards. -- FFmpeg = Fascinating & Formidable Meaningful Picky Erotic God
On Mon, Jun 07, 2010 at 10:41:50PM +0200, Stefano Sabatini wrote:
On date Saturday 2010-02-06 00:48:47 +0100, Stefano Sabatini encoded:
On date Tuesday 2010-02-02 12:34:04 +0100, Michael Niedermayer encoded:
On Tue, Feb 02, 2010 at 12:08:14AM +0100, Stefano Sabatini wrote:
Hi, this filter is useful for testing/pedagogical purposes, so I'd like to commit it even if we don't still have a test for lavfi. [...] +static av_cold void uninit(AVFilterContext *ctx) +{ + PixdescTestContext *priv = ctx->priv; + av_free(priv->line);
please use av_freep() for everything except local variables avoids double frees and access to freed memory
[...]
+static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) +{ + PixdescTestContext *priv = inlink->dst->priv; + int i, c, w = inlink->w; + + AVFilterPicRef *inpic = inlink->cur_pic; + AVFilterPicRef *outpic = inlink->dst->outputs[0]->outpic; + + /* clear destination picture */ + for (c = 0; c < priv->pix_desc->nb_components; c++) { + int h1 = c == 1 || c == 2 ? h>>priv->pix_desc->log2_chroma_h : h; + int y1 = c == 1 || c == 2 ? y>>priv->pix_desc->log2_chroma_h : y;
does that work with odd y/h ?
Tested, we have them the same problem as in the pad filter, so I'll suspend this review until I'll have fixed somehow the problem in lsws.
In attachment an updated patch.
The problem was fixed after Michael fix to libswscale (which we have still to document...).
Filter and test in attachment.
Note that I have a problem with this test, the generated list of input/output formats currently depends on the endianness of the system, that also means that the reference file should be generated accordingly.
fix the code then so the lists dont depend on the system endianness [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In a rich man's house there is no place to spit but his face. -- Diogenes of Sinope
On date Tuesday 2010-06-08 01:56:50 +0200, Michael Niedermayer encoded:
On Mon, Jun 07, 2010 at 10:41:50PM +0200, Stefano Sabatini wrote: [...]
Filter and test in attachment.
Note that I have a problem with this test, the generated list of input/output formats currently depends on the endianness of the system, that also means that the reference file should be generated accordingly.
fix the code then so the lists dont depend on the system endianness
Fixed, but I need someone to test it on a big-endian machine otherwise the test there will fail and provide the test file. Regards. -- FFmpeg = Freak and Fast Magnificient Plastic Earthshaking Gangster
On Sun, 13 Jun 2010 23:25:31 +0200, Stefano Sabatini wrote:
On date Tuesday 2010-06-08 01:56:50 +0200, Michael Niedermayer encoded:
On Mon, Jun 07, 2010 at 10:41:50PM +0200, Stefano Sabatini wrote: [...]
Filter and test in attachment.
Note that I have a problem with this test, the generated list of input/output formats currently depends on the endianness of the system, that also means that the reference file should be generated accordingly.
fix the code then so the lists dont depend on the system endianness
Fixed, but I need someone to test it on a big-endian machine otherwise the test there will fail and provide the test file.
mru has a ppc box for ffmpeg development, you might want to ask him for an account. -compn
On date Sunday 2010-06-13 18:56:36 -0400, compn encoded:
On Sun, 13 Jun 2010 23:25:31 +0200, Stefano Sabatini wrote:
On date Tuesday 2010-06-08 01:56:50 +0200, Michael Niedermayer encoded:
On Mon, Jun 07, 2010 at 10:41:50PM +0200, Stefano Sabatini wrote: [...]
Filter and test in attachment.
Note that I have a problem with this test, the generated list of input/output formats currently depends on the endianness of the system, that also means that the reference file should be generated accordingly.
fix the code then so the lists dont depend on the system endianness
Fixed, but I need someone to test it on a big-endian machine otherwise the test there will fail and provide the test file.
mru has a ppc box for ffmpeg development, you might want to ask him for an account.
Can someone with a BE machine run it and post the result? Or alternatively can someone give me an account on such a machine? Regards. -- FFmpeg = Frightening & Fascinating Mastering Portable Encoding/decoding Gadget
On date Sunday 2010-06-20 19:11:15 +0200, Stefano Sabatini encoded:
On date Sunday 2010-06-13 18:56:36 -0400, compn encoded:
On Sun, 13 Jun 2010 23:25:31 +0200, Stefano Sabatini wrote:
On date Tuesday 2010-06-08 01:56:50 +0200, Michael Niedermayer encoded:
On Mon, Jun 07, 2010 at 10:41:50PM +0200, Stefano Sabatini wrote: [...]
Filter and test in attachment.
Note that I have a problem with this test, the generated list of input/output formats currently depends on the endianness of the system, that also means that the reference file should be generated accordingly.
fix the code then so the lists dont depend on the system endianness
Fixed, but I need someone to test it on a big-endian machine otherwise the test there will fail and provide the test file.
mru has a ppc box for ffmpeg development, you might want to ask him for an account.
Can someone with a BE machine run it and post the result? Or alternatively can someone give me an account on such a machine?
Successfully tested on the BE Mans-box (thanks Mans), patch updated. OK to apply? Regards. -- FFmpeg = Faithful and Fascinating Mortal Problematic Ecumenical Game
On Mon, Jun 21, 2010 at 11:25:29PM +0200, Stefano Sabatini wrote: [...]
+static int config_props(AVFilterLink *inlink) +{ + PixdescTestContext *priv = inlink->dst->priv; + + priv->pix_desc = &av_pix_fmt_descriptors[inlink->format]; + + if (!(priv->line = av_malloc(sizeof(*priv->line) * inlink->w))) + return AVERROR(ENOMEM); + + return 0; +} + +static void start_frame(AVFilterLink *inlink, AVFilterPicRef *picref) +{ + PixdescTestContext *priv = inlink->dst->priv; + AVFilterLink *outlink = inlink->dst->outputs[0]; + AVFilterPicRef *outpicref; + int i; + + outlink->outpic = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, + outlink->w, outlink->h); + outpicref = outlink->outpic;
+ outpicref->pts = picref->pts; + outpicref->pos = picref->pos; + outpicref->pixel_aspect = picref->pixel_aspect; + outpicref->interlaced = picref->interlaced; + outpicref->top_field_first = picref->top_field_first;
this code should be factored into its own function it likely is duplicated over a few filters
+ + for (i = 0; i < 4; i++) { + int h = outlink->h; + h = i == 1 || i == 2 ? h>>priv->pix_desc->log2_chroma_h : h; + if (outpicref->data[i]) + memset(outpicref->data[i], 0, outpicref->linesize[i] * h); + }
can linesize be <0 here? [...]
diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh index ebbc0f3..42fba34 100755 --- a/tests/lavfi-regression.sh +++ b/tests/lavfi-regression.sh @@ -86,6 +86,19 @@ if [ -n "$do_lavfi_pix_fmts" ]; then done fi
+if [ -n "$do_lavfi_pixdesc" ]; then + pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2)" + + ref_file=tests/ref/lavfi/lavfi_pixdesc + rm -f $ref_file + + for pix_fmt in $pix_fmts; do + cat $ref_file-$pix_fmt >> $ref_file + do_video_encoding "lavfi_pixdesc-${pix_fmt}.nut" "" \ + "-vf slicify=random,format=$pix_fmt,pixdesctest -vcodec rawvideo -pix_fmt $pix_fmt"
shouldnt it be converted back and compared by tiny_psnr too? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates
On date Tuesday 2010-06-22 02:22:51 +0200, Michael Niedermayer encoded:
On Mon, Jun 21, 2010 at 11:25:29PM +0200, Stefano Sabatini wrote: [...]
+static int config_props(AVFilterLink *inlink) +{ + PixdescTestContext *priv = inlink->dst->priv; + + priv->pix_desc = &av_pix_fmt_descriptors[inlink->format]; + + if (!(priv->line = av_malloc(sizeof(*priv->line) * inlink->w))) + return AVERROR(ENOMEM); + + return 0; +} + +static void start_frame(AVFilterLink *inlink, AVFilterPicRef *picref) +{ + PixdescTestContext *priv = inlink->dst->priv; + AVFilterLink *outlink = inlink->dst->outputs[0]; + AVFilterPicRef *outpicref; + int i; + + outlink->outpic = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, + outlink->w, outlink->h); + outpicref = outlink->outpic;
+ outpicref->pts = picref->pts; + outpicref->pos = picref->pos; + outpicref->pixel_aspect = picref->pixel_aspect; + outpicref->interlaced = picref->interlaced; + outpicref->top_field_first = picref->top_field_first;
this code should be factored into its own function it likely is duplicated over a few filters
Check attached. -- FFmpeg = Friendly and Fancy Monstrous Problematic Evil Gnome
On Sun, Jul 04, 2010 at 12:26:47AM +0200, Stefano Sabatini wrote:
On date Tuesday 2010-06-22 02:22:51 +0200, Michael Niedermayer encoded:
On Mon, Jun 21, 2010 at 11:25:29PM +0200, Stefano Sabatini wrote: [...] avfilter.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) 9f65488262329acc9e2a1e4b7924e9984c995c07 0001-Implement-avfilter_copy_picref_props.patch From 95a9c0124d02eb28006f7aa59b2fd336dba63fe8 Mon Sep 17 00:00:00 2001 Message-Id: <95a9c0124d02eb28006f7aa59b2fd336dba63fe8.1278195876.git.stefano.sabatini-lala at poste.it> From: Stefano Sabatini <stefano.sabatini-lala at poste.it> Date: Sat, 3 Jul 2010 23:05:05 +0200 Subject: [implement-pixdesctest PATCH 1/2] Implement avfilter_copy_picref_props().
ok [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you really think that XML is the answer, then you definitly missunderstood the question -- Attila Kinali
Hi, On 2010-07-04, Michael Niedermayer wrote:
On Sun, Jul 04, 2010 at 12:26:47AM +0200, Stefano Sabatini wrote:
On date Tuesday 2010-06-22 02:22:51 +0200, Michael Niedermayer encoded:
On Mon, Jun 21, 2010 at 11:25:29PM +0200, Stefano Sabatini wrote: [...] avfilter.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) 9f65488262329acc9e2a1e4b7924e9984c995c07 0001-Implement-avfilter_copy_picref_props.patch From 95a9c0124d02eb28006f7aa59b2fd336dba63fe8 Mon Sep 17 00:00:00 2001 Message-Id: <95a9c0124d02eb28006f7aa59b2fd336dba63fe8.1278195876.git.stefano.sabatini-lala at poste.it> From: Stefano Sabatini <stefano.sabatini-lala at poste.it> Date: Sat, 3 Jul 2010 23:05:05 +0200 Subject: [implement-pixdesctest PATCH 1/2] Implement avfilter_copy_picref_props().
ok
--- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -121,6 +121,19 @@ typedef struct AVFilterPicRef } AVFilterPicRef; /** + * Copy properties of src to dst, without to copy the actual video + * data. + */ Gerund after prepositions (except to), hence: "Copy properties of src to dst, without copying the actual video" Regards, V?ctor
On date Sunday 2010-07-04 23:17:49 +0200, V?ctor Paesa encoded:
Hi,
On 2010-07-04, Michael Niedermayer wrote:
On Sun, Jul 04, 2010 at 12:26:47AM +0200, Stefano Sabatini wrote:
On date Tuesday 2010-06-22 02:22:51 +0200, Michael Niedermayer encoded:
On Mon, Jun 21, 2010 at 11:25:29PM +0200, Stefano Sabatini wrote: [...] avfilter.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) 9f65488262329acc9e2a1e4b7924e9984c995c07 0001-Implement-avfilter_copy_picref_props.patch From 95a9c0124d02eb28006f7aa59b2fd336dba63fe8 Mon Sep 17 00:00:00 2001 Message-Id: <95a9c0124d02eb28006f7aa59b2fd336dba63fe8.1278195876.git.stefano.sabatini-lala at poste.it> From: Stefano Sabatini <stefano.sabatini-lala at poste.it> Date: Sat, 3 Jul 2010 23:05:05 +0200 Subject: [implement-pixdesctest PATCH 1/2] Implement avfilter_copy_picref_props().
ok
--- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -121,6 +121,19 @@ typedef struct AVFilterPicRef } AVFilterPicRef;
/** + * Copy properties of src to dst, without to copy the actual video + * data. + */
Gerund after prepositions (except to), hence: "Copy properties of src to dst, without copying the actual video"
Applied with the doxy fix. Regards. -- FFmpeg = Fanciful & Fantastic Mean Puritan Empowered Gem
On date Tuesday 2010-06-22 02:22:51 +0200, Michael Niedermayer encoded:
On Mon, Jun 21, 2010 at 11:25:29PM +0200, Stefano Sabatini wrote: [...]
+static int config_props(AVFilterLink *inlink) +{ + PixdescTestContext *priv = inlink->dst->priv; + + priv->pix_desc = &av_pix_fmt_descriptors[inlink->format]; + + if (!(priv->line = av_malloc(sizeof(*priv->line) * inlink->w))) + return AVERROR(ENOMEM); + + return 0; +} + +static void start_frame(AVFilterLink *inlink, AVFilterPicRef *picref) +{ + PixdescTestContext *priv = inlink->dst->priv; + AVFilterLink *outlink = inlink->dst->outputs[0]; + AVFilterPicRef *outpicref; + int i; + + outlink->outpic = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, + outlink->w, outlink->h); + outpicref = outlink->outpic;
+ outpicref->pts = picref->pts; + outpicref->pos = picref->pos; + outpicref->pixel_aspect = picref->pixel_aspect; + outpicref->interlaced = picref->interlaced; + outpicref->top_field_first = picref->top_field_first;
this code should be factored into its own function it likely is duplicated over a few filters
Fixed in the previous patch.
+ + for (i = 0; i < 4; i++) { + int h = outlink->h; + h = i == 1 || i == 2 ? h>>priv->pix_desc->log2_chroma_h : h; + if (outpicref->data[i]) + memset(outpicref->data[i], 0, outpicref->linesize[i] * h); + }
can linesize be <0 here?
Good catch, fixed.
[...]
diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh index ebbc0f3..42fba34 100755 --- a/tests/lavfi-regression.sh +++ b/tests/lavfi-regression.sh @@ -86,6 +86,19 @@ if [ -n "$do_lavfi_pix_fmts" ]; then done fi
+if [ -n "$do_lavfi_pixdesc" ]; then + pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2)" + + ref_file=tests/ref/lavfi/lavfi_pixdesc + rm -f $ref_file + + for pix_fmt in $pix_fmts; do + cat $ref_file-$pix_fmt >> $ref_file + do_video_encoding "lavfi_pixdesc-${pix_fmt}.nut" "" \ + "-vf slicify=random,format=$pix_fmt,pixdesctest -vcodec rawvideo -pix_fmt $pix_fmt"
shouldnt it be converted back and compared by tiny_psnr too?
Yes, found a much better solution which doesn't require the bundling of the reference files at all. Regards. -- FFmpeg = Frightening and Fierce Mournful Problematic Exxagerate Gospel
On date Sunday 2010-07-04 00:28:54 +0200, Stefano Sabatini encoded: [...]
Subject: [implement-pixdesctest PATCH 2/2] Add pixdesctest filter and corresponding test.
--- Makefile | 1 + doc/filters.texi | 13 ++++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_pixdesctest.c | 128 ++++++++++++++++++++++++++++++++++++++++++ tests/lavfi-regression.sh | 20 +++++++ 6 files changed, 164 insertions(+), 0 deletions(-) create mode 100644 libavfilter/vf_pixdesctest.c
Ping? -- FFmpeg = Fancy and Formidable Mystic Portable Elected Guru
On Sun, Jul 04, 2010 at 12:28:54AM +0200, Stefano Sabatini wrote:
On date Tuesday 2010-06-22 02:22:51 +0200, Michael Niedermayer encoded:
On Mon, Jun 21, 2010 at 11:25:29PM +0200, Stefano Sabatini wrote: [...]
+static int config_props(AVFilterLink *inlink) +{ + PixdescTestContext *priv = inlink->dst->priv; + + priv->pix_desc = &av_pix_fmt_descriptors[inlink->format]; + + if (!(priv->line = av_malloc(sizeof(*priv->line) * inlink->w))) + return AVERROR(ENOMEM); + + return 0; +} + +static void start_frame(AVFilterLink *inlink, AVFilterPicRef *picref) +{ + PixdescTestContext *priv = inlink->dst->priv; + AVFilterLink *outlink = inlink->dst->outputs[0]; + AVFilterPicRef *outpicref; + int i; + + outlink->outpic = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, + outlink->w, outlink->h); + outpicref = outlink->outpic;
+ outpicref->pts = picref->pts; + outpicref->pos = picref->pos; + outpicref->pixel_aspect = picref->pixel_aspect; + outpicref->interlaced = picref->interlaced; + outpicref->top_field_first = picref->top_field_first;
this code should be factored into its own function it likely is duplicated over a few filters
Fixed in the previous patch.
+ + for (i = 0; i < 4; i++) { + int h = outlink->h; + h = i == 1 || i == 2 ? h>>priv->pix_desc->log2_chroma_h : h; + if (outpicref->data[i]) + memset(outpicref->data[i], 0, outpicref->linesize[i] * h); + }
can linesize be <0 here?
Good catch, fixed.
[...]
diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh index ebbc0f3..42fba34 100755 --- a/tests/lavfi-regression.sh +++ b/tests/lavfi-regression.sh @@ -86,6 +86,19 @@ if [ -n "$do_lavfi_pix_fmts" ]; then done fi
+if [ -n "$do_lavfi_pixdesc" ]; then + pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2)" + + ref_file=tests/ref/lavfi/lavfi_pixdesc + rm -f $ref_file + + for pix_fmt in $pix_fmts; do + cat $ref_file-$pix_fmt >> $ref_file + do_video_encoding "lavfi_pixdesc-${pix_fmt}.nut" "" \ + "-vf slicify=random,format=$pix_fmt,pixdesctest -vcodec rawvideo -pix_fmt $pix_fmt"
shouldnt it be converted back and compared by tiny_psnr too?
Yes, found a much better solution which doesn't require the bundling of the reference files at all.
Regards. -- FFmpeg = Frightening and Fierce Mournful Problematic Exxagerate Gospel
Makefile | 1 doc/filters.texi | 13 ++++ libavfilter/Makefile | 1 libavfilter/allfilters.c | 1 libavfilter/vf_pixdesctest.c | 128 +++++++++++++++++++++++++++++++++++++++++++ tests/lavfi-regression.sh | 20 ++++++ 6 files changed, 164 insertions(+) 614060a98a65df3a7d7b5c24fa3b17aafe5c639d 0002-Add-pixdesctest-filter-and-corresponding-test.patch
From 6027e7854a980c41f3035173216bed17fe95dd05 Mon Sep 17 00:00:00 2001 Message-Id: <6027e7854a980c41f3035173216bed17fe95dd05.1278195876.git.stefano.sabatini-lala at poste.it> In-Reply-To: <95a9c0124d02eb28006f7aa59b2fd336dba63fe8.1278195876.git.stefano.sabatini-lala at poste.it> References: <95a9c0124d02eb28006f7aa59b2fd336dba63fe8.1278195876.git.stefano.sabatini-lala at poste.it> From: Stefano Sabatini <stefano.sabatini-lala at poste.it> Date: Mon, 7 Jun 2010 22:31:30 +0200 Subject: [implement-pixdesctest PATCH 2/2] Add pixdesctest filter and corresponding test.
--- Makefile | 1 + doc/filters.texi | 13 ++++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_pixdesctest.c | 128 ++++++++++++++++++++++++++++++++++++++++++ tests/lavfi-regression.sh | 20 +++++++ 6 files changed, 164 insertions(+), 0 deletions(-) create mode 100644 libavfilter/vf_pixdesctest.c
no reference checksums? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch
On date Tuesday 2010-07-06 13:04:37 +0200, Michael Niedermayer encoded:
On Sun, Jul 04, 2010 at 12:28:54AM +0200, Stefano Sabatini wrote:
On date Tuesday 2010-06-22 02:22:51 +0200, Michael Niedermayer encoded:
On Mon, Jun 21, 2010 at 11:25:29PM +0200, Stefano Sabatini wrote: [...]
diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh index ebbc0f3..42fba34 100755 --- a/tests/lavfi-regression.sh +++ b/tests/lavfi-regression.sh @@ -86,6 +86,19 @@ if [ -n "$do_lavfi_pix_fmts" ]; then done fi
+if [ -n "$do_lavfi_pixdesc" ]; then + pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2)" + + ref_file=tests/ref/lavfi/lavfi_pixdesc + rm -f $ref_file + + for pix_fmt in $pix_fmts; do + cat $ref_file-$pix_fmt >> $ref_file + do_video_encoding "lavfi_pixdesc-${pix_fmt}.nut" "" \ + "-vf slicify=random,format=$pix_fmt,pixdesctest -vcodec rawvideo -pix_fmt $pix_fmt"
shouldnt it be converted back and compared by tiny_psnr too?
Yes, found a much better solution which doesn't require the bundling of the reference files at all. [...] Makefile | 1 + doc/filters.texi | 13 ++++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_pixdesctest.c | 128 ++++++++++++++++++++++++++++++++++++++++++ tests/lavfi-regression.sh | 20 +++++++ 6 files changed, 164 insertions(+), 0 deletions(-) create mode 100644 libavfilter/vf_pixdesctest.c
no reference checksums?
No, as I said the reference are automatically generated, indeed the purpose of the test is to check that the output is the very same with and without the filter. This is a little slower, but looks more robust, I'll change if you prefer the other way. Regards. -- FFmpeg = Fancy and Fast Muttering Ponderous Explosive Gargoyle
On Sun, Jul 04, 2010 at 12:28:54AM +0200, Stefano Sabatini wrote:
On date Tuesday 2010-06-22 02:22:51 +0200, Michael Niedermayer encoded:
On Mon, Jun 21, 2010 at 11:25:29PM +0200, Stefano Sabatini wrote: [...]
+static int config_props(AVFilterLink *inlink) +{ + PixdescTestContext *priv = inlink->dst->priv; + + priv->pix_desc = &av_pix_fmt_descriptors[inlink->format]; + + if (!(priv->line = av_malloc(sizeof(*priv->line) * inlink->w))) + return AVERROR(ENOMEM); + + return 0; +} + +static void start_frame(AVFilterLink *inlink, AVFilterPicRef *picref) +{ + PixdescTestContext *priv = inlink->dst->priv; + AVFilterLink *outlink = inlink->dst->outputs[0]; + AVFilterPicRef *outpicref; + int i; + + outlink->outpic = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, + outlink->w, outlink->h); + outpicref = outlink->outpic;
+ outpicref->pts = picref->pts; + outpicref->pos = picref->pos; + outpicref->pixel_aspect = picref->pixel_aspect; + outpicref->interlaced = picref->interlaced; + outpicref->top_field_first = picref->top_field_first;
this code should be factored into its own function it likely is duplicated over a few filters
Fixed in the previous patch.
+ + for (i = 0; i < 4; i++) { + int h = outlink->h; + h = i == 1 || i == 2 ? h>>priv->pix_desc->log2_chroma_h : h; + if (outpicref->data[i]) + memset(outpicref->data[i], 0, outpicref->linesize[i] * h); + }
can linesize be <0 here?
Good catch, fixed.
[...]
diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh index ebbc0f3..42fba34 100755 --- a/tests/lavfi-regression.sh +++ b/tests/lavfi-regression.sh @@ -86,6 +86,19 @@ if [ -n "$do_lavfi_pix_fmts" ]; then done fi
+if [ -n "$do_lavfi_pixdesc" ]; then + pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2)" + + ref_file=tests/ref/lavfi/lavfi_pixdesc + rm -f $ref_file + + for pix_fmt in $pix_fmts; do + cat $ref_file-$pix_fmt >> $ref_file + do_video_encoding "lavfi_pixdesc-${pix_fmt}.nut" "" \ + "-vf slicify=random,format=$pix_fmt,pixdesctest -vcodec rawvideo -pix_fmt $pix_fmt"
shouldnt it be converted back and compared by tiny_psnr too?
Yes, found a much better solution which doesn't require the bundling of the reference files at all.
Regards. -- FFmpeg = Frightening and Fierce Mournful Problematic Exxagerate Gospel
Makefile | 1 doc/filters.texi | 13 ++++ libavfilter/Makefile | 1 libavfilter/allfilters.c | 1 libavfilter/vf_pixdesctest.c | 128 +++++++++++++++++++++++++++++++++++++++++++ tests/lavfi-regression.sh | 20 ++++++ 6 files changed, 164 insertions(+) 614060a98a65df3a7d7b5c24fa3b17aafe5c639d 0002-Add-pixdesctest-filter-and-corresponding-test.patch
From 6027e7854a980c41f3035173216bed17fe95dd05 Mon Sep 17 00:00:00 2001 Message-Id: <6027e7854a980c41f3035173216bed17fe95dd05.1278195876.git.stefano.sabatini-lala at poste.it> In-Reply-To: <95a9c0124d02eb28006f7aa59b2fd336dba63fe8.1278195876.git.stefano.sabatini-lala at poste.it> References: <95a9c0124d02eb28006f7aa59b2fd336dba63fe8.1278195876.git.stefano.sabatini-lala at poste.it> From: Stefano Sabatini <stefano.sabatini-lala at poste.it> Date: Mon, 7 Jun 2010 22:31:30 +0200 Subject: [implement-pixdesctest PATCH 2/2] Add pixdesctest filter and corresponding test.
ok if tested and works [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I do not agree with what you have to say, but I'll defend to the death your right to say it. -- Voltaire
On date Wednesday 2010-07-07 14:26:50 +0200, Michael Niedermayer encoded:
On Sun, Jul 04, 2010 at 12:28:54AM +0200, Stefano Sabatini wrote: [...]
Makefile | 1 doc/filters.texi | 13 ++++ libavfilter/Makefile | 1 libavfilter/allfilters.c | 1 libavfilter/vf_pixdesctest.c | 128 +++++++++++++++++++++++++++++++++++++++++++ tests/lavfi-regression.sh | 20 ++++++ 6 files changed, 164 insertions(+) 614060a98a65df3a7d7b5c24fa3b17aafe5c639d 0002-Add-pixdesctest-filter-and-corresponding-test.patch
From 6027e7854a980c41f3035173216bed17fe95dd05 Mon Sep 17 00:00:00 2001 Message-Id: <6027e7854a980c41f3035173216bed17fe95dd05.1278195876.git.stefano.sabatini-lala at poste.it> In-Reply-To: <95a9c0124d02eb28006f7aa59b2fd336dba63fe8.1278195876.git.stefano.sabatini-lala at poste.it> References: <95a9c0124d02eb28006f7aa59b2fd336dba63fe8.1278195876.git.stefano.sabatini-lala at poste.it> From: Stefano Sabatini <stefano.sabatini-lala at poste.it> Date: Mon, 7 Jun 2010 22:31:30 +0200 Subject: [implement-pixdesctest PATCH 2/2] Add pixdesctest filter and corresponding test.
ok if tested and works
Applied. -- FFmpeg = Fiendish and Fantastic Marvellous Peaceless Elaborated God
participants (4)
-
michaelni@gmx.at -
stefano.sabatini-lala@poste.it -
tempn@twmi.rr.com -
victorpaesa@googlemail.com