Commit 7f526efd authored by Reimar Döffinger's avatar Reimar Döffinger

Change unsigned->signed and int->long, this fits the asm code better on 64

bit systems.
Also fixes several crashes because (long)-i is incorrect if i is unsigned.

Originally committed as revision 16740 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
parent b926572a
This diff is collapsed.
......@@ -12,46 +12,46 @@
// Note: do not fix the dependence on stdio.h
/* A full collection of rgb to rgb(bgr) convertors */
extern void (*rgb24to32)(const uint8_t *src,uint8_t *dst,unsigned src_size);
extern void (*rgb24to16)(const uint8_t *src,uint8_t *dst,unsigned src_size);
extern void (*rgb24to15)(const uint8_t *src,uint8_t *dst,unsigned src_size);
extern void (*rgb32to24)(const uint8_t *src,uint8_t *dst,unsigned src_size);
extern void (*rgb32to16)(const uint8_t *src,uint8_t *dst,unsigned src_size);
extern void (*rgb32to15)(const uint8_t *src,uint8_t *dst,unsigned src_size);
extern void (*rgb15to16)(const uint8_t *src,uint8_t *dst,unsigned src_size);
extern void (*rgb15to24)(const uint8_t *src,uint8_t *dst,unsigned src_size);
extern void (*rgb15to32)(const uint8_t *src,uint8_t *dst,unsigned src_size);
extern void (*rgb16to15)(const uint8_t *src,uint8_t *dst,unsigned src_size);
extern void (*rgb16to24)(const uint8_t *src,uint8_t *dst,unsigned src_size);
extern void (*rgb16to32)(const uint8_t *src,uint8_t *dst,unsigned src_size);
extern void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void rgb24tobgr32(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void rgb32tobgr24(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void rgb16tobgr32(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void rgb16tobgr24(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void rgb16tobgr16(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void rgb16tobgr15(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void rgb15tobgr32(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void rgb15tobgr24(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void rgb15tobgr16(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void rgb15tobgr15(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void rgb8tobgr8(const uint8_t *src, uint8_t *dst, unsigned src_size);
extern void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
extern void palette8tobgr32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
extern void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
extern void palette8tobgr24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
extern void palette8torgb16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
extern void palette8tobgr16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
extern void palette8torgb15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
extern void palette8tobgr15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette);
extern void (*rgb24to32)(const uint8_t *src,uint8_t *dst,long src_size);
extern void (*rgb24to16)(const uint8_t *src,uint8_t *dst,long src_size);
extern void (*rgb24to15)(const uint8_t *src,uint8_t *dst,long src_size);
extern void (*rgb32to24)(const uint8_t *src,uint8_t *dst,long src_size);
extern void (*rgb32to16)(const uint8_t *src,uint8_t *dst,long src_size);
extern void (*rgb32to15)(const uint8_t *src,uint8_t *dst,long src_size);
extern void (*rgb15to16)(const uint8_t *src,uint8_t *dst,long src_size);
extern void (*rgb15to24)(const uint8_t *src,uint8_t *dst,long src_size);
extern void (*rgb15to32)(const uint8_t *src,uint8_t *dst,long src_size);
extern void (*rgb16to15)(const uint8_t *src,uint8_t *dst,long src_size);
extern void (*rgb16to24)(const uint8_t *src,uint8_t *dst,long src_size);
extern void (*rgb16to32)(const uint8_t *src,uint8_t *dst,long src_size);
extern void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
extern void rgb24tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
extern void rgb32tobgr24(const uint8_t *src, uint8_t *dst, long src_size);
extern void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
extern void rgb16tobgr24(const uint8_t *src, uint8_t *dst, long src_size);
extern void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size);
extern void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size);
extern void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
extern void rgb15tobgr24(const uint8_t *src, uint8_t *dst, long src_size);
extern void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size);
extern void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size);
extern void rgb8tobgr8(const uint8_t *src, uint8_t *dst, long src_size);
extern void palette8torgb32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
extern void palette8tobgr32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
extern void palette8torgb24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
extern void palette8tobgr24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
extern void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
extern void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
extern void palette8torgb15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
extern void palette8tobgr15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
/**
*
......@@ -67,16 +67,16 @@ extern void palette8tobgr15(const uint8_t *src, uint8_t *dst, unsigned num_pixel
* problem for anyone then tell me, and ill fix it)
*/
extern void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
unsigned int width, unsigned int height,
int lumStride, int chromStride, int dstStride);
long width, long height,
long lumStride, long chromStride, long dstStride);
/**
*
* width should be a multiple of 16
*/
extern void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
unsigned int width, unsigned int height,
int lumStride, int chromStride, int dstStride);
long width, long height,
long lumStride, long chromStride, long dstStride);
/**
*
......@@ -84,8 +84,8 @@ extern void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uin
* problem for anyone then tell me, and ill fix it)
*/
extern void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
unsigned int width, unsigned int height,
int lumStride, int chromStride, int srcStride);
long width, long height,
long lumStride, long chromStride, long srcStride);
/**
*
......@@ -93,8 +93,8 @@ extern void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint
* problem for anyone then tell me, and ill fix it)
*/
extern void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
unsigned int width, unsigned int height,
int lumStride, int chromStride, int dstStride);
long width, long height,
long lumStride, long chromStride, long dstStride);
/**
*
......@@ -103,25 +103,26 @@ extern void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_
* chrominance data is only taken from every secound line others are ignored FIXME write HQ version
*/
extern void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
unsigned int width, unsigned int height,
int lumStride, int chromStride, int srcStride);
extern void (*planar2x)(const uint8_t *src, uint8_t *dst, int width, int height, int srcStride, int dstStride);
long width, long height,
long lumStride, long chromStride, long srcStride);
extern void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height,
long srcStride, long dstStride);
extern void (*interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst,
unsigned width, unsigned height, int src1Stride,
int src2Stride, int dstStride);
long width, long height, long src1Stride,
long src2Stride, long dstStride);
extern void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
uint8_t *dst1, uint8_t *dst2,
unsigned width, unsigned height,
int srcStride1, int srcStride2,
int dstStride1, int dstStride2);
long width, long height,
long srcStride1, long srcStride2,
long dstStride1, long dstStride2);
extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
uint8_t *dst,
unsigned width, unsigned height,
int srcStride1, int srcStride2,
int srcStride3, int dstStride);
long width, long height,
long srcStride1, long srcStride2,
long srcStride3, long dstStride);
#define MODE_RGB 0x1
......
This diff is collapsed.
......@@ -757,7 +757,7 @@
static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW)
{
#ifdef HAVE_MMX
if(uDest != NULL)
......@@ -765,14 +765,14 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t *
asm volatile(
YSCALEYUV2YV12X(0, CHR_MMX_FILTER_OFFSET)
:: "r" (&c->redDither),
"r" (uDest), "p" ((long)chrDstW)
"r" (uDest), "p" (chrDstW)
: "%"REG_a, "%"REG_d, "%"REG_S
);
asm volatile(
YSCALEYUV2YV12X(4096, CHR_MMX_FILTER_OFFSET)
:: "r" (&c->redDither),
"r" (vDest), "p" ((long)chrDstW)
"r" (vDest), "p" (chrDstW)
: "%"REG_a, "%"REG_d, "%"REG_S
);
}
......@@ -780,7 +780,7 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t *
asm volatile(
YSCALEYUV2YV12X(0, LUM_MMX_FILTER_OFFSET)
:: "r" (&c->redDither),
"r" (dest), "p" ((long)dstW)
"r" (dest), "p" (dstW)
: "%"REG_a, "%"REG_d, "%"REG_S
);
#else
......@@ -806,7 +806,7 @@ yuv2nv12XinC(lumFilter, lumSrc, lumFilterSize,
}
static inline void RENAME(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc,
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW)
{
#ifdef HAVE_MMX
if(uDest != NULL)
......@@ -814,14 +814,14 @@ static inline void RENAME(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc,
asm volatile(
YSCALEYUV2YV121
:: "r" (chrSrc + chrDstW), "r" (uDest + chrDstW),
"g" ((long)-chrDstW)
"g" (-chrDstW)
: "%"REG_a
);
asm volatile(
YSCALEYUV2YV121
:: "r" (chrSrc + 2048 + chrDstW), "r" (vDest + chrDstW),
"g" ((long)-chrDstW)
"g" (-chrDstW)
: "%"REG_a
);
}
......@@ -829,7 +829,7 @@ static inline void RENAME(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc,
asm volatile(
YSCALEYUV2YV121
:: "r" (lumSrc + dstW), "r" (dest + dstW),
"g" ((long)-dstW)
"g" (-dstW)
: "%"REG_a
);
#else
......@@ -1489,7 +1489,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
//FIXME yuy2* can read upto 7 samples to much
static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, int width)
static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, long width)
{
#ifdef HAVE_MMX
asm volatile(
......@@ -1504,7 +1504,7 @@ static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, int width)
"movq %%mm0, (%2, %%"REG_a") \n\t"
"add $8, %%"REG_a" \n\t"
" js 1b \n\t"
: : "g" ((long)-width), "r" (src+width*2), "r" (dst+width)
: : "g" (-width), "r" (src+width*2), "r" (dst+width)
: "%"REG_a
);
#else
......@@ -1514,7 +1514,7 @@ static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, int width)
#endif
}
static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width)
{
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
asm volatile(
......@@ -1539,7 +1539,7 @@ static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1,
"movd %%mm1, (%3, %%"REG_a") \n\t"
"add $4, %%"REG_a" \n\t"
" js 1b \n\t"
: : "g" ((long)-width), "r" (src1+width*4), "r" (src2+width*4), "r" (dstU+width), "r" (dstV+width)
: : "g" (-width), "r" (src1+width*4), "r" (src2+width*4), "r" (dstU+width), "r" (dstV+width)
: "%"REG_a
);
#else
......@@ -1553,7 +1553,7 @@ static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1,
}
//this is allmost identical to the previous, end exists only cuz yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses
static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, int width)
static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width)
{
#ifdef HAVE_MMX
asm volatile(
......@@ -1567,7 +1567,7 @@ static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, int width)
"movq %%mm0, (%2, %%"REG_a") \n\t"
"add $8, %%"REG_a" \n\t"
" js 1b \n\t"
: : "g" ((long)-width), "r" (src+width*2), "r" (dst+width)
: : "g" (-width), "r" (src+width*2), "r" (dst+width)
: "%"REG_a
);
#else
......@@ -1577,7 +1577,7 @@ static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, int width)
#endif
}
static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width)
{
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
asm volatile(
......@@ -1602,7 +1602,7 @@ static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1,
"movd %%mm1, (%3, %%"REG_a") \n\t"
"add $4, %%"REG_a" \n\t"
" js 1b \n\t"
: : "g" ((long)-width), "r" (src1+width*4), "r" (src2+width*4), "r" (dstU+width), "r" (dstV+width)
: : "g" (-width), "r" (src1+width*4), "r" (src2+width*4), "r" (dstU+width), "r" (dstV+width)
: "%"REG_a
);
#else
......@@ -1648,7 +1648,7 @@ static inline void RENAME(bgr32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
}
}
static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, int width)
static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, long width)
{
#ifdef HAVE_MMX
asm volatile(
......@@ -1717,7 +1717,7 @@ static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, int width)
"movq %%mm0, (%1, %%"REG_a") \n\t"
"add $8, %%"REG_a" \n\t"
" js 1b \n\t"
: : "r" (src+width*3), "r" (dst+width), "g" ((long)-width)
: : "r" (src+width*3), "r" (dst+width), "g" (-width)
: "%"REG_a, "%"REG_b
);
#else
......@@ -1733,7 +1733,7 @@ static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, int width)
#endif
}
static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width)
{
#ifdef HAVE_MMX
asm volatile(
......@@ -1882,7 +1882,7 @@ static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
"movd %%mm0, (%3, %%"REG_a") \n\t"
"add $4, %%"REG_a" \n\t"
" js 1b \n\t"
: : "r" (src1+width*6), "r" (src2+width*6), "r" (dstU+width), "r" (dstV+width), "g" ((long)-width)
: : "r" (src1+width*6), "r" (src2+width*6), "r" (dstU+width), "r" (dstV+width), "g" (-width)
: "%"REG_a, "%"REG_b
);
#else
......@@ -2035,7 +2035,7 @@ static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1
// Bilinear / Bicubic scaling
static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc,
int16_t *filter, int16_t *filterPos, int filterSize)
int16_t *filter, int16_t *filterPos, long filterSize)
{
#ifdef HAVE_MMX
assert(filterSize % 4 == 0 && filterSize>0);
......@@ -2173,7 +2173,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" ((long)filterSize*2)
"m" (src), "r" (filterSize*2)
: "%"REG_b, "%"REG_a, "%"REG_c
);
}
......@@ -2373,7 +2373,7 @@ FUNNY_Y_CODE
}
}
inline static void RENAME(hcscale)(uint16_t *dst, int dstWidth, uint8_t *src1, uint8_t *src2,
inline static void RENAME(hcscale)(uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2,
int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter,
int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode,
int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter,
......
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