Commit ebb65252 authored by lucabe's avatar lucabe

change all the occurrences of "FFMIN(FFMAX())" to clip_uint8() or clip()


git-svn-id: file:///var/local/repositories/mplayer/trunk/libswscale@21776 b3059339-0415-0410-9bf9-f77b7e298cf2
parent 346421d9
...@@ -308,7 +308,7 @@ static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilt ...@@ -308,7 +308,7 @@ static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilt
for(j=0; j<lumFilterSize; j++) for(j=0; j<lumFilterSize; j++)
val += lumSrc[j][i] * lumFilter[j]; val += lumSrc[j][i] * lumFilter[j];
dest[i]= FFMIN(FFMAX(val>>19, 0), 255); dest[i]= clip_uint8(val>>19);
} }
if(uDest != NULL) if(uDest != NULL)
...@@ -323,8 +323,8 @@ static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilt ...@@ -323,8 +323,8 @@ static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilt
v += chrSrc[j][i + 2048] * chrFilter[j]; v += chrSrc[j][i + 2048] * chrFilter[j];
} }
uDest[i]= FFMIN(FFMAX(u>>19, 0), 255); uDest[i]= clip_uint8(u>>19);
vDest[i]= FFMIN(FFMAX(v>>19, 0), 255); vDest[i]= clip_uint8(v>>19);
} }
} }
...@@ -341,7 +341,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil ...@@ -341,7 +341,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
for(j=0; j<lumFilterSize; j++) for(j=0; j<lumFilterSize; j++)
val += lumSrc[j][i] * lumFilter[j]; val += lumSrc[j][i] * lumFilter[j];
dest[i]= FFMIN(FFMAX(val>>19, 0), 255); dest[i]= clip_uint8(val>>19);
} }
if(uDest == NULL) if(uDest == NULL)
...@@ -359,8 +359,8 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil ...@@ -359,8 +359,8 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
v += chrSrc[j][i + 2048] * chrFilter[j]; v += chrSrc[j][i + 2048] * chrFilter[j];
} }
uDest[2*i]= FFMIN(FFMAX(u>>19, 0), 255); uDest[2*i]= clip_uint8(u>>19);
uDest[2*i+1]= FFMIN(FFMAX(v>>19, 0), 255); uDest[2*i+1]= clip_uint8(v>>19);
} }
else else
for(i=0; i<chrDstW; i++) for(i=0; i<chrDstW; i++)
...@@ -374,8 +374,8 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil ...@@ -374,8 +374,8 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
v += chrSrc[j][i + 2048] * chrFilter[j]; v += chrSrc[j][i + 2048] * chrFilter[j];
} }
uDest[2*i]= FFMIN(FFMAX(v>>19, 0), 255); uDest[2*i]= clip_uint8(v>>19);
uDest[2*i+1]= FFMIN(FFMAX(u>>19, 0), 255); uDest[2*i+1]= clip_uint8(u>>19);
} }
} }
...@@ -1458,7 +1458,7 @@ static void globalInit(void){ ...@@ -1458,7 +1458,7 @@ static void globalInit(void){
// generating tables: // generating tables:
int i; int i;
for(i=0; i<768; i++){ for(i=0; i<768; i++){
int c= FFMIN(FFMAX(i-256, 0), 255); int c= clip_uint8(i-256);
clip_table[i]=c; clip_table[i]=c;
} }
} }
......
...@@ -226,7 +226,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int ...@@ -226,7 +226,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int
for(j=0; j<filterSize; j++) { for(j=0; j<filterSize; j++) {
val += ((int)src[srcPos + j])*filter[filterSize*i + j]; val += ((int)src[srcPos + j])*filter[filterSize*i + j];
} }
dst[i] = FFMIN(FFMAX(0, val>>7), (1<<15)-1); dst[i] = clip(val>>7, 0, (1<<15)-1);
} }
} }
else else
...@@ -265,7 +265,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int ...@@ -265,7 +265,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int
val_vEven = vec_mule(src_v, filter_v); val_vEven = vec_mule(src_v, filter_v);
val_s = vec_sums(val_vEven, vzero); val_s = vec_sums(val_vEven, vzero);
vec_st(val_s, 0, tempo); vec_st(val_s, 0, tempo);
dst[i] = FFMIN(FFMAX(0, tempo[3]>>7), (1<<15)-1); dst[i] = clip(tempo[3]>>7, 0, (1<<15)-1);
} }
} }
break; break;
...@@ -292,7 +292,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int ...@@ -292,7 +292,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int
val_v = vec_msums(src_v, filter_v, (vector signed int)vzero); val_v = vec_msums(src_v, filter_v, (vector signed int)vzero);
val_s = vec_sums(val_v, vzero); val_s = vec_sums(val_v, vzero);
vec_st(val_s, 0, tempo); vec_st(val_s, 0, tempo);
dst[i] = FFMIN(FFMAX(0, tempo[3]>>7), (1<<15)-1); dst[i] = clip(tempo[3]>>7, 0, (1<<15)-1);
} }
} }
break; break;
...@@ -321,7 +321,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int ...@@ -321,7 +321,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int
vector signed int val_s = vec_sums(val_v, vzero); vector signed int val_s = vec_sums(val_v, vzero);
vec_st(val_s, 0, tempo); vec_st(val_s, 0, tempo);
dst[i] = FFMIN(FFMAX(0, tempo[3]>>7), (1<<15)-1); dst[i] = clip(tempo[3]>>7, 0, (1<<15)-1);
} }
} }
break; break;
...@@ -383,7 +383,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int ...@@ -383,7 +383,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int
val_s = vec_sums(val_v, vzero); val_s = vec_sums(val_v, vzero);
vec_st(val_s, 0, tempo); vec_st(val_s, 0, tempo);
dst[i] = FFMIN(FFMAX(0, tempo[3]>>7), (1<<15)-1); dst[i] = clip(tempo[3]>>7, 0, (1<<15)-1);
} }
} }
......
...@@ -2456,7 +2456,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW ...@@ -2456,7 +2456,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW
val += ((int)src[srcPos + j])*filter[filterSize*i + j]; val += ((int)src[srcPos + j])*filter[filterSize*i + j];
} }
// filter += hFilterSize; // filter += hFilterSize;
dst[i] = FFMIN(FFMAX(0, val>>7), (1<<15)-1); // the cubic equation does overflow ... dst[i] = clip(val>>7, 0, (1<<15)-1); // the cubic equation does overflow ...
// dst[i] = val>>7; // dst[i] = val>>7;
} }
#endif #endif
......
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