[vlc-devel] [PATCH] display: avoid using memset in vout_display_PlacePicture()

Rémi Denis-Courmont remi at remlab.net
Fri Aug 21 13:46:36 CEST 2020


Hi,

First, that's a rather dubious optimization. Compilers know how to inline a fixed-size memset(), and you end up with one more branch with this patch.

It doesn't make the code any clearer either.

Le 21 août 2020 10:19:24 GMT+02:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>It's only needed when the display has no dimension yet. The rest of the
>time
>we fill all (4) fields of the vout_display_place_t structure.
>---
> src/video_output/display.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/src/video_output/display.c b/src/video_output/display.c
>index 8fd444168d0..84284e8f41d 100644
>--- a/src/video_output/display.c
>+++ b/src/video_output/display.c
>@@ -150,9 +150,11 @@ void
>vout_display_PlacePicture(vout_display_place_t *place,
> assert(cfg->window_props.width == 0 && cfg->window_props.height == 0);
> 
>     /* */
>-    memset(place, 0, sizeof(*place));
>     if (cfg->display.width == 0 || cfg->display.height == 0)
>+    {
>+        *place = (vout_display_place_t) { 0 };
>         return;
>+    }
> 
>     /* */
>     unsigned display_width;
>-- 
>2.26.2
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200821/2784c988/attachment.html>


More information about the vlc-devel mailing list