From b20b786945bad8fa5720a7b39fca275800a472bd Mon Sep 17 00:00:00 2001 From: jeffreymcallister Date: Tue, 19 Jul 2022 18:27:13 -0700 Subject: [PATCH] Fix AV1 temporal layers in SMT (#479) --- .../include/pipeline_transcode.h | 4 ++-- .../sample_multi_transcode/src/pipeline_transcode.cpp | 11 ++--------- .../sample_multi_transcode/src/transcode_utils.cpp | 4 ++-- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/tools/legacy/sample_multi_transcode/include/pipeline_transcode.h b/tools/legacy/sample_multi_transcode/include/pipeline_transcode.h index 4b9e48e8..0eaca923 100644 --- a/tools/legacy/sample_multi_transcode/include/pipeline_transcode.h +++ b/tools/legacy/sample_multi_transcode/include/pipeline_transcode.h @@ -337,8 +337,8 @@ struct __sInputParams { mfxU16 nBaseLayerPID; mfxU16 nAvcTemporalLayers[8]; #if defined(_WIN32) || defined(_WIN64) - mfxU16 nTemp; - mfxU16 nTemporalLayers[8]; + mfxU16 bTemporalLayers; + mfxTemporalLayer temporalLayers[8]; #endif mfxU16 nSPSId; mfxU16 nPPSId; diff --git a/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp b/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp index 88381dbd..8ccdb520 100644 --- a/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp +++ b/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp @@ -2755,19 +2755,12 @@ mfxStatus CTranscodingPipeline::InitEncMfxParams(sInputParams* pInParams) { } } #if defined(_WIN32) || defined(_WIN64) - if (pInParams->nTemp) { + if (pInParams->bTemporalLayers) { if (pInParams->EncodeId == MFX_CODEC_AV1) { auto tl = m_mfxEncParams.AddExtBuffer(); tl->BaseLayerPID = pInParams->nBaseLayerPID; tl->NumLayers = 8; - std::vector tmplayers; - tmplayers.reserve(8); - tl->Layers = &tmplayers[0]; - - for (int i = 0; i < 8; i++) { - tl->Layers[i] = {}; - tl->Layers[i].FrameRateScale = pInParams->nTemporalLayers[i]; - } + tl->Layers = pInParams->temporalLayers; } } #endif diff --git a/tools/legacy/sample_multi_transcode/src/transcode_utils.cpp b/tools/legacy/sample_multi_transcode/src/transcode_utils.cpp index edc4e8be..51825844 100644 --- a/tools/legacy/sample_multi_transcode/src/transcode_utils.cpp +++ b/tools/legacy/sample_multi_transcode/src/transcode_utils.cpp @@ -1367,7 +1367,7 @@ mfxStatus ParseAdditionalParams(msdk_char* argv[], } #if defined(_WIN32) || defined(_WIN64) else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-TemporalLayers"))) { - InputParams.nTemp = 1; + InputParams.bTemporalLayers = true; VAL_CHECK(i + 1 >= argc, i, argv[i]); mfxU16 arr[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; int j, k; @@ -1387,7 +1387,7 @@ mfxStatus ParseAdditionalParams(msdk_char* argv[], } for (j = 0; j < 8; j++) { - InputParams.nTemporalLayers[j] = arr[j]; + InputParams.temporalLayers[j].FrameRateScale = arr[j]; } i += 1; }