summaryrefslogtreecommitdiff
path: root/libavcodec/libopenh264enc.c
diff options
context:
space:
mode:
authorJun Zhao <mypopydev@gmail.com>2023-04-18 17:08:52 +0800
committerJun Zhao <barryjzhao@tencent.com>2023-04-22 18:39:27 +0800
commitde5e2570f07ec1d801c739e13a98ec717899fb3f (patch)
tree8048011ee5cbe202ac9d275342c92178790cf393 /libavcodec/libopenh264enc.c
parent86645bf0a6b2a02b90bf0a17a14d7e750b1b9d40 (diff)
lavc/libopenh264: Support full range videos in transcoding
Support full range videos when transcoding, enabled the YUVJ420P to avoid auto scale from YUVJ420P to YUV420P Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Diffstat (limited to 'libavcodec/libopenh264enc.c')
-rw-r--r--libavcodec/libopenh264enc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 8b4755f5ba..cccc11fbb7 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -311,10 +311,12 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
#if OPENH264_VER_AT_LEAST(1, 6)
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;
if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED ||
avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
@@ -443,6 +445,7 @@ const FFCodec ff_libopenh264_encoder = {
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP |
FF_CODEC_CAP_AUTO_THREADS,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUVJ420P,
AV_PIX_FMT_NONE },
.defaults = svc_enc_defaults,
.p.priv_class = &class,