[vlc-devel] [PATCH 2/3] vout: spu: refactor region colorspace fixup

Francois Cartegnie fcvlcdev at free.fr
Wed Aug 7 10:47:12 CEST 2019


---
 src/video_output/vout_subpictures.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 53daf00827..626bb38039 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -293,6 +293,19 @@ static filter_t *SpuRenderCreateAndLoadScale(vlc_object_t *object,
     return scale;
 }
 
+static void SpuFixupRegionColospace(subpicture_region_t *region)
+{
+    // assume rendered text is in sRGB if nothing is set
+    if (region->fmt.transfer == TRANSFER_FUNC_UNDEF)
+        region->fmt.transfer = TRANSFER_FUNC_SRGB;
+    if (region->fmt.primaries == COLOR_PRIMARIES_UNDEF)
+        region->fmt.primaries = COLOR_PRIMARIES_SRGB;
+    if (region->fmt.space == COLOR_SPACE_UNDEF)
+        region->fmt.space = COLOR_SPACE_SRGB;
+    if (region->fmt.color_range == COLOR_RANGE_UNDEF)
+        region->fmt.color_range = COLOR_RANGE_FULL;
+}
+
 static void SpuRenderText(spu_t *spu,
                           subpicture_region_t *region,
                           const vlc_fourcc_t *chroma_list)
@@ -764,16 +777,7 @@ static void SpuRenderRegion(spu_t *spu,
 
     /* Render text region */
     if (region->fmt.i_chroma == VLC_CODEC_TEXT) {
-        // assume rendered text is in sRGB if nothing is set
-        if (region->fmt.transfer == TRANSFER_FUNC_UNDEF)
-            region->fmt.transfer = TRANSFER_FUNC_SRGB;
-        if (region->fmt.primaries == COLOR_PRIMARIES_UNDEF)
-            region->fmt.primaries = COLOR_PRIMARIES_SRGB;
-        if (region->fmt.space == COLOR_SPACE_UNDEF)
-            region->fmt.space = COLOR_SPACE_SRGB;
-        if (region->fmt.color_range == COLOR_RANGE_UNDEF)
-            region->fmt.color_range = COLOR_RANGE_FULL;
-
+        SpuFixupRegionColospace(region);
         SpuRenderText(spu, region, chroma_list);
 
         /* Check if the rendering has failed ... */
-- 
2.21.0



More information about the vlc-devel mailing list