Re: [FFmpeg-devel] [PATCH 2/2] lavfi: add testsrc2 test source.

2015-11-07 Thread Nicolas George
Le sextidi 16 brumaire, an CCXXIV, Paul B Mahol a écrit :
> Should be fine.

Pushed like that. Thanks for all the remarks.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] lavfi: add testsrc2 test source.

2015-11-06 Thread Paul B Mahol
On 10/25/15, Nicolas George  wrote:
> Similar to testsrc, but using drawutils and therefore
> supporting a lot of pixel formats instead of just rgb24.
> This allows using it as input for other tests without
> requiring a format conversion.
> It is also slightly faster than testsrc for some reason.
>
> Signed-off-by: Nicolas George 
> ---
>  libavfilter/Makefile   |   1 +
>  libavfilter/allfilters.c   |   1 +
>  libavfilter/vsrc_testsrc.c | 271
> +
>  tests/fate/filter-video.mak|   9 ++
>  tests/ref/fate/filter-testsrc2-rgb24   |  71 +
>  tests/ref/fate/filter-testsrc2-yuv420p |  71 +
>  tests/ref/fate/filter-testsrc2-yuv444p |  71 +
>  7 files changed, 495 insertions(+)
>  create mode 100644 tests/ref/fate/filter-testsrc2-rgb24
>  create mode 100644 tests/ref/fate/filter-testsrc2-yuv420p
>  create mode 100644 tests/ref/fate/filter-testsrc2-yuv444p


Should be fine.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] lavfi: add testsrc2 test source.

2015-10-29 Thread Nicolas George
Le sextidi 6 brumaire, an CCXXIV, Clement Boesch a écrit :
> We have testsrc and mptestsrc so... fftestsrc? or ffmire, miresrc,
> colorfuzz, rainbowlicornsrc, ... or it could also just be a "ffmpeg" mode
> option for testsrc so we could have all sort of mire templates (but that's
> going to be inconsistent with the other smptebars & friends).
> 
> I don't know.

None of these seem really better than testsrc2, they introduce a new
non-intuitive name. For now, I think I will stick to testsrc2.

> BTW, while I'm at it, I think a test source generating 10-12 bits video
> stream would be great for testing purpose. This mire looks like a good
> candidate.

This would be useful indeed. Unfortunately, all the drawutils code is really
8-bits-centric. If someone updates it to work with higher bit depths, then
this source would be able to somewhat make use of it: with a little change,
the diagonal gradient and the noise checkers can make use of the low order
bits.

For high bit depth, I suspect some kind of fractal or other mathematical
pattern generator would be more suited.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] lavfi: add testsrc2 test source.

2015-10-27 Thread Clément Bœsch
On Mon, Oct 26, 2015 at 11:31:58PM +0100, Nicolas George wrote:
> Le quintidi 5 brumaire, an CCXXIV, Clement Boesch a écrit :
> > Same. I also think the noise could get some improvement with a wider
> > color spectrum.
> 
> I agree, but unfortunately, there is no drawutils API to blend a colored
> mask. It would be necessary to write one, and I do not want to spend too
> much effort on this.
> 
> I could change the color pseudo-randomly between the squares instead of
> making just a checkered pattern. Or I could blend random noise in red, then
> green then blue in a random order (alpha blending does not commute). Any
> suggestion?
> 

No idea, sorry.

> Also: I agree that testsrc2 is not the best name ever, but I have no idea
> what to make of it. It could be testsrc with an option to select the mode,
> the default being the old mode (then printing a warning that the default
> will change, then changing the default). Again, what do people prefer?

We have testsrc and mptestsrc so... fftestsrc? or ffmire, miresrc,
colorfuzz, rainbowlicornsrc, ... or it could also just be a "ffmpeg" mode
option for testsrc so we could have all sort of mire templates (but that's
going to be inconsistent with the other smptebars & friends).

I don't know.

[...]

BTW, while I'm at it, I think a test source generating 10-12 bits video
stream would be great for testing purpose. This mire looks like a good
candidate.

-- 
Clément B.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] lavfi: add testsrc2 test source.

2015-10-27 Thread Lou Logan
On Mon, Oct 26, 2015, at 02:31 PM, Nicolas George wrote:
> Also: I agree that testsrc2 is not the best name ever, but I have no idea
> what to make of it.

Just throwing out a few ideas:

* d(u)testsrc  - I realize that sounds like "detest", but it refers to
drawutils
* testpattern
* patternsrc
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] lavfi: add testsrc2 test source.

