ScummVM API documentation
msmpeg4_vc1.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#ifndef IMAGE_CODECS_MSMPEG4_VC1_H
23#define IMAGE_CODECS_MSMPEG4_VC1_H
24
25#include "common/scummsys.h"
26
27namespace Image {
28namespace MSMPEG4VC1 {
29
30extern const uint16 ff_msmp4_mb_i_table[64][2];
31extern const uint32 ff_msmp4_dc_tables[2][2][120][2];
32
33} // namespace MSMPEG4VC1
42template<int width>
43inline void putHalfPixels(byte *dst, const byte *src, ptrdiff_t pitch, int height,
44 int mode, bool noRounding, bool average = false) {
45 for (int y = 0; y < height; ++y) {
46 for (int x = 0; x < width; ++x) {
47 int value = src[x];
48 if (mode == 1)
49 value = (src[x] + src[x + 1] + !noRounding) >> 1;
50 else if (mode == 2)
51 value = (src[x] + src[x + pitch] + !noRounding) >> 1;
52 else if (mode == 3)
53 value = (src[x] + src[x + 1] + src[x + pitch] + src[x + pitch + 1] + (noRounding ? 1 : 2)) >> 2;
54 dst[x] = average ? (dst[x] + value + 1) >> 1 : value;
55 }
56 dst += pitch;
57 src += pitch;
58 }
59}
60
61} // namespace Image
62
63#endif