mirror of
https://github.com/libretro/scummvm.git
synced 2026-11-07 04:26:05 -10:00
VIDEO: Add WMV3/VC-1 support and extract shared MSMPEG4 code
This commit is contained in:
1 parent
10b1c806c7
commit
4fd00b7aa3
9 files changed
+15513
-179
No files matched your search
@@ -315,6 +315,7 @@ _fmtowns_pc98_audio=auto
|
||||
_sid_audio=auto
|
||||
_svq1=auto
|
||||
_truemotion1=auto
|
||||
_vc1=auto
|
||||
_unp64=auto
|
||||
_vgmtrans_audio=auto
|
||||
_xan=auto
|
||||
@@ -368,6 +369,7 @@ add_component tinygl "TinyGL" "_tinygl" "USE_TINYGL"
|
||||
add_component truemotion1 "TrueMotion 1" "_truemotion1" "USE_TRUEMOTION1"
|
||||
add_component universaltracker "External Tracker Libraries" "_universaltracker" "USE_UNIVERSALTRACKER"
|
||||
add_component unp64 "UNP64" "_unp64" "USE_UNP64"
|
||||
add_component vc1 "VC-1 / WMV3" "_vc1" "USE_VC1"
|
||||
add_component vgmtrans_audio "VGMTrans Soundfont audio" "_vgmtrans_audio" "USE_VGMTRANS_AUDIO"
|
||||
add_component xan "XAN" "_xan" "USE_XAN"
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# This file is included from the main "configure" script
|
||||
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
|
||||
add_engine testbed "TestBed: the Testing framework" no "" "" "" "imgui midi universaltracker cdtoons indeo3 indeo45 vpx mpc hnm jyv1 mpeg2 msmpeg4 qdm2 svq1 truemotion1 xan tinygl"
|
||||
add_engine testbed "TestBed: the Testing framework" no "" "" "" "imgui midi universaltracker cdtoons indeo3 indeo45 vpx mpc hnm jyv1 mpeg2 msmpeg4 qdm2 svq1 truemotion1 vc1 xan tinygl"
|
||||
@@ -43,6 +43,9 @@
|
||||
#include "image/codecs/svq1.h"
|
||||
#include "image/codecs/truemotion1.h"
|
||||
#include "image/codecs/xan.h"
|
||||
#ifdef USE_VC1
|
||||
#include "image/codecs/vc1.h"
|
||||
#endif
|
||||
|
||||
#include "common/endian.h"
|
||||
#include "common/system.h"
|
||||
@@ -99,6 +102,24 @@ Codec *createBitmapCodec(uint32 tag, uint32 streamTag, int width, int height, in
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MKTAG('W', 'M', 'V', '3'):
|
||||
case MKTAG('w', 'm', 'v', '3'):
|
||||
#ifdef USE_VC1
|
||||
return new WMV3Decoder(width, height);
|
||||
#else
|
||||
missingCodec = "WMV3";
|
||||
break;
|
||||
#endif
|
||||
case MKTAG('W', 'V', 'C', '1'):
|
||||
case MKTAG('w', 'v', 'c', '1'):
|
||||
case MKTAG('W', 'M', 'V', 'A'):
|
||||
#ifdef USE_VC1
|
||||
return new WMV3Decoder(width, height, true);
|
||||
#else
|
||||
missingCodec = "VC-1";
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MKTAG('I','V','3','2'):
|
||||
#ifdef USE_INDEO3
|
||||
return new Indeo3Decoder(width, height, bitsPerPixel);
|
||||
@@ -212,6 +233,24 @@ Codec *createQuickTimeCodec(uint32 tag, int width, int height, int bitsPerPixel)
|
||||
case MKTAG('r','a','w',' '):
|
||||
// Used my L-Zone-mac (Director game)
|
||||
return new BitmapRawDecoder(width, height, bitsPerPixel, true, true);
|
||||
case MKTAG('W', 'M', 'V', '3'):
|
||||
case MKTAG('w', 'm', 'v', '3'):
|
||||
#ifdef USE_VC1
|
||||
return new WMV3Decoder(width, height);
|
||||
#else
|
||||
missingCodec = "WMV3";
|
||||
break;
|
||||
#endif
|
||||
case MKTAG('W', 'V', 'C', '1'):
|
||||
case MKTAG('w', 'v', 'c', '1'):
|
||||
case MKTAG('W', 'M', 'V', 'A'):
|
||||
#ifdef USE_VC1
|
||||
return new WMV3Decoder(width, height, true);
|
||||
#else
|
||||
missingCodec = "VC-1";
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MKTAG('I','V','3','2'):
|
||||
#ifdef USE_INDEO3
|
||||
// Indeo 3: Used by Team Xtreme: Operation Weather Disaster (Spanish)
|
||||
|
||||
+7
-178
@@ -33,6 +33,7 @@
|
||||
*/
|
||||
|
||||
#include "image/codecs/msmpeg4.h"
|
||||
#include "image/codecs/msmpeg4_vc1.h"
|
||||
|
||||
#include "common/endian.h"
|
||||
#include "common/memstream.h"
|
||||
@@ -422,27 +423,6 @@ const INT8 intra_run[102] = {
|
||||
15, 16, 17, 18, 19, 20,
|
||||
};
|
||||
|
||||
|
||||
/* intra picture macro block coded block pattern */
|
||||
const UINT16 table_mb_intra[64][2] = {
|
||||
{ 0x1, 1 },{ 0x17, 6 },{ 0x9, 5 },{ 0x5, 5 },
|
||||
{ 0x6, 5 },{ 0x47, 9 },{ 0x20, 7 },{ 0x10, 7 },
|
||||
{ 0x2, 5 },{ 0x7c, 9 },{ 0x3a, 7 },{ 0x1d, 7 },
|
||||
{ 0x2, 6 },{ 0xec, 9 },{ 0x77, 8 },{ 0x0, 8 },
|
||||
{ 0x3, 5 },{ 0xb7, 9 },{ 0x2c, 7 },{ 0x13, 7 },
|
||||
{ 0x1, 6 },{ 0x168, 10 },{ 0x46, 8 },{ 0x3f, 8 },
|
||||
{ 0x1e, 6 },{ 0x712, 13 },{ 0xb5, 9 },{ 0x42, 8 },
|
||||
{ 0x22, 7 },{ 0x1c5, 11 },{ 0x11e, 10 },{ 0x87, 9 },
|
||||
{ 0x6, 4 },{ 0x3, 9 },{ 0x1e, 7 },{ 0x1c, 6 },
|
||||
{ 0x12, 7 },{ 0x388, 12 },{ 0x44, 9 },{ 0x70, 9 },
|
||||
{ 0x1f, 6 },{ 0x23e, 11 },{ 0x39, 8 },{ 0x8e, 9 },
|
||||
{ 0x1, 7 },{ 0x1c6, 11 },{ 0xb6, 9 },{ 0x45, 9 },
|
||||
{ 0x14, 6 },{ 0x23f, 11 },{ 0x7d, 9 },{ 0x18, 9 },
|
||||
{ 0x7, 7 },{ 0x1c7, 11 },{ 0x86, 9 },{ 0x19, 9 },
|
||||
{ 0x15, 6 },{ 0x1db, 10 },{ 0x2, 9 },{ 0x46, 9 },
|
||||
{ 0xd, 8 },{ 0x713, 13 },{ 0x1da, 10 },{ 0x169, 10 },
|
||||
};
|
||||
|
||||
/* non intra picture macro block coded block pattern + mb type */
|
||||
const UINT32 table_mb_non_intra[128][2] = {
|
||||
{ 0x40, 7 },{ 0x13c9, 13 },{ 0x9fd, 12 },{ 0x1fc, 15 },
|
||||
@@ -479,142 +459,6 @@ const UINT32 table_mb_non_intra[128][2] = {
|
||||
{ 0x5, 5 },{ 0xb, 10 },{ 0x9c, 8 },{ 0xe, 10 },
|
||||
};
|
||||
|
||||
/* dc table 0 */
|
||||
|
||||
static const UINT32 table0_dc_lum[120][2] = {
|
||||
{ 0x1, 1 },{ 0x1, 2 },{ 0x1, 4 },{ 0x1, 5 },
|
||||
{ 0x5, 5 },{ 0x7, 5 },{ 0x8, 6 },{ 0xc, 6 },
|
||||
{ 0x0, 7 },{ 0x2, 7 },{ 0x12, 7 },{ 0x1a, 7 },
|
||||
{ 0x3, 8 },{ 0x7, 8 },{ 0x27, 8 },{ 0x37, 8 },
|
||||
{ 0x5, 9 },{ 0x4c, 9 },{ 0x6c, 9 },{ 0x6d, 9 },
|
||||
{ 0x8, 10 },{ 0x19, 10 },{ 0x9b, 10 },{ 0x1b, 10 },
|
||||
{ 0x9a, 10 },{ 0x13, 11 },{ 0x34, 11 },{ 0x35, 11 },
|
||||
{ 0x61, 12 },{ 0x48, 13 },{ 0xc4, 13 },{ 0x4a, 13 },
|
||||
{ 0xc6, 13 },{ 0xc7, 13 },{ 0x92, 14 },{ 0x18b, 14 },
|
||||
{ 0x93, 14 },{ 0x183, 14 },{ 0x182, 14 },{ 0x96, 14 },
|
||||
{ 0x97, 14 },{ 0x180, 14 },{ 0x314, 15 },{ 0x315, 15 },
|
||||
{ 0x605, 16 },{ 0x604, 16 },{ 0x606, 16 },{ 0xc0e, 17 },
|
||||
{ 0x303cd, 23 },{ 0x303c9, 23 },{ 0x303c8, 23 },{ 0x303ca, 23 },
|
||||
{ 0x303cb, 23 },{ 0x303cc, 23 },{ 0x303ce, 23 },{ 0x303cf, 23 },
|
||||
{ 0x303d0, 23 },{ 0x303d1, 23 },{ 0x303d2, 23 },{ 0x303d3, 23 },
|
||||
{ 0x303d4, 23 },{ 0x303d5, 23 },{ 0x303d6, 23 },{ 0x303d7, 23 },
|
||||
{ 0x303d8, 23 },{ 0x303d9, 23 },{ 0x303da, 23 },{ 0x303db, 23 },
|
||||
{ 0x303dc, 23 },{ 0x303dd, 23 },{ 0x303de, 23 },{ 0x303df, 23 },
|
||||
{ 0x303e0, 23 },{ 0x303e1, 23 },{ 0x303e2, 23 },{ 0x303e3, 23 },
|
||||
{ 0x303e4, 23 },{ 0x303e5, 23 },{ 0x303e6, 23 },{ 0x303e7, 23 },
|
||||
{ 0x303e8, 23 },{ 0x303e9, 23 },{ 0x303ea, 23 },{ 0x303eb, 23 },
|
||||
{ 0x303ec, 23 },{ 0x303ed, 23 },{ 0x303ee, 23 },{ 0x303ef, 23 },
|
||||
{ 0x303f0, 23 },{ 0x303f1, 23 },{ 0x303f2, 23 },{ 0x303f3, 23 },
|
||||
{ 0x303f4, 23 },{ 0x303f5, 23 },{ 0x303f6, 23 },{ 0x303f7, 23 },
|
||||
{ 0x303f8, 23 },{ 0x303f9, 23 },{ 0x303fa, 23 },{ 0x303fb, 23 },
|
||||
{ 0x303fc, 23 },{ 0x303fd, 23 },{ 0x303fe, 23 },{ 0x303ff, 23 },
|
||||
{ 0x60780, 24 },{ 0x60781, 24 },{ 0x60782, 24 },{ 0x60783, 24 },
|
||||
{ 0x60784, 24 },{ 0x60785, 24 },{ 0x60786, 24 },{ 0x60787, 24 },
|
||||
{ 0x60788, 24 },{ 0x60789, 24 },{ 0x6078a, 24 },{ 0x6078b, 24 },
|
||||
{ 0x6078c, 24 },{ 0x6078d, 24 },{ 0x6078e, 24 },{ 0x6078f, 24 },
|
||||
};
|
||||
|
||||
static const UINT32 table0_dc_chroma[120][2] = {
|
||||
{ 0x0, 2 },{ 0x1, 2 },{ 0x5, 3 },{ 0x9, 4 },
|
||||
{ 0xd, 4 },{ 0x11, 5 },{ 0x1d, 5 },{ 0x1f, 5 },
|
||||
{ 0x21, 6 },{ 0x31, 6 },{ 0x38, 6 },{ 0x33, 6 },
|
||||
{ 0x39, 6 },{ 0x3d, 6 },{ 0x61, 7 },{ 0x79, 7 },
|
||||
{ 0x80, 8 },{ 0xc8, 8 },{ 0xca, 8 },{ 0xf0, 8 },
|
||||
{ 0x81, 8 },{ 0xc0, 8 },{ 0xc9, 8 },{ 0x107, 9 },
|
||||
{ 0x106, 9 },{ 0x196, 9 },{ 0x183, 9 },{ 0x1e3, 9 },
|
||||
{ 0x1e2, 9 },{ 0x20a, 10 },{ 0x20b, 10 },{ 0x609, 11 },
|
||||
{ 0x412, 11 },{ 0x413, 11 },{ 0x60b, 11 },{ 0x411, 11 },
|
||||
{ 0x60a, 11 },{ 0x65f, 11 },{ 0x410, 11 },{ 0x65d, 11 },
|
||||
{ 0x65e, 11 },{ 0xcb8, 12 },{ 0xc10, 12 },{ 0xcb9, 12 },
|
||||
{ 0x1823, 13 },{ 0x3045, 14 },{ 0x6089, 15 },{ 0xc110, 16 },
|
||||
{ 0x304448, 22 },{ 0x304449, 22 },{ 0x30444a, 22 },{ 0x30444b, 22 },
|
||||
{ 0x30444c, 22 },{ 0x30444d, 22 },{ 0x30444e, 22 },{ 0x30444f, 22 },
|
||||
{ 0x304450, 22 },{ 0x304451, 22 },{ 0x304452, 22 },{ 0x304453, 22 },
|
||||
{ 0x304454, 22 },{ 0x304455, 22 },{ 0x304456, 22 },{ 0x304457, 22 },
|
||||
{ 0x304458, 22 },{ 0x304459, 22 },{ 0x30445a, 22 },{ 0x30445b, 22 },
|
||||
{ 0x30445c, 22 },{ 0x30445d, 22 },{ 0x30445e, 22 },{ 0x30445f, 22 },
|
||||
{ 0x304460, 22 },{ 0x304461, 22 },{ 0x304462, 22 },{ 0x304463, 22 },
|
||||
{ 0x304464, 22 },{ 0x304465, 22 },{ 0x304466, 22 },{ 0x304467, 22 },
|
||||
{ 0x304468, 22 },{ 0x304469, 22 },{ 0x30446a, 22 },{ 0x30446b, 22 },
|
||||
{ 0x30446c, 22 },{ 0x30446d, 22 },{ 0x30446e, 22 },{ 0x30446f, 22 },
|
||||
{ 0x304470, 22 },{ 0x304471, 22 },{ 0x304472, 22 },{ 0x304473, 22 },
|
||||
{ 0x304474, 22 },{ 0x304475, 22 },{ 0x304476, 22 },{ 0x304477, 22 },
|
||||
{ 0x304478, 22 },{ 0x304479, 22 },{ 0x30447a, 22 },{ 0x30447b, 22 },
|
||||
{ 0x30447c, 22 },{ 0x30447d, 22 },{ 0x30447e, 22 },{ 0x30447f, 22 },
|
||||
{ 0x608880, 23 },{ 0x608881, 23 },{ 0x608882, 23 },{ 0x608883, 23 },
|
||||
{ 0x608884, 23 },{ 0x608885, 23 },{ 0x608886, 23 },{ 0x608887, 23 },
|
||||
{ 0x608888, 23 },{ 0x608889, 23 },{ 0x60888a, 23 },{ 0x60888b, 23 },
|
||||
{ 0x60888c, 23 },{ 0x60888d, 23 },{ 0x60888e, 23 },{ 0x60888f, 23 },
|
||||
};
|
||||
|
||||
/* dc table 1 */
|
||||
|
||||
const UINT32 table1_dc_lum[120][2] = {
|
||||
{ 0x2, 2 },{ 0x3, 2 },{ 0x3, 3 },{ 0x2, 4 },
|
||||
{ 0x5, 4 },{ 0x1, 5 },{ 0x3, 5 },{ 0x8, 5 },
|
||||
{ 0x0, 6 },{ 0x5, 6 },{ 0xd, 6 },{ 0xf, 6 },
|
||||
{ 0x13, 6 },{ 0x8, 7 },{ 0x18, 7 },{ 0x1c, 7 },
|
||||
{ 0x24, 7 },{ 0x4, 8 },{ 0x6, 8 },{ 0x12, 8 },
|
||||
{ 0x32, 8 },{ 0x3b, 8 },{ 0x4a, 8 },{ 0x4b, 8 },
|
||||
{ 0xb, 9 },{ 0x26, 9 },{ 0x27, 9 },{ 0x66, 9 },
|
||||
{ 0x74, 9 },{ 0x75, 9 },{ 0x14, 10 },{ 0x1c, 10 },
|
||||
{ 0x1f, 10 },{ 0x1d, 10 },{ 0x2b, 11 },{ 0x3d, 11 },
|
||||
{ 0x19d, 11 },{ 0x19f, 11 },{ 0x54, 12 },{ 0x339, 12 },
|
||||
{ 0x338, 12 },{ 0x33d, 12 },{ 0xab, 13 },{ 0xf1, 13 },
|
||||
{ 0x678, 13 },{ 0xf2, 13 },{ 0x1e0, 14 },{ 0x1e1, 14 },
|
||||
{ 0x154, 14 },{ 0xcf2, 14 },{ 0x3cc, 15 },{ 0x2ab, 15 },
|
||||
{ 0x19e7, 15 },{ 0x3ce, 15 },{ 0x19e6, 15 },{ 0x554, 16 },
|
||||
{ 0x79f, 16 },{ 0x555, 16 },{ 0xf3d, 17 },{ 0xf37, 17 },
|
||||
{ 0xf3c, 17 },{ 0xf35, 17 },{ 0x1e6d, 18 },{ 0x1e68, 18 },
|
||||
{ 0x3cd8, 19 },{ 0x3cd3, 19 },{ 0x3cd9, 19 },{ 0x79a4, 20 },
|
||||
{ 0xf34ba, 25 },{ 0xf34b4, 25 },{ 0xf34b5, 25 },{ 0xf34b6, 25 },
|
||||
{ 0xf34b7, 25 },{ 0xf34b8, 25 },{ 0xf34b9, 25 },{ 0xf34bb, 25 },
|
||||
{ 0xf34bc, 25 },{ 0xf34bd, 25 },{ 0xf34be, 25 },{ 0xf34bf, 25 },
|
||||
{ 0x1e6940, 26 },{ 0x1e6941, 26 },{ 0x1e6942, 26 },{ 0x1e6943, 26 },
|
||||
{ 0x1e6944, 26 },{ 0x1e6945, 26 },{ 0x1e6946, 26 },{ 0x1e6947, 26 },
|
||||
{ 0x1e6948, 26 },{ 0x1e6949, 26 },{ 0x1e694a, 26 },{ 0x1e694b, 26 },
|
||||
{ 0x1e694c, 26 },{ 0x1e694d, 26 },{ 0x1e694e, 26 },{ 0x1e694f, 26 },
|
||||
{ 0x1e6950, 26 },{ 0x1e6951, 26 },{ 0x1e6952, 26 },{ 0x1e6953, 26 },
|
||||
{ 0x1e6954, 26 },{ 0x1e6955, 26 },{ 0x1e6956, 26 },{ 0x1e6957, 26 },
|
||||
{ 0x1e6958, 26 },{ 0x1e6959, 26 },{ 0x1e695a, 26 },{ 0x1e695b, 26 },
|
||||
{ 0x1e695c, 26 },{ 0x1e695d, 26 },{ 0x1e695e, 26 },{ 0x1e695f, 26 },
|
||||
{ 0x1e6960, 26 },{ 0x1e6961, 26 },{ 0x1e6962, 26 },{ 0x1e6963, 26 },
|
||||
{ 0x1e6964, 26 },{ 0x1e6965, 26 },{ 0x1e6966, 26 },{ 0x1e6967, 26 },
|
||||
};
|
||||
|
||||
const UINT32 table1_dc_chroma[120][2] = {
|
||||
{ 0x0, 2 },{ 0x1, 2 },{ 0x4, 3 },{ 0x7, 3 },
|
||||
{ 0xb, 4 },{ 0xd, 4 },{ 0x15, 5 },{ 0x28, 6 },
|
||||
{ 0x30, 6 },{ 0x32, 6 },{ 0x52, 7 },{ 0x62, 7 },
|
||||
{ 0x66, 7 },{ 0xa6, 8 },{ 0xc6, 8 },{ 0xcf, 8 },
|
||||
{ 0x14f, 9 },{ 0x18e, 9 },{ 0x19c, 9 },{ 0x29d, 10 },
|
||||
{ 0x33a, 10 },{ 0x538, 11 },{ 0x63c, 11 },{ 0x63e, 11 },
|
||||
{ 0x63f, 11 },{ 0x676, 11 },{ 0xa73, 12 },{ 0xc7a, 12 },
|
||||
{ 0xcef, 12 },{ 0x14e5, 13 },{ 0x19dd, 13 },{ 0x29c8, 14 },
|
||||
{ 0x29c9, 14 },{ 0x63dd, 15 },{ 0x33b8, 14 },{ 0x33b9, 14 },
|
||||
{ 0xc7b6, 16 },{ 0x63d8, 15 },{ 0x63df, 15 },{ 0xc7b3, 16 },
|
||||
{ 0xc7b4, 16 },{ 0xc7b5, 16 },{ 0x63de, 15 },{ 0xc7b7, 16 },
|
||||
{ 0xc7b8, 16 },{ 0xc7b9, 16 },{ 0x18f65, 17 },{ 0x31ec8, 18 },
|
||||
{ 0xc7b248, 24 },{ 0xc7b249, 24 },{ 0xc7b24a, 24 },{ 0xc7b24b, 24 },
|
||||
{ 0xc7b24c, 24 },{ 0xc7b24d, 24 },{ 0xc7b24e, 24 },{ 0xc7b24f, 24 },
|
||||
{ 0xc7b250, 24 },{ 0xc7b251, 24 },{ 0xc7b252, 24 },{ 0xc7b253, 24 },
|
||||
{ 0xc7b254, 24 },{ 0xc7b255, 24 },{ 0xc7b256, 24 },{ 0xc7b257, 24 },
|
||||
{ 0xc7b258, 24 },{ 0xc7b259, 24 },{ 0xc7b25a, 24 },{ 0xc7b25b, 24 },
|
||||
{ 0xc7b25c, 24 },{ 0xc7b25d, 24 },{ 0xc7b25e, 24 },{ 0xc7b25f, 24 },
|
||||
{ 0xc7b260, 24 },{ 0xc7b261, 24 },{ 0xc7b262, 24 },{ 0xc7b263, 24 },
|
||||
{ 0xc7b264, 24 },{ 0xc7b265, 24 },{ 0xc7b266, 24 },{ 0xc7b267, 24 },
|
||||
{ 0xc7b268, 24 },{ 0xc7b269, 24 },{ 0xc7b26a, 24 },{ 0xc7b26b, 24 },
|
||||
{ 0xc7b26c, 24 },{ 0xc7b26d, 24 },{ 0xc7b26e, 24 },{ 0xc7b26f, 24 },
|
||||
{ 0xc7b270, 24 },{ 0xc7b271, 24 },{ 0xc7b272, 24 },{ 0xc7b273, 24 },
|
||||
{ 0xc7b274, 24 },{ 0xc7b275, 24 },{ 0xc7b276, 24 },{ 0xc7b277, 24 },
|
||||
{ 0xc7b278, 24 },{ 0xc7b279, 24 },{ 0xc7b27a, 24 },{ 0xc7b27b, 24 },
|
||||
{ 0xc7b27c, 24 },{ 0xc7b27d, 24 },{ 0xc7b27e, 24 },{ 0xc7b27f, 24 },
|
||||
{ 0x18f6480, 25 },{ 0x18f6481, 25 },{ 0x18f6482, 25 },{ 0x18f6483, 25 },
|
||||
{ 0x18f6484, 25 },{ 0x18f6485, 25 },{ 0x18f6486, 25 },{ 0x18f6487, 25 },
|
||||
{ 0x18f6488, 25 },{ 0x18f6489, 25 },{ 0x18f648a, 25 },{ 0x18f648b, 25 },
|
||||
{ 0x18f648c, 25 },{ 0x18f648d, 25 },{ 0x18f648e, 25 },{ 0x18f648f, 25 },
|
||||
};
|
||||
|
||||
/* vlc table 0, for intra luma */
|
||||
|
||||
static const UINT16 table0_vlc[133][2] = {
|
||||
@@ -3323,12 +3167,12 @@ static void initMsmpeg4Tables() {
|
||||
MVTable *mv = &mv_tables[i];
|
||||
initVlc(&mv->vlc, 9, mv->n + 1, mv->table_mv_bits, 1, 1, mv->table_mv_code, 2, 2);
|
||||
}
|
||||
initVlc(&gDcLumVlc[0], 9, 120, &table0_dc_lum[0][1], 8, 4, &table0_dc_lum[0][0], 8, 4);
|
||||
initVlc(&gDcChromaVlc[0], 9, 120, &table0_dc_chroma[0][1], 8, 4, &table0_dc_chroma[0][0], 8, 4);
|
||||
initVlc(&gDcLumVlc[1], 9, 120, &table1_dc_lum[0][1], 8, 4, &table1_dc_lum[0][0], 8, 4);
|
||||
initVlc(&gDcChromaVlc[1], 9, 120, &table1_dc_chroma[0][1], 8, 4, &table1_dc_chroma[0][0], 8, 4);
|
||||
initVlc(&gDcLumVlc[0], 9, 120, &MSMPEG4VC1::ff_msmp4_dc_tables[0][0][0][1], 8, 4, &MSMPEG4VC1::ff_msmp4_dc_tables[0][0][0][0], 8, 4);
|
||||
initVlc(&gDcChromaVlc[0], 9, 120, &MSMPEG4VC1::ff_msmp4_dc_tables[0][1][0][1], 8, 4, &MSMPEG4VC1::ff_msmp4_dc_tables[0][1][0][0], 8, 4);
|
||||
initVlc(&gDcLumVlc[1], 9, 120, &MSMPEG4VC1::ff_msmp4_dc_tables[1][0][0][1], 8, 4, &MSMPEG4VC1::ff_msmp4_dc_tables[1][0][0][0], 8, 4);
|
||||
initVlc(&gDcChromaVlc[1], 9, 120, &MSMPEG4VC1::ff_msmp4_dc_tables[1][1][0][1], 8, 4, &MSMPEG4VC1::ff_msmp4_dc_tables[1][1][0][0], 8, 4);
|
||||
initVlc(&gMbNonIntraVlc, 9, 128, &table_mb_non_intra[0][1], 8, 4, &table_mb_non_intra[0][0], 8, 4);
|
||||
initVlc(&gMbIntraVlc, 9, 64, &table_mb_intra[0][1], 4, 2, &table_mb_intra[0][0], 4, 2);
|
||||
initVlc(&gMbIntraVlc, 9, 64, &MSMPEG4VC1::ff_msmp4_mb_i_table[0][1], 4, 2, &MSMPEG4VC1::ff_msmp4_mb_i_table[0][0], 4, 2);
|
||||
}
|
||||
|
||||
} // End of namespace
|
||||
@@ -3931,22 +3775,7 @@ void MSMPEG4Decoder::frameEnd() {
|
||||
}
|
||||
|
||||
static void putPixels(byte *dst, const byte *src, int pitch, int h, int mode, bool noRounding) {
|
||||
for (int y = 0; y < h; ++y) {
|
||||
for (int x = 0; x < 8; ++x) {
|
||||
int value;
|
||||
if (mode == 0)
|
||||
value = src[x];
|
||||
else if (mode == 1)
|
||||
value = noRounding ? ((src[x] + src[x + 1]) >> 1) : ((src[x] + src[x + 1] + 1) >> 1);
|
||||
else if (mode == 2)
|
||||
value = noRounding ? ((src[x] + src[x + pitch]) >> 1) : ((src[x] + src[x + pitch] + 1) >> 1);
|
||||
else
|
||||
value = noRounding ? ((src[x] + src[x + 1] + src[x + pitch] + src[x + pitch + 1] + 1) >> 2) : ((src[x] + src[x + 1] + src[x + pitch] + src[x + pitch + 1] + 2) >> 2);
|
||||
dst[x] = value;
|
||||
}
|
||||
dst += pitch;
|
||||
src += pitch;
|
||||
}
|
||||
putHalfPixels<8>(dst, src, pitch, h, mode, noRounding);
|
||||
}
|
||||
|
||||
static void motionCompensatePlane(byte *dst, const byte *ref, int dstPitch, int refPitch, int dstX, int dstY,
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Shared Microsoft MPEG-4 and VC-1 decoding tables.
|
||||
*
|
||||
* These tables are a ScummVM port of libavcodec/msmpeg4_vc1_data.c
|
||||
* from FFmpeg revision c23123630e6a7e645c199599b8ade3fe7e9ab3db:
|
||||
* https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/c23123630e6a7e645c199599b8ade3fe7e9ab3db
|
||||
* The original code was Copyright (c) 2001 Fabrice Bellard and
|
||||
* (c) 2002-2004 Michael Niedermayer <[email protected]>, distributed under
|
||||
* the GNU LGPL version 2.1 or later. The shared tables contain the DC
|
||||
* differential codes and intra-picture macroblock coded block patterns.
|
||||
*/
|
||||
|
||||
#include "image/codecs/msmpeg4_vc1.h"
|
||||
|
||||
namespace Image {
|
||||
namespace MSMPEG4VC1 {
|
||||
|
||||
/* intra picture macro block coded block pattern */
|
||||
const uint16 ff_msmp4_mb_i_table[64][2] = {
|
||||
{0x1, 1}, {0x17, 6}, {0x9, 5}, {0x5, 5}, {0x6, 5}, {0x47, 9}, {0x20, 7}, {0x10, 7},
|
||||
{0x2, 5}, {0x7c, 9}, {0x3a, 7}, {0x1d, 7}, {0x2, 6}, {0xec, 9}, {0x77, 8}, {0x0, 8},
|
||||
{0x3, 5}, {0xb7, 9}, {0x2c, 7}, {0x13, 7}, {0x1, 6}, {0x168, 10}, {0x46, 8}, {0x3f, 8},
|
||||
{0x1e, 6}, {0x712, 13}, {0xb5, 9}, {0x42, 8}, {0x22, 7}, {0x1c5, 11}, {0x11e, 10}, {0x87, 9},
|
||||
{0x6, 4}, {0x3, 9}, {0x1e, 7}, {0x1c, 6}, {0x12, 7}, {0x388, 12}, {0x44, 9}, {0x70, 9},
|
||||
{0x1f, 6}, {0x23e, 11}, {0x39, 8}, {0x8e, 9}, {0x1, 7}, {0x1c6, 11}, {0xb6, 9}, {0x45, 9},
|
||||
{0x14, 6}, {0x23f, 11}, {0x7d, 9}, {0x18, 9}, {0x7, 7}, {0x1c7, 11}, {0x86, 9}, {0x19, 9},
|
||||
{0x15, 6}, {0x1db, 10}, {0x2, 9}, {0x46, 9}, {0xd, 8}, {0x713, 13}, {0x1da, 10}, {0x169, 10},
|
||||
};
|
||||
const uint32 ff_msmp4_dc_tables[2][2][120][2] = {
|
||||
/* dc table 0 */
|
||||
{ {
|
||||
{0x1, 1}, {0x1, 2}, {0x1, 4}, {0x1, 5}, {0x5, 5}, {0x7, 5}, {0x8, 6},
|
||||
{0xc, 6}, {0x0, 7}, {0x2, 7}, {0x12, 7}, {0x1a, 7}, {0x3, 8}, {0x7, 8},
|
||||
{0x27, 8}, {0x37, 8}, {0x5, 9}, {0x4c, 9}, {0x6c, 9}, {0x6d, 9}, {0x8, 10},
|
||||
{0x19, 10}, {0x9b, 10}, {0x1b, 10}, {0x9a, 10}, {0x13, 11}, {0x34, 11}, {0x35, 11},
|
||||
{0x61, 12}, {0x48, 13}, {0xc4, 13}, {0x4a, 13}, {0xc6, 13}, {0xc7, 13}, {0x92, 14},
|
||||
{0x18b, 14}, {0x93, 14}, {0x183, 14}, {0x182, 14}, {0x96, 14}, {0x97, 14}, {0x180, 14},
|
||||
{0x314, 15}, {0x315, 15}, {0x605, 16}, {0x604, 16}, {0x606, 16}, {0xc0e, 17}, {0x303cd, 23},
|
||||
{0x303c9, 23}, {0x303c8, 23}, {0x303ca, 23}, {0x303cb, 23}, {0x303cc, 23}, {0x303ce, 23}, {0x303cf, 23},
|
||||
{0x303d0, 23}, {0x303d1, 23}, {0x303d2, 23}, {0x303d3, 23}, {0x303d4, 23}, {0x303d5, 23}, {0x303d6, 23},
|
||||
{0x303d7, 23}, {0x303d8, 23}, {0x303d9, 23}, {0x303da, 23}, {0x303db, 23}, {0x303dc, 23}, {0x303dd, 23},
|
||||
{0x303de, 23}, {0x303df, 23}, {0x303e0, 23}, {0x303e1, 23}, {0x303e2, 23}, {0x303e3, 23}, {0x303e4, 23},
|
||||
{0x303e5, 23}, {0x303e6, 23}, {0x303e7, 23}, {0x303e8, 23}, {0x303e9, 23}, {0x303ea, 23}, {0x303eb, 23},
|
||||
{0x303ec, 23}, {0x303ed, 23}, {0x303ee, 23}, {0x303ef, 23}, {0x303f0, 23}, {0x303f1, 23}, {0x303f2, 23},
|
||||
{0x303f3, 23}, {0x303f4, 23}, {0x303f5, 23}, {0x303f6, 23}, {0x303f7, 23}, {0x303f8, 23}, {0x303f9, 23},
|
||||
{0x303fa, 23}, {0x303fb, 23}, {0x303fc, 23}, {0x303fd, 23}, {0x303fe, 23}, {0x303ff, 23}, {0x60780, 24},
|
||||
{0x60781, 24}, {0x60782, 24}, {0x60783, 24}, {0x60784, 24}, {0x60785, 24}, {0x60786, 24}, {0x60787, 24},
|
||||
{0x60788, 24}, {0x60789, 24}, {0x6078a, 24}, {0x6078b, 24}, {0x6078c, 24}, {0x6078d, 24}, {0x6078e, 24},
|
||||
{0x6078f, 24},
|
||||
},
|
||||
{
|
||||
{0x0, 2}, {0x1, 2}, {0x5, 3}, {0x9, 4}, {0xd, 4}, {0x11, 5}, {0x1d, 5},
|
||||
{0x1f, 5}, {0x21, 6}, {0x31, 6}, {0x38, 6}, {0x33, 6}, {0x39, 6}, {0x3d, 6},
|
||||
{0x61, 7}, {0x79, 7}, {0x80, 8}, {0xc8, 8}, {0xca, 8}, {0xf0, 8}, {0x81, 8},
|
||||
{0xc0, 8}, {0xc9, 8}, {0x107, 9}, {0x106, 9}, {0x196, 9}, {0x183, 9}, {0x1e3, 9},
|
||||
{0x1e2, 9}, {0x20a, 10}, {0x20b, 10}, {0x609, 11}, {0x412, 11}, {0x413, 11}, {0x60b, 11},
|
||||
{0x411, 11}, {0x60a, 11}, {0x65f, 11}, {0x410, 11}, {0x65d, 11}, {0x65e, 11}, {0xcb8, 12},
|
||||
{0xc10, 12}, {0xcb9, 12}, {0x1823, 13}, {0x3045, 14}, {0x6089, 15}, {0xc110, 16}, {0x304448, 22},
|
||||
{0x304449, 22}, {0x30444a, 22}, {0x30444b, 22}, {0x30444c, 22}, {0x30444d, 22}, {0x30444e, 22}, {0x30444f, 22},
|
||||
{0x304450, 22}, {0x304451, 22}, {0x304452, 22}, {0x304453, 22}, {0x304454, 22}, {0x304455, 22}, {0x304456, 22},
|
||||
{0x304457, 22}, {0x304458, 22}, {0x304459, 22}, {0x30445a, 22}, {0x30445b, 22}, {0x30445c, 22}, {0x30445d, 22},
|
||||
{0x30445e, 22}, {0x30445f, 22}, {0x304460, 22}, {0x304461, 22}, {0x304462, 22}, {0x304463, 22}, {0x304464, 22},
|
||||
{0x304465, 22}, {0x304466, 22}, {0x304467, 22}, {0x304468, 22}, {0x304469, 22}, {0x30446a, 22}, {0x30446b, 22},
|
||||
{0x30446c, 22}, {0x30446d, 22}, {0x30446e, 22}, {0x30446f, 22}, {0x304470, 22}, {0x304471, 22}, {0x304472, 22},
|
||||
{0x304473, 22}, {0x304474, 22}, {0x304475, 22}, {0x304476, 22}, {0x304477, 22}, {0x304478, 22}, {0x304479, 22},
|
||||
{0x30447a, 22}, {0x30447b, 22}, {0x30447c, 22}, {0x30447d, 22}, {0x30447e, 22}, {0x30447f, 22}, {0x608880, 23},
|
||||
{0x608881, 23}, {0x608882, 23}, {0x608883, 23}, {0x608884, 23}, {0x608885, 23}, {0x608886, 23}, {0x608887, 23},
|
||||
{0x608888, 23}, {0x608889, 23}, {0x60888a, 23}, {0x60888b, 23}, {0x60888c, 23}, {0x60888d, 23}, {0x60888e, 23},
|
||||
{0x60888f, 23},
|
||||
}},
|
||||
/* dc table 1 */
|
||||
{ {
|
||||
{0x2, 2}, {0x3, 2}, {0x3, 3}, {0x2, 4}, {0x5, 4}, {0x1, 5}, {0x3, 5},
|
||||
{0x8, 5}, {0x0, 6}, {0x5, 6}, {0xd, 6}, {0xf, 6}, {0x13, 6}, {0x8, 7},
|
||||
{0x18, 7}, {0x1c, 7}, {0x24, 7}, {0x4, 8}, {0x6, 8}, {0x12, 8}, {0x32, 8},
|
||||
{0x3b, 8}, {0x4a, 8}, {0x4b, 8}, {0xb, 9}, {0x26, 9}, {0x27, 9}, {0x66, 9},
|
||||
{0x74, 9}, {0x75, 9}, {0x14, 10}, {0x1c, 10}, {0x1f, 10}, {0x1d, 10}, {0x2b, 11},
|
||||
{0x3d, 11}, {0x19d, 11}, {0x19f, 11}, {0x54, 12}, {0x339, 12}, {0x338, 12}, {0x33d, 12},
|
||||
{0xab, 13}, {0xf1, 13}, {0x678, 13}, {0xf2, 13}, {0x1e0, 14}, {0x1e1, 14}, {0x154, 14},
|
||||
{0xcf2, 14}, {0x3cc, 15}, {0x2ab, 15}, {0x19e7, 15}, {0x3ce, 15}, {0x19e6, 15}, {0x554, 16},
|
||||
{0x79f, 16}, {0x555, 16}, {0xf3d, 17}, {0xf37, 17}, {0xf3c, 17}, {0xf35, 17}, {0x1e6d, 18},
|
||||
{0x1e68, 18}, {0x3cd8, 19}, {0x3cd3, 19}, {0x3cd9, 19}, {0x79a4, 20}, {0xf34ba, 25}, {0xf34b4, 25},
|
||||
{0xf34b5, 25}, {0xf34b6, 25}, {0xf34b7, 25}, {0xf34b8, 25}, {0xf34b9, 25}, {0xf34bb, 25}, {0xf34bc, 25},
|
||||
{0xf34bd, 25}, {0xf34be, 25}, {0xf34bf, 25}, {0x1e6940, 26}, {0x1e6941, 26}, {0x1e6942, 26}, {0x1e6943, 26},
|
||||
{0x1e6944, 26}, {0x1e6945, 26}, {0x1e6946, 26}, {0x1e6947, 26}, {0x1e6948, 26}, {0x1e6949, 26}, {0x1e694a, 26},
|
||||
{0x1e694b, 26}, {0x1e694c, 26}, {0x1e694d, 26}, {0x1e694e, 26}, {0x1e694f, 26}, {0x1e6950, 26}, {0x1e6951, 26},
|
||||
{0x1e6952, 26}, {0x1e6953, 26}, {0x1e6954, 26}, {0x1e6955, 26}, {0x1e6956, 26}, {0x1e6957, 26}, {0x1e6958, 26},
|
||||
{0x1e6959, 26}, {0x1e695a, 26}, {0x1e695b, 26}, {0x1e695c, 26}, {0x1e695d, 26}, {0x1e695e, 26}, {0x1e695f, 26},
|
||||
{0x1e6960, 26}, {0x1e6961, 26}, {0x1e6962, 26}, {0x1e6963, 26}, {0x1e6964, 26}, {0x1e6965, 26}, {0x1e6966, 26},
|
||||
{0x1e6967, 26},
|
||||
},
|
||||
{
|
||||
{0x0, 2}, {0x1, 2}, {0x4, 3}, {0x7, 3}, {0xb, 4}, {0xd, 4},
|
||||
{0x15, 5}, {0x28, 6}, {0x30, 6}, {0x32, 6}, {0x52, 7}, {0x62, 7},
|
||||
{0x66, 7}, {0xa6, 8}, {0xc6, 8}, {0xcf, 8}, {0x14f, 9}, {0x18e, 9},
|
||||
{0x19c, 9}, {0x29d, 10}, {0x33a, 10}, {0x538, 11}, {0x63c, 11}, {0x63e, 11},
|
||||
{0x63f, 11}, {0x676, 11}, {0xa73, 12}, {0xc7a, 12}, {0xcef, 12}, {0x14e5, 13},
|
||||
{0x19dd, 13}, {0x29c8, 14}, {0x29c9, 14}, {0x63dd, 15}, {0x33b8, 14}, {0x33b9, 14},
|
||||
{0xc7b6, 16}, {0x63d8, 15}, {0x63df, 15}, {0xc7b3, 16}, {0xc7b4, 16}, {0xc7b5, 16},
|
||||
{0x63de, 15}, {0xc7b7, 16}, {0xc7b8, 16}, {0xc7b9, 16}, {0x18f65, 17}, {0x31ec8, 18},
|
||||
{0xc7b248, 24}, {0xc7b249, 24}, {0xc7b24a, 24}, {0xc7b24b, 24}, {0xc7b24c, 24}, {0xc7b24d, 24},
|
||||
{0xc7b24e, 24}, {0xc7b24f, 24}, {0xc7b250, 24}, {0xc7b251, 24}, {0xc7b252, 24}, {0xc7b253, 24},
|
||||
{0xc7b254, 24}, {0xc7b255, 24}, {0xc7b256, 24}, {0xc7b257, 24}, {0xc7b258, 24}, {0xc7b259, 24},
|
||||
{0xc7b25a, 24}, {0xc7b25b, 24}, {0xc7b25c, 24}, {0xc7b25d, 24}, {0xc7b25e, 24}, {0xc7b25f, 24},
|
||||
{0xc7b260, 24}, {0xc7b261, 24}, {0xc7b262, 24}, {0xc7b263, 24}, {0xc7b264, 24}, {0xc7b265, 24},
|
||||
{0xc7b266, 24}, {0xc7b267, 24}, {0xc7b268, 24}, {0xc7b269, 24}, {0xc7b26a, 24}, {0xc7b26b, 24},
|
||||
{0xc7b26c, 24}, {0xc7b26d, 24}, {0xc7b26e, 24}, {0xc7b26f, 24}, {0xc7b270, 24}, {0xc7b271, 24},
|
||||
{0xc7b272, 24}, {0xc7b273, 24}, {0xc7b274, 24}, {0xc7b275, 24}, {0xc7b276, 24}, {0xc7b277, 24},
|
||||
{0xc7b278, 24}, {0xc7b279, 24}, {0xc7b27a, 24}, {0xc7b27b, 24}, {0xc7b27c, 24}, {0xc7b27d, 24},
|
||||
{0xc7b27e, 24}, {0xc7b27f, 24}, {0x18f6480, 25}, {0x18f6481, 25}, {0x18f6482, 25}, {0x18f6483, 25},
|
||||
{0x18f6484, 25}, {0x18f6485, 25}, {0x18f6486, 25}, {0x18f6487, 25}, {0x18f6488, 25}, {0x18f6489, 25},
|
||||
{0x18f648a, 25}, {0x18f648b, 25}, {0x18f648c, 25}, {0x18f648d, 25}, {0x18f648e, 25}, {0x18f648f, 25},
|
||||
}}};
|
||||
|
||||
} // namespace MSMPEG4VC1
|
||||
} // namespace Image
|
||||
@@ -0,0 +1,63 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IMAGE_CODECS_MSMPEG4_VC1_H
|
||||
#define IMAGE_CODECS_MSMPEG4_VC1_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
namespace Image {
|
||||
namespace MSMPEG4VC1 {
|
||||
|
||||
extern const uint16 ff_msmp4_mb_i_table[64][2];
|
||||
extern const uint32 ff_msmp4_dc_tables[2][2][120][2];
|
||||
|
||||
} // namespace MSMPEG4VC1
|
||||
/**
|
||||
* Half-pixel interpolation shared by the MSMPEG4 and VC-1 decoders.
|
||||
* Extracted from the MSMPEG4 port of FFmpeg revision 2cb1773ddc
|
||||
* (Copyright (c) 2000, 2001 Gerard Lantau, GPL version 2 or later).
|
||||
* mode selects copy (0), horizontal (1), vertical (2), or both (3).
|
||||
* When averaging, interpolation rounding and destination rounding are separate:
|
||||
* the destination average always rounds up, including noRounding interpolation.
|
||||
*/
|
||||
template<int width>
|
||||
inline void putHalfPixels(byte *dst, const byte *src, ptrdiff_t pitch, int height,
|
||||
int mode, bool noRounding, bool average = false) {
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
int value = src[x];
|
||||
if (mode == 1)
|
||||
value = (src[x] + src[x + 1] + !noRounding) >> 1;
|
||||
else if (mode == 2)
|
||||
value = (src[x] + src[x + pitch] + !noRounding) >> 1;
|
||||
else if (mode == 3)
|
||||
value = (src[x] + src[x + 1] + src[x + pitch] + src[x + pitch + 1] + (noRounding ? 1 : 2)) >> 2;
|
||||
dst[x] = average ? (dst[x] + value + 1) >> 1 : value;
|
||||
}
|
||||
dst += pitch;
|
||||
src += pitch;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Image
|
||||
|
||||
#endif
|
||||
+15103
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,147 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* WMV3 and VC-1 software video decoder.
|
||||
*
|
||||
* This decoder is a ScummVM port of the FFmpeg WMV3/VC-1 decoder path
|
||||
* used by libavcodec revision c23123630e6a7e645c199599b8ade3fe7e9ab3db:
|
||||
* https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/c23123630e6a7e645c199599b8ade3fe7e9ab3db
|
||||
* The original code was Copyright
|
||||
* (c) 2005 Anonymous, Alex Beregszaszi and Michael Niedermayer,
|
||||
* (c) 2006-2007 Konstantin Shishkov,
|
||||
* (c) 2011 Mashiat Sarker Shakkhar and distributed under the GNU LGPL
|
||||
* version 2.1 or later. The migrated path includes sequence and picture
|
||||
* headers, bitplanes, VLC tables, prediction, motion compensation, inverse
|
||||
* transforms, overlap and loop filtering, IntraX8, error concealment,
|
||||
* reference-frame ordering, and YUV420 output.
|
||||
*/
|
||||
|
||||
#ifndef IMAGE_CODECS_VC1_H
|
||||
#define IMAGE_CODECS_VC1_H
|
||||
|
||||
#include "common/bitstream.h"
|
||||
#include "common/scummsys.h"
|
||||
#include "image/codecs/codec.h"
|
||||
|
||||
namespace Image {
|
||||
|
||||
struct VC1Ratio {
|
||||
int num;
|
||||
int den;
|
||||
VC1Ratio(int numerator = 0, int denominator = 1) : num(numerator), den(denominator) {}
|
||||
};
|
||||
|
||||
struct VC1Header {
|
||||
int bitrtq_postproc = 0;
|
||||
int broadcast = 0;
|
||||
int broken_link = 0;
|
||||
int chromaformat = 0;
|
||||
int closed_entry = 0;
|
||||
int color_prim = 0;
|
||||
int dquant = 0;
|
||||
int extended_dmv = 0;
|
||||
int extended_mv = 0;
|
||||
int fastuvmc = 0;
|
||||
int finterpflag = 0;
|
||||
int frmrtq_postproc = 0;
|
||||
int height = 0;
|
||||
int hrd_num_leaky_buckets = 0;
|
||||
int hrd_param_flag = 0;
|
||||
int interlace = 0;
|
||||
int level = 0;
|
||||
int loop_filter = 0;
|
||||
int matrix_coef = 0;
|
||||
int max_b_frames = 0;
|
||||
int max_coded_height = 0;
|
||||
int max_coded_width = 0;
|
||||
int multires = 0;
|
||||
int overlap = 0;
|
||||
int panscanflag = 0;
|
||||
int postprocflag = 0;
|
||||
int profile = 0;
|
||||
int psf = 0;
|
||||
int quantizer_mode = 0;
|
||||
int range_mapuv = 0;
|
||||
int range_mapuv_flag = 0;
|
||||
int range_mapy = 0;
|
||||
int range_mapy_flag = 0;
|
||||
int rangered = 0;
|
||||
int refdist_flag = 0;
|
||||
int res_fasttx = 0;
|
||||
int res_rtm_flag = 0;
|
||||
int res_sprite = 0;
|
||||
int res_transtab = 0;
|
||||
int res_x8 = 0;
|
||||
int res_y411 = 0;
|
||||
int resync_marker = 0;
|
||||
int tfcntrflag = 0;
|
||||
int transfer_char = 0;
|
||||
int vstransform = 0;
|
||||
int width = 0;
|
||||
const uint8 *zz_8x4 = nullptr;
|
||||
const uint8 *zz_4x8 = nullptr;
|
||||
VC1Ratio sample_aspect_ratio;
|
||||
VC1Ratio framerate;
|
||||
};
|
||||
|
||||
int readVC1Sequence(VC1Header *v, Common::BitStream8MSB *gb);
|
||||
int readVC1Entry(VC1Header *v, Common::BitStream8MSB *gb);
|
||||
|
||||
class VC1Bitplane {
|
||||
public:
|
||||
VC1Bitplane();
|
||||
int decode(uint8 *data, int *rawFlag, int width, int height, int stride, Common::BitStream8MSB *bits) const;
|
||||
|
||||
private:
|
||||
uint16 _imode[16];
|
||||
uint16 _norm2[8];
|
||||
uint16 _norm6[8192];
|
||||
};
|
||||
|
||||
namespace VC1 {
|
||||
class Decoder;
|
||||
struct Picture;
|
||||
} // namespace VC1
|
||||
/** Packet-based WMV3/VC-1 decoder with delayed-frame output. */
|
||||
class WMV3Decoder : public Codec {
|
||||
public:
|
||||
WMV3Decoder(int width, int height, bool advanced = false);
|
||||
~WMV3Decoder() override;
|
||||
/** Supply container initialization data before decoding packets. */
|
||||
bool setExtraData(Common::SeekableReadStream &stream);
|
||||
const Graphics::Surface *decodeFrame(Common::SeekableReadStream &stream) override;
|
||||
/** Return delayed output at end of stream, or nullptr when exhausted. */
|
||||
const Graphics::Surface *drainFrame();
|
||||
Graphics::PixelFormat getPixelFormat() const override { return _format; }
|
||||
bool setOutputPixelFormat(const Graphics::PixelFormat &format) override;
|
||||
bool hasError() const;
|
||||
|
||||
private:
|
||||
VC1::Decoder *_decoder;
|
||||
Graphics::Surface _surface;
|
||||
Graphics::PixelFormat _format;
|
||||
const Graphics::Surface *convert(const VC1::Picture *picture);
|
||||
};
|
||||
|
||||
} // namespace Image
|
||||
|
||||
#endif // IMAGE_CODECS_VC1_H
|
||||
@@ -88,10 +88,24 @@ MODULE_OBJS += \
|
||||
codecs/truemotion1.o
|
||||
endif
|
||||
|
||||
ifdef USE_VC1
|
||||
MODULE_OBJS += \
|
||||
codecs/vc1.o
|
||||
endif
|
||||
|
||||
ifdef USE_XAN
|
||||
MODULE_OBJS += \
|
||||
codecs/xan.o
|
||||
endif
|
||||
|
||||
# Shared tables are needed by either decoder, independently of the other.
|
||||
ifdef USE_MSMPEG4
|
||||
MODULE_OBJS += codecs/msmpeg4_vc1.o
|
||||
else
|
||||
ifdef USE_VC1
|
||||
MODULE_OBJS += codecs/msmpeg4_vc1.o
|
||||
endif
|
||||
endif
|
||||
|
||||
# Include common rules
|
||||
include $(srcdir)/rules.mk
|
||||
Reference in new issue
Block a user