ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mem.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #include "common/scummsys.h"
23 
24 /* Common memory code used by the Indeo decoder
25  *
26  * Original copyright note: * Intel Indeo 4 (IV41, IV42, etc.) video decoder for ffmpeg
27  * written, produced, and directed by Alan Smithee
28  */
29 
30 #ifndef IMAGE_CODECS_INDEO_MEM_H
31 #define IMAGE_CODECS_INDEO_MEM_H
32 
33 namespace Image {
34 namespace Indeo {
35 
36 #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
37 #define FFALIGN(x, a) (((x) + (a)-1) & ~((a)-1))
38 #define FFSIGN(a) ((a) > 0 ? 1 : -1)
39 #define MAX_INTEGER 0x7ffffff
40 
48 extern void avFreeP(void *arg);
49 
50 
66 extern void *avReallocF(void *ptr, size_t nelem, size_t elsize);
67 
72 extern uint16 invertBits(uint16 val, int nbits);
73 
77 extern uint32 bitswap32(uint32 x);
78 
84 inline uint8 avClipUint8(int a) {
85  if (a & (~0xFF))
86  return (-a) >> 31;
87  else
88  return a;
89 }
90 
97 inline unsigned avClipUintp2(int a, int p) {
98  if (a & ~((1 << p) - 1))
99  return -a >> 31 & ((1 << p) - 1);
100  else
101  return a;
102 }
103 
104 extern const uint8 ffZigZagDirect[64];
105 
106 } // End of namespace Indeo
107 } // End of namespace Image
108 
109 #endif
Definition: movie_decoder.h:32