]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/scale.c
- Build libvlc from src/ rather than top
[vlc] / modules / video_filter / scale.c
index d2c3127998a4e2d96475a3b711f8183720989c04..fde9f41689fe615649e0431f705af1fc53ecffbd 100644 (file)
@@ -19,7 +19,7 @@
  *
  * 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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -108,6 +108,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     picture_t *p_pic_dst;
     int i_plane, i, j, k, l;
 
+    if( !p_pic ) return NULL;
+    
     /* Request output picture */
     p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
     if( !p_pic_dst )
@@ -131,12 +133,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
                   p_filter->fmt_out.video.i_height / 2 ) /
                 p_filter->fmt_out.video.i_height;
 
+            l = __MIN( (int)p_filter->fmt_in.video.i_height - 1, l );
+
             for( j = 0; j < p_pic_dst->p[i_plane].i_visible_pitch; j++ )
             {
                 k = ( p_filter->fmt_in.video.i_width * j +
                       p_filter->fmt_out.video.i_width / 2 ) /
                     p_filter->fmt_out.video.i_width;
 
+                k = __MIN( (int)p_filter->fmt_in.video.i_width - 1, k );
+
                 p_dst[i * i_dst_pitch + j] = p_src[l * i_src_pitch + k];
             }
         }