ScummVM API documentation
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/*
23 * WMV3 and VC-1 software video decoder.
24 *
25 * This decoder is a ScummVM port of the FFmpeg WMV3/VC-1 decoder path
26 * used by libavcodec revision c23123630e6a7e645c199599b8ade3fe7e9ab3db:
27 * https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/c23123630e6a7e645c199599b8ade3fe7e9ab3db
28 * The original code was Copyright
29 * (c) 2005 Anonymous, Alex Beregszaszi and Michael Niedermayer,
30 * (c) 2006-2007 Konstantin Shishkov,
31 * (c) 2011 Mashiat Sarker Shakkhar and distributed under the GNU LGPL
32 * version 2.1 or later. The migrated path includes sequence and picture
33 * headers, bitplanes, VLC tables, prediction, motion compensation, inverse
34 * transforms, overlap and loop filtering, IntraX8, error concealment,
35 * reference-frame ordering, and YUV420 output.
36 */
37
38#ifndef IMAGE_CODECS_VC1_H
39#define IMAGE_CODECS_VC1_H
40
41#include "common/bitstream.h"
42#include "common/scummsys.h"
43#include "image/codecs/codec.h"
44
45namespace Image {
46
47struct VC1Ratio {
48 int num;
49 int den;
50 constexpr VC1Ratio(int numerator = 0, int denominator = 1) : num(numerator), den(denominator) {}
51};
52
53struct VC1Header {
54 int bitrtq_postproc = 0;
55 int broadcast = 0;
56 int broken_link = 0;
57 int chromaformat = 0;
58 int closed_entry = 0;
59 int color_prim = 0;
60 int dquant = 0;
61 int extended_dmv = 0;
62 int extended_mv = 0;
63 int fastuvmc = 0;
64 int finterpflag = 0;
65 int frmrtq_postproc = 0;
66 int height = 0;
67 int hrd_num_leaky_buckets = 0;
68 int hrd_param_flag = 0;
69 int interlace = 0;
70 int level = 0;
71 int loop_filter = 0;
72 int matrix_coef = 0;
73 int max_b_frames = 0;
74 int max_coded_height = 0;
75 int max_coded_width = 0;
76 int multires = 0;
77 int overlap = 0;
78 int panscanflag = 0;
79 int postprocflag = 0;
80 int profile = 0;
81 int psf = 0;
82 int quantizer_mode = 0;
83 int range_mapuv = 0;
84 int range_mapuv_flag = 0;
85 int range_mapy = 0;
86 int range_mapy_flag = 0;
87 int rangered = 0;
88 int refdist_flag = 0;
89 int res_fasttx = 0;
90 int res_rtm_flag = 0;
91 int res_sprite = 0;
92 int res_transtab = 0;
93 int res_x8 = 0;
94 int res_y411 = 0;
95 int resync_marker = 0;
96 int tfcntrflag = 0;
97 int transfer_char = 0;
98 int vstransform = 0;
99 int width = 0;
100 const uint8 *zz_8x4 = nullptr;
101 const uint8 *zz_4x8 = nullptr;
102 VC1Ratio sample_aspect_ratio;
103 VC1Ratio framerate;
104};
105
106int readVC1Sequence(VC1Header *v, Common::BitStream8MSB *gb);
107int readVC1Entry(VC1Header *v, Common::BitStream8MSB *gb);
108
110public:
111 VC1Bitplane();
112 int decode(uint8 *data, int *rawFlag, int width, int height, int stride, Common::BitStream8MSB *bits) const;
113
114private:
115 uint16 _imode[16];
116 uint16 _norm2[8];
117 uint16 _norm6[8192];
118};
119
120namespace VC1 {
121class Decoder;
122struct Picture;
123} // namespace VC1
125class WMV3Decoder : public Codec {
126public:
127 WMV3Decoder(int width, int height, bool advanced = false);
128 ~WMV3Decoder() override;
134 Graphics::PixelFormat getPixelFormat() const override { return _format; }
135 bool setOutputPixelFormat(const Graphics::PixelFormat &format) override;
136 bool hasError() const;
137
138private:
139 VC1::Decoder *_decoder;
140 Graphics::Surface _surface;
141 Graphics::PixelFormat _format;
142 const Graphics::Surface *convert(const VC1::Picture *picture);
143};
144
145} // namespace Image
146
147#endif // IMAGE_CODECS_VC1_H
Definition: bitstream.h:55
Definition: stream.h:745
Definition: codec.h:57
Definition: vc1.h:109
Definition: vc1.h:125
const Graphics::Surface * drainFrame()
bool setOutputPixelFormat(const Graphics::PixelFormat &format) override
bool setExtraData(Common::SeekableReadStream &stream)
const Graphics::Surface * decodeFrame(Common::SeekableReadStream &stream) override
Graphics::PixelFormat getPixelFormat() const override
Definition: vc1.h:134
Definition: pixelformat.h:138
Definition: surface.h:67
Definition: vc1.h:53
Definition: vc1.h:47