-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MemoryAlignment: Fixes #10810
MemoryAlignment: Fixes #10810
Conversation
Hi @FernetMenta please have a look. I think I did not get the remarks correctly yet. |
@@ -108,7 +108,7 @@ void CBaseTexture::Allocate(unsigned int width, unsigned int height, unsigned in | |||
if (GetPitch() * GetRows() > 0) | |||
{ | |||
size_t size = GetPitch() * GetRows(); | |||
m_pixels = (unsigned char*) _aligned_malloc(size, 16); | |||
m_pixels = (unsigned char*) _aligned_malloc(size, 32); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -68,7 +65,7 @@ DemuxPacket* CDVDDemuxUtils::AllocateDemuxPacket(int iDataSize) | |||
* Note, if the first 23 bits of the additional bytes are not 0 then damaged | |||
* MPEG bitstreams could cause overread and segfault | |||
*/ | |||
pPacket->pData =(uint8_t*)_aligned_malloc(iDataSize + FF_INPUT_BUFFER_PADDING_SIZE, 16); | |||
pPacket->pData =(uint8_t*)av_malloc(iDataSize + FF_INPUT_BUFFER_PADDING_SIZE); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
jenkins build this please |
@@ -68,7 +68,7 @@ DemuxPacket* CDVDDemuxUtils::AllocateDemuxPacket(int iDataSize) | |||
* Note, if the first 23 bits of the additional bytes are not 0 then damaged | |||
* MPEG bitstreams could cause overread and segfault | |||
*/ | |||
pPacket->pData =(uint8_t*)_aligned_malloc(iDataSize + FF_INPUT_BUFFER_PADDING_SIZE, 16); | |||
pPacket->pData =(uint8_t*)_aligned_malloc(iDataSize + FF_INPUT_BUFFER_PADDING_SIZE, 32); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
jenkins build this please |
with aadfc21 image support is completely broken on my machine. reverting it restores operation. |
See: #10826 thx for reporting back. |
@@ -404,7 +404,7 @@ bool CFFmpegImage::DecodeFrame(AVFrame* frame, unsigned int width, unsigned int | |||
|
|||
bool needsCopy = false; | |||
int pixelsSize = pitch * height; | |||
bool aligned = (((uintptr_t)(const void *)(pixels)) % (16) == 0); | |||
bool aligned = (((uintptr_t)(const void *)(pixels)) % (32) == 0); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
One is the address. The other the entries of the buffer beginning at that
address.
Should be fine, right?
Am 03.02.2017 2:46 nachm. schrieb "Chris Browet" <notifications@github.com>:
… ***@***.**** commented on this pull request.
------------------------------
In xbmc/guilib/FFmpegImage.cpp
<#10810 (review)>:
> @@ -404,7 +404,7 @@ bool CFFmpegImage::DecodeFrame(AVFrame* frame, unsigned int width, unsigned int
bool needsCopy = false;
int pixelsSize = pitch * height;
- bool aligned = (((uintptr_t)(const void *)(pixels)) % (16) == 0);
+ bool aligned = (((uintptr_t)(const void *)(pixels)) % (32) == 0);
You probably want to align on 32 in the av_frame_get_buffer below, too
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#10810 (review)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABCfHWKcEs4PSt3Hd9ILo5yozRIin1Ugks5rYy-7gaJpZM4KkKS->
.
|
Are we on the same page? ;) |
Nope, we aren't.
There is the "alignment" of the memory adress, so that intrinsics can
properly work and the alignment of the size of the buffer.
See: https://ffmpeg.org/doxygen/2.2/frame_8c_source.html line 134 for example. For the rest ffmpeg cares.
…--
Key-ID: 0x1A995A9B
keyserver: pgp.mit.edu
==============================================================
Fingerprint: 4606 DA19 EC2E 9A0B 0157 C81B DA07 CF63 1A99 5A9B
|
Whenever we provide a user buffer directly into ffmpeg we should take care that its alignment is 32 byte, cause our ffmpeg build with AVX support might do nasty things.
This PR does two things:
a) Use av_malloc when we directly communicate with ffmpeg / sws_scale and so on
b) Use _aligned_malloc(size, 32) whenever we don't want ffmpeg dependencies in that other code, e.g. Texture.cpp and friends.