Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
925e40a3
Commit
925e40a3
authored
Nov 17, 2006
by
hartman
Browse files
* Remove the old swscale files, and use the newer libswscale from ffmpeg.
Untested and likely to break stuff
parent
3a2462f6
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
925e40a3
...
...
@@ -2789,8 +2789,14 @@ dnl Trying with pkg-config
VLC_ADD_LDFLAGS([ffmpeg stream_out_switcher],[${FFMPEG_LIBS}])
dnl newer ffmpeg have a separate libpostproc
PKG_CHECK_MODULES(POSTPROC, libpostproc,[
VLC_ADD_CFLAGS([ffmpeg],[${POSTPROC_CFLAGS}])
VLC_ADD_LDFLAGS([ffmpeg],[${POSTPROC_LIBS}])
],[ true ])
dnl even newer ffmpeg has a libswscale
PKG_CHECK_MODULES(SWSCALE, libswscale,[
VLC_ADD_CFLAGS([ffmpeg],[${SWSCALE_CFLAGS}])
VLC_ADD_LDFLAGS([ffmpeg],[${SWSCALE_LIBS}])
],[ true ])
],[
dnl
...
...
@@ -5637,7 +5643,6 @@ AC_CONFIG_FILES([
modules/stream_out/transrate/Makefile
modules/video_chroma/Makefile
modules/video_filter/Makefile
modules/video_filter/swscale/Makefile
modules/video_output/Makefile
modules/video_output/directx/Makefile
modules/video_output/qte/Makefile
...
...
modules/codec/ffmpeg/Modules.am
View file @
925e40a3
...
...
@@ -9,6 +9,7 @@ SOURCES_ffmpeg = \
postprocess.c \
demux.c \
mux.c \
scale.c \
$(NULL)
SOURCES_ffmpegaltivec = \
...
...
modules/codec/ffmpeg/ffmpeg.c
View file @
925e40a3
...
...
@@ -76,6 +76,14 @@ static char *nloopf_list_text[] =
static
char
*
enc_hq_list
[]
=
{
"rd"
,
"bits"
,
"simple"
};
static
char
*
enc_hq_list_text
[]
=
{
N_
(
"rd"
),
N_
(
"bits"
),
N_
(
"simple"
)
};
static
int
pi_mode_values
[]
=
{
0
,
1
,
2
,
4
,
8
,
5
,
6
,
9
,
10
};
static
char
*
ppsz_mode_descriptions
[]
=
{
N_
(
"Fast bilinear"
),
N_
(
"Bilinear"
),
N_
(
"Bicubic (good quality)"
),
N_
(
"Experimental"
),
N_
(
"Nearest neighbour (bad quality)"
),
N_
(
"Area"
),
N_
(
"Luma bicubic / chroma bilinear"
),
N_
(
"Gauss"
),
N_
(
"SincR"
),
N_
(
"Lanczos"
),
N_
(
"Bicubic spline"
)
};
/*****************************************************************************
* Module descriptor
*****************************************************************************/
...
...
@@ -216,6 +224,16 @@ vlc_module_begin();
set_description
(
_
(
"FFmpeg deinterlace video filter"
)
);
add_shortcut
(
"ffmpeg-deinterlace"
);
/* video filter submodule */
add_submodule
();
set_description
(
_
(
"Video scaling filter"
)
);
set_capability
(
"video filter2"
,
1000
);
set_category
(
CAT_VIDEO
);
set_subcategory
(
SUBCAT_VIDEO_VFILTER
);
set_callbacks
(
E_
(
OpenScaler
),
E_
(
CloseScaler
)
);
add_integer
(
"swscale-mode"
,
0
,
NULL
,
SCALEMODE_TEXT
,
SCALEMODE_LONGTEXT
,
VLC_TRUE
);
change_integer_list
(
pi_mode_values
,
ppsz_mode_descriptions
,
0
);
var_Create
(
p_module
->
p_libvlc_global
,
"avcodec"
,
VLC_VAR_MUTEX
);
vlc_module_end
();
...
...
@@ -455,9 +473,8 @@ static struct
/* Packed YUV formats */
{
VLC_FOURCC
(
'Y'
,
'U'
,
'Y'
,
'2'
),
PIX_FMT_YUV422
},
#if LIBAVCODEC_BUILD >= 4720
{
VLC_FOURCC
(
'Y'
,
'U'
,
'Y'
,
'V'
),
PIX_FMT_YUV422
},
{
VLC_FOURCC
(
'U'
,
'Y'
,
'V'
,
'Y'
),
PIX_FMT_UYVY422
},
#endif
/* Packed RGB formats */
{
VLC_FOURCC
(
'R'
,
'V'
,
'1'
,
'5'
),
PIX_FMT_RGB555
},
...
...
modules/codec/ffmpeg/ffmpeg.h
View file @
925e40a3
...
...
@@ -78,6 +78,8 @@ int E_(OpenCropPadd)( vlc_object_t * );
void
E_
(
CloseFilter
)(
vlc_object_t
*
);
int
E_
(
OpenDeinterlace
)(
vlc_object_t
*
);
void
E_
(
CloseDeinterlace
)(
vlc_object_t
*
);
int
E_
(
OpenScaler
)(
vlc_object_t
*
);
void
E_
(
CloseScaler
)(
vlc_object_t
*
);
/* Postprocessing module */
void
*
E_
(
OpenPostproc
)(
decoder_t
*
,
vlc_bool_t
*
);
...
...
@@ -297,3 +299,7 @@ N_("<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...
#define ENC_CHROMA_ELIM_LONGTEXT N_( "Eliminates chrominance blocks when " \
"the PSNR isn't much changed (default: 0.0). The H264 specification " \
"recommends 7." )
#define SCALEMODE_TEXT N_("Scaling mode")
#define SCALEMODE_LONGTEXT N_("Scaling mode to use.")
modules/
video_filter/swscale/filter
.c
→
modules/
codec/ffmpeg/scale
.c
View file @
925e40a3
...
...
@@ -28,8 +28,10 @@
#include
<vlc/decoder.h>
#include
"vlc_filter.h"
#include
"common.h"
#include
"swscale.h"
#include
<ffmpeg/swscale.h>
#include
<ffmpeg/avcodec.h>
#include
<ffmpeg/avutil.h>
#include
"ffmpeg.h"
void
*
(
*
swscale_fast_memcpy
)(
void
*
,
const
void
*
,
size_t
);
...
...
@@ -50,41 +52,19 @@ struct filter_sys_t
/****************************************************************************
* Local prototypes
****************************************************************************/
static
int
OpenFilter
(
vlc_object_t
*
);
static
void
CloseFilter
(
vlc_object_t
*
);
static
picture_t
*
Filter
(
filter_t
*
,
picture_t
*
);
static
int
CheckInit
(
filter_t
*
);
static
int
GetSwscaleChroma
(
vlc_fourcc_t
);
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define MODE_TEXT N_("Scaling mode")
#define MODE_LONGTEXT N_("Scaling mode to use.")
static
int
pi_mode_values
[]
=
{
0
,
1
,
2
,
4
,
8
,
5
,
6
,
9
,
10
};
static
char
*
ppsz_mode_descriptions
[]
=
{
N_
(
"Fast bilinear"
),
N_
(
"Bilinear"
),
N_
(
"Bicubic (good quality)"
),
N_
(
"Experimental"
),
N_
(
"Nearest neighbour (bad quality)"
),
N_
(
"Area"
),
N_
(
"Luma bicubic / chroma bilinear"
),
N_
(
"Gauss"
),
N_
(
"SincR"
),
N_
(
"Lanczos"
),
N_
(
"Bicubic spline"
)
};
vlc_module_begin
();
set_description
(
_
(
"Video scaling filter"
)
);
set_capability
(
"video filter2"
,
1000
);
set_category
(
CAT_VIDEO
);
set_subcategory
(
SUBCAT_VIDEO_VFILTER
);
set_callbacks
(
OpenFilter
,
CloseFilter
);
add_integer
(
"swscale-mode"
,
0
,
NULL
,
MODE_TEXT
,
MODE_LONGTEXT
,
VLC_TRUE
);
change_integer_list
(
pi_mode_values
,
ppsz_mode_descriptions
,
0
);
vlc_module_end
();
/*****************************************************************************
* Open
Filt
er: probe the filter and return score
* Open
Scal
er: probe the filter and return score
*****************************************************************************/
static
int
Open
Filt
er
(
vlc_object_t
*
p_this
)
int
E_
(
Open
Scal
er
)
(
vlc_object_t
*
p_this
)
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
;
...
...
@@ -99,14 +79,14 @@ static int OpenFilter( vlc_object_t *p_this )
/* Supported Input formats: YV12, I420/IYUV, YUY2, UYVY, BGR32, BGR24,
* BGR16, BGR15, RGB32, RGB24, Y8/Y800, YVU9/IF09 */
if
(
!
(
i_fmt_in
=
GetSwscale
Chroma
(
p_filter
->
fmt_in
.
video
.
i_chroma
))
)
if
(
!
(
i_fmt_in
=
E_
(
GetFfmpeg
Chroma
)
(
p_filter
->
fmt_in
.
video
.
i_chroma
))
)
{
return
VLC_EGENERIC
;
}
/* Supported output formats: YV12, I420/IYUV, YUY2, UYVY,
* {BGR,RGB}{1,4,8,15,16,24,32}, Y8/Y800, YVU9/IF09 */
if
(
!
(
i_fmt_out
=
GetSwscale
Chroma
(
p_filter
->
fmt_out
.
video
.
i_chroma
))
)
if
(
!
(
i_fmt_out
=
E_
(
GetFfmpeg
Chroma
)
(
p_filter
->
fmt_out
.
video
.
i_chroma
))
)
{
return
VLC_EGENERIC
;
}
...
...
@@ -198,7 +178,7 @@ static int OpenFilter( vlc_object_t *p_this )
/*****************************************************************************
* CloseFilter: clean up the filter
*****************************************************************************/
static
void
Close
Filt
er
(
vlc_object_t
*
p_this
)
void
E_
(
Close
Scal
er
)
(
vlc_object_t
*
p_this
)
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
...
...
@@ -222,8 +202,8 @@ static int CheckInit( filter_t *p_filter )
{
unsigned
int
i_fmt_in
,
i_fmt_out
;
if
(
!
(
i_fmt_in
=
GetSwscale
Chroma
(
p_filter
->
fmt_in
.
video
.
i_chroma
))
||
!
(
i_fmt_out
=
GetSwscale
Chroma
(
p_filter
->
fmt_out
.
video
.
i_chroma
))
)
if
(
!
(
i_fmt_in
=
E_
(
GetFfmpeg
Chroma
)
(
p_filter
->
fmt_in
.
video
.
i_chroma
))
||
!
(
i_fmt_out
=
E_
(
GetFfmpeg
Chroma
)
(
p_filter
->
fmt_out
.
video
.
i_chroma
))
)
{
msg_Err
(
p_filter
,
"format not supported"
);
return
VLC_EGENERIC
;
...
...
@@ -237,7 +217,7 @@ static int CheckInit( filter_t *p_filter )
p_filter
->
fmt_out
.
video
.
i_width
,
p_filter
->
fmt_out
.
video
.
i_height
,
i_fmt_out
,
p_sys
->
i_sws_flags
|
p_sys
->
i_cpu_mask
,
p_sys
->
p_src_filter
,
p_sys
->
p_dst_filter
);
p_sys
->
p_src_filter
,
p_sys
->
p_dst_filter
,
0
);
if
(
!
p_sys
->
ctx
)
{
msg_Err
(
p_filter
,
"could not init SwScaler"
);
...
...
@@ -308,50 +288,3 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
return
p_pic_dst
;
}
/*****************************************************************************
* Chroma fourcc -> ffmpeg_id mapping
*****************************************************************************/
static
struct
{
vlc_fourcc_t
i_chroma
;
unsigned
int
i_swscale_chroma
;
}
chroma_table
[]
=
{
/* Planar YUV formats */
{
VLC_FOURCC
(
'Y'
,
'V'
,
'1'
,
'2'
),
IMGFMT_YV12
},
{
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'0'
),
IMGFMT_I420
},
{
VLC_FOURCC
(
'I'
,
'Y'
,
'U'
,
'V'
),
IMGFMT_IYUV
},
{
VLC_FOURCC
(
'I'
,
'4'
,
'4'
,
'4'
),
IMGFMT_444P
},
{
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
),
IMGFMT_444P
},
{
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'2'
),
IMGFMT_422P
},
{
VLC_FOURCC
(
'I'
,
'4'
,
'1'
,
'1'
),
IMGFMT_411P
},
#if 0
{ VLC_FOURCC('Y','U','V','P'), IMGFMT_Y800 },
#endif
/* Packed YUV formats */
{
VLC_FOURCC
(
'U'
,
'Y'
,
'V'
,
'Y'
),
IMGFMT_UYVY
},
{
VLC_FOURCC
(
'Y'
,
'U'
,
'Y'
,
'2'
),
IMGFMT_YUY2
},
/* Packed RGB formats */
{
VLC_FOURCC
(
'R'
,
'V'
,
'1'
,
'5'
),
IMGFMT_RGB15
},
{
VLC_FOURCC
(
'R'
,
'V'
,
'1'
,
'6'
),
IMGFMT_RGB16
},
{
VLC_FOURCC
(
'R'
,
'V'
,
'2'
,
'4'
),
IMGFMT_RGB24
},
{
VLC_FOURCC
(
'R'
,
'V'
,
'3'
,
'2'
),
IMGFMT_RGB32
},
{
VLC_FOURCC
(
'G'
,
'R'
,
'E'
,
'Y'
),
IMGFMT_RGB8
},
{
0
}
};
static
int
GetSwscaleChroma
(
vlc_fourcc_t
i_chroma
)
{
int
i
;
for
(
i
=
0
;
chroma_table
[
i
].
i_chroma
!=
0
;
i
++
)
{
if
(
chroma_table
[
i
].
i_chroma
==
i_chroma
)
return
chroma_table
[
i
].
i_swscale_chroma
;
}
return
0
;
}
modules/video_filter/swscale/Modules.am
deleted
100644 → 0
View file @
3a2462f6
SOURCES_swscale = \
swscale.c \
swscale.h \
swscale_internal.h \
yuv2rgb.c \
rgb2rgb.c \
rgb2rgb.h \
common.h \
filter.c \
$(NULL)
EXTRA_DIST += \
swscale_template.c \
swscale_altivec_template.c \
yuv2rgb_template.c \
yuv2rgb_altivec.c \
yuv2rgb_mlib.c \
rgb2rgb_template.c \
$(NULL)
modules/video_filter/swscale/common.h
deleted
100644 → 0
View file @
3a2462f6
/*****************************************************************************
* common.h: a few defines and wrappers for swscale
*****************************************************************************
* Copyright (C) 1999-2004 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
* This program 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.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#define mp_msg(a,b,args... ) //fprintf(stderr, ##args)
#define vo_format_name(a) ""
#ifndef _VLC_FILTER_H
extern
void
*
(
*
swscale_fast_memcpy
)(
void
*
,
const
void
*
,
int
);
#endif
#define memcpy(a,b,c) swscale_fast_memcpy(a,b,c)
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__OS2__) || \
(defined(__OpenBSD__) && !defined(__ELF__))
#define MANGLE(a) "_" #a
#else
#define MANGLE(a) #a
#endif
#ifdef ARCH_X86
static
inline
unsigned
short
ByteSwap16
(
unsigned
short
x
)
{
__asm
(
"xchgb %b0,%h0"
:
"=q"
(
x
)
:
"0"
(
x
));
return
x
;
}
#define bswap_16(x) ByteSwap16(x)
#else
#define bswap_16(x) (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8)
#endif
/* !ARCH_X86 */
/* SWSCALE image formats */
#define IMGFMT_RGB_MASK 0xFFFFFF00
#define IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8))
#define IMGFMT_RGB1 (IMGFMT_RGB|1)
#define IMGFMT_RGB4 (IMGFMT_RGB|4)
#define IMGFMT_RGB4_CHAR (IMGFMT_RGB|4|128) // RGB4 with 1 pixel per byte
#define IMGFMT_RGB8 (IMGFMT_RGB|8)
#define IMGFMT_RGB15 (IMGFMT_RGB|15)
#define IMGFMT_RGB16 (IMGFMT_RGB|16)
#define IMGFMT_RGB24 (IMGFMT_RGB|24)
#define IMGFMT_RGB32 (IMGFMT_RGB|32)
#define IMGFMT_BGR_MASK 0xFFFFFF00
#define IMGFMT_BGR (('B'<<24)|('G'<<16)|('R'<<8))
#define IMGFMT_BGR1 (IMGFMT_BGR|1)
#define IMGFMT_BGR4 (IMGFMT_BGR|4)
#define IMGFMT_BGR4_CHAR (IMGFMT_BGR|4|128) // BGR4 with 1 pixel per byte
#define IMGFMT_BGR8 (IMGFMT_BGR|8)
#define IMGFMT_BGR15 (IMGFMT_BGR|15)
#define IMGFMT_BGR16 (IMGFMT_BGR|16)
#define IMGFMT_BGR24 (IMGFMT_BGR|24)
#define IMGFMT_BGR32 (IMGFMT_BGR|32)
#ifdef WORDS_BIGENDIAN
#define IMGFMT_ABGR IMGFMT_RGB32
#define IMGFMT_BGRA (IMGFMT_RGB32|64)
#define IMGFMT_ARGB IMGFMT_BGR32
#define IMGFMT_RGBA (IMGFMT_BGR32|64)
#else
#define IMGFMT_ABGR (IMGFMT_BGR32|64)
#define IMGFMT_BGRA IMGFMT_BGR32
#define IMGFMT_ARGB (IMGFMT_RGB32|64)
#define IMGFMT_RGBA IMGFMT_RGB32
#endif
/* old names for compatibility */
#define IMGFMT_RG4B IMGFMT_RGB4_CHAR
#define IMGFMT_BG4B IMGFMT_BGR4_CHAR
#define IMGFMT_IS_RGB(fmt) (((fmt)&IMGFMT_RGB_MASK)==IMGFMT_RGB)
#define IMGFMT_IS_BGR(fmt) (((fmt)&IMGFMT_BGR_MASK)==IMGFMT_BGR)
#define IMGFMT_RGB_DEPTH(fmt) ((fmt)&0x3F)
#define IMGFMT_BGR_DEPTH(fmt) ((fmt)&0x3F)
/* Planar YUV Formats */
#define IMGFMT_YVU9 0x39555659
#define IMGFMT_IF09 0x39304649
#define IMGFMT_YV12 0x32315659
#define IMGFMT_I420 0x30323449
#define IMGFMT_IYUV 0x56555949
#define IMGFMT_CLPL 0x4C504C43
#define IMGFMT_Y800 0x30303859
#define IMGFMT_Y8 0x20203859
#define IMGFMT_NV12 0x3231564E
#define IMGFMT_NV21 0x3132564E
/* unofficial Planar Formats, FIXME if official 4CC exists */
#define IMGFMT_444P 0x50343434
#define IMGFMT_422P 0x50323234
#define IMGFMT_411P 0x50313134
#define IMGFMT_HM12 0x32314D48
/* Packed YUV Formats */
#define IMGFMT_IUYV 0x56595549
#define IMGFMT_IY41 0x31435949
#define IMGFMT_IYU1 0x31555949
#define IMGFMT_IYU2 0x32555949
#define IMGFMT_UYVY 0x59565955
#define IMGFMT_UYNV 0x564E5955
#define IMGFMT_cyuv 0x76757963
#define IMGFMT_Y422 0x32323459
#define IMGFMT_YUY2 0x32595559
#define IMGFMT_YUNV 0x564E5559
#define IMGFMT_YVYU 0x55595659
#define IMGFMT_Y41P 0x50313459
#define IMGFMT_Y211 0x31313259
#define IMGFMT_Y41T 0x54313459
#define IMGFMT_Y42T 0x54323459
#define IMGFMT_V422 0x32323456
#define IMGFMT_V655 0x35353656
#define IMGFMT_CLJR 0x524A4C43
#define IMGFMT_YUVP 0x50565559
#define IMGFMT_UYVP 0x50565955
modules/video_filter/swscale/rgb2rgb.c
deleted
100644 → 0
View file @
3a2462f6
/*
*
* rgb2rgb.c, Software RGB to RGB convertor
* pluralize by Software PAL8 to RGB convertor
* Software YUV to YUV convertor
* Software YUV to RGB convertor
* Written by Nick Kurshev.
* palette & yuv & runtime cpu stuff by Michael (michaelni@gmx.at) (under GPL)
*/
#include
<inttypes.h>
#include
"config.h"
#include
"rgb2rgb.h"
#include
"swscale.h"
#include
"common.h"
#define FAST_BGR2YV12 // use 7 bit coeffs instead of 15bit
void
(
*
rgb24to32
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb24to16
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb24to15
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb32to24
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb32to16
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb32to15
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb15to16
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb15to24
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb15to32
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb16to15
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb16to24
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb16to32
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
//void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, unsigned src_size);
void
(
*
rgb24tobgr24
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb24tobgr16
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb24tobgr15
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb32tobgr32
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
//void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, unsigned src_size);
void
(
*
rgb32tobgr16
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
void
(
*
rgb32tobgr15
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
unsigned
src_size
);
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
);
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
);
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
);
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
);
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
);
void
(
*
planar2x
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
width
,
int
height
,
int
srcStride
,
int
dstStride
);
void
(
*
interleaveBytes
)(
uint8_t
*
src1
,
uint8_t
*
src2
,
uint8_t
*
dst
,
unsigned
width
,
unsigned
height
,
int
src1Stride
,
int
src2Stride
,
int
dstStride
);
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
);
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
);
#ifdef ARCH_X86
static
const
uint64_t
mmx_null
__attribute__
((
aligned
(
8
)))
=
0x0000000000000000ULL
;
static
const
uint64_t
mmx_one
__attribute__
((
aligned
(
8
)))
=
0xFFFFFFFFFFFFFFFFULL
;
static
const
uint64_t
mask32b
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x000000FF000000FFULL
;
static
const
uint64_t
mask32g
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x0000FF000000FF00ULL
;
static
const
uint64_t
mask32r
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x00FF000000FF0000ULL
;
static
const
uint64_t
mask32
__attribute__
((
aligned
(
8
)))
=
0x00FFFFFF00FFFFFFULL
;
static
const
uint64_t
mask3216br
__attribute__
((
aligned
(
8
)))
=
0x00F800F800F800F8ULL
;
static
const
uint64_t
mask3216g
__attribute__
((
aligned
(
8
)))
=
0x0000FC000000FC00ULL
;
static
const
uint64_t
mask3215g
__attribute__
((
aligned
(
8
)))
=
0x0000F8000000F800ULL
;
static
const
uint64_t
mul3216
__attribute__
((
aligned
(
8
)))
=
0x2000000420000004ULL
;
static
const
uint64_t
mul3215
__attribute__
((
aligned
(
8
)))
=
0x2000000820000008ULL
;
static
const
uint64_t
mask24b
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x00FF0000FF0000FFULL
;
static
const
uint64_t
mask24g
attribute_used
__attribute__
((
aligned
(
8
)))
=
0xFF0000FF0000FF00ULL
;
static
const
uint64_t
mask24r
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x0000FF0000FF0000ULL
;
static
const
uint64_t
mask24l
__attribute__
((
aligned
(
8
)))
=
0x0000000000FFFFFFULL
;
static
const
uint64_t
mask24h
__attribute__
((
aligned
(
8
)))
=
0x0000FFFFFF000000ULL
;
static
const
uint64_t
mask24hh
__attribute__
((
aligned
(
8
)))
=
0xffff000000000000ULL
;
static
const
uint64_t
mask24hhh
__attribute__
((
aligned
(
8
)))
=
0xffffffff00000000ULL
;
static
const
uint64_t
mask24hhhh
__attribute__
((
aligned
(
8
)))
=
0xffffffffffff0000ULL
;
static
const
uint64_t
mask15b
__attribute__
((
aligned
(
8
)))
=
0x001F001F001F001FULL
;
/* 00000000 00011111 xxB */
static
const
uint64_t
mask15rg
__attribute__
((
aligned
(
8
)))
=
0x7FE07FE07FE07FE0ULL
;
/* 01111111 11100000 RGx */
static
const
uint64_t
mask15s
__attribute__
((
aligned
(
8
)))
=
0xFFE0FFE0FFE0FFE0ULL
;
static
const
uint64_t
mask15g
__attribute__
((
aligned
(
8
)))
=
0x03E003E003E003E0ULL
;
static
const
uint64_t
mask15r
__attribute__
((
aligned
(
8
)))
=
0x7C007C007C007C00ULL
;
#define mask16b mask15b
static
const
uint64_t
mask16g
__attribute__
((
aligned
(
8
)))
=
0x07E007E007E007E0ULL
;
static
const
uint64_t
mask16r
__attribute__
((
aligned
(
8
)))
=
0xF800F800F800F800ULL
;
static
const
uint64_t
red_16mask
__attribute__
((
aligned
(
8
)))
=
0x0000f8000000f800ULL
;
static
const
uint64_t
green_16mask
__attribute__
((
aligned
(
8
)))
=
0x000007e0000007e0ULL
;
static
const
uint64_t
blue_16mask
__attribute__
((
aligned
(
8
)))
=
0x0000001f0000001fULL
;
static
const
uint64_t
red_15mask
__attribute__
((
aligned
(
8
)))
=
0x00007c000000f800ULL
;
static
const
uint64_t
green_15mask
__attribute__
((
aligned
(
8
)))
=
0x000003e0000007e0ULL
;
static
const
uint64_t
blue_15mask
__attribute__
((
aligned
(
8
)))
=
0x0000001f0000001fULL
;
#ifdef FAST_BGR2YV12
static
const
uint64_t
bgr2YCoeff
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x000000210041000DULL
;
static
const
uint64_t
bgr2UCoeff
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x0000FFEEFFDC0038ULL
;
static
const
uint64_t
bgr2VCoeff
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x00000038FFD2FFF8ULL
;
#else
static
const
uint64_t
bgr2YCoeff
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x000020E540830C8BULL
;
static
const
uint64_t
bgr2UCoeff
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x0000ED0FDAC23831ULL
;
static
const
uint64_t
bgr2VCoeff
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x00003831D0E6F6EAULL
;
#endif
static
const
uint64_t
bgr2YOffset
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x1010101010101010ULL
;
static
const
uint64_t
bgr2UVOffset
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x8080808080808080ULL
;
static
const
uint64_t
w1111
attribute_used
__attribute__
((
aligned
(
8
)))
=
0x0001000100010001ULL
;
#if 0
static volatile uint64_t __attribute__((aligned(8))) b5Dither;
static volatile uint64_t __attribute__((aligned(8))) g5Dither;
static volatile uint64_t __attribute__((aligned(8))) g6Dither;
static volatile uint64_t __attribute__((aligned(8))) r5Dither;
static uint64_t __attribute__((aligned(8))) dither4[2]={
0x0103010301030103LL,
0x0200020002000200LL,};
static uint64_t __attribute__((aligned(8))) dither8[2]={
0x0602060206020602LL,
0x0004000400040004LL,};
#endif
#endif
#define RGB2YUV_SHIFT 8
#define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5))
#define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5))
#define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
#define GY ((int)( 0.504*(1<<RGB2YUV_SHIFT)+0.5))
#define GV ((int)(-0.368*(1<<RGB2YUV_SHIFT)+0.5))
#define GU ((int)(-0.291*(1<<RGB2YUV_SHIFT)+0.5))
#define RY ((int)( 0.257*(1<<RGB2YUV_SHIFT)+0.5))
#define RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
#define RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5))
//Note: we have C, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one
//Plain C versions
#undef HAVE_MMX
#undef HAVE_MMX2
#undef HAVE_3DNOW
#undef HAVE_SSE2
#define RENAME(a) a ## _C
#include
"rgb2rgb_template.c"
#ifdef ARCH_X86
//MMX versions
#undef RENAME
#define HAVE_MMX
#undef HAVE_MMX2
#undef HAVE_3DNOW
#undef HAVE_SSE2
#define RENAME(a) a ## _MMX
#include
"rgb2rgb_template.c"
//MMX2 versions
#undef RENAME
#define HAVE_MMX
#define HAVE_MMX2
#undef HAVE_3DNOW
#undef HAVE_SSE2
#define RENAME(a) a ## _MMX2
#include
"rgb2rgb_template.c"
//3DNOW versions
#undef RENAME
#define HAVE_MMX
#undef HAVE_MMX2
#define HAVE_3DNOW
#undef HAVE_SSE2
#define RENAME(a) a ## _3DNOW
#include
"rgb2rgb_template.c"
#endif //ARCH_X86
/*
rgb15->rgb16 Original by Strepto/Astral
ported to gcc & bugfixed : A'rpi
MMX2, 3DNOW optimization by Nick Kurshev
32bit c version, and and&add trick by Michael Niedermayer
*/
void
sws_rgb2rgb_init
(
int
flags
){
#ifdef ARCH_X86
if
(
flags
&
SWS_CPU_CAPS_MMX2
){
rgb15to16
=
rgb15to16_MMX2
;
rgb15to24
=
rgb15to24_MMX2
;
rgb15to32
=
rgb15to32_MMX2
;
rgb16to24
=
rgb16to24_MMX2
;
rgb16to32
=
rgb16to32_MMX2
;
rgb16to15
=
rgb16to15_MMX2
;