diff options
author | 2005-04-24 07:47:41 +0000 | |
---|---|---|
committer | 2005-04-24 07:47:41 +0000 | |
commit | be41c4a71e4144a326f8e408fa86ed46ae76eeb9 (patch) | |
tree | 52b2084bc20037b2945b9c720ecd23e729b10d53 | |
parent | 9eaff548207834f2e94f97829ce0e56e029445d9 (diff) |
support for both orderings of the slices (top->down / bottom->up)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15249 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | postproc/swscale.c | 32 | ||||
-rw-r--r-- | postproc/swscale_internal.h | 1 |
2 files changed, 29 insertions, 4 deletions
diff --git a/postproc/swscale.c b/postproc/swscale.c index 71e6ff515f..a94de52af6 100644 --- a/postproc/swscale.c +++ b/postproc/swscale.c @@ -2275,10 +2275,34 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int */ int sws_scale_ordered(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ - //copy strides, so they can safely be modified - int srcStride2[3]= {srcStride[0], srcStride[1], srcStride[2]}; - int dstStride2[3]= {dstStride[0], dstStride[1], dstStride[2]}; - return c->swScale(c, src, srcStride2, srcSliceY, srcSliceH, dst, dstStride2); + if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) { + MSG_ERR("swScaler: slices start in the middle!\n"); + return 0; + } + if (c->sliceDir == 0) { + if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1; + } + + // copy strides, so they can safely be modified + if (c->sliceDir == 1) { + // slices go from top to bottom + int srcStride2[3]= {srcStride[0], srcStride[1], srcStride[2]}; + int dstStride2[3]= {dstStride[0], dstStride[1], dstStride[2]}; + return c->swScale(c, src, srcStride2, srcSliceY, srcSliceH, dst, dstStride2); + } else { + // slices go from bottom to top => we flip the image internally + uint8_t* src2[3]= {src[0] + (srcSliceH-1)*srcStride[0], + src[1] + ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[1], + src[2] + ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[2] + }; + uint8_t* dst2[3]= {dst[0] + (c->dstH-1)*dstStride[0], + dst[1] + ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[1], + dst[2] + ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[2]}; + int srcStride2[3]= {-srcStride[0], -srcStride[1], -srcStride[2]}; + int dstStride2[3]= {-dstStride[0], -dstStride[1], -dstStride[2]}; + + return c->swScale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH, srcSliceH, dst2, dstStride2); + } } /** diff --git a/postproc/swscale_internal.h b/postproc/swscale_internal.h index d1fae26669..fff873297c 100644 --- a/postproc/swscale_internal.h +++ b/postproc/swscale_internal.h @@ -60,6 +60,7 @@ typedef struct SwsContext{ int chrIntHSubSample, chrIntVSubSample; int chrDstHSubSample, chrDstVSubSample; int vChrDrop; + int sliceDir; double param[2]; int16_t **lumPixBuf; |