[vlc-commits] [Git][videolan/vlc][master] 4 commits: vout_subpictures: don't use fully cropped out regions
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Feb 8 16:18:18 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
58dce6bf by Steve Lhomme at 2024-02-08T15:57:54+00:00
vout_subpictures: don't use fully cropped out regions
- - - - -
f654bef3 by Steve Lhomme at 2024-02-08T15:57:54+00:00
vout_subpicture: return early if the scaling result in empty picture
- - - - -
765dd210 by Steve Lhomme at 2024-02-08T15:57:54+00:00
vout_subpicture: use the dst dimension for the scaling output
This is the same value and it's also how the cached picture is tested for size changes.
- - - - -
64ac3880 by Steve Lhomme at 2024-02-08T15:57:54+00:00
vout_subpictures: reuse destination sizes to crop
The region_fmt dimensions are always the destination dimensions at this stage, regardless if there's resizing or not.
- - - - -
1 changed file:
- src/video_output/vout_subpictures.c
Changes:
=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -936,6 +936,13 @@ static subpicture_region_t *SpuRenderRegion(spu_t *spu,
x_offset = spu_scale_w(restrained.x, restrained.scale);
y_offset = spu_scale_h(restrained.y, restrained.scale);
+ const unsigned dst_width = spu_scale_w(region->fmt.i_visible_width, scale_size);
+ const unsigned dst_height = spu_scale_h(region->fmt.i_visible_height, scale_size);
+
+ if (unlikely(dst_width == 0 || dst_height == 0))
+ return NULL;
+
+
/* */
if (force_palette) {
video_palette_t *old_palette = region->fmt.p_palette;
@@ -995,9 +1002,6 @@ static subpicture_region_t *SpuRenderRegion(spu_t *spu,
/* Scale from rendered size to destination size */
if (scale_size.w != SCALE_UNIT || scale_size.h != SCALE_UNIT || convert_chroma)
{
- const unsigned dst_width = spu_scale_w(region->fmt.i_visible_width, scale_size);
- const unsigned dst_height = spu_scale_h(region->fmt.i_visible_height, scale_size);
-
/* Destroy the cache if unusable */
if (region->p_private) {
subpicture_region_private_t *private = region->p_private;
@@ -1022,7 +1026,7 @@ static subpicture_region_t *SpuRenderRegion(spu_t *spu,
}
/* Scale if needed into cache */
- if (!region->p_private && dst_width > 0 && dst_height > 0) {
+ if (!region->p_private) {
filter_t *scale = sys->scale;
picture_t *picture = region->p_picture;
@@ -1071,10 +1075,8 @@ static subpicture_region_t *SpuRenderRegion(spu_t *spu,
scale->fmt_out.video.i_width = dst_width;
scale->fmt_out.video.i_height = dst_height;
- scale->fmt_out.video.i_visible_width =
- spu_scale_w(region->fmt.i_visible_width, scale_size);
- scale->fmt_out.video.i_visible_height =
- spu_scale_h(region->fmt.i_visible_height, scale_size);
+ scale->fmt_out.video.i_visible_width = dst_width;
+ scale->fmt_out.video.i_visible_height = dst_height;
picture = scale->ops->filter_video(scale, picture);
assert(picture == NULL || !picture_HasChainedPics(picture)); // no chaining
@@ -1113,8 +1115,8 @@ static subpicture_region_t *SpuRenderRegion(spu_t *spu,
{
crop_x = x_offset;
crop_y = y_offset;
- crop_width = region_fmt.i_visible_width;
- crop_height = region_fmt.i_visible_height;
+ crop_width = dst_width;
+ crop_height = dst_height;
}
if(region->i_max_width && spu_scale_w(region->i_max_width, scale_size) < crop_width)
@@ -1125,29 +1127,26 @@ static subpicture_region_t *SpuRenderRegion(spu_t *spu,
/* Find the intersection */
if (crop_x + crop_width <= x_offset ||
- x_offset + (int)region_fmt.i_visible_width < crop_x ||
+ x_offset + (int)dst_width < crop_x ||
crop_y + crop_height <= y_offset ||
- y_offset + (int)region_fmt.i_visible_height < crop_y) {
+ y_offset + (int)dst_height < crop_y) {
/* No intersection */
- region_fmt.i_visible_width =
- region_fmt.i_visible_height = 0;
- } else {
- int x, y, x_end, y_end;
- x = __MAX(crop_x, x_offset);
- y = __MAX(crop_y, y_offset);
- x_end = __MIN(crop_x + crop_width,
- x_offset + (int)region_fmt.i_visible_width);
- y_end = __MIN(crop_y + crop_height,
- y_offset + (int)region_fmt.i_visible_height);
-
- region_fmt.i_x_offset = x - x_offset;
- region_fmt.i_y_offset = y - y_offset;
- region_fmt.i_visible_width = x_end - x;
- region_fmt.i_visible_height = y_end - y;
-
- x_offset = __MAX(x, 0);
- y_offset = __MAX(y, 0);
+ return NULL;
}
+
+ int x, y, x_end, y_end;
+ x = __MAX(crop_x, x_offset);
+ y = __MAX(crop_y, y_offset);
+ x_end = __MIN(crop_x + crop_width, x_offset + (int)dst_width);
+ y_end = __MIN(crop_y + crop_height, y_offset + (int)dst_height);
+
+ region_fmt.i_x_offset = x - x_offset;
+ region_fmt.i_y_offset = y - y_offset;
+ region_fmt.i_visible_width = x_end - x;
+ region_fmt.i_visible_height = y_end - y;
+
+ x_offset = __MAX(x, 0);
+ y_offset = __MAX(y, 0);
}
subpicture_region_t *dst = subpicture_region_ForPicture(®ion_fmt, region_picture);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7f923bd8ea88ad2964bc9afa1056e5dcee00a611...64ac3880b935c2a9720e613cdd77db98bc4e690d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7f923bd8ea88ad2964bc9afa1056e5dcee00a611...64ac3880b935c2a9720e613cdd77db98bc4e690d
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