Commit 00c63c9b authored by michael's avatar michael

YV12 like formats support (I420/IYUV)

bugfixes related to vo_x11 resizeing


git-svn-id: file:///var/local/repositories/mplayer/trunk/postproc@4420 b3059339-0415-0410-9bf9-f77b7e298cf2
parent 77796b2c
This diff is collapsed.
...@@ -103,6 +103,7 @@ void SwScale_Init(); ...@@ -103,6 +103,7 @@ void SwScale_Init();
void freeSwsContext(SwsContext *swsContext); void freeSwsContext(SwsContext *swsContext);
SwsContext *getSwsContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat);
SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
SwsFilter *srcFilter, SwsFilter *dstFilter); SwsFilter *srcFilter, SwsFilter *dstFilter);
......
...@@ -1974,8 +1974,8 @@ FUNNYUVCODE ...@@ -1974,8 +1974,8 @@ FUNNYUVCODE
} }
} }
static void RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, static void RENAME(swScale)(SwsContext *c, uint8_t* srcParam[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]){ int srcSliceH, uint8_t* dstParam[], int dstStride[]){
/* load a few things into local vars to make the code more readable? and faster */ /* load a few things into local vars to make the code more readable? and faster */
const int srcW= c->srcW; const int srcW= c->srcW;
...@@ -2014,6 +2014,41 @@ static void RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int ...@@ -2014,6 +2014,41 @@ static void RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int
int chrBufIndex= c->chrBufIndex; int chrBufIndex= c->chrBufIndex;
int lastInLumBuf= c->lastInLumBuf; int lastInLumBuf= c->lastInLumBuf;
int lastInChrBuf= c->lastInChrBuf; int lastInChrBuf= c->lastInChrBuf;
uint8_t *src[3];
uint8_t *dst[3];
if((c->srcFormat == IMGFMT_IYUV) || (c->srcFormat == IMGFMT_I420)){
src[0]= srcParam[0];
src[1]= srcParam[2];
src[2]= srcParam[1];
}else{
src[0]= srcParam[0];
src[1]= srcParam[1];
src[2]= srcParam[2];
}
if((c->dstFormat == IMGFMT_IYUV) || (c->dstFormat == IMGFMT_I420)){
dst[0]= dstParam[0];
dst[1]= dstParam[2];
dst[2]= dstParam[1];
}else{
dst[0]= dstParam[0];
dst[1]= dstParam[1];
dst[2]= dstParam[2];
}
if(dstStride[0]%8 !=0 || dstStride[1]%8 !=0 || dstStride[2]%8 !=0)
{
static int firstTime=1; //FIXME move this into the context perhaps
if(flags & SWS_PRINT_INFO && firstTime)
{
fprintf(stderr, "SwScaler: Warning: dstStride is not aligned!\n"
"SwScaler: ->cannot do aligned memory acesses anymore\n");
firstTime=0;
}
}
if(srcSliceY ==0){ if(srcSliceY ==0){
lumBufIndex=0; lumBufIndex=0;
...@@ -2027,7 +2062,7 @@ static void RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int ...@@ -2027,7 +2062,7 @@ static void RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int
unsigned char *dest =dst[0]+dstStride[0]*dstY; unsigned char *dest =dst[0]+dstStride[0]*dstY;
unsigned char *uDest=dst[1]+dstStride[1]*(dstY>>1); unsigned char *uDest=dst[1]+dstStride[1]*(dstY>>1);
unsigned char *vDest=dst[2]+dstStride[2]*(dstY>>1); unsigned char *vDest=dst[2]+dstStride[2]*(dstY>>1);
const int chrDstY= dstFormat==IMGFMT_YV12 ? (dstY>>1) : dstY; const int chrDstY= isHalfChrV(dstFormat) ? (dstY>>1) : dstY;
const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input
const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
...@@ -2124,7 +2159,7 @@ static void RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int ...@@ -2124,7 +2159,7 @@ static void RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int
#endif #endif
if(dstY < dstH-2) if(dstY < dstH-2)
{ {
if(dstFormat==IMGFMT_YV12) //YV12 if(isPlanarYUV(dstFormat)) //YV12 like
{ {
if(dstY&1) uDest=vDest= NULL; //FIXME split functions in lumi / chromi if(dstY&1) uDest=vDest= NULL; //FIXME split functions in lumi / chromi
if(vLumFilterSize == 1 && vChrFilterSize == 1) // Unscaled YV12 if(vLumFilterSize == 1 && vChrFilterSize == 1) // Unscaled YV12
...@@ -2180,7 +2215,7 @@ static void RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int ...@@ -2180,7 +2215,7 @@ static void RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int
{ {
int16_t **lumSrcPtr= lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; int16_t **lumSrcPtr= lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
int16_t **chrSrcPtr= chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; int16_t **chrSrcPtr= chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
if(dstFormat==IMGFMT_YV12) //YV12 if(isPlanarYUV(dstFormat)) //YV12
{ {
if(dstY&1) uDest=vDest= NULL; //FIXME split functions in lumi / chromi if(dstY&1) uDest=vDest= NULL; //FIXME split functions in lumi / chromi
yuv2yuvXinC( yuv2yuvXinC(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment