mirror of
https://github.com/wolfpld/tracy
synced 2025-05-03 14:03:52 +00:00
Frame image packer doesn't care about width and height.
This commit is contained in:
parent
10a3516099
commit
46d33f45bf
@ -1597,7 +1597,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
|||||||
|
|
||||||
data[idx].state.store( JobData::InProgress, std::memory_order_release );
|
data[idx].state.store( JobData::InProgress, std::memory_order_release );
|
||||||
td->Queue( [this, &data, idx, fi] {
|
td->Queue( [this, &data, idx, fi] {
|
||||||
PackFrameImage( data[idx].outbuf, data[idx].outsz, data[idx].buf, fi->w, fi->h, fi->csz );
|
PackFrameImage( data[idx].outbuf, data[idx].outsz, data[idx].buf, fi->w * fi->h / 2, fi->csz );
|
||||||
data[idx].state.store( JobData::DataReady, std::memory_order_release );
|
data[idx].state.store( JobData::DataReady, std::memory_order_release );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@ -3858,7 +3858,7 @@ void Worker::ProcessFrameImage( const QueueFrameImage& ev )
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto fi = m_slab.Alloc<FrameImage>();
|
auto fi = m_slab.Alloc<FrameImage>();
|
||||||
fi->ptr = PackFrameImage( (const char*)it->second, ev.w, ev.h, fi->csz );
|
fi->ptr = PackFrameImage( (const char*)it->second, ev.w * ev.h / 2, fi->csz );
|
||||||
fi->w = ev.w;
|
fi->w = ev.w;
|
||||||
fi->h = ev.h;
|
fi->h = ev.h;
|
||||||
fi->frameRef = uint32_t( fidx );
|
fi->frameRef = uint32_t( fidx );
|
||||||
@ -5958,31 +5958,29 @@ const char* Worker::GetFailureString( Worker::Failure failure )
|
|||||||
return s_failureReasons[(int)failure];
|
return s_failureReasons[(int)failure];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::PackFrameImage( char*& buf, size_t& bufsz, const char* image, uint16_t w, uint16_t h, uint32_t& csz ) const
|
void Worker::PackFrameImage( char*& buf, size_t& bufsz, const char* image, uint32_t inBytes, uint32_t& csz ) const
|
||||||
{
|
{
|
||||||
const auto insz = size_t( w ) * size_t( h ) / 2;
|
const auto maxout = LZ4_COMPRESSBOUND( inBytes );
|
||||||
const auto maxout = LZ4_COMPRESSBOUND( insz );
|
|
||||||
if( bufsz < maxout )
|
if( bufsz < maxout )
|
||||||
{
|
{
|
||||||
bufsz = maxout;
|
bufsz = maxout;
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
buf = new char[maxout];
|
buf = new char[maxout];
|
||||||
}
|
}
|
||||||
const auto outsz = LZ4_compress_default( image, buf, insz, maxout );
|
const auto outsz = LZ4_compress_default( image, buf, inBytes, maxout );
|
||||||
csz = uint32_t( outsz );
|
csz = uint32_t( outsz );
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Worker::PackFrameImage( const char* image, uint16_t w, uint16_t h, uint32_t& csz )
|
const char* Worker::PackFrameImage( const char* image, uint32_t inBytes, uint32_t& csz )
|
||||||
{
|
{
|
||||||
const auto insz = size_t( w ) * size_t( h ) / 2;
|
const auto maxout = LZ4_COMPRESSBOUND( inBytes );
|
||||||
const auto maxout = LZ4_COMPRESSBOUND( insz );
|
|
||||||
if( m_frameImageBufferSize < maxout )
|
if( m_frameImageBufferSize < maxout )
|
||||||
{
|
{
|
||||||
m_frameImageBufferSize = maxout;
|
m_frameImageBufferSize = maxout;
|
||||||
delete[] m_frameImageBuffer;
|
delete[] m_frameImageBuffer;
|
||||||
m_frameImageBuffer = new char[maxout];
|
m_frameImageBuffer = new char[maxout];
|
||||||
}
|
}
|
||||||
const auto outsz = LZ4_compress_default( image, m_frameImageBuffer, insz, maxout );
|
const auto outsz = LZ4_compress_default( image, m_frameImageBuffer, inBytes, maxout );
|
||||||
csz = uint32_t( outsz );
|
csz = uint32_t( outsz );
|
||||||
auto ptr = (char*)m_slab.AllocBig( outsz );
|
auto ptr = (char*)m_slab.AllocBig( outsz );
|
||||||
memcpy( ptr, m_frameImageBuffer, outsz );
|
memcpy( ptr, m_frameImageBuffer, outsz );
|
||||||
|
@ -409,8 +409,8 @@ public:
|
|||||||
const FailureData& GetFailureData() const { return m_failureData; }
|
const FailureData& GetFailureData() const { return m_failureData; }
|
||||||
static const char* GetFailureString( Failure failure );
|
static const char* GetFailureString( Failure failure );
|
||||||
|
|
||||||
void PackFrameImage( char*& buf, size_t& bufsz, const char* image, uint16_t w, uint16_t h, uint32_t& csz ) const;
|
void PackFrameImage( char*& buf, size_t& bufsz, const char* image, uint32_t inBytes, uint32_t& csz ) const;
|
||||||
const char* PackFrameImage( const char* image, uint16_t w, uint16_t h, uint32_t& csz );
|
const char* PackFrameImage( const char* image, uint32_t inBytes, uint32_t& csz );
|
||||||
const char* UnpackFrameImage( const FrameImage& image );
|
const char* UnpackFrameImage( const FrameImage& image );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user