1
0
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:
initramfs 2016-04-23 22:08:31 -04:00 committed by initramfs
parent 277ddc3d2f
commit 50f67b3cef
No known key found for this signature in database
GPG Key ID: 78B8BDF87E9EF0AF
2 changed files with 11 additions and 4 deletions

View File

@ -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);

View File

@ -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 {};