You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

483 lines
18 KiB

/*
* Copyright (C) 2022 Rockchip Electronics Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_C2_RK_EXTEND_PARAMS_H
#define ANDROID_C2_RK_EXTEND_PARAMS_H
#include <C2Param.h>
#include <C2Config.h>
enum ExtendedC2ParamIndexKind : C2Param::type_index_t {
kParamIndexEncSceneMode = C2Param::TYPE_INDEX_VENDOR_START,
/* 1. Microsoft Teams Video Extension */
/* static capability queries */
kParamIndexMLVECDriVersion,
kParamIndexMLVECMaxLayerCount,
kParamIndexMLVECLowLatencyMode,
kParamIndexMLVECMaxLTRFrames,
kParamIndexMLVECPreOPSupport,
/* static configuration parameters */
kParamIndexMLVECProfileLvel,
kParamIndexMLVECSliceSpacing,
kParamIndexMLVECRateControl,
kParamIndexMLVECSetLTRFrames,
kParamIndexMLVECSetSarSize,
kParamIndexMLVECInputQueueCtl,
/* dynamic Configuration parameters */
kParamIndexMLVECLtrCtlMarkFrm,
kParamIndexMLVECLtrCtlUseFrm,
kParamIndexMLVECFrameQPCtl,
kParamIndexMLVECBaseLayerPID,
kParamIndexMLVECTriggerTime,
kParamIndexMLVECDownScalar,
kParamIndexMLVECInputCrop,
/* 2. Codec Decoder Extension */
kParamIndexDecDisableDpbCheck,
kParamIndexDecDisableErrorMark,
kParamIndexDecLowMemoryMode,
kParamIndexDecFbcDisable,
kParamIndexDecOutputCrop,
/* 3. Codec Encoder Extension */
kParamIndexEncSliceSize,
kParamIndexEncInputScaler,
kParamIndexEncSEModeSetting,
kParamIndexEncDisableSEI,
kParamIndexEncRoiRegionCfg,
kParamIndexEncRoiRegion2Cfg,
kParamIndexEncRoiRegion3Cfg,
kParamIndexEncRoiRegion4Cfg,
kParamIndexEncPreProcess,
kParamIndexEncSuperProcess,
};
typedef C2PortParam<C2Info, C2Int32Value, kParamIndexDecDisableDpbCheck> C2StreamDecDisableDpbCheck;
constexpr char C2_PARAMKEY_DEC_DISABLE_DPB_CHECK[] = "c2-dec-disable-dpb-check";
typedef C2PortParam<C2Info, C2Int32Value, kParamIndexDecDisableErrorMark> C2StreamDecDisableErrorMark;
constexpr char C2_PARAMKEY_DEC_DISABLE_ERROR_MARK[] = "c2-dec-disable-error-mark";
typedef C2PortParam<C2Info, C2Int32Value, kParamIndexDecLowMemoryMode> C2StreamDecLowMemoryMode;
constexpr char C2_PARAMKEY_DEC_LOW_MEMORY_MODE[] = "c2-dec-low-memory-mode";
typedef C2PortParam<C2Info, C2Int32Value, kParamIndexDecFbcDisable> C2StreamDecFbcDisable;
constexpr char C2_PARAMKEY_DEC_FBC_DISABLE[] = "c2-dec-fbc-disable";
typedef C2PortParam<C2Info, C2Int32Value, kParamIndexDecOutputCrop> C2StreamDecOutputCropEnable;
constexpr char C2_PARAMKEY_DEC_OUTPUT_CROP[] = "c2-dec-output-crop-enable";
typedef C2PortParam<C2Info, C2Int32Value, kParamIndexEncSceneMode> C2StreamEncSceneModeInfo;
constexpr char C2_PARAMKEY_ENC_SCENE_MODE[] = "c2-enc-scene-mode";
typedef C2PortParam<C2Info, C2Int32Value, kParamIndexEncSliceSize> C2StreamEncSliceSizeInfo;
constexpr char C2_PARAMKEY_ENC_SLICE_SIZE[] = "c2-enc-slice-size";
struct C2InputScalarStruct {
int32_t width;
int32_t height;
C2InputScalarStruct() : width(0), height(0) { }
C2InputScalarStruct(int32_t _width, int32_t _height) : width(_width), height(_height) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2InputScalarStruct, kParamIndexEncInputScaler> C2StreamEncInputScalar;
constexpr char C2_PARAMKEY_ENC_INPUT_SCALAR[] = "c2-enc-input-scalar";
/**
* Super Encoding Mode Setting
*
* - mode: SE Mode, support v1.0/3.0
* - bgDeltaQp: delta qp of background
* - fgDeltaQp: delta qp of foreground
* - mapMinQp: the min qp of that can be set
* - mapMaxQp: the max qp of that can be set
*/
struct C2SEModeSettingStruct {
int32_t mode;
int32_t bgDeltaQp;
int32_t fgDeltaQp;
int32_t mapMinQp;
int32_t mapMaxQp;
C2SEModeSettingStruct() : mode(0), bgDeltaQp(0), fgDeltaQp(0), mapMinQp(0), mapMaxQp(0) { }
C2SEModeSettingStruct(
int32_t _mode, int32_t _bgDeltaQp, int32_t _fgDeltaQp, int32_t _mapMinQp, int32_t _mapMaxQp) :
mode(_mode), bgDeltaQp(_bgDeltaQp), fgDeltaQp(_fgDeltaQp),
mapMinQp(_mapMinQp), mapMaxQp(_mapMaxQp) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2SEModeSettingStruct, kParamIndexEncSEModeSetting> C2StreamEncSEModeSetting;
constexpr char C2_PARAMKEY_ENC_SE_MODE_SETTING[] = "c2-enc-super-encoding";
typedef C2PortParam<C2Info, C2Int32Value, kParamIndexEncDisableSEI> C2StreamEncDisableSEI;
constexpr char C2_PARAMKEY_ENC_DISABLE_SEI[] = "c2-enc-disable-sei";
struct C2RoiRegionCfgStruct {
int32_t left; /**< horizontal position of top left corner */
int32_t right; /**< vertical position of top left corner */
int32_t width; /**< width of ROI rectangle */
int32_t height; /**< height of ROI rectangle */
int32_t forceIntra; /**< flag of forced intra macroblock */
int32_t qpMode; /**< 0 - relative qp 1 - absolute qp */
int32_t qpVal; /**< absolute / relative qp of macroblock */
C2RoiRegionCfgStruct() :
left(0), right(0), width(0), height(0), forceIntra(0), qpMode(0), qpVal(0) {}
C2RoiRegionCfgStruct(
int32_t _left, int32_t _right, int32_t _width, int32_t _height,
int32_t _forceIntra, int32_t _qpMode, int32_t _qpVal) :
left(_left), right(_right), width(_width), height(_height),
forceIntra(_forceIntra), qpMode(_qpMode), qpVal(_qpVal) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2RoiRegionCfgStruct, kParamIndexEncRoiRegionCfg> C2StreamEncRoiRegionCfg;
constexpr char C2_PARAMKEY_ENC_ROI_REGION_CFG[] = "c2-enc-roi-region-config";
typedef C2PortParam<C2Info, C2RoiRegionCfgStruct, kParamIndexEncRoiRegion2Cfg> C2StreamEncRoiRegion2Cfg;
constexpr char C2_PARAMKEY_ENC_ROI_REGION2_CFG[] = "c2-enc-roi-region2-config";
typedef C2PortParam<C2Info, C2RoiRegionCfgStruct, kParamIndexEncRoiRegion3Cfg> C2StreamEncRoiRegion3Cfg;
constexpr char C2_PARAMKEY_ENC_ROI_REGION3_CFG[] = "c2-enc-roi-region3-config";
typedef C2PortParam<C2Info, C2RoiRegionCfgStruct, kParamIndexEncRoiRegion4Cfg> C2StreamEncRoiRegion4Cfg;
constexpr char C2_PARAMKEY_ENC_ROI_REGION4_CFG[] = "c2-enc-roi-region4-config";
struct C2PreProcessStruct {
int32_t mirror;
int32_t flip;
C2PreProcessStruct() :
mirror(0), flip(0) {}
C2PreProcessStruct(int32_t _mirror, int32_t _flip) :
mirror(_mirror), flip(_flip) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2PreProcessStruct, kParamIndexEncPreProcess> C2StreamEncPreProcess;
constexpr char C2_PARAMKEY_ENC_PRE_PROCESS[] = "c2-enc-preprocess";
/*
* Large frame process of encoder
*
* Mode: 0 - close default
* 1 - drop large frame
* 2 - reenc large frame
* iThd: threshold of large frame of I frame, unit of measurement is kbps.
* pThd: threshold of large frame of P frame, unit of measurement is kbps.
* maxReencTime: valid when mode is 2, the maximum times of reenc
*/
struct C2SuperProcessStruct {
int32_t mode;
int32_t iThd;
int32_t pThd;
int32_t reencTimes;
C2SuperProcessStruct() :
mode(0), iThd(0), pThd(0), reencTimes(0) {}
C2SuperProcessStruct(int32_t _mode, int32_t _iThd, int32_t _pThd, int32_t _reencTimes) :
mode(_mode), iThd(_iThd), pThd(_pThd), reencTimes(_reencTimes) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2SuperProcessStruct, kParamIndexEncSuperProcess> C2StreamEncSuperProcess;
constexpr char C2_PARAMKEY_ENC_SUPER_PROCESS[] = "c2-enc-super-process";
/*
* 1. MLVEC hardware driver version
* key-name: vendor.rtc-ext-enc-caps-vt-driver-version.number
*/
struct C2NumberStruct {
int32_t number;
inline C2NumberStruct() : number(0) { }
inline C2NumberStruct(int32_t _number) : number(_number) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2NumberStruct, kParamIndexMLVECDriVersion> C2DriverVersion;
constexpr char C2_PARAMKEY_MLVEC_ENC_DRI_VERSION[] = "rtc-ext-enc-caps-vt-driver-version";
constexpr char C2_PARAMKEY_MLVEC_DEC_DRI_VERSION[] = "rtc-ext-dec-caps-vt-driver-version";
/*
* 2. the maximal number of support tsvc layer count
* key-name - vendor.rtc-ext-enc-caps-temporal-layers.max-p-count
*/
struct C2MaxLayersStruct {
int32_t count;
C2MaxLayersStruct() : count(0) { }
C2MaxLayersStruct(int32_t _count) : count(_count) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2MaxLayersStruct, kParamIndexMLVECMaxLayerCount> C2MaxLayerCount;
constexpr char C2_PARAMKEY_MLVEC_MAX_TEMPORAL_LAYERS[] = "rtc-ext-enc-caps-temporal-layers";
/*
* 3. enforces the encoder/decoder to run in low latency mode. When the value is
* TRUE, encoder must (1) enforce 1-in-1-out behavior, (2) generate bitstreams
* with syntax element.
* key-name - vendor.rtc-ext-enc-low-latency.enable
*/
struct C2ModeEnableStruct {
int32_t enable;
C2ModeEnableStruct() : enable(0) { }
C2ModeEnableStruct(int32_t _enable) : enable(_enable) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2ModeEnableStruct, kParamIndexMLVECLowLatencyMode> C2LowLatencyMode;
constexpr char C2_PARAMKEY_MLVEC_ENC_LOW_LATENCY_MODE[] = "rtc-ext-enc-low-latency";
constexpr char C2_PARAMKEY_MLVEC_DEC_LOW_LATENCY_MODE[] = "rtc-ext-dec-low-latency";
/*
* 4. MaxLTRFrames is the maximal number of LTR frames supported by the encoder.
* The value must be smaller than or equal to nMaxRefFrames and greater than
* or equal to 2
* key-name - vendor.rtc-ext-enc-caps-ltr.max-count
*/
struct C2MaxCntStruct {
int32_t count;
C2MaxCntStruct() : count(0) { }
C2MaxCntStruct(int32_t _count) : count(_count) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2MaxCntStruct, kParamIndexMLVECMaxLTRFrames> C2MaxLTRFramesCount;
constexpr char C2_PARAMKEY_MLVEC_MAX_LTR_FRAMES[] = "rtc-ext-enc-caps-ltr";
/*
* 5. - "Resize support" indicates what down scaling factors supported by the
* encoder when combined resizing with encoding is supported.
* key-name - vendor.rtc-ext-enc-caps-preprocess.max-downscale-factor
* - "Rotation support" indicates the encoder supports rotation or not.
* key-name - vendor.rtc-ext-enc-caps-preprocess.rotation
*/
struct C2PreOPStruct {
int32_t scale;
int32_t rotation;
C2PreOPStruct() : scale(0), rotation(0) { }
C2PreOPStruct(int32_t _scale, int32_t _rotation) : scale(_scale), rotation(_rotation) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2PreOPStruct, kParamIndexMLVECPreOPSupport> C2PreOPSupport;
constexpr char C2_PARAMKEY_MLVEC_PRE_OP[] = "rtc-ext-enc-caps-preprocess";
/*
* 6. profile and level
* key-name: vendor.rtc-ext-enc-custom-profile-level.profile(level)
*/
struct C2ProfileStruct {
int32_t profile;
int32_t level;
C2ProfileStruct() : profile(0), level(0) { }
C2ProfileStruct(int32_t _profile, int32_t _level) : profile(_profile), level(_level) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2ProfileStruct, kParamIndexMLVECProfileLvel> C2MProfileLevel;
constexpr char C2_PARAMKEY_MLVEC_PROFILE_LEVEL[] = "rtc-ext-enc-custom-profile-level";
/*
* 7. SliceHeaderSpacing indicates the number of MBs in a slice
* key-name: vendor.rtc-ext-enc-slice.spacing
*/
struct C2SpacingStruct {
int32_t spacing;
C2SpacingStruct() : spacing(0) { }
C2SpacingStruct(int32_t _spacing) : spacing(_spacing) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2SpacingStruct, kParamIndexMLVECSliceSpacing> C2SliceSpacing;
constexpr char C2_PARAMKEY_MLVEC_SLICE_SPACING[] = "rtc-ext-enc-slice";
/*
* 8. RateControl defines the encoding rate control mode, 0 means disable
* internal RC, and use constan QP set by app.
* key-name: vendor.rtc-ext-enc-bitrate-mode.value
*/
typedef C2PortParam<C2Info, C2Int32Value, kParamIndexMLVECRateControl> C2RateControl;
constexpr char C2_PARAMKEY_MLVEC_RATE_CONTROL[] = "rtc-ext-enc-bitrate-mode";
/*
* 9. LTRFrames is the number of LTR frames controlled by the application
* key-name: vendor.rtc-ext-enc-ltr-count.num-ltr-frames
*/
struct C2NumLTRFrmsStruct {
int32_t num;
C2NumLTRFrmsStruct() : num(0) { }
C2NumLTRFrmsStruct(int32_t _num) : num(_num) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2NumLTRFrmsStruct, kParamIndexMLVECSetLTRFrames> C2NumLTRFrms;
constexpr char C2_PARAMKEY_MLVEC_NUM_LTR_FRAMES[] = "rtc-ext-enc-ltr-count";
/*
* 10. SarWidth and SarHeight maps to SPS VUIsyntax element
* key-name: vendor.rtc-ext-enc-sar.width \ vendor.rtc-ext-enc-sar.height
*/
typedef C2PortParam<C2Info, C2PictureSizeStruct, kParamIndexMLVECSetSarSize> C2SarSize;
constexpr char C2_PARAMKEY_MLVEC_SET_SAR_SIZE[] = "rtc-ext-enc-sar";
/*
* 11. InputQueueControl
* key-name: vendor.rtc-ext-enc-app-input-control.enable
*/
typedef C2PortParam<C2Info, C2ModeEnableStruct, kParamIndexMLVECInputQueueCtl> C2InputQueuCtl;
constexpr char C2_PARAMKEY_MLVEC_INPUT_QUEUE_CTL[] = "rtc-ext-enc-app-input-control";
/*
* 12. long-term frames control: MarkLTR
* key-name: vendor.rtc-ext-enc-ltr.mark-frame
*/
struct C2LtrMarkStruct {
int32_t markFrame;
C2LtrMarkStruct() : markFrame(0) { }
C2LtrMarkStruct(int32_t _markFrame) : markFrame(_markFrame) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2LtrMarkStruct, kParamIndexMLVECLtrCtlMarkFrm> C2LtrCtlMark;
constexpr char C2_PARAMKEY_MLVEC_LTR_CTL_MARK[] = "rtc-ext-enc-ltr";
/*
* 13. long-term frames control: UseLTR
* key-name: vendor.rtc-ext-enc-ltr.use-frame
*/
struct C2LtrUseStruct {
int32_t useFrame;
C2LtrUseStruct() : useFrame(0) { }
C2LtrUseStruct(int32_t _useFrame) : useFrame(_useFrame) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2LtrUseStruct, kParamIndexMLVECLtrCtlUseFrm> C2LtrCtlUse;
constexpr char C2_PARAMKEY_MLVEC_LTR_CTL_USE[] = "rtc-ext-enc-ltr";
/*
* 14. FrameQP specifies the quantization parameter (QP) value of the next frame
* key-name: vendor.rtc-ext-enc-frame-qp.value
*/
typedef C2PortParam<C2Info, C2Int32Value, kParamIndexMLVECFrameQPCtl> C2FrameQPCtl;
constexpr char C2_PARAMKEY_MLVEC_FRAME_QP_CTL[] = "rtc-ext-enc-frame-qp";
/*
* 15. BaseLayerPID changes the value of H.264 syntax element priority_id of
* the base temporal layer(i.e.with temporal_id equal to 0), starting from
* the next base layer frame
* key-name: vendor.rtc-ext-enc-base-layer-pid.value
*/
typedef C2PortParam<C2Info, C2Int32Value, kParamIndexMLVECBaseLayerPID> C2BaseLayerPid;
constexpr char C2_PARAMKEY_MLVEC_BASE_LAYER_PID[] = "rtc-ext-enc-base-layer-pid";
/*
* 16. DynamicConfigurationTimestamp specifies timestamp of the frame which
* dynamic configuration should apply to.
* key-name: vendor.rtc-ext-enc-input-trigger.timestamp
*/
struct C2TimestampStruct {
int64_t timestamp;
C2TimestampStruct() : timestamp(0) { }
C2TimestampStruct(int64_t _timestamp) : timestamp(_timestamp) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2TimestampStruct, kParamIndexMLVECTriggerTime> C2TriggerTime;
constexpr char C2_PARAMKEY_MLVEC_TRIGGER_TIME[] = "rtc-ext-enc-input-trigger";
/*
* 17. DownScaleWidth & DownScaleHeight indicate the down scaled output resolution
* of encoder, if the encoder has the capability of internal resizing.
* key-name: vendor.rtc-ext-down-scalar.output-width(height)
*/
struct C2ScalarStruct {
int32_t width;
int32_t height;
C2ScalarStruct() : width(0), height(0) { }
C2ScalarStruct(int32_t _width, int32_t _height) : width(_width), height(_height) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2ScalarStruct, kParamIndexMLVECDownScalar> C2DownScalar;
constexpr char C2_PARAMKEY_MLVEC_DOWN_SCALAR[] = "rtc-ext-down-scalar";
/*
* 18. InputCrop in combination with input frame size and output bitstream resolution
* specify crop,scaling and combined crop/scaling operation
* key-name: vendor.rtc-ext-enc-input.crop-left
*/
struct C2CropStruct {
int32_t left;
int32_t right;
int32_t width;
int32_t height;
C2CropStruct() : left(0), right(0), width(0), height(0) { }
C2CropStruct(int32_t _left, int32_t _right, int32_t _width, int32_t _height)
: left(_left), right(_right), width(_width), height(_height) {}
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList();
};
typedef C2PortParam<C2Info, C2CropStruct, kParamIndexMLVECInputCrop> C2InputCrop;
constexpr char C2_PARAMKEY_MLVEC_INPUT_CROP[] = "rtc-ext-enc-input";
#endif // ANDROID_C2_RK_EXTEND_PARAMS_H