[vlc-commits] contrib: ffmpeg: set the alternate transfer function early in H264

Steve Lhomme git at videolan.org
Wed May 29 15:44:12 CEST 2019


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed May 29 15:18:01 2019 +0200| [74d3c61c74393ddb0135b9228f37ab2783562d3f] | committer: Steve Lhomme

contrib: ffmpeg: set the alternate transfer function early in H264

(cherry picked from commit a8c5fc709d08c17ccdcc1867e7a7c801d3d614df)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=74d3c61c74393ddb0135b9228f37ab2783562d3f
---

 ...4_slice-set-the-SEI-parameters-early-on-t.patch | 48 ++++++++++++++++++++++
 contrib/src/ffmpeg/rules.mak                       |  1 +
 2 files changed, 49 insertions(+)

diff --git a/contrib/src/ffmpeg/0001-avcodec-h264_slice-set-the-SEI-parameters-early-on-t.patch b/contrib/src/ffmpeg/0001-avcodec-h264_slice-set-the-SEI-parameters-early-on-t.patch
new file mode 100644
index 0000000000..4010520fd7
--- /dev/null
+++ b/contrib/src/ffmpeg/0001-avcodec-h264_slice-set-the-SEI-parameters-early-on-t.patch
@@ -0,0 +1,48 @@
+From 1b3d0743f592a51a6a65eea2f667c0c2815ff9e2 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 29 May 2019 15:15:49 +0200
+Subject: [PATCH] avcodec/h264_slice: set the SEI parameters early on the
+ AVCodecContext
+
+It's better to do it before the buffers are actually created. At least in VLC
+we currently don't support changing some parameters dynamically easily so we
+don't use the information if it comes after the buffer are created.
+
+Co-authored-by: James Almer <jamrial at gmail.com>
+---
+ libavcodec/h264_slice.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
+index 1c9a270fb6..5ceee107a0 100644
+--- a/libavcodec/h264_slice.c
++++ b/libavcodec/h264_slice.c
+@@ -1092,6 +1092,12 @@ static int h264_init_ps(H264Context *h, const H264SliceContext *sl, int first_sl
+                 h->avctx->colorspace      = sps->colorspace;
+             }
+         }
++
++        if (h->sei.alternative_transfer.present &&
++            av_color_transfer_name(h->sei.alternative_transfer.preferred_transfer_characteristics) &&
++            h->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) {
++            h->avctx->color_trc = h->sei.alternative_transfer.preferred_transfer_characteristics;
++        }
+     }
+ 
+     if (!h->context_initialized || must_reinit || needs_reinit) {
+@@ -1332,12 +1338,6 @@ static int h264_export_frame_props(H264Context *h)
+         h->sei.picture_timing.timecode_cnt = 0;
+     }
+ 
+-    if (h->sei.alternative_transfer.present &&
+-        av_color_transfer_name(h->sei.alternative_transfer.preferred_transfer_characteristics) &&
+-        h->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) {
+-        h->avctx->color_trc = cur->f->color_trc = h->sei.alternative_transfer.preferred_transfer_characteristics;
+-    }
+-
+     return 0;
+ }
+ 
+-- 
+2.19.1.windows.1
+
diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index 4be6e7b485..f641b5b712 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -243,6 +243,7 @@ ifdef USE_FFMPEG
 	$(APPLY) $(SRC)/ffmpeg/h264_early_SAR.patch
 	$(APPLY) $(SRC)/ffmpeg/ffmpeg-mkv-overshoot.patch
 	$(APPLY) $(SRC)/ffmpeg/0001-avcodec-hevcdec-set-the-SEI-parameters-early-on-the-.patch
+	$(APPLY) $(SRC)/ffmpeg/0001-avcodec-h264_slice-set-the-SEI-parameters-early-on-t.patch
 endif
 ifdef USE_LIBAV
 	$(APPLY) $(SRC)/ffmpeg/libav_gsm.patch



More information about the vlc-commits mailing list