Skip to content

Commit

Permalink
[Encode] AV1 Metadata enable
Browse files Browse the repository at this point in the history
av1 metadata enable ,including prepare and resolve metadata
  • Loading branch information
WangLy-ada authored and intel-mediadev committed Oct 17, 2023
1 parent b0c30c4 commit 38cce51
Show file tree
Hide file tree
Showing 10 changed files with 397 additions and 12 deletions.
76 changes: 76 additions & 0 deletions media_common/agnostic/common/codec/shared/codec_def_encode_av1.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,82 @@ struct EncodeAv1Par

};

struct MetadataAV1PostFeature
{
struct
{
uint64_t RowCount;
uint64_t ColCount;
uint64_t RowHeights[64];
uint64_t ColWidths[64];
uint64_t ContextUpdateTileId;
} tilePartition;

struct
{
uint64_t CompoundPredictionType;
struct
{
uint64_t LoopFilterLevel[2];
uint64_t LoopFilterLevelU;
uint64_t LoopFilterLevelV;
uint64_t LoopFilterSharpnessLevel;
uint64_t LoopFilterDeltaEnabled;
uint64_t UpdateRefDelta;
int64_t RefDeltas[8];
uint64_t UpdateModeDelta;
int64_t ModeDeltas[2];
} LoopFilter;
struct
{
uint64_t DeltaLFPresent;
uint64_t DeltaLFMulti;
uint64_t DeltaLFRes;
} LoopFilterDelta;
struct
{
uint64_t BaseQIndex;
int64_t YDCDeltaQ;
int64_t UDCDeltaQ;
int64_t UACDeltaQ;
int64_t VDCDeltaQ;
int64_t VACDeltaQ;
uint64_t UsingQMatrix;
uint64_t QMY;
uint64_t QMU;
uint64_t QMV;
} Quantization;
struct
{
uint64_t DeltaQPresent;
uint64_t DeltaQRes;
} QuantizationDelta;
struct
{
uint64_t CdefBits;
uint64_t CdefDampingMinus3;
uint64_t CdefYPriStrength[8];
uint64_t CdefUVPriStrength[8];
uint64_t CdefYSecStrength[8];
uint64_t CdefUVSecStrength[8];
} CDEF;
struct
{
uint64_t UpdateMap;
uint64_t TemporalUpdate;
uint64_t UpdateData;
uint64_t NumSegments;
struct
{
uint64_t EnabledFeatures;
int64_t FeatureValue[8];
} SegmentsData[8];
} SegmentationConfig;
uint64_t PrimaryRefFrame;
uint64_t ReferenceIndices[7];
} postFeature;
};

struct AV1MetaDataOffset
{
//tile partition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ MOS_STATUS EncodeAv1VdencPipelineAdapterXe_Hpm::Allocate(CodechalSetting *codecH

return m_encoder->Init(codecHalSettings);
}
MOS_STATUS EncodeAv1VdencPipelineAdapterXe_Hpm::ResolveMetaData(PMOS_RESOURCE pInput, PMOS_RESOURCE pOutput)
{
return m_encoder->ExecuteResolveMetaData(pInput, pOutput);
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class EncodeAv1VdencPipelineAdapterXe_Hpm : public EncodeAv1VdencPipelineAdapter
virtual ~EncodeAv1VdencPipelineAdapterXe_Hpm() {}

virtual MOS_STATUS Allocate(CodechalSetting *codecHalSettings) override;

virtual MOS_STATUS ResolveMetaData(PMOS_RESOURCE pInput, PMOS_RESOURCE pOutput) override;

MEDIA_CLASS_DEFINE_END(EncodeAv1VdencPipelineAdapterXe_Hpm)
};
#endif // !__ENCODE_AV1_VDENC_PIPELINE_ADAPTER_XE_HPM_H__
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ namespace encode

ENCODE_CHK_STATUS_RETURN(PatchTileLevelCommands(cmdBuffer, packetPhase));

ENCODE_CHK_STATUS_RETURN(PrepareHWMetaData(&cmdBuffer));

ENCODE_CHK_STATUS_RETURN(Mos_Solo_PostProcessEncode(m_osInterface, &m_basicFeature->m_resBitstreamBuffer, &m_basicFeature->m_reconSurface));

#if MHW_HWCMDPARSER_ENABLED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ MOS_STATUS Av1BasicFeature::Update(void *params)

EncodeBasicFeature::Update(params);

EncoderParams* encodeParams = (EncoderParams*)params;
EncoderParamsAV1 *encodeParams = (EncoderParamsAV1 *)params;

m_av1SeqParams = static_cast<PCODEC_AV1_ENCODE_SEQUENCE_PARAMS>(encodeParams->pSeqParams);
ENCODE_CHK_NULL_RETURN(m_av1SeqParams);
Expand All @@ -125,6 +125,7 @@ MOS_STATUS Av1BasicFeature::Update(void *params)
ENCODE_ASSERTMESSAGE("The num of OBU header exceeds the max value.");
return MOS_STATUS_USER_CONTROL_MAX_DATA_SIZE;
}
m_AV1metaDataOffset = encodeParams->AV1metaDataOffset;

m_appHdrSize = m_appHdrSizeExcludeFrameHdr = 0;
m_targetUsage = m_av1SeqParams->TargetUsage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class Av1BasicFeature : public EncodeBasicFeature, public mhw::vdbox::vdenc::Itf
PCODEC_AV1_ENCODE_PICTURE_PARAMS m_av1PicParams = nullptr; //!< Pointer to picture parameter
Av1ReferenceFrames m_ref = {}; //!< Reference List
Av1StreamIn m_streamIn = {}; //!< Stream In
AV1MetaDataOffset m_AV1metaDataOffset = {}; //!< AV1 Metadata Offset

uint32_t m_sizeOfSseSrcPixelRowStoreBufferPerLcu = 0; //!< Size of SSE row store buffer per LCU
static constexpr uint32_t m_vdencBrcStatsBufferSize = 1216; //!< Vdenc bitrate control buffer size
Expand Down
Loading

0 comments on commit 38cce51

Please sign in to comment.