[FFmpeg-cvslog] swscale: extend mmx padding.
Ronald S. Bultje
git at videolan.org
Fri Jul 15 17:58:58 CEST 2011
ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Thu Jul 14 10:31:27 2011 -0700| [baba2eedacbbaecf55bdb89dbfe32c69799df99f] | committer: Ronald S. Bultje
swscale: extend mmx padding.
Fixes a crash when forcing libc to strictly adhere to malloc sizes.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=baba2eedacbbaecf55bdb89dbfe32c69799df99f
---
libswscale/utils.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 6647f68..0bde820 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1049,19 +1049,20 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
//Note we need at least one pixel more at the end because of the MMX code (just in case someone wanna replace the 4000/8000)
/* align at 16 bytes for AltiVec */
for (i=0; i<c->vLumBufSize; i++) {
- FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], dst_stride+1, fail);
+ FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], dst_stride+16, fail);
c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize];
}
- c->uv_off_px = dst_stride_px;
- c->uv_off_byte = dst_stride;
+ // 64 / c->scalingBpp is the same as 16 / sizeof(scaling_intermediate)
+ c->uv_off_px = dst_stride_px + 64 / c->scalingBpp;
+ c->uv_off_byte = dst_stride + 16;
for (i=0; i<c->vChrBufSize; i++) {
- FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+1, fail);
+ FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+32, fail);
c->chrUPixBuf[i] = c->chrUPixBuf[i+c->vChrBufSize];
- c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + (dst_stride >> 1);
+ c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + (dst_stride >> 1) + 8;
}
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
for (i=0; i<c->vLumBufSize; i++) {
- FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], dst_stride+1, fail);
+ FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], dst_stride+16, fail);
c->alpPixBuf[i] = c->alpPixBuf[i+c->vLumBufSize];
}
More information about the ffmpeg-cvslog
mailing list