Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-05-28 17:52:50 +0400
committerMichael Niedermayer <michaelni@gmx.at>2011-05-29 04:13:36 +0400
commit986f0d86cbdc92f46e5fbba05fb29526b76162be (patch)
tree6f1a2fd291a6930528a806c9b68c530f9d22f392 /libswscale/utils.c
parentea535ed50d1b8d751e2d194a987295ab38daf1a2 (diff)
Commits that could not be pulled earlier due to bugs.
commit 93681fbd5082a3af896b7a730dacdd27a3052406 Author: Ronald S. Bultje <rsbultje@gmail.com> Date: Thu May 26 11:32:32 2011 -0400 swscale: fix compile on ppc. commit e758573a887cfb1155e81499ca54f433127cf24e Author: Ronald S. Bultje <rsbultje@gmail.com> Date: Thu May 26 10:36:47 2011 -0400 swscale: fix compile on x86-32. commit 0f4eb8b04341081591bf401eaa2c07d6bc3ff52e Author: Ronald S. Bultje <rsbultje@gmail.com> Date: Thu May 26 09:17:52 2011 -0400 swscale: remove VOF/VOFW. commit b4a224c5e4109cb2cca8bac38628673d685fe763 Author: Ronald S. Bultje <rsbultje@gmail.com> Date: Wed May 25 14:30:09 2011 -0400 swscale: split chroma buffers into separate U/V planes. Preparatory step to implement support for sizes > VOFW.
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r--libswscale/utils.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c
index b0548dcf8e..20cc3f187a 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -753,6 +753,7 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
int srcH= c->srcH;
int dstW= c->dstW;
int dstH= c->dstH;
+ int dst_stride = FFALIGN(dstW * sizeof(int16_t)+66, 16), dst_stride_px = dst_stride >> 1;
int flags, cpu_flags;
enum PixelFormat srcFormat= c->srcFormat;
enum PixelFormat dstFormat= c->dstFormat;
@@ -794,10 +795,6 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
srcW, srcH, dstW, dstH);
return AVERROR(EINVAL);
}
- if(srcW > VOFW || dstW > VOFW) {
- av_log(NULL, AV_LOG_ERROR, "swScaler: Compile-time maximum width is "AV_STRINGIFY(VOFW)" change VOF/VOFW and recompile\n");
- return AVERROR(EINVAL);
- }
FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail);
if (!dstFilter) dstFilter= &dummyFilter;
@@ -1001,29 +998,31 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
// allocate pixbufs (we use dynamic allocation because otherwise we would need to
// allocate several megabytes to handle all possible cases)
FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail);
- FF_ALLOC_OR_GOTO(c, c->chrPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail);
+ FF_ALLOC_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail);
+ FF_ALLOC_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail);
if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat))
FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail);
//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], VOF+1, fail);
+ FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], dst_stride+1, fail);
c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize];
}
+ c->uv_off = dst_stride_px;
for (i=0; i<c->vChrBufSize; i++) {
- FF_ALLOC_OR_GOTO(c, c->chrPixBuf[i+c->vChrBufSize], (VOF+1)*2, fail);
- c->chrPixBuf[i] = c->chrPixBuf[i+c->vChrBufSize];
+ FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+1, fail);
+ c->chrUPixBuf[i] = c->chrUPixBuf[i+c->vChrBufSize];
+ c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + dst_stride_px;
}
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
for (i=0; i<c->vLumBufSize; i++) {
- FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], VOF+1, fail);
+ FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], dst_stride+1, fail);
c->alpPixBuf[i] = c->alpPixBuf[i+c->vLumBufSize];
}
//try to avoid drawing green stuff between the right end and the stride end
- for (i=0; i<c->vChrBufSize; i++) memset(c->chrPixBuf[i], 64, (VOF+1)*2);
-
- assert(2*VOFW == VOF);
+ for (i=0; i<c->vChrBufSize; i++)
+ memset(c->chrUPixBuf[i], 64, dst_stride*2+1);
assert(c->chrDstH <= dstH);
@@ -1481,10 +1480,11 @@ void sws_freeContext(SwsContext *c)
av_freep(&c->lumPixBuf);
}
- if (c->chrPixBuf) {
+ if (c->chrUPixBuf) {
for (i=0; i<c->vChrBufSize; i++)
- av_freep(&c->chrPixBuf[i]);
- av_freep(&c->chrPixBuf);
+ av_freep(&c->chrUPixBuf[i]);
+ av_freep(&c->chrUPixBuf);
+ av_freep(&c->chrVPixBuf);
}
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {