annotate libass/ass_cache.h @ 37195:ac6c37d85d65 default tip

configure: Fix initialization of variable def_local_aligned_32 It contiained the #define of HAVE_LOCAL_ALIGNED_16 instead of HAVE_LOCAL_ALIGNED_32.
author al
date Sun, 28 Sep 2014 18:38:41 +0000
parents 6e7f60f6f9d4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20008
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
1 /*
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
2 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
3 * Copyright (C) 2011 Grigori Goronzy <greg@chown.ath.cx>
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
4 *
26738
588ce97b44f2 Speak of libass instead of MPlayer in the libass license headers.
diego
parents: 26723
diff changeset
5 * This file is part of libass.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
6 *
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
7 * Permission to use, copy, modify, and distribute this software for any
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
8 * purpose with or without fee is hereby granted, provided that the above
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
9 * copyright notice and this permission notice appear in all copies.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
10 *
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 30200
diff changeset
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26723
0f892cd714b2 Use standard license header.
diego
parents: 26138
diff changeset
18 */
20008
fa122b7c71c6 Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents: 19965
diff changeset
19
25897
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
20 #ifndef LIBASS_CACHE_H
aaebaf255b23 Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents: 25535
diff changeset
21 #define LIBASS_CACHE_H
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
22
26138
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
23 #include "ass.h"
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
24 #include "ass_font.h"
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
25 #include "ass_bitmap.h"
74055622161d Add missing header #includes to fix 'make checkheaders'.
diego
parents: 25897
diff changeset
26
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
27 typedef struct cache Cache;
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
28
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
29 // cache values
18937
9e95ac641e77 Initial libass release (without mencoder support).
eugeni
parents:
diff changeset
30
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
31 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
32 Bitmap *bm; // the actual bitmaps
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
33 Bitmap *bm_o;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
34 Bitmap *bm_s;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
35 } BitmapHashValue;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
36
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
37 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
38 unsigned char *a;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
39 unsigned char *b;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
40 } CompositeHashValue;
28789
a0ce88ba2557 Combine adjacent overlapping, translucent glyph borders and shadows to
greg
parents: 28436
diff changeset
41
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
42 typedef struct {
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
43 FT_Library lib;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
44 FT_Outline *outline;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
45 FT_Outline *border;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
46 FT_BBox bbox_scaled; // bbox after scaling, but before rotation
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
47 FT_Vector advance; // 26.6, advance distance to the next outline in line
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
48 int asc, desc; // ascender/descender
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
49 } OutlineHashValue;
28789
a0ce88ba2557 Combine adjacent overlapping, translucent glyph borders and shadows to
greg
parents: 28436
diff changeset
50
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
51 typedef struct {
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
52 FT_Glyph_Metrics metrics;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
53 } GlyphMetricsHashValue;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
54
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
55 // Create definitions for bitmap, outline and composite hash keys
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
56 #define CREATE_STRUCT_DEFINITIONS
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
57 #include "ass_cache_template.h"
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
58
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
59 // Type-specific function pointers
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
60 typedef unsigned(*HashFunction)(void *key, size_t key_size);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
61 typedef size_t(*ItemSize)(void *value, size_t value_size);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
62 typedef unsigned(*HashCompare)(void *a, void *b, size_t key_size);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
63 typedef void(*CacheItemDestructor)(void *key, void *value);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
64
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
65 // cache hash keys
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
66
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
67 typedef struct outline_hash_key {
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
68 enum {
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
69 OUTLINE_GLYPH,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
70 OUTLINE_DRAWING,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
71 } type;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
72 union {
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
73 GlyphHashKey glyph;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
74 DrawingHashKey drawing;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
75 } u;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
76 } OutlineHashKey;
23018
a4517aa83565 Add outline glyph cache (unused yet).
eugeni
parents: 23017
diff changeset
77
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
78 typedef struct bitmap_hash_key {
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
79 enum {
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
80 BITMAP_OUTLINE,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
81 BITMAP_CLIP,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
82 } type;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
83 union {
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
84 OutlineBitmapHashKey outline;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
85 ClipMaskHashKey clip;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
86 } u;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
87 } BitmapHashKey;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
88
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
89 Cache *ass_cache_create(HashFunction hash_func, HashCompare compare_func,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
90 CacheItemDestructor destruct_func, ItemSize size_func,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
91 size_t key_size, size_t value_size);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
92 void *ass_cache_put(Cache *cache, void *key, void *value);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
93 void *ass_cache_get(Cache *cache, void *key);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
94 int ass_cache_empty(Cache *cache, size_t max_size);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
95 void ass_cache_stats(Cache *cache, size_t *size, unsigned *hits,
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
96 unsigned *misses, unsigned *count);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
97 void ass_cache_done(Cache *cache);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
98 Cache *ass_font_cache_create(void);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
99 Cache *ass_outline_cache_create(void);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
100 Cache *ass_glyph_metrics_cache_create(void);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
101 Cache *ass_bitmap_cache_create(void);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
102 Cache *ass_composite_cache_create(void);
23018
a4517aa83565 Add outline glyph cache (unused yet).
eugeni
parents: 23017
diff changeset
103
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents: 29263
diff changeset
104 #endif /* LIBASS_CACHE_H */