Skip to content

Commit

Permalink
[Encode] Refine av1 pipeline: status report parameters
Browse files Browse the repository at this point in the history
Refine duplicate code
  • Loading branch information
leyu-yao authored and intel-mediadev committed Aug 25, 2023
1 parent dac7c76 commit d9a78ff
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ MOS_STATUS Av1VdencPipelineXe_M_Base::Prepare(void *params)

ENCODE_CHK_STATUS_RETURN(Av1VdencPipeline::Prepare(params));

PCODEC_AV1_ENCODE_PICTURE_PARAMS picParams = static_cast<PCODEC_AV1_ENCODE_PICTURE_PARAMS>(encodeParams->pPicParams);
ENCODE_CHK_NULL_RETURN(picParams);

uint16_t numTileRows = 0;
uint16_t numTileColumns = 0;
RUN_FEATURE_INTERFACE_RETURN(Av1EncodeTile, Av1FeatureIDs::encodeTile, GetTileRowColumns,
Expand All @@ -97,25 +94,8 @@ MOS_STATUS Av1VdencPipelineXe_M_Base::Prepare(void *params)
ENCODE_CHK_STATUS_RETURN(SwitchContext(feature->m_outputChromaFormat, numTileRows, numTileColumns));

EncoderStatusParameters inputParameters = {};
MOS_ZeroMemory(&inputParameters, sizeof(EncoderStatusParameters));

inputParameters.statusReportFeedbackNumber = picParams->StatusReportFeedbackNumber;
inputParameters.codecFunction = encodeParams->ExecCodecFunction;
inputParameters.currRefList = feature->m_ref.GetCurrRefList();
inputParameters.picWidthInMb = feature->m_picWidthInMb;
inputParameters.frameFieldHeightInMb = feature->m_frameFieldHeightInMb;
inputParameters.currOriginalPic = feature->m_currOriginalPic;
inputParameters.pictureCodingType = feature->m_pictureCodingType;
inputParameters.numUsedVdbox = m_numVdbox;
inputParameters.hwWalker = false;
inputParameters.maxNumSlicesAllowed = 0;

inputParameters.numberTilesInFrame = numTileRows * numTileColumns;

inputParameters.av1EnableFrameObu = feature->m_av1PicParams->PicFlags.fields.EnableFrameOBU;
inputParameters.av1FrameHdrOBUSizeByteOffset = feature->m_frameHdrOBUSizeByteOffset;
inputParameters.frameWidth = feature->m_frameWidth;
inputParameters.frameHeight = feature->m_frameHeight;

ENCODE_CHK_STATUS_RETURN(FillStatusReportParameters(&inputParameters, encodeParams));

ENCODE_CHK_STATUS_RETURN(m_statusReport->Init(&inputParameters));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,35 +70,15 @@ MOS_STATUS Av1VdencPipelineXe_Lpm_Plus_Base::Prepare(void *params)

ENCODE_CHK_STATUS_RETURN(Av1VdencPipeline::Prepare(params));

PCODEC_AV1_ENCODE_PICTURE_PARAMS picParams = static_cast<PCODEC_AV1_ENCODE_PICTURE_PARAMS>(encodeParams->pPicParams);
ENCODE_CHK_NULL_RETURN(picParams);

uint16_t numTileRows = 0;
uint16_t numTileColumns = 0;
RUN_FEATURE_INTERFACE_RETURN(Av1EncodeTile, Av1FeatureIDs::encodeTile, GetTileRowColumns, numTileRows, numTileColumns);

ENCODE_CHK_STATUS_RETURN(SwitchContext(feature->m_outputChromaFormat, numTileRows, numTileColumns));

EncoderStatusParameters inputParameters = {};
MOS_ZeroMemory(&inputParameters, sizeof(EncoderStatusParameters));

inputParameters.statusReportFeedbackNumber = picParams->StatusReportFeedbackNumber;
inputParameters.codecFunction = encodeParams->ExecCodecFunction;
inputParameters.currRefList = feature->m_ref.GetCurrRefList();
inputParameters.picWidthInMb = feature->m_picWidthInMb;
inputParameters.frameFieldHeightInMb = feature->m_frameFieldHeightInMb;
inputParameters.currOriginalPic = feature->m_currOriginalPic;
inputParameters.pictureCodingType = feature->m_pictureCodingType;
inputParameters.numUsedVdbox = m_numVdbox;
inputParameters.hwWalker = false;
inputParameters.maxNumSlicesAllowed = 0;

inputParameters.numberTilesInFrame = numTileRows * numTileColumns;

inputParameters.av1EnableFrameObu = feature->m_av1PicParams->PicFlags.fields.EnableFrameOBU;
inputParameters.av1FrameHdrOBUSizeByteOffset = feature->m_frameHdrOBUSizeByteOffset;
inputParameters.frameWidth = feature->m_frameWidth;
inputParameters.frameHeight = feature->m_frameHeight;

ENCODE_CHK_STATUS_RETURN(FillStatusReportParameters(&inputParameters, encodeParams));

ENCODE_CHK_STATUS_RETURN(m_statusReport->Init(&inputParameters));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,42 @@ MOS_STATUS Av1VdencPipeline::SwitchContext(uint8_t outputChromaFormat, uint16_t

return MOS_STATUS_SUCCESS;
}

MOS_STATUS Av1VdencPipeline::FillStatusReportParameters(EncoderStatusParameters* pPar, EncoderParams* encodeParams)
{
ENCODE_CHK_NULL_RETURN(pPar);
ENCODE_CHK_NULL_RETURN(encodeParams);

PCODEC_AV1_ENCODE_PICTURE_PARAMS picParams = static_cast<PCODEC_AV1_ENCODE_PICTURE_PARAMS>(encodeParams->pPicParams);
ENCODE_CHK_NULL_RETURN(picParams);

auto feature = dynamic_cast<Av1BasicFeature *>(m_featureManager->GetFeature(Av1FeatureIDs::basicFeature));
ENCODE_CHK_NULL_RETURN(feature);

uint16_t numTileRows = 0;
uint16_t numTileColumns = 0;
RUN_FEATURE_INTERFACE_RETURN(Av1EncodeTile, Av1FeatureIDs::encodeTile, GetTileRowColumns,
numTileRows, numTileColumns);

pPar->statusReportFeedbackNumber = picParams->StatusReportFeedbackNumber;
pPar->codecFunction = encodeParams->ExecCodecFunction;
pPar->currRefList = feature->m_ref.GetCurrRefList();
pPar->picWidthInMb = feature->m_picWidthInMb;
pPar->frameFieldHeightInMb = feature->m_frameFieldHeightInMb;
pPar->currOriginalPic = feature->m_currOriginalPic;
pPar->pictureCodingType = feature->m_pictureCodingType;
pPar->numUsedVdbox = m_numVdbox;
pPar->hwWalker = false;
pPar->maxNumSlicesAllowed = 0;

pPar->numberTilesInFrame = numTileRows * numTileColumns;

pPar->av1EnableFrameObu = feature->m_av1PicParams->PicFlags.fields.EnableFrameOBU;
pPar->av1FrameHdrOBUSizeByteOffset = feature->m_frameHdrOBUSizeByteOffset;
pPar->frameWidth = feature->m_frameWidth;
pPar->frameHeight = feature->m_frameHeight;

return MOS_STATUS_SUCCESS;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Av1VdencPipeline : public encode::Av1Pipeline
virtual MOS_STATUS CreateFeatureManager() override;
virtual MOS_STATUS SwitchContext(uint8_t outputChromaFormat, uint16_t numTileRows, uint16_t numTileColumns);
virtual MOS_STATUS InitMmcState() = 0;
virtual MOS_STATUS FillStatusReportParameters(EncoderStatusParameters* pPar, EncoderParams* pEncPar);

MEDIA_CLASS_DEFINE_END(encode__Av1VdencPipeline)
};
Expand Down

0 comments on commit d9a78ff

Please sign in to comment.