[vlc-commits] [Git][videolan/vlc][master] 9 commits: vout/opengl: do vertical flip after picture placement

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Apr 12 18:03:43 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
ba322be2 by Steve Lhomme at 2024-04-12T17:31:19+00:00
vout/opengl: do vertical flip after picture placement

Vertically swapping the position of the video keeps the place "height".
The vertical position use the inverted position of the bottom position
rather than the top position of the video.

- - - - -
69c8925e by Steve Lhomme at 2024-04-12T17:31:19+00:00
libplacebo: simplify placement for 199+

...by grouping the need_vflip calls in a code block.

- - - - -
c35a90d4 by Steve Lhomme at 2024-04-12T17:31:19+00:00
libplacebo: assume the framebuffer matches the display size

The module always does the swapchain resizing when the core requests it, so the core
is aware of the proper swapchain dimensions.

- - - - -
c69fb3d9 by Steve Lhomme at 2024-04-12T17:31:19+00:00
libplacebo: do the vertical flipping locally in flipped output

Rather than position to bottom side, we position the top one.

- - - - -
f2e5a46b by Steve Lhomme at 2024-04-12T17:31:19+00:00
libplacebo: factorize a vout_display_PlacePicture() call

- - - - -
3f6a8936 by Steve Lhomme at 2024-04-12T17:31:19+00:00
android/display: remove unused FlipVerticalAlign()

Since 9c35043b2d7eceed2ba391d0048267520d6dafe0.

- - - - -
272514cf by Steve Lhomme at 2024-04-12T17:31:19+00:00
glwin32: do vertical flip after picture placement

Vertically swapping the position of the video keeps the place "height".
The vertical position use the inverted position of the bottom position
rather than the top position of the video.

- - - - -
9a321d7c by Steve Lhomme at 2024-04-12T17:31:19+00:00
caopengllayer: do vertical flip after picture placement

Vertically swapping the position of the video keeps the place "height".
The vertical position use the inverted position of the bottom position
rather than the top position of the video.

- - - - -
01238151 by Steve Lhomme at 2024-04-12T17:31:19+00:00
macosx: do vertical flip after picture placement

Vertically swapping the position of the video keeps the place "height".
The vertical position use the inverted position of the bottom position
rather than the top position of the video.

- - - - -


6 changed files:

- modules/video_output/android/display.c
- modules/video_output/caopengllayer.m
- modules/video_output/libplacebo/display.c
- modules/video_output/macosx.m
- modules/video_output/opengl/display.c
- modules/video_output/win32/glwin32.c


Changes:

=====================================
modules/video_output/android/display.c
=====================================
@@ -67,15 +67,6 @@ struct sys
     struct subpicture sub;
 };
 
