[vlc-commits] [Git][videolan/vlc][master] 3 commits: Revert "subpictures: scale with the least cropping"
François Cartegnie (@fcartegnie)
gitlab at videolan.org
Thu Mar 7 14:33:19 UTC 2024
François Cartegnie pushed to branch master at VideoLAN / VLC
Commits:
d7a2ed3b by Steve Lhomme at 2024-03-07T13:56:54+00:00
Revert "subpictures: scale with the least cropping"
This reverts commit 372e62c00c50884629ef3c63c1d3b9ed490c9b02.
This commit broke SPU positioning for this DVD:
https://streams.videolan.org/samples/MPEG-VOB/menus%20DVD/Avcd%2023032b
- - - - -
a7c7febf by Steve Lhomme at 2024-03-07T13:56:54+00:00
vout_subpictures: only edit area fitting if it was modified
Otherwise we carry over some scaling rounding in the original region, even if nothing was changed.
- - - - -
3b4e6314 by Steve Lhomme at 2024-03-07T13:56:54+00:00
vout_subpictures: break when we match the region chroma
- - - - -
1 changed file:
- src/video_output/vout_subpictures.c
Changes:
=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -570,20 +570,34 @@ static void SpuAreaFixOverlap(spu_area_t *dst,
static void SpuAreaFitInside(spu_area_t *area, const spu_area_t *boundary)
{
spu_area_t a = spu_area_scaled(*area);
+ bool modified = false;
const int i_error_x = (a.x + a.width) - boundary->width;
if (i_error_x > 0)
+ {
a.x -= i_error_x;
+ modified = true;
+ }
if (a.x < 0)
+ {
a.x = 0;
+ modified = true;
+ }
const int i_error_y = (a.y + a.height) - boundary->height;
if (i_error_y > 0)
+ {
a.y -= i_error_y;
+ modified = true;
+ }
if (a.y < 0)
+ {
a.y = 0;
+ modified = true;
+ }
- *area = spu_area_unscaled(a, area->scale);
+ if (modified)
+ *area = spu_area_unscaled(a, area->scale);
}
/**
@@ -1003,7 +1017,10 @@ static subpicture_region_t *SpuRenderRegion(spu_t *spu,
bool convert_chroma = true;
for (int i = 0; chroma_list[i] && convert_chroma; i++) {
if (region->p_picture->format.i_chroma == chroma_list[i])
+ {
convert_chroma = false;
+ break;
+ }
}
/* Scale from rendered size to destination size */
@@ -1294,25 +1311,14 @@ static vlc_render_subpicture *SpuRenderSubpictures(spu_t *spu,
i_sar_num, i_sar_den, 65536);
}
- /* Compute scaling from original size to destination size */
- // ensures that the heights match, the width being cropped.
- spu_scale_t scale_h = spu_scale_createq((uint64_t)fmt_dst->i_visible_height * fmt_dst->i_sar_den * region_sar.num,
- (uint64_t)i_original_height * fmt_dst->i_sar_num * region_sar.den,
- fmt_dst->i_visible_height,
- i_original_height);
-
- // ensures that the widths match, the height being cropped.
- spu_scale_t scale_w = spu_scale_createq((uint64_t)fmt_dst->i_visible_width * fmt_dst->i_sar_den * region_sar.num,
- (uint64_t)i_original_width * fmt_dst->i_sar_num * region_sar.den,
- fmt_dst->i_visible_width,
- i_original_width);
-
- // take the scale that will crop the least
- spu_scale_t scale;
- if (scale_h.h * scale_h.w > scale_w.h * scale_w.w)
- scale = scale_w;
- else
- scale = scale_h;
+ /* Compute scaling from original size to destination size
+ * FIXME The current scaling ensure that the heights match, the width being
+ * cropped.
+ */
+ spu_scale_t scale = spu_scale_createq((uint64_t)fmt_dst->i_visible_height * fmt_dst->i_sar_den * region_sar.num,
+ (uint64_t)i_original_height * fmt_dst->i_sar_num * region_sar.den,
+ fmt_dst->i_visible_height,
+ i_original_height);
/* Check scale validity */
assert(scale.w != 0 && scale.h != 0);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/37eb94ecf7dd8d6818c482b974ad59bd35a040a1...3b4e631487ddb76468b918b704eff81501b3e848
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/37eb94ecf7dd8d6818c482b974ad59bd35a040a1...3b4e631487ddb76468b918b704eff81501b3e848
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