2015-10-26 Thread Nicolas George
Le quintidi 5 brumaire, an CCXXIV, Clement Boesch a écrit :
> Same. I also think the noise could get some improvement with a wider
> color spectrum.

I agree, but unfortunately, there is no drawutils API to blend a colored
mask. It would be necessary to write one, and I do not want to spend too
much effort on this.

I could change the color pseudo-randomly between the squares instead of
making just a checkered pattern. Or I could blend random noise in red, then
green then blue in a random order (alpha blending does not commute). Any
suggestion?

Also: I agree that testsrc2 is not the best name ever, but I have no idea
what to make of it. It could be testsrc with an option to select the mode,
the default being the old mode (then printing a warning that the default
will change, then changing the default). Again, what do people prefer?

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] lavfi: add testsrc2 test source.

2015-10-26 Thread Clément Bœsch
On Sun, Oct 25, 2015 at 04:06:15PM +, Paul B Mahol wrote:
> On 10/25/15, Nicolas George  wrote:
> > Le quartidi 4 brumaire, an CCXXIV, Nicolas George a ecrit :
> >> Similar to testsrc, but using drawutils and therefore
> >> supporting a lot of pixel formats instead of just rgb24.
> >> This allows using it as input for other tests without
> >> requiring a format conversion.
> >> It is also slightly faster than testsrc for some reason.
> >>
> >> Signed-off-by: Nicolas George 
> >
> > Forgot to add: to see what it looks like without applying and compiling:
> >
> > http://www.normalesup.org/~george/tmp/testsrc2.mp4
> > http://www.normalesup.org/~george/tmp/testsrc2.png
> >
> 
> WOW, really looks nice. I slightly dislike name, have no better
> alternative though.
> 

Same. I also think the noise could get some improvement with a wider
color spectrum.

-- 
Clément B.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] lavfi: add testsrc2 test source.

2015-10-25 Thread Nicolas George
Le quartidi 4 brumaire, an CCXXIV, Nicolas George a écrit :
> Similar to testsrc, but using drawutils and therefore
> supporting a lot of pixel formats instead of just rgb24.
> This allows using it as input for other tests without
> requiring a format conversion.
> It is also slightly faster than testsrc for some reason.
> 
> Signed-off-by: Nicolas George 

Forgot to add: to see what it looks like without applying and compiling:

http://www.normalesup.org/~george/tmp/testsrc2.mp4
http://www.normalesup.org/~george/tmp/testsrc2.png

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] lavfi: add testsrc2 test source.

2015-10-25 Thread Nicolas George
Similar to testsrc, but using drawutils and therefore
supporting a lot of pixel formats instead of just rgb24.
This allows using it as input for other tests without
requiring a format conversion.
It is also slightly faster than testsrc for some reason.

Signed-off-by: Nicolas George 
---
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vsrc_testsrc.c | 271 +
 tests/fate/filter-video.mak|   9 ++
 tests/ref/fate/filter-testsrc2-rgb24   |  71 +
 tests/ref/fate/filter-testsrc2-yuv420p |  71 +
 tests/ref/fate/filter-testsrc2-yuv444p |  71 +
 7 files changed, 495 insertions(+)
 create mode 100644 tests/ref/fate/filter-testsrc2-rgb24
 create mode 100644 tests/ref/fate/filter-testsrc2-yuv420p
 create mode 100644 tests/ref/fate/filter-testsrc2-yuv444p

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 8e776c1..dd4f547 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -263,6 +263,7 @@ OBJS-$(CONFIG_RGBTESTSRC_FILTER) += 
vsrc_testsrc.o
 OBJS-$(CONFIG_SMPTEBARS_FILTER)  += vsrc_testsrc.o
 OBJS-$(CONFIG_SMPTEHDBARS_FILTER)+= vsrc_testsrc.o
 OBJS-$(CONFIG_TESTSRC_FILTER)+= vsrc_testsrc.o
+OBJS-$(CONFIG_TESTSRC2_FILTER)   += vsrc_testsrc.o
 
 OBJS-$(CONFIG_NULLSINK_FILTER)   += vsink_nullsink.o
 
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 9385fdf..8e363a0 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -284,6 +284,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(SMPTEBARS,  smptebars,  vsrc);
 REGISTER_FILTER(SMPTEHDBARS,smptehdbars,vsrc);
 REGISTER_FILTER(TESTSRC,testsrc,vsrc);
