mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(video): rename and make the frame alignment propety public
Making the frame alignment property public allows for a standardized parameter for frame alignment, usable by other code that allocates frame buffers.
This commit is contained in:
parent
277ddc3d2f
commit
50f67b3cef
|
@ -250,7 +250,7 @@ AVFrame* VideoFrame::generateAVFrame(const QSize& dimensions, const int pixelFor
|
||||||
|
|
||||||
int bufSize = av_image_alloc(ret->data, ret->linesize,
|
int bufSize = av_image_alloc(ret->data, ret->linesize,
|
||||||
dimensions.width(), dimensions.height(),
|
dimensions.width(), dimensions.height(),
|
||||||
static_cast<AVPixelFormat>(pixelFormat), data_alignment);
|
static_cast<AVPixelFormat>(pixelFormat), frameAlignment);
|
||||||
|
|
||||||
if(bufSize < 0){
|
if(bufSize < 0){
|
||||||
av_frame_free(&ret);
|
av_frame_free(&ret);
|
||||||
|
|
|
@ -146,6 +146,16 @@ public:
|
||||||
* VideoFrame is no longer valid.
|
* VideoFrame is no longer valid.
|
||||||
*/
|
*/
|
||||||
vpx_image* toVpxImage(QSize frameSize = {0, 0});
|
vpx_image* toVpxImage(QSize frameSize = {0, 0});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data alignment parameter used to populate AVFrame buffers.
|
||||||
|
*
|
||||||
|
* This field is public in effort to standardized the frame alignment parameter for all AVFrame
|
||||||
|
* allocations.
|
||||||
|
*
|
||||||
|
* It's currently set to 32-byte alignment for AVX2 support.
|
||||||
|
*/
|
||||||
|
static constexpr int frameAlignment = 32;
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief A function to create a hashable key from a given QSize dimension.
|
* @brief A function to create a hashable key from a given QSize dimension.
|
||||||
|
@ -202,9 +212,6 @@ private:
|
||||||
*/
|
*/
|
||||||
void deleteFrameBuffer();
|
void deleteFrameBuffer();
|
||||||
private:
|
private:
|
||||||
// Data alignment for framebuffers
|
|
||||||
static constexpr int data_alignment = 32;
|
|
||||||
|
|
||||||
// Main framebuffer store
|
// Main framebuffer store
|
||||||
QHash<int, QHash<quint64, AVFrame*>> frameBuffer {};
|
QHash<int, QHash<quint64, AVFrame*>> frameBuffer {};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user