diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-02-24 00:12:30 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-02-24 00:12:30 +0000 |
commit | 3e499f531a4f511c6866ea508d1e19064d07b7ee (patch) | |
tree | 344ebd7697c4bbad6e62c57bb398aba11ba16582 /postproc | |
parent | 8c031d1cbdbcaa489ae1ff32d22b4e919602928d (diff) | |
download | ffmpeg-streaming-3e499f531a4f511c6866ea508d1e19064d07b7ee.zip ffmpeg-streaming-3e499f531a4f511c6866ea508d1e19064d07b7ee.tar.gz |
cleanup
Originally committed as revision 9500 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
Diffstat (limited to 'postproc')
-rw-r--r-- | postproc/swscale.c | 27 | ||||
-rw-r--r-- | postproc/swscale_internal.h | 5 | ||||
-rw-r--r-- | postproc/swscale_template.c | 19 | ||||
-rw-r--r-- | postproc/yuv2rgb.c | 5 | ||||
-rw-r--r-- | postproc/yuv2rgb_mlib.c | 18 | ||||
-rw-r--r-- | postproc/yuv2rgb_template.c | 20 |
6 files changed, 31 insertions, 63 deletions
diff --git a/postproc/swscale.c b/postproc/swscale.c index da4a4de..985bfdb 100644 --- a/postproc/swscale.c +++ b/postproc/swscale.c @@ -1764,7 +1764,7 @@ static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int /** * bring pointers in YUV order instead of YVU */ -inline void sws_orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]){ +inline static void sws_orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]){ if(format == IMGFMT_YV12 || format == IMGFMT_YVU9 || format == IMGFMT_444P || format == IMGFMT_422P || format == IMGFMT_411P){ sortedP[0]= p[0]; @@ -1797,16 +1797,8 @@ inline void sws_orderYUV(int format, uint8_t * sortedP[], int sortedStride[], ui } /* unscaled copy like stuff (assumes nearly identical formats) */ -static int simpleCopy(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, - int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){ - - int srcStride[3]; - int dstStride[3]; - uint8_t *src[3]; - uint8_t *dst[3]; - - sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam); - sws_orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam); +static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, + int srcSliceH, uint8_t* dst[], int dstStride[]){ if(isPacked(c->srcFormat)) { @@ -2382,11 +2374,18 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH /** * swscale warper, so we dont need to export the SwsContext */ -int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, - int srcSliceH, uint8_t* dst[], int dstStride[]){ +int sws_scale(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, + int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){ + int srcStride[3]; + int dstStride[3]; + uint8_t *src[3]; + uint8_t *dst[3]; + + sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam); + sws_orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam); +//printf("sws: slice %d %d\n", srcSliceY, srcSliceH); return c->swScale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride); } -//FIXME order YV12/I420 here /** * returns a normalized gaussian curve used to filter stuff diff --git a/postproc/swscale_internal.h b/postproc/swscale_internal.h index fe7da66..84f6db9 100644 --- a/postproc/swscale_internal.h +++ b/postproc/swscale_internal.h @@ -26,6 +26,10 @@ typedef int (*SwsFunc)(struct SwsContext *context, uint8_t* src[], int srcStride /* this struct should be aligned on at least 32-byte boundary */ typedef struct SwsContext{ + /** + * + * Note the src,dst,srcStride,dstStride will be copied, in the sws_scale() warper so they can freely be modified here + */ SwsFunc swScale; int srcW, srcH, dstH; int chrSrcW, chrSrcH, chrDstW, chrDstH; @@ -119,7 +123,6 @@ typedef struct SwsContext{ } SwsContext; //FIXME check init (where 0) -inline void sws_orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]); SwsFunc yuv2rgb_get_func_ptr (SwsContext *c); int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation); diff --git a/postproc/swscale_template.c b/postproc/swscale_template.c index fed7a48..d3c7e1d 100644 --- a/postproc/swscale_template.c +++ b/postproc/swscale_template.c @@ -1585,7 +1585,7 @@ static inline void RENAME(bgr32ToY)(uint8_t *dst, uint8_t *src, int width) { int b= ((uint32_t*)src)[i]&0xFF; int g= (((uint32_t*)src)[i]>>8)&0xFF; - int r= ((uint32_t*)src)[i]>>16; + int r= (((uint32_t*)src)[i]>>16)&0xFF; dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT); } @@ -1946,7 +1946,7 @@ static inline void RENAME(rgb32ToY)(uint8_t *dst, uint8_t *src, int width) { int r= ((uint32_t*)src)[i]&0xFF; int g= (((uint32_t*)src)[i]>>8)&0xFF; - int b= ((uint32_t*)src)[i]>>16; + int b= (((uint32_t*)src)[i]>>16)&0xFF; dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT); } @@ -2502,8 +2502,8 @@ FUNNY_UV_CODE } } -static int RENAME(swScale)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, - int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){ +static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, + int srcSliceH, uint8_t* dst[], int dstStride[]){ /* load a few things into local vars to make the code more readable? and faster */ const int srcW= c->srcW; @@ -2548,21 +2548,14 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* srcParam[], int srcStridePara int chrBufIndex= c->chrBufIndex; int lastInLumBuf= c->lastInLumBuf; int lastInChrBuf= c->lastInChrBuf; - int srcStride[3]; - int dstStride[3]; - uint8_t *src[3]; - uint8_t *dst[3]; - sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam); - sws_orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam); - if(isPacked(c->srcFormat)){ src[0]= src[1]= - src[2]= srcParam[0]; + src[2]= src[0]; srcStride[0]= srcStride[1]= - srcStride[2]= srcStrideParam[0]; + srcStride[2]= srcStride[0]; } srcStride[1]<<= c->vChrDrop; srcStride[2]<<= c->vChrDrop; diff --git a/postproc/yuv2rgb.c b/postproc/yuv2rgb.c index 0df8534..5ce19b5 100644 --- a/postproc/yuv2rgb.c +++ b/postproc/yuv2rgb.c @@ -262,13 +262,10 @@ const int32_t Inverse_Table_6_9[8][4] = { dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y]; #define PROLOG(func_name, dst_type) \ -static int func_name(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, \ +static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, \ int srcSliceH, uint8_t* dst[], int dstStride[]){\ - uint8_t *src[3];\ - int srcStride[3];\ int y;\ \ - sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);\ if(c->srcFormat == IMGFMT_422P){\ srcStride[1] *= 2;\ srcStride[2] *= 2;\ diff --git a/postproc/yuv2rgb_mlib.c b/postproc/yuv2rgb_mlib.c index 25d256e..015d599 100644 --- a/postproc/yuv2rgb_mlib.c +++ b/postproc/yuv2rgb_mlib.c @@ -33,12 +33,8 @@ #include "../libvo/img_format.h" //FIXME try to reduce dependency of such stuff #include "swscale.h" -static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, +static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ - uint8_t *src[3]; - int srcStride[3]; - - sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam); if(c->srcFormat == IMGFMT_422P){ srcStride[1] *= 2; srcStride[2] *= 2; @@ -51,12 +47,8 @@ static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* srcParam[], int srcStride return srcSliceH; } -static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, +static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ - uint8_t *src[3]; - int srcStride[3]; - - sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam); if(c->srcFormat == IMGFMT_422P){ srcStride[1] *= 2; srcStride[2] *= 2; @@ -69,12 +61,8 @@ static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* srcParam[], int srcStride return srcSliceH; } -static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, +static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ - uint8_t *src[3]; - int srcStride[3]; - - sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam); if(c->srcFormat == IMGFMT_422P){ srcStride[1] *= 2; srcStride[2] *= 2; diff --git a/postproc/yuv2rgb_template.c b/postproc/yuv2rgb_template.c index 57f2797..4b81c7e 100644 --- a/postproc/yuv2rgb_template.c +++ b/postproc/yuv2rgb_template.c @@ -123,13 +123,10 @@ "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */\ -static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, +static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ - int srcStride[3]; - uint8_t *src[3]; int y, h_size; - sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam); if(c->srcFormat == IMGFMT_422P){ srcStride[1] *= 2; srcStride[2] *= 2; @@ -221,13 +218,10 @@ YUV2RGB return srcSliceH; } -static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, +static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ - int srcStride[3]; - uint8_t *src[3]; int y, h_size; - sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam); if(c->srcFormat == IMGFMT_422P){ srcStride[1] *= 2; srcStride[2] *= 2; @@ -313,13 +307,10 @@ YUV2RGB return srcSliceH; } -static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, +static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ - int srcStride[3]; - uint8_t *src[3]; int y, h_size; - sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam); if(c->srcFormat == IMGFMT_422P){ srcStride[1] *= 2; srcStride[2] *= 2; @@ -462,13 +453,10 @@ YUV2RGB return srcSliceH; } -static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, +static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ - int srcStride[3]; - uint8_t *src[3]; int y, h_size; - sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam); if(c->srcFormat == IMGFMT_422P){ srcStride[1] *= 2; srcStride[2] *= 2; |