]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/postproc.c
MTP: remove unneeded include
[vlc] / modules / video_filter / postproc.c
index c3b8c04d4caeced1ee0c698d526e441839b686e6..0a1b067570882f6afd3cd1a955e505e9b98155fd 100644 (file)
@@ -30,6 +30,7 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
+#include <vlc_cpu.h>
 
 #include "filter_picture.h"
 
@@ -58,9 +59,10 @@ static int PPNameCallback( vlc_object_t *, char const *,
 
 #define Q_TEXT N_("Post processing quality")
 #define Q_LONGTEXT N_( \
-    "Quality of post processing. Valid range is 0 to 6\n" \
-    "Higher levels require considerable more CPU power, but produce " \
-    "better looking pictures." )
+    "Quality of post processing. Valid range is 0 (disabled) to 6 (highest)\n"     \
+    "Higher levels require more CPU power, but produce higher quality pictures.\n" \
+    "With default filter chain, the values map to the following filters:\n"        \
+    "1: hb, 2-4: hb+vb, 5-6: hb+vb+dr" )
 
 #define NAME_TEXT N_("FFmpeg post processing filter chains")
 #define NAME_LONGTEXT NAME_TEXT
@@ -73,8 +75,7 @@ static int PPNameCallback( vlc_object_t *, char const *,
 vlc_module_begin ()
     set_description( N_("Video post processing filter") )
     set_shortname( N_("Postproc" ) )
-    add_shortcut( "postprocess" ) /* name is "postproc" */
-    add_shortcut( "pp" )
+    add_shortcut( "postprocess", "pp" ) /* name is "postproc" */
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
@@ -86,7 +87,7 @@ vlc_module_begin ()
                             PP_QUALITY_MAX, NULL, Q_TEXT, Q_LONGTEXT, false )
         add_deprecated_alias( "ffmpeg-pp-q" )
         change_safe()
-    add_string( FILTER_PREFIX "name", "default", NULL, NAME_TEXT,
+    add_string( FILTER_PREFIX "name", "default", NAME_TEXT,
                 NAME_LONGTEXT, true )
         add_deprecated_alias( "ffmpeg-pp-name" )
 vlc_module_end ()
@@ -167,7 +168,7 @@ static int OpenPostproc( vlc_object_t *p_this )
             i_flags |= PP_FORMAT_420;
             break;
         default:
-            msg_Err( p_filter, "Unsupported input chroma (%4s)",
+            msg_Err( p_filter, "Unsupported input chroma (%4.4s)",
                       (char*)&p_filter->fmt_in.video.i_chroma );
             return VLC_EGENERIC;
     }
@@ -189,12 +190,8 @@ static int OpenPostproc( vlc_object_t *p_this )
     config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
                        p_filter->p_cfg );
 
-    var_Create( p_filter, FILTER_PREFIX "q",
-                VLC_VAR_INTEGER | VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT |
-                VLC_VAR_ISCOMMAND );
-    /* For some obscure reason the VLC_VAR_ISCOMMAND isn't taken into account
-       in during var_Create */
-    var_Change( p_filter, FILTER_PREFIX "q", VLC_VAR_SETISCOMMAND, NULL, NULL );
+    var_Create( p_filter, FILTER_PREFIX "q", VLC_VAR_INTEGER |
+                VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
 
     text.psz_string = _("Post processing");
     var_Change( p_filter, FILTER_PREFIX "q", VLC_VAR_SETTEXT, &text, NULL );
@@ -202,8 +199,7 @@ static int OpenPostproc( vlc_object_t *p_this )
     var_Get( p_filter, FILTER_PREFIX "q", &val_orig );
     var_Change( p_filter, FILTER_PREFIX "q", VLC_VAR_DELCHOICE, &val_orig, NULL );
 
-    val.psz_string = var_CreateGetNonEmptyStringCommand(
-                                            p_filter, FILTER_PREFIX "name" );
+    val.psz_string = var_GetNonEmptyString( p_filter, FILTER_PREFIX "name" );
     if( val_orig.i_int )
     {
         p_sys->pp_mode = pp_get_mode_by_name_and_quality( val.psz_string ?
@@ -215,7 +211,6 @@ static int OpenPostproc( vlc_object_t *p_this )
         {
             msg_Err( p_filter, "Error while creating post processing mode." );
             free( val.psz_string );
-            var_Destroy( p_filter, FILTER_PREFIX "q" );
             pp_free_context( p_sys->pp_context );
             free( p_sys );
             return VLC_EGENERIC;
@@ -291,21 +286,22 @@ static picture_t *PostprocPict( filter_t *p_filter, picture_t *p_pic )
     int i_plane;
     int i_src_stride[3], i_dst_stride[3];
 
+    picture_t *p_outpic = filter_NewPicture( p_filter );
+    if( !p_outpic )
+    {
+        picture_Release( p_pic );
+        return NULL;
+    }
+
     /* Lock to prevent issues if pp_mode is changed */
     vlc_mutex_lock( &p_sys->lock );
     if( !p_sys->pp_mode )
     {
         vlc_mutex_unlock( &p_sys->lock );
-        return p_pic;
+        picture_CopyPixels( p_outpic, p_pic );
+        return CopyInfoAndRelease( p_outpic, p_pic );
     }
 
-    picture_t *p_outpic = filter_NewPicture( p_filter );
-    if( !p_outpic )
-    {
-        picture_Release( p_pic );
-        vlc_mutex_unlock( &p_sys->lock );
-        return NULL;
-    }
 
     for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
     {