Commit bbd293ff authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove imgresample

parent aed9c92a
...@@ -102,8 +102,12 @@ Audio output: ...@@ -102,8 +102,12 @@ Audio output:
Video output: Video output:
* Effects (cube, torus, etc.) removed from OpenGL video output * Effects (cube, torus, etc.) removed from OpenGL video output
* Video is able to stay in original size and to zoom in fullscreen (hotkey 'o') while keeping black borders * Video is able to stay in original size and to zoom in fullscreen
* Image video output has been rewritten into a video-filter named 'scene'. The old image video output has been removed. (hotkey 'o') while keeping black borders
* Image video output has been rewritten into a video-filter named 'scene'.
The old image video output has been removed.
* Support for scaling and converting video chromas with FFMPEG imgresample was
withdrawn due to bugs. Please use the newer FFMPEG swscale instead.
Miscellanous: Miscellanous:
* Invmem, a fake codec to display images from external applications * Invmem, a fake codec to display images from external applications
......
...@@ -213,7 +213,7 @@ case "${host_os}" in ...@@ -213,7 +213,7 @@ case "${host_os}" in
VLC_ADD_LDFLAGS([mkv mp4], [-Wl,-framework,IOKit,-framework,CoreFoundation]) VLC_ADD_LDFLAGS([mkv mp4], [-Wl,-framework,IOKit,-framework,CoreFoundation])
VLC_ADD_LDFLAGS([vlc],[-Wl,-undefined,dynamic_lookup]) VLC_ADD_LDFLAGS([vlc],[-Wl,-undefined,dynamic_lookup])
VLC_ADD_LDFLAGS([libvlc_control],[-Wl,dynamic_lookup]) VLC_ADD_LDFLAGS([libvlc_control],[-Wl,dynamic_lookup])
VLC_ADD_LDFLAGS([avcodec avformat swscale imgresample postproc i420_rgb_mmx x264],[-Wl,-read_only_relocs,suppress]) VLC_ADD_LDFLAGS([avcodec avformat swscale postproc i420_rgb_mmx x264],[-Wl,-read_only_relocs,suppress])
VLC_ADD_CFLAGS([motion],[-fconstant-cfstrings]) VLC_ADD_CFLAGS([motion],[-fconstant-cfstrings])
VLC_ADD_LDFLAGS([libvlc],[-Wl,-framework,CoreFoundation]) VLC_ADD_LDFLAGS([libvlc],[-Wl,-framework,CoreFoundation])
VLC_ADD_LDFLAGS([motion],[-Wl,-framework,IOKit,-framework,CoreFoundation]) VLC_ADD_LDFLAGS([motion],[-Wl,-framework,IOKit,-framework,CoreFoundation])
...@@ -720,7 +720,7 @@ AC_CHECK_LIB(m,cos,[ ...@@ -720,7 +720,7 @@ AC_CHECK_LIB(m,cos,[
VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain scene],[-lm]) VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain scene],[-lm])
]) ])
AC_CHECK_LIB(m,pow,[ AC_CHECK_LIB(m,pow,[
VLC_ADD_LIBS([avcodec avformat swscale imgresample postproc ffmpegaltivec stream_out_transrate i420_rgb faad twolame equalizer spatializer param_eq libvlc vorbis freetype mod mpc dmo quicktime realaudio realvideo galaktos opengl],[-lm]) VLC_ADD_LIBS([avcodec avformat swscale postproc ffmpegaltivec stream_out_transrate i420_rgb faad twolame equalizer spatializer param_eq libvlc vorbis freetype mod mpc dmo quicktime realaudio realvideo galaktos opengl],[-lm])
]) ])
AC_CHECK_LIB(m,sqrt,[ AC_CHECK_LIB(m,sqrt,[
VLC_ADD_LIBS([headphone_channel_mixer normvol speex mono colorthres extract],[-lm]) VLC_ADD_LIBS([headphone_channel_mixer normvol speex mono colorthres extract],[-lm])
...@@ -3153,49 +3153,7 @@ then ...@@ -3153,49 +3153,7 @@ then
VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS]) VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
VLC_RESTORE_FLAGS VLC_RESTORE_FLAGS
],[ ],[
AC_MSG_WARN([Could not find libswscale. Trying to enable imgresample. Use --disable-swscale to ignore this error.]) AC_MSG_ERROR([Could not find libswscale. Use --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
enable_imgresample=yes
])
fi
dnl
dnl avcodec (deprecated API) image scaling and conversion plugin
dnl
dnl This is build as a seperate module than the avcodec one to prevent
dnl stupid run time library load errors from disabling most codecs
dnl from VLC.
dnl
AC_ARG_ENABLE(imgresample,
AS_HELP_STRING([--enable-imgresample],[deprecated libavcodec image scaling
and conversion (default disabled)]))
if test "${enable_imgresample}" = "yes"
then
PKG_CHECK_MODULES(IMGRESAMPLE,[libavcodec],
[
VLC_SAVE_FLAGS
CPPFLAGS="${CPPFLAGS} ${IMGRESAMPLE_CFLAGS}"
CFLAGS="${CFLAGS} ${IMGRESAMPLE_CFLAGS}"
AC_CHECK_HEADERS(libavcodec/avcodec.h ffmpeg/avcodec.h)
AC_CHECK_LIB(avcodec,img_resample,
[
VLC_ADD_PLUGIN([imgresample])
VLC_ADD_LIBS([imgresample],[$IMGRESAMPLE_LIBS])
VLC_ADD_CFLAGS([imgresample],[$IMGRESAMPLE_CFLAGS])
],[
AC_MSG_WARN([Could not find img_resample in libavcodec.])
if test "${enable_swscale}" != "no"
then
AC_MSG_FAILURE([swscale (and its fallback module imgresample) support will be missing. Use --disable-swscale to ignore this error. (This basically means that you will be missing any good software scaling module and some video chroma converters.)])
fi
# That sed hack to add -rpath is kind of ugly but at least it fixes
# detection when linking against a shared libavcodec with
# a libavutil not in one of your ld.so.conf directories.
# (for example a local install)
],[${IMGRESAMPLE_LIBS} `echo ${IMGRESAMPLE_LIBS}|sed s'/-L/-Wl,-rpath=/'`])
VLC_RESTORE_FLAGS
],[
AC_MSG_WARN([Could not find libavcodec.])
]) ])
fi fi
......
...@@ -158,7 +158,6 @@ $Id$ ...@@ -158,7 +158,6 @@ $Id$
* id3: ID3 tag skipper * id3: ID3 tag skipper
* id3tag: ID3 tag parser/skipper using libid3tag * id3tag: ID3 tag parser/skipper using libid3tag
* image: Image file video output * image: Image file video output
* imgresample: FFmpeg video filter
* inhibit: preventing the computer from suspending * inhibit: preventing the computer from suspending
* invert: inverse video filter * invert: inverse video filter
* invmem: module for VLC to display images from an external application * invmem: module for VLC to display images from an external application
......
...@@ -42,7 +42,6 @@ SOURCES_blendbench = blendbench.c ...@@ -42,7 +42,6 @@ SOURCES_blendbench = blendbench.c
SOURCES_chain = chain.c SOURCES_chain = chain.c
SOURCES_postproc = postproc.c SOURCES_postproc = postproc.c
SOURCES_swscale = swscale.c ../codec/avcodec/chroma.c SOURCES_swscale = swscale.c ../codec/avcodec/chroma.c
SOURCES_imgresample = imgresample.c ../codec/avcodec/chroma.c
SOURCES_swscale_maemo = swscale_maemo.c libswscale_nokia770/arm_jit_swscale.c libswscale_nokia770/arm_colorconv.S libswscale_nokia770/arm_jit_swscale.h libswscale_nokia770/arm_colorconv.h SOURCES_swscale_maemo = swscale_maemo.c libswscale_nokia770/arm_jit_swscale.c libswscale_nokia770/arm_colorconv.S libswscale_nokia770/arm_jit_swscale.h libswscale_nokia770/arm_colorconv.h
SOURCES_scene = scene.c SOURCES_scene = scene.c
SOURCES_yuvp = yuvp.c SOURCES_yuvp = yuvp.c
......
/*****************************************************************************
* imageresample.c: scaling and chroma conversion using the old libavcodec API
*****************************************************************************
* Copyright (C) 1999-2001 the VideoLAN team
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_vout.h>
#include <vlc_filter.h>
/* ffmpeg header */
#ifdef HAVE_LIBAVCODEC_AVCODEC_H
# include <libavcodec/avcodec.h>
#elif defined(HAVE_FFMPEG_AVCODEC_H)
# include <ffmpeg/avcodec.h>
#else
# include <avcodec.h>
#endif
#include "../codec/avcodec/avcodec.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int OpenFilter( vlc_object_t * );
static void CloseFilter( vlc_object_t * );
static void Conversion( filter_t *, picture_t *, picture_t * );
static picture_t *Conversion_Filter( filter_t *, picture_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin ()
set_capability( "video filter2", 50 )
set_callbacks( OpenFilter, CloseFilter )
set_description( N_("FFmpeg video filter") )
vlc_module_end ()
/*****************************************************************************
* chroma_sys_t: chroma method descriptor
*****************************************************************************
* This structure is part of the chroma transformation descriptor, it
* describes the chroma plugin specific properties.
*****************************************************************************/
struct filter_sys_t
{
int i_src_vlc_chroma;
int i_src_ffmpeg_chroma;
int i_dst_vlc_chroma;
int i_dst_ffmpeg_chroma;
AVPicture tmp_pic;
ImgReSampleContext *p_rsc;
};
/*****************************************************************************
* OpenFilter: allocate a chroma function
*****************************************************************************
* This function allocates and initializes a chroma function
*****************************************************************************/
int OpenFilter( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
int i_ffmpeg_chroma[2];
/*
* Check the source chroma first, then the destination chroma
*/
if( GetFfmpegChroma( &i_ffmpeg_chroma[0], p_filter->fmt_in.video ) == VLC_EGENERIC )
return VLC_EGENERIC;
if( GetFfmpegChroma( &i_ffmpeg_chroma[1], p_filter->fmt_out.video ) == VLC_EGENERIC )
return VLC_EGENERIC;
p_filter->pf_video_filter = Conversion_Filter;
p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
if( p_filter->p_sys == NULL )
{
return VLC_ENOMEM;
}
p_filter->p_sys->i_src_vlc_chroma = p_filter->fmt_in.video.i_chroma;
p_filter->p_sys->i_dst_vlc_chroma = p_filter->fmt_out.video.i_chroma;
p_filter->p_sys->i_src_ffmpeg_chroma = i_ffmpeg_chroma[0];
p_filter->p_sys->i_dst_ffmpeg_chroma = i_ffmpeg_chroma[1];
if( ( p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height ||
p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width ) &&
( p_filter->p_sys->i_dst_vlc_chroma == VLC_FOURCC('I','4','2','0') ||
p_filter->p_sys->i_dst_vlc_chroma == VLC_FOURCC('Y','V','1','2') ))
{
msg_Dbg( p_filter, "preparing to resample picture" );
p_filter->p_sys->p_rsc =
img_resample_init( p_filter->fmt_out.video.i_width,
p_filter->fmt_out.video.i_height,
p_filter->fmt_in.video.i_width,
p_filter->fmt_in.video.i_height );
avpicture_alloc( &p_filter->p_sys->tmp_pic,
p_filter->p_sys->i_dst_ffmpeg_chroma,
p_filter->fmt_in.video.i_width,
p_filter->fmt_in.video.i_height );
}
else
{
msg_Dbg( p_filter, "no resampling" );
p_filter->p_sys->p_rsc = NULL;
}
return VLC_SUCCESS;
}
VIDEO_FILTER_WRAPPER( Conversion )
/*****************************************************************************
* ChromaConversion: actual chroma conversion function
*****************************************************************************/
static void Conversion( filter_t *p_filter,
picture_t *p_src, picture_t *p_dest )
{
AVPicture src_pic;
AVPicture dest_pic;
int i;
/* Prepare the AVPictures for converion */
for( i = 0; i < p_src->i_planes; i++ )
{
src_pic.data[i] = p_src->p[i].p_pixels;
src_pic.linesize[i] = p_src->p[i].i_pitch;
}
for( i = 0; i < p_dest->i_planes; i++ )
{
dest_pic.data[i] = p_dest->p[i].p_pixels;
dest_pic.linesize[i] = p_dest->p[i].i_pitch;
}
/* Special cases */
if( p_filter->p_sys->i_src_vlc_chroma == VLC_FOURCC('Y','V','1','2') ||
p_filter->p_sys->i_src_vlc_chroma == VLC_FOURCC('Y','V','U','9') )
{
/* Invert U and V */
src_pic.data[1] = p_src->p[2].p_pixels;
src_pic.data[2] = p_src->p[1].p_pixels;
}
if( p_filter->p_sys->i_dst_vlc_chroma == VLC_FOURCC('Y','V','1','2') ||
p_filter->p_sys->i_dst_vlc_chroma == VLC_FOURCC('Y','V','U','9') )
{
/* Invert U and V */
dest_pic.data[1] = p_dest->p[2].p_pixels;
dest_pic.data[2] = p_dest->p[1].p_pixels;
}
if( p_filter->p_sys->i_src_ffmpeg_chroma == PIX_FMT_RGB24 )
if( p_filter->fmt_in.video.i_bmask == 0x00ff0000 )
p_filter->p_sys->i_src_ffmpeg_chroma = PIX_FMT_BGR24;
if( p_filter->p_sys->p_rsc )
{
img_convert( &p_filter->p_sys->tmp_pic,
p_filter->p_sys->i_dst_ffmpeg_chroma,
&src_pic, p_filter->p_sys->i_src_ffmpeg_chroma,
p_filter->fmt_in.video.i_width,
p_filter->fmt_in.video.i_height );
img_resample( p_filter->p_sys->p_rsc, &dest_pic,
&p_filter->p_sys->tmp_pic );
}
else
{
img_convert( &dest_pic, p_filter->p_sys->i_dst_ffmpeg_chroma,
&src_pic, p_filter->p_sys->i_src_ffmpeg_chroma,
p_filter->fmt_in.video.i_width,
p_filter->fmt_in.video.i_height );
}
}
/*****************************************************************************
* CloseFilter: free the chroma function
*****************************************************************************
* This function frees the previously allocated chroma function
*****************************************************************************/
void CloseFilter( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
if( p_filter->p_sys->p_rsc )
{
img_resample_close( p_filter->p_sys->p_rsc );
avpicture_free( &p_filter->p_sys->tmp_pic );
}
free( p_filter->p_sys );
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment