On Mon, Jan 4, 2016 at 5:12 AM, <[email protected]> wrote: > From: Bill Spitzak <[email protected]> > > If GNUPLOT_OUTPUT is set, then you can pipe the output of a pixman-using > program > to gnuplot and get a continuously-updated plot of the horizontal filter. This > works well with demos/scale to test the filter generation. > > The plot is all the different subposition filters shuffled together. This is > misleading in a few cases: > > IMPULSE.BOX - goes up and down as the subfilters have different numbers of > non-zero samples > IMPULSE.TRIANGLE - somewhat crooked for the same reason > 1-wide filters - looks triangular, but a 1-wide box would be more accurate > --- > pixman/pixman-image.c | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > > diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c > index 1ff1a49..69743c4 100644 > --- a/pixman/pixman-image.c > +++ b/pixman/pixman-image.c > @@ -531,6 +531,46 @@ compute_image_info (pixman_image_t *image) > > image->common.flags = flags; > image->common.extended_format_code = code; > +/* If GNUPLOT_OUTPUT is set, then you can pipe the output of a pixman-using > program > + * to gnuplot and get a continuously-updated plot of the horizontal filter. > This > + * works well with demos/scale to test the filter generation. > + * > + * The plot is all the different subposition filters shuffled together. This > is > + * misleading in a few cases: > + * > + * IMPULSE.BOX - goes up and down as the subfilters have different numbers > of non-zero samples > + * IMPULSE.TRIANGLE - somewhat crooked for the same reason > + * 1-wide filters - looks triangular, but a 1-wide box would be more > accurate > + */ > +/* #define GNUPLOT_OUTPUT 1 */ > +#if GNUPLOT_OUTPUT > + if ((flags & FAST_PATH_SEPARABLE_CONVOLUTION_FILTER) && > image->common.filter_params) { > + const pixman_fixed_t* p = image->common.filter_params; > + int width = pixman_fixed_to_int(p[0]); > + int samples = 1 << pixman_fixed_to_int(p[2]); > + int x,y; > + p += 4; > + printf("plot '-' with linespoints\n"); > + printf("%g 0\n", - width * .5); > + for (x = 0; x < width; ++x) { > + for (y = 0; y < samples; ++y) { > + int yy; > + if (width & 1) > + yy = y; > + else if (y >= samples / 2) > + yy = y - samples / 2; > + else > + yy = samples / 2 + y; > + printf("%g %g\n", > + x - width * .5 + (y + .5) * (1.0 / samples), > + pixman_fixed_to_double(p[(yy + 1) * width - x - 1])); > + } > + } > + printf("%g 0\n", width * .5); > + printf("e\n"); > + fflush(stdout); > + } > +#endif > } > > void > -- > 1.9.1 > > _______________________________________________ > Pixman mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/pixman
I get the big picture of this feature, and it seems useful, but we need write this according to standards. I would like to see the following changes: 1. We can do something more nice than a hard-coded #define. Let's add a flag to configure.ac called "enable-gnuplot-output". For something similar, see "enable-timers" in configure.ac. The default will be "no". 2. Take your code and put it in a new function in pixman-utils.c, and make sure the code inside the function is encompassed with #ifdef/#endif around it. In case enable-gluplot-output wasn't called, the function will be an empty function. 3. Call that function from compute_image_info. I guess you will want to call it only if: ((flags & FAST_PATH_SEPARABLE_CONVOLUTION_FILTER) && image->common.filter_params) is true. However, we don't need to put #ifdef around the call itself. I think the above steps will create two patches: - Step 1&2 should be the first patch (Adding the utility). - Step 3 should be the second patch (Using the utility). Is using this is simple as: ./<demo/test binary> | gnuplot ? or is it more complicated than that ? If so, put an example of how to use it in the second commit message. Thanks, Oded _______________________________________________ Pixman mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/pixman
