#include <vlc_filter.h>
#include <vlc_cpu.h>
-#ifdef HAVE_LIBSWSCALE_SWSCALE_H
-# include <libswscale/swscale.h>
-#elif defined(HAVE_FFMPEG_SWSCALE_H)
-# include <ffmpeg/swscale.h>
+#include <libswscale/swscale.h>
+
+#ifdef __APPLE__
+# include <TargetConditionals.h>
#endif
#include "../codec/avcodec/chroma.h" // Chroma Avutil <-> VLC conversion
* Local prototypes
****************************************************************************/
-void *( *swscale_fast_memcpy )( void *, const void *, size_t );
-
/**
* Internal swscale filter structure.
*/
if( ( p_filter->p_sys = p_sys = malloc(sizeof(filter_sys_t)) ) == NULL )
return VLC_ENOMEM;
- /* FIXME pointer assignment may not be atomic */
- swscale_fast_memcpy = vlc_memcpy;
-
/* Set CPU capabilities */
p_sys->i_cpu_mask = GetSwsCpuMask();
(char *)&p_filter->fmt_out.video.i_chroma,
ppsz_mode_descriptions[i_sws_mode] );
+ p_filter->fmt_out.video.i_sar_num = p_filter->fmt_in.video.i_sar_num;
+ p_filter->fmt_out.video.i_sar_den = p_filter->fmt_in.video.i_sar_den;
+
return VLC_SUCCESS;
}
*****************************************************************************/
static int GetSwsCpuMask(void)
{
- const unsigned int i_cpu = vlc_CPU();
int i_sws_cpu = 0;
- if( i_cpu & CPU_CAPABILITY_MMX )
+#if defined(__i386__) || defined(__x86_64__)
+ if( vlc_CPU_MMX() )
i_sws_cpu |= SWS_CPU_CAPS_MMX;
#if (LIBSWSCALE_VERSION_INT >= ((0<<16)+(5<<8)+0))
- if( i_cpu & CPU_CAPABILITY_MMXEXT )
+ if( vlc_CPU_MMXEXT() )
i_sws_cpu |= SWS_CPU_CAPS_MMX2;
#endif
- if( i_cpu & CPU_CAPABILITY_3DNOW )
+ if( vlc_CPU_3dNOW() )
i_sws_cpu |= SWS_CPU_CAPS_3DNOW;
-
- if( i_cpu & CPU_CAPABILITY_ALTIVEC )
+#elif defined(__ppc__) || defined(__ppc64__) || defined(__powerpc__)
+ if( vlc_CPU_ALTIVEC() )
i_sws_cpu |= SWS_CPU_CAPS_ALTIVEC;
+#endif
return i_sws_cpu;
}
*pi_fmt = PIX_FMT_YUV410P;
*pb_swap_uv = true;
break;
- case VLC_CODEC_RGB16:
- *pi_fmt = PIX_FMT_RGB565;
- break;
default:
break;
}
FixParameters( &i_fmti, &b_has_ai, &b_swap_uvi, p_fmti->i_chroma );
FixParameters( &i_fmto, &b_has_ao, &b_swap_uvo, p_fmto->i_chroma );
+#if !defined (__ANDROID__) && !defined(TARGET_OS_IPHONE)
/* FIXME TODO removed when ffmpeg is fixed
* Without SWS_ACCURATE_RND the quality is really bad for some conversions */
switch( i_fmto )
i_sws_flags |= SWS_ACCURATE_RND;
break;
}
+#endif
if( p_cfg )
{
{
filter_sys_t *p_sys = p_filter->p_sys;
const video_format_t *p_fmti = &p_filter->fmt_in.video;
- const video_format_t *p_fmto = &p_filter->fmt_out.video;
+ video_format_t *p_fmto = &p_filter->fmt_out.video;
if( IsFmtSimilar( p_fmti, &p_sys->fmt_in ) &&
IsFmtSimilar( p_fmto, &p_sys->fmt_out ) &&
p_sys->p_src_e = picture_New( p_fmti->i_chroma, i_fmti_width, p_fmti->i_height, 0, 1 );
p_sys->p_dst_e = picture_New( p_fmto->i_chroma, i_fmto_width, p_fmto->i_height, 0, 1 );
- memset( p_sys->p_src_e->p[0].p_pixels, 0, p_sys->p_src_e->p[0].i_pitch * p_sys->p_src_e->p[0].i_lines );
- memset( p_sys->p_dst_e->p[0].p_pixels, 0, p_sys->p_dst_e->p[0].i_pitch * p_sys->p_dst_e->p[0].i_lines );
+ if( p_sys->p_src_e )
+ memset( p_sys->p_src_e->p[0].p_pixels, 0, p_sys->p_src_e->p[0].i_pitch * p_sys->p_src_e->p[0].i_lines );
+ if( p_sys->p_dst_e )
+ memset( p_sys->p_dst_e->p[0].p_pixels, 0, p_sys->p_dst_e->p[0].i_pitch * p_sys->p_dst_e->p[0].i_lines );
}
if( !p_sys->ctx ||
p_sys->b_swap_uvi = cfg.b_swap_uvi;
p_sys->b_swap_uvo = cfg.b_swap_uvo;
+ video_format_ScaleCropAr( p_fmto, p_fmti );
#if 0
msg_Dbg( p_filter, "%ix%i chroma: %4.4s -> %ix%i chroma: %4.4s extend by %d",
p_fmti->i_width, p_fmti->i_height, (char *)&p_fmti->i_chroma,