Revision 8a322796 libswscale/swscale_template.c
libswscale/swscale_template.c | ||
---|---|---|
17 | 17 |
* along with FFmpeg; if not, write to the Free Software |
18 | 18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 | 19 |
* |
20 |
* the C code (not assembly, mmx, ...) of this file can be used
|
|
21 |
* under the LGPL license too
|
|
20 |
* The C code (not assembly, MMX, ...) of this file can be used
|
|
21 |
* under the LGPL license.
|
|
22 | 22 |
*/ |
23 | 23 |
|
24 | 24 |
#undef REAL_MOVNTQ |
... | ... | |
30 | 30 |
#undef SFENCE |
31 | 31 |
|
32 | 32 |
#ifdef HAVE_3DNOW |
33 |
/* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */
|
|
33 |
/* On K6 femms is faster than emms. On K7 femms is directly mapped on emms. */
|
|
34 | 34 |
#define EMMS "femms" |
35 | 35 |
#else |
36 | 36 |
#define EMMS "emms" |
... | ... | |
1503 | 1503 |
const int yalpha1=0; |
1504 | 1504 |
int i; |
1505 | 1505 |
|
1506 |
uint16_t *buf1= buf0; //FIXME needed for the rgb1/bgr1
|
|
1506 |
uint16_t *buf1= buf0; //FIXME needed for RGB1/BGR1
|
|
1507 | 1507 |
const int yalpha= 4096; //FIXME ... |
1508 | 1508 |
|
1509 | 1509 |
if (flags&SWS_FULL_CHR_H_INT) |
... | ... | |
1700 | 1700 |
} |
1701 | 1701 |
} |
1702 | 1702 |
|
1703 |
//FIXME yuy2* can read upto 7 samples to much
|
|
1703 |
//FIXME yuy2* can read up to 7 samples too much
|
|
1704 | 1704 |
|
1705 | 1705 |
static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, long width) |
1706 | 1706 |
{ |
... | ... | |
2297 | 2297 |
} |
2298 | 2298 |
} |
2299 | 2299 |
|
2300 |
// Bilinear / Bicubic scaling
|
|
2300 |
// bilinear / bicubic scaling
|
|
2301 | 2301 |
static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc, |
2302 | 2302 |
int16_t *filter, int16_t *filterPos, long filterSize) |
2303 | 2303 |
{ |
... | ... | |
2544 | 2544 |
} |
2545 | 2545 |
|
2546 | 2546 |
#ifdef HAVE_MMX |
2547 |
// use the new MMX scaler if the mmx2 can't be used (it is faster than the x86 ASM one)
|
|
2547 |
// Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one).
|
|
2548 | 2548 |
if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) |
2549 | 2549 |
#else |
2550 | 2550 |
if (!(flags&SWS_FAST_BILINEAR)) |
... | ... | |
2552 | 2552 |
{ |
2553 | 2553 |
RENAME(hScale)(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize); |
2554 | 2554 |
} |
2555 |
else // Fast Bilinear upscale / crap downscale
|
|
2555 |
else // fast bilinear upscale / crap downscale
|
|
2556 | 2556 |
{ |
2557 | 2557 |
#if defined(ARCH_X86) |
2558 | 2558 |
#ifdef HAVE_MMX2 |
... | ... | |
2761 | 2761 |
} |
2762 | 2762 |
|
2763 | 2763 |
#ifdef HAVE_MMX |
2764 |
// use the new MMX scaler if the mmx2 can't be used (it is faster than the x86 ASM one)
|
|
2764 |
// Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one).
|
|
2765 | 2765 |
if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) |
2766 | 2766 |
#else |
2767 | 2767 |
if (!(flags&SWS_FAST_BILINEAR)) |
... | ... | |
2770 | 2770 |
RENAME(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); |
2771 | 2771 |
RENAME(hScale)(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); |
2772 | 2772 |
} |
2773 |
else // Fast Bilinear upscale / crap downscale
|
|
2773 |
else // fast bilinear upscale / crap downscale
|
|
2774 | 2774 |
{ |
2775 | 2775 |
#if defined(ARCH_X86) |
2776 | 2776 |
#ifdef HAVE_MMX2 |
... | ... | |
2890 | 2890 |
"cmp %2, %%"REG_a" \n\t" |
2891 | 2891 |
" jb 1b \n\t" |
2892 | 2892 |
|
2893 |
/* GCC-3.3 makes MPlayer crash on IA-32 machines when using "g" operand here,
|
|
2894 |
which is needed to support GCC-4.0 */
|
|
2893 |
/* GCC 3.3 makes MPlayer crash on IA-32 machines when using "g" operand here,
|
|
2894 |
which is needed to support GCC 4.0. */
|
|
2895 | 2895 |
#if defined(ARCH_X86_64) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) |
2896 | 2896 |
:: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), |
2897 | 2897 |
#else |
... | ... | |
2963 | 2963 |
int lastDstY; |
2964 | 2964 |
uint8_t *pal=NULL; |
2965 | 2965 |
|
2966 |
/* vars whch will change and which we need to storw back in the context */
|
|
2966 |
/* vars which will change and which we need to store back in the context */
|
|
2967 | 2967 |
int dstY= c->dstY; |
2968 | 2968 |
int lumBufIndex= c->lumBufIndex; |
2969 | 2969 |
int chrBufIndex= c->chrBufIndex; |
... | ... | |
3004 | 3004 |
if (flags & SWS_PRINT_INFO && firstTime) |
3005 | 3005 |
{ |
3006 | 3006 |
av_log(c, AV_LOG_WARNING, "Warning: dstStride is not aligned!\n" |
3007 |
" ->cannot do aligned memory acesses anymore\n"); |
|
3007 |
" ->cannot do aligned memory accesses anymore\n");
|
|
3008 | 3008 |
firstTime=0; |
3009 | 3009 |
} |
3010 | 3010 |
} |
3011 | 3011 |
|
3012 |
/* Note the user might start scaling the picture in the middle so this will not get executed |
|
3013 |
this is not really intended but works currently, so ppl might do it */ |
|
3012 |
/* Note the user might start scaling the picture in the middle so this |
|
3013 |
will not get executed. This is not really intended but works |
|
3014 |
currently, so people might do it. */ |
|
3014 | 3015 |
if (srcSliceY ==0){ |
3015 | 3016 |
lumBufIndex=0; |
3016 | 3017 |
chrBufIndex=0; |
... | ... | |
3182 | 3183 |
{ |
3183 | 3184 |
const int chrSkipMask= (1<<c->chrDstVSubSample)-1; |
3184 | 3185 |
if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi |
3185 |
if (vLumFilterSize == 1 && vChrFilterSize == 1) // Unscaled YV12
|
|
3186 |
if (vLumFilterSize == 1 && vChrFilterSize == 1) // unscaled YV12
|
|
3186 | 3187 |
{ |
3187 | 3188 |
int16_t *lumBuf = lumPixBuf[0]; |
3188 | 3189 |
int16_t *chrBuf= chrPixBuf[0]; |
... | ... | |
3200 | 3201 |
{ |
3201 | 3202 |
ASSERT(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); |
3202 | 3203 |
ASSERT(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2); |
3203 |
if (vLumFilterSize == 1 && vChrFilterSize == 2) //Unscaled RGB
|
|
3204 |
if (vLumFilterSize == 1 && vChrFilterSize == 2) //unscaled RGB
|
|
3204 | 3205 |
{ |
3205 | 3206 |
int chrAlpha= vChrFilter[2*dstY+1]; |
3206 | 3207 |
RENAME(yuv2packed1)(c, *lumSrcPtr, *chrSrcPtr, *(chrSrcPtr+1), |
3207 | 3208 |
dest, dstW, chrAlpha, dstFormat, flags, dstY); |
3208 | 3209 |
} |
3209 |
else if (vLumFilterSize == 2 && vChrFilterSize == 2) //BiLinear Upscale RGB
|
|
3210 |
else if (vLumFilterSize == 2 && vChrFilterSize == 2) //bilinear upscale RGB
|
|
3210 | 3211 |
{ |
3211 | 3212 |
int lumAlpha= vLumFilter[2*dstY+1]; |
3212 | 3213 |
int chrAlpha= vChrFilter[2*dstY+1]; |
... | ... | |
3217 | 3218 |
RENAME(yuv2packed2)(c, *lumSrcPtr, *(lumSrcPtr+1), *chrSrcPtr, *(chrSrcPtr+1), |
3218 | 3219 |
dest, dstW, lumAlpha, chrAlpha, dstY); |
3219 | 3220 |
} |
3220 |
else //General RGB
|
|
3221 |
else //general RGB
|
|
3221 | 3222 |
{ |
3222 | 3223 |
RENAME(yuv2packedX)(c, |
3223 | 3224 |
vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
Also available in: Unified diff