#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_vout.h>
#include <vlc_filter.h>
#ifdef HAVE_LIBSWSCALE_SWSCALE_H
# include <libswscale/swscale.h>
+# include <libavcodec/avcodec.h>
#elif defined(HAVE_FFMPEG_SWSCALE_H)
# include <ffmpeg/swscale.h>
+# include <ffmpeg/avcodec.h>
#endif
/* Gruikkkkkkkkkk!!!!! */
-#include "../codec/avcodec/chroma.h"
+#include "../codec/avcodec/avcodec.h"
+#undef AVPALETTE_SIZE
#define AVPALETTE_SIZE (256 * sizeof(uint32_t))
N_("Area"), N_("Luma bicubic / chroma bilinear"), N_("Gauss"),
N_("SincR"), N_("Lanczos"), N_("Bicubic spline") };
-vlc_module_begin();
- set_description( N_("Video scaling filter") );
- set_capability( "video filter2", 150 );
- set_category( CAT_VIDEO );
- set_subcategory( SUBCAT_VIDEO_VFILTER );
- set_callbacks( OpenScaler, CloseScaler );
- add_integer( "swscale-mode", 2, NULL, SCALEMODE_TEXT, SCALEMODE_LONGTEXT, true );
- change_integer_list( pi_mode_values, ppsz_mode_descriptions, NULL );
-vlc_module_end();
+vlc_module_begin ()
+ set_description( N_("Video scaling filter") )
+ set_shortname( N_("Swscale" ) )
+ set_capability( "video filter2", 150 )
+ set_category( CAT_VIDEO )
+ set_subcategory( SUBCAT_VIDEO_VFILTER )
+ set_callbacks( OpenScaler, CloseScaler )
+ add_integer( "swscale-mode", 2, NULL, SCALEMODE_TEXT, SCALEMODE_LONGTEXT, true )
+ change_integer_list( pi_mode_values, ppsz_mode_descriptions, NULL )
+vlc_module_end ()
/* Version checking */
#if LIBSWSCALE_VERSION_INT >= ((0<<16)+(5<<8)+0)
int i_sws_mode;
- float sws_lum_gblur = 0.0, sws_chr_gblur = 0.0;
- int sws_chr_vshift = 0, sws_chr_hshift = 0;
- float sws_chr_sharpen = 0.0, sws_lum_sharpen = 0.0;
-
if( GetParameters( NULL,
&p_filter->fmt_in.video,
&p_filter->fmt_out.video, 0 ) )
if( p_fmti->i_chroma == p_fmto->i_chroma )
{
- if( p_fmti->i_chroma == VLC_FOURCC( 'Y', 'U', 'V', 'P' ) && ALLOW_YUVP )
+ if( p_fmti->i_chroma == VLC_CODEC_YUVP && ALLOW_YUVP )
{
i_fmti = i_fmto = PIX_FMT_GRAY8;
i_sws_flags = SWS_POINT;
}
}
- if( p_fmti->i_chroma == VLC_FOURCC( 'Y', 'U', 'V', 'A' ) )
+ if( p_fmti->i_chroma == VLC_CODEC_YUVA )
{
i_fmti = PIX_FMT_YUV444P;
b_has_ai = true;
}
- else if( p_fmti->i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'A' ) )
+ else if( p_fmti->i_chroma == VLC_CODEC_RGBA )
{
i_fmti = PIX_FMT_BGR32;
b_has_ai = true;
}
- if( p_fmto->i_chroma == VLC_FOURCC( 'Y', 'U', 'V', 'A' ) )
+ if( p_fmto->i_chroma == VLC_CODEC_YUVA )
{
i_fmto = PIX_FMT_YUV444P;
b_has_ao = true;
}
- else if( p_fmto->i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'A' ) )
+ else if( p_fmto->i_chroma == VLC_CODEC_RGBA )
{
i_fmto = PIX_FMT_BGR32;
b_has_ao = true;
}
+ /* FIXME TODO removed when ffmpeg is fixed
+ * Without SWS_ACCURATE_RND the quality is really bad for some conversions */
+ switch( i_fmto )
+ {
+ case PIX_FMT_ARGB:
+ case PIX_FMT_RGBA:
+ case PIX_FMT_ABGR:
+ i_sws_flags |= SWS_ACCURATE_RND;
+ break;
+ }
+
if( p_cfg )
{
p_cfg->i_fmti = i_fmti;
p_cfg->i_fmto = i_fmto;
p_cfg->b_has_a = b_has_ai && b_has_ao;
p_cfg->b_add_a = (!b_has_ai) && b_has_ao;
- p_cfg->b_copy = i_fmti == i_fmto && p_fmti->i_width == p_fmto->i_width && p_fmti->i_width && p_fmto->i_height;
+ p_cfg->b_copy = i_fmti == i_fmto && p_fmti->i_width == p_fmto->i_width && p_fmti->i_height == p_fmto->i_height;
p_cfg->i_sws_flags = i_sws_flags;
}
}
if( p_sys->ctxA )
{
- p_sys->p_src_a = picture_New( VLC_FOURCC( 'G', 'R', 'E', 'Y' ), i_fmti_width, p_fmti->i_height, 0 );
- p_sys->p_dst_a = picture_New( VLC_FOURCC( 'G', 'R', 'E', 'Y' ), i_fmto_width, p_fmto->i_height, 0 );
+ p_sys->p_src_a = picture_New( VLC_CODEC_GREY, i_fmti_width, p_fmti->i_height, 0 );
+ p_sys->p_dst_a = picture_New( VLC_CODEC_GREY, i_fmto_width, p_fmto->i_height, 0 );
}
if( p_sys->i_extend_factor != 1 )
{
uint8_t *dst[3]; int dst_stride[3];
GetPixels( src, src_stride, p_src, i_plane_start, i_plane_count );
- if( p_filter->fmt_in.video.i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'P' ) )
+ if( p_filter->fmt_in.video.i_chroma == VLC_CODEC_RGBP )
{
memset( palette, 0, sizeof(palette) );
if( p_filter->fmt_in.video.p_palette )
if( p_sys->ctxA )
{
/* We extract the A plane to rescale it, and then we reinject it. */
- if( p_fmti->i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'A' ) )
+ if( p_fmti->i_chroma == VLC_CODEC_RGBA )
ExtractA( p_sys->p_src_a, p_src, p_fmti->i_width * p_sys->i_extend_factor, p_fmti->i_height );
else
plane_CopyPixels( p_sys->p_src_a->p, p_src->p+A_PLANE );
Convert( p_filter, p_sys->ctxA, p_sys->p_dst_a, p_sys->p_src_a, p_fmti->i_height, 0, 1 );
- if( p_fmto->i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'A' ) )
+ if( p_fmto->i_chroma == VLC_CODEC_RGBA )
InjectA( p_dst, p_sys->p_dst_a, p_fmto->i_width * p_sys->i_extend_factor, p_fmto->i_height );
else
plane_CopyPixels( p_dst->p+A_PLANE, p_sys->p_dst_a->p );
else if( p_sys->b_add_a )
{
/* We inject a complete opaque alpha plane */
- if( p_fmto->i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'A' ) )
+ if( p_fmto->i_chroma == VLC_CODEC_RGBA )
FillA( &p_dst->p[0], OFFSET_A );
else
FillA( &p_dst->p[A_PLANE], 0 );