[vlc-commits] [Git][videolan/vlc][master] 2 commits: vout: move SPU rendering in a function
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Aug 18 06:32:09 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
19f228ab by Steve Lhomme at 2023-08-18T06:09:52+00:00
vout: move SPU rendering in a function
No functional changes.
- - - - -
2bc9decf by Steve Lhomme at 2023-08-18T06:09:52+00:00
vout: create the subpicture to render before just blending it
Or just before returning the subpicture to the GPU for rendering.
- - - - -
1 changed file:
- src/video_output/video_output.c
Changes:
=====================================
src/video_output/video_output.c
=====================================
@@ -1093,6 +1093,21 @@ static picture_t *FilterPictureInteractive(vout_thread_sys_t *sys)
return filtered;
}
+static subpicture_t *RenderSPUs(vout_thread_sys_t *sys,
+ const vlc_fourcc_t *subpicture_chromas,
+ const video_format_t *spu_frame,
+ vlc_tick_t system_now, vlc_tick_t render_subtitle_date,
+ bool ignore_osd)
+{
+ if (unlikely(sys->spu == NULL))
+ return NULL;
+ return spu_Render(sys->spu,
+ subpicture_chromas, spu_frame,
+ sys->display->source,
+ system_now, render_subtitle_date,
+ ignore_osd, sys->display->info.can_scale_spu);
+}
+
static int PrerenderPicture(vout_thread_sys_t *sys, picture_t *filtered,
bool *render_now, picture_t **out_pic,
subpicture_t **out_subpic)
@@ -1140,7 +1155,6 @@ static int PrerenderPicture(vout_thread_sys_t *sys, picture_t *filtered,
// otherwise it's done in the display chroma
const bool blending_before_converter = vd->source->orientation == ORIENT_NORMAL;
- const vlc_fourcc_t *subpicture_chromas;
video_format_t fmt_spu;
if (vd_does_blending) {
vout_display_place_t place;
@@ -1155,7 +1169,6 @@ static int PrerenderPicture(vout_thread_sys_t *sys, picture_t *filtered,
fmt_spu.i_height =
fmt_spu.i_visible_height = place.height;
}
- subpicture_chromas = vd->info.subpicture_chromas;
} else {
if (blending_before_converter) {
fmt_spu = *vd->source;
@@ -1164,7 +1177,6 @@ static int PrerenderPicture(vout_thread_sys_t *sys, picture_t *filtered,
fmt_spu.i_sar_num = vd->cfg->display.sar.num;
fmt_spu.i_sar_den = vd->cfg->display.sar.den;
}
- subpicture_chromas = NULL;
if (sys->spu_blend &&
sys->spu_blend->fmt_out.video.i_chroma != fmt_spu.i_chroma) {
@@ -1181,12 +1193,6 @@ static int PrerenderPicture(vout_thread_sys_t *sys, picture_t *filtered,
/* Get the subpicture to be displayed. */
video_format_t fmt_spu_rot;
video_format_ApplyRotation(&fmt_spu_rot, &fmt_spu);
- subpicture_t *subpic = !sys->spu ? NULL :
- spu_Render(sys->spu,
- subpicture_chromas, &fmt_spu_rot,
- vd->source, system_now,
- render_subtitle_date,
- do_snapshot, vd->info.can_scale_spu);
/*
* Perform rendering
*
@@ -1196,8 +1202,11 @@ static int PrerenderPicture(vout_thread_sys_t *sys, picture_t *filtered,
*/
picture_t *todisplay = filtered;
picture_t *snap_pic = todisplay;
- if (!vd_does_blending && blending_before_converter && subpic) {
- if (sys->spu_blend) {
+ if (!vd_does_blending && blending_before_converter && sys->spu_blend) {
+ subpicture_t *subpic = RenderSPUs(sys, NULL, &fmt_spu_rot,
+ system_now, render_subtitle_date,
+ do_snapshot);
+ if (subpic) {
picture_t *blent = picture_pool_Get(sys->private_pool);
if (blent) {
video_format_CopyCropAr(&blent->format, &filtered->format);
@@ -1219,6 +1228,7 @@ static int PrerenderPicture(vout_thread_sys_t *sys, picture_t *filtered,
picture_Release(blent);
}
}
+ subpicture_Delete(subpic);
}
}
@@ -1238,26 +1248,29 @@ static int PrerenderPicture(vout_thread_sys_t *sys, picture_t *filtered,
todisplay = vout_ConvertForDisplay(vd, todisplay);
if (todisplay == NULL) {
- if (subpic != NULL)
- subpicture_Delete(subpic);
return VLC_EGENERIC;
}
- if (!vd_does_blending && !blending_before_converter && subpic)
+ if (!vd_does_blending && !blending_before_converter && sys->spu_blend)
{
- if (sys->spu_blend)
+ subpicture_t *subpic = RenderSPUs(sys, NULL, &fmt_spu_rot,
+ system_now, render_subtitle_date,
+ do_snapshot);
+ if (subpic)
+ {
picture_BlendSubpicture(todisplay, sys->spu_blend, subpic);
- }
-
- if (subpic && !vd_does_blending)
- {
- /* The subpic will not be used anymore */
- subpicture_Delete(subpic);
- subpic = NULL;
+ subpicture_Delete(subpic);
+ }
}
*out_pic = todisplay;
- *out_subpic = subpic;
+ if (vd_does_blending)
+ *out_subpic = RenderSPUs(sys, vd->info.subpicture_chromas, &fmt_spu_rot,
+ system_now, render_subtitle_date,
+ false);
+ else
+ *out_subpic = NULL;
+
return VLC_SUCCESS;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e67614a99a8f6e75eabcabd2103cee9f46a54245...2bc9decf93b8e6c1e9a52761f502319b1c3209a7
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e67614a99a8f6e75eabcabd2103cee9f46a54245...2bc9decf93b8e6c1e9a52761f502319b1c3209a7
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