Skip to content

Commit 9d1a754

Browse files
committed
vcomp/lavc: videotoolbox_hevc: honor :subsampling opt
1 parent 5afa001 commit 9d1a754

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/video_compress/libavcodec.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#include "rtp/rtpdec_h264.h"
6666
#include "rtp/rtpenc_h264.h"
6767
#include "tv.h"
68+
#include "types.h" // for UYVY, RGBA, v210, RGB
6869
#include "ug_runtime_error.hpp"
6970
#include "utils/color_out.h"
7071
#include "utils/debug.h" // for debug_file_dump
@@ -2011,7 +2012,16 @@ configure_videotoolbox_hevc(AVCodecContext * /*codec_ctx*/,
20112012
if (param->lavc_opts.find("profile") == param->lavc_opts.end()) {
20122013
// enforce AV_PROFILE_HEVC_REXT, otherwise we will get Main10
20132014
// profile (10-bit 4:2:0) - even for UYVY
2014-
param->lavc_opts["profile"] = "rext";
2015+
const char *profile = "rext";
2016+
// but user may requested :subsampling=420 -> use main[10] :
2017+
if (av_pixfmt_get_subsampling(param->av_pix_fmt) == SUBS_420) {
2018+
profile = av_pix_fmt_desc_get(param->av_pix_fmt)
2019+
->comp[0]
2020+
.depth == DEPTH8
2021+
? "main"
2022+
: "main10";
2023+
}
2024+
param->lavc_opts["profile"] = profile;
20152025
}
20162026
}
20172027

0 commit comments

Comments
 (0)