This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 113c1c06247d6ab2fa0b9b3d8392e583ac6c08c8
Author:     nyanmisaka <[email protected]>
AuthorDate: Fri Mar 27 15:51:57 2026 +0800
Commit:     ArazIusubov <[email protected]>
CommitDate: Tue Apr 7 14:54:21 2026 +0000

    avcodec/amfenc: let the HEVC encoder profile follow the target bit depth
    
    Previously, you could even set the Main profile for the P010 input and 
10-bit output.
    
    Signed-off-by: nyanmisaka <[email protected]>
---
 libavcodec/amfenc_hevc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index 42ed693e94..644cdb37a4 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -169,6 +169,7 @@ static av_cold int amf_encode_init_hevc(AVCodecContext 
*avctx)
     AMFEncoderContext  *ctx = avctx->priv_data;
     AMFVariantStruct    var = {0};
     amf_int64           profile = 0;
+    amf_int64           profile_from_bitdepth = 0;
     amf_int64           profile_level = 0;
     AMFBuffer          *buffer;
     AMFGuid             guid;
@@ -256,6 +257,17 @@ static av_cold int amf_encode_init_hevc(AVCodecContext 
*avctx)
     }
     AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, 
AMF_VIDEO_ENCODER_HEVC_COLOR_BIT_DEPTH, bit_depth);
 
+    // HEVC profile follows target bit depth
+    profile_from_bitdepth = bit_depth == AMF_COLOR_BIT_DEPTH_10 ? 
AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN_10
+                                                                : 
AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN;
+    if (profile != profile_from_bitdepth) {
+        AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, 
AMF_VIDEO_ENCODER_HEVC_PROFILE, profile_from_bitdepth);
+        if (profile != 0) {
+            av_log(avctx, AV_LOG_WARNING, "The video profile and bit depth did 
not match, but this has been corrected\n");
+        }
+    }
+    avctx->profile = bit_depth == AMF_COLOR_BIT_DEPTH_10 ? 
AV_PROFILE_HEVC_MAIN_10 : AV_PROFILE_HEVC_MAIN;
+
     // Color profile
     color_profile = av_amf_get_color_profile(avctx->color_range, 
avctx->colorspace);
     AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, 
AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PROFILE, color_profile);

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to