IMAGE: Make more codecs into optional components

This commit is contained in:
Cameron Cawley
2026-02-01 15:12:07 +00:00
committed by GitHub
parent 1752d2fb36
commit a06885758c
13 changed files with 95 additions and 55 deletions
Vendored
+8
View File
@@ -297,14 +297,18 @@ _need_memalign=yes
_have_x86=no
_have_amd64=no
_imgui=yes
_cdtoons=auto
_indeo3=auto
_indeo45=auto
_hnm=auto
_jyv1=auto
_qdm2=auto
_fmtowns_pc98_audio=auto
_sid_audio=auto
_svq1=auto
_truemotion1=auto
_vgmtrans_audio=auto
_xan=auto
_midi=auto
_universaltracker=auto
@@ -328,6 +332,7 @@ add_feature zlib "zlib" "_zlib"
add_feature test_cxx11 "Test C++11" "_test_cxx11"
# Components are features which may be disabled if unused by the engines
add_component cdtoons "CDTOONS" "_cdtoons" "USE_CDTOONS"
add_component enet "ENet" "_enet" "USE_ENET"
add_component fmtowns_pc98_audio "FM-TOWNS/PC98 audio" "_fmtowns_pc98_audio" "USE_FMTOWNS_PC98_AUDIO"
add_component gif "GIF" "_gif" "USE_GIF"
@@ -335,6 +340,7 @@ add_component hnm "HNM" "_hnm" "USE_HNM"
add_component imgui "Dear ImGui based debugger" "_imgui" "USE_IMGUI"
add_component indeo3 "Indeo 3" "_indeo3" "USE_INDEO3"
add_component indeo45 "Indeo 4&5" "_indeo45" "USE_INDEO45"
add_component jyv1 "JYV1" "_jyv1" "USE_JYV1"
add_component lua "Lua" "_lua" "USE_LUA"
add_component vpx "libvpx" "_vpx" "USE_VPX"
add_component theoradec "libtheoradec" "_theoradec" "USE_THEORADEC"
@@ -345,8 +351,10 @@ add_component qdm2 "QDM2" "_qdm2" "USE_QDM2"
add_component sid_audio "SID audio" "_sid_audio" "USE_SID_AUDIO"
add_component svq1 "Sorenson Video 1" "_svq1" "USE_SVQ1"
add_component tinygl "TinyGL" "_tinygl" "USE_TINYGL"
add_component truemotion1 "TrueMotion 1" "_truemotion1" "USE_SVQ1"
add_component universaltracker "External Tracker Libraries" "_universaltracker" "USE_UNIVERSALTRACKER"
add_component vgmtrans_audio "VGMTrans Soundfont audio" "_vgmtrans_audio" "USE_VGMTRANS_AUDIO"
add_component xan "XAN" "_xan" "USE_XAN"
# The following list of features cannot be declared as components
# because they are used in the common code:
+1 -1
View File
@@ -1,7 +1,7 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
add_engine mohawk "Mohawk" yes "cstime myst mystme riven" "Living Books" "highres" ""
add_engine cstime "Where in Time is Carmen Sandiego?" no
add_engine cstime "Where in Time is Carmen Sandiego?" no "" "" "" "cdtoons"
add_engine riven "Riven: The Sequel to Myst" yes "" "" "16bit"
add_engine myst "Myst" yes
add_engine mystme "Myst ME" yes "" "" "16bit jpeg" "qdm2 svq1"
+1 -1
View File
@@ -1,4 +1,4 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
add_engine sci "SCI" yes "sci32" "SCI 0-1.1 games" "" "midi fmtowns_pc98_audio"
add_engine sci32 "SCI32 games" yes "" "" "highres" "indeo3"
add_engine sci32 "SCI32 games" yes "" "" "highres" "indeo3 truemotion1"
+1 -1
View File
@@ -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 indeo3 indeo45 vpx mpc hnm mpeg2 qdm2 svq1 tinygl"
add_engine testbed "TestBed: the Testing framework" no "" "" "" "imgui midi universaltracker cdtoons indeo3 indeo45 vpx mpc hnm jyv1 mpeg2 qdm2 svq1 truemotion1 xan tinygl"
+1 -1
View File
@@ -5,4 +5,4 @@ add_engine akalabeth "Akalabeth" no "" "" ""
add_engine ultima1 "Ultima I - The First Age of Darkness" no "" "" ""
add_engine ultima4 "Ultima IV - Quest of the Avatar" yes "" "" "16bit"
add_engine ultima6 "Ultima VI = The False Prophet" yes "" "" "highres 16bit lua"
add_engine ultima8 "Ultima VIII - Pagan" yes "" "" "highres 16bit" "imgui"
add_engine ultima8 "Ultima VIII - Pagan" yes "" "" "highres 16bit" "imgui jyv1 xan"
+1 -1
View File
@@ -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 zvision "Z-Vision" yes "" "" "freetype2 16bit highres" "midi mpeg2"
add_engine zvision "Z-Vision" yes "" "" "freetype2 16bit highres" "midi truemotion1 mpeg2"
+51 -19
View File
@@ -25,15 +25,9 @@
#include "image/codecs/bmp_raw.h"
#include "image/codecs/cdtoons.h"
#include "image/codecs/cinepak.h"
#ifdef USE_INDEO3
#include "image/codecs/indeo3.h"
#endif
#ifdef USE_INDEO45
#include "image/codecs/indeo4.h"
#include "image/codecs/indeo5.h"
#endif
#include "image/codecs/jyv1.h"
#include "image/codecs/mjpeg.h"
#include "image/codecs/mpeg.h"
@@ -64,12 +58,16 @@ Graphics::PixelFormat Codec::getDefaultYUVFormat() {
}
Codec *createBitmapCodec(uint32 tag, uint32 streamTag, int width, int height, int bitsPerPixel) {
#ifdef USE_JYV1
// Crusader videos are special cased here because the frame type is not in the "compression"
// tag but in the "stream handler" tag for these files
if (JYV1Decoder::isJYV1StreamTag(streamTag)) {
assert(bitsPerPixel == 8);
return new JYV1Decoder(width, height, streamTag);
}
#endif
const char *missingCodec = nullptr;
switch (tag) {
case SWAP_CONSTANT_32(0):
@@ -92,50 +90,71 @@ Codec *createBitmapCodec(uint32 tag, uint32 streamTag, int width, int height, in
#ifdef USE_INDEO3
return new Indeo3Decoder(width, height, bitsPerPixel);
#else
warning("createBitmapCodec(): Indeo 3 codec is not compiled");
return 0;
missingCodec = "Indeo 3";
break;
#endif
case MKTAG('I', 'V', '4', '1'):
case MKTAG('I', 'V', '4', '2'):
#ifdef USE_INDEO45
return new Indeo4Decoder(width, height, bitsPerPixel);
#else
warning("createBitmapCodec(): Indeo 4 & 5 codecs are not compiled");
return 0;
missingCodec = "Indeo 4";
break;
#endif
case MKTAG('I', 'V', '5', '0'):
#ifdef USE_INDEO45
return new Indeo5Decoder(width, height, bitsPerPixel);
#else
warning("createBitmapCodec(): Indeo 4 & 5 codecs are not compiled");
return 0;
missingCodec = "Indeo 5";
break;
#endif
case MKTAG('X', 'x', 'a', 'n'):
#ifdef USE_XAN
return new XanDecoder(width, height, bitsPerPixel);
#ifdef IMAGE_CODECS_TRUEMOTION1_H
#else
missingCodec = "Xan";
break;
#endif
case MKTAG('D','U','C','K'):
case MKTAG('d','u','c','k'):
#ifdef USE_TRUEMOTION1
return new TrueMotion1Decoder();
#else
missingCodec = "TrueMotion1";
break;
#endif
#ifdef USE_MPEG2
case MKTAG('m','p','g','2'):
#ifdef USE_MPEG2
return new MPEGDecoder();
#else
missingCodec = "MPEG2";
break;
#endif
case MKTAG('M','J','P','G'):
case MKTAG('m','j','p','g'):
#ifdef USE_MJPEG
return new MJPEGDecoder();
#else
missingCodec = "MJPEG";
break;
#endif
default:
if (tag & 0x00FFFFFF)
warning("Unknown BMP/AVI compression format \'%s\'", tag2str(tag));
else
warning("Unknown BMP/AVI compression format %d", SWAP_BYTES_32(tag));
return 0;
}
assert(missingCodec);
warning("createBitmapCodec(): %s codec is not compiled", missingCodec);
return 0;
}
Codec *createQuickTimeCodec(uint32 tag, int width, int height, int bitsPerPixel) {
const char *missingCodec = nullptr;
switch (tag) {
case MKTAG('c','v','i','d'):
// Cinepak: As used by most Myst and all Riven videos as well as some Myst ME videos. "The Chief" videos also use this. Very popular for Director titles.
@@ -154,19 +173,29 @@ Codec *createQuickTimeCodec(uint32 tag, int width, int height, int bitsPerPixel)
// Sorenson Video 1: Used by some Myst ME videos.
return new SVQ1Decoder(width, height);
#else
warning("createQuickTimeCodec(): Sorenson Video 1 codec is not compiled");
return 0;
missingCodec = "Sorenson Video 1";
break;
#endif
case MKTAG('S','V','Q','3'):
// Sorenson Video 3: Used by some Myst ME videos.
warning("Sorenson Video 3 not yet supported");
break;
return 0;
case MKTAG('j','p','e','g'):
#ifdef USE_JPEG
// JPEG: Used by some Myst ME 10th Anniversary videos.
return new JPEGDecoder();
#else
missingCodec = "JPEG";
break;
#endif
case MKTAG('Q','k','B','k'):
#ifdef USE_CDTOONS
// CDToons: Used by most of the Broderbund games.
return new CDToonsDecoder(width, height);
#else
missingCodec = "CDToons";
break;
#endif
case MKTAG('r','a','w',' '):
// Used my L-Zone-mac (Director game)
return new BitmapRawDecoder(width, height, bitsPerPixel, true, true);
@@ -175,13 +204,16 @@ Codec *createQuickTimeCodec(uint32 tag, int width, int height, int bitsPerPixel)
// Indeo 3: Used by Team Xtreme: Operation Weather Disaster (Spanish)
return new Indeo3Decoder(width, height, bitsPerPixel);
#else
warning("createQuickTimeCodec(): Indeo 3 codec is not compiled");
return 0;
missingCodec = "Indeo 3";
break;
#endif
default:
warning("Unsupported QuickTime codec \'%s\'", tag2str(tag));
return 0;
}
assert(missingCodec);
warning("createBitmapCodec(): %s codec is not compiled", missingCodec);
return 0;
}
-4
View File
@@ -25,8 +25,6 @@
#include "image/codecs/codec.h"
#include "graphics/pixelformat.h"
#ifdef USE_MPEG2
typedef struct mpeg2dec_s mpeg2dec_t;
typedef struct mpeg2_info_s mpeg2_info_t;
@@ -79,5 +77,3 @@ private:
} // End of namespace Image
#endif // IMAGE_CODECS_MPEG_H
#endif // USE_MPEG2
-6
View File
@@ -22,10 +22,6 @@
// Sorenson Video 1 Codec
// Based off FFmpeg's SVQ1 decoder (written by Arpi and Nick Kurshev)
#include "common/scummsys.h"
#ifdef USE_SVQ1
#include "image/codecs/svq1.h"
#include "image/codecs/svq1_cb.h"
#include "image/codecs/svq1_vlc.h"
@@ -806,5 +802,3 @@ bool SVQ1Decoder::svq1DecodeDeltaBlock(Common::BitStream32BEMSB *ss, byte *curre
}
} // End of namespace Image
#endif
-4
View File
@@ -24,8 +24,6 @@
#include "common/scummsys.h"
#ifdef USE_SVQ1
#include "common/bitstream.h"
#include "image/codecs/codec.h"
@@ -98,5 +96,3 @@ private:
} // End of namespace Image
#endif
#endif
-6
View File
@@ -21,11 +21,7 @@
// Based on the TrueMotion 1 decoder by Alex Beregszaszi & Mike Melanson in FFmpeg
#include "common/scummsys.h"
#include "image/codecs/truemotion1.h"
#ifdef IMAGE_CODECS_TRUEMOTION1_H
#include "image/codecs/truemotion1data.h"
#include "common/stream.h"
#include "common/textconsole.h"
@@ -427,5 +423,3 @@ const Graphics::Surface *TrueMotion1Decoder::decodeFrame(Common::SeekableReadStr
}
} // End of namespace Image
#endif
-4
View File
@@ -21,9 +21,6 @@
// Based on the TrueMotion 1 decoder by Alex Beregszaszi & Mike Melanson in FFmpeg
// Only compile if SCI32 is enabled, TESTBED is enabled, ZVISION is enabled, or if we're building dynamic modules
#if defined(ENABLE_SCI32) || defined(ENABLE_TESTBED) || defined(ENABLE_ZVISION) || defined(DYNAMIC_MODULES)
#ifndef IMAGE_CODECS_TRUEMOTION1_H
#define IMAGE_CODECS_TRUEMOTION1_H
@@ -103,4 +100,3 @@ private:
} // End of namespace Image
#endif // IMAGE_CODECS_TRUEMOTION1_H
#endif // SCI32/Plugins guard
+31 -7
View File
@@ -16,33 +16,37 @@ MODULE_OBJS := \
tga.o \
xbm.o \
codecs/bmp_raw.o \
codecs/cdtoons.o \
codecs/cinepak.o \
codecs/codec.o \
codecs/dither.o \
codecs/hlz.o \
codecs/jyv1.o \
codecs/mjpeg.o \
codecs/msrle.o \
codecs/msrle4.o \
codecs/msvideo1.o \
codecs/qtrle.o \
codecs/rpza.o \
codecs/smc.o \
codecs/svq1.o \
codecs/truemotion1.o \
codecs/xan.o
codecs/smc.o
ifdef USE_GIF
MODULE_OBJS += \
gif.o
endif
ifdef USE_JPEG
MODULE_OBJS += \
codecs/mjpeg.o
endif
ifdef USE_MPEG2
MODULE_OBJS += \
codecs/mpeg.o
endif
ifdef USE_CDTOONS
MODULE_OBJS += \
codecs/cdtoons.o
endif
ifdef USE_INDEO3
MODULE_OBJS += \
codecs/indeo3.o
@@ -63,5 +67,25 @@ MODULE_OBJS += \
codecs/hnm.o
endif
ifdef USE_JYV1
MODULE_OBJS += \
codecs/jyv1.o
endif
ifdef USE_SVQ1
MODULE_OBJS += \
codecs/svq1.o
endif
ifdef USE_TRUEMOTION1
MODULE_OBJS += \
codecs/truemotion1.o
endif
ifdef USE_XAN
MODULE_OBJS += \
codecs/xan.o
endif
# Include common rules
include $(srcdir)/rules.mk