[vlc-devel] commit: Correctly test for picture compatibility with avcodec direct rendering requirements . (Laurent Aimar )
git version control
git at videolan.org
Fri Feb 26 21:00:30 CET 2010
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Feb 26 20:26:45 2010 +0100| [c935a03f2f5bddaef3ff4b3ea06684607338df2d] | committer: Laurent Aimar
Correctly test for picture compatibility with avcodec direct rendering requirements.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c935a03f2f5bddaef3ff4b3ea06684607338df2d
---
modules/codec/avcodec/video.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index da15db8..2fda800 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -933,9 +933,6 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
avcodec_align_dimensions( p_sys->p_context, &i_width, &i_height );
if( GetVlcChroma( &p_dec->fmt_out.video, p_context->pix_fmt ) != VLC_SUCCESS ||
- p_sys->p_context->width % 16 || p_sys->p_context->height % 16 ||
- /* We only pad picture up to 16 */
- PAD(p_sys->p_context->width,16) < i_width || PAD(p_sys->p_context->height,16) < i_height ||
p_context->pix_fmt == PIX_FMT_PAL8 )
return avcodec_default_get_buffer( p_context, p_ff_pic );
@@ -945,6 +942,23 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
p_pic = ffmpeg_NewPictBuf( p_dec, p_sys->p_context );
if( !p_pic )
return avcodec_default_get_buffer( p_context, p_ff_pic );
+ bool b_compatible = true;
+ if( p_pic->p[0].i_pitch / p_pic->p[0].i_pixel_pitch < i_width ||
+ p_pic->p[0].i_lines < i_height )
+ b_compatible = false;
+ for( int i = 0; i < p_pic->i_planes && b_compatible; i++ )
+ {
+ const unsigned i_align = i == 0 ? 16 : 8;
+ if( p_pic->p[i].i_pitch % i_align )
+ b_compatible = false;
+ if( (intptr_t)p_pic->p[i].p_pixels % i_align )
+ b_compatible = false;
+ }
+ if( !b_compatible )
+ {
+ decoder_DeletePicture( p_dec, p_pic );
+ return avcodec_default_get_buffer( p_context, p_ff_pic );
+ }
p_sys->p_context->draw_horiz_band = NULL;
More information about the vlc-devel
mailing list