ScummVM API documentation
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#include "common/util.h"
24
25/* Common memory code used by the Indeo decoder
26 *
27 * Original copyright note: * Intel Indeo 4 (IV41, IV42, etc.) video decoder for ffmpeg
28 * written, produced, and directed by Alan Smithee
29 */
30
31#ifndef IMAGE_CODECS_INDEO_MEM_H
32#define IMAGE_CODECS_INDEO_MEM_H
33
34namespace Image {
35namespace Indeo {
36
37#define FF_ARRAY_ELEMS(a) ARRAYSIZE(a)
38#define FFALIGN(x, a) (((x) + (a)-1) & ~((a)-1))
39#define FFSIGN(a) ((a) > 0 ? 1 : -1)
40#define MAX_INTEGER 0x7ffffff
41
49extern void avFreeP(void *arg);
50
51
67extern void *avReallocF(void *ptr, size_t nelem, size_t elsize);
68
73extern uint16 invertBits(uint16 val, int nbits);
74
78extern uint32 bitswap32(uint32 x);
79
85inline uint8 avClipUint8(int a) {
86 if (a & (~0xFF))
87 return (-a) >> 31;
88 else
89 return a;
90}
91
98inline unsigned avClipUintp2(int a, int p) {
99 if (a & ~((1 << p) - 1))
100 return -a >> 31 & ((1 << p) - 1);
101 else
102 return a;
103}
104
105extern const uint8 ffZigZagDirect[64];
106
107} // End of namespace Indeo
108} // End of namespace Image
109
110#endif