From c77884b8edd7658c98551134d5b41196f8744d58 Mon Sep 17 00:00:00 2001 From: sdrik Date: Mon, 16 Mar 2009 08:29:40 +0000 Subject: Split YUV2RGB operands declaration into a separate macro git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28972 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/yuv2rgb_template.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libswscale') diff --git a/libswscale/yuv2rgb_template.c b/libswscale/yuv2rgb_template.c index f55568b0ab..35b7f14f60 100644 --- a/libswscale/yuv2rgb_template.c +++ b/libswscale/yuv2rgb_template.c @@ -162,7 +162,8 @@ "add $"AV_STRINGIFY(depth*8)", %1 \n\t" \ "add $4, %0 \n\t" \ " js 1b \n\t" \ -\ + +#define YUV2RGB_OPERANDS \ : "+r" (index), "+r" (image) \ : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index) \ ); \ @@ -223,6 +224,7 @@ static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStr MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */ YUV2RGB_ENDLOOP(2) + YUV2RGB_OPERANDS } static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, @@ -280,6 +282,7 @@ static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStr MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */ YUV2RGB_ENDLOOP(2) + YUV2RGB_OPERANDS } static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, @@ -394,6 +397,7 @@ static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStr #endif YUV2RGB_ENDLOOP(3) + YUV2RGB_OPERANDS } #define RGB_PLANAR2PACKED32 \ @@ -450,4 +454,5 @@ static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStr RGB_PLANAR2PACKED32 YUV2RGB_ENDLOOP(4) + YUV2RGB_OPERANDS } -- cgit v1.2.3 From 6be0336c0d602c1f5f22bab12a9fce2fb3ae8a46 Mon Sep 17 00:00:00 2001 From: sdrik Date: Mon, 16 Mar 2009 20:04:32 +0000 Subject: Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28978 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/yuv2rgb.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'libswscale') diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 65af412c2c..309cb8df81 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -101,7 +101,7 @@ const int32_t ff_yuv2rgb_coeffs[8][4] = { Y = src[2*i+1]; \ dst[6*i+3] = b[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = r[Y]; -#define YUV2RGBFUNC(func_name, dst_type) \ +#define YUV2RGBFUNC(func_name, dst_type, alpha) \ static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, \ int srcSliceH, uint8_t* dst[], int dstStride[]){\ int y;\ @@ -145,7 +145,7 @@ static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSlic ENDYUV2RGBLINE(dst_delta)\ ENDYUV2RGBFUNC() -YUV2RGBFUNC(yuv2rgb_c_32, uint32_t) +YUV2RGBFUNC(yuv2rgb_c_32, uint32_t, 0) LOADCHROMA(0); PUTRGB(dst_1,py_1,0,0); PUTRGB(dst_2,py_2,0,1); @@ -174,7 +174,7 @@ ENDYUV2RGBLINE(8) PUTRGB(dst_1,py_1,1,0); ENDYUV2RGBFUNC() -YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t) +YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0) LOADCHROMA(0); PUTRGB24(dst_1,py_1,0); PUTRGB24(dst_2,py_2,0); @@ -201,7 +201,7 @@ ENDYUV2RGBLINE(24) ENDYUV2RGBFUNC() // only trivial mods from yuv2rgb_c_24_rgb -YUV2RGBFUNC(yuv2rgb_c_24_bgr, uint8_t) +YUV2RGBFUNC(yuv2rgb_c_24_bgr, uint8_t, 0) LOADCHROMA(0); PUTBGR24(dst_1,py_1,0); PUTBGR24(dst_2,py_2,0); @@ -229,7 +229,7 @@ ENDYUV2RGBFUNC() // This is exactly the same code as yuv2rgb_c_32 except for the types of // r, g, b, dst_1, dst_2 -YUV2RGBFUNC(yuv2rgb_c_16, uint16_t) +YUV2RGBFUNC(yuv2rgb_c_16, uint16_t, 0) LOADCHROMA(0); PUTRGB(dst_1,py_1,0,0); PUTRGB(dst_2,py_2,0,1); @@ -249,7 +249,7 @@ CLOSEYUV2RGBFUNC(8) // This is exactly the same code as yuv2rgb_c_32 except for the types of // r, g, b, dst_1, dst_2 -YUV2RGBFUNC(yuv2rgb_c_8, uint8_t) +YUV2RGBFUNC(yuv2rgb_c_8, uint8_t, 0) LOADCHROMA(0); PUTRGB(dst_1,py_1,0,0); PUTRGB(dst_2,py_2,0,1); @@ -268,7 +268,7 @@ YUV2RGBFUNC(yuv2rgb_c_8, uint8_t) CLOSEYUV2RGBFUNC(8) // r, g, b, dst_1, dst_2 -YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t) +YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0) const uint8_t *d32 = dither_8x8_32[y&7]; const uint8_t *d64 = dither_8x8_73[y&7]; #define PUTRGB8(dst,src,i,o) \ @@ -297,7 +297,7 @@ CLOSEYUV2RGBFUNC(8) // This is exactly the same code as yuv2rgb_c_32 except for the types of // r, g, b, dst_1, dst_2 -YUV2RGBFUNC(yuv2rgb_c_4, uint8_t) +YUV2RGBFUNC(yuv2rgb_c_4, uint8_t, 0) int acc; #define PUTRGB4(dst,src,i) \ Y = src[2*i]; \ @@ -323,7 +323,7 @@ YUV2RGBFUNC(yuv2rgb_c_4, uint8_t) PUTRGB4(dst_1,py_1,3); CLOSEYUV2RGBFUNC(4) -YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t) +YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t, 0) const uint8_t *d64 = dither_8x8_73[y&7]; const uint8_t *d128 = dither_8x8_220[y&7]; int acc; @@ -354,7 +354,7 @@ CLOSEYUV2RGBFUNC(4) // This is exactly the same code as yuv2rgb_c_32 except for the types of // r, g, b, dst_1, dst_2 -YUV2RGBFUNC(yuv2rgb_c_4b, uint8_t) +YUV2RGBFUNC(yuv2rgb_c_4b, uint8_t, 0) LOADCHROMA(0); PUTRGB(dst_1,py_1,0,0); PUTRGB(dst_2,py_2,0,1); @@ -372,7 +372,7 @@ YUV2RGBFUNC(yuv2rgb_c_4b, uint8_t) PUTRGB(dst_1,py_1,3,0); CLOSEYUV2RGBFUNC(8) -YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t) +YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t, 0) const uint8_t *d64 = dither_8x8_73[y&7]; const uint8_t *d128 = dither_8x8_220[y&7]; @@ -399,7 +399,7 @@ YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t) PUTRGB4DB(dst_1,py_1,3,6); CLOSEYUV2RGBFUNC(8) -YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t) +YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0) const uint8_t *d128 = dither_8x8_220[y&7]; char out_1 = 0, out_2 = 0; g= c->table_gU[128] + c->table_gV[128]; -- cgit v1.2.3 From 2e7a366dd9de3d579797b49b981a744e03a9c43c Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 17 Mar 2009 11:52:39 +0000 Subject: whitespace cosmetics: Consistently format function calls without space between name and parentheses; shorten some overly long lines. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28981 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_bfin.c | 28 +++++++------ libswscale/yuv2rgb_bfin.c | 104 +++++++++++++++++++++++----------------------- 2 files changed, 67 insertions(+), 65 deletions(-) (limited to 'libswscale') diff --git a/libswscale/swscale_bfin.c b/libswscale/swscale_bfin.c index ed7d9579b6..0c3ea4dc32 100644 --- a/libswscale/swscale_bfin.c +++ b/libswscale/swscale_bfin.c @@ -37,16 +37,16 @@ #define L1CODE #endif -int ff_bfin_uyvytoyv12 (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - long width, long height, - long lumStride, long chromStride, long srcStride) L1CODE; +int ff_bfin_uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, + long width, long height, + long lumStride, long chromStride, long srcStride) L1CODE; -int ff_bfin_yuyvtoyv12 (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - long width, long height, - long lumStride, long chromStride, long srcStride) L1CODE; +int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, + long width, long height, + long lumStride, long chromStride, long srcStride) L1CODE; -static int uyvytoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, - int srcSliceH, uint8_t* dst[], int dstStride[]) +static int uyvytoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, + int srcSliceH, uint8_t* dst[], int dstStride[]) { uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY; uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2; @@ -54,13 +54,14 @@ static int uyvytoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], uint8_t *ip = src[0] + srcStride[0]*srcSliceY; int w = dstStride[0]; - ff_bfin_uyvytoyv12 (ip, dsty, dstu, dstv, w, srcSliceH, dstStride[0], dstStride[1], srcStride[0]); + ff_bfin_uyvytoyv12(ip, dsty, dstu, dstv, w, srcSliceH, + dstStride[0], dstStride[1], srcStride[0]); return srcSliceH; } -static int yuyvtoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, - int srcSliceH, uint8_t* dst[], int dstStride[]) +static int yuyvtoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, + int srcSliceH, uint8_t* dst[], int dstStride[]) { uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY; uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2; @@ -68,13 +69,14 @@ static int yuyvtoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], uint8_t *ip = src[0] + srcStride[0]*srcSliceY; int w = dstStride[0]; - ff_bfin_yuyvtoyv12 (ip, dsty, dstu, dstv, w, srcSliceH, dstStride[0], dstStride[1], srcStride[0]); + ff_bfin_yuyvtoyv12(ip, dsty, dstu, dstv, w, srcSliceH, + dstStride[0], dstStride[1], srcStride[0]); return srcSliceH; } -void ff_bfin_get_unscaled_swscale (SwsContext *c) +void ff_bfin_get_unscaled_swscale(SwsContext *c) { SwsFunc swScale = c->swScale; if (c->flags & SWS_CPU_CAPS_BFIN) diff --git a/libswscale/yuv2rgb_bfin.c b/libswscale/yuv2rgb_bfin.c index 58cc5b6a35..5bbd77b320 100644 --- a/libswscale/yuv2rgb_bfin.c +++ b/libswscale/yuv2rgb_bfin.c @@ -38,20 +38,20 @@ #define L1CODE #endif -void ff_bfin_yuv2rgb555_line (uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, - int w, uint32_t *coeffs) L1CODE; - -void ff_bfin_yuv2rgb565_line (uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, - int w, uint32_t *coeffs) L1CODE; +void ff_bfin_yuv2rgb555_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, + int w, uint32_t *coeffs) L1CODE; -void ff_bfin_yuv2rgb24_line (uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, +void ff_bfin_yuv2rgb565_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, int w, uint32_t *coeffs) L1CODE; +void ff_bfin_yuv2rgb24_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, + int w, uint32_t *coeffs) L1CODE; + typedef void (* ltransform)(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out, int w, uint32_t *coeffs); -static void bfin_prepare_coefficients (SwsContext *c, int rgb, int masks) +static void bfin_prepare_coefficients(SwsContext *c, int rgb, int masks) { int oy; oy = c->yOffset&0xffff; @@ -88,18 +88,18 @@ static void bfin_prepare_coefficients (SwsContext *c, int rgb, int masks) } } -static int core_yuv420_rgb (SwsContext *c, - uint8_t **in, int *instrides, - int srcSliceY, int srcSliceH, - uint8_t **oplanes, int *outstrides, - ltransform lcscf, int rgb, int masks) +static int core_yuv420_rgb(SwsContext *c, + uint8_t **in, int *instrides, + int srcSliceY, int srcSliceH, + uint8_t **oplanes, int *outstrides, + ltransform lcscf, int rgb, int masks) { uint8_t *py,*pu,*pv,*op; int w = instrides[0]; int h2 = srcSliceH>>1; int i; - bfin_prepare_coefficients (c, rgb, masks); + bfin_prepare_coefficients(c, rgb, masks); py = in[0]; pu = in[1+(1^rgb)]; @@ -109,12 +109,12 @@ static int core_yuv420_rgb (SwsContext *c, for (i=0;ioy); + lcscf(py, pu, pv, op, w, &c->oy); py += instrides[0]; op += outstrides[0]; - lcscf (py, pu, pv, op, w, &c->oy); + lcscf(py, pu, pv, op, w, &c->oy); py += instrides[0]; pu += instrides[1]; @@ -126,62 +126,62 @@ static int core_yuv420_rgb (SwsContext *c, } -static int bfin_yuv420_rgb555 (SwsContext *c, - uint8_t **in, int *instrides, - int srcSliceY, int srcSliceH, - uint8_t **oplanes, int *outstrides) -{ - return core_yuv420_rgb (c, in, instrides, srcSliceY, srcSliceH, oplanes, outstrides, - ff_bfin_yuv2rgb555_line, 1, 555); -} - -static int bfin_yuv420_bgr555 (SwsContext *c, - uint8_t **in, int *instrides, - int srcSliceY, int srcSliceH, - uint8_t **oplanes, int *outstrides) -{ - return core_yuv420_rgb (c, in, instrides, srcSliceY, srcSliceH, oplanes, outstrides, - ff_bfin_yuv2rgb555_line, 0, 555); -} - -static int bfin_yuv420_rgb24 (SwsContext *c, +static int bfin_yuv420_rgb555(SwsContext *c, uint8_t **in, int *instrides, int srcSliceY, int srcSliceH, uint8_t **oplanes, int *outstrides) { - return core_yuv420_rgb (c, in, instrides, srcSliceY, srcSliceH, oplanes, outstrides, - ff_bfin_yuv2rgb24_line, 1, 888); + return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes, + outstrides, ff_bfin_yuv2rgb555_line, 1, 555); } -static int bfin_yuv420_bgr24 (SwsContext *c, +static int bfin_yuv420_bgr555(SwsContext *c, uint8_t **in, int *instrides, int srcSliceY, int srcSliceH, uint8_t **oplanes, int *outstrides) { - return core_yuv420_rgb (c, in, instrides, srcSliceY, srcSliceH, oplanes, outstrides, - ff_bfin_yuv2rgb24_line, 0, 888); + return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes, + outstrides, ff_bfin_yuv2rgb555_line, 0, 555); } -static int bfin_yuv420_rgb565 (SwsContext *c, - uint8_t **in, int *instrides, - int srcSliceY, int srcSliceH, - uint8_t **oplanes, int *outstrides) +static int bfin_yuv420_rgb24(SwsContext *c, + uint8_t **in, int *instrides, + int srcSliceY, int srcSliceH, + uint8_t **oplanes, int *outstrides) { - return core_yuv420_rgb (c, in, instrides, srcSliceY, srcSliceH, oplanes, outstrides, - ff_bfin_yuv2rgb565_line, 1, 565); + return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes, + outstrides, ff_bfin_yuv2rgb24_line, 1, 888); } -static int bfin_yuv420_bgr565 (SwsContext *c, - uint8_t **in, int *instrides, - int srcSliceY, int srcSliceH, - uint8_t **oplanes, int *outstrides) +static int bfin_yuv420_bgr24(SwsContext *c, + uint8_t **in, int *instrides, + int srcSliceY, int srcSliceH, + uint8_t **oplanes, int *outstrides) +{ + return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes, + outstrides, ff_bfin_yuv2rgb24_line, 0, 888); +} + +static int bfin_yuv420_rgb565(SwsContext *c, + uint8_t **in, int *instrides, + int srcSliceY, int srcSliceH, + uint8_t **oplanes, int *outstrides) +{ + return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes, + outstrides, ff_bfin_yuv2rgb565_line, 1, 565); +} + +static int bfin_yuv420_bgr565(SwsContext *c, + uint8_t **in, int *instrides, + int srcSliceY, int srcSliceH, + uint8_t **oplanes, int *outstrides) { - return core_yuv420_rgb (c, in, instrides, srcSliceY, srcSliceH, oplanes, outstrides, - ff_bfin_yuv2rgb565_line, 0, 565); + return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes, + outstrides, ff_bfin_yuv2rgb565_line, 0, 565); } -SwsFunc ff_bfin_yuv2rgb_get_func_ptr (SwsContext *c) +SwsFunc ff_bfin_yuv2rgb_get_func_ptr(SwsContext *c) { SwsFunc f; -- cgit v1.2.3 From 972614cb3872fea7242a75aaa395c965e0321d13 Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 17 Mar 2009 12:05:56 +0000 Subject: Fix ff_bfin_yuv2rgb_get_func_ptr() vs. sws_ff_bfin_yuv2rgb_get_func_ptr() name mismatch. The function is now called sws_yuv2rgb_get_func_ptr_bfin(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28982 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/yuv2rgb.c | 2 +- libswscale/yuv2rgb_bfin.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'libswscale') diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 309cb8df81..4d04fccb1d 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -460,7 +460,7 @@ SwsFunc sws_yuv2rgb_get_func_ptr(SwsContext *c) #if ARCH_BFIN if (c->flags & SWS_CPU_CAPS_BFIN) - t = sws_ff_bfin_yuv2rgb_get_func_ptr(c); + t = sws_yuv2rgb_get_func_ptr_bfin(c); #endif if (t) diff --git a/libswscale/yuv2rgb_bfin.c b/libswscale/yuv2rgb_bfin.c index 5bbd77b320..b88790743a 100644 --- a/libswscale/yuv2rgb_bfin.c +++ b/libswscale/yuv2rgb_bfin.c @@ -181,7 +181,7 @@ static int bfin_yuv420_bgr565(SwsContext *c, } -SwsFunc ff_bfin_yuv2rgb_get_func_ptr(SwsContext *c) +SwsFunc sws_yuv2rgb_get_func_ptr_bfin(SwsContext *c) { SwsFunc f; -- cgit v1.2.3 From baf5ee6d67308aea8b45db1b2ea6ff0fa5d9a4fc Mon Sep 17 00:00:00 2001 From: sdrik Date: Tue, 17 Mar 2009 19:51:52 +0000 Subject: Don't write outside of the picture buffer in planarCopy in the gray case git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28985 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libswscale') diff --git a/libswscale/swscale.c b/libswscale/swscale.c index c6012c15b7..8728e2bb6c 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1934,8 +1934,14 @@ static int planarCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli if ((isGray(c->srcFormat) || isGray(c->dstFormat)) && plane>0) { - if (!isGray(c->dstFormat)) - memset(dst[plane], 128, dstStride[plane]*height); + if (!isGray(c->dstFormat)){ + int i; + uint8_t *ptr = dst[plane] + dstStride[plane]*y; + for (i=0; i Date: Tue, 17 Mar 2009 19:53:36 +0000 Subject: Add a fillPlane function to fill a plane with one constant value git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28986 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'libswscale') diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 8728e2bb6c..391a39f667 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -953,6 +953,15 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t * } } +static void fillPlane(uint8_t* plane, int stride, int width, int height, int y, uint8_t val){ + int i; + uint8_t *ptr = plane + stride*y; + for (i=0; isrcFormat) || isGray(c->dstFormat)) && plane>0) { - if (!isGray(c->dstFormat)){ - int i; - uint8_t *ptr = dst[plane] + dstStride[plane]*y; - for (i=0; idstFormat)) + fillPlane(dst[plane], dstStride[plane], length, height, y, 128); } else { -- cgit v1.2.3 From a186cc55236117005c93d6c9f695e317e78eab26 Mon Sep 17 00:00:00 2001 From: diego Date: Wed, 18 Mar 2009 08:06:08 +0000 Subject: Consistently use ff_ prefixes for internal symbols. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28988 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 6 +++--- libswscale/swscale_internal.h | 10 +++++----- libswscale/swscale_template.c | 8 ++++---- libswscale/yuv2rgb.c | 14 +++++++------- libswscale/yuv2rgb_altivec.c | 6 +++--- libswscale/yuv2rgb_bfin.c | 2 +- libswscale/yuv2rgb_mlib.c | 2 +- libswscale/yuv2rgb_vis.c | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) (limited to 'libswscale') diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 391a39f667..5445425077 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -2142,12 +2142,12 @@ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange c->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13); c->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13); - sws_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation); + ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation); //FIXME factorize #ifdef COMPILE_ALTIVEC if (c->flags & SWS_CPU_CAPS_ALTIVEC) - sws_yuv2rgb_altivec_init_tables (c, inv_table, brightness, contrast, saturation); + ff_yuv2rgb_init_tables_altivec(c, inv_table, brightness, contrast, saturation); #endif return 0; } @@ -2344,7 +2344,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P || srcFormat==PIX_FMT_YUVA420P) && (isBGR(dstFormat) || isRGB(dstFormat)) && !(flags & SWS_ACCURATE_RND) && !(dstH&1)) { - c->swScale= sws_yuv2rgb_get_func_ptr(c); + c->swScale= ff_yuv2rgb_get_func_ptr(c); } if (srcFormat==PIX_FMT_YUV410P && dstFormat==PIX_FMT_YUV420P && !(flags & SWS_BITEXACT)) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 13b9609060..ca1528e0f1 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -212,12 +212,12 @@ typedef struct SwsContext{ } SwsContext; //FIXME check init (where 0) -SwsFunc sws_yuv2rgb_get_func_ptr (SwsContext *c); -int sws_yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation); +SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c); +int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation); -void sws_yuv2rgb_altivec_init_tables (SwsContext *c, const int inv_table[4],int brightness,int contrast, int saturation); -SwsFunc sws_yuv2rgb_init_altivec (SwsContext *c); -void altivec_yuv2packedX (SwsContext *c, +void ff_yuv2rgb_init_tables_altivec(SwsContext *c, const int inv_table[4], int brightness, int contrast, int saturation); +SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c); +void ff_yuv2packedX_altivec(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstY); diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 80704f6eb6..f08fcf5bf0 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -1160,14 +1160,14 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_ #endif /* HAVE_MMX */ #if HAVE_ALTIVEC /* The following list of supported dstFormat values should - match what's found in the body of altivec_yuv2packedX() */ + match what's found in the body of ff_yuv2packedX_altivec() */ if (!(c->flags & SWS_BITEXACT) && (c->dstFormat==PIX_FMT_ABGR || c->dstFormat==PIX_FMT_BGRA || c->dstFormat==PIX_FMT_BGR24 || c->dstFormat==PIX_FMT_RGB24 || c->dstFormat==PIX_FMT_RGBA || c->dstFormat==PIX_FMT_ARGB)) - altivec_yuv2packedX (c, lumFilter, lumSrc, lumFilterSize, - chrFilter, chrSrc, chrFilterSize, - dest, dstW, dstY); + ff_yuv2packedX_altivec(c, lumFilter, lumSrc, lumFilterSize, + chrFilter, chrSrc, chrFilterSize, + dest, dstW, dstY); else #endif yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize, diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 4d04fccb1d..3060b22003 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -426,7 +426,7 @@ YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0) dst_2[0]= out_2; CLOSEYUV2RGBFUNC(1) -SwsFunc sws_yuv2rgb_get_func_ptr(SwsContext *c) +SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c) { SwsFunc t = NULL; #if (HAVE_MMX2 || HAVE_MMX) && CONFIG_GPL @@ -448,19 +448,19 @@ SwsFunc sws_yuv2rgb_get_func_ptr(SwsContext *c) } #endif #if HAVE_VIS - t = sws_yuv2rgb_init_vis(c); + t = ff_yuv2rgb_init_vis(c); #endif #if CONFIG_MLIB - t = sws_yuv2rgb_init_mlib(c); + t = ff_yuv2rgb_init_mlib(c); #endif #if HAVE_ALTIVEC && CONFIG_GPL if (c->flags & SWS_CPU_CAPS_ALTIVEC) - t = sws_yuv2rgb_init_altivec(c); + t = ff_yuv2rgb_init_altivec(c); #endif #if ARCH_BFIN if (c->flags & SWS_CPU_CAPS_BFIN) - t = sws_yuv2rgb_get_func_ptr_bfin(c); + t = ff_yuv2rgb_get_func_ptr_bfin(c); #endif if (t) @@ -517,8 +517,8 @@ static void fill_gv_table(int table[256], const int elemsize, const int inc) } } -av_cold int sws_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange, - int brightness, int contrast, int saturation) +av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange, + int brightness, int contrast, int saturation) { const int isRgb = c->dstFormat==PIX_FMT_RGB32 || c->dstFormat==PIX_FMT_RGB32_1 diff --git a/libswscale/yuv2rgb_altivec.c b/libswscale/yuv2rgb_altivec.c index b3a87a0360..e029805b3c 100644 --- a/libswscale/yuv2rgb_altivec.c +++ b/libswscale/yuv2rgb_altivec.c @@ -690,7 +690,7 @@ static int altivec_uyvy_rgb32 (SwsContext *c, So we just fall back to the C codes for this. */ -SwsFunc sws_yuv2rgb_init_altivec (SwsContext *c) +SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c) { if (!(c->flags & SWS_CPU_CAPS_ALTIVEC)) return NULL; @@ -750,7 +750,7 @@ SwsFunc sws_yuv2rgb_init_altivec (SwsContext *c) return NULL; } -void sws_yuv2rgb_altivec_init_tables (SwsContext *c, const int inv_table[4],int brightness,int contrast, int saturation) +void ff_yuv2rgb_init_tables_altivec(SwsContext *c, const int inv_table[4], int brightness, int contrast, int saturation) { union { signed short tmp[8] __attribute__ ((aligned(16))); @@ -786,7 +786,7 @@ void sws_yuv2rgb_altivec_init_tables (SwsContext *c, const int inv_table[4],int void -altivec_yuv2packedX (SwsContext *c, +ff_yuv2packedX_altivec(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstY) diff --git a/libswscale/yuv2rgb_bfin.c b/libswscale/yuv2rgb_bfin.c index b88790743a..2cc6962d01 100644 --- a/libswscale/yuv2rgb_bfin.c +++ b/libswscale/yuv2rgb_bfin.c @@ -181,7 +181,7 @@ static int bfin_yuv420_bgr565(SwsContext *c, } -SwsFunc sws_yuv2rgb_get_func_ptr_bfin(SwsContext *c) +SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c) { SwsFunc f; diff --git a/libswscale/yuv2rgb_mlib.c b/libswscale/yuv2rgb_mlib.c index 68247914e7..c8966b9fd5 100644 --- a/libswscale/yuv2rgb_mlib.c +++ b/libswscale/yuv2rgb_mlib.c @@ -73,7 +73,7 @@ static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], in } -SwsFunc sws_yuv2rgb_init_mlib(SwsContext *c) +SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c) { switch(c->dstFormat){ case PIX_FMT_RGB24: return mlib_YUV2RGB420_24; diff --git a/libswscale/yuv2rgb_vis.c b/libswscale/yuv2rgb_vis.c index 2e2737aa9f..fd5d0ba2f9 100644 --- a/libswscale/yuv2rgb_vis.c +++ b/libswscale/yuv2rgb_vis.c @@ -184,7 +184,7 @@ static int vis_422P_ARGB32(SwsContext *c, uint8_t* src[], int srcStride[], int s return srcSliceH; } -SwsFunc sws_yuv2rgb_init_vis(SwsContext *c) { +SwsFunc ff_yuv2rgb_init_vis(SwsContext *c){ c->sparc_coeffs[5]=c->yCoeff; c->sparc_coeffs[6]=c->vgCoeff; c->sparc_coeffs[7]=c->vrCoeff; -- cgit v1.2.3 From 72e3d88202beb08f6c5afefab0198aaa2714360b Mon Sep 17 00:00:00 2001 From: ramiro Date: Wed, 18 Mar 2009 17:07:30 +0000 Subject: Do not assume long is same width as x86 register. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28992 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/rgb2rgb_template.c | 30 ++++++++++++++++-------------- libswscale/swscale.c | 12 ++++++------ libswscale/swscale_template.c | 30 +++++++++++++++--------------- libswscale/yuv2rgb.c | 1 + libswscale/yuv2rgb_template.c | 2 +- 5 files changed, 39 insertions(+), 36 deletions(-) (limited to 'libswscale') diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index b03f6424f7..e2b66c9226 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -1339,7 +1339,7 @@ static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, long src_ static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size) { - long idx = 15 - src_size; + x86_reg idx = 15 - src_size; const uint8_t *s = src-idx; uint8_t *d = dst-idx; #if HAVE_MMX @@ -1405,7 +1405,7 @@ static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long s { unsigned i; #if HAVE_MMX - long mmx_size= 23 - src_size; + x86_reg mmx_size= 23 - src_size; __asm__ volatile ( "test %%"REG_a", %%"REG_a" \n\t" "jns 2f \n\t" @@ -1476,7 +1476,7 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long y; - const long chromWidth= width>>1; + const x86_reg chromWidth= width>>1; for (y=0; y>1; + const x86_reg chromWidth= width>>1; for (y=0; y>1; + const x86_reg chromWidth= width>>1; for (y=0; y>2; dst[dstStride]= ( src[0] + 3*src[srcStride])>>2; @@ -1996,7 +1996,7 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t long lumStride, long chromStride, long srcStride) { long y; - const long chromWidth= width>>1; + const x86_reg chromWidth= width>>1; for (y=0; y>1; + const x86_reg chromWidth= width>>1; #if HAVE_MMX for (y=0; yflags & SWS_ACCURATE_RND){ while(p--){ @@ -1024,7 +1024,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_ uint8_t *dest, long dstW, long dstY) { #if HAVE_MMX - long dummy=0; + x86_reg dummy=0; if(!(c->flags & SWS_BITEXACT)){ if (c->flags & SWS_ACCURATE_RND){ switch(c->dstFormat){ @@ -1515,7 +1515,7 @@ static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, long width, uint3 "movq %%mm0, (%2, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" - : : "g" (-width), "r" (src+width*2), "r" (dst+width) + : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst+width) : "%"REG_a ); #else @@ -1546,7 +1546,7 @@ static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, "movd %%mm1, (%2, %%"REG_a") \n\t" "add $4, %%"REG_a" \n\t" " js 1b \n\t" - : : "g" (-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width) + : : "g" ((x86_reg)-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width) : "%"REG_a ); #else @@ -1576,7 +1576,7 @@ static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width, uint3 "movq %%mm0, (%2, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" - : : "g" (-width), "r" (src+width*2), "r" (dst+width) + : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst+width) : "%"REG_a ); #else @@ -1607,7 +1607,7 @@ static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, "movd %%mm1, (%2, %%"REG_a") \n\t" "add $4, %%"REG_a" \n\t" " js 1b \n\t" - : : "g" (-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width) + : : "g" ((x86_reg)-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width) : "%"REG_a ); #else @@ -1731,7 +1731,7 @@ static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, uint8_t *src, long width, "add $4, %%"REG_a" \n\t" " js 1b \n\t" : "+r" (src) - : "r" (dst+width), "g" (-width) + : "r" (dst+width), "g" ((x86_reg)-width) : "%"REG_a ); } @@ -1789,7 +1789,7 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, uint8_t * "add $4, %%"REG_a" \n\t" " js 1b \n\t" : "+r" (src) - : "r" (dstU+width), "r" (dstV+width), "g" (-width), "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0]) + : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0]) : "%"REG_a ); } @@ -1951,7 +1951,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW assert(filterSize % 4 == 0 && filterSize>0); if (filterSize==4) // Always true for upscaling, sometimes for down, too. { - long counter= -2*dstW; + x86_reg counter= -2*dstW; filter-= counter*2; filterPos-= counter/2; dst-= counter/2; @@ -1997,7 +1997,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW } else if (filterSize==8) { - long counter= -2*dstW; + x86_reg counter= -2*dstW; filter-= counter*4; filterPos-= counter/2; dst-= counter/2; @@ -2055,7 +2055,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW else { uint8_t *offset = src+filterSize; - long counter= -2*dstW; + x86_reg counter= -2*dstW; //filter-= counter*filterSize/2; filterPos-= counter/2; dst-= counter/2; @@ -2098,7 +2098,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW : "+r" (counter), "+r" (filter) : "m" (filterPos), "m" (dst), "m"(offset), - "m" (src), "r" (filterSize*2) + "m" (src), "r" ((x86_reg)filterSize*2) : "%"REG_a, "%"REG_c, "%"REG_d ); } @@ -2289,7 +2289,7 @@ FUNNY_Y_CODE else { #endif /* HAVE_MMX2 */ - long xInc_shr16 = xInc >> 16; + x86_reg xInc_shr16 = xInc >> 16; uint16_t xInc_mask = xInc & 0xffff; //NO MMX just normal asm ... __asm__ volatile( @@ -2575,7 +2575,7 @@ FUNNY_UV_CODE else { #endif /* HAVE_MMX2 */ - long xInc_shr16 = (long) (xInc >> 16); + x86_reg xInc_shr16 = (x86_reg) (xInc >> 16); uint16_t xInc_mask = xInc & 0xffff; __asm__ volatile( "xor %%"REG_a", %%"REG_a" \n\t" // i @@ -2613,7 +2613,7 @@ FUNNY_UV_CODE /* GCC 3.3 makes MPlayer crash on IA-32 machines when using "g" operand here, which is needed to support GCC 4.0. */ #if ARCH_X86_64 && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), + :: "m" (src1), "m" (dst), "g" ((x86_reg)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #else :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #endif diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 3060b22003..7cdf945b14 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -33,6 +33,7 @@ #include "rgb2rgb.h" #include "swscale.h" #include "swscale_internal.h" +#include "libavutil/x86_cpu.h" #define DITHER1XBPP // only for MMX diff --git a/libswscale/yuv2rgb_template.c b/libswscale/yuv2rgb_template.c index 35b7f14f60..dc0198f2a3 100644 --- a/libswscale/yuv2rgb_template.c +++ b/libswscale/yuv2rgb_template.c @@ -137,7 +137,7 @@ uint8_t *py = src[0] + y*srcStride[0]; \ uint8_t *pu = src[1] + (y>>1)*srcStride[1]; \ uint8_t *pv = src[2] + (y>>1)*srcStride[2]; \ - long index= -h_size/2; \ + x86_reg index= -h_size/2; \ #define YUV2RGB_INIT \ /* This MMX assembly code deals with a SINGLE scan line at a time, \ -- cgit v1.2.3 From 7fcbe59d3f0cb5444d1a56f822f3e4ef77b8a17d Mon Sep 17 00:00:00 2001 From: ramiro Date: Wed, 18 Mar 2009 17:12:44 +0000 Subject: swscale-example: use LFG instead of random() git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28993 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale-example.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libswscale') diff --git a/libswscale/swscale-example.c b/libswscale/swscale-example.c index 87b9ba027d..993d8db900 100644 --- a/libswscale/swscale-example.c +++ b/libswscale/swscale-example.c @@ -26,6 +26,7 @@ #undef HAVE_AV_CONFIG_H #include "libavutil/avutil.h" +#include "libavutil/lfg.h" #include "swscale.h" #include "swscale_internal.h" @@ -194,12 +195,15 @@ int main(int argc, char **argv){ int stride[3]={W, W, W}; int x, y; struct SwsContext *sws; + AVLFG rand; sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUV420P, 2, NULL, NULL, NULL); + av_lfg_init(&rand, 1); + for (y=0; y Date: Wed, 18 Mar 2009 22:11:50 +0000 Subject: Fix libswscale compilation on non-x86, hopefully without breaking MinGW64 again. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28996 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/rgb2rgb_template.c | 46 ++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'libswscale') diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index e2b66c9226..fb4ac23d88 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -1339,7 +1339,12 @@ static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, long src_ static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size) { - x86_reg idx = 15 - src_size; +#if HAVE_MMX + x86_reg +#else + long +#endif + idx = 15 - src_size; const uint8_t *s = src-idx; uint8_t *d = dst-idx; #if HAVE_MMX @@ -1476,10 +1481,11 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long y; - const x86_reg chromWidth= width>>1; + const long chromWidth= width>>1; for (y=0; y>1; + const long chromWidth= width>>1; for (y=0; y>1; + const long chromWidth= width>>1; for (y=0; y>2; dst[dstStride]= ( src[0] + 3*src[srcStride])>>2; @@ -1996,10 +2004,11 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t long lumStride, long chromStride, long srcStride) { long y; - const x86_reg chromWidth= width>>1; + const long chromWidth= width>>1; for (y=0; y>1; + const long chromWidth= width>>1; #if HAVE_MMX + x86_reg cw = chromWidth; for (y=0; y>2); const uint8_t* vp=src3+srcStride3*(y>>2); uint8_t* d=dst+dstStride*y; - x=0; #if HAVE_MMX + x86_reg x = 0; for (;x Date: Thu, 19 Mar 2009 03:45:29 +0000 Subject: Unscaled converters for YUYV->YUV420P YUYV->YUV422P UYVY->YUV420P UYVY->YUV422P git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28997 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/rgb2rgb.c | 13 +++ libswscale/rgb2rgb.h | 14 +++ libswscale/rgb2rgb_template.c | 245 +++++++++++++++++++++++++++++++++++++++++- libswscale/swscale.c | 53 +++++++++ 4 files changed, 324 insertions(+), 1 deletion(-) (limited to 'libswscale') diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index ad69265c37..59b8e30a63 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -87,6 +87,19 @@ void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *sr long width, long height, long srcStride1, long srcStride2, long srcStride3, long dstStride); +void (*uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); +void (*uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); +void (*yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); +void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); + #if ARCH_X86 && CONFIG_GPL DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL; diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h index df912c8533..3850ef291d 100644 --- a/libswscale/rgb2rgb.h +++ b/libswscale/rgb2rgb.h @@ -142,6 +142,20 @@ extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint long srcStride1, long srcStride2, long srcStride3, long dstStride); + +extern void (*uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); +extern void (*uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); +extern void (*yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); +extern void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride); + void sws_rgb2rgb_init(int flags); #endif /* SWSCALE_RGB2RGB_H */ diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index fb4ac23d88..fa6de09a09 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -2701,6 +2701,245 @@ static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2 #endif } +static void RENAME(extract_even)(const uint8_t *src, uint8_t *dst, x86_reg count) +{ + dst += count; + src += 2*count; + count= - count; + +#if HAVE_MMX + if(count <= -16){ + count += 15; + __asm__ volatile( + "pcmpeqw %%mm7, %%mm7 \n\t" + "psrlw $8, %%mm7 \n\t" + "1: \n\t" + "movq -30(%1, %0, 2), %%mm0 \n\t" + "movq -22(%1, %0, 2), %%mm1 \n\t" + "movq -14(%1, %0, 2), %%mm2 \n\t" + "movq -6(%1, %0, 2), %%mm3 \n\t" + "pand %%mm7, %%mm0 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm2 \n\t" + "pand %%mm7, %%mm3 \n\t" + "packuswb %%mm1, %%mm0 \n\t" + "packuswb %%mm3, %%mm2 \n\t" + MOVNTQ" %%mm0,-15(%2, %0) \n\t" + MOVNTQ" %%mm2,- 7(%2, %0) \n\t" + "add $16, %0 \n\t" + " js 1b \n\t" + : "+r"(count) + : "r"(src), "r"(dst) + ); + count -= 15; + } +#endif + while(count<0){ + dst[count]= src[2*count]; + count++; + } +} + +static void RENAME(extract_even2)(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, x86_reg count) +{ + dst0+= count; + dst1+= count; + src += 4*count; + count= - count; +#if HAVE_MMX + if(count <= -8){ + count += 7; + __asm__ volatile( + "pcmpeqw %%mm7, %%mm7 \n\t" + "psrlw $8, %%mm7 \n\t" + "1: \n\t" + "movq -28(%1, %0, 4), %%mm0 \n\t" + "movq -20(%1, %0, 4), %%mm1 \n\t" + "movq -12(%1, %0, 4), %%mm2 \n\t" + "movq -4(%1, %0, 4), %%mm3 \n\t" + "pand %%mm7, %%mm0 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm2 \n\t" + "pand %%mm7, %%mm3 \n\t" + "packuswb %%mm1, %%mm0 \n\t" + "packuswb %%mm3, %%mm2 \n\t" + "movq %%mm0, %%mm1 \n\t" + "movq %%mm2, %%mm3 \n\t" + "psrlw $8, %%mm0 \n\t" + "psrlw $8, %%mm2 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm3 \n\t" + "packuswb %%mm2, %%mm0 \n\t" + "packuswb %%mm3, %%mm1 \n\t" + MOVNTQ" %%mm0,- 7(%3, %0) \n\t" + MOVNTQ" %%mm1,- 7(%2, %0) \n\t" + "add $8, %0 \n\t" + " js 1b \n\t" + : "+r"(count) + : "r"(src), "r"(dst0), "r"(dst1) + ); + count -= 7; + } +#endif + while(count<0){ + dst0[count]= src[4*count+0]; + dst1[count]= src[4*count+2]; + count++; + } +} + +static void RENAME(extract_odd2)(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, x86_reg count) +{ + dst0+= count; + dst1+= count; + src += 4*count; + count= - count; +#if HAVE_MMX + if(count <= -8){ + count += 7; + __asm__ volatile( + "pcmpeqw %%mm7, %%mm7 \n\t" + "psrlw $8, %%mm7 \n\t" + "1: \n\t" + "movq -28(%1, %0, 4), %%mm0 \n\t" + "movq -20(%1, %0, 4), %%mm1 \n\t" + "movq -12(%1, %0, 4), %%mm2 \n\t" + "movq -4(%1, %0, 4), %%mm3 \n\t" + "psrlw $8, %%mm0 \n\t" + "psrlw $8, %%mm1 \n\t" + "psrlw $8, %%mm2 \n\t" + "psrlw $8, %%mm3 \n\t" + "packuswb %%mm1, %%mm0 \n\t" + "packuswb %%mm3, %%mm2 \n\t" + "movq %%mm0, %%mm1 \n\t" + "movq %%mm2, %%mm3 \n\t" + "psrlw $8, %%mm0 \n\t" + "psrlw $8, %%mm2 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm3 \n\t" + "packuswb %%mm2, %%mm0 \n\t" + "packuswb %%mm3, %%mm1 \n\t" + MOVNTQ" %%mm0,- 7(%3, %0) \n\t" + MOVNTQ" %%mm1,- 7(%2, %0) \n\t" + "add $8, %0 \n\t" + " js 1b \n\t" + : "+r"(count) + : "r"(src), "r"(dst0), "r"(dst1) + ); + count -= 7; + } +#endif + while(count<0){ + dst0[count]= src[4*count+0]; + dst1[count]= src[4*count+2]; + count++; + } +} + +static void RENAME(yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, + long width, long height, + long lumStride, long chromStride, long srcStride) +{ + long y; + const long chromWidth= -((-width)>>1); + + for (y=0; y>1); + + for (y=0; y