Mercurial > mplayer.hg
comparison libass/ass_render.c @ 28799:65b83aee82fb
Use blur with kernel [[1,2,1], [2,4,2], [1,2,1]] for \be.
This is faster than gaussian blur and similar to vsfilter.
author | greg |
---|---|
date | Fri, 06 Mar 2009 01:17:05 +0000 |
parents | a0ce88ba2557 |
children | 83f8140eb736 |
comparison
equal
deleted
inserted
replaced
28798:60b7ea3da519 | 28799:65b83aee82fb |
---|---|
41 #include "ass_fontconfig.h" | 41 #include "ass_fontconfig.h" |
42 #include "ass_library.h" | 42 #include "ass_library.h" |
43 | 43 |
44 #define MAX_GLYPHS 3000 | 44 #define MAX_GLYPHS 3000 |
45 #define MAX_LINES 300 | 45 #define MAX_LINES 300 |
46 #define BE_RADIUS 1.5 | |
47 #define BLUR_MAX_RADIUS 50.0 | 46 #define BLUR_MAX_RADIUS 50.0 |
48 #define ROUND(x) ((int) ((x) + .5)) | 47 #define ROUND(x) ((int) ((x) + .5)) |
49 | 48 |
50 static int last_render_id = 0; | 49 static int last_render_id = 0; |
51 | 50 |
81 FT_Library ftlibrary; | 80 FT_Library ftlibrary; |
82 fc_instance_t* fontconfig_priv; | 81 fc_instance_t* fontconfig_priv; |
83 ass_settings_t settings; | 82 ass_settings_t settings; |
84 int render_id; | 83 int render_id; |
85 ass_synth_priv_t* synth_priv; | 84 ass_synth_priv_t* synth_priv; |
86 ass_synth_priv_t* synth_priv_blur; | |
87 | 85 |
88 ass_image_t* images_root; // rendering result is stored here | 86 ass_image_t* images_root; // rendering result is stored here |
89 ass_image_t* prev_images_root; | 87 ass_image_t* prev_images_root; |
90 | 88 |
91 event_images_t* eimg; // temporary buffer for sorting rendered events | 89 event_images_t* eimg; // temporary buffer for sorting rendered events |
268 if (!priv) { | 266 if (!priv) { |
269 FT_Done_FreeType(ft); | 267 FT_Done_FreeType(ft); |
270 goto ass_init_exit; | 268 goto ass_init_exit; |
271 } | 269 } |
272 | 270 |
273 priv->synth_priv = ass_synth_init(BE_RADIUS); | 271 priv->synth_priv = ass_synth_init(BLUR_MAX_RADIUS); |
274 priv->synth_priv_blur = ass_synth_init(BLUR_MAX_RADIUS); | |
275 | 272 |
276 priv->library = library; | 273 priv->library = library; |
277 priv->ftlibrary = ft; | 274 priv->ftlibrary = ft; |
278 // images_root and related stuff is zero-filled in calloc | 275 // images_root and related stuff is zero-filled in calloc |
279 | 276 |
1501 // apply rotation | 1498 // apply rotation |
1502 transform_3d(shift, &info->glyph, &info->outline_glyph, info->frx, info->fry, info->frz); | 1499 transform_3d(shift, &info->glyph, &info->outline_glyph, info->frx, info->fry, info->frz); |
1503 | 1500 |
1504 // render glyph | 1501 // render glyph |
1505 error = glyph_to_bitmap(ass_renderer->synth_priv, | 1502 error = glyph_to_bitmap(ass_renderer->synth_priv, |
1506 ass_renderer->synth_priv_blur, | |
1507 info->glyph, info->outline_glyph, | 1503 info->glyph, info->outline_glyph, |
1508 &info->bm, &info->bm_o, | 1504 &info->bm, &info->bm_o, |
1509 &info->bm_s, info->be, info->blur * frame_context.border_scale); | 1505 &info->bm_s, info->be, info->blur * frame_context.border_scale); |
1510 if (error) | 1506 if (error) |
1511 info->symbol = 0; | 1507 info->symbol = 0; |