14 return (value << 24) | ((value & 0xff00) << 8) | ((value >> 8) & 0xff00) | (value >> 24);
97 uint8* mpInternalBuffer;
98 uint32 mInternalBufferBytes;
99 uint32 mInternalBufferCurrentBytes;
100 uint32 mInternalBufferIndex;
134 , mpStreamIO(nullptr)
135 , mpInternalBuffer(nullptr)
136 , mInternalBufferBytes(0)
137 , mInternalBufferCurrentBytes(0)
138 , mInternalBufferIndex(0)
151 if (mpInternalBuffer && mpMemSys)
153 mpMemSys->
free(mpInternalBuffer);
182 mStart = mTail = (
uint32*)bitstream;
184 mAWord =
XSWAP(mStart[0]);
185 mBWord =
XSWAP(mStart[1]);
190 mpStreamIO =
nullptr;
191 if (mpInternalBuffer)
193 mpMemSys->
free(mpInternalBuffer);
195 mpInternalBuffer =
nullptr;
208 if (mInternalBufferIndex >= mInternalBufferCurrentBytes)
210 mInternalBufferIndex = 0;
211 VIDStreamResult result = mpStreamIO->
Read(mpInternalBuffer, mInternalBufferBytes, mInternalBufferCurrentBytes);
215 mInternalBufferCurrentBytes = 0;
216 return result ==
VID_STREAM_EOF ? VID_ERROR_STREAM_EOF : VID_ERROR_STREAM_ERROR;
221 M4CHECK((mInternalBufferCurrentBytes & 0x3) == 0 );
223 M4CHECK( mInternalBufferCurrentBytes > 0 );
226 value = *((
uint32*)(mpInternalBuffer + mInternalBufferIndex));
227 mInternalBufferIndex += 4;
245 if (mpInternalBuffer)
247 mpMemSys->
free(mpInternalBuffer);
250 mpInternalBuffer = (
uint8*)mpMemSys->
malloc(mInternalBufferBytes);
251 mInternalBufferCurrentBytes = 0;
252 mInternalBufferIndex = 0;
256 ReadStreamBuffered(value);
257 mAWord =
XSWAP(value);
259 ReadStreamBuffered(value);
260 mBWord =
XSWAP(value);
266 mStart = mTail =
nullptr;
286 res2 = ((mAWord & (0xffffffff >> mPos)) <<
nbit) | (mBWord >> (32 -
nbit));
290 res2 = (mAWord & (0xffffffff >> mPos)) >> (32 - mPos - bits);
313 ReadStreamBuffered(value);
314 mBWord =
XSWAP(value);
318 mBWord =
XSWAP(*(mTail+2));
334 return mpStreamIO ? mpStreamIO->
IsEof() : ((8 * 4 * (mTail - mStart) + mPos)>>3) >= mLength;
361 while((mPos & 7) != 0)
406 return v & (0xffffffff >> (32 - bits));
416 return v & (0xffffffff >> (32 - bits));
428 static const uint8 stuffing[8] = { 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x00 };
432 return show(8) == 0x7f;
485 return (
const uint32*)mStart;
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition M4Bitstream.h:22
bool validStuffingBits()
Definition M4Bitstream.h:426
uint32 show(const uint32 bits)
Show indicated bit from stream without moving file position.
Definition M4Bitstream.h:279
void skipResyncMarker()
Definition M4Bitstream.h:375
uint32 getBits(const uint32 bits)
Return indicated # of bits from stream.
Definition M4Bitstream.h:451
void setMemoryHook(M4MemHandler &memSys)
Set memory allocator.
Definition M4Bitstream.h:166
void nextStartCode()
implements next_start_code()
Definition M4Bitstream.h:356
const uint32 * getBaseAddr() const
Return memory base addres of stream.
Definition M4Bitstream.h:483
void nextResyncMarker()
Definition M4Bitstream.h:369
uint32 totalBitsGet() const
Read the byte counter.
Definition M4Bitstream.h:474
void align()
Align bitstream to next byte boundary.
Definition M4Bitstream.h:342
bool isEof()
Check eof.
Definition M4Bitstream.h:332
uint32 showBitsByteAligned(const uint32 bits)
implements nextbits_bytealigned()
Definition M4Bitstream.h:394
~M4Bitstream()
Destructor.
Definition M4Bitstream.h:149
M4Bitstream()
Construction of bitstream object.
Definition M4Bitstream.h:130
uint32 getBit()
Return 1 bit from stream.
Definition M4Bitstream.h:463
void skip(const uint32 bits)
Skip indicated bits in stream.
Definition M4Bitstream.h:302
void totalBitsClear()
Clear the byte counter.
Definition M4Bitstream.h:118
void init(const uint8 *bitstream, uint32 length)
Link bitstream to provided byte sequence.
Definition M4Bitstream.h:180
void free(void *ptr)
Memory release.
Definition M4Memory.h:52
void * malloc(size_t size, size_t alignment=32)
Memory allocation with possible alignment.
Definition M4Memory.h:44
Definition vdecmpeg4_Stream.h:22
virtual VIDStreamResult Read(uint8 *pRequestedDataBuffer, uint32 requestedDataBytes, uint32 &actualDataBytes)=0
Definition M4Bitstream.h:9
uint32 XSWAP(uint32 value)
Definition M4Bitstream.h:12
int32 VIDError
Generic error type.
Definition vdecmpeg4_ErrorCodes.h:10
VIDStreamResult
Possible resuls for VIDStream methods.
Definition vdecmpeg4_Stream.h:11
@ VID_STREAM_EOF
Definition vdecmpeg4_Stream.h:13
@ VID_STREAM_OK
Definition vdecmpeg4_Stream.h:12
float v
Definition radaudio_mdct.cpp:62
#define M4CHECK
Definition vdecmpeg4_Types.h:8