mirror of
https://github.com/mpv-player/mpv
synced 2024-12-29 18:42:09 +00:00
libswscale: Relicense almost all x86 assembler optimizations as LGPL.
This is of course done with permissions from the authors. The only GPL component left are MMX optimizations for YUV to RGB conversion. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30965 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
3e7a2bd8c3
commit
28ff7246a0
@ -8,22 +8,19 @@
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FFmpeg; if not, write to the Free Software
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* The C code (not assembly, MMX, ...) of this file can be used
|
||||
* under the LGPL license.
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
#include "config.h"
|
||||
@ -101,7 +98,7 @@ void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t
|
||||
long lumStride, long chromStride, long srcStride);
|
||||
|
||||
|
||||
#if ARCH_X86 && CONFIG_GPL
|
||||
#if ARCH_X86
|
||||
DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL;
|
||||
DECLARE_ASM_CONST(8, uint64_t, mmx_one) = 0xFFFFFFFFFFFFFFFFULL;
|
||||
DECLARE_ASM_CONST(8, uint64_t, mask32b) = 0x000000FF000000FFULL;
|
||||
@ -162,7 +159,7 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
|
||||
#define RENAME(a) a ## _C
|
||||
#include "rgb2rgb_template.c"
|
||||
|
||||
#if ARCH_X86 && CONFIG_GPL
|
||||
#if ARCH_X86
|
||||
|
||||
//MMX versions
|
||||
#undef RENAME
|
||||
@ -198,7 +195,7 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
|
||||
|
||||
void sws_rgb2rgb_init(int flags)
|
||||
{
|
||||
#if (HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX) && CONFIG_GPL
|
||||
#if HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX
|
||||
if (flags & SWS_CPU_CAPS_MMX2)
|
||||
rgb2rgb_init_MMX2();
|
||||
else if (flags & SWS_CPU_CAPS_3DNOW)
|
||||
|
@ -9,22 +9,19 @@
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FFmpeg; if not, write to the Free Software
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* The C code (not assembly, MMX, ...) of this file can be used
|
||||
* under the LGPL license.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
@ -3,22 +3,19 @@
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FFmpeg; if not, write to the Free Software
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* the C code (not assembly, mmx, ...) of this file can be used
|
||||
* under the LGPL license too
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -130,7 +127,7 @@ add BGR4 output support
|
||||
write special BGR->BGR scaler
|
||||
*/
|
||||
|
||||
#if ARCH_X86 && CONFIG_GPL
|
||||
#if ARCH_X86
|
||||
DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
|
||||
DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL;
|
||||
DECLARE_ASM_CONST(8, uint64_t, w10)= 0x0010001000100010LL;
|
||||
@ -185,7 +182,7 @@ DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUV)[2][4] = {
|
||||
|
||||
DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUVOffset)= 0x0040400000404000ULL;
|
||||
|
||||
#endif /* ARCH_X86 && CONFIG_GPL */
|
||||
#endif /* ARCH_X86 */
|
||||
|
||||
DECLARE_ALIGNED(8, static const uint8_t, dither_2x2_4)[2][8]={
|
||||
{ 1, 3, 1, 3, 1, 3, 1, 3, },
|
||||
@ -1154,7 +1151,7 @@ static inline void monoblack2Y(uint8_t *dst, const uint8_t *src, long width, uin
|
||||
|
||||
//Note: we have C, MMX, MMX2, 3DNOW versions, there is no 3DNOW+MMX2 one
|
||||
//Plain C versions
|
||||
#if ((!HAVE_MMX || !CONFIG_GPL) && !HAVE_ALTIVEC) || CONFIG_RUNTIME_CPUDETECT
|
||||
#if (!HAVE_MMX && !HAVE_ALTIVEC) || CONFIG_RUNTIME_CPUDETECT
|
||||
#define COMPILE_C
|
||||
#endif
|
||||
|
||||
@ -1166,15 +1163,15 @@ static inline void monoblack2Y(uint8_t *dst, const uint8_t *src, long width, uin
|
||||
|
||||
#if ARCH_X86
|
||||
|
||||
#if ((HAVE_MMX && !HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
|
||||
#if (HAVE_MMX && !HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT
|
||||
#define COMPILE_MMX
|
||||
#endif
|
||||
|
||||
#if (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
|
||||
#if HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT
|
||||
#define COMPILE_MMX2
|
||||
#endif
|
||||
|
||||
#if ((HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
|
||||
#if (HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT
|
||||
#define COMPILE_3DNOW
|
||||
#endif
|
||||
#endif //ARCH_X86
|
||||
@ -1245,7 +1242,7 @@ SwsFunc ff_getSwsFunc(SwsContext *c)
|
||||
#if CONFIG_RUNTIME_CPUDETECT
|
||||
int flags = c->flags;
|
||||
|
||||
#if ARCH_X86 && CONFIG_GPL
|
||||
#if ARCH_X86
|
||||
// ordered per speed fastest first
|
||||
if (flags & SWS_CPU_CAPS_MMX2) {
|
||||
sws_init_swScale_MMX2(c);
|
||||
@ -1273,7 +1270,7 @@ SwsFunc ff_getSwsFunc(SwsContext *c)
|
||||
#endif
|
||||
sws_init_swScale_C(c);
|
||||
return swScale_C;
|
||||
#endif /* ARCH_X86 && CONFIG_GPL */
|
||||
#endif /* ARCH_X86 */
|
||||
#else //CONFIG_RUNTIME_CPUDETECT
|
||||
#if COMPILE_TEMPLATE_MMX2
|
||||
sws_init_swScale_MMX2(c);
|
||||
|
@ -3,22 +3,19 @@
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FFmpeg; if not, write to the Free Software
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* The C code (not assembly, MMX, ...) of this file can be used
|
||||
* under the LGPL license.
|
||||
*/
|
||||
|
||||
#undef REAL_MOVNTQ
|
||||
@ -2258,7 +2255,7 @@ static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
|
||||
long dstWidth, const uint8_t *src, int srcW,
|
||||
int xInc)
|
||||
{
|
||||
#if ARCH_X86 && CONFIG_GPL
|
||||
#if ARCH_X86
|
||||
#if COMPILE_TEMPLATE_MMX2
|
||||
int32_t *filterPos = c->hLumFilterPos;
|
||||
int16_t *filter = c->hLumFilter;
|
||||
@ -2407,7 +2404,7 @@ static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst,
|
||||
long dstWidth, const uint8_t *src1,
|
||||
const uint8_t *src2, int srcW, int xInc)
|
||||
{
|
||||
#if ARCH_X86 && CONFIG_GPL
|
||||
#if ARCH_X86
|
||||
#if COMPILE_TEMPLATE_MMX2
|
||||
int32_t *filterPos = c->hChrFilterPos;
|
||||
int16_t *filter = c->hChrFilter;
|
||||
|
@ -3,22 +3,19 @@
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FFmpeg; if not, write to the Free Software
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* the C code (not assembly, mmx, ...) of this file can be used
|
||||
* under the LGPL license too
|
||||
*/
|
||||
|
||||
#define _SVID_SOURCE //needed for MAP_ANONYMOUS
|
||||
@ -508,7 +505,7 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
|
||||
#if ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT)
|
||||
static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode, int16_t *filter, int32_t *filterPos, int numSplits)
|
||||
{
|
||||
uint8_t *fragmentA;
|
||||
@ -666,7 +663,7 @@ static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode, int16_t *fil
|
||||
|
||||
return fragmentPos + 1;
|
||||
}
|
||||
#endif /* ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL */
|
||||
#endif /* ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) */
|
||||
|
||||
static void getSubSampleFactors(int *h, int *v, enum PixelFormat format)
|
||||
{
|
||||
@ -951,7 +948,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
|
||||
|
||||
/* precalculate horizontal scaler filter coefficients */
|
||||
{
|
||||
#if ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
|
||||
#if ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT)
|
||||
// can't downscale !!!
|
||||
if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) {
|
||||
c->lumMmx2FilterCodeSize = initMMX2HScaler( dstW, c->lumXInc, NULL, NULL, NULL, 8);
|
||||
@ -983,7 +980,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
|
||||
mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
|
||||
#endif
|
||||
} else
|
||||
#endif /* ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL */
|
||||
#endif /* ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) */
|
||||
{
|
||||
const int filterAlign=
|
||||
(flags & SWS_CPU_CAPS_MMX) ? 4 :
|
||||
@ -1540,7 +1537,7 @@ void sws_freeContext(SwsContext *c)
|
||||
av_freep(&c->hLumFilterPos);
|
||||
av_freep(&c->hChrFilterPos);
|
||||
|
||||
#if ARCH_X86 && CONFIG_GPL
|
||||
#if ARCH_X86
|
||||
#ifdef MAP_ANONYMOUS
|
||||
if (c->lumMmx2FilterCode) munmap(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize);
|
||||
if (c->chrMmx2FilterCode) munmap(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize);
|
||||
@ -1553,7 +1550,7 @@ void sws_freeContext(SwsContext *c)
|
||||
#endif
|
||||
c->lumMmx2FilterCode=NULL;
|
||||
c->chrMmx2FilterCode=NULL;
|
||||
#endif /* ARCH_X86 && CONFIG_GPL */
|
||||
#endif /* ARCH_X86 */
|
||||
|
||||
av_freep(&c->yuvTable);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user