spelling/grammar cosmetics
Originally committed as revision 28351 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
This commit is contained in:
parent
7a24ec506c
commit
f40c7dbb7e
@ -46,7 +46,7 @@ tested special converters (most are tested actually, but I did not write it down
|
||||
YVU9 -> YV12
|
||||
|
||||
untested special converters
|
||||
YV12/I420 -> BGR15/BGR24/BGR32 (it is the yuv2rgb stuff, so it should be ok)
|
||||
YV12/I420 -> BGR15/BGR24/BGR32 (it is the yuv2rgb stuff, so it should be OK)
|
||||
YV12/I420 -> YV12/I420
|
||||
YUY2/BGR15/BGR24/BGR32/RGB24/RGB32 -> same format
|
||||
BGR24 -> BGR32 & RGB24 -> RGB32
|
||||
@ -89,9 +89,9 @@ unsigned swscale_version(void)
|
||||
//#define WORDS_BIGENDIAN
|
||||
#define DITHER1XBPP
|
||||
|
||||
#define FAST_BGR2YV12 // use 7 bit coeffs instead of 15bit
|
||||
#define FAST_BGR2YV12 // use 7 bit coefficients instead of 15 bit
|
||||
|
||||
#define RET 0xC3 //near return opcode for X86
|
||||
#define RET 0xC3 //near return opcode for x86
|
||||
|
||||
#ifdef M_PI
|
||||
#define PI M_PI
|
||||
@ -194,10 +194,10 @@ Special versions: fast Y 1:1 scaling (no interpolation in y direction)
|
||||
TODO
|
||||
more intelligent misalignment avoidance for the horizontal scaler
|
||||
write special vertical cubic upscale version
|
||||
Optimize C code (yv12 / minmax)
|
||||
add support for packed pixel yuv input & output
|
||||
optimize C code (YV12 / minmax)
|
||||
add support for packed pixel YUV input & output
|
||||
add support for Y8 output
|
||||
optimize bgr24 & bgr32
|
||||
optimize BGR24 & BGR32
|
||||
add BGR4 output support
|
||||
write special BGR->BGR scaler
|
||||
*/
|
||||
@ -471,7 +471,7 @@ static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilt
|
||||
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
|
||||
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
|
||||
{
|
||||
//FIXME Optimize (just quickly writen not opti..)
|
||||
//FIXME Optimize (just quickly written not optimized..)
|
||||
int i;
|
||||
for (i=0; i<dstW; i++)
|
||||
{
|
||||
@ -504,7 +504,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
|
||||
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
|
||||
uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, int dstFormat)
|
||||
{
|
||||
//FIXME Optimize (just quickly writen not opti..)
|
||||
//FIXME Optimize (just quickly written not optimized..)
|
||||
int i;
|
||||
for (i=0; i<dstW; i++)
|
||||
{
|
||||
@ -653,7 +653,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
|
||||
}
|
||||
|
||||
#define YSCALE_YUV_2_RGBX_C(type) \
|
||||
YSCALE_YUV_2_PACKEDX_C(type) /* FIXME fix tables so that cliping is not needed and then use _NOCLIP*/\
|
||||
YSCALE_YUV_2_PACKEDX_C(type) /* FIXME fix tables so that clipping is not needed and then use _NOCLIP*/\
|
||||
r = (type *)c->table_rV[V]; \
|
||||
g = (type *)(c->table_gU[U] + c->table_gV[V]); \
|
||||
b = (type *)c->table_bU[U]; \
|
||||
@ -953,7 +953,7 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t *
|
||||
}
|
||||
}
|
||||
|
||||
//Note: we have C, X86, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one
|
||||
//Note: we have C, X86, MMX, MMX2, 3DNOW versions, there is no 3DNOW+MMX2 one
|
||||
//Plain C versions
|
||||
#if !HAVE_MMX || defined (RUNTIME_CPUDETECT) || !CONFIG_GPL
|
||||
#define COMPILE_C
|
||||
@ -1004,7 +1004,7 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t *
|
||||
|
||||
#if ARCH_X86
|
||||
|
||||
//X86 versions
|
||||
//x86 versions
|
||||
/*
|
||||
#undef RENAME
|
||||
#undef HAVE_MMX
|
||||
@ -1055,7 +1055,7 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t *
|
||||
|
||||
#endif //ARCH_X86
|
||||
|
||||
// minor note: the HAVE_xyz is messed up after that line so don't use it
|
||||
// minor note: the HAVE_xyz are messed up after this line so don't use them
|
||||
|
||||
static double getSplineCoeff(double a, double b, double c, double d, double dist)
|
||||
{
|
||||
@ -1085,7 +1085,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
|
||||
__asm__ volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions)
|
||||
#endif
|
||||
|
||||
// Note the +1 is for the MMXscaler which reads over the end
|
||||
// NOTE: the +1 is for the MMX scaler which reads over the end
|
||||
*filterPos = av_malloc((dstW+1)*sizeof(int16_t));
|
||||
|
||||
if (FFABS(xInc - 0x10000) <10) // unscaled
|
||||
@ -1134,7 +1134,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
|
||||
int j;
|
||||
|
||||
(*filterPos)[i]= xx;
|
||||
//Bilinear upscale / linear interpolate / Area averaging
|
||||
//bilinear upscale / linear interpolate / area averaging
|
||||
for (j=0; j<filterSize; j++)
|
||||
{
|
||||
int64_t coeff= fone - FFABS((xx<<16) - xDstInSrc)*(fone>>16);
|
||||
@ -1315,7 +1315,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
|
||||
/* preserve monotonicity because the core can't handle the filter otherwise */
|
||||
if (i<dstW-1 && (*filterPos)[i] >= (*filterPos)[i+1]) break;
|
||||
|
||||
// Move filter coeffs left
|
||||
// move filter coefficients left
|
||||
for (k=1; k<filter2Size; k++)
|
||||
filter2[i*filter2Size + k - 1]= filter2[i*filter2Size + k];
|
||||
filter2[i*filter2Size + k - 1]= 0;
|
||||
@ -1341,10 +1341,10 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
|
||||
if (minFilterSize < 5)
|
||||
filterAlign = 4;
|
||||
|
||||
// we really don't want to waste our time
|
||||
// doing useless computation, so fall-back on
|
||||
// the scalar C code for very small filter.
|
||||
// vectorizing is worth it only if you have
|
||||
// We really don't want to waste our time
|
||||
// doing useless computation, so fall back on
|
||||
// the scalar C code for very small filters.
|
||||
// Vectorizing is worth it only if you have a
|
||||
// decent-sized vector.
|
||||
if (minFilterSize < 3)
|
||||
filterAlign = 1;
|
||||
@ -1381,7 +1381,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
|
||||
}
|
||||
|
||||
|
||||
//FIXME try to align filterpos if possible
|
||||
//FIXME try to align filterPos if possible
|
||||
|
||||
//fix borders
|
||||
for (i=0; i<dstW; i++)
|
||||
@ -1389,7 +1389,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
|
||||
int j;
|
||||
if ((*filterPos)[i] < 0)
|
||||
{
|
||||
// Move filter coeffs left to compensate for filterPos
|
||||
// move filter coefficients left to compensate for filterPos
|
||||
for (j=1; j<filterSize; j++)
|
||||
{
|
||||
int left= FFMAX(j + (*filterPos)[i], 0);
|
||||
@ -1402,7 +1402,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
|
||||
if ((*filterPos)[i] + filterSize > srcW)
|
||||
{
|
||||
int shift= (*filterPos)[i] + filterSize - srcW;
|
||||
// Move filter coeffs right to compensate for filterPos
|
||||
// move filter coefficients right to compensate for filterPos
|
||||
for (j=filterSize-2; j>=0; j--)
|
||||
{
|
||||
int right= FFMIN(j + shift, filterSize-1);
|
||||
@ -1413,11 +1413,11 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
|
||||
}
|
||||
}
|
||||
|
||||
// Note the +1 is for the MMXscaler which reads over the end
|
||||
// Note the +1 is for the MMX scaler which reads over the end
|
||||
/* align at 16 for AltiVec (needed by hScale_altivec_real) */
|
||||
*outFilter= av_mallocz(*outFilterSize*(dstW+1)*sizeof(int16_t));
|
||||
|
||||
/* Normalize & Store in outFilter */
|
||||
/* normalize & store in outFilter */
|
||||
for (i=0; i<dstW; i++)
|
||||
{
|
||||
int j;
|
||||
@ -2075,7 +2075,7 @@ static uint16_t roundToInt16(int64_t f){
|
||||
}
|
||||
|
||||
/**
|
||||
* @param inv_table the yuv2rgb coeffs, normally Inverse_Table_6_9[x]
|
||||
* @param inv_table the yuv2rgb coefficients, normally Inverse_Table_6_9[x]
|
||||
* @param fullRange if 1 then the luma range is 0..255 if 0 it is 16..235
|
||||
* @return -1 if not supported
|
||||
*/
|
||||
@ -2242,7 +2242,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
|SWS_BICUBLIN);
|
||||
if(!i || (i & (i-1)))
|
||||
{
|
||||
av_log(NULL, AV_LOG_ERROR, "swScaler: Exactly one scaler algorithm must be choosen\n");
|
||||
av_log(NULL, AV_LOG_ERROR, "swScaler: Exactly one scaler algorithm must be chosen\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2254,7 +2254,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
return NULL;
|
||||
}
|
||||
if(srcW > VOFW || dstW > VOFW){
|
||||
av_log(NULL, AV_LOG_ERROR, "swScaler: Compile time max width is "AV_STRINGIFY(VOFW)" change VOF/VOFW and recompile\n");
|
||||
av_log(NULL, AV_LOG_ERROR, "swScaler: Compile-time maximum width is "AV_STRINGIFY(VOFW)" change VOF/VOFW and recompile\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2288,14 +2288,14 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat);
|
||||
getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
|
||||
|
||||
// reuse chroma for 2 pixles rgb/bgr unless user wants full chroma interpolation
|
||||
// reuse chroma for 2 pixels RGB/BGR unless user wants full chroma interpolation
|
||||
if ((isBGR(dstFormat) || isRGB(dstFormat)) && !(flags&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
|
||||
|
||||
// drop some chroma lines if the user wants it
|
||||
c->vChrDrop= (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;
|
||||
c->chrSrcVSubSample+= c->vChrDrop;
|
||||
|
||||
// drop every 2. pixel for chroma calculation unless user wants full chroma
|
||||
// drop every other pixel for chroma calculation unless user wants full chroma
|
||||
if ((isBGR(srcFormat) || isRGB(srcFormat)) && !(flags&SWS_FULL_CHR_H_INP)
|
||||
&& srcFormat!=PIX_FMT_RGB8 && srcFormat!=PIX_FMT_BGR8
|
||||
&& srcFormat!=PIX_FMT_RGB4 && srcFormat!=PIX_FMT_BGR4
|
||||
@ -2322,7 +2322,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
|
||||
sws_setColorspaceDetails(c, Inverse_Table_6_9[SWS_CS_DEFAULT], srcRange, Inverse_Table_6_9[SWS_CS_DEFAULT] /* FIXME*/, dstRange, 0, 1<<16, 1<<16);
|
||||
|
||||
/* unscaled special Cases */
|
||||
/* unscaled special cases */
|
||||
if (unscaled && !usesHFilter && !usesVFilter && (srcRange == dstRange || isBGR(dstFormat) || isRGB(dstFormat)))
|
||||
{
|
||||
/* yv12_to_nv12 */
|
||||
@ -2348,7 +2348,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
if (srcFormat==PIX_FMT_BGR24 && dstFormat==PIX_FMT_YUV420P && !(flags & SWS_ACCURATE_RND))
|
||||
c->swScale= bgr24toyv12Wrapper;
|
||||
|
||||
/* rgb/bgr -> rgb/bgr (no dither needed forms) */
|
||||
/* RGB/BGR -> RGB/BGR (no dither needed forms) */
|
||||
if ( (isBGR(srcFormat) || isRGB(srcFormat))
|
||||
&& (isBGR(dstFormat) || isRGB(dstFormat))
|
||||
&& srcFormat != PIX_FMT_BGR8 && dstFormat != PIX_FMT_BGR8
|
||||
@ -2448,7 +2448,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR))
|
||||
{
|
||||
if (flags&SWS_PRINT_INFO)
|
||||
av_log(c, AV_LOG_INFO, "output Width is not a multiple of 32 -> no MMX2 scaler\n");
|
||||
av_log(c, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n");
|
||||
}
|
||||
if (usesHFilter) c->canMMX2BeUsed=0;
|
||||
}
|
||||
@ -2471,7 +2471,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
c->lumXInc+= 20;
|
||||
c->chrXInc+= 20;
|
||||
}
|
||||
//we don't use the x86asm scaler if mmx is available
|
||||
//we don't use the x86 asm scaler if MMX is available
|
||||
else if (flags & SWS_CPU_CAPS_MMX)
|
||||
{
|
||||
c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20;
|
||||
@ -2517,7 +2517,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
initMMX2HScaler(c->chrDstW, c->chrXInc, c->funnyUVCode, c->chrMmx2Filter, c->chrMmx2FilterPos, 4);
|
||||
}
|
||||
#endif /* defined(COMPILE_MMX2) */
|
||||
} // Init Horizontal stuff
|
||||
} // initialize horizontal stuff
|
||||
|
||||
|
||||
|
||||
@ -2557,7 +2557,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
#endif
|
||||
}
|
||||
|
||||
// Calculate Buffer Sizes so that they won't run out while handling these damn slices
|
||||
// calculate buffer sizes so that they won't run out while handling these damn slices
|
||||
c->vLumBufSize= c->vLumFilterSize;
|
||||
c->vChrBufSize= c->vChrFilterSize;
|
||||
for (i=0; i<dstH; i++)
|
||||
@ -2577,7 +2577,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
// allocate pixbufs (we use dynamic allocation because otherwise we would need to
|
||||
c->lumPixBuf= av_malloc(c->vLumBufSize*2*sizeof(int16_t*));
|
||||
c->chrPixBuf= av_malloc(c->vChrBufSize*2*sizeof(int16_t*));
|
||||
//Note we need at least one pixel more at the end because of the mmx code (just in case someone wanna replace the 4000/8000)
|
||||
//Note we need at least one pixel more at the end because of the MMX code (just in case someone wanna replace the 4000/8000)
|
||||
/* align at 16 bytes for AltiVec */
|
||||
for (i=0; i<c->vLumBufSize; i++)
|
||||
c->lumPixBuf[i]= c->lumPixBuf[i+c->vLumBufSize]= av_mallocz(VOF+1);
|
||||
@ -2668,7 +2668,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
else
|
||||
{
|
||||
#if ARCH_X86
|
||||
av_log(c, AV_LOG_VERBOSE, "using X86-Asm scaler for horizontal scaling\n");
|
||||
av_log(c, AV_LOG_VERBOSE, "using x86 asm scaler for horizontal scaling\n");
|
||||
#else
|
||||
if (flags & SWS_FAST_BILINEAR)
|
||||
av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR C scaler for horizontal scaling\n");
|
||||
@ -2695,22 +2695,22 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
}
|
||||
|
||||
if (dstFormat==PIX_FMT_BGR24)
|
||||
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR24 Converter\n",
|
||||
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR24 converter\n",
|
||||
(flags & SWS_CPU_CAPS_MMX2) ? "MMX2" : ((flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C"));
|
||||
else if (dstFormat==PIX_FMT_RGB32)
|
||||
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR32 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
|
||||
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR32 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
|
||||
else if (dstFormat==PIX_FMT_BGR565)
|
||||
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR16 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
|
||||
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR16 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
|
||||
else if (dstFormat==PIX_FMT_BGR555)
|
||||
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR15 Converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
|
||||
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR15 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
|
||||
|
||||
av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
|
||||
}
|
||||
if (flags & SWS_PRINT_INFO)
|
||||
{
|
||||
av_log(c, AV_LOG_DEBUG, "Lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
|
||||
av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
|
||||
c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc);
|
||||
av_log(c, AV_LOG_DEBUG, "Chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
|
||||
av_log(c, AV_LOG_DEBUG, "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
|
||||
c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc);
|
||||
}
|
||||
|
||||
@ -2720,7 +2720,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
|
||||
|
||||
/**
|
||||
* swscale wrapper, so we don't need to export the SwsContext.
|
||||
* assumes planar YUV to be in YUV order instead of YVU
|
||||
* Assumes planar YUV to be in YUV order instead of YVU.
|
||||
*/
|
||||
int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dst[], int dstStride[]){
|
||||
@ -2820,7 +2820,7 @@ int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
|
||||
}
|
||||
|
||||
/**
|
||||
* swscale wrapper, so we don't need to export the SwsContext
|
||||
* swscale wrapper, so we don't need to export the SwsContext.
|
||||
*/
|
||||
int sws_scale_ordered(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dst[], int dstStride[]){
|
||||
@ -2886,8 +2886,8 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a normalized gaussian curve used to filter stuff
|
||||
* quality=3 is high quality, lowwer is lowwer quality
|
||||
* Returns a normalized Gaussian curve used to filter stuff
|
||||
* quality=3 is high quality, lower is lower quality.
|
||||
*/
|
||||
SwsVector *sws_getGaussianVec(double variance, double quality){
|
||||
const int length= (int)(variance*quality + 0.5) | 1;
|
||||
@ -3168,7 +3168,7 @@ void sws_freeContext(SwsContext *c){
|
||||
/**
|
||||
* Checks if context is valid or reallocs a new one instead.
|
||||
* If context is NULL, just calls sws_getContext() to get a new one.
|
||||
* Otherwise, checks if the parameters are the same already saved in context.
|
||||
* Otherwise, checks if the parameters are the ones already saved in context.
|
||||
* If that is the case, returns the current context.
|
||||
* Otherwise, frees context and gets a new one.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user