freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Freetype-devel] Re: GSOC - Distance Fields


From: Anuj Verma
Subject: Re: [Freetype-devel] Re: GSOC - Distance Fields
Date: Sat, 20 Jun 2020 17:08:44 +0530

Hello Alexei,

First thing, here is the result of all the curves after using square distances:

A) Line Segment: ~0.10 microseconds
B) Conic Curves: ~0.75 microseconds
C) Cubic Curves: ~0.71 microseconds

For comparison, the previous result with `FT_Vector_Length':

A) Line Segment: ~0.32 microseconds
B) Conic Bezier: ~1.08 microseconds
C) Cubic Bezier: ~1.25 microseconds

Secondly, I did try subdividing the conic curves, for start I simply divided
them into equal parts and used that to generate SDF. I saw that it require
at least 32 divisions to produce a decent SDF, which in itself is quite slower
than simply solving the cubic equation (and there can be many curves in the
glyph).
Moreover, I overlooked the fact that around the corners there is a corner check
involved, which is done to determine the sign correctly around corners. So,
subdividing the curve also increases that which is around ~0.13 microseconds
for each pixel around the corner.

Looking at this I now think that it's not worth splitting the curve into lines for
generating the SDF. But I think for optimization it can be used, we can use
a coarse grid and subdivided curves to quickly check which line is closer
to the coarse grid, and then for the pixels in the coarse grid we only check
those curves. This will also not require the corver check since we are only
interested in absolute values. I think this can be faster but can't say anything
for sure without profiling.

One more thing, shouldn't it be `minmum level of warnings.' ?
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/src/smooth/ftgrays.c#n441

Thanks,
Anuj

reply via email to

[Prev in Thread] Current Thread [Next in Thread]