Mercurial > mplayer.hg
annotate libass/ass_utils.h @ 29267:7b2f34b6ff9a
Simplify find invocation in tags/TAGS generation command:
- Drop '-print', which is the default for find.
- Drop unnecessary invocation of find in a subshell.
author | diego |
---|---|
date | Fri, 15 May 2009 22:24:12 +0000 |
parents | 0366ab2c1cb9 |
children | 48d020c5ceca |
rev | line source |
---|---|
20008
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
18937
diff
changeset
|
1 // -*- c-basic-offset: 8; indent-tabs-mode: t -*- |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
18937
diff
changeset
|
2 // vim:ts=8:sw=8:noet:ai: |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
18937
diff
changeset
|
3 /* |
26723 | 4 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com> |
5 * | |
26738
588ce97b44f2
Speak of libass instead of MPlayer in the libass license headers.
diego
parents:
26723
diff
changeset
|
6 * This file is part of libass. |
26723 | 7 * |
26738
588ce97b44f2
Speak of libass instead of MPlayer in the libass license headers.
diego
parents:
26723
diff
changeset
|
8 * libass is free software; you can redistribute it and/or modify |
26723 | 9 * it under the terms of the GNU General Public License as published by |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
26738
588ce97b44f2
Speak of libass instead of MPlayer in the libass license headers.
diego
parents:
26723
diff
changeset
|
13 * libass is distributed in the hope that it will be useful, |
26723 | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License along | |
26738
588ce97b44f2
Speak of libass instead of MPlayer in the libass license headers.
diego
parents:
26723
diff
changeset
|
19 * with libass; if not, write to the Free Software Foundation, Inc., |
26723 | 20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
21 */ | |
20008
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
18937
diff
changeset
|
22 |
25897
aaebaf255b23
Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents:
25535
diff
changeset
|
23 #ifndef LIBASS_UTILS_H |
aaebaf255b23
Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents:
25535
diff
changeset
|
24 #define LIBASS_UTILS_H |
18937 | 25 |
26138
74055622161d
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26036
diff
changeset
|
26 #include <stdint.h> |
74055622161d
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26036
diff
changeset
|
27 |
28718 | 28 int mystrtoi(char** p, int* res); |
29 int mystrtoll(char** p, long long* res); | |
18937 | 30 int mystrtou32(char** p, int base, uint32_t* res); |
31 int mystrtod(char** p, double* res); | |
32 int strtocolor(char** q, uint32_t* res); | |
28785 | 33 char parse_bool(char* str); |
22213
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
34 |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
35 static inline int d6_to_int(int x) { |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
36 return (x + 32) >> 6; |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
37 } |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
38 static inline int d16_to_int(int x) { |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
39 return (x + 32768) >> 16; |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
40 } |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
41 static inline int int_to_d6(int x) { |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
42 return x << 6; |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
43 } |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
44 static inline int int_to_d16(int x) { |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
45 return x << 16; |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
46 } |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
47 static inline int d16_to_d6(int x) { |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
48 return (x + 512) >> 10; |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
49 } |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
50 static inline int d6_to_d16(int x) { |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
51 return x << 10; |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
52 } |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
53 static inline double d6_to_double(int x) { |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
54 return x / 64.; |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
55 } |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
56 static inline int double_to_d6(double x) { |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
57 return (int)(x * 64); |
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
58 } |
23299
0ee56ec36a40
Limit ass_font_set_transform to nonrotating transformations.
eugeni
parents:
22213
diff
changeset
|
59 static inline double d16_to_double(int x) { |
0ee56ec36a40
Limit ass_font_set_transform to nonrotating transformations.
eugeni
parents:
22213
diff
changeset
|
60 return ((double)x) / 0x10000; |
0ee56ec36a40
Limit ass_font_set_transform to nonrotating transformations.
eugeni
parents:
22213
diff
changeset
|
61 } |
0ee56ec36a40
Limit ass_font_set_transform to nonrotating transformations.
eugeni
parents:
22213
diff
changeset
|
62 static inline int double_to_d16(double x) { |
0ee56ec36a40
Limit ass_font_set_transform to nonrotating transformations.
eugeni
parents:
22213
diff
changeset
|
63 return (int)(x * 0x10000); |
0ee56ec36a40
Limit ass_font_set_transform to nonrotating transformations.
eugeni
parents:
22213
diff
changeset
|
64 } |
22213
66abe12ad374
Move conversions between 16.16, 26.6 fixed point and int, double to separate
eugeni
parents:
20503
diff
changeset
|
65 |
25897
aaebaf255b23
Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents:
25535
diff
changeset
|
66 #endif /* LIBASS_UTILS_H */ |