aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/utils.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2011-05-25 14:30:09 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2011-05-26 09:31:27 -0400
commitb4a224c5e4109cb2cca8bac38628673d685fe763 (patch)
treed6f53aa8452c9f813452e242a1f9a758c74de399 /libswscale/utils.c
parent69645c021ad2cc503769b44b9008f98b014423de (diff)
downloadffmpeg-b4a224c5e4109cb2cca8bac38628673d685fe763.tar.gz
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.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 20f07d672e..cb174e5b8e 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -989,7 +989,8 @@ 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)
@@ -998,9 +999,11 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], VOF+1, fail);
c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize];
}
+ c->uv_off = VOFW;
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], VOF*2+1, fail);
+ c->chrUPixBuf[i] = c->chrUPixBuf[i+c->vChrBufSize];
+ c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + VOFW;
}
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
for (i=0; i<c->vLumBufSize; i++) {
@@ -1009,7 +1012,8 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
}
//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);
+ for (i=0; i<c->vChrBufSize; i++)
+ memset(c->chrUPixBuf[i], 64, VOF*2+1);
assert(2*VOFW == VOF);
@@ -1462,10 +1466,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) {