diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2011-07-14 10:31:27 -0700 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-07-14 13:27:06 -0700 |
commit | baba2eedacbbaecf55bdb89dbfe32c69799df99f (patch) | |
tree | 3d5396bce1f65bf95ac1ad17eb3faa8639919ce2 /libswscale/utils.c | |
parent | 55eda370cb6fe9e4c21539f3f90fd940fcf7a103 (diff) | |
download | ffmpeg-baba2eedacbbaecf55bdb89dbfe32c69799df99f.tar.gz |
swscale: extend mmx padding.
Fixes a crash when forcing libc to strictly adhere to malloc sizes.
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r-- | libswscale/utils.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index 6647f68682..0bde82026d 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]; } |