+REGISTER_FILTER(TESTSRC2,   testsrc2,   vsrc);
 
 REGISTER_FILTER(NULLSINK,   nullsink,   vsink);
 
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index f63c861..1fca3e7 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -41,6 +41,7 @@
 #include "libavutil/imgutils.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
+#include "libavutil/xga_font_data.h"
 #include "avfilter.h"
 #include "drawutils.h"
 #include "formats.h"
@@ -679,6 +680,276 @@ AVFilter ff_vsrc_testsrc = {
 
 #endif /* CONFIG_TESTSRC_FILTER */
 
+#if CONFIG_TESTSRC2_FILTER
+
+static const AVOption testsrc2_options[] = {
+COMMON_OPTIONS
+{ NULL }
+};
+
+AVFILTER_DEFINE_CLASS(testsrc2);
+
+static void set_color(TestSourceContext *s, FFDrawColor *color, uint32_t argb)
+{
+uint8_t rgba[4] = { (argb >> 16) & 0xFF,
+(argb >>  8) & 0xFF,
+(argb >>  0) & 0xFF,
+(argb >> 24) & 0xFF, };
+ff_draw_color(>draw, color, rgba);
+}
+
+static uint32_t color_gradient(unsigned index)
+{
+unsigned si = index & 0xFF, sd = 0xFF - si;
+switch (index >> 8) {
+case 0: return 0xFF + (si <<  8);
+case 1: return 0x00FF00 + (sd << 16);
+case 2: return 0x00FF00 + (si <<  0);
+case 3: return 0xFF + (sd <<  8);
+case 4: return 0xFF + (si << 16);
+case 5: return 0xFF + (sd <<  0);
+}
+av_assert0(0);
+}
+
+static void draw_text(TestSourceContext *s, AVFrame *frame, FFDrawColor *color,
+  int x0, int y0, const uint8_t *text)
+{
+int x = x0;
+
+for (; *text; text++) {
+if (*text == '\n') {
+x = x0;
+y0 += 16;
+continue;
+}
+ff_blend_mask(>draw, color, frame->data, frame->linesize,
+  frame->width, frame->height,
+  avpriv_vga16_font + *text * 16, 1, 8, 16, 0, 0, x, y0);
+x += 8;
+}
+}
+
+static void test2_fill_picture(AVFilterContext *ctx, AVFrame *frame)
+{
+TestSourceContext *s = ctx->priv;
+FFDrawColor color;
+
+/* colored background */
+{
+unsigned i, x = 0, x2;
+
+x = 0;
+for (i = 1; i < 7; i++) {
+x2 = av_rescale(i, s->w, 6);
+x2 = ff_draw_round_to_sub(>draw, 0, 0, x2);
+set_color(s, , ((i & 1) ? 0xFF : 0) |
+ ((i & 2) ? 0x00FF00 : 0) |
+ ((i & 4) ? 0xFF : 0));
+ff_fill_rectangle(>draw, , frame->data, frame->linesize,
+  x, 0, x2 - x, frame->height);
+x = x2;
+}
+}
+
+/* oblique gradient */
+/* note: too slow if using blending */
+if (s->h >= 64) {
+unsigned x, dx, y0, y, g0, g;
+
+dx = ff_draw_round_to_sub(>draw, 0, +1, 1);
+y0 = av_rescale_q(s->pts, s->time_base, av_make_q(2, s->h - 16));
+g0 = av_rescale_q(s->pts, s->time_base, av_make_q(1, 128));
+for (x = 0; x < s->w; x += dx) {
+g = (av_rescale(x, 6 * 256, 

Re: [FFmpeg-devel] [PATCH 2/2] lavfi: add testsrc2 test source.

2015-10-25 Thread Paul B Mahol
On 10/25/15, Nicolas George  wrote:
> Le quartidi 4 brumaire, an CCXXIV, Nicolas George a ecrit :
>> Similar to testsrc, but using drawutils and therefore
>> supporting a lot of pixel formats instead of just rgb24.
>> This allows using it as input for other tests without
>> requiring a format conversion.
>> It is also slightly faster than testsrc for some reason.
>>
>> Signed-off-by: Nicolas George 
>
> Forgot to add: to see what it looks like without applying and compiling:
>
> http://www.normalesup.org/~george/tmp/testsrc2.mp4
> http://www.normalesup.org/~george/tmp/testsrc2.png
>

WOW, really looks nice. I slightly dislike name, have no better
alternative though.

> Regards,
>
> --
>   Nicolas George
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel