Tie 770 SW scaler to OMAP FB, not to Hildon UI
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 18 Oct 2009 14:45:41 +0000 (17:45 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 18 Oct 2009 14:48:38 +0000 (17:48 +0300)
Note that this won't work on OMAP1 (ARMv<6). However a trivial change
could enable that (the JIT supports ARMv5 too).

configure.ac
modules/video_filter/Modules.am
modules/video_filter/swscale_arm.c [deleted file]
modules/video_filter/swscale_omap.c [new file with mode: 0644]
po/POTFILES.in

index 7aea04b..b7dcfd7 100644 (file)
@@ -733,7 +733,7 @@ AC_CHECK_LIB(m,sqrt,[
   VLC_ADD_LIBS([headphone_channel_mixer normvol speex mono colorthres extract],[-lm])
 ])
 AC_CHECK_LIB(m,ceil,[
-  VLC_ADD_LIBS([hotkeys mosaic swscale_maemo],[-lm])
+  VLC_ADD_LIBS([hotkeys mosaic swscale_omap],[-lm])
 ])
 AC_CHECK_LIB(m,exp,[
   VLC_ADD_LIBS([gaussianblur],[-lm])
@@ -3959,6 +3959,7 @@ AC_ARG_ENABLE(omapfb,
         AC_CHECK_HEADERS(X11/Xlib.h, [
           VLC_ADD_LIBS([omapfb],[${X_LIBS} ${X_PRE_LIBS} -lX11]) ])
       ])
+      VLC_ADD_PLUGIN([swscale_omap])
     fi
 
 dnl
@@ -4323,7 +4324,6 @@ then
     VLC_ADD_CFLAGS([maemo],[${HILDON_CFLAGS}])
     VLC_ADD_LIBS([maemo],[${HILDON_LIBS}])
     VLC_ADD_PLUGIN([maemo])
-    VLC_ADD_PLUGIN([swscale_maemo])
     ALIASES="${ALIASES} mvlc"
   ], [
     AS_IF([test "${enable_maemo}" = "yes"],[
index 5af788a..7032375 100644 (file)
@@ -43,7 +43,7 @@ SOURCES_blendbench = blendbench.c
 SOURCES_chain = chain.c
 SOURCES_postproc = postproc.c
 SOURCES_swscale = swscale.c ../codec/avcodec/chroma.c
-SOURCES_swscale_maemo = swscale_maemo.c \
+SOURCES_swscale_omap = swscale_omap.c \
        libswscale_nokia770/arm_jit_swscale.c \
        libswscale_nokia770/arm_colorconv.S \
        libswscale_nokia770/arm_jit_swscale.h \
diff --git a/modules/video_filter/swscale_arm.c b/modules/video_filter/swscale_arm.c
deleted file mode 100644 (file)
index 6356ca2..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-/*****************************************************************************
- * swscale_maemo.c: scaling and chroma conversion using libswscale_nokia770
- *****************************************************************************
- * Copyright (C) 1999-2008 the VideoLAN team
- * $Id$
- *
- * Authors: Antoine Lejeune <phytos@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_filter.h>
-
-#include "libswscale_nokia770/arm_jit_swscale.h"
-#include "libswscale_nokia770/arm_colorconv.h"
-
-/****************************************************************************
- * Local prototypes
- ****************************************************************************/
-static int  OpenScaler( vlc_object_t * );
-static void CloseScaler( vlc_object_t * );
-
-static picture_t *Filter( filter_t *, picture_t * );
-static int Init( filter_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin();
-    set_description( N_("Video scaling filter") );
-    set_capability( "video filter2", 1000 );
-    set_category( CAT_VIDEO );
-    set_subcategory( SUBCAT_VIDEO_VFILTER );
-    set_callbacks( OpenScaler, CloseScaler );
-vlc_module_end();
-
-/*****************************************************************************
- * filter_sys_t : filter descriptor
- *****************************************************************************/
-struct filter_sys_t
-{
-    struct SwsContextArmJit *ctx;
-
-    es_format_t fmt_in;
-    es_format_t fmt_out;
-};
-
-/*****************************************************************************
- * OpenScaler: probe the filter and return score
- *****************************************************************************/
-static int OpenScaler( vlc_object_t *p_this )
-{
-    filter_t *p_filter = (filter_t*)p_this;
-    filter_sys_t *p_sys;
-
-    /* Allocate the memory needed to store the decoder's structure */
-    if( ( p_filter->p_sys = p_sys =
-          (filter_sys_t *)malloc(sizeof(filter_sys_t)) ) == NULL )
-    {
-        return VLC_ENOMEM;
-    }
-
-    /* Misc init */
-    p_sys->ctx = NULL;
-    p_filter->pf_video_filter = Filter;
-    es_format_Init( &p_sys->fmt_in, 0, 0 );
-    es_format_Init( &p_sys->fmt_out, 0, 0 );
-
-    if( Init( p_filter ) )
-    {
-        free( p_sys );
-        return VLC_EGENERIC;
-    }
-
-    msg_Dbg( p_filter, "%ix%i chroma: %4.4s -> %ix%i chroma: %4.4s",
-             p_filter->fmt_in.video.i_width, p_filter->fmt_in.video.i_height,
-             (char *)&p_filter->fmt_in.video.i_chroma,
-             p_filter->fmt_out.video.i_width, p_filter->fmt_out.video.i_height,
-             (char *)&p_filter->fmt_out.video.i_chroma );
-
-    return VLC_SUCCESS;
-}
-
-/*****************************************************************************
- * CloseFilter: clean up the filter
- *****************************************************************************/
-static void CloseScaler( vlc_object_t *p_this )
-{
-    filter_t *p_filter = (filter_t*)p_this;
-    filter_sys_t *p_sys = p_filter->p_sys;
-
-    if( p_sys->ctx )
-        sws_arm_jit_free( p_sys->ctx );
-    free( p_sys );
-}
-
-/*****************************************************************************
- * Helpers
- *****************************************************************************/
-
-static bool IsFmtSimilar( const video_format_t *p_fmt1, const video_format_t *p_fmt2 )
-{
-    return p_fmt1->i_chroma == p_fmt2->i_chroma &&
-           p_fmt1->i_width  == p_fmt2->i_width &&
-           p_fmt1->i_height == p_fmt2->i_height;
-}
-
-static int Init( filter_t *p_filter )
-{
-    filter_sys_t *p_sys = p_filter->p_sys;
-
-    if( IsFmtSimilar( &p_filter->fmt_in.video, &p_sys->fmt_in ) &&
-        IsFmtSimilar( &p_filter->fmt_out.video, &p_sys->fmt_out ) &&
-        p_sys->ctx )
-    {
-        return VLC_SUCCESS;
-    }
-
-    if( ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420 &&
-          p_filter->fmt_in.video.i_chroma != VLC_CODEC_YV12 ) ||
-          p_filter->fmt_out.video.i_chroma != VLC_FOURCC('Y','4','2','0') )
-    {
-        msg_Err( p_filter, "format not supported" );
-        return VLC_EGENERIC;
-    }
-
-    if( p_sys->ctx )
-        sws_arm_jit_free( p_sys->ctx );
-
-    p_sys->ctx =
-        sws_arm_jit_create_omapfb_yuv420_scaler_armv6(
-            p_filter->fmt_in.video.i_width,
-            p_filter->fmt_in.video.i_height,
-            p_filter->fmt_out.video.i_width,
-            p_filter->fmt_out.video.i_height, 2 );
-
-    if( !p_sys->ctx )
-    {
-        msg_Err( p_filter, "could not init SwScaler" );
-        return VLC_EGENERIC;
-    }
-
-    p_sys->fmt_in = p_filter->fmt_in;
-    p_sys->fmt_out = p_filter->fmt_out;
-
-    return VLC_SUCCESS;
-}
-
-/****************************************************************************
- * Filter: the whole thing
- ****************************************************************************
- * This function is called just after the thread is launched.
- ****************************************************************************/
-static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
-{
-    filter_sys_t *p_sys = p_filter->p_sys;
-    uint8_t *src[3]; int src_stride[3];
-    uint8_t *dst[3]; int dst_stride[3];
-    picture_t *p_pic_dst;
-    int i_plane;
-    int i_nb_planes = p_pic->i_planes;
-
-    /* Check if format properties changed */
-    if( Init( p_filter ) != VLC_SUCCESS )
-        return NULL;
-
-    /* Request output picture */
-    p_pic_dst = filter_NewPicture( p_filter );
-    if( !p_pic_dst )
-    {
-        msg_Warn( p_filter, "can't get output picture" );
-        return NULL;
-    }
-
-    for( i_plane = 0; i_plane < __MIN(3, p_pic->i_planes); i_plane++ )
-    {
-        src[i_plane] = p_pic->p[i_plane].p_pixels;
-        src_stride[i_plane] = p_pic->p[i_plane].i_pitch;
-    }
-    for( i_plane = 0; i_plane < __MIN(3, i_nb_planes); i_plane++ )
-    {
-        dst[i_plane] = p_pic_dst->p[i_plane].p_pixels;
-        dst_stride[i_plane] = p_pic_dst->p[i_plane].i_pitch;
-    }
-
-    sws_arm_jit_scale( p_sys->ctx, src, src_stride, 0,
-                       p_filter->fmt_in.video.i_height, dst, dst_stride);
-
-    picture_CopyProperties( p_pic_dst, p_pic );
-    picture_Release( p_pic );
-
-    return p_pic_dst;
-}
diff --git a/modules/video_filter/swscale_omap.c b/modules/video_filter/swscale_omap.c
new file mode 100644 (file)
index 0000000..24fb386
--- /dev/null
@@ -0,0 +1,214 @@
+/*****************************************************************************
+ * swscale_omap.c: scaling and chroma conversion using libswscale_nokia770
+ *****************************************************************************
+ * Copyright (C) 1999-2008 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Antoine Lejeune <phytos@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_filter.h>
+
+#include "libswscale_nokia770/arm_jit_swscale.h"
+#include "libswscale_nokia770/arm_colorconv.h"
+
+/****************************************************************************
+ * Local prototypes
+ ****************************************************************************/
+static int  OpenScaler( vlc_object_t * );
+static void CloseScaler( vlc_object_t * );
+
+static picture_t *Filter( filter_t *, picture_t * );
+static int Init( filter_t * );
+
+/*****************************************************************************
+ * Module descriptor
+ *****************************************************************************/
+vlc_module_begin();
+    set_description( N_("Video scaling filter") );
+    set_capability( "video filter2", 1000 );
+    set_category( CAT_VIDEO );
+    set_subcategory( SUBCAT_VIDEO_VFILTER );
+    set_callbacks( OpenScaler, CloseScaler );
+vlc_module_end();
+
+/*****************************************************************************
+ * filter_sys_t : filter descriptor
+ *****************************************************************************/
+struct filter_sys_t
+{
+    struct SwsContextArmJit *ctx;
+
+    es_format_t fmt_in;
+    es_format_t fmt_out;
+};
+
+/*****************************************************************************
+ * OpenScaler: probe the filter and return score
+ *****************************************************************************/
+static int OpenScaler( vlc_object_t *p_this )
+{
+    filter_t *p_filter = (filter_t*)p_this;
+    filter_sys_t *p_sys;
+
+    /* Allocate the memory needed to store the decoder's structure */
+    if( ( p_filter->p_sys = p_sys =
+          (filter_sys_t *)malloc(sizeof(filter_sys_t)) ) == NULL )
+    {
+        return VLC_ENOMEM;
+    }
+
+    /* Misc init */
+    p_sys->ctx = NULL;
+    p_filter->pf_video_filter = Filter;
+    es_format_Init( &p_sys->fmt_in, 0, 0 );
+    es_format_Init( &p_sys->fmt_out, 0, 0 );
+
+    if( Init( p_filter ) )
+    {
+        free( p_sys );
+        return VLC_EGENERIC;
+    }
+
+    msg_Dbg( p_filter, "%ix%i chroma: %4.4s -> %ix%i chroma: %4.4s",
+             p_filter->fmt_in.video.i_width, p_filter->fmt_in.video.i_height,
+             (char *)&p_filter->fmt_in.video.i_chroma,
+             p_filter->fmt_out.video.i_width, p_filter->fmt_out.video.i_height,
+             (char *)&p_filter->fmt_out.video.i_chroma );
+
+    return VLC_SUCCESS;
+}
+
+/*****************************************************************************
+ * CloseFilter: clean up the filter
+ *****************************************************************************/
+static void CloseScaler( vlc_object_t *p_this )
+{
+    filter_t *p_filter = (filter_t*)p_this;
+    filter_sys_t *p_sys = p_filter->p_sys;
+
+    if( p_sys->ctx )
+        sws_arm_jit_free( p_sys->ctx );
+    free( p_sys );
+}
+
+/*****************************************************************************
+ * Helpers
+ *****************************************************************************/
+
+static bool IsFmtSimilar( const video_format_t *p_fmt1, const video_format_t *p_fmt2 )
+{
+    return p_fmt1->i_chroma == p_fmt2->i_chroma &&
+           p_fmt1->i_width  == p_fmt2->i_width &&
+           p_fmt1->i_height == p_fmt2->i_height;
+}
+
+static int Init( filter_t *p_filter )
+{
+    filter_sys_t *p_sys = p_filter->p_sys;
+
+    if( IsFmtSimilar( &p_filter->fmt_in.video, &p_sys->fmt_in ) &&
+        IsFmtSimilar( &p_filter->fmt_out.video, &p_sys->fmt_out ) &&
+        p_sys->ctx )
+    {
+        return VLC_SUCCESS;
+    }
+
+    if( ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420 &&
+          p_filter->fmt_in.video.i_chroma != VLC_CODEC_YV12 ) ||
+          p_filter->fmt_out.video.i_chroma != VLC_FOURCC('Y','4','2','0') )
+    {
+        msg_Err( p_filter, "format not supported" );
+        return VLC_EGENERIC;
+    }
+
+    if( p_sys->ctx )
+        sws_arm_jit_free( p_sys->ctx );
+
+    p_sys->ctx =
+        sws_arm_jit_create_omapfb_yuv420_scaler_armv6(
+            p_filter->fmt_in.video.i_width,
+            p_filter->fmt_in.video.i_height,
+            p_filter->fmt_out.video.i_width,
+            p_filter->fmt_out.video.i_height, 2 );
+
+    if( !p_sys->ctx )
+    {
+        msg_Err( p_filter, "could not init SwScaler" );
+        return VLC_EGENERIC;
+    }
+
+    p_sys->fmt_in = p_filter->fmt_in;
+    p_sys->fmt_out = p_filter->fmt_out;
+
+    return VLC_SUCCESS;
+}
+
+/****************************************************************************
+ * Filter: the whole thing
+ ****************************************************************************
+ * This function is called just after the thread is launched.
+ ****************************************************************************/
+static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
+{
+    filter_sys_t *p_sys = p_filter->p_sys;
+    uint8_t *src[3]; int src_stride[3];
+    uint8_t *dst[3]; int dst_stride[3];
+    picture_t *p_pic_dst;
+    int i_plane;
+    int i_nb_planes = p_pic->i_planes;
+
+    /* Check if format properties changed */
+    if( Init( p_filter ) != VLC_SUCCESS )
+        return NULL;
+
+    /* Request output picture */
+    p_pic_dst = filter_NewPicture( p_filter );
+    if( !p_pic_dst )
+    {
+        msg_Warn( p_filter, "can't get output picture" );
+        return NULL;
+    }
+
+    for( i_plane = 0; i_plane < __MIN(3, p_pic->i_planes); i_plane++ )
+    {
+        src[i_plane] = p_pic->p[i_plane].p_pixels;
+        src_stride[i_plane] = p_pic->p[i_plane].i_pitch;
+    }
+    for( i_plane = 0; i_plane < __MIN(3, i_nb_planes); i_plane++ )
+    {
+        dst[i_plane] = p_pic_dst->p[i_plane].p_pixels;
+        dst_stride[i_plane] = p_pic_dst->p[i_plane].i_pitch;
+    }
+
+    sws_arm_jit_scale( p_sys->ctx, src, src_stride, 0,
+                       p_filter->fmt_in.video.i_height, dst, dst_stride);
+
+    picture_CopyProperties( p_pic_dst, p_pic );
+    picture_Release( p_pic );
+
+    return p_pic_dst;
+}
index cef4432..750df2d 100644 (file)
@@ -1225,7 +1225,7 @@ modules/video_filter/scale.c
 modules/video_filter/scene.c
 modules/video_filter/sharpen.c
 modules/video_filter/swscale.c
-modules/video_filter/swscale_maemo.c
+modules/video_filter/swscale_omap.c
 modules/video_filter/transform.c
 modules/video_filter/wall.c
 modules/video_filter/wave.c