[x264-devel] commit: Filtering system-related fixes (Steven Walters )

git at videolan.org git at videolan.org
Thu Jul 29 08:17:06 CEST 2010


x264 | branch: stable | Steven Walters <kemuri9 at gmail.com> | Sun Jul 25 19:45:27 2010 -0400| [d2cfa9681c293066e96a3f1c5fd83f023839677b] | committer: Jason Garrett-Glaser 

Filtering system-related fixes
Fix configure to check for outdated libavutil in resize filter support.
Do not print an explicit error message in ffms when requesting a frame beyond the number of frames in the source.
Mention in --*help that filtering options can be specified as name=value.
Fix the shadowing warning in the resize filter on posix systems.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=d2cfa9681c293066e96a3f1c5fd83f023839677b
---

 configure              |    9 +++++++--
 filters/video/resize.c |    4 ++--
 input/ffms.c           |    7 +++++--
 x264.c                 |    1 +
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index aeb215a..565eb98 100755
--- a/configure
+++ b/configure
@@ -549,8 +549,13 @@ if [ "$swscale" = "auto" ] ; then
     error="swscale must be at least version 0.9.0"
     if cc_check "libswscale/swscale.h" "$SWSCALE_CFLAGS $SWSCALE_LIBS" "sws_getContext(0,0,0,0,0,0,0,0,0,0);" ; then
         if cpp_check "libswscale/swscale.h" "$SWSCALE_CFLAGS" "LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(0,9,0)" "$error"; then
-            define HAVE_SWSCALE
-            swscale="yes"
+            # we use colorspaces that were defined in libavutil r19775
+            if cc_check "libavutil/pixfmt.h" "$SWSCALE_CFLAGS" "enum PixelFormat pixfmt = PIX_FMT_YUV422P16LE;" ; then
+                define HAVE_SWSCALE
+                swscale="yes"
+            else
+                echo "Warning: libavutil is too old, update to ffmpeg r19775+"
+            fi
         else
             echo "Warning: ${error}"
         fi
diff --git a/filters/video/resize.c b/filters/video/resize.c
index 3a2faa4..60c6693 100644
--- a/filters/video/resize.c
+++ b/filters/video/resize.c
@@ -178,10 +178,10 @@ static int pick_closest_supported_csp( int csp )
     }
 }
 
-static int round_dbl( double val, int precision, int truncate )
+static int round_dbl( double val, int precision, int b_truncate )
 {
     int ret = (int)(val / precision) * precision;
-    if( !truncate && (val - ret) >= (precision/2) ) // use the remainder if we're not truncating it
+    if( !b_truncate && (val - ret) >= (precision/2) ) // use the remainder if we're not truncating it
         ret += precision;
     return ret;
 }
diff --git a/input/ffms.c b/input/ffms.c
index 84118d5..0472cc6 100644
--- a/input/ffms.c
+++ b/input/ffms.c
@@ -41,6 +41,7 @@ typedef struct
     FFMS_Track *track;
     int reduce_pts;
     int vfr_input;
+    int num_frames;
 } ffms_hnd_t;
 
 static int FFMS_CC update_progress( int64_t current, int64_t total, void *private )
@@ -92,7 +93,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
 
     FFMS_DestroyIndex( idx );
     const FFMS_VideoProperties *videop = FFMS_GetVideoProperties( h->video_source );
-    info->num_frames   = videop->NumFrames;
+    info->num_frames   = h->num_frames = videop->NumFrames;
     info->sar_height   = videop->SARDen;
     info->sar_width    = videop->SARNum;
     info->fps_den      = videop->FPSDenominator;
@@ -144,10 +145,12 @@ static int picture_alloc( cli_pic_t *pic, int csp, int width, int height )
 static int read_frame( cli_pic_t *pic, hnd_t handle, int i_frame )
 {
     ffms_hnd_t *h = handle;
+    if( i_frame >= h->num_frames )
+        return -1;
     FFMS_ErrorInfo e;
     e.BufferSize = 0;
     const FFMS_Frame *frame = FFMS_GetFrame( h->video_source, i_frame, &e );
-    FAIL_IF_ERROR( !frame, "could not read frame %d\n", i_frame )
+    FAIL_IF_ERROR( !frame, "could not read frame %d \n", i_frame )
 
     memcpy( pic->img.stride, frame->Linesize, sizeof(pic->img.stride) );
     memcpy( pic->img.plane, frame->Data, sizeof(pic->img.plane) );
diff --git a/x264.c b/x264.c
index 2f4263e..530ad4a 100644
--- a/x264.c
+++ b/x264.c
@@ -697,6 +697,7 @@ static void Help( x264_param_t *defaults, int longhelp )
     H0( "\n" );
     H0( "Filtering:\n" );
     H0( "\n" );
+    H0( "      Filter options may be specified in the name=value format\n" );
     H0( "--vf, --video-filter <filter0>/<filter1>/... Apply video filtering to the input file\n" );
     H0( "      Available filters:\n" );
     x264_register_vid_filters();



More information about the x264-devel mailing list