diff options
author | Grigori Goronzy <greg@blackbox> | 2009-07-08 00:07:52 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@blackbox> | 2009-07-08 00:07:52 +0200 |
commit | 6302f307524b430992bd7d71036f7b46c702f678 (patch) | |
tree | 614351d90c7ab2e854144cf8a3fcdf04d17cdcbf | |
parent | f54a0cf94853d8372225bb0b45d6bd2b8e4e6fde (diff) | |
download | libass-6302f307524b430992bd7d71036f7b46c702f678.tar.bz2 libass-6302f307524b430992bd7d71036f7b46c702f678.tar.xz |
Turn down subpixel accuracy to 1/8th pixel
Using the full accuracy range of 1/64th pixel seems unnecessary--1/8th
pixel is "good enough". Mask out the three lowest bits to lower cache
and CPU usage; a short test shows that this almost halves the amount
of glyphs with different subpixel shifts being generated and cached.
-rw-r--r-- | libass/ass_render.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c index 19870a5..0317340 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -42,7 +42,8 @@ #define MAX_LINES_INITIAL 64 #define BLUR_MAX_RADIUS 100.0 #define MAX_BE 100 -#define SUBPIXEL_MASK 63 // d6 bitmask for subpixel accuracy adjustment +#define SUBPIXEL_MASK 63 +#define SUBPIXEL_ACCURACY 7 // d6 mask for subpixel accuracy adjustment static int last_render_id = 0; @@ -2895,10 +2896,10 @@ ass_render_event(ass_renderer_t *render_priv, ass_event_t *event, glyph_info_t *g = text_info->glyphs + i; g->hash_key.advance.x = double_to_d6(device_x - (int) device_x + - d6_to_double(g->pos.x & SUBPIXEL_MASK)); + d6_to_double(g->pos.x & SUBPIXEL_MASK)) & ~SUBPIXEL_ACCURACY; g->hash_key.advance.y = double_to_d6(device_y - (int) device_y + - d6_to_double(g->pos.y & SUBPIXEL_MASK)); + d6_to_double(g->pos.y & SUBPIXEL_MASK)) & ~SUBPIXEL_ACCURACY; get_bitmap_glyph(render_priv, text_info->glyphs + i); } |