Skip to content

Commit

Permalink
--dolby-vision-rpuと--dhdr10-infoの併用に対応。
Browse files Browse the repository at this point in the history
  • Loading branch information
rigaya committed Nov 24, 2024
1 parent e5d2bf3 commit ed65d56
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
1 change: 1 addition & 0 deletions QSVEnc/QSVEnc_readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ API v1.1 … Intel Media SDK v2.0
- --dolby-vision-rpuをファイルから読む場合に壊してしまっていたのを修正。
- --vpp-libplacebo-debandのgrain_y, grain_cの読み取りが行われない問題を修正。
- --vpp-libplacebo-debandのgrain_cのヘルプを修正。
- --dolby-vision-rpuと--dhdr10-infoの併用に対応。

2024.11.22 (7.74)
- --dolby-vision-profileで対象外のプロファイルも読み込めていた問題を修正。
Expand Down
2 changes: 1 addition & 1 deletion QSVPipeline/qsv_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4160,7 +4160,7 @@ RGY_ERR CQSVPipeline::CreatePipeline() {
}
}
if (m_pmfxENC) {
m_pipelineTasks.push_back(std::make_unique<PipelineTaskMFXEncode>(&m_device->mfxSession(), 1, m_pmfxENC.get(), m_mfxVer, m_encParams, m_timecode.get(), m_encTimestamp.get(), m_outputTimebase, m_dynamicRC, m_hdr10plus.get(), m_hdr10plusMetadataCopy || m_dovirpuMetadataCopy, m_pQSVLog));
m_pipelineTasks.push_back(std::make_unique<PipelineTaskMFXEncode>(&m_device->mfxSession(), 1, m_pmfxENC.get(), m_mfxVer, m_encParams, m_timecode.get(), m_encTimestamp.get(), m_outputTimebase, m_dynamicRC, m_hdr10plus.get(), m_dovirpu.get(), m_pQSVLog));
} else {
m_pipelineTasks.push_back(std::make_unique<PipelineTaskOutputRaw>(&m_device->mfxSession(), 1, m_mfxVer, m_pQSVLog));
}
Expand Down
2 changes: 1 addition & 1 deletion QSVPipeline/qsv_pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class CQSVPipeline
std::unique_ptr<RGYHDRMetadata> m_hdrseiIn;
std::unique_ptr<RGYHDRMetadata> m_hdrseiOut;
std::unique_ptr<RGYHDR10Plus> m_hdr10plus;
bool m_hdr10plusMetadataCopy;
bool m_hdr10plusMetadataCopy;
std::unique_ptr<DOVIRpu> m_dovirpu;
bool m_dovirpuMetadataCopy;
RGYDOVIProfile m_doviProfile;
Expand Down
31 changes: 26 additions & 5 deletions QSVPipeline/qsv_pipeline_ctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1767,16 +1767,18 @@ class PipelineTaskMFXEncode : public PipelineTask {
std::vector<QSVRCParam>& m_dynamicRC;
int m_appliedDynamicRC;
RGYHDR10Plus *m_hdr10plus;
bool m_hdr10plusMetadataCopy;
const DOVIRpu *m_doviRpu;
encCtrlData m_encCtrlData;
public:
PipelineTaskMFXEncode(
MFXVideoSession *mfxSession, int outMaxQueueSize, MFXVideoENCODE *mfxencode, mfxVersion mfxVer, QSVVideoParam& encParams,
RGYTimecode *timecode, RGYTimestamp *encTimestamp, rgy_rational<int> outputTimebase, std::vector<QSVRCParam>& dynamicRC, RGYHDR10Plus *hdr10plus, bool hdr10plusMetadataCopy, std::shared_ptr<RGYLog> log)
RGYTimecode *timecode, RGYTimestamp *encTimestamp, rgy_rational<int> outputTimebase, std::vector<QSVRCParam>& dynamicRC,
RGYHDR10Plus *hdr10plus, const DOVIRpu *doviRpu, std::shared_ptr<RGYLog> log)
: PipelineTask(PipelineTaskType::MFXENCODE, outMaxQueueSize, mfxSession, mfxVer, log),
m_encode(mfxencode), m_timecode(timecode), m_encTimestamp(encTimestamp), m_encParams(encParams), m_outputTimebase(outputTimebase), m_bitStreamOut(),
m_baseRC(getRCParam(encParams)), m_dynamicRC(dynamicRC), m_appliedDynamicRC(-1),
m_hdr10plus(hdr10plus), m_hdr10plusMetadataCopy(hdr10plusMetadataCopy), m_encCtrlData() {
m_hdr10plus(hdr10plus), m_doviRpu(doviRpu),
m_encCtrlData() {
};
virtual ~PipelineTaskMFXEncode() {
m_outQeueue.clear(); // m_bitStreamOutが解放されるよう前にこちらを解放する
Expand Down Expand Up @@ -1907,12 +1909,31 @@ class PipelineTaskMFXEncode : public PipelineTask {

std::vector<std::shared_ptr<RGYFrameData>> metadatalist;
if (m_encParams.videoPrm.mfx.CodecId == MFX_CODEC_HEVC || m_encParams.videoPrm.mfx.CodecId == MFX_CODEC_AV1) {
if (frame) {
metadatalist = dynamic_cast<PipelineTaskOutputSurf *>(frame.get())->surf().frame()->dataList();
}
if (m_hdr10plus && frame) {
// 外部からHDR10+を読み込む場合、metadatalist 内のHDR10+の削除
for (auto it = metadatalist.begin(); it != metadatalist.end(); ) {
if ((*it)->dataType() == RGY_FRAME_DATA_HDR10PLUS) {
it = metadatalist.erase(it);
} else {
it++;
}
}
if (const auto data = m_hdr10plus->getData(m_inFrames); data.size() > 0) {
metadatalist.push_back(std::make_shared<RGYFrameDataHDR10plus>(data.data(), data.size(), dynamic_cast<PipelineTaskOutputSurf *>(frame.get())->surf().frame()->timestamp()));
}
} else if (m_hdr10plusMetadataCopy && frame) {
metadatalist = dynamic_cast<PipelineTaskOutputSurf *>(frame.get())->surf().frame()->dataList();
}
if (m_doviRpu) {
// 外部からdoviを読み込む場合、metadatalist 内のdovi rpuの削除
for (auto it = metadatalist.begin(); it != metadatalist.end(); ) {
if ((*it)->dataType() == RGY_FRAME_DATA_DOVIRPU) {
it = metadatalist.erase(it);
} else {
it++;
}
}
}
}

Expand Down

0 comments on commit ed65d56

Please sign in to comment.