17#define FRAME_COUNT(_tag) (_tag->Frames + (_tag->SmackerType & 1))
32 if (!p_data || !p_mxSmk) {
74 huffmanTrees =
new MxU8[treeSize <= 0x2000 ? 0x2000 : treeSize];
81 memcpy(huffmanTrees + 0x1000, p_data, smackTag->
tablesize);
113 *data = smackTag->
Width / 4;
115 *data = smackTag->
Height / 4;
123 *data = width * 3 + (width - smackTag->
Width);
126 *data = smackTag->
Width;
175 if (p_paletteChanged) {
178 MxU8* intoChunk = p_chunkData + 1;
179 MxU8* intoPalette = palette;
180 MxU16 paletteIndex = 0;
185 if (*intoChunk & 0x80) {
186 MxU8 length = (*intoChunk & 0x7f) + 1;
187 memcpy(intoPalette, ¤tPalette[paletteIndex * 3], length * 3);
188 intoPalette += length * 3;
189 paletteIndex += length;
193 if (*intoChunk & 0x40) {
194 MxU8 length = (*intoChunk & 0x3f) + 1;
195 memcpy(intoPalette, ¤tPalette[*(intoChunk + 1) * 3], length * 3);
196 intoPalette += length * 3;
197 paletteIndex += length;
207 }
while (paletteIndex < 256);
209 for (
MxU32 i = 0; i < 256; i++) {
210 memcpy(currentPalette, &palette[i * 3], 3);
212 p_bitmapInfo->
m_bmiColors[i].rgbBlue = palette[i * 3 + 2] * 4;
213 p_bitmapInfo->
m_bmiColors[i].rgbGreen = palette[i * 3 + 1] * 4;
214 p_bitmapInfo->
m_bmiColors[i].rgbRed = palette[i * 3] * 4;
217 p_chunkData += *p_chunkData * 4;
238 u32 left, bottom, top, right;
251 left = p_smackRect[0];
252 top = p_smackRect[1];
253 right = p_smackRect[2] + p_smackRect[0];
254 bottom = p_smackRect[3] + p_smackRect[1];
257 if (left > p_smackRect[0]) {
258 left = p_smackRect[0];
260 if (right < p_smackRect[0] + p_smackRect[2]) {
261 right = p_smackRect[0] + p_smackRect[2];
264 bottom = p_smackRect[1] + p_smackRect[3];
268 *p_rect =
MxRect32(left, top, right, bottom);
static MxLong HeightAbs(MxLong p_value)
[AI] Returns the absolute value of the input height (for DIBs).
[AI] List for pointers to MxRect32 rectangles.
[AI] Rectangle using 32-bit signed integer coordinates.
#define DECOMP_SIZE_ASSERT(T, S)
#define NULL
[AI] Null pointer value (C/C++ semantics).
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
#define FRAME_COUNT(_tag)
void SmackDoTables(u8 *p_huffmanTrees, u8 *p_huffmanTables, u32 p_codeSize, u32 p_abSize, u32 p_detailSize, u32 p_typeSize)
[AI] Generates Huffman tables required for decoding a Smacker frame.
u32 SmackGetSizeDeltas(u32 p_width, u32 p_height)
[AI] Returns the size required for frame delta data given width and height.
u8 SmackGetRect(u8 *p_unk0x6b4, u32 *p_rect)
[AI] Reads a rectangle from the frame update information.
void SmackDoFrameToBuffer(u8 *p_source, u8 *p_huffmanTables, u8 *p_unk0x6b4)
[AI] Decompress a single Smacker video frame into a provided buffer.
u32 SmackGetSizeTables()
[AI] External functions from SMACK.LIB used for decoding Smacker video data.
#define SmackHeaderSize(smk)
[AI] Represents a bitmap information header plus a 256-color palette, matching the layout for 8-bit D...
RGBQUAD m_bmiColors[256]
[AI] 256-entry color palette for 8bpp images.
BITMAPINFOHEADER m_bmiHeader
[AI] Standard DIB bitmap header (size 0x28 bytes).
[AI] The MxSmk struct encapsulates all data required to decode and display a Smacker (SMK) video stre...
MxU32 * m_frameSizes
[AI] Array of frame sizes (in bytes), one entry per video frame (plus ring frame if present).
MxU8 * m_huffmanTrees
[AI] Huffman trees used for decompressing video frames.
MxU32 m_maxFrameSize
[AI] Maximum size of any frame, used for allocation.
static MxResult LoadFrame(MxBITMAPINFO *p_bitmapInfo, MxU8 *p_bitmapData, MxSmk *p_mxSmk, MxU8 *p_chunkData, MxBool p_paletteChanged, MxRect32List *p_list)
[AI] Decompresses and loads a single Smacker frame into a bitmap buffer, updating palette if needed.
MxU8 * m_unk0x6b4
[AI] Buffer/context for decoding frame delta data; referenced throughout decompression ([AI_SUGGESTED...
MxU8 * m_frameTypes
[AI] Array of frame types, one entry per frame.
static void Destroy(MxSmk *p_mxSmk)
[AI] Cleans up and deallocates all resources associated with this MxSmk.
static MxResult LoadHeader(MxU8 *p_data, MxSmk *p_mxSmk)
[AI] Loads the SMK header and initializes decoding structures for a Smacker video.
MxU8 * m_huffmanTables
[AI] Generated decoding tables for use in SmackDoFrameToBuffer.
SmackTag m_smackTag
[AI] Metadata block from the Smacker file header.
static MxBool GetRect(MxU8 *p_unk0x6b4, MxU16 *p_und, u32 *p_smackRect, MxRect32 *p_rect)
[AI] Retrieves and merges rectangles describing updated regions of the current frame.