[vlc-commits] i420_yuy2: refactor intialization
Alexandre Janniaux
git at videolan.org
Thu Oct 8 10:28:14 CEST 2020
vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Thu Sep 3 16:15:58 2020 +0200| [639f7e60d6432a37d6ebae3bc0fc7af7ad5ec9fe] | committer: Steve Lhomme
i420_yuy2: refactor intialization
Avoid switch for one case and use VLC_EGENERIC/VLC_SUCCESS when
suitable.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=639f7e60d6432a37d6ebae3bc0fc7af7ad5ec9fe
---
modules/video_chroma/i420_yuy2.c | 55 ++++++++++++++++++----------------------
1 file changed, 25 insertions(+), 30 deletions(-)
diff --git a/modules/video_chroma/i420_yuy2.c b/modules/video_chroma/i420_yuy2.c
index d7f23c6ea8..b18fea3c31 100644
--- a/modules/video_chroma/i420_yuy2.c
+++ b/modules/video_chroma/i420_yuy2.c
@@ -118,56 +118,51 @@ static int Activate( vlc_object_t *p_this )
if( !vlc_CPU_capable() )
return VLC_EGENERIC;
+
if( (p_filter->fmt_in.video.i_x_offset + p_filter->fmt_in.video.i_visible_width) & 1
|| (p_filter->fmt_in.video.i_y_offset + p_filter->fmt_in.video.i_visible_height) & 1 )
{
- return -1;
+ return VLC_EGENERIC;
}
if( p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width
|| p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
|| p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation )
- return -1;
+ return VLC_EGENERIC;
+
+ // VLC_CODEC_YV12: FIXME invert U and V in the filters :)
+ if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420)
+ return VLC_EGENERIC;
- switch( p_filter->fmt_in.video.i_chroma )
+ switch( p_filter->fmt_out.video.i_chroma )
{
-// case VLC_CODEC_YV12: FIXME invert U and V in the filters :)
- case VLC_CODEC_I420:
- switch( p_filter->fmt_out.video.i_chroma )
- {
- case VLC_CODEC_YUYV:
- p_filter->pf_video_filter = I420_YUY2_Filter;
- break;
+ case VLC_CODEC_YUYV:
+ p_filter->pf_video_filter = I420_YUY2_Filter;
+ break;
- case VLC_CODEC_YVYU:
- p_filter->pf_video_filter = I420_YVYU_Filter;
- break;
+ case VLC_CODEC_YVYU:
+ p_filter->pf_video_filter = I420_YVYU_Filter;
+ break;
- case VLC_CODEC_UYVY:
- p_filter->pf_video_filter = I420_UYVY_Filter;
- break;
+ case VLC_CODEC_UYVY:
+ p_filter->pf_video_filter = I420_UYVY_Filter;
+ break;
#if !defined (MODULE_NAME_IS_i420_yuy2_altivec)
- case VLC_FOURCC('I','U','Y','V'):
- p_filter->pf_video_filter = I420_IUYV_Filter;
- break;
+ case VLC_FOURCC('I','U','Y','V'):
+ p_filter->pf_video_filter = I420_IUYV_Filter;
+ break;
#endif
#if defined (MODULE_NAME_IS_i420_yuy2)
- case VLC_CODEC_Y211:
- p_filter->pf_video_filter = I420_Y211_Filter;
- break;
-#endif
-
- default:
- return -1;
- }
+ case VLC_CODEC_Y211:
+ p_filter->pf_video_filter = I420_Y211_Filter;
break;
-
+#endif
default:
- return -1;
+ return VLC_EGENERIC;
}
- return 0;
+ return VLC_SUCCESS;
}
#if 0
More information about the vlc-commits
mailing list