[vlc-commits] vout: spu: refactor region colorspace fixup

Francois Cartegnie git at videolan.org
Thu Aug 8 09:50:08 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jul 25 15:58:33 2019 +0200| [5effd313d3a6f8bbefa3dd8c5901e5225eac3421] | committer: Francois Cartegnie

vout: spu: refactor region colorspace fixup

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5effd313d3a6f8bbefa3dd8c5901e5225eac3421
---

 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 ... */



More information about the vlc-commits mailing list