From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 8E71740C36 for ; Fri, 8 Jul 2022 07:21:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 431EC68B948; Fri, 8 Jul 2022 10:21:10 +0300 (EEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4568868B852 for ; Fri, 8 Jul 2022 10:21:03 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657264868; x=1688800868; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=LTIj5KZ7Khg9B/xr1Mg+eolujJe5IETHn5Q7u9T9zWw=; b=T7lu8YKYB37iMzf9aXqQW8DsZyYQxYPEehHm+R7EBvNxZUTGCVq2WdWm ppAEGuBXsjtpDgcbCaGd3j+f3N79a6YmTxDH1inv0th4TIIjmISyvoOWW A3LepE0QvgkKTsVt68RybB9TBbjpdYM83/2J2CRvOgNk7MOleCGeUW9ol 9/DvYwMvZCZJLCCncUps6HFzjX/mz4K03sCbBBV+5pBuHQ/g0BebHWTQd dW3dtjkVG0dKORgoDTVRyjZz5nRvCF1f4p/lZ2HRsd0CfusRFsMQHGBLP U+g+X6WLRqaEiai30TrV+SIxbcO4Anb8wxeufhwoTCYRD3qUNHEX543Nu Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10401"; a="285343076" X-IronPort-AV: E=Sophos;i="5.92,254,1650956400"; d="scan'208";a="285343076" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2022 00:20:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,254,1650956400"; d="scan'208";a="544108898" Received: from wenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.4]) by orsmga003.jf.intel.com with ESMTP; 08 Jul 2022 00:20:12 -0700 From: Wenbin Chen To: ffmpeg-devel@ffmpeg.org Date: Fri, 8 Jul 2022 15:14:51 +0800 Message-Id: <20220708071451.133523-1-wenbin.chen@intel.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] libavcodec/qsvenc: Change the parameter log to be thread safe X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Dividing one line log into several av_log() call is not thread safe. Now merge these strings into one av_log() call. Signed-off-by: Wenbin Chen --- libavcodec/qsvenc.c | 87 ++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 45 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 2382c2f5f7..5729292f94 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -182,6 +182,7 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, mfxExtCodingOption2 *co2 = NULL; mfxExtCodingOption3 *co3 = NULL; mfxExtHEVCTiles *exthevctiles = NULL; + const char *tmp_str = NULL; if (q->co2_idx > 0) co2 = (mfxExtCodingOption2*)coding_opts[q->co2_idx]; @@ -195,13 +196,12 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, av_log(avctx, AV_LOG_VERBOSE, "profile: %s; level: %"PRIu16"\n", print_profile(avctx->codec_id, info->CodecProfile), info->CodecLevel); - av_log(avctx, AV_LOG_VERBOSE, "GopPicSize: %"PRIu16"; GopRefDist: %"PRIu16"; GopOptFlag: ", - info->GopPicSize, info->GopRefDist); - if (info->GopOptFlag & MFX_GOP_CLOSED) - av_log(avctx, AV_LOG_VERBOSE, "closed "); - if (info->GopOptFlag & MFX_GOP_STRICT) - av_log(avctx, AV_LOG_VERBOSE, "strict "); - av_log(avctx, AV_LOG_VERBOSE, "; IdrInterval: %"PRIu16"\n", info->IdrInterval); + av_log(avctx, AV_LOG_VERBOSE, + "GopPicSize: %"PRIu16"; GopRefDist: %"PRIu16"; GopOptFlag:%s%s; IdrInterval: %"PRIu16"\n", + info->GopPicSize, info->GopRefDist, + info->GopOptFlag & MFX_GOP_CLOSED ? " closed" : "", + info->GopOptFlag & MFX_GOP_STRICT ? " strict" : "", + info->IdrInterval); av_log(avctx, AV_LOG_VERBOSE, "TargetUsage: %"PRIu16"; RateControlMethod: %s\n", info->TargetUsage, print_ratecontrol(info->RateControlMethod)); @@ -269,45 +269,46 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, av_log(avctx, AV_LOG_VERBOSE, "IntRefType: %"PRIu16"; IntRefCycleSize: %"PRIu16"; IntRefQPDelta: %"PRId16"\n", co2->IntRefType, co2->IntRefCycleSize, co2->IntRefQPDelta); - av_log(avctx, AV_LOG_VERBOSE, "MaxFrameSize: %d; ", co2->MaxFrameSize); - av_log(avctx, AV_LOG_VERBOSE, "MaxSliceSize: %d; ", co2->MaxSliceSize); - av_log(avctx, AV_LOG_VERBOSE, "\n"); + av_log(avctx, AV_LOG_VERBOSE, "MaxFrameSize: %d; MaxSliceSize: %d\n", + co2->MaxFrameSize, co2->MaxSliceSize); av_log(avctx, AV_LOG_VERBOSE, "BitrateLimit: %s; MBBRC: %s; ExtBRC: %s\n", print_threestate(co2->BitrateLimit), print_threestate(co2->MBBRC), print_threestate(co2->ExtBRC)); - av_log(avctx, AV_LOG_VERBOSE, "Trellis: "); if (co2->Trellis & MFX_TRELLIS_OFF) { - av_log(avctx, AV_LOG_VERBOSE, "off"); + av_log(avctx, AV_LOG_VERBOSE, "Trellis: off\n"); } else if (!co2->Trellis) { - av_log(avctx, AV_LOG_VERBOSE, "auto"); + av_log(avctx, AV_LOG_VERBOSE, "Trellis: auto\n"); } else { - if (co2->Trellis & MFX_TRELLIS_I) av_log(avctx, AV_LOG_VERBOSE, "I"); - if (co2->Trellis & MFX_TRELLIS_P) av_log(avctx, AV_LOG_VERBOSE, "P"); - if (co2->Trellis & MFX_TRELLIS_B) av_log(avctx, AV_LOG_VERBOSE, "B"); + char trellis_type[4]; + int i = 0; + if (co2->Trellis & MFX_TRELLIS_I) trellis_type[i++] = 'I'; + if (co2->Trellis & MFX_TRELLIS_P) trellis_type[i++] = 'P'; + if (co2->Trellis & MFX_TRELLIS_B) trellis_type[i++] = 'B'; + trellis_type[i] = 0; + av_log(avctx, AV_LOG_VERBOSE, "Trellis: %s\n", trellis_type); } - av_log(avctx, AV_LOG_VERBOSE, "\n"); - av_log(avctx, AV_LOG_VERBOSE, - "RepeatPPS: %s; NumMbPerSlice: %"PRIu16"; LookAheadDS: ", - print_threestate(co2->RepeatPPS), co2->NumMbPerSlice); switch (co2->LookAheadDS) { - case MFX_LOOKAHEAD_DS_OFF: av_log(avctx, AV_LOG_VERBOSE, "off"); break; - case MFX_LOOKAHEAD_DS_2x: av_log(avctx, AV_LOG_VERBOSE, "2x"); break; - case MFX_LOOKAHEAD_DS_4x: av_log(avctx, AV_LOG_VERBOSE, "4x"); break; - default: av_log(avctx, AV_LOG_VERBOSE, "unknown"); break; + case MFX_LOOKAHEAD_DS_OFF: tmp_str = "off"; break; + case MFX_LOOKAHEAD_DS_2x: tmp_str = "2x"; break; + case MFX_LOOKAHEAD_DS_4x: tmp_str = "4x"; break; + default: tmp_str = "unknown"; break; } - av_log(avctx, AV_LOG_VERBOSE, "\n"); + av_log(avctx, AV_LOG_VERBOSE, + "RepeatPPS: %s; NumMbPerSlice: %"PRIu16"; LookAheadDS: %s\n", + print_threestate(co2->RepeatPPS), co2->NumMbPerSlice, tmp_str); - av_log(avctx, AV_LOG_VERBOSE, "AdaptiveI: %s; AdaptiveB: %s; BRefType: ", - print_threestate(co2->AdaptiveI), print_threestate(co2->AdaptiveB)); switch (co2->BRefType) { - case MFX_B_REF_OFF: av_log(avctx, AV_LOG_VERBOSE, "off"); break; - case MFX_B_REF_PYRAMID: av_log(avctx, AV_LOG_VERBOSE, "pyramid"); break; - default: av_log(avctx, AV_LOG_VERBOSE, "auto"); break; + case MFX_B_REF_OFF: tmp_str = "off"; break; + case MFX_B_REF_PYRAMID: tmp_str = "pyramid"; break; + default: tmp_str = "auto"; break; } + av_log(avctx, AV_LOG_VERBOSE, + "AdaptiveI: %s; AdaptiveB: %s; BRefType:%s\n", + print_threestate(co2->AdaptiveI), print_threestate(co2->AdaptiveB), tmp_str); av_log(avctx, AV_LOG_VERBOSE, "MinQPI: %"PRIu8"; MaxQPI: %"PRIu8"; MinQPP: %"PRIu8"; MaxQPP: %"PRIu8"; MinQPB: %"PRIu8"; MaxQPB: %"PRIu8"\n", @@ -319,14 +320,12 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, if (info->RateControlMethod == MFX_RATECONTROL_QVBR) av_log(avctx, AV_LOG_VERBOSE, "QVBRQuality: %"PRIu16"\n", co3->QVBRQuality); - av_log(avctx, AV_LOG_VERBOSE, "PRefType: "); switch (co3->PRefType) { - case MFX_P_REF_DEFAULT: av_log(avctx, AV_LOG_VERBOSE, "default"); break; - case MFX_P_REF_SIMPLE: av_log(avctx, AV_LOG_VERBOSE, "simple"); break; - case MFX_P_REF_PYRAMID: av_log(avctx, AV_LOG_VERBOSE, "pyramid"); break; - default: av_log(avctx, AV_LOG_VERBOSE, "unknown"); break; + case MFX_P_REF_DEFAULT: av_log(avctx, AV_LOG_VERBOSE, "PRefType: default\n"); break; + case MFX_P_REF_SIMPLE: av_log(avctx, AV_LOG_VERBOSE, "PRefType: simple\n"); break; + case MFX_P_REF_PYRAMID: av_log(avctx, AV_LOG_VERBOSE, "PRefType: pyramid\n"); break; + default: av_log(avctx, AV_LOG_VERBOSE, "PRefType: unknown\n"); break; } - av_log(avctx, AV_LOG_VERBOSE, "\n"); if (avctx->codec_id == AV_CODEC_ID_HEVC) av_log(avctx, AV_LOG_VERBOSE,"GPB: %s\n", print_threestate(co3->GPB)); @@ -360,13 +359,12 @@ static void dump_video_vp9_param(AVCodecContext *avctx, QSVEncContext *q, av_log(avctx, AV_LOG_VERBOSE, "profile: %s \n", print_profile(avctx->codec_id, info->CodecProfile)); - av_log(avctx, AV_LOG_VERBOSE, "GopPicSize: %"PRIu16"; GopRefDist: %"PRIu16"; GopOptFlag: ", - info->GopPicSize, info->GopRefDist); - if (info->GopOptFlag & MFX_GOP_CLOSED) - av_log(avctx, AV_LOG_VERBOSE, "closed "); - if (info->GopOptFlag & MFX_GOP_STRICT) - av_log(avctx, AV_LOG_VERBOSE, "strict "); - av_log(avctx, AV_LOG_VERBOSE, "; IdrInterval: %"PRIu16"\n", info->IdrInterval); + av_log(avctx, AV_LOG_VERBOSE, + "GopPicSize: %"PRIu16"; GopRefDist: %"PRIu16"; GopOptFlag:%s%s; IdrInterval: %"PRIu16"\n", + info->GopPicSize, info->GopRefDist, + info->GopOptFlag & MFX_GOP_CLOSED ? " closed" : "", + info->GopOptFlag & MFX_GOP_STRICT ? " strict" : "", + info->IdrInterval); av_log(avctx, AV_LOG_VERBOSE, "TargetUsage: %"PRIu16"; RateControlMethod: %s\n", info->TargetUsage, print_ratecontrol(info->RateControlMethod)); @@ -396,8 +394,7 @@ static void dump_video_vp9_param(AVCodecContext *avctx, QSVEncContext *q, "IntRefType: %"PRIu16"; IntRefCycleSize: %"PRIu16"; IntRefQPDelta: %"PRId16"\n", co2->IntRefType, co2->IntRefCycleSize, co2->IntRefQPDelta); - av_log(avctx, AV_LOG_VERBOSE, "MaxFrameSize: %d; ", co2->MaxFrameSize); - av_log(avctx, AV_LOG_VERBOSE, "\n"); + av_log(avctx, AV_LOG_VERBOSE, "MaxFrameSize: %d\n", co2->MaxFrameSize); av_log(avctx, AV_LOG_VERBOSE, "BitrateLimit: %s; MBBRC: %s; ExtBRC: %s\n", -- 2.32.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".