diff mbox series

[FFmpeg-devel,2/2] lavc/libopenh264: refine the code

Message ID 20230418153351.2350679-2-mypopydev@gmail.com
State Accepted
Commit 73ddcad990e2c9c050df6b57509d11137e61eae4
Headers show
Series [FFmpeg-devel,1/2] lavc/libopenh264: Support full range videos in transcoding | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Jun Zhao April 18, 2023, 3:33 p.m. UTC
refine the code

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavcodec/libopenh264enc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index cccc11fbb7..3c605fe8ea 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -313,7 +313,6 @@  static av_cold int svc_encode_init(AVCodecContext *avctx)
     param.sSpatialLayers[0].uiVideoFormat = VF_UNDEF;
 
     if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED) {
-        param.sSpatialLayers[0].bVideoSignalTypePresent = true;
         param.sSpatialLayers[0].bFullRange = (avctx->color_range == AVCOL_RANGE_JPEG);
     }  else if (avctx->pix_fmt == AV_PIX_FMT_YUVJ420P)
         param.sSpatialLayers[0].bFullRange = 1;
@@ -321,7 +320,6 @@  static av_cold int svc_encode_init(AVCodecContext *avctx)
     if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED      ||
         avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
         avctx->color_trc != AVCOL_TRC_UNSPECIFIED) {
-        param.sSpatialLayers[0].bVideoSignalTypePresent = true;
         param.sSpatialLayers[0].bColorDescriptionPresent = true;
     }
 
@@ -331,6 +329,9 @@  static av_cold int svc_encode_init(AVCodecContext *avctx)
         param.sSpatialLayers[0].uiColorPrimaries = avctx->color_primaries;
     if (avctx->color_trc != AVCOL_TRC_UNSPECIFIED)
         param.sSpatialLayers[0].uiTransferCharacteristics = avctx->color_trc;
+
+    param.sSpatialLayers[0].bVideoSignalTypePresent =
+        (param.sSpatialLayers[0].bFullRange || param.sSpatialLayers[0].bColorDescriptionPresent);
 #endif
 
     if ((*s->encoder)->InitializeExt(s->encoder, &param) != cmResultSuccess) {