-static void FlipVerticalAlign(struct vout_display_placement *dp)
-{
-    /* Reverse vertical alignment as the GL tex are Y inverted */
-    if (dp->align.vertical == VLC_VIDEO_ALIGN_TOP)
-        dp->align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
-    else if (dp->align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
-        dp->align.vertical = VLC_VIDEO_ALIGN_TOP;
-}
-
 static int subpicture_Control(vout_display_t *vd, int query)
 {
     struct sys *sys = vd->sys;


=====================================
modules/video_output/caopengllayer.m
=====================================
@@ -411,12 +411,7 @@ static int Open (vout_display_t *vd,
         glsys->cgl_prev = NULL;
 
         dispatch_sync(dispatch_get_main_queue(), ^{
-            // Reverse vertical alignment as the GL tex are Y inverted
            sys->cfg = *vd->cfg;
-           if (sys->cfg.display.align.vertical == VLC_VIDEO_ALIGN_TOP)
-               sys->cfg.display.align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
-           else if (sys->cfg.display.align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
-               sys->cfg.display.align.vertical = VLC_VIDEO_ALIGN_TOP;
 
             // Create video view
             sys->videoView = [[VLCVideoLayerView alloc] initWithVoutDisplay:vd];
@@ -435,7 +430,9 @@ static int Open (vout_display_t *vd,
                 sys->videoLayer = nil;
             }
 
-            vout_display_PlacePicture(&sys->place, vd->source, &sys->cfg.display);
+            vout_display_PlacePicture(&sys->place, vd->source, &vd->cfg->display);
+            // Reverse vertical alignment as the GL tex are Y inverted
+            sys->place.y = vd->cfg->display.height - (sys->place.y + sys->place.height);
         });
 
         if (sys->videoView == nil) {
@@ -568,14 +565,11 @@ static int Control (vout_display_t *vd, int query)
                 cfg.display.width = sys->cfg.display.width;
                 cfg.display.height = sys->cfg.display.height;
 
-                // Reverse vertical alignment as the GL tex are Y inverted
-                if (cfg.display.align.vertical == VLC_VIDEO_ALIGN_TOP)
-                    cfg.display.align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
-                else if (cfg.display.align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
-                    cfg.display.align.vertical = VLC_VIDEO_ALIGN_TOP;
                 sys->cfg = cfg;
 
                 vout_display_PlacePicture(&sys->place, vd->source, &cfg.display);
+                // Reverse vertical alignment as the GL tex are Y inverted
+                sys->place.y = cfg.display.height - (sys->place.y + sys->place.height);
             }
 
             // Note!


=====================================
modules/video_output/libplacebo/display.c
=====================================
@@ -297,24 +297,10 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
 
     // Set the target crop dynamically based on the swapchain flip state
     vout_display_place_t place;
-    struct vout_display_placement dp = vd->cfg->display;
-    dp.width = frame.fbo->params.w;
-    dp.height = frame.fbo->params.h;
-    if (need_vflip) {
-        switch (dp.align.vertical) {
-        case VLC_VIDEO_ALIGN_TOP:
-            dp.align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
-            break;
-        case VLC_VIDEO_ALIGN_BOTTOM:
-            dp.align.vertical = VLC_VIDEO_ALIGN_TOP;
-            break;
-        default:
-            break;
-        }
-    }
-    vout_display_PlacePicture(&place, vd->fmt, &dp);
-    if (need_vflip) {
-        place.y = frame.fbo->params.h - place.y;
+    vout_display_PlacePicture(&place, vd->fmt, &vd->cfg->display);
+    if (need_vflip)
+    {
+        place.y = place.height + place.y;
         place.height = -place.height;
     }
 


=====================================
modules/video_output/macosx.m
=====================================
@@ -333,6 +333,8 @@ static void UpdatePlace (vout_display_t *vd, const vout_display_cfg_t *cfg)
     vout_display_place_t place;
     /* We never receive resize from the core, so provide the size ourselves */
     vout_display_PlacePicture(&place, vd->source, &cfg->display);
+    /* Reverse vertical alignment as the GL tex are Y inverted */
+    place.y = cfg->display.height - (place.y + place.height);
     sys->place = place;
 }
 
@@ -358,11 +360,6 @@ static int Control (vout_display_t *vd, int query)
                 @synchronized(sys->glView) {
                     vout_display_cfg_t cfg;
                     cfg = *vd->cfg;
-                    /* Reverse vertical alignment as the GL tex are Y inverted */
-                    if (cfg.display.align.vertical == VLC_VIDEO_ALIGN_TOP)
-                        cfg.display.align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
-                    else if (cfg.display.align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
-                        cfg.display.align.vertical = VLC_VIDEO_ALIGN_TOP;
                     cfg.display.width = sys->cfg.display.width;
                     cfg.display.height = sys->cfg.display.height;
                     sys->cfg = cfg;
@@ -583,7 +580,6 @@ static void OpenglSwap (vlc_gl_t *gl)
 
     /* on HiDPI displays, the point bounds don't equal the actual pixel based bounds */
     NSRect bounds = [self convertRectToBacking:[self bounds]];
-    vout_display_place_t place;
 
     @synchronized(self) {
         if (vd == NULL) return;


=====================================
modules/video_output/opengl/display.c
=====================================
@@ -136,16 +136,6 @@ static const struct vlc_display_operations ops = {
     .update_format = UpdateFormat,
 };
 
-static void
-FlipVerticalAlign(struct vout_display_placement *dp)
-{
-    /* Reverse vertical alignment as the GL tex are Y inverted */
-    if (dp->align.vertical == VLC_VIDEO_ALIGN_TOP)
-        dp->align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
-    else if (dp->align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
-        dp->align.vertical = VLC_VIDEO_ALIGN_TOP;
-}
-
 static void PlacePicture(vout_display_t *vd, vout_display_place_t *place,
                          struct vout_display_placement dp)
 {
@@ -166,9 +156,8 @@ static void PlacePicture(vout_display_t *vd, vout_display_place_t *place,
         dp.height = width;
     }
 
-    FlipVerticalAlign(&dp);
-
     vout_display_PlacePicture(place, &source, &dp);
+    place->y = dp.height - (place->y + place->height);
 
     if (ORIENT_IS_SWAP(transform))
     {


=====================================
modules/video_output/win32/glwin32.c
=====================================
@@ -245,16 +245,11 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
         return;
     if (sys->area.place_changed)
     {
-        struct vout_display_placement place_cfg = vd->cfg->display;
         vout_display_place_t place;
 
+        vout_display_PlacePicture(&place, vd->source, &vd->cfg->display);
         /* Reverse vertical alignment as the GL tex are Y inverted */
-        if (place_cfg.align.vertical == VLC_VIDEO_ALIGN_TOP)
-            place_cfg.align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
-        else if (place_cfg.align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
-            place_cfg.align.vertical = VLC_VIDEO_ALIGN_TOP;
-
-        vout_display_PlacePicture(&place, vd->source, &place_cfg);
+        place.y = vd->cfg->display.height - (place.y + place.height);
 
         vlc_gl_Resize (sys->gl, place.width, place.height);
         vout_display_opengl_SetOutputSize(sys->vgl, vd->cfg->display.width, vd->cfg->display.height);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/aa81847cc8569ce51b4393af474659954e4333f9...012381510bff2bc79bd65014500d665dc0a690aa

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/aa81847cc8569ce51b4393af474659954e4333f9...012381510bff2bc79bd65014500d665dc0a690aa
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list