consistency cosmetics
[mplayer/greg.git] / libass / ass_utils.h
blobbe8b3dfa978b2660e23e4cf3a6d06dd29b66c457
1 // -*- c-basic-offset: 8; indent-tabs-mode: t -*-
2 // vim:ts=8:sw=8:noet:ai:
3 /*
4 Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef ASS_UTILS_H
22 #define ASS_UTILS_H
24 int mystrtoi(char** p, int base, int* res);
25 int mystrtou32(char** p, int base, uint32_t* res);
26 int mystrtod(char** p, double* res);
27 int strtocolor(char** q, uint32_t* res);
29 static inline int d6_to_int(int x) {
30 return (x + 32) >> 6;
32 static inline int d16_to_int(int x) {
33 return (x + 32768) >> 16;
35 static inline int int_to_d6(int x) {
36 return x << 6;
38 static inline int int_to_d16(int x) {
39 return x << 16;
41 static inline int d16_to_d6(int x) {
42 return (x + 512) >> 10;
44 static inline int d6_to_d16(int x) {
45 return x << 10;
47 static inline double d6_to_double(int x) {
48 return x / 64.;
50 static inline int double_to_d6(double x) {
51 return (int)(x * 64);
53 static inline double d16_to_double(int x) {
54 return ((double)x) / 0x10000;
56 static inline int double_to_d16(double x) {
57 return (int)(x * 0x10000);
60 #endif /* ASS_UTILS_H */