[vlc-commits] picture: detect odd chroma early
Steve Lhomme
git at videolan.org
Wed Sep 19 12:15:06 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Sep 17 14:24:38 2018 +0200| [32c838a2c9be0f0d4ac82b6b4b6baafdff1ac407] | committer: Steve Lhomme
picture: detect odd chroma early
No need to prepare a picture if the chroma is bogus.
And mark the unlikeliness of the chroma being bogus.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=32c838a2c9be0f0d4ac82b6b4b6baafdff1ac407
---
src/misc/picture.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/misc/picture.c b/src/misc/picture.c
index 63fefa4f96..f8059a603e 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -92,6 +92,11 @@ static int LCM( int a, int b )
int picture_Setup( picture_t *p_picture, const video_format_t *restrict fmt )
{
+ const vlc_chroma_description_t *p_dsc =
+ vlc_fourcc_GetChromaDescription( fmt->i_chroma );
+ if( unlikely(!p_dsc) )
+ return VLC_EGENERIC;
+
/* Store default values */
p_picture->i_planes = 0;
for( unsigned i = 0; i < VOUT_MAX_PLANES; i++ )
@@ -112,11 +117,6 @@ int picture_Setup( picture_t *p_picture, const video_format_t *restrict fmt )
fmt->i_visible_height > 0 && fmt->i_y_offset + fmt->i_visible_height <= fmt->i_height )
video_format_CopyCrop( &p_picture->format, fmt );
- const vlc_chroma_description_t *p_dsc =
- vlc_fourcc_GetChromaDescription( p_picture->format.i_chroma );
- if( !p_dsc )
- return VLC_EGENERIC;
-
/* We want V (width/height) to respect:
(V * p_dsc->p[i].w.i_num) % p_dsc->p[i].w.i_den == 0
(V * p_dsc->p[i].w.i_num/p_dsc->p[i].w.i_den * p_dsc->i_pixel_size) % 16 == 0
More information about the vlc-commits
mailing list