<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 4, 2016 at 3:25 AM, Oded Gabbay <span dir="ltr"><<a href="mailto:oded.gabbay@gmail.com" target="_blank">oded.gabbay@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, Jan 4, 2016 at 5:12 AM, <<a href="mailto:spitzak@gmail.com">spitzak@gmail.com</a>> wrote:<br>
> From: Bill Spitzak <<a href="mailto:spitzak@gmail.com">spitzak@gmail.com</a>><br>
><br>
> If GNUPLOT_OUTPUT is set, then you can pipe the output of a pixman-using program<br>
> to gnuplot and get a continuously-updated plot of the horizontal filter. This<br>
> works well with demos/scale to test the filter generation.<br>
><br>
> The plot is all the different subposition filters shuffled together. This is<br>
> misleading in a few cases:<br>
><br>
> IMPULSE.BOX - goes up and down as the subfilters have different numbers of non-zero samples<br>
> IMPULSE.TRIANGLE - somewhat crooked for the same reason<br>
> 1-wide filters - looks triangular, but a 1-wide box would be more accurate<br>
> ---<br>
> pixman/pixman-image.c | 40 ++++++++++++++++++++++++++++++++++++++++<br>
> 1 file changed, 40 insertions(+)<br>
><br>
> diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c<br>
> index 1ff1a49..69743c4 100644<br>
> --- a/pixman/pixman-image.c<br>
> +++ b/pixman/pixman-image.c<br>
> @@ -531,6 +531,46 @@ compute_image_info (pixman_image_t *image)<br>
><br>
> image->common.flags = flags;<br>
> image->common.extended_format_code = code;<br>
> +/* If GNUPLOT_OUTPUT is set, then you can pipe the output of a pixman-using program<br>
> + * to gnuplot and get a continuously-updated plot of the horizontal filter. This<br>
> + * works well with demos/scale to test the filter generation.<br>
> + *<br>
> + * The plot is all the different subposition filters shuffled together. This is<br>
> + * misleading in a few cases:<br>
> + *<br>
> + * IMPULSE.BOX - goes up and down as the subfilters have different numbers of non-zero samples<br>
> + * IMPULSE.TRIANGLE - somewhat crooked for the same reason<br>
> + * 1-wide filters - looks triangular, but a 1-wide box would be more accurate<br>
> + */<br>
> +/* #define GNUPLOT_OUTPUT 1 */<br>
> +#if GNUPLOT_OUTPUT<br>
> + if ((flags & FAST_PATH_SEPARABLE_CONVOLUTION_FILTER) && image->common.filter_params) {<br>
> + const pixman_fixed_t* p = image->common.filter_params;<br>
> + int width = pixman_fixed_to_int(p[0]);<br>
> + int samples = 1 << pixman_fixed_to_int(p[2]);<br>
> + int x,y;<br>
> + p += 4;<br>
> + printf("plot '-' with linespoints\n");<br>
> + printf("%g 0\n", - width * .5);<br>
> + for (x = 0; x < width; ++x) {<br>
> + for (y = 0; y < samples; ++y) {<br>
> + int yy;<br>
> + if (width & 1)<br>
> + yy = y;<br>
> + else if (y >= samples / 2)<br>
> + yy = y - samples / 2;<br>
> + else<br>
> + yy = samples / 2 + y;<br>
> + printf("%g %g\n",<br>
> + x - width * .5 + (y + .5) * (1.0 / samples),<br>
> + pixman_fixed_to_double(p[(yy + 1) * width - x - 1]));<br>
> + }<br>
> + }<br>
> + printf("%g 0\n", width * .5);<br>
> + printf("e\n");<br>
> + fflush(stdout);<br>
> + }<br>
> +#endif<br>
> }<br>
><br>
> void<br>
> --<br>
> 1.9.1<br>
><br>
</div></div>> _______________________________________________<br>
> Pixman mailing list<br>
> <a href="mailto:Pixman@lists.freedesktop.org">Pixman@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/pixman" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/pixman</a><br>
<br>
I get the big picture of this feature, and it seems useful, but we<br>
need write this according to standards.<br>
I would like to see the following changes:<br>
<br>
1. We can do something more nice than a hard-coded #define. Let's add<br>
a flag to <a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> called "enable-gnuplot-output". For something<br>
similar, see "enable-timers" in <a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a>. The default will be<br>
"no".<br></blockquote><div><br></div><div>That makes sense. I actually gave up trying to figure out how to set the CFLAGS and was forced to edit the source code to turn this on/off, which meant I often mistakenly checked the code in with it turned on. I guess configure is the way to go. <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2. Take your code and put it in a new function in pixman-utils.c, and<br>
make sure the code inside the function is encompassed with<br>
#ifdef/#endif around it. In case enable-gluplot-output wasn't called,<br>
the function will be an empty function.<br>
<br>
3. Call that function from compute_image_info. I guess you will want<br>
to call it only if:<br>
<span class="">((flags & FAST_PATH_SEPARABLE_CONVOLUTION_FILTER) &&<br>
image->common.filter_params)<br>
</span>is true.<br>
However, we don't need to put #ifdef around the call itself.<br></blockquote><div><br></div><div>I would prefer that there not be a call to the empty function there, and that instead the config option removes the call to it here. In addition the arguments may be non-trivial as I would like this to be able to print filters from a future mulit-resolution data structure, to extract this from the current structure I need to pass the width, subsamples, and pointer to array.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I think the above steps will create two patches:<br>
- Step 1&2 should be the first patch (Adding the utility).<br>
- Step 3 should be the second patch (Using the utility).<br></blockquote><div><br></div><div>Ok. <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is using this is simple as:<br>
./<demo/test binary> | gnuplot ?<br></blockquote><div><br></div><div>Yes that is how it works. It works surprisingly well. It is sometimes useful to go to the gnuplot window and scroll up/down a bit to lock the current zoom. Hit the button with the squiggle on the top to go back to auto-zoom.<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If so, put an example of how to use it in the second commit message.<br>
<br>
Thanks,<br>
<br>
Oded<br>
</blockquote></div><br></div></div>