UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
M4Decoder.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "vdecmpeg4.h"
5#include "M4Global.h"
6#include "M4BitstreamParser.h"
7#include "M4Prediction.h"
9
10namespace vdecmpeg4
11{
12class M4Image;
13class M4MotionVectorMgr;
14class VIDStream;
15
16// Linear texture
17#define M4_MEM_OFFSET_LEFT_BLOCK 8 // 8 bytes
18#define M4_MEM_SHIFT_MB_TO_Y 4 // * 16
19#define M4_MEM_SHIFT_MB_TO_UV 3 // * 8
20
21
30{
31public:
34
37
39 VIDError init(const VIDDecoderSetup* setup);
40
42 VIDError initBuffers(int16 width, int16 height);
43
44 //-------------------------------------------------------------------------
46
49
51 VIDError StreamDecode(float time, const VIDImage** result);
52
53
54 //-------------------------------------------------------------------------
56
59 {
60 mpStreamEvents = pEvents;
61 return VID_OK;
62 }
63
64
65
66
69
70private:
73
75 ~M4Decoder();
76
78 VIDError iFrame();
79
81 VIDError pFrame(bool gmc);
82
84 VIDError bFrame();
85
87 void mbIntra(M4_MB* mb, int32 x, int32 y, bool useACPredition, uint32 cbp, uint8 quant);
88
91
94
96 M4Decoder();
97
99 M4Decoder(const M4Decoder& pObj);
100
102 void freeStuff();
103
105 void freeBuffers();
106
108 M4Image* AllocVidFrame();
109
111 const M4Decoder& operator=(const M4Decoder& pObj);
112
113private:
114 int16 mWidth;
115 int16 mHeight;
116
117 uint16 mMBWidth;
118 uint16 mMBHeight;
119
120 uint32 mDecoderFlags;
121
122 M4Image* mCurrent;
123
126 M4Image* mReference[2];
127
130 M4Image* mTempImage[2];
131
132 M4_MB* mIPMacroblocks;
133 M4_MB* mBMacroblocks;
134
135 M4MotionVectorMgr* mMotVecMgr;
136
137 M4Bitstream mBitstream;
138 M4BitstreamParser mBitstreamParser;
139
140 M4Image** mpVidImage;
141 uint32 mNumVidImages;
142
143
144 uint32 mFrameCounter;
145 M4BitstreamCache mBitstreamCache;
146
147 VIDStreamIO* mpStreamIO;
148 VIDStreamEvents* mpStreamEvents;
149
150 M4XCmdSingleThread mXCommand;
151
153 friend class M4MotionVectorMgr;
154 friend class M4Image;
155
156public:
157
158 void* operator new(size_t sz, M4MemHandler& memSys)
159 {
160 return memSys.malloc(sz);
161 }
162 void operator delete(void* ptr)
163 {
164 ((M4Decoder*)ptr)->mMemSys.free(ptr);
165 }
166 static const int32 mDequantTable[4];
167 static const uint32 mRoundtab[16];
168 static const uint8 mIntraMacroBlocks[8];
169
172
175
177#ifdef _M4_ENABLE_BMP_OUT
178 void SetVideoOutToBMP(const char* pFileBaseName);
179 char mBaseName[256];
180#endif
181
182 friend class M4XCmdSingleThread; // temp hack
183
184 void (*mCbPrintf)(const char *pMessage);
185 void VIDPrintf(const char *pFormat, ...);
186};
187
188}
189
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
EGLSurface EGLnsecsANDROID time
Definition AndroidOpenGLFunctions.h:9
FPlatformTypes::int16 int16
A 16-bit signed integer.
Definition Platform.h:1123
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define M4_MEMORY_HANDLER
Definition M4Memory.h:14
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition M4BitstreamParser.h:476
Definition M4BitstreamParser.h:39
Definition M4Bitstream.h:22
Definition M4Decoder.h:30
M4MemHandler mMemSys
local copy of memory hooks
Definition M4Decoder.h:171
VIDError initBuffers(int16 width, int16 height)
Init decoder for indicated image res.
Definition M4Decoder.cpp:226
VIDError StreamSeekNotify()
Do some reset stuff if seeking happens.
Definition M4Decoder.cpp:537
VIDError StreamDecode(float time, const VIDImage **result)
Handle Stream.
Definition M4Decoder.cpp:363
static M4Decoder * create(M4MemHandler &memHandler)
Static creation.
Definition M4Decoder.cpp:36
void(* mCbPrintf)(const char *pMessage)
Definition M4Decoder.h:184
void VIDPrintf(const char *pFormat,...)
Definition M4Decoder.cpp:60
static void destroy(M4Decoder *&pDecoder, M4MemHandler &memHandler)
Static destruction.
Definition M4Decoder.cpp:49
VIDError init(const VIDDecoderSetup *setup)
Initialize decoder.
Definition M4Decoder.cpp:173
static const uint8 mIntraMacroBlocks[8]
Definition M4Decoder.h:168
VIDError StreamSet(VIDStreamIO *pStream, VIDStreamEvents *pEvents)
"Pull" interface
Definition M4Decoder.cpp:341
static const uint32 mRoundtab[16]
Definition M4Decoder.h:167
static const int32 mDequantTable[4]
Definition M4Decoder.h:166
VIDError StreamEventsSet(VIDStreamEvents *pEvents)
Attach a new event interface.
Definition M4Decoder.h:58
Definition M4Image.h:22
Definition M4Memory.h:34
Definition M4MotionVectorMgr.h:14
Definition M4XCmdSingleThread.h:24
Definition vdecmpeg4_Stream.h:58
Definition vdecmpeg4_Stream.h:22
Definition M4Bitstream.h:9
MV_PREDICTION
Possible motion vector prediction.
Definition M4Global.h:62
int32 VIDError
Generic error type.
Definition vdecmpeg4_ErrorCodes.h:10
Definition M4Global.h:89
Definition vdecmpeg4_Platform.h:53
Definition vdecmpeg4_Image.